Index: /ogre_src_v1-9-0/OgreMain/include/Android/OgreAPKFileSystemArchive.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Android/OgreAPKFileSystemArchive.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Android/OgreAPKFileSystemArchive.h	(revision 148)
@@ -0,0 +1,102 @@
+/*
+-----------------------------------------------------------------------------
+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 __APKFileSystemArchive_H__
+#define __APKFileSystemArchive_H__
+
+#include <OgreArchive.h>
+#include <OgreArchiveFactory.h>
+#include <android/asset_manager.h>
+
+namespace Ogre{	
+	class APKFileSystemArchive : public Archive
+	{
+	private:
+		AAssetManager* mAssetMgr;
+		String mPathPreFix;
+
+	public:
+		APKFileSystemArchive(const String& name, const String& archType, AAssetManager* assetMgr);
+        ~APKFileSystemArchive();
+
+        /// @copydoc Archive::isCaseSensitive
+        bool isCaseSensitive(void) const;
+
+        /// @copydoc Archive::load
+        void load();
+        /// @copydoc Archive::unload
+        void unload();
+
+        /// @copydoc Archive::open
+        DataStreamPtr open(const String& filename, bool readOnly = true) const;
+
+		/// @copydoc Archive::create
+		DataStreamPtr create(const String& filename) const;
+
+		/// @copydoc Archive::delete
+		void remove(const String& filename) const;
+
+		/// @copydoc Archive::list
+        StringVectorPtr list(bool recursive = true, bool dirs = false);
+
+        /// @copydoc Archive::listFileInfo
+        FileInfoListPtr listFileInfo(bool recursive = true, bool dirs = false);
+
+        /// @copydoc Archive::find
+        StringVectorPtr find(const String& pattern, bool recursive = true, bool dirs = false);
+
+        /// @copydoc Archive::findFileInfo
+        FileInfoListPtr findFileInfo(const String& pattern, bool recursive = true, bool dirs = false) const;
+
+        /// @copydoc Archive::exists
+        bool exists(const String& filename);
+
+		/// @copydoc Archive::getModifiedTime
+		time_t getModifiedTime(const String& filename);
+	};
+	
+	class APKFileSystemArchiveFactory : public ArchiveFactory
+    {
+    public:
+		APKFileSystemArchiveFactory(AAssetManager* assetMgr) : mAssetMgr(assetMgr) {}
+        virtual ~APKFileSystemArchiveFactory() {}
+        /// @copydoc FactoryObj::getType
+        const String& getType(void) const;
+        /// @copydoc FactoryObj::createInstance
+        Archive *createInstance( const String& name, bool readOnly ) 
+        {
+            return OGRE_NEW APKFileSystemArchive(name, getType(), mAssetMgr);
+        }
+        /// @copydoc FactoryObj::destroyInstance
+        void destroyInstance( Archive* arch) { OGRE_DELETE arch; }
+    private:
+        AAssetManager* mAssetMgr;
+    };
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/Android/OgreAPKZipArchive.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Android/OgreAPKZipArchive.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Android/OgreAPKZipArchive.h	(revision 148)
@@ -0,0 +1,68 @@
+/*
+-----------------------------------------------------------------------------
+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 __APKZipArchive_H__
+#define __APKZipArchive_H__
+
+#include <OgreZip.h>
+#include <OgreLogManager.h>
+#include <android/asset_manager.h>
+
+
+namespace Ogre{
+	class APKZipArchiveFactory : public EmbeddedZipArchiveFactory
+	{
+	protected:
+		AAssetManager* mAssetMgr;
+	public:
+		APKZipArchiveFactory(AAssetManager* assetMgr) : mAssetMgr(assetMgr) {}
+		virtual ~APKZipArchiveFactory() {}
+
+		/// @copydoc FactoryObj::getType
+		const String& getType(void) const;
+
+		/// @copydoc FactoryObj::createInstance
+		Archive *createInstance( const String& name, bool readOnly )
+		{
+			String apkName = name;
+	        if (apkName.size() > 0 && apkName[0] == '/')
+	        	apkName.erase(apkName.begin());
+
+			AAsset* asset = AAssetManager_open(mAssetMgr, apkName.c_str(), AASSET_MODE_BUFFER);
+			if(asset)
+			{
+				EmbeddedZipArchiveFactory::addEmbbeddedFile(apkName, (const Ogre::uint8*)AAsset_getBuffer(asset), AAsset_getLength(asset), 0);
+			}
+
+            ZipArchive * resZipArchive = OGRE_NEW ZipArchive(apkName, "APKZip", mPluginIo);
+            return resZipArchive;
+		}
+	};
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/Android/OgreAndroidLogListener.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Android/OgreAndroidLogListener.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Android/OgreAndroidLogListener.h	(revision 148)
@@ -0,0 +1,46 @@
+/*
+-----------------------------------------------------------------------------
+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 __AndroidLogListener_H__
+#define __AndroidLogListener_H__
+
+#include "OgreLog.h"
+
+namespace Ogre
+{
+    
+    class AndroidLogListener : public Ogre::LogListener, public Ogre::LogAlloc
+    {
+    public:
+        AndroidLogListener();
+	
+        virtual void messageLogged(const Ogre::String& message, Ogre::LogMessageLevel lml, bool maskDebug, const Ogre::String &logName, bool& skipThisMessage );
+    };
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/Android/OgreConfigDialogImp.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Android/OgreConfigDialogImp.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Android/OgreConfigDialogImp.h	(revision 148)
@@ -0,0 +1,57 @@
+/*
+-----------------------------------------------------------------------------
+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 __AndroidConfigDialog_H__
+#define __AndroidConfigDialog_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreRoot.h"
+#include "OgreRenderSystem.h"
+
+namespace Ogre
+{
+	class _OgreExport ConfigDialog : public UtilityAlloc
+	{
+	public:
+		ConfigDialog();
+		~ConfigDialog();
+	
+	public:
+		void initialise();
+		void run();
+		void cancel();
+
+		bool display();
+
+	protected:
+		RenderSystem* iSelectedRenderSystem;
+		bool		iDisplayStatus;		
+	};
+}
+
+#endif // __AndroidConfigDialog_H__
Index: /ogre_src_v1-9-0/OgreMain/include/Android/OgreErrorDialogImp.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Android/OgreErrorDialogImp.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Android/OgreErrorDialogImp.h	(revision 148)
@@ -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 __AndroidErrorDialog_H__
+#define __AndroidErrorDialog_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre
+{
+	/** Class for displaying the error dialog if Ogre fails badly. */
+	class _OgreExport ErrorDialog
+	{
+	public:
+		ErrorDialog();
+
+		/**
+		@remarks
+			Displays the error dialog.
+		@param
+			errorMessage The error message which has caused the failure.
+		@param
+			logName Optional name of the log to display in the detail pane.
+		*/
+		void display(const String& errorMessage, String logName = "");
+	};
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/Android/OgreTimerImp.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Android/OgreTimerImp.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Android/OgreTimerImp.h	(revision 148)
@@ -0,0 +1,78 @@
+/*
+-----------------------------------------------------------------------------
+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 __AndroidTimer_H__
+#define __AndroidTimer_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre
+{
+	/** Timer class */
+	class _OgreExport Timer : public TimerAlloc
+	{
+	private:
+		struct timeval start;
+		clock_t zeroClock;
+	public:
+		Timer();
+		~Timer();
+
+		/** Method for setting a specific option of the Timer. These options are usually
+            specific for a certain implementation of the Timer class, and may (and probably
+            will) not exist across different implementations.  reset() must be called after
+			all setOption() calls.
+            @param
+                strKey The name of the option to set
+            @param
+                pValue A pointer to the value - the size should be calculated by the timer
+                based on the key
+            @return
+                On success, true is returned.
+            @par
+                On failure, false is returned.
+        */
+        bool setOption( const String& strKey, const void* pValue ) { return false; }
+
+		/** Resets timer */
+		void reset();
+
+		/** Returns milliseconds since initialisation or last reset */
+		unsigned long getMilliseconds();
+
+		/** Returns microseconds since initialisation or last reset */
+		unsigned long getMicroseconds();
+
+		/** Returns milliseconds since initialisation or last reset, only CPU time measured */	
+		unsigned long getMillisecondsCPU();
+
+		/** Returns microseconds since initialisation or last reset, only CPU time measured */	
+		unsigned long getMicrosecondsCPU();
+	};
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/FlashCC/OgreConfigDialogImp.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/FlashCC/OgreConfigDialogImp.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/FlashCC/OgreConfigDialogImp.h	(revision 148)
@@ -0,0 +1,57 @@
+/*
+-----------------------------------------------------------------------------
+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 __FlashCCConfigDialog_H__
+#define __FlashCCConfigDialog_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreRoot.h"
+#include "OgreRenderSystem.h"
+
+namespace Ogre
+{
+	class _OgreExport ConfigDialog : public UtilityAlloc
+	{
+	public:
+		ConfigDialog();
+		~ConfigDialog();
+	
+	public:
+		void initialise();
+		void run();
+		void cancel();
+
+		bool display();
+
+	protected:
+		RenderSystem* iSelectedRenderSystem;
+		bool		iDisplayStatus;		
+	};
+}
+
+#endif // __AndroidConfigDialog_H__
Index: /ogre_src_v1-9-0/OgreMain/include/FlashCC/OgreTimerImp.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/FlashCC/OgreTimerImp.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/FlashCC/OgreTimerImp.h	(revision 148)
@@ -0,0 +1,78 @@
+/*
+-----------------------------------------------------------------------------
+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 __FlashCCTimer_H__
+#define __FlashCCTimer_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre
+{
+	/** Timer class */
+	class _OgreExport Timer : public TimerAlloc
+	{
+	private:
+		struct timeval start;
+		clock_t zeroClock;
+	public:
+		Timer();
+		~Timer();
+
+		/** Method for setting a specific option of the Timer. These options are usually
+            specific for a certain implementation of the Timer class, and may (and probably
+            will) not exist across different implementations.  reset() must be called after
+			all setOption() calls.
+            @param
+                strKey The name of the option to set
+            @param
+                pValue A pointer to the value - the size should be calculated by the timer
+                based on the key
+            @return
+                On success, true is returned.
+            @par
+                On failure, false is returned.
+        */
+        bool setOption( const String& strKey, const void* pValue ) { return false; }
+
+		/** Resets timer */
+		void reset();
+
+		/** Returns milliseconds since initialisation or last reset */
+		unsigned long getMilliseconds();
+
+		/** Returns microseconds since initialisation or last reset */
+		unsigned long getMicroseconds();
+
+		/** Returns milliseconds since initialisation or last reset, only CPU time measured */	
+		unsigned long getMillisecondsCPU();
+
+		/** Returns microseconds since initialisation or last reset, only CPU time measured */	
+		unsigned long getMicrosecondsCPU();
+	};
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/GLX/OgreConfigDialogImp.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/GLX/OgreConfigDialogImp.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/GLX/OgreConfigDialogImp.h	(revision 148)
@@ -0,0 +1,75 @@
+/*
+-----------------------------------------------------------------------------
+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 __GLXCONFIGDIALOG_H__
+#define __GLXCONFIGDIALOG_H__
+
+#include "../OgrePrerequisites.h"
+#include "../OgreRoot.h"
+#include "../OgreRenderSystem.h"
+
+namespace Ogre
+{
+	/** Defines the behaviour of an automatic renderer configuration dialog.
+	@remarks
+		OGRE comes with it's own renderer configuration dialog, which
+		applications can use to easily allow the user to configure the
+		settings appropriate to their machine. This class defines the
+		interface to this standard dialog. Because dialogs are inherently
+		tied to a particular platform's windowing system, there will be a
+		different subclass for each platform.
+	@author
+		Steven J. Streeting
+	*/
+	class _OgreExport ConfigDialog : public UtilityAlloc
+	{
+	public:
+		ConfigDialog();
+
+		/** Displays the dialog.
+		@remarks
+			This method displays the dialog and from then on the dialog
+			interacts with the user independently. The dialog will be
+			calling the relevant OGRE rendering systems to query them for
+			options and to set the options the user selects. The method
+			returns when the user closes the dialog.
+		@returns
+			If the user accepted the dialog, <b>true</b> is returned.
+		@par
+			If the user cancelled the dialog (indicating the application
+			should probably terminate), <b>false</b> is returned.
+		@see
+			RenderSystem
+		*/
+		bool display();
+
+	protected:
+		RenderSystem* mSelectedRenderSystem;
+	};
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/GLX/OgreErrorDialogImp.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/GLX/OgreErrorDialogImp.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/GLX/OgreErrorDialogImp.h	(revision 148)
@@ -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 __OGRE_GLX_ERROR_DIALOG_H__
+#define __OGRE_GLX_ERROR_DIALOG_H__
+
+#include "../OgrePrerequisites.h"
+
+namespace Ogre
+{
+	/** Class for displaying the error dialog if Ogre fails badly. */
+	class _OgreExport ErrorDialog
+	{
+	public:
+		ErrorDialog();
+
+		/**
+		@remarks
+			Displays the error dialog.
+		@param
+			errorMessage The error message which has caused the failure.
+		@param
+			logName Optional name of the log to display in the detail pane.
+		*/
+		void display(const String& errorMessage, String logName = "");
+	};
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/GLX/OgreTimerImp.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/GLX/OgreTimerImp.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/GLX/OgreTimerImp.h	(revision 148)
@@ -0,0 +1,79 @@
+/*
+-----------------------------------------------------------------------------
+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 __GLXTimer_H__
+#define __GLXTimer_H__
+
+#include "../OgrePrerequisites.h"
+
+namespace Ogre
+{
+	/** Timer class */
+	class _OgreExport Timer : public TimerAlloc
+	{
+	private:
+		struct timeval start;
+		clock_t zeroClock;
+	public:
+		Timer();
+		~Timer();
+
+		/** Method for setting a specific option of the Timer. These options are usually
+            specific for a certain implementation of the Timer class, and may (and probably
+            will) not exist across different implementations.  reset() must be called after
+			all setOption() calls.
+            @param
+                strKey The name of the option to set
+            @param
+                pValue A pointer to the value - the size should be calculated by the timer
+                based on the key
+            @return
+                On success, true is returned.
+            @par
+                On failure, false is returned.
+        */
+        bool setOption( const String& strKey, const void* pValue )
+        { (void)strKey; (void)pValue; return false; }
+
+		/** Resets timer */
+		void reset();
+
+		/** Returns milliseconds since initialisation or last reset */
+		unsigned long getMilliseconds();
+
+		/** Returns microseconds since initialisation or last reset */
+		unsigned long getMicroseconds();
+
+		/** Returns milliseconds since initialisation or last reset, only CPU time measured */	
+		unsigned long getMillisecondsCPU();
+
+		/** Returns microseconds since initialisation or last reset, only CPU time measured */	
+		unsigned long getMicrosecondsCPU();
+	};
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/NaCl/OgreConfigDialogImp.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/NaCl/OgreConfigDialogImp.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/NaCl/OgreConfigDialogImp.h	(revision 148)
@@ -0,0 +1,75 @@
+/*
+-----------------------------------------------------------------------------
+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 __OGRE_NACL_CONFIG_DIALOG_H__
+#define __OGRE_NACL_CONFIG_DIALOG_H__
+
+#include "../OgrePrerequisites.h"
+#include "../OgreRoot.h"
+#include "../OgreRenderSystem.h"
+
+namespace Ogre
+{
+	/** Defines the behaviour of an automatic renderer configuration dialog.
+	@remarks
+		OGRE comes with it's own renderer configuration dialog, which
+		applications can use to easily allow the user to configure the
+		settings appropriate to their machine. This class defines the
+		interface to this standard dialog. Because dialogs are inherently
+		tied to a particular platform's windowing system, there will be a
+		different subclass for each platform.
+	@author
+		Steven J. Streeting
+	*/
+	class _OgreExport ConfigDialog : public UtilityAlloc
+	{
+	public:
+		ConfigDialog();
+
+		/** Displays the dialog.
+		@remarks
+			This method displays the dialog and from then on the dialog
+			interacts with the user independently. The dialog will be
+			calling the relevant OGRE rendering systems to query them for
+			options and to set the options the user selects. The method
+			returns when the user closes the dialog.
+		@returns
+			If the user accepted the dialog, <b>true</b> is returned.
+		@par
+			If the user cancelled the dialog (indicating the application
+			should probably terminate), <b>false</b> is returned.
+		@see
+			RenderSystem
+		*/
+		bool display();
+
+	protected:
+		RenderSystem* mSelectedRenderSystem;
+	};
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/NaCl/OgreErrorDialogImp.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/NaCl/OgreErrorDialogImp.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/NaCl/OgreErrorDialogImp.h	(revision 148)
@@ -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 __OGRE_NACL_ERROR_DIALOG_H__
+#define __OGRE_NACL_ERROR_DIALOG_H__
+
+#include "../OgrePrerequisites.h"
+
+namespace Ogre
+{
+	/** Class for displaying the error dialog if Ogre fails badly. */
+	class _OgreExport ErrorDialog
+	{
+	public:
+		ErrorDialog();
+
+		/**
+		@remarks
+			Displays the error dialog.
+		@param
+			errorMessage The error message which has caused the failure.
+		@param
+			logName Optional name of the log to display in the detail pane.
+		*/
+		void display(const String& errorMessage, String logName = "");
+	};
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/NaCl/OgreTimerImp.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/NaCl/OgreTimerImp.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/NaCl/OgreTimerImp.h	(revision 148)
@@ -0,0 +1,83 @@
+/*
+-----------------------------------------------------------------------------
+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 __OGRE_NACL_TIMER_H__
+#define __OGRE_NACL_TIMER_H__
+
+#include "../OgrePrerequisites.h"
+
+#if OGRE_PLATFORM == OGRE_PLATFORM_NACL
+    #include <sys/time.h>
+#endif
+
+namespace Ogre
+{
+	/** Timer class */
+	class _OgreExport Timer : public TimerAlloc
+	{
+	private:
+		struct timeval start;
+		clock_t zeroClock;
+	public:
+		Timer();
+		~Timer();
+
+		/** Method for setting a specific option of the Timer. These options are usually
+            specific for a certain implementation of the Timer class, and may (and probably
+            will) not exist across different implementations.  reset() must be called after
+			all setOption() calls.
+            @param
+                strKey The name of the option to set
+            @param
+                pValue A pointer to the value - the size should be calculated by the timer
+                based on the key
+            @return
+                On success, true is returned.
+            @par
+                On failure, false is returned.
+        */
+        bool setOption( const String& strKey, const void* pValue )
+        { (void)strKey; (void)pValue; return false; }
+
+		/** Resets timer */
+		void reset();
+
+		/** Returns milliseconds since initialisation or last reset */
+		unsigned long getMilliseconds();
+
+		/** Returns microseconds since initialisation or last reset */
+		unsigned long getMicroseconds();
+
+		/** Returns milliseconds since initialisation or last reset, only CPU time measured */	
+		unsigned long getMillisecondsCPU();
+
+		/** Returns microseconds since initialisation or last reset, only CPU time measured */	
+		unsigned long getMicrosecondsCPU();
+	};
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OSX/OgreConfigDialogImp.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OSX/OgreConfigDialogImp.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OSX/OgreConfigDialogImp.h	(revision 148)
@@ -0,0 +1,99 @@
+/*
+-----------------------------------------------------------------------------
+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 __OSXConfigDialog_H__
+#define __OSXConfigDialog_H__
+
+#include "../OgrePrerequisites.h"
+#include "../OgreRoot.h"
+#include "../OgreRenderSystem.h"
+#include "../OgreConfigOptionMap.h"
+
+#ifdef __OBJC__
+#import <Cocoa/Cocoa.h>
+#import <AppKit/AppKit.h>
+
+#if defined(MAC_OS_X_VERSION_10_6) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
+@interface OgreConfigWindowDelegate : NSObject <NSWindowDelegate, NSTableViewDelegate, NSTableViewDataSource>
+#else
+@interface OgreConfigWindowDelegate : NSObject
+#endif
+{
+    NSWindow *mConfigWindow;
+    NSImageView *mOgreLogo;
+    NSPopUpButton *mRenderSystemsPopUp;
+    NSPopUpButton *mOptionsPopUp;
+    NSTableView *mOptionsTable;
+    NSButton *mOkButton;
+    NSButton *mCancelButton;
+    NSTextField *mOptionLabel;
+    
+    NSDictionary *mOptions;
+}
+
+- (void)cancelButtonPressed:(id)sender;
+- (void)okButtonPressed:(id)sender;
+- (void)popUpValueChanged:(id)sender;
+
+// Getters and setters
+- (void)setOptions:(NSDictionary *)dict;
+- (NSDictionary *)getOptions;
+- (void)setRenderSystemsPopUp:(NSPopUpButton *)button;
+- (NSPopUpButton *)getRenderSystemsPopUp;
+- (void)setOgreLogo:(NSImageView *)image;
+- (NSImageView *)getOgreLogo;
+- (void)setConfigWindow:(NSWindow *)window;
+- (NSWindow *)getConfigWindow;
+- (void)setOptionsTable:(NSTableView *)table;
+- (NSTableView *)getOptionsTable;
+- (void)setOptionsPopUp:(NSPopUpButton *)button;
+- (NSPopUpButton *)getOptionsPopUp;
+
+@end
+#endif
+
+namespace Ogre
+{
+	class _OgreExport ConfigDialog : public UtilityAlloc
+	{
+	public:
+		ConfigDialog();
+		~ConfigDialog();
+	
+		void initialise();
+		bool display();
+
+	protected:
+#ifdef __OBJC__
+        OgreConfigWindowDelegate *mWindowDelegate;
+#endif
+		RenderSystem *mSelectedRenderSystem;
+	};
+}
+
+#endif // __OSX_CONFIG_DIALOG_H__
Index: /ogre_src_v1-9-0/OgreMain/include/OSX/OgreErrorDialogImp.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OSX/OgreErrorDialogImp.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OSX/OgreErrorDialogImp.h	(revision 148)
@@ -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 __OSXErrorDialog_H__
+#define __OSXErrorDialog_H__
+
+#include "../OgrePrerequisites.h"
+
+namespace Ogre
+{
+	/** Class for displaying the error dialog if Ogre fails badly. */
+	class _OgreExport ErrorDialog
+	{
+	public:
+		ErrorDialog();
+
+		/**
+		@remarks
+			Displays the error dialog.
+		@param
+			errorMessage The error message which has caused the failure.
+		@param
+			logName Optional name of the log to display in the detail pane.
+		*/
+		void display(const String& errorMessage, String logName = "");
+	};
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OSX/OgreTimerImp.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OSX/OgreTimerImp.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OSX/OgreTimerImp.h	(revision 148)
@@ -0,0 +1,78 @@
+/*
+-----------------------------------------------------------------------------
+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 __OSXTimer_H__
+#define __OSXTimer_H__
+
+#include "../OgrePrerequisites.h"
+
+namespace Ogre
+{
+	/** Timer class */
+	class _OgreExport Timer : public TimerAlloc
+	{
+	private:
+		struct timeval start;
+		clock_t zeroClock;
+	public:
+		Timer();
+		~Timer();
+
+		/** Method for setting a specific option of the Timer. These options are usually
+            specific for a certain implementation of the Timer class, and may (and probably
+            will) not exist across different implementations.  reset() must be called after
+			all setOption() calls.
+            @param
+                strKey The name of the option to set
+            @param
+                pValue A pointer to the value - the size should be calculated by the timer
+                based on the key
+            @return
+                On success, true is returned.
+            @par
+                On failure, false is returned.
+        */
+        bool setOption( const String& strKey, const void* pValue ) { return false; }
+
+		/** Resets timer */
+		void reset();
+
+		/** Returns milliseconds since initialisation or last reset */
+		unsigned long getMilliseconds();
+
+		/** Returns microseconds since initialisation or last reset */
+		unsigned long getMicroseconds();
+
+		/** Returns milliseconds since initialisation or last reset, only CPU time measured */	
+		unsigned long getMillisecondsCPU();
+
+		/** Returns microseconds since initialisation or last reset, only CPU time measured */	
+		unsigned long getMicrosecondsCPU();
+	};
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OSX/Ogre_Prefix.pch
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OSX/Ogre_Prefix.pch	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OSX/Ogre_Prefix.pch	(revision 148)
@@ -0,0 +1,6 @@
+#ifdef __OBJC__
+#   include <Cocoa/Cocoa.h>
+#endif
+#include <Carbon/Carbon.h>
+
+#include <OgreStableHeaders.h>
Index: /ogre_src_v1-9-0/OgreMain/include/OSX/macUtils.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OSX/macUtils.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OSX/macUtils.h	(revision 148)
@@ -0,0 +1,43 @@
+/*
+-----------------------------------------------------------------------------
+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 <CoreFoundation/CoreFoundation.h>
+#include "../OgrePrerequisites.h"
+
+namespace Ogre {
+
+    CFBundleRef mac_loadExeBundle(const char *path);
+    void * mac_getBundleSym(CFBundleRef bundle, const char *name);
+    bool mac_unloadExeBundle(CFBundleRef bundle);
+    void* mac_loadDylib(const char* name);
+    void* mac_loadFramework(String name);
+    _OgreExport String macPluginPath();
+    _OgreExport String macBundlePath();
+    _OgreExport String macFrameworksPath();
+    _OgreExport String macCachePath();
+    _OgreExport String macTempFileName(void);
+}
Index: /ogre_src_v1-9-0/OgreMain/include/OSX/nib/config.nib/classes.nib
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OSX/nib/config.nib/classes.nib	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OSX/nib/config.nib/classes.nib	(revision 148)
@@ -0,0 +1,19 @@
+{
+    IBClasses = (
+        {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 
+        {
+            ACTIONS = {cancelClicked = id; okClicked = id; }; 
+            CLASS = OgreConfigWindowController; 
+            LANGUAGE = ObjC; 
+            OUTLETS = {
+                messageTextField = id; 
+                optionsPopUp = id; 
+                optionsTableView = id; 
+                renderSystemPopup = id; 
+            }; 
+            SUPERCLASS = NSWindowController; 
+        }, 
+        {CLASS = myTableViewController; LANGUAGE = ObjC; SUPERCLASS = NSObject; }
+    ); 
+    IBVersion = 1; 
+}
Index: /ogre_src_v1-9-0/OgreMain/include/OSX/nib/config.nib/info.nib
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OSX/nib/config.nib/info.nib	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OSX/nib/config.nib/info.nib	(revision 148)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>IBDocumentLocation</key>
+	<string>905 258 904 456 0 0 1920 1178 </string>
+	<key>IBFramework Version</key>
+	<string>446.1</string>
+	<key>IBLockedObjects</key>
+	<array>
+		<integer>5</integer>
+	</array>
+	<key>IBOpenObjects</key>
+	<array>
+		<integer>5</integer>
+	</array>
+	<key>IBSystem Version</key>
+	<string>8J135</string>
+</dict>
+</plist>
Index: /ogre_src_v1-9-0/OgreMain/include/OSX/nib/main.nib/classes.nib
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OSX/nib/main.nib/classes.nib	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OSX/nib/main.nib/classes.nib	(revision 148)
@@ -0,0 +1,4 @@
+{
+IBClasses = ();
+IBVersion = 1;
+}
Index: /ogre_src_v1-9-0/OgreMain/include/OSX/nib/main.nib/info.nib
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OSX/nib/main.nib/info.nib	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OSX/nib/main.nib/info.nib	(revision 148)
@@ -0,0 +1,31 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+	<key>IBDocumentLocation</key>
+	<string>406 71 356 240 0 0 1280 778 </string>
+	<key>IBEditorPositions</key>
+	<dict>
+		<key>29</key>
+		<string>38 274 84 44 0 0 1280 778 </string>
+	</dict>
+	<key>IBFramework Version</key>
+	<string>446.1</string>
+	<key>IBLockedObjects</key>
+	<array>
+		<integer>201</integer>
+	</array>
+	<key>IBOldestOS</key>
+	<integer>3</integer>
+	<key>IBOpenObjects</key>
+	<array>
+		<integer>29</integer>
+		<integer>166</integer>
+		<integer>279</integer>
+	</array>
+	<key>IBSystem Version</key>
+	<string>8J2135a</string>
+	<key>targetFramework</key>
+	<string>IBCarbonFramework</string>
+</dict>
+</plist>
Index: /ogre_src_v1-9-0/OgreMain/include/OSX/nib/main.nib/objects.xib
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OSX/nib/main.nib/objects.xib	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OSX/nib/main.nib/objects.xib	(revision 148)
@@ -0,0 +1,329 @@
+<?xml version="1.0" standalone="yes"?>
+<object class="NSIBObjectData">
+  <string name="targetFramework">IBCarbonFramework</string>
+  <object name="rootObject" class="NSCustomObject" id="1">
+    <string name="customClass">NSApplication</string>
+  </object>
+  <array count="40" name="allObjects">
+    <object class="IBCarbonMenu" id="29">
+      <string name="title">main</string>
+      <array count="1" name="items">
+        <object class="IBCarbonMenuItem" id="185">
+          <string name="title">Ogre3D</string>
+          <object name="submenu" class="IBCarbonMenu" id="184">
+            <string name="title">Ogre3D</string>
+            <array count="1" name="items">
+              <object class="IBCarbonMenuItem" id="187">
+                <string name="title">About Ogre3D</string>
+                <int name="keyEquivalentModifier">0</int>
+                <ostype name="command">abou</ostype>
+              </object>
+            </array>
+            <string name="name">_NSAppleMenu</string>
+          </object>
+        </object>
+      </array>
+      <string name="name">_NSMainMenu</string>
+    </object>
+    <object class="IBCarbonWindow" id="166">
+      <string name="windowRect">150 247 570 738 </string>
+      <string name="title">Ogre3D</string>
+      <object name="rootControl" class="IBCarbonRootControl" id="167">
+        <string name="bounds">0 0 420 491 </string>
+        <string name="viewFrame">0 0 491 420 </string>
+        <array count="13" name="subviews">
+          <object class="IBCarbonButton" id="203">
+            <string name="bounds">380 319 400 389 </string>
+            <string name="viewFrame">319 380 70 20 </string>
+            <ostype name="controlSignature">CONF</ostype>
+            <int name="controlID">102</int>
+            <string name="title">Cancel</string>
+            <ostype name="command">not!</ostype>
+          </object>
+          <object class="IBCarbonButton" id="202">
+            <string name="bounds">380 401 400 471 </string>
+            <string name="viewFrame">401 380 70 20 </string>
+            <ostype name="controlSignature">CONF</ostype>
+            <int name="controlID">103</int>
+            <string name="title">Run</string>
+            <ostype name="command">run!</ostype>
+          </object>
+          <object class="IBCarbonPopupButton" id="241">
+            <string name="bounds">220 259 240 389 </string>
+            <string name="viewFrame">259 220 130 20 </string>
+            <ostype name="controlSignature">CONF</ostype>
+            <int name="controlID">104</int>
+            <ostype name="command">VIMO</ostype>
+            <int name="titleJustification">0</int>
+            <int name="selectedItem">2</int>
+            <object name="menu" class="IBCarbonMenu" id="242">
+              <string name="title">Popup</string>
+              <array count="3" name="items">
+                <object class="IBCarbonMenuItem" id="245">
+                  <boolean name="updateSingleItem">TRUE</boolean>
+                  <string name="title">1024 x 768</string>
+                </object>
+                <object class="IBCarbonMenuItem" id="243">
+                  <boolean name="checked">TRUE</boolean>
+                  <boolean name="updateSingleItem">TRUE</boolean>
+                  <string name="title">800 x 600</string>
+                </object>
+                <object class="IBCarbonMenuItem" id="244">
+                  <boolean name="updateSingleItem">TRUE</boolean>
+                  <string name="title">640 x 480</string>
+                </object>
+              </array>
+            </object>
+          </object>
+          <object class="IBCarbonStaticText" id="246">
+            <string name="bounds">221 20 237 251 </string>
+            <string name="viewFrame">20 221 231 16 </string>
+            <string name="title">Video Mode</string>
+            <int name="justification">-1</int>
+          </object>
+          <object class="IBCarbonPopupButton" id="247">
+            <string name="bounds">250 259 270 389 </string>
+            <string name="viewFrame">259 250 130 20 </string>
+            <ostype name="controlSignature">CONF</ostype>
+            <int name="controlID">105</int>
+            <ostype name="command">CODE</ostype>
+            <object name="menu" class="IBCarbonMenu" id="248">
+              <string name="title">Popup</string>
+              <array count="2" name="items">
+                <object class="IBCarbonMenuItem" id="249">
+                  <boolean name="checked">TRUE</boolean>
+                  <boolean name="updateSingleItem">TRUE</boolean>
+                  <string name="title">32</string>
+                </object>
+                <object class="IBCarbonMenuItem" id="250">
+                  <boolean name="updateSingleItem">TRUE</boolean>
+                  <string name="title">16</string>
+                </object>
+              </array>
+            </object>
+          </object>
+          <object class="IBCarbonStaticText" id="252">
+            <string name="bounds">251 20 267 251 </string>
+            <string name="viewFrame">20 251 231 16 </string>
+            <string name="title">Color Depth</string>
+            <int name="justification">-1</int>
+          </object>
+          <object class="IBCarbonPopupButton" id="253">
+            <string name="bounds">280 259 300 389 </string>
+            <string name="viewFrame">259 280 130 20 </string>
+            <ostype name="controlSignature">CONF</ostype>
+            <int name="controlID">106</int>
+            <ostype name="command">FSAA</ostype>
+            <int name="selectedItem">2</int>
+            <object name="menu" class="IBCarbonMenu" id="254">
+              <string name="title">Popup</string>
+              <array count="4" name="items">
+                <object class="IBCarbonMenuItem" id="255">
+                  <boolean name="updateSingleItem">TRUE</boolean>
+                  <string name="title">0</string>
+                </object>
+                <object class="IBCarbonMenuItem" id="256">
+                  <boolean name="checked">TRUE</boolean>
+                  <boolean name="updateSingleItem">TRUE</boolean>
+                  <string name="title">2</string>
+                </object>
+                <object class="IBCarbonMenuItem" id="257">
+                  <boolean name="updateSingleItem">TRUE</boolean>
+                  <string name="title">4</string>
+                </object>
+                <object class="IBCarbonMenuItem" id="287">
+                  <boolean name="updateSingleItem">TRUE</boolean>
+                  <string name="title">6</string>
+                </object>
+              </array>
+            </object>
+          </object>
+          <object class="IBCarbonStaticText" id="258">
+            <string name="bounds">281 20 297 251 </string>
+            <string name="viewFrame">20 281 231 16 </string>
+            <string name="title">FSAA</string>
+            <int name="justification">-1</int>
+          </object>
+          <object class="IBCarbonPopupButton" id="259">
+            <string name="bounds">310 259 330 389 </string>
+            <string name="viewFrame">259 310 130 20 </string>
+            <ostype name="controlSignature">CONF</ostype>
+            <int name="controlID">107</int>
+            <ostype name="command">RTTP</ostype>
+            <object name="menu" class="IBCarbonMenu" id="260">
+              <string name="title">Popup</string>
+              <array count="3" name="items">
+                <object class="IBCarbonMenuItem" id="262">
+                  <boolean name="checked">TRUE</boolean>
+                  <boolean name="updateSingleItem">TRUE</boolean>
+                  <string name="title">FBO</string>
+                </object>
+                <object class="IBCarbonMenuItem" id="263">
+                  <boolean name="updateSingleItem">TRUE</boolean>
+                  <string name="title">PBuffer</string>
+                </object>
+                <object class="IBCarbonMenuItem" id="261">
+                  <boolean name="updateSingleItem">TRUE</boolean>
+                  <string name="title">Copy</string>
+                </object>
+              </array>
+            </object>
+          </object>
+          <object class="IBCarbonStaticText" id="264">
+            <string name="bounds">311 20 327 251 </string>
+            <string name="viewFrame">20 311 231 16 </string>
+            <string name="title">RTT Preferred Mode</string>
+            <int name="justification">-1</int>
+          </object>
+          <object class="IBCarbonImageView" id="277">
+            <string name="bounds">0 0 212 491 </string>
+            <string name="viewFrame">0 0 491 212 </string>
+            <ostype name="controlSignature">CONF</ostype>
+            <int name="controlID">100</int>
+          </object>
+          <object class="IBCarbonPopupButton" id="281">
+            <string name="bounds">340 259 360 389 </string>
+            <string name="viewFrame">259 340 130 20 </string>
+            <ostype name="controlSignature">CONF</ostype>
+            <int name="controlID">108</int>
+            <ostype name="command">FUSC</ostype>
+            <int name="selectedItem">2</int>
+            <object name="menu" class="IBCarbonMenu" id="282">
+              <string name="title">Popup</string>
+              <array count="2" name="items">
+                <object class="IBCarbonMenuItem" id="284">
+                  <boolean name="updateSingleItem">TRUE</boolean>
+                  <string name="title">Yes</string>
+                </object>
+                <object class="IBCarbonMenuItem" id="283">
+                  <boolean name="checked">TRUE</boolean>
+                  <boolean name="updateSingleItem">TRUE</boolean>
+                  <string name="title">No</string>
+                </object>
+              </array>
+            </object>
+          </object>
+          <object class="IBCarbonStaticText" id="286">
+            <string name="bounds">341 20 357 251 </string>
+            <string name="viewFrame">20 341 231 16 </string>
+            <string name="title">Full Screen</string>
+            <int name="justification">-1</int>
+          </object>
+        </array>
+      </object>
+      <boolean name="receiveUpdates">FALSE</boolean>
+      <boolean name="hasHorizontalZoom">FALSE</boolean>
+      <boolean name="isResizable">FALSE</boolean>
+      <boolean name="hasVerticalZoom">FALSE</boolean>
+      <boolean name="liveResize">TRUE</boolean>
+      <boolean name="compositing">TRUE</boolean>
+      <int name="windowPosition">1</int>
+      <boolean name="isConstrained">FALSE</boolean>
+    </object>
+    <reference idRef="167"/>
+    <reference idRef="184"/>
+    <reference idRef="185"/>
+    <reference idRef="187"/>
+    <reference idRef="202"/>
+    <reference idRef="203"/>
+    <reference idRef="241"/>
+    <reference idRef="242"/>
+    <reference idRef="243"/>
+    <reference idRef="244"/>
+    <reference idRef="245"/>
+    <reference idRef="246"/>
+    <reference idRef="247"/>
+    <reference idRef="248"/>
+    <reference idRef="249"/>
+    <reference idRef="250"/>
+    <reference idRef="252"/>
+    <reference idRef="253"/>
+    <reference idRef="254"/>
+    <reference idRef="255"/>
+    <reference idRef="256"/>
+    <reference idRef="257"/>
+    <reference idRef="258"/>
+    <reference idRef="259"/>
+    <reference idRef="260"/>
+    <reference idRef="261"/>
+    <reference idRef="262"/>
+    <reference idRef="263"/>
+    <reference idRef="264"/>
+    <reference idRef="277"/>
+    <object class="IBCarbonWindow" id="279">
+      <string name="windowRect">113 45 593 685 </string>
+      <string name="title">Ogre3D</string>
+      <object name="rootControl" class="IBCarbonRootControl" id="280">
+        <string name="bounds">0 0 480 640 </string>
+        <string name="viewFrame">0 0 640 480 </string>
+      </object>
+      <boolean name="receiveUpdates">FALSE</boolean>
+      <boolean name="liveResize">TRUE</boolean>
+      <boolean name="compositing">TRUE</boolean>
+      <int name="windowPosition">1</int>
+      <boolean name="isConstrained">FALSE</boolean>
+    </object>
+    <reference idRef="280"/>
+    <reference idRef="281"/>
+    <reference idRef="282"/>
+    <reference idRef="283"/>
+    <reference idRef="284"/>
+    <reference idRef="286"/>
+    <reference idRef="287"/>
+  </array>
+  <array count="40" name="allParents">
+    <reference idRef="1"/>
+    <reference idRef="1"/>
+    <reference idRef="166"/>
+    <reference idRef="185"/>
+    <reference idRef="29"/>
+    <reference idRef="184"/>
+    <reference idRef="167"/>
+    <reference idRef="167"/>
+    <reference idRef="167"/>
+    <reference idRef="241"/>
+    <reference idRef="242"/>
+    <reference idRef="242"/>
+    <reference idRef="242"/>
+    <reference idRef="167"/>
+    <reference idRef="167"/>
+    <reference idRef="247"/>
+    <reference idRef="248"/>
+    <reference idRef="248"/>
+    <reference idRef="167"/>
+    <reference idRef="167"/>
+    <reference idRef="253"/>
+    <reference idRef="254"/>
+    <reference idRef="254"/>
+    <reference idRef="254"/>
+    <reference idRef="167"/>
+    <reference idRef="167"/>
+    <reference idRef="259"/>
+    <reference idRef="260"/>
+    <reference idRef="260"/>
+    <reference idRef="260"/>
+    <reference idRef="167"/>
+    <reference idRef="167"/>
+    <reference idRef="1"/>
+    <reference idRef="279"/>
+    <reference idRef="167"/>
+    <reference idRef="281"/>
+    <reference idRef="282"/>
+    <reference idRef="282"/>
+    <reference idRef="167"/>
+    <reference idRef="254"/>
+  </array>
+  <dictionary count="5" name="nameTable">
+    <string>ConfigWindow</string>
+    <reference idRef="166"/>
+    <string>Files Owner</string>
+    <reference idRef="1"/>
+    <string>MenuBar</string>
+    <reference idRef="29"/>
+    <string>RenderWindow</string>
+    <reference idRef="279"/>
+    <string>View</string>
+    <reference idRef="277"/>
+  </dictionary>
+  <unsigned_int name="nextObjectID">288</unsigned_int>
+</object>
Index: /ogre_src_v1-9-0/OgreMain/include/Ogre.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Ogre.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Ogre.h	(revision 148)
@@ -0,0 +1,129 @@
+/*
+-----------------------------------------------------------------------------
+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 _Ogre_H__
+#define _Ogre_H__
+// This file includes all the other files which you will need to build a client application
+#include "OgrePrerequisites.h"
+
+#include "OgreAnimation.h"
+#include "OgreAnimationState.h"
+#include "OgreAnimationTrack.h"
+#include "OgreAny.h"
+#include "OgreArchive.h"
+#include "OgreArchiveManager.h"
+#include "OgreAxisAlignedBox.h"
+#include "OgreBillboardChain.h"
+#include "OgreBillboardSet.h"
+#include "OgreBone.h"
+#include "OgreCamera.h"
+#include "OgreConfigFile.h"
+#include "OgreControllerManager.h"
+#include "OgreDataStream.h"
+#include "OgreEntity.h"
+#include "OgreException.h"
+#include "OgreFrustum.h"
+#include "OgreGpuProgram.h"
+#include "OgreGpuProgramManager.h"
+#include "OgreHardwareBufferManager.h"
+#include "OgreHardwareIndexBuffer.h"
+#include "OgreHardwarePixelBuffer.h"
+#include "OgreHardwareOcclusionQuery.h"
+#include "OgreHardwareVertexBuffer.h"
+#include "OgreHardwarePixelBuffer.h"
+#include "OgreHighLevelGpuProgram.h"
+#include "OgreHighLevelGpuProgramManager.h"
+#include "OgreInstanceBatch.h"
+#include "OgreInstancedEntity.h"
+#include "OgreInstanceManager.h"
+#include "OgreKeyFrame.h"
+#include "OgreLight.h"
+#include "OgreLogManager.h"
+#include "OgreManualObject.h"
+#include "OgreMaterial.h"
+#include "OgreMaterialManager.h"
+#include "OgreMaterialSerializer.h"
+#include "OgreMath.h"
+#include "OgreMatrix3.h"
+#include "OgreMatrix4.h"
+#include "OgreMesh.h"
+#include "OgreMeshManager.h"
+#include "OgreMeshSerializer.h"
+#include "OgreParticleAffector.h"
+#include "OgreParticleEmitter.h"
+#include "OgreParticleSystemManager.h"
+#include "OgrePass.h"
+#include "OgrePatchMesh.h"
+#include "OgrePatchSurface.h"
+#include "OgreProfiler.h"
+#include "OgreRadixSort.h"
+#include "OgreRenderQueueInvocation.h"
+#include "OgreRenderQueueListener.h"
+#include "OgreRenderObjectListener.h"
+#include "OgreRenderSystem.h"
+#include "OgreRenderTargetListener.h"
+#include "OgreRenderTexture.h"
+#include "OgreRenderWindow.h"
+#include "OgreResourceBackgroundQueue.h"
+#include "OgreResourceGroupManager.h"
+#include "OgreRibbonTrail.h"
+#include "OgreRoot.h"
+#include "OgreSceneManager.h"
+#include "OgreSceneManagerEnumerator.h"
+#include "OgreSceneNode.h"
+#include "OgreSimpleRenderable.h"
+#include "OgreSkeleton.h"
+#include "OgreSkeletonInstance.h"
+#include "OgreSkeletonManager.h"
+#include "OgreSkeletonSerializer.h"
+#include "OgreStaticGeometry.h"
+#include "OgreString.h"
+#include "OgreStringConverter.h"
+#include "OgreStringVector.h"
+#include "OgreSubEntity.h"
+#include "OgreSubMesh.h"
+#include "OgreTechnique.h"
+#include "OgreTextureManager.h"
+#include "OgreTextureUnitState.h"
+#include "OgreVector2.h"
+#include "OgreViewport.h"
+#include "OgreCompositor.h"
+#include "OgreCompositorManager.h"
+#include "OgreCompositorChain.h"
+#include "OgreCompositorInstance.h"
+#include "OgreCompositionTechnique.h"
+#include "OgreCompositionPass.h"
+#include "OgreCompositionTargetPass.h"
+#include "OgreWindowEventUtilities.h"
+#include "OgreShadowCameraSetup.h"
+#include "OgreShadowCameraSetupFocused.h"
+#include "OgreShadowCameraSetupLiSPSM.h"
+#include "OgreShadowCameraSetupPlaneOptimal.h"
+#include "OgreShadowCameraSetupPSSM.h"
+// .... more to come
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreAlignedAllocator.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreAlignedAllocator.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreAlignedAllocator.h	(revision 148)
@@ -0,0 +1,107 @@
+/*
+-----------------------------------------------------------------------------
+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 __AlignedAllocator_H__
+#define __AlignedAllocator_H__
+
+// Now we're only including this within OgreMemoryAllocatorConfig.h which is already in
+// the prerequisites header (circlar reference)
+//#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+
+	/** \addtogroup Memory
+	*  @{
+	*/
+
+	/** Class to provide aligned memory allocate functionality.
+    @remarks
+        All SIMD processing are friendly with aligned memory, and some SIMD routines
+        are designed for working with aligned memory only. If the data are intended to
+        use SIMD processing, it's need to be aligned for better performance boost.
+        In additional, most time cache boundary aligned data also lead to better
+        performance even if didn't used SIMD processing. So this class provides a couple
+        of functions for allocate aligned memory.
+    @par
+        Anyways, in general, you don't need to use this class directly, Ogre internally
+        will take care with most SIMD and cache friendly optimisation if possible.
+    @par
+        This isn't a "one-step" optimisation, there are a lot of underlying work to
+        achieve performance boost. If you didn't know what are you doing or what there
+        are going, just ignore this class.
+    @note
+        This class intended to use by advanced user only.
+    */
+	class _OgreExport AlignedMemory
+	{
+	public:
+        /** Allocate memory with given alignment.
+            @param
+                size The size of memory need to allocate.
+            @param
+                alignment The alignment of result pointer, must be power of two
+                and in range [1, 128].
+            @return
+                The allocated memory pointer.
+            @par
+                On failure, exception will be throw.
+        */
+        static void* allocate(size_t size, size_t alignment);
+
+        /** Allocate memory with default platform dependent alignment.
+            @remarks
+                The default alignment depend on target machine, this function
+                guarantee aligned memory according with SIMD processing and
+                cache boundary friendly.
+            @param
+                size The size of memory need to allocate.
+            @return
+                The allocated memory pointer.
+            @par
+                On failure, exception will be throw.
+        */
+        static void* allocate(size_t size);
+
+        /** Deallocate memory that allocated by this class.
+            @param
+                p Pointer to the memory allocated by this class or <b>NULL</b> pointer.
+            @par
+                On <b>NULL</b> pointer, nothing happen.
+        */
+        static void deallocate(void* p);
+	};
+
+	/** @} */
+	/** @} */
+
+}
+
+#endif  // __AlignedAllocator_H__
Index: /ogre_src_v1-9-0/OgreMain/include/OgreAnimable.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreAnimable.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreAnimable.h	(revision 148)
@@ -0,0 +1,339 @@
+/*
+-----------------------------------------------------------------------------
+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 __ANIMABLE_H__
+#define __ANIMABLE_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreVector2.h"
+#include "OgreVector3.h"
+#include "OgreVector4.h"
+#include "OgreQuaternion.h"
+#include "OgreColourValue.h"
+#include "OgreSharedPtr.h"
+#include "OgreStringVector.h"
+#include "OgreException.h"
+#include "OgreAny.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+
+	/** \addtogroup Animation
+	*  @{
+	*/
+
+	/** Defines an object property which is animable, i.e. may be keyframed.
+	@remarks
+		Animable properties are those which can be altered over time by a 
+		predefined keyframe sequence. They may be set directly, or they may
+		be modified from their existing state (common if multiple animations
+		are expected to apply at once). Implementors of this interface are
+		expected to override the 'setValue', 'setCurrentStateAsBaseValue' and 
+		'applyDeltaValue' methods appropriate to the type in question, and to 
+		initialise the type.
+	@par
+		AnimableValue instances are accessible through any class which extends
+		AnimableObject in order to expose it's animable properties.
+	@note
+		This class is an instance of the Adapter pattern, since it generalises
+		access to a particular property. Whilst it could have been templated
+		such that the type which was being referenced was compiled in, this would
+		make it more difficult to aggregated generically, and since animations
+		are often comprised of multiple properties it helps to be able to deal
+		with all values through a single class.
+	*/
+	class _OgreExport AnimableValue : public AnimableAlloc
+	{
+	public:
+		/// The type of the value being animated
+		enum ValueType
+		{
+			INT,
+			REAL,
+			VECTOR2,
+			VECTOR3,
+			VECTOR4,
+			QUATERNION,
+			COLOUR,
+			RADIAN,
+			DEGREE
+		};
+	protected:
+		/// Value type
+		ValueType mType;
+
+		/// Base value data
+		union
+		{
+			int mBaseValueInt;
+			Real mBaseValueReal[4];
+		};
+
+		/// Internal method to set a value as base
+		virtual void setAsBaseValue(int val) { mBaseValueInt = val; }
+		/// Internal method to set a value as base
+		virtual void setAsBaseValue(Real val) { mBaseValueReal[0] = val; }
+		/// Internal method to set a value as base
+		virtual void setAsBaseValue(const Vector2& val) 
+		{ memcpy(mBaseValueReal, val.ptr(), sizeof(Real)*2); }
+		/// Internal method to set a value as base
+		virtual void setAsBaseValue(const Vector3& val) 
+		{ memcpy(mBaseValueReal, val.ptr(), sizeof(Real)*3); }
+		/// Internal method to set a value as base
+		virtual void setAsBaseValue(const Vector4& val) 
+		{ memcpy(mBaseValueReal, val.ptr(), sizeof(Real)*4); }
+		/// Internal method to set a value as base
+		virtual void setAsBaseValue(const Quaternion& val) 
+		{ memcpy(mBaseValueReal, val.ptr(), sizeof(Real)*4); }
+		/// Internal method to set a value as base
+		virtual void setAsBaseValue(const Any& val);
+		/// Internal method to set a value as base
+		virtual void setAsBaseValue(const ColourValue& val)
+		{ 
+			mBaseValueReal[0] = val.r;
+			mBaseValueReal[1] = val.g;
+			mBaseValueReal[2] = val.b;
+			mBaseValueReal[3] = val.a;
+		}
+		/// Internal method to set a value as base
+		virtual void setAsBaseValue(const Radian& val)
+		{ 
+			mBaseValueReal[0] = val.valueRadians();
+		}
+		/// Internal method to set a value as base
+		virtual void setAsBaseValue(const Degree& val)
+		{ 
+			mBaseValueReal[0] = val.valueRadians();
+		}
+
+
+	public:
+		AnimableValue(ValueType t) : mType(t) {}
+		virtual ~AnimableValue() {}
+
+		/// Gets the value type of this animable value
+		ValueType getType(void) const { return mType; }
+
+		/// Sets the current state as the 'base' value; used for delta animation
+		virtual void setCurrentStateAsBaseValue(void) = 0;
+
+		/// Set value 
+		virtual void setValue(int) {
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", "");
+		}
+		/// Set value 
+		virtual void setValue(Real) {
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", "");
+		}
+		/// Set value 
+		virtual void setValue(const Vector2&) {
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", "");
+		}
+		/// Set value 
+		virtual void setValue(const Vector3&) {
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", "");
+		}
+		/// Set value 
+		virtual void setValue(const Vector4&) {
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", "");
+		}
+		/// Set value 
+		virtual void setValue(const Quaternion&) {
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", "");
+		}
+		/// Set value 
+		virtual void setValue(const ColourValue&) {
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", "");
+		}
+		/// Set value 
+		virtual void setValue(const Radian&) {
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", "");
+		}
+		/// Set value 
+		virtual void setValue(const Degree&) {
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", "");
+		}
+		/// Set value 
+		virtual void setValue(const Any& val);
+
+		// reset to base value
+		virtual void resetToBaseValue(void);
+
+		/// Apply delta value
+		virtual void applyDeltaValue(int) {
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", "");
+		}
+		/// Set value 
+		virtual void applyDeltaValue(Real) {
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", "");
+		}
+		/// Apply delta value 
+		virtual void applyDeltaValue(const Vector2&) {
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", "");
+		}
+		/// Apply delta value 
+		virtual void applyDeltaValue(const Vector3&) {
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", "");
+		}
+		/// Apply delta value 
+		virtual void applyDeltaValue(const Vector4&) {
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", "");
+		}
+		/// Apply delta value 
+		virtual void applyDeltaValue(const Quaternion&) {
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", "");
+		}
+		/// Apply delta value 
+		virtual void applyDeltaValue(const ColourValue&) {
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", "");
+		}
+		/// Apply delta value 
+		virtual void applyDeltaValue(const Degree&) {
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", "");
+		}
+		/// Apply delta value 
+		virtual void applyDeltaValue(const Radian&) {
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", "");
+		}
+		/// Apply delta value 
+		virtual void applyDeltaValue(const Any& val);
+
+
+	};
+
+	typedef SharedPtr<AnimableValue> AnimableValuePtr;
+
+
+
+	/** Defines an interface to classes which have one or more AnimableValue
+		instances to expose.
+	*/
+	class _OgreExport AnimableObject
+	{
+	protected:
+		typedef map<String, StringVector>::type AnimableDictionaryMap;
+		/// Static map of class name to list of animable value names
+		static AnimableDictionaryMap msAnimableDictionary;
+		/** Get the name of the animable dictionary for this class.
+		@remarks
+			Subclasses must override this if they want to support animation of
+			their values.
+		*/
+		virtual const String& getAnimableDictionaryName(void) const 
+		{ return StringUtil::BLANK; }
+        /** Internal method for creating a dictionary of animable value names 
+			for the class, if it does not already exist.
+        */
+        void createAnimableDictionary(void) const
+        {
+            if (msAnimableDictionary.find(getAnimableDictionaryName()) 
+				== msAnimableDictionary.end())
+            {
+				StringVector vec;
+				initialiseAnimableDictionary(vec);
+				msAnimableDictionary[getAnimableDictionaryName()] = vec;
+            }
+
+        }
+	
+		/// Get an updateable reference to animable value list
+		StringVector& _getAnimableValueNames(void)
+		{
+			AnimableDictionaryMap::iterator i = 
+				msAnimableDictionary.find(getAnimableDictionaryName());
+			if (i != msAnimableDictionary.end())
+			{
+				return i->second;
+			}
+			else
+			{
+				OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND, 
+					"Animable value list not found for " + getAnimableDictionaryName(), 
+					"AnimableObject::getAnimableValueNames");
+			}
+
+		}
+
+		/** Internal method for initialising dictionary; should be implemented by 
+			subclasses wanting to expose animable parameters.
+		*/
+		virtual void initialiseAnimableDictionary(StringVector&) const {}
+
+
+	public:
+		AnimableObject() {}
+		virtual ~AnimableObject() {}
+
+		/** Gets a list of animable value names for this object. */
+		const StringVector& getAnimableValueNames(void) const
+		{
+			createAnimableDictionary();
+
+			AnimableDictionaryMap::iterator i = 
+				msAnimableDictionary.find(getAnimableDictionaryName());
+			if (i != msAnimableDictionary.end())
+			{
+				return i->second;
+			}
+			else
+			{
+				OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND, 
+					"Animable value list not found for " + getAnimableDictionaryName(), 
+					"AnimableObject::getAnimableValueNames");
+			}
+
+		}
+
+		/** Create a reference-counted AnimableValuePtr for the named value.
+		@remarks
+			You can use the returned object to animate a value on this object,
+			using AnimationTrack. Subclasses must override this if they wish 
+			to support animation of their values.
+		*/
+		virtual AnimableValuePtr createAnimableValue(const String& valueName)
+		{
+			OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND, 
+				"No animable value named '" + valueName + "' present.", 
+				"AnimableObject::createAnimableValue");
+		}
+
+
+
+	};
+
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreAnimation.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreAnimation.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreAnimation.h	(revision 148)
@@ -0,0 +1,547 @@
+/*
+-----------------------------------------------------------------------------
+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 __Animation_H__
+#define __Animation_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreString.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreAnimable.h"
+#include "OgreAnimationTrack.h"
+#include "OgreAnimationState.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+    /** \addtogroup Core
+    *  @{
+    */
+
+    /** \addtogroup Animation
+    *  @{
+    */
+
+    class Animation;
+    
+    /** An animation container interface, which allows generic access to sibling animations.
+     @remarks
+        Because Animation instances can be held by different kinds of classes, and
+        there are sometimes instances when you need to reference other Animation 
+        instances within the same container, this class allows generic access to
+        named animations within that container, whatever it may be.
+    */
+    class _OgreExport AnimationContainer
+    {
+    public:
+        virtual ~AnimationContainer() {}
+
+        /** Gets the number of animations in this container. */
+        virtual unsigned short getNumAnimations(void) const = 0;
+        
+        /** Retrieve an animation by index.  */
+        virtual Animation* getAnimation(unsigned short index) const = 0;
+        
+        /** Retrieve an animation by name. */
+        virtual Animation* getAnimation(const String& name) const = 0;
+        
+        /** Create a new animation with a given length owned by this container. */
+        virtual Animation* createAnimation(const String& name, Real length) = 0;
+        
+        /** Returns whether this object contains the named animation. */
+        virtual bool hasAnimation(const String& name) const = 0;
+        
+        /** Removes an Animation from this container. */
+        virtual void removeAnimation(const String& name) = 0;
+        
+    };
+    /** An animation sequence. 
+    @remarks
+        This class defines the interface for a sequence of animation, whether that
+        be animation of a mesh, a path along a spline, or possibly more than one
+        type of animation in one. An animation is made up of many 'tracks', which are
+        the more specific types of animation.
+    @par
+        You should not create these animations directly. They will be created via a parent
+        object which owns the animation, e.g. Skeleton.
+    */
+    class _OgreExport Animation : public AnimationAlloc
+    {
+
+    public:
+        /** The types of animation interpolation available. */
+        enum InterpolationMode
+        {
+            /** Values are interpolated along straight lines. */
+            IM_LINEAR,
+            /** Values are interpolated along a spline, resulting in smoother changes in direction. */
+            IM_SPLINE
+        };
+
+        /** The types of rotational interpolation available. */
+        enum RotationInterpolationMode
+        {
+            /** Values are interpolated linearly. This is faster but does not 
+                necessarily give a completely accurate result.
+            */
+            RIM_LINEAR,
+            /** Values are interpolated spherically. This is more accurate but
+                has a higher cost.
+            */
+            RIM_SPHERICAL
+        };
+        /** You should not use this constructor directly, use the parent object such as Skeleton instead.
+        @param name The name of the animation, should be unique within it's parent (e.g. Skeleton)
+        @param length The length of the animation in seconds.
+        */
+        Animation(const String& name, Real length);
+        virtual ~Animation();
+
+        /** Gets the name of this animation. */
+        const String& getName(void) const;
+
+        /** Gets the total length of the animation. */
+        Real getLength(void) const;
+
+        /** Sets the length of the animation. 
+        @note Changing the length of an animation may invalidate existing AnimationState
+            instances which will need to be recreated. 
+        */
+        void setLength(Real len);
+
+        /** Creates a NodeAnimationTrack for animating a Node.
+        @param handle Handle to give the track, used for accessing the track later. 
+            Must be unique within this Animation.
+        */
+        NodeAnimationTrack* createNodeTrack(unsigned short handle);
+
+        /** Creates a NumericAnimationTrack for animating any numeric value.
+        @param handle Handle to give the track, used for accessing the track later. 
+            Must be unique within this Animation.
+        */
+        NumericAnimationTrack* createNumericTrack(unsigned short handle);
+
+        /** Creates a VertexAnimationTrack for animating vertex position data.
+        @param handle Handle to give the track, used for accessing the track later. 
+            Must be unique within this Animation, and is used to identify the target. For example
+            when applied to a Mesh, the handle must reference the index of the geometry being 
+            modified; 0 for the shared geometry, and 1+ for SubMesh geometry with the same index-1.
+        @param animType Either morph or pose animation, 
+        */
+        VertexAnimationTrack* createVertexTrack(unsigned short handle, VertexAnimationType animType);
+
+        /** Creates a new AnimationTrack automatically associated with a Node. 
+        @remarks
+            This method creates a standard AnimationTrack, but also associates it with a
+            target Node which will receive all keyframe effects.
+        @param handle Numeric handle to give the track, used for accessing the track later. 
+            Must be unique within this Animation.
+        @param node A pointer to the Node object which will be affected by this track
+        */
+        NodeAnimationTrack* createNodeTrack(unsigned short handle, Node* node);
+
+        /** Creates a NumericAnimationTrack and associates it with an animable. 
+        @param handle Handle to give the track, used for accessing the track later. 
+        @param anim Animable object link
+            Must be unique within this Animation.
+        */
+        NumericAnimationTrack* createNumericTrack(unsigned short handle, 
+            const AnimableValuePtr& anim);
+
+        /** Creates a VertexAnimationTrack and associates it with VertexData. 
+        @param handle Handle to give the track, used for accessing the track later. 
+        @param data VertexData object link
+        @param animType The animation type 
+            Must be unique within this Animation.
+        */
+        VertexAnimationTrack* createVertexTrack(unsigned short handle, 
+            VertexData* data, VertexAnimationType animType);
+
+        /** Gets the number of NodeAnimationTrack objects contained in this animation. */
+        unsigned short getNumNodeTracks(void) const;
+
+        /** Gets a node track by it's handle. */
+        NodeAnimationTrack* getNodeTrack(unsigned short handle) const;
+
+        /** Does a track exist with the given handle? */
+        bool hasNodeTrack(unsigned short handle) const;
+
+        /** Gets the number of NumericAnimationTrack objects contained in this animation. */
+        unsigned short getNumNumericTracks(void) const;
+
+        /** Gets a numeric track by it's handle. */
+        NumericAnimationTrack* getNumericTrack(unsigned short handle) const;
+
+        /** Does a track exist with the given handle? */
+        bool hasNumericTrack(unsigned short handle) const;
+
+        /** Gets the number of VertexAnimationTrack objects contained in this animation. */
+        unsigned short getNumVertexTracks(void) const;
+
+        /** Gets a Vertex track by it's handle. */
+        VertexAnimationTrack* getVertexTrack(unsigned short handle) const;
+
+        /** Does a track exist with the given handle? */
+        bool hasVertexTrack(unsigned short handle) const;
+        
+        /** Destroys the node track with the given handle. */
+        void destroyNodeTrack(unsigned short handle);
+
+        /** Destroys the numeric track with the given handle. */
+        void destroyNumericTrack(unsigned short handle);
+
+        /** Destroys the Vertex track with the given handle. */
+        void destroyVertexTrack(unsigned short handle);
+
+        /** Removes and destroys all tracks making up this animation. */
+        void destroyAllTracks(void);
+
+        /** Removes and destroys all tracks making up this animation. */
+        void destroyAllNodeTracks(void);
+        /** Removes and destroys all tracks making up this animation. */
+        void destroyAllNumericTracks(void);
+        /** Removes and destroys all tracks making up this animation. */
+        void destroyAllVertexTracks(void);
+
+        /** Applies an animation given a specific time point and weight.
+        @remarks
+            Where you have associated animation tracks with objects, you can easily apply
+            an animation to those objects by calling this method.
+        @param timePos The time position in the animation to apply.
+        @param weight The influence to give to this track, 1.0 for full influence, less to blend with
+          other animations.
+        @param scale The scale to apply to translations and scalings, useful for 
+            adapting an animation to a different size target.
+        */
+        void apply(Real timePos, Real weight = 1.0, Real scale = 1.0f);
+
+        /** Applies all node tracks given a specific time point and weight to the specified node.
+        @remarks
+            It does not consider the actual node tracks are attached to.
+            As such, it resembles the apply method for a given skeleton (see below).
+        @param timePos The time position in the animation to apply.
+        @param weight The influence to give to this track, 1.0 for full influence, less to blend with
+          other animations.
+        @param scale The scale to apply to translations and scalings, useful for 
+            adapting an animation to a different size target.
+        */
+        void applyToNode(Node* node, Real timePos, Real weight = 1.0, Real scale = 1.0f);
+
+        /** Applies all node tracks given a specific time point and weight to a given skeleton.
+        @remarks
+            Where you have associated animation tracks with Node objects, you can easily apply
+            an animation to those nodes by calling this method.
+        @param timePos The time position in the animation to apply.
+        @param weight The influence to give to this track, 1.0 for full influence, less to blend with
+            other animations.
+        @param scale The scale to apply to translations and scalings, useful for 
+            adapting an animation to a different size target.
+        */
+        void apply(Skeleton* skeleton, Real timePos, Real weight = 1.0, Real scale = 1.0f);
+
+        /** Applies all node tracks given a specific time point and weight to a given skeleton.
+        @remarks
+            Where you have associated animation tracks with Node objects, you can easily apply
+            an animation to those nodes by calling this method.
+        @param timePos The time position in the animation to apply.
+        @param weight The influence to give to this track, 1.0 for full influence, less to blend with
+            other animations.
+        @param blendMask The influence array defining additional per bone weights. These will
+            be modulated with the weight factor.
+        @param scale The scale to apply to translations and scalings, useful for 
+            adapting an animation to a different size target.
+        */
+        void apply(Skeleton* skeleton, Real timePos, float weight,
+          const AnimationState::BoneBlendMask* blendMask, Real scale);
+
+        /** Applies all vertex tracks given a specific time point and weight to a given entity.
+        @param entity The Entity to which this animation should be applied
+        @param timePos The time position in the animation to apply.
+        @param weight The weight at which the animation should be applied 
+            (only affects pose animation)
+        @param software Whether to populate the software morph vertex data
+        @param hardware Whether to populate the hardware morph vertex data
+        */
+        void apply(Entity* entity, Real timePos, Real weight, bool software, 
+            bool hardware);
+
+        /** Applies all numeric tracks given a specific time point and weight to the specified animable value.
+        @remarks
+            It does not applies to actual attached animable values but rather uses all tracks for a single animable value.
+        @param timePos The time position in the animation to apply.
+        @param weight The influence to give to this track, 1.0 for full influence, less to blend with
+          other animations.
+        @param scale The scale to apply to translations and scalings, useful for 
+            adapting an animation to a different size target.
+        */
+        void applyToAnimable(const AnimableValuePtr& anim, Real timePos, Real weight = 1.0, Real scale = 1.0f);
+
+        /** Applies all vertex tracks given a specific time point and weight to the specified vertex data.
+        @remarks
+            It does not apply to the actual attached vertex data but rather uses all tracks for a given vertex data.
+        @param timePos The time position in the animation to apply.
+        @param weight The influence to give to this track, 1.0 for full influence, less to blend with
+          other animations.
+        */
+        void applyToVertexData(VertexData* data, Real timePos, Real weight = 1.0);
+
+        /** Tells the animation how to interpolate between keyframes.
+        @remarks
+            By default, animations normally interpolate linearly between keyframes. This is
+            fast, but when animations include quick changes in direction it can look a little
+            unnatural because directions change instantly at keyframes. An alternative is to
+            tell the animation to interpolate along a spline, which is more expensive in terms
+            of calculation time, but looks smoother because major changes in direction are 
+            distributed around the keyframes rather than just at the keyframe.
+        @par
+            You can also change the default animation behaviour by calling 
+            Animation::setDefaultInterpolationMode.
+        */
+        void setInterpolationMode(InterpolationMode im);
+
+        /** Gets the current interpolation mode of this animation. 
+        @remarks
+            See setInterpolationMode for more info.
+        */
+        InterpolationMode getInterpolationMode(void) const;
+        /** Tells the animation how to interpolate rotations.
+        @remarks
+            By default, animations interpolate linearly between rotations. This
+            is fast but not necessarily completely accurate. If you want more 
+            accurate interpolation, use spherical interpolation, but be aware 
+            that it will incur a higher cost.
+        @par
+            You can also change the default rotation behaviour by calling 
+            Animation::setDefaultRotationInterpolationMode.
+        */
+        void setRotationInterpolationMode(RotationInterpolationMode im);
+
+        /** Gets the current rotation interpolation mode of this animation. 
+        @remarks
+            See setRotationInterpolationMode for more info.
+        */
+        RotationInterpolationMode getRotationInterpolationMode(void) const;
+
+        // Methods for setting the defaults
+        /** Sets the default animation interpolation mode. 
+        @remarks
+            Every animation created after this option is set will have the new interpolation
+            mode specified. You can also change the mode per animation by calling the 
+            setInterpolationMode method on the instance in question.
+        */
+        static void setDefaultInterpolationMode(InterpolationMode im);
+
+        /** Gets the default interpolation mode for all animations. */
+        static InterpolationMode getDefaultInterpolationMode(void);
+
+        /** Sets the default rotation interpolation mode. 
+        @remarks
+            Every animation created after this option is set will have the new interpolation
+            mode specified. You can also change the mode per animation by calling the 
+            setInterpolationMode method on the instance in question.
+        */
+        static void setDefaultRotationInterpolationMode(RotationInterpolationMode im);
+
+        /** Gets the default rotation interpolation mode for all animations. */
+        static RotationInterpolationMode getDefaultRotationInterpolationMode(void);
+
+        typedef map<unsigned short, NodeAnimationTrack*>::type NodeTrackList;
+        typedef ConstMapIterator<NodeTrackList> NodeTrackIterator;
+
+        typedef map<unsigned short, NumericAnimationTrack*>::type NumericTrackList;
+        typedef ConstMapIterator<NumericTrackList> NumericTrackIterator;
+
+        typedef map<unsigned short, VertexAnimationTrack*>::type VertexTrackList;
+        typedef ConstMapIterator<VertexTrackList> VertexTrackIterator;
+
+        /// Fast access to NON-UPDATEABLE node track list
+        const NodeTrackList& _getNodeTrackList(void) const;
+
+        /// Get non-updateable iterator over node tracks
+        NodeTrackIterator getNodeTrackIterator(void) const
+        { return NodeTrackIterator(mNodeTrackList.begin(), mNodeTrackList.end()); }
+        
+        /// Fast access to NON-UPDATEABLE numeric track list
+        const NumericTrackList& _getNumericTrackList(void) const;
+
+        /// Get non-updateable iterator over node tracks
+        NumericTrackIterator getNumericTrackIterator(void) const
+        { return NumericTrackIterator(mNumericTrackList.begin(), mNumericTrackList.end()); }
+
+        /// Fast access to NON-UPDATEABLE Vertex track list
+        const VertexTrackList& _getVertexTrackList(void) const;
+
+        /// Get non-updateable iterator over node tracks
+        VertexTrackIterator getVertexTrackIterator(void) const
+        { return VertexTrackIterator(mVertexTrackList.begin(), mVertexTrackList.end()); }
+
+        /** Optimise an animation by removing unnecessary tracks and keyframes.
+        @remarks
+            When you export an animation, it is possible that certain tracks
+            have been keyframed but actually don't include anything useful - the
+            keyframes include no transformation. These tracks can be completely
+            eliminated from the animation and thus speed up the animation. 
+            In addition, if several keyframes in a row have the same value, 
+            then they are just adding overhead and can be removed.
+        @note
+            Since track-less and identity track has difference behavior for
+            accumulate animation blending if corresponding track presenting at
+            other animation that is non-identity, and in normally this method
+            didn't known about the situation of other animation, it can't deciding
+            whether or not discards identity tracks. So there have a parameter
+            allow you choose what you want, in case you aren't sure how to do that,
+            you should use Skeleton::optimiseAllAnimations instead.
+        @param
+            discardIdentityNodeTracks If true, discard identity node tracks.
+        */
+        void optimise(bool discardIdentityNodeTracks = true);
+
+        /// A list of track handles
+        typedef set<ushort>::type TrackHandleList;
+
+        /** Internal method for collecting identity node tracks.
+        @remarks
+            This method remove non-identity node tracks form the track handle list.
+        @param
+            tracks A list of track handle of non-identity node tracks, where this
+            method will remove non-identity node track handles.
+        */
+        void _collectIdentityNodeTracks(TrackHandleList& tracks) const;
+
+        /** Internal method for destroy given node tracks.
+        */
+        void _destroyNodeTracks(const TrackHandleList& tracks);
+
+        /** Clone this animation.
+        @note
+            The pointer returned from this method is the only one recorded, 
+            thus it is up to the caller to arrange for the deletion of this
+            object.
+        */
+        Animation* clone(const String& newName) const;
+        
+        /** Internal method used to tell the animation that keyframe list has been
+            changed, which may cause it to rebuild some internal data */
+        void _keyFrameListChanged(void) { mKeyFrameTimesDirty = true; }
+
+        /** Internal method used to convert time position to time index object.
+        @note
+            The time index returns by this function are associated with state of
+            the animation object, if the animation object altered (e.g. create/remove
+            keyframe or track), all related time index will invalidated.
+        @param timePos The time position.
+        @return The time index object which contains wrapped time position (in
+            relation to the whole animation sequence) and lower bound index of
+            global keyframe time list.
+        */
+        TimeIndex _getTimeIndex(Real timePos) const;
+        
+        /** Sets a base keyframe which for the skeletal / pose keyframes 
+            in this animation. 
+        @remarks
+            Skeletal and pose animation keyframes are expressed as deltas from a 
+            given base state. By default, that is the binding setup of the skeleton, 
+            or the object space mesh positions for pose animation. However, sometimes
+            it is useful for animators to create animations with a different starting
+            pose, because that's more convenient, and the animation is designed to
+            simply be added to the existing animation state and not globally averaged
+            with other animations (this is always the case with pose animations, but
+            is activated for skeletal animations via ANIMBLEND_CUMULATIVE).
+        @par
+            In order for this to work, the keyframes need to be 're-based' against
+            this new starting state, for example by treating the first keyframe as
+            the reference point (and therefore representing no change). This can 
+            be achieved by applying the inverse of this reference keyframe against
+            all other keyframes. Since this fundamentally changes the animation, 
+            this method just marks the animation as requiring this rebase, which 
+            is performed at the next Animation 'apply' call. This is to allow the
+            Animation to be re-saved with this flag set, but without having altered
+            the keyframes yet, so no data is lost unintentionally. If you wish to
+            save the animation after the adjustment has taken place, you can
+            (@see _applyBaseKeyFrame)
+        @param useBaseKeyFrame Whether a base keyframe should be used
+        @param keyframeTime The time corresponding to the base keyframe, if any
+        @param baseAnimName Optionally a different base animation (must contain the same tracks)
+        */
+        void setUseBaseKeyFrame(bool useBaseKeyFrame, Real keyframeTime = 0.0f, const String& baseAnimName = StringUtil::BLANK);
+        /** Whether a base keyframe is being used for this Animation. */
+        bool getUseBaseKeyFrame() const;
+        /** If a base keyframe is being used, the time of that keyframe. */
+        Real getBaseKeyFrameTime() const;
+        /** If a base keyframe is being used, the Animation that provides that keyframe. */
+        const String& getBaseKeyFrameAnimationName() const;
+        
+        /// Internal method to adjust keyframes relative to a base keyframe (@see setUseBaseKeyFrame) */
+        void _applyBaseKeyFrame();
+        
+        void _notifyContainer(AnimationContainer* c);
+        /** Retrieve the container of this animation. */
+        AnimationContainer* getContainer();
+        
+    protected:
+        /// Node tracks, indexed by handle
+        NodeTrackList mNodeTrackList;
+        /// Numeric tracks, indexed by handle
+        NumericTrackList mNumericTrackList;
+        /// Vertex tracks, indexed by handle
+        VertexTrackList mVertexTrackList;
+        String mName;
+
+        Real mLength;
+        
+        InterpolationMode mInterpolationMode;
+        RotationInterpolationMode mRotationInterpolationMode;
+
+        static InterpolationMode msDefaultInterpolationMode;
+        static RotationInterpolationMode msDefaultRotationInterpolationMode;
+
+        /// Global keyframe time list used to search global keyframe index.
+        typedef vector<Real>::type KeyFrameTimeList;
+        mutable KeyFrameTimeList mKeyFrameTimes;
+        /// Dirty flag indicate that keyframe time list need to rebuild
+        mutable bool mKeyFrameTimesDirty;
+
+        bool mUseBaseKeyFrame;
+        Real mBaseKeyFrameTime;
+        String mBaseKeyFrameAnimationName;
+        AnimationContainer* mContainer;
+
+        void optimiseNodeTracks(bool discardIdentityTracks);
+        void optimiseVertexTracks(void);
+
+        /// Internal method to build global keyframe time list
+        void buildKeyFrameTimeList(void) const;
+    };
+
+    /** @} */
+    /** @} */
+} // namespace Ogre
+
+#include "OgreHeaderSuffix.h"
+
+#endif // __Animation_H__
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreAnimationState.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreAnimationState.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreAnimationState.h	(revision 148)
@@ -0,0 +1,299 @@
+/*
+-----------------------------------------------------------------------------
+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 __AnimationSet_H__
+#define __AnimationSet_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreString.h"
+#include "OgreController.h"
+#include "OgreIteratorWrappers.h"
+#include "Threading/OgreThreadHeaders.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Animation
+	*  @{
+	*/
+
+    /** Represents the state of an animation and the weight of its influence. 
+    @remarks
+        Other classes can hold instances of this class to store the state of any animations
+        they are using.
+    */
+	class _OgreExport AnimationState : public AnimationAlloc
+    {
+    public:
+
+        /// Typedef for an array of float values used as a bone blend mask
+        typedef vector<float>::type BoneBlendMask;
+
+        /** Normal constructor with all params supplied
+            @param
+                animName The name of this state.
+            @param
+                parent The parent AnimationStateSet that this state will belong to.
+            @param
+                timePos The position, in seconds, where this state will begin.
+            @param
+                length The length, in seconds, of this animation state.
+            @param
+                weight Weight to apply the animation state with.
+            @param
+                enabled Whether the animation state is enabled.
+        */
+        AnimationState(const String& animName, AnimationStateSet *parent, 
+			Real timePos, Real length, Real weight = 1.0, bool enabled = false);
+		/// Constructor to copy from an existing state with new parent
+		AnimationState(AnimationStateSet* parent, const AnimationState &rhs);
+		virtual ~AnimationState();
+        
+        /// Gets the name of the animation to which this state applies
+        const String& getAnimationName() const;
+        /// Gets the time position for this animation
+        Real getTimePosition(void) const;
+        /// Sets the time position for this animation
+        void setTimePosition(Real timePos);
+        /// Gets the total length of this animation (may be shorter than whole animation)
+        Real getLength() const;
+        /// Sets the total length of this animation (may be shorter than whole animation)
+        void setLength(Real len);
+        /// Gets the weight (influence) of this animation
+        Real getWeight(void) const;
+        /// Sets the weight (influence) of this animation
+        void setWeight(Real weight);
+        /** Modifies the time position, adjusting for animation length
+        @param offset The amount of time, in seconds, to extend the animation.
+        @remarks
+            This method loops at the edges if animation looping is enabled.
+        */
+        void addTime(Real offset);
+
+		/// Returns true if the animation has reached the end and is not looping
+		bool hasEnded(void) const;
+
+        /// Returns true if this animation is currently enabled
+        bool getEnabled(void) const;
+        /// Sets whether this animation is enabled
+        void setEnabled(bool enabled);
+
+        /// Equality operator
+        bool operator==(const AnimationState& rhs) const;
+        /// Inequality operator
+        bool operator!=(const AnimationState& rhs) const;
+
+        /** Sets whether or not an animation loops at the start and end of
+            the animation if the time continues to be altered.
+        */
+        void setLoop(bool loop) { mLoop = loop; }
+        /// Gets whether or not this animation loops            
+        bool getLoop(void) const { return mLoop; }
+     
+        /** Copies the states from another animation state, preserving the animation name
+        (unlike operator=) but copying everything else.
+        @param animState Reference to animation state which will use as source.
+        */
+        void copyStateFrom(const AnimationState& animState);
+
+		/// Get the parent animation state set
+		AnimationStateSet* getParent(void) const { return mParent; }
+
+      /** @brief Create a new blend mask with the given number of entries
+       *
+       * In addition to assigning a single weight value to a skeletal animation,
+       * it may be desirable to assign animation weights per bone using a 'blend mask'.
+       *
+       * @param blendMaskSizeHint 
+       *   The number of bones of the skeleton owning this AnimationState.
+	   * @param initialWeight
+	   *   The value all the blend mask entries will be initialised with (negative to skip initialisation)
+       */
+      void createBlendMask(size_t blendMaskSizeHint, float initialWeight = 1.0f);
+      /// Destroy the currently set blend mask
+      void destroyBlendMask();
+      /** @brief Set the blend mask data (might be dangerous)
+       *
+       * @par The size of the array should match the number of entries the
+       *      blend mask was created with.
+       *
+       * @par Stick to the setBlendMaskEntry method if you don't know exactly what you're doing.
+       */
+      void _setBlendMaskData(const float* blendMaskData);
+      /** @brief Set the blend mask
+       *
+       * @par The size of the array should match the number of entries the
+       *      blend mask was created with.
+       *
+       * @par Stick to the setBlendMaskEntry method if you don't know exactly what you're doing.
+       */
+      void _setBlendMask(const BoneBlendMask* blendMask);
+      /// Get the current blend mask (const version, may be 0) 
+      const BoneBlendMask* getBlendMask() const {return mBlendMask;}
+      /// Return whether there is currently a valid blend mask set
+      bool hasBlendMask() const {return mBlendMask != 0;}
+      /// Set the weight for the bone identified by the given handle
+      void setBlendMaskEntry(size_t boneHandle, float weight);
+      /// Get the weight for the bone identified by the given handle
+      inline float getBlendMaskEntry(size_t boneHandle) const
+      {
+          assert(mBlendMask && mBlendMask->size() > boneHandle);
+          return (*mBlendMask)[boneHandle];
+      }
+    protected:
+        /// The blend mask (containing per bone weights)
+        BoneBlendMask* mBlendMask;
+
+        String mAnimationName;
+		AnimationStateSet* mParent;
+        Real mTimePos;
+        Real mLength;
+        Real mWeight;
+        bool mEnabled;
+        bool mLoop;
+
+    };
+
+	// A map of animation states
+	typedef map<String, AnimationState*>::type AnimationStateMap;
+	typedef MapIterator<AnimationStateMap> AnimationStateIterator;
+	typedef ConstMapIterator<AnimationStateMap> ConstAnimationStateIterator;
+    // A list of enabled animation states
+    typedef list<AnimationState*>::type EnabledAnimationStateList;
+    typedef ConstVectorIterator<EnabledAnimationStateList> ConstEnabledAnimationStateIterator;
+
+	/** Class encapsulating a set of AnimationState objects.
+	*/
+	class _OgreExport AnimationStateSet : public AnimationAlloc
+	{
+	public:
+		/// Mutex, public for external locking if needed
+            OGRE_AUTO_MUTEX;
+		/// Create a blank animation state set
+		AnimationStateSet();
+		/// Create an animation set by copying the contents of another
+		AnimationStateSet(const AnimationStateSet& rhs);
+
+		~AnimationStateSet();
+
+		/** Create a new AnimationState instance. 
+		@param animName The name of the animation
+		@param timePos Starting time position
+		@param length Length of the animation to play
+		@param weight Weight to apply the animation with 
+		@param enabled Whether the animation is enabled
+		*/
+		AnimationState* createAnimationState(const String& animName,  
+			Real timePos, Real length, Real weight = 1.0, bool enabled = false);
+		/// Get an animation state by the name of the animation
+		AnimationState* getAnimationState(const String& name) const;
+		/// Tests if state for the named animation is present
+		bool hasAnimationState(const String& name) const;
+		/// Remove animation state with the given name
+		void removeAnimationState(const String& name);
+		/// Remove all animation states
+		void removeAllAnimationStates(void);
+
+		/** Get an iterator over all the animation states in this set.
+		@note
+			The iterator returned from this method is not threadsafe,
+			you will need to manually lock the public mutex on this
+			class to ensure thread safety if you need it.
+		*/
+		AnimationStateIterator getAnimationStateIterator(void);
+		/** Get an iterator over all the animation states in this set.
+		@note
+			The iterator returned from this method is not threadsafe,
+			you will need to manually lock the public mutex on this
+			class to ensure thread safety if you need it.
+		*/
+		ConstAnimationStateIterator getAnimationStateIterator(void) const;
+		/// Copy the state of any matching animation states from this to another
+		void copyMatchingState(AnimationStateSet* target) const;
+		/// Set the dirty flag and dirty frame number on this state set
+		void _notifyDirty(void);
+		/// Get the latest animation state been altered frame number
+		unsigned long getDirtyFrameNumber(void) const { return mDirtyFrameNumber; }
+
+        /// Internal method respond to enable/disable an animation state
+        void _notifyAnimationStateEnabled(AnimationState* target, bool enabled);
+        /// Tests if exists enabled animation state in this set
+        bool hasEnabledAnimationState(void) const { return !mEnabledAnimationStates.empty(); }
+		/** Get an iterator over all the enabled animation states in this set
+		@note
+			The iterator returned from this method is not threadsafe,
+			you will need to manually lock the public mutex on this
+			class to ensure thread safety if you need it.
+		*/
+		ConstEnabledAnimationStateIterator getEnabledAnimationStateIterator(void) const;
+
+	protected:
+		unsigned long mDirtyFrameNumber;
+		AnimationStateMap mAnimationStates;
+        EnabledAnimationStateList mEnabledAnimationStates;
+
+	};
+
+	/** ControllerValue wrapper class for AnimationState.
+	@remarks
+		In Azathoth and earlier, AnimationState was a ControllerValue but this
+		actually causes memory problems since Controllers delete their values
+		automatically when there are no further references to them, but AnimationState
+		is deleted explicitly elsewhere so this causes double-free problems.
+		This wrapper acts as a bridge and it is this which is destroyed automatically.
+	*/
+	class _OgreExport AnimationStateControllerValue : public ControllerValue<Real>
+	{
+	protected:
+		AnimationState* mTargetAnimationState;
+	public:
+		/** Constructor, pass in the target animation state. */
+		AnimationStateControllerValue(AnimationState* targetAnimationState)
+			: mTargetAnimationState(targetAnimationState) {}
+		/// Destructor (parent already virtual)
+		~AnimationStateControllerValue() {}
+		/** ControllerValue implementation. */
+		Real getValue(void) const;
+
+		/** ControllerValue implementation. */
+		void setValue(Real value);
+
+	};
+
+	/** @} */	
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreAnimationTrack.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreAnimationTrack.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreAnimationTrack.h	(revision 148)
@@ -0,0 +1,583 @@
+/*
+-----------------------------------------------------------------------------
+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 __AnimationTrack_H__
+#define __AnimationTrack_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreSimpleSpline.h"
+#include "OgreRotationalSpline.h"
+#include "OgreKeyFrame.h"
+#include "OgreAnimable.h"
+#include "OgrePose.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre 
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Animation
+	*  @{
+	*/
+    /** Time index object used to search keyframe at the given position.
+    */
+    class _OgreExport TimeIndex
+    {
+    protected:
+        /** The time position (in relation to the whole animation sequence)
+        */
+        Real mTimePos;
+        /** The global keyframe index (in relation to the whole animation sequence)
+            that used to convert to local keyframe index, or INVALID_KEY_INDEX which
+            means global keyframe index unavailable, and then slight slow method will
+            used to search local keyframe index.
+        */
+        uint mKeyIndex;
+
+        /** Indicate it's an invalid global keyframe index.
+        */
+        static const uint INVALID_KEY_INDEX = (uint)-1;
+
+    public:
+        /** Construct time index object by the given time position.
+        */
+        TimeIndex(Real timePos)
+            : mTimePos(timePos)
+            , mKeyIndex(INVALID_KEY_INDEX)
+        {
+        }
+
+        /** Construct time index object by the given time position and
+            global keyframe index.
+        @note In normally, you don't need to use this constructor directly, use
+            Animation::_getTimeIndex instead.
+        */
+        TimeIndex(Real timePos, uint keyIndex)
+            : mTimePos(timePos)
+            , mKeyIndex(keyIndex)
+        {
+        }
+
+        bool hasKeyIndex(void) const
+        {
+            return mKeyIndex != INVALID_KEY_INDEX;
+        }
+
+        Real getTimePos(void) const
+        {
+            return mTimePos;
+        }
+
+        uint getKeyIndex(void) const
+        {
+            return mKeyIndex;
+        }
+    };
+
+    /** A 'track' in an animation sequence, i.e. a sequence of keyframes which affect a
+        certain type of animable object.
+    @remarks
+        This class is intended as a base for more complete classes which will actually
+        animate specific types of object, e.g. a bone in a skeleton to affect
+        skeletal animation. An animation will likely include multiple tracks each of which
+        can be made up of many KeyFrame instances. Note that the use of tracks allows each animable
+        object to have it's own number of keyframes, i.e. you do not have to have the
+        maximum number of keyframes for all animable objects just to cope with the most
+        animated one.
+    @remarks
+        Since the most common animable object is a Node, there are options in this class for associating
+        the track with a Node which will receive keyframe updates automatically when the 'apply' method
+        is called.
+	@remarks
+		By default rotation is done using shortest-path algorithm.
+		It is possible to change this behaviour using
+		setUseShortestRotationPath() method.
+    */
+	class _OgreExport AnimationTrack : public AnimationAlloc
+    {
+    public:
+
+		/** Listener allowing you to override certain behaviour of a track, 
+			for example to drive animation procedurally.
+		*/
+		class _OgreExport Listener
+		{
+		public:
+			virtual ~Listener() {}
+
+			/** Get an interpolated keyframe for this track at the given time.
+			@return true if the KeyFrame was populated, false if not.
+			*/
+			virtual bool getInterpolatedKeyFrame(const AnimationTrack* t, const TimeIndex& timeIndex, KeyFrame* kf) = 0;
+		};
+
+        /// Constructor
+        AnimationTrack(Animation* parent, unsigned short handle);
+
+        virtual ~AnimationTrack();
+
+		/** Get the handle associated with this track. */
+		unsigned short getHandle(void) const { return mHandle; }
+
+        /** Returns the number of keyframes in this animation. */
+        virtual unsigned short getNumKeyFrames(void) const;
+
+        /** Returns the KeyFrame at the specified index. */
+        virtual KeyFrame* getKeyFrame(unsigned short index) const;
+
+        /** Gets the 2 KeyFrame objects which are active at the time given, and the blend value between them.
+        @remarks
+            At any point in time  in an animation, there are either 1 or 2 keyframes which are 'active',
+            1 if the time index is exactly on a keyframe, 2 at all other times i.e. the keyframe before
+            and the keyframe after.
+        @par
+            This method returns those keyframes given a time index, and also returns a parametric
+            value indicating the value of 't' representing where the time index falls between them.
+            E.g. if it returns 0, the time index is exactly on keyFrame1, if it returns 0.5 it is
+            half way between keyFrame1 and keyFrame2 etc.
+        @param timeIndex The time index.
+        @param keyFrame1 Pointer to a KeyFrame pointer which will receive the pointer to the 
+            keyframe just before or at this time index.
+        @param keyFrame2 Pointer to a KeyFrame pointer which will receive the pointer to the 
+            keyframe just after this time index. 
+        @param firstKeyIndex Pointer to an unsigned short which, if supplied, will receive the 
+            index of the 'from' keyframe in case the caller needs it.
+        @return Parametric value indicating how far along the gap between the 2 keyframes the timeIndex
+            value is, e.g. 0.0 for exactly at 1, 0.25 for a quarter etc. By definition the range of this 
+            value is:  0.0 <= returnValue < 1.0 .
+        */
+        virtual Real getKeyFramesAtTime(const TimeIndex& timeIndex, KeyFrame** keyFrame1, KeyFrame** keyFrame2,
+            unsigned short* firstKeyIndex = 0) const;
+
+        /** Creates a new KeyFrame and adds it to this animation at the given time index.
+        @remarks
+            It is better to create KeyFrames in time order. Creating them out of order can result 
+            in expensive reordering processing. Note that a KeyFrame at time index 0.0 is always created
+            for you, so you don't need to create this one, just access it using getKeyFrame(0);
+        @param timePos The time from which this KeyFrame will apply.
+        */
+        virtual KeyFrame* createKeyFrame(Real timePos);
+
+        /** Removes a KeyFrame by it's index. */
+        virtual void removeKeyFrame(unsigned short index);
+
+        /** Removes all the KeyFrames from this track. */
+        virtual void removeAllKeyFrames(void);
+
+
+        /** Gets a KeyFrame object which contains the interpolated transforms at the time index specified.
+        @remarks
+            The KeyFrame objects held by this class are transformation snapshots at 
+            discrete points in time. Normally however, you want to interpolate between these
+            keyframes to produce smooth movement, and this method allows you to do this easily.
+            In animation terminology this is called 'tweening'. 
+        @param timeIndex The time (in relation to the whole animation sequence)
+        @param kf Keyframe object to store results
+        */
+        virtual void getInterpolatedKeyFrame(const TimeIndex& timeIndex, KeyFrame* kf) const = 0;
+
+        /** Applies an animation track to the designated target.
+        @param timeIndex The time position in the animation to apply.
+        @param weight The influence to give to this track, 1.0 for full influence, less to blend with
+          other animations.
+	    @param scale The scale to apply to translations and scalings, useful for 
+			adapting an animation to a different size target.
+        */
+        virtual void apply(const TimeIndex& timeIndex, Real weight = 1.0, Real scale = 1.0f) = 0;
+
+        /** Internal method used to tell the track that keyframe data has been 
+            changed, which may cause it to rebuild some internal data. */
+		virtual void _keyFrameDataChanged(void) const {}
+
+		/** Method to determine if this track has any KeyFrames which are
+		doing anything useful - can be used to determine if this track
+		can be optimised out.
+		*/
+		virtual bool hasNonZeroKeyFrames(void) const { return true; }
+
+		/** Optimise the current track by removing any duplicate keyframes. */
+		virtual void optimise(void) {}
+
+        /** Internal method to collect keyframe times, in unique, ordered format. */
+        virtual void _collectKeyFrameTimes(vector<Real>::type& keyFrameTimes);
+
+        /** Internal method to build keyframe time index map to translate global lower
+            bound index to local lower bound index. */
+        virtual void _buildKeyFrameIndexMap(const vector<Real>::type& keyFrameTimes);
+		
+		/** Internal method to re-base the keyframes relative to a given keyframe. */
+		virtual void _applyBaseKeyFrame(const KeyFrame* base) {}
+
+		/** Set a listener for this track. */
+		virtual void setListener(Listener* l) { mListener = l; }
+
+		/** Returns the parent Animation object for this track. */
+		Animation *getParent() const { return mParent; }
+    protected:
+        typedef vector<KeyFrame*>::type KeyFrameList;
+        KeyFrameList mKeyFrames;
+        Animation* mParent;
+		unsigned short mHandle;
+		Listener* mListener;
+
+        /// Map used to translate global keyframe time lower bound index to local lower bound index
+        typedef vector<ushort>::type KeyFrameIndexMap;
+        KeyFrameIndexMap mKeyFrameIndexMap;
+
+		/// Create a keyframe implementation - must be overridden
+		virtual KeyFrame* createKeyFrameImpl(Real time) = 0;
+
+		/// Internal method for clone implementation
+		virtual void populateClone(AnimationTrack* clone) const;
+		
+
+
+    };
+
+	/** Specialised AnimationTrack for dealing with generic animable values.
+	*/
+	class _OgreExport NumericAnimationTrack : public AnimationTrack
+	{
+	public:
+		/// Constructor
+		NumericAnimationTrack(Animation* parent, unsigned short handle);
+		/// Constructor, associates with an AnimableValue
+		NumericAnimationTrack(Animation* parent, unsigned short handle, 
+			AnimableValuePtr& target);
+
+        /** Creates a new KeyFrame and adds it to this animation at the given time index.
+        @remarks
+            It is better to create KeyFrames in time order. Creating them out of order can result 
+            in expensive reordering processing. Note that a KeyFrame at time index 0.0 is always created
+            for you, so you don't need to create this one, just access it using getKeyFrame(0);
+        @param timePos The time from which this KeyFrame will apply.
+        */
+        virtual NumericKeyFrame* createNumericKeyFrame(Real timePos);
+
+		/// @copydoc AnimationTrack::getInterpolatedKeyFrame
+        virtual void getInterpolatedKeyFrame(const TimeIndex& timeIndex, KeyFrame* kf) const;
+
+		/// @copydoc AnimationTrack::apply
+		virtual void apply(const TimeIndex& timeIndex, Real weight = 1.0, Real scale = 1.0f);
+
+        /** Applies an animation track to a given animable value.
+		@param anim The AnimableValue to which to apply the animation
+        @param timeIndex The time position in the animation to apply.
+        @param weight The influence to give to this track, 1.0 for full influence, less to blend with
+          other animations.
+	    @param scale The scale to apply to translations and scalings, useful for 
+			adapting an animation to a different size target.
+        */
+		void applyToAnimable(const AnimableValuePtr& anim, const TimeIndex& timeIndex, 
+			Real weight = 1.0, Real scale = 1.0f);
+
+		/** Returns a pointer to the associated animable object (if any). */
+		virtual const AnimableValuePtr& getAssociatedAnimable(void) const;
+
+		/** Sets the associated animable object which will be automatically 
+			affected by calls to 'apply'. */
+		virtual void setAssociatedAnimable(const AnimableValuePtr& val);
+
+		/** Returns the KeyFrame at the specified index. */
+		NumericKeyFrame* getNumericKeyFrame(unsigned short index) const;
+
+		/** Clone this track (internal use only) */
+		NumericAnimationTrack* _clone(Animation* newParent) const;
+
+
+	protected:
+		/// Target to animate
+		AnimableValuePtr mTargetAnim;
+
+		/// @copydoc AnimationTrack::createKeyFrameImpl
+		KeyFrame* createKeyFrameImpl(Real time);
+
+
+	};
+
+	/** Specialised AnimationTrack for dealing with node transforms.
+	*/
+	class _OgreExport NodeAnimationTrack : public AnimationTrack
+	{
+	public:
+		/// Constructor
+		NodeAnimationTrack(Animation* parent, unsigned short handle);
+		/// Constructor, associates with a Node
+		NodeAnimationTrack(Animation* parent, unsigned short handle, 
+			Node* targetNode);
+        /// Destructor
+        virtual ~NodeAnimationTrack();
+        /** Creates a new KeyFrame and adds it to this animation at the given time index.
+        @remarks
+            It is better to create KeyFrames in time order. Creating them out of order can result 
+            in expensive reordering processing. Note that a KeyFrame at time index 0.0 is always created
+            for you, so you don't need to create this one, just access it using getKeyFrame(0);
+        @param timePos The time from which this KeyFrame will apply.
+        */
+        virtual TransformKeyFrame* createNodeKeyFrame(Real timePos);
+		/** Returns a pointer to the associated Node object (if any). */
+		virtual Node* getAssociatedNode(void) const;
+
+		/** Sets the associated Node object which will be automatically affected by calls to 'apply'. */
+		virtual void setAssociatedNode(Node* node);
+
+		/** As the 'apply' method but applies to a specified Node instead of associated node. */
+		virtual void applyToNode(Node* node, const TimeIndex& timeIndex, Real weight = 1.0, 
+			Real scale = 1.0f);
+
+		/** Sets the method of rotation calculation */
+		virtual void setUseShortestRotationPath(bool useShortestPath);
+
+		/** Gets the method of rotation calculation */
+		virtual bool getUseShortestRotationPath() const;
+
+		/// @copydoc AnimationTrack::getInterpolatedKeyFrame
+        virtual void getInterpolatedKeyFrame(const TimeIndex& timeIndex, KeyFrame* kf) const;
+
+		/// @copydoc AnimationTrack::apply
+		virtual void apply(const TimeIndex& timeIndex, Real weight = 1.0, Real scale = 1.0f);
+
+		/// @copydoc AnimationTrack::_keyFrameDataChanged
+		void _keyFrameDataChanged(void) const;
+
+		/** Returns the KeyFrame at the specified index. */
+		virtual TransformKeyFrame* getNodeKeyFrame(unsigned short index) const;
+
+
+		/** Method to determine if this track has any KeyFrames which are
+			doing anything useful - can be used to determine if this track
+			can be optimised out.
+		*/
+		virtual bool hasNonZeroKeyFrames(void) const;
+
+		/** Optimise the current track by removing any duplicate keyframes. */
+		virtual void optimise(void);
+
+		/** Clone this track (internal use only) */
+		NodeAnimationTrack* _clone(Animation* newParent) const;
+		
+		void _applyBaseKeyFrame(const KeyFrame* base);
+		
+	protected:
+		/// Specialised keyframe creation
+		KeyFrame* createKeyFrameImpl(Real time);
+		// Flag indicating we need to rebuild the splines next time
+		virtual void buildInterpolationSplines(void) const;
+
+        // Struct for store splines, allocate on demand for better memory footprint
+        struct Splines
+        {
+		    SimpleSpline positionSpline;
+		    SimpleSpline scaleSpline;
+		    RotationalSpline rotationSpline;
+        };
+
+		Node* mTargetNode;
+		// Prebuilt splines, must be mutable since lazy-update in const method
+		mutable Splines* mSplines;
+		mutable bool mSplineBuildNeeded;
+		/// Defines if rotation is done using shortest path
+		mutable bool mUseShortestRotationPath ;
+	};
+
+	/** Type of vertex animation.
+		Vertex animation comes in 2 types, morph and pose. The reason
+		for the 2 types is that we have 2 different potential goals - to encapsulate
+		a complete, flowing morph animation with multiple keyframes (a typical animation,
+		but implemented by having snapshots of the vertex data at each keyframe), 
+		or to represent a single pose change, for example a facial expression. 
+		Whilst both could in fact be implemented using the same system, we choose
+		to separate them since the requirements and limitations of each are quite
+		different.
+	@par
+		Morph animation is a simple approach where we have a whole series of 
+		snapshots of vertex data which must be interpolated, e.g. a running 
+		animation implemented as morph targets. Because this is based on simple
+		snapshots, it's quite fast to use when animating an entire mesh because 
+		it's a simple linear change between keyframes. However, this simplistic 
+		approach does not support blending between multiple morph animations. 
+		If you need animation blending, you are advised to use skeletal animation
+		for full-mesh animation, and pose animation for animation of subsets of 
+		meshes or where skeletal animation doesn't fit - for example facial animation.
+		For animating in a vertex shader, morph animation is quite simple and 
+		just requires the 2 vertex buffers (one the original position buffer) 
+		of absolute position data, and an interpolation factor. Each track in 
+		a morph animation references a unique set of vertex data.
+	@par
+		Pose animation is more complex. Like morph animation each track references
+		a single unique set of vertex data, but unlike morph animation, each 
+		keyframe references 1 or more 'poses', each with an influence level. 
+		A pose is a series of offsets to the base vertex data, and may be sparse - ie it
+		may not reference every vertex. Because they're offsets, they can be 
+		blended - both within a track and between animations. This set of features
+		is very well suited to facial animation.
+	@par
+		For example, let's say you modelled a face (one set of vertex data), and 
+		defined a set of poses which represented the various phonetic positions 
+		of the face. You could then define an animation called 'SayHello', containing
+		a single track which referenced the face vertex data, and which included 
+		a series of keyframes, each of which referenced one or more of the facial 
+		positions at different influence levels - the combination of which over
+		time made the face form the shapes required to say the word 'hello'. Since
+		the poses are only stored once, but can be referenced may times in 
+		many animations, this is a very powerful way to build up a speech system.
+	@par
+		The downside of pose animation is that it can be more difficult to set up.
+		Also, since it uses more buffers (one for the base data, and one for each
+		active pose), if you're animating in hardware using vertex shaders you need
+		to keep an eye on how many poses you're blending at once. You define a
+		maximum supported number in your vertex program definition, see the 
+		includes_pose_animation material script entry. 
+	@par
+		So, by partitioning the vertex animation approaches into 2, we keep the
+		simple morph technique easy to use, whilst still allowing all 
+		the powerful techniques to be used. Note that morph animation cannot
+		be blended with other types of vertex animation (pose animation or other
+		morph animation); pose animation can be blended with other pose animation
+		though, and both types can be combined with skeletal animation. Also note
+		that all morph animation can be expressed as pose animation, but not vice
+		versa.
+	*/
+	enum VertexAnimationType
+	{
+		/// No animation
+		VAT_NONE = 0,
+		/// Morph animation is made up of many interpolated snapshot keyframes
+		VAT_MORPH = 1,
+		/// Pose animation is made up of a single delta pose keyframe
+		VAT_POSE = 2
+	};
+
+	/** Specialised AnimationTrack for dealing with changing vertex position information.
+	@see VertexAnimationType
+	*/
+	class _OgreExport VertexAnimationTrack : public AnimationTrack
+	{
+	public:
+		/** The target animation mode */
+		enum TargetMode
+		{
+			/// Interpolate vertex positions in software
+			TM_SOFTWARE, 
+			/** Bind keyframe 1 to position, and keyframe 2 to a texture coordinate
+				for interpolation in hardware */
+			TM_HARDWARE
+		};
+		/// Constructor
+		VertexAnimationTrack(Animation* parent, unsigned short handle, VertexAnimationType animType);
+		/// Constructor, associates with target VertexData and temp buffer (for software)
+		VertexAnimationTrack(Animation* parent, unsigned short handle, VertexAnimationType animType, 
+			VertexData* targetData, TargetMode target = TM_SOFTWARE);
+
+		/** Get the type of vertex animation we're performing. */
+		VertexAnimationType getAnimationType(void) const { return mAnimationType; }
+		
+		/** Whether the vertex animation (if present) includes normals */
+		bool getVertexAnimationIncludesNormals() const;
+
+		/** Creates a new morph KeyFrame and adds it to this animation at the given time index.
+		@remarks
+		It is better to create KeyFrames in time order. Creating them out of order can result 
+		in expensive reordering processing. Note that a KeyFrame at time index 0.0 is always created
+		for you, so you don't need to create this one, just access it using getKeyFrame(0);
+		@param timePos The time from which this KeyFrame will apply.
+		*/
+		virtual VertexMorphKeyFrame* createVertexMorphKeyFrame(Real timePos);
+
+		/** Creates the single pose KeyFrame and adds it to this animation.
+		*/
+		virtual VertexPoseKeyFrame* createVertexPoseKeyFrame(Real timePos);
+
+		/** @copydoc AnimationTrack::getInterpolatedKeyFrame
+		*/
+        virtual void getInterpolatedKeyFrame(const TimeIndex& timeIndex, KeyFrame* kf) const;
+
+		/// @copydoc AnimationTrack::apply
+		virtual void apply(const TimeIndex& timeIndex, Real weight = 1.0, Real scale = 1.0f);
+
+		/** As the 'apply' method but applies to specified VertexData instead of 
+			associated data. */
+		virtual void applyToVertexData(VertexData* data, 
+			const TimeIndex& timeIndex, Real weight = 1.0, 
+			const PoseList* poseList = 0);
+
+
+		/** Returns the morph KeyFrame at the specified index. */
+		VertexMorphKeyFrame* getVertexMorphKeyFrame(unsigned short index) const;
+
+		/** Returns the pose KeyFrame at the specified index. */
+		VertexPoseKeyFrame* getVertexPoseKeyFrame(unsigned short index) const;
+
+		/** Sets the associated VertexData which this track will update. */
+		void setAssociatedVertexData(VertexData* data) { mTargetVertexData = data; }
+		/** Gets the associated VertexData which this track will update. */
+		VertexData* getAssociatedVertexData(void) const { return mTargetVertexData; }
+
+		/// Set the target mode
+		void setTargetMode(TargetMode m) { mTargetMode = m; }
+		/// Get the target mode
+		TargetMode getTargetMode(void) const { return mTargetMode; }
+
+		/** Method to determine if this track has any KeyFrames which are
+		doing anything useful - can be used to determine if this track
+		can be optimised out.
+		*/
+		virtual bool hasNonZeroKeyFrames(void) const;
+
+		/** Optimise the current track by removing any duplicate keyframes. */
+		virtual void optimise(void);
+
+		/** Clone this track (internal use only) */
+		VertexAnimationTrack* _clone(Animation* newParent) const;
+		
+		void _applyBaseKeyFrame(const KeyFrame* base);
+
+	protected:
+		/// Animation type
+		VertexAnimationType mAnimationType;
+		/// Target to animate
+		VertexData* mTargetVertexData;
+		/// Mode to apply
+		TargetMode mTargetMode;
+
+		/// @copydoc AnimationTrack::createKeyFrameImpl
+		KeyFrame* createKeyFrameImpl(Real time);
+
+		/// Utility method for applying pose animation
+		void applyPoseToVertexData(const Pose* pose, VertexData* data, Real influence);
+
+
+	};
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreAny.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreAny.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreAny.h	(revision 148)
@@ -0,0 +1,442 @@
+/*
+-----------------------------------------------------------------------------
+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.
+-----------------------------------------------------------------------------
+*/
+// -- Based on boost::any, original copyright information follows --
+// Copyright Kevlin Henney, 2000, 2001, 2002. All rights reserved.
+//
+// Distributed under the Boost Software License, Version 1.0. (See
+// accompAnying file LICENSE_1_0.txt or copy at
+// http://www.boost.org/LICENSE_1_0.txt)
+// -- End original copyright --
+
+#ifndef __OGRE_ANY_H__
+#define __OGRE_ANY_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreException.h"
+#include "OgreString.h"
+#include <algorithm>
+#include <typeinfo>
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+	/** Variant type that can hold Any other type.
+	*/
+	class Any 
+    {
+    public: // constructors
+
+        Any()
+          : mContent(0)
+        {
+        }
+
+        template<typename ValueType>
+        explicit Any(const ValueType & value)
+          : mContent(OGRE_NEW_T(holder<ValueType>, MEMCATEGORY_GENERAL)(value))
+        {
+        }
+
+        Any(const Any & other)
+          : mContent(other.mContent ? other.mContent->clone() : 0)
+        {
+        }
+
+        virtual ~Any()
+        {
+            destroy();
+        }
+
+    public: // modifiers
+
+        Any& swap(Any & rhs)
+        {
+            std::swap(mContent, rhs.mContent);
+            return *this;
+        }
+
+        template<typename ValueType>
+        Any& operator=(const ValueType & rhs)
+        {
+            Any(rhs).swap(*this);
+            return *this;
+        }
+
+        Any & operator=(const Any & rhs)
+        {
+            Any(rhs).swap(*this);
+            return *this;
+        }
+
+    public: // queries
+
+        bool isEmpty() const
+        {
+            return !mContent;
+        }
+
+        const std::type_info& getType() const
+        {
+            return mContent ? mContent->getType() : typeid(void);
+        }
+
+		inline friend std::ostream& operator <<
+			( std::ostream& o, const Any& v )
+		{
+			if (v.mContent)
+				v.mContent->writeToStream(o);
+			return o;
+		}
+
+		void destroy()
+		{
+			OGRE_DELETE_T(mContent, placeholder, MEMCATEGORY_GENERAL);
+			mContent = NULL;
+		}
+
+    protected: // types
+
+		class placeholder 
+        {
+        public: // structors
+    
+            virtual ~placeholder()
+            {
+            }
+
+        public: // queries
+
+            virtual const std::type_info& getType() const = 0;
+
+            virtual placeholder * clone() const = 0;
+    
+			virtual void writeToStream(std::ostream& o) = 0;
+
+        };
+
+        template<typename ValueType>
+        class holder : public placeholder
+        {
+        public: // structors
+
+            holder(const ValueType & value)
+              : held(value)
+            {
+            }
+
+        public: // queries
+
+            virtual const std::type_info & getType() const
+            {
+                return typeid(ValueType);
+            }
+
+            virtual placeholder * clone() const
+            {
+                return OGRE_NEW_T(holder, MEMCATEGORY_GENERAL)(held);
+            }
+
+			virtual void writeToStream(std::ostream& o)
+			{
+				o << held;
+			}
+
+
+        public: // representation
+
+            ValueType held;
+
+        };
+
+
+
+    protected: // representation
+        placeholder * mContent;
+
+        template<typename ValueType>
+        friend ValueType * any_cast(Any *);
+
+
+    public: 
+
+	    template<typename ValueType>
+    	ValueType operator()() const
+    	{
+			if (!mContent) 
+			{
+				OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
+					"Bad cast from uninitialised Any", 
+					"Any::operator()");
+			}
+			else if(getType() == typeid(ValueType))
+			{
+             	return static_cast<Any::holder<ValueType> *>(mContent)->held;
+			}
+			else
+			{
+				StringUtil::StrStreamType str;
+				str << "Bad cast from type '" << getType().name() << "' "
+					<< "to '" << typeid(ValueType).name() << "'";
+				OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
+					 str.str(), 
+					"Any::operator()");
+			}
+		}
+
+		template <typename ValueType>
+		ValueType get(void) const
+		{
+			if (!mContent) 
+			{
+				OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
+					"Bad cast from uninitialised Any", 
+					"Any::operator()");
+			}
+			else if(getType() == typeid(ValueType))
+			{
+             	return static_cast<Any::holder<ValueType> *>(mContent)->held;
+			}
+			else
+			{
+				StringUtil::StrStreamType str;
+				str << "Bad cast from type '" << getType().name() << "' "
+					<< "to '" << typeid(ValueType).name() << "'";
+				OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
+					 str.str(), 
+					"Any::operator()");
+			}
+		}
+
+    };
+
+
+	/** Specialised Any class which has built in arithmetic operators, but can 
+		hold only types which support operator +,-,* and / .
+	*/
+	class AnyNumeric : public Any
+	{
+	public:
+		AnyNumeric()
+		: Any()
+		{
+		}
+
+		template<typename ValueType>
+		AnyNumeric(const ValueType & value)
+			
+		{
+			mContent = OGRE_NEW_T(numholder<ValueType>, MEMCATEGORY_GENERAL)(value);
+		}
+
+		AnyNumeric(const AnyNumeric & other)
+            : Any()
+		{
+			mContent = other.mContent ? other.mContent->clone() : 0; 
+		}
+
+	protected:
+		class numplaceholder : public Any::placeholder
+		{
+		public: // structors
+
+			~numplaceholder()
+			{
+			}
+			virtual placeholder* add(placeholder* rhs) = 0;
+			virtual placeholder* subtract(placeholder* rhs) = 0;
+			virtual placeholder* multiply(placeholder* rhs) = 0;
+			virtual placeholder* multiply(Real factor) = 0;
+			virtual placeholder* divide(placeholder* rhs) = 0;
+		};
+
+		template<typename ValueType>
+		class numholder : public numplaceholder
+		{
+		public: // structors
+
+			numholder(const ValueType & value)
+				: held(value)
+			{
+			}
+
+		public: // queries
+
+			virtual const std::type_info & getType() const
+			{
+				return typeid(ValueType);
+			}
+
+			virtual placeholder * clone() const
+			{
+				return OGRE_NEW_T(numholder, MEMCATEGORY_GENERAL)(held);
+			}
+
+			virtual placeholder* add(placeholder* rhs)
+			{
+				return OGRE_NEW_T(numholder, MEMCATEGORY_GENERAL)(held + static_cast<numholder*>(rhs)->held);
+			}
+			virtual placeholder* subtract(placeholder* rhs)
+			{
+				return OGRE_NEW_T(numholder, MEMCATEGORY_GENERAL)(held - static_cast<numholder*>(rhs)->held);
+			}
+			virtual placeholder* multiply(placeholder* rhs)
+			{
+				return OGRE_NEW_T(numholder, MEMCATEGORY_GENERAL)(held * static_cast<numholder*>(rhs)->held);
+			}
+			virtual placeholder* multiply(Real factor)
+			{
+				return OGRE_NEW_T(numholder, MEMCATEGORY_GENERAL)(held * factor);
+			}
+			virtual placeholder* divide(placeholder* rhs)
+			{
+				return OGRE_NEW_T(numholder, MEMCATEGORY_GENERAL)(held / static_cast<numholder*>(rhs)->held);
+			}
+			virtual void writeToStream(std::ostream& o)
+			{
+				o << held;
+			}
+
+		public: // representation
+
+			ValueType held;
+
+		};
+
+		/// Construct from holder
+		AnyNumeric(placeholder* pholder)
+		{
+			mContent = pholder;
+		}
+
+	public:
+		AnyNumeric & operator=(const AnyNumeric & rhs)
+		{
+			AnyNumeric(rhs).swap(*this);
+			return *this;
+		}
+		AnyNumeric operator+(const AnyNumeric& rhs) const
+		{
+			return AnyNumeric(
+				static_cast<numplaceholder*>(mContent)->add(rhs.mContent));
+		}
+		AnyNumeric operator-(const AnyNumeric& rhs) const
+		{
+			return AnyNumeric(
+				static_cast<numplaceholder*>(mContent)->subtract(rhs.mContent));
+		}
+		AnyNumeric operator*(const AnyNumeric& rhs) const
+		{
+			return AnyNumeric(
+				static_cast<numplaceholder*>(mContent)->multiply(rhs.mContent));
+		}
+		AnyNumeric operator*(Real factor) const
+		{
+			return AnyNumeric(
+				static_cast<numplaceholder*>(mContent)->multiply(factor));
+		}
+		AnyNumeric operator/(const AnyNumeric& rhs) const
+		{
+			return AnyNumeric(
+				static_cast<numplaceholder*>(mContent)->divide(rhs.mContent));
+		}
+		AnyNumeric& operator+=(const AnyNumeric& rhs)
+		{
+			*this = AnyNumeric(
+				static_cast<numplaceholder*>(mContent)->add(rhs.mContent));
+			return *this;
+		}
+		AnyNumeric& operator-=(const AnyNumeric& rhs)
+		{
+			*this = AnyNumeric(
+				static_cast<numplaceholder*>(mContent)->subtract(rhs.mContent));
+			return *this;
+		}
+		AnyNumeric& operator*=(const AnyNumeric& rhs)
+		{
+			*this = AnyNumeric(
+				static_cast<numplaceholder*>(mContent)->multiply(rhs.mContent));
+			return *this;
+		}
+		AnyNumeric& operator/=(const AnyNumeric& rhs)
+		{
+			*this = AnyNumeric(
+				static_cast<numplaceholder*>(mContent)->divide(rhs.mContent));
+			return *this;
+		}
+
+
+
+
+	};
+
+
+    template<typename ValueType>
+    ValueType * any_cast(Any * operand)
+    {
+        return operand && (std::strcmp(operand->getType().name(), typeid(ValueType).name()) == 0)
+                    ? &static_cast<Any::holder<ValueType> *>(operand->mContent)->held
+                    : 0;
+    }
+
+    template<typename ValueType>
+    const ValueType * any_cast(const Any * operand)
+    {
+        return any_cast<ValueType>(const_cast<Any *>(operand));
+    }
+
+    template<typename ValueType>
+    ValueType any_cast(const Any & operand)
+    {
+        const ValueType * result = any_cast<ValueType>(&operand);
+        if(!result)
+		{
+			StringUtil::StrStreamType str;
+			str << "Bad cast from type '" << operand.getType().name() << "' "
+				<< "to '" << typeid(ValueType).name() << "'";
+			OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
+				str.str(), 
+				"Ogre::any_cast");
+		}
+        return *result;
+    }
+	/** @} */
+	/** @} */
+
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreArchive.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreArchive.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreArchive.h	(revision 148)
@@ -0,0 +1,243 @@
+/*
+-----------------------------------------------------------------------------
+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 _Archive_H__
+#define _Archive_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreString.h"
+#include "OgreDataStream.h"
+#include "OgreSharedPtr.h"
+#include "OgreStringVector.h"
+#include "OgreException.h"
+#include <ctime>
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Resources
+	*  @{
+	*/
+    /** Information about a file/directory within the archive will be
+    returned using a FileInfo struct.
+    @see
+    Archive
+    */
+    struct FileInfo {
+		/// The archive in which the file has been found (for info when performing
+		/// multi-Archive searches, note you should still open through ResourceGroupManager)
+		const Archive* archive;
+        /// The file's fully qualified name
+        String filename;
+        /// Path name; separated by '/' and ending with '/'
+        String path;
+        /// Base filename
+        String basename;
+        /// Compressed size
+        size_t compressedSize;
+        /// Uncompressed size
+        size_t uncompressedSize;
+    };
+
+    typedef vector<FileInfo>::type FileInfoList;
+    typedef SharedPtr<FileInfoList> FileInfoListPtr;
+
+    /** Archive-handling class.
+    @remarks
+        An archive is a generic term for a container of files. This may be a
+        filesystem folder, it may be a compressed archive, it may even be 
+        a remote location shared on the web. This class is designed to be 
+        subclassed to provide access to a range of file locations. 
+    @par
+        Instances of this class are never constructed or even handled by end-user
+        applications. They are constructed by custom ArchiveFactory classes, 
+        which plugins can register new instances of using ArchiveManager. 
+        End-user applications will typically use ResourceManager or 
+        ResourceGroupManager to manage resources at a higher level, rather than 
+        reading files directly through this class. Doing it this way allows you
+        to benefit from OGRE's automatic searching of multiple file locations 
+        for the resources you are looking for.
+    */
+	class _OgreExport Archive : public ArchiveAlloc
+    {
+    protected:
+        /// Archive name
+        String mName; 
+        /// Archive type code
+        String mType;
+		/// Read-only flag
+		bool mReadOnly;
+    public:
+
+
+        /** Constructor - don't call direct, used by ArchiveFactory.
+        */
+        Archive( const String& name, const String& archType )
+            : mName(name), mType(archType), mReadOnly(true) {}
+
+        /** Default destructor.
+        */
+        virtual ~Archive() {}
+
+		/// Get the name of this archive
+		const String& getName(void) const { return mName; }
+
+        /// Returns whether this archive is case sensitive in the way it matches files
+        virtual bool isCaseSensitive(void) const = 0;
+
+        /** Loads the archive.
+        @remarks
+            This initializes all the internal data of the class.
+        @warning
+            Do not call this function directly, it is meant to be used
+            only by the ArchiveManager class.
+        */
+        virtual void load() = 0;
+
+        /** Unloads the archive.
+        @warning
+            Do not call this function directly, it is meant to be used
+            only by the ArchiveManager class.
+        */
+        virtual void unload() = 0;
+
+		/** Reports whether this Archive is read-only, or whether the contents
+			can be updated. 
+		*/
+		virtual bool isReadOnly() const { return mReadOnly; }
+
+        /** Open a stream on a given file. 
+        @note
+            There is no equivalent 'close' method; the returned stream
+            controls the lifecycle of this file operation.
+        @param filename The fully qualified name of the file
+		@param readOnly Whether to open the file in read-only mode or not (note, 
+			if the archive is read-only then this cannot be set to false)
+        @return A shared pointer to a DataStream which can be used to 
+            read / write the file. If the file is not present, returns a null
+			shared pointer.
+        */
+        virtual DataStreamPtr open(const String& filename, bool readOnly = true) const = 0;
+
+		/** Create a new file (or overwrite one already there). 
+		@note If the archive is read-only then this method will fail.
+		@param filename The fully qualified name of the file
+		@return A shared pointer to a DataStream which can be used to 
+		read / write the file. 
+		*/
+		virtual DataStreamPtr create(const String& filename) const
+		{
+                        (void)filename;
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, 
+				"This archive does not support creation of files.", 
+				"Archive::create");
+		}
+
+		/** Delete a named file.
+		@remarks Not possible on read-only archives
+		@param filename The fully qualified name of the file
+		*/
+		virtual void remove(const String& filename) const
+		{
+                        (void)filename;
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, 
+				"This archive does not support removal of files.", 
+				"Archive::remove");
+		}
+
+        /** List all file names in the archive.
+        @note
+            This method only returns filenames, you can also retrieve other
+            information using listFileInfo.
+        @param recursive Whether all paths of the archive are searched (if the 
+            archive has a concept of that)
+        @param dirs Set to true if you want the directories to be listed
+            instead of files
+        @return A list of filenames matching the criteria, all are fully qualified
+        */
+        virtual StringVectorPtr list(bool recursive = true, bool dirs = false) = 0;
+        
+        /** List all files in the archive with accompanying information.
+        @param recursive Whether all paths of the archive are searched (if the 
+            archive has a concept of that)
+        @param dirs Set to true if you want the directories to be listed
+            instead of files
+        @return A list of structures detailing quite a lot of information about
+            all the files in the archive.
+        */
+        virtual FileInfoListPtr listFileInfo(bool recursive = true, bool dirs = false) = 0;
+
+        /** Find all file or directory names matching a given pattern
+            in this archive.
+        @note
+            This method only returns filenames, you can also retrieve other
+            information using findFileInfo.
+        @param pattern The pattern to search for; wildcards (*) are allowed
+        @param recursive Whether all paths of the archive are searched (if the 
+            archive has a concept of that)
+        @param dirs Set to true if you want the directories to be listed
+            instead of files
+        @return A list of filenames matching the criteria, all are fully qualified
+        */
+        virtual StringVectorPtr find(const String& pattern, bool recursive = true,
+            bool dirs = false) = 0;
+
+        /** Find out if the named file exists (note: fully qualified filename required) */
+        virtual bool exists(const String& filename) = 0; 
+
+		/** Retrieve the modification time of a given file */
+		virtual time_t getModifiedTime(const String& filename) = 0; 
+
+
+        /** Find all files or directories matching a given pattern in this
+            archive and get some detailed information about them.
+        @param pattern The pattern to search for; wildcards (*) are allowed
+        @param recursive Whether all paths of the archive are searched (if the 
+        archive has a concept of that)
+        @param dirs Set to true if you want the directories to be listed
+            instead of files
+        @return A list of file information structures for all files matching 
+            the criteria.
+        */
+        virtual FileInfoListPtr findFileInfo(const String& pattern, 
+            bool recursive = true, bool dirs = false) const = 0;
+
+        /// Return the type code of this Archive
+        const String& getType(void) const { return mType; }
+        
+    };
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreArchiveFactory.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreArchiveFactory.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreArchiveFactory.h	(revision 148)
@@ -0,0 +1,80 @@
+/*
+-----------------------------------------------------------------------------
+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 _ArchiveFactory_H__
+#define _ArchiveFactory_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreFactoryObj.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Resources
+	*  @{
+	*/
+    /** Abstract factory class, archive codec plugins can register concrete
+        subclasses of this.
+        @remarks
+            All access to 'archives' (collections of files, compressed or
+            just folders, maybe even remote) is managed via the abstract
+            Archive class. Plugins are expected to provide the
+            implementation for the actual codec itself, but because a
+            subclass of Archive has to be created for every archive, a
+            factory class is required to create the appropriate subclass.
+        @par
+            So archive plugins create a subclass of Archive AND a subclass
+            of ArchiveFactory which creates instances of the Archive
+            subclass. See the 'Zip' and 'FileSystem' plugins for examples.
+            Each Archive and ArchiveFactory subclass pair deal with a
+            single archive type (identified by a string).
+    */
+    class _OgreExport ArchiveFactory : public FactoryObj< Archive >, public ArchiveAlloc
+    {
+    public:
+        virtual ~ArchiveFactory() {}
+        /** Creates a new object.
+        @param name Name of the object to create
+        @return
+            An object created by the factory. The type of the object depends on
+            the factory.
+        */
+        virtual Archive* createInstance(const String& name, bool readOnly) = 0;
+
+        virtual Archive* createInstance(const String& name) { return createInstance(name, true); }
+    };
+	/** @} */
+	/** @} */
+
+} // namespace
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreArchiveManager.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreArchiveManager.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreArchiveManager.h	(revision 148)
@@ -0,0 +1,142 @@
+/*
+-----------------------------------------------------------------------------
+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 _ArchiveManager_H__
+#define _ArchiveManager_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreResourceManager.h"
+#include "OgreSingleton.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Resources
+	*  @{
+	*/
+    /** This class manages the available ArchiveFactory plugins. 
+    */
+    class _OgreExport ArchiveManager : public Singleton<ArchiveManager>, public ArchiveAlloc
+    {
+    protected:
+        typedef map<String, ArchiveFactory*>::type ArchiveFactoryMap;
+        /// Factories available to create archives, indexed by archive type (String identifier e.g. 'Zip')
+        ArchiveFactoryMap mArchFactories;
+        /// Currently loaded archives
+        typedef map<String, Archive*>::type ArchiveMap;
+        ArchiveMap mArchives;
+
+    public:
+        /** Default constructor - should never get called by a client app.
+        */
+        ArchiveManager();
+        /** Default destructor.
+        */
+        virtual ~ArchiveManager();
+
+        /** Opens an archive for file reading.
+            @remarks
+                The archives are created using class factories within
+                extension libraries.
+            @param filename
+                The filename that will be opened
+            @param archiveType
+                The type of archive that this is. For example: "Zip".
+            @return
+                If the function succeeds, a valid pointer to an Archive
+                object is returned.
+            @par
+                If the function fails, an exception is thrown.
+        */
+        Archive* load( const String& filename, const String& archiveType, bool readOnly);
+
+		/** Unloads an archive.
+		@remarks
+			You must ensure that this archive is not being used before removing it.
+		*/
+		void unload(Archive* arch);
+		/** Unloads an archive by name.
+		@remarks
+			You must ensure that this archive is not being used before removing it.
+		*/
+		void unload(const String& filename);
+		typedef MapIterator<ArchiveMap> ArchiveMapIterator;
+		/** Get an iterator over the Archives in this Manager. */
+		ArchiveMapIterator getArchiveIterator(void);
+
+        /** Adds a new ArchiveFactory to the list of available factories.
+            @remarks
+                Plugin developers who add new archive codecs need to call
+                this after defining their ArchiveFactory subclass and
+                Archive subclasses for their archive type.
+        */
+        void addArchiveFactory(ArchiveFactory* factory);
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static ArchiveManager& getSingleton(void);
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static ArchiveManager* getSingletonPtr(void);
+    };
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreAtomicObject.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreAtomicObject.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreAtomicObject.h	(revision 148)
@@ -0,0 +1,128 @@
+/*
+-----------------------------------------------------------------------------
+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 __AtomicObject_H__
+#define __AtomicObject_H__
+
+#include <signal.h>
+#include "OgrePrerequisites.h"
+#include "Threading/OgreThreadHeaders.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+    template <class T> class AtomicObject {
+
+        public:
+
+        AtomicObject (const T &initial)
+            : mField(initial)
+        {   }
+
+        AtomicObject (const AtomicObject<T> &cousin)
+            : mField(cousin.get())
+        {   }
+
+        AtomicObject ()
+        {   }
+
+        void operator= (const AtomicObject<T> &cousin)
+        {
+            set(cousin.get());
+        }
+
+        T get (void) const
+        {
+            OGRE_LOCK_AUTO_MUTEX;
+            return mField;
+        }
+
+        void set (const T &v)
+        {
+            OGRE_LOCK_AUTO_MUTEX;
+            mField = v;
+        }
+
+        bool cas (const T &old, const T &nu)
+        {
+            OGRE_LOCK_AUTO_MUTEX;
+            if (mField != old) return false;
+            mField = nu;
+            return true;
+        }
+
+        T operator++ (void)
+        {
+            OGRE_LOCK_AUTO_MUTEX;
+            return ++mField;
+        }
+
+        T operator++ (int)
+        {
+            OGRE_LOCK_AUTO_MUTEX;
+            return mField++;
+        }
+
+        T operator-- (int)
+        {
+            OGRE_LOCK_AUTO_MUTEX;
+            return mField--;
+        }
+
+		T operator+=(const T &add)
+		{
+                    OGRE_LOCK_AUTO_MUTEX;
+			mField += add;
+			return mField;
+		}
+
+		T operator-=(const T &sub)
+		{
+                    OGRE_LOCK_AUTO_MUTEX;
+			mField -= sub;
+			return mField;
+		}
+
+        protected:
+
+                OGRE_AUTO_MUTEX;
+
+        volatile T mField;
+
+    };
+	/** @} */
+	/** @} */
+
+}
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreAtomicScalar.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreAtomicScalar.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreAtomicScalar.h	(revision 148)
@@ -0,0 +1,491 @@
+/*
+-----------------------------------------------------------------------------
+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 __AtomicScalar_H__
+#define __AtomicScalar_H__
+
+#include <signal.h>
+#include "OgrePrerequisites.h"
+#include "OgreException.h"
+#include "OgrePlatformInformation.h"
+
+#if (((OGRE_COMPILER == OGRE_COMPILER_GNUC) && (OGRE_COMP_VER >= 412)) || (OGRE_COMPILER == OGRE_COMPILER_CLANG)) && OGRE_THREAD_SUPPORT
+
+// Atomics are not yet supported for the unsigned long long int(ResourceHandle) type as of Clang 5.0. So only GCC for now.
+#if ((OGRE_COMPILER == OGRE_COMPILER_GNUC) && (OGRE_COMP_VER >= 473))
+    #define BUILTIN_FETCH_ADD(var, add) __atomic_fetch_add (var, add, __ATOMIC_SEQ_CST);
+    #define BUILTIN_ADD_FETCH(var, add) __atomic_add_fetch (var, add, __ATOMIC_SEQ_CST);
+    #define BUILTIN_SUB_FETCH(var, sub) __atomic_sub_fetch (var, sub, __ATOMIC_SEQ_CST);
+#else
+    #define BUILTIN_FETCH_ADD(var, add) __sync_fetch_and_add (var, add);
+    #define BUILTIN_ADD_FETCH(var, add) __sync_add_and_fetch (var, add);
+    #define BUILTIN_SUB_FETCH(var, sub) __sync_sub_and_fetch (var, sub);
+#endif
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+    template<class T> class AtomicScalar
+    {
+
+        public:
+
+        AtomicScalar (const T &initial)
+            : mField(initial)
+        {   }
+
+        AtomicScalar (const AtomicScalar<T> &cousin)
+            : mField(cousin.mField)
+        {   }
+
+        AtomicScalar () 
+        {   }
+
+        void operator= (const AtomicScalar<T> &cousin)
+        {
+            mField = cousin.mField;
+        }
+
+        T get (void) const
+        {
+            return mField;
+        }
+
+        void set (const T &v)
+        {
+            mField = v; 
+        }   
+
+        bool cas (const T &old, const T &nu)
+        {
+            return __sync_bool_compare_and_swap (&mField, old, nu);
+        }
+            
+        T operator++ (void)
+        {
+            return BUILTIN_ADD_FETCH (&mField, 1);
+        }
+            
+        T operator-- (void)
+        {
+            return BUILTIN_ADD_FETCH (&mField, -1);
+        }
+
+        T operator++ (int)
+        {
+            return BUILTIN_FETCH_ADD (&mField, 1);
+        }
+            
+        T operator-- (int)
+        {
+            return BUILTIN_FETCH_ADD (&mField, -1);
+        }
+
+		T operator+=(const T &add)
+		{
+			return BUILTIN_ADD_FETCH (&mField, add);
+		}
+
+		T operator-=(const T &sub)
+		{
+			return BUILTIN_SUB_FETCH (&mField, sub);
+		}
+
+        // Need special alignment for atomic functions on ARM CPU's
+#if OGRE_CPU == OGRE_CPU_ARM
+#   if OGRE_COMPILER == OGRE_COMPILER_MSVC
+        __declspec(align(16)) volatile T mField;
+#   elif (OGRE_COMPILER == OGRE_COMPILER_GNUC) || (OGRE_COMPILER == OGRE_COMPILER_CLANG)
+        volatile T mField __attribute__((__aligned__(16)));
+#   endif
+#else
+        volatile T mField;
+#endif
+
+    };
+	/** @} */
+	/** @} */
+
+}
+
+
+ #elif OGRE_COMPILER == OGRE_COMPILER_MSVC && OGRE_COMP_VER >= 1400 && OGRE_THREAD_SUPPORT
+
+#ifndef WIN32_LEAN_AND_MEAN
+#  define WIN32_LEAN_AND_MEAN
+#endif
+#if !defined(NOMINMAX) && defined(_MSC_VER)
+#	define NOMINMAX // required to stop windows.h messing up std::min
+#endif
+#include <windows.h>
+#include <intrin.h>
+#include "Threading/OgreThreadHeaders.h"
+
+// Save warnings state
+#   pragma warning (push)
+#   pragma warning (disable : 4244)
+
+
+
+namespace Ogre {
+
+    // a hack so we can support windows xp.
+#define NEED_TO_INIT_INTERLOCKEDCOMPAREEXCHANGE64WRAPPER
+    struct _OgreExport InterlockedCompareExchange64Wrapper
+    {
+        InterlockedCompareExchange64Wrapper();
+
+        typedef 
+            LONGLONG
+            (WINAPI *func_InterlockedCompareExchange64)( 
+            __inout LONGLONG volatile *Destination,
+            __in    LONGLONG Exchange,
+            __in    LONGLONG Comperand) ;
+
+        static func_InterlockedCompareExchange64 Ogre_InterlockedCompareExchange64;
+
+        static FORCEINLINE
+            LONGLONG
+            Ogre_InterlockedIncrement64 (
+            __inout LONGLONG volatile *Addend
+            )
+        {
+            LONGLONG Old;
+
+            do {
+                Old = *Addend;
+            } while (Ogre_InterlockedCompareExchange64(Addend,
+                Old + 1,
+                Old) != Old);
+
+            return Old + 1;
+        }
+
+        static FORCEINLINE
+            LONGLONG
+            Ogre_InterlockedDecrement64 (
+            __inout LONGLONG volatile *Addend
+            )
+        {
+            LONGLONG Old;
+
+            do {
+                Old = *Addend;
+            } while (Ogre_InterlockedCompareExchange64(Addend,
+                Old - 1,
+                Old) != Old);
+
+            return Old - 1;
+        }
+
+    };
+
+    /** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+    template<class T> class AtomicScalar
+    {
+
+        public:
+
+        AtomicScalar (const T &initial)
+            : mField(initial)
+        {   }
+
+        AtomicScalar (const AtomicScalar<T> &cousin)
+            : mField(cousin.mField)
+        {   }
+
+        AtomicScalar () 
+        {   }
+
+        void operator= (const AtomicScalar<T> &cousin)
+        {
+            mField = cousin.mField;
+        }
+
+        T get (void) const
+        {
+            return mField;
+        }
+
+        void set (const T &v)
+        {
+            mField = v;
+        }   
+
+        bool cas (const T &old, const T &nu)
+        {
+            if (sizeof(T)==2) {
+                return _InterlockedCompareExchange16((SHORT*)&mField, static_cast<SHORT>(nu), static_cast<SHORT>(old)) == static_cast<SHORT>(old);
+            } 
+			else if (sizeof(T)==4) 
+			{
+                return _InterlockedCompareExchange((LONG*)&mField, static_cast<LONG>(nu), static_cast<LONG>(old)) == static_cast<LONG>(old);
+			} 
+			else if (sizeof(T)==8 && InterlockedCompareExchange64Wrapper::Ogre_InterlockedCompareExchange64 != NULL) {
+                return InterlockedCompareExchange64Wrapper::Ogre_InterlockedCompareExchange64((LONGLONG*)&mField, static_cast<LONGLONG>(nu), static_cast<LONGLONG>(old)) == static_cast<LONGLONG>(old);
+            } 
+			else {
+                OGRE_LOCK_AUTO_MUTEX;
+                if (mField != old) return false;
+                mField = nu;
+                return true;
+            }
+        }
+            
+        T operator++ (void)
+        {
+            if (sizeof(T)==2) {
+                return _InterlockedIncrement16((SHORT*)&mField);
+            } else if (sizeof(T)==4) {
+                return InterlockedIncrement((LONG*)&mField);
+            } else if (sizeof(T)==8 && InterlockedCompareExchange64Wrapper::Ogre_InterlockedCompareExchange64 != NULL) {
+                return InterlockedCompareExchange64Wrapper::Ogre_InterlockedIncrement64((LONGLONG*)&mField);
+            } else {
+                OGRE_LOCK_AUTO_MUTEX;
+                return ++mField;
+            }
+        }
+            
+        T operator-- (void)
+        {
+            if (sizeof(T)==2) {
+                return _InterlockedDecrement16((SHORT*)&mField);
+            } else if (sizeof(T)==4) {
+                return InterlockedDecrement((LONG*)&mField);
+            } else if (sizeof(T)==8 && InterlockedCompareExchange64Wrapper::Ogre_InterlockedCompareExchange64 != NULL) {
+                return InterlockedCompareExchange64Wrapper::Ogre_InterlockedDecrement64((LONGLONG*)&mField);
+            } else {
+                OGRE_LOCK_AUTO_MUTEX;
+                return --mField;
+            }
+        }
+
+        T operator++ (int)
+        {
+            if (sizeof(T)==2) {
+                return _InterlockedIncrement16((SHORT*)&mField)-1;
+            } else if (sizeof(T)==4) {
+                return InterlockedIncrement((LONG*)&mField)-1;
+            } else if (sizeof(T)==8 && InterlockedCompareExchange64Wrapper::Ogre_InterlockedCompareExchange64 != NULL) {
+                return InterlockedCompareExchange64Wrapper::Ogre_InterlockedIncrement64((LONGLONG*)&mField)-1;
+            } else {
+                OGRE_LOCK_AUTO_MUTEX;
+                return mField++;
+            }
+        }
+            
+        T operator-- (int)
+        {
+            if (sizeof(T)==2) {
+                return _InterlockedDecrement16((SHORT*)&mField)+1;
+            } else if (sizeof(T)==4) {
+                return InterlockedDecrement((LONG*)&mField)+1;
+            } else if (sizeof(T)==8 && InterlockedCompareExchange64Wrapper::Ogre_InterlockedCompareExchange64 != NULL) {
+                return InterlockedCompareExchange64Wrapper::Ogre_InterlockedDecrement64((LONGLONG*)&mField)+1;
+            } else {
+                OGRE_LOCK_AUTO_MUTEX;
+                return mField--;
+            }
+        }
+
+		T operator+=(const T &add)
+		{
+            if ((sizeof(T)==2) || (sizeof(T)==4) || (sizeof(T)==8 && InterlockedCompareExchange64Wrapper::Ogre_InterlockedCompareExchange64 != NULL)) {
+                //The function InterlockedExchangeAdd is not available for 64 and 16 bit version
+                //We will use the cas operation instead. 
+                T newVal;
+                do {
+                    //Create a value of the current field plus the added value
+                    newVal = mField + add;
+                    //Replace the current field value with the new value. Ensure that the value 
+                    //of the field hasn't changed in the mean time by comparing it to the new value
+                    //minus the added value. 
+                } while (!cas(newVal - add, newVal)); //repeat until successful
+                return newVal;
+            }
+            else
+            {
+                OGRE_LOCK_AUTO_MUTEX;
+                mField += add;
+                return mField;
+            }
+		}
+
+		T operator-=(const T &sub)
+		{
+            if ((sizeof(T)==2) || (sizeof(T)==4) || (sizeof(T)==8 && InterlockedCompareExchange64Wrapper::Ogre_InterlockedCompareExchange64 != NULL)) {
+                //The function InterlockedExchangeAdd is not available for 64 and 16 bit version
+                //We will use the cas operation instead. 
+                T newVal;
+                do {
+                    //Create a value of the current field plus the added value
+                    newVal = mField - sub;
+                    //Replace the current field value with the new value. Ensure that the value 
+                    //of the field hasn't changed in the mean time by comparing it to the new value
+                    //minus the added value. 
+                } while (!cas(newVal + sub, newVal)); //repeat until successful
+                return newVal;
+            }
+            else
+            {
+                OGRE_LOCK_AUTO_MUTEX;
+                mField -= sub;
+                return mField;
+            }
+		}
+
+        protected:
+
+        OGRE_AUTO_MUTEX;
+
+        volatile T mField;
+
+    };
+	/** @} */
+	/** @} */
+
+}
+
+#   pragma warning (pop)
+
+#else
+
+#include "Threading/OgreThreadHeaders.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+    template <class T> class AtomicScalar {
+
+        public:
+
+        AtomicScalar (const T &initial)
+            : mField(initial)
+        {   }
+
+        AtomicScalar (const AtomicScalar<T> &cousin)
+            : mField(cousin.mField)
+        {   }
+
+        AtomicScalar ()
+        {   }
+
+        void operator= (const AtomicScalar<T> &cousin)
+        {
+            mField = cousin.mField;
+        }
+
+        T get (void) const
+        {
+            // no lock required here
+            // since get will not interfere with set or cas
+            // we may get a stale value, but this is ok
+            return mField;
+        }
+
+        void set (const T &v)
+        {
+            mField = v;
+        }
+
+        bool cas (const T &old, const T &nu)
+        {
+            OGRE_LOCK_AUTO_MUTEX;
+            if (mField != old) return false;
+            mField = nu;
+            return true;
+        }
+
+        T operator++ (void)
+        {
+            OGRE_LOCK_AUTO_MUTEX;
+            return ++mField;
+        }
+
+        T operator-- (void)
+        {
+            OGRE_LOCK_AUTO_MUTEX;
+            return --mField;
+        }
+
+        T operator++ (int)
+        {
+            OGRE_LOCK_AUTO_MUTEX;
+            return mField++;
+        }
+
+        T operator-- (int)
+        {
+            OGRE_LOCK_AUTO_MUTEX;
+            return mField--;
+        }
+
+		T operator+=(const T &add)
+		{
+            OGRE_LOCK_AUTO_MUTEX;
+			mField += add;
+			return mField;
+		}
+
+		T operator-=(const T &sub)
+		{
+            OGRE_LOCK_AUTO_MUTEX;
+			mField -= sub;
+			return mField;
+		}
+
+        protected:
+
+        OGRE_AUTO_MUTEX;
+
+        volatile T mField;
+
+    };
+	/** @} */
+	/** @} */
+
+}
+
+#endif
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreAutoParamDataSource.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreAutoParamDataSource.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreAutoParamDataSource.h	(revision 148)
@@ -0,0 +1,266 @@
+/*
+-----------------------------------------------------------------------------
+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 __AutoParamDataSource_H_
+#define __AutoParamDataSource_H_
+
+#include "OgrePrerequisites.h"
+#include "OgreCommon.h"
+#include "OgreMatrix4.h"
+#include "OgreVector4.h"
+#include "OgreLight.h"
+#include "OgreColourValue.h"
+
+namespace Ogre {
+
+	// forward decls
+	struct VisibleObjectsBoundsInfo;
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Materials
+	*  @{
+	*/
+
+
+    /** This utility class is used to hold the information used to generate the matrices
+    and other information required to automatically populate GpuProgramParameters.
+    @remarks
+        This class exercises a lazy-update scheme in order to avoid having to update all
+        the information a GpuProgramParameters class could possibly want all the time. 
+        It relies on the SceneManager to update it when the base data has changed, and
+        will calculate concatenated matrices etc only when required, passing back precalculated
+        matrices when they are requested more than once when the underlying information has
+        not altered.
+    */
+	class _OgreExport AutoParamDataSource : public SceneMgtAlloc
+    {
+    protected:
+		const Light& getLight(size_t index) const;
+        mutable Matrix4 mWorldMatrix[256];
+        mutable size_t mWorldMatrixCount;
+        mutable const Matrix4* mWorldMatrixArray;
+        mutable Matrix4 mWorldViewMatrix;
+        mutable Matrix4 mViewProjMatrix;
+        mutable Matrix4 mWorldViewProjMatrix;
+        mutable Matrix4 mInverseWorldMatrix;
+        mutable Matrix4 mInverseWorldViewMatrix;
+        mutable Matrix4 mInverseViewMatrix;
+        mutable Matrix4 mInverseTransposeWorldMatrix;
+        mutable Matrix4 mInverseTransposeWorldViewMatrix;
+		mutable Vector4 mCameraPosition;
+        mutable Vector4 mCameraPositionObjectSpace;
+        mutable Matrix4 mTextureViewProjMatrix[OGRE_MAX_SIMULTANEOUS_LIGHTS];
+		mutable Matrix4 mTextureWorldViewProjMatrix[OGRE_MAX_SIMULTANEOUS_LIGHTS];
+		mutable Matrix4 mSpotlightViewProjMatrix[OGRE_MAX_SIMULTANEOUS_LIGHTS];
+		mutable Matrix4 mSpotlightWorldViewProjMatrix[OGRE_MAX_SIMULTANEOUS_LIGHTS];
+		mutable Vector4 mShadowCamDepthRanges[OGRE_MAX_SIMULTANEOUS_LIGHTS];
+        mutable Matrix4 mViewMatrix;
+        mutable Matrix4 mProjectionMatrix;
+		mutable Real mDirLightExtrusionDistance;
+		mutable Vector4 mLodCameraPosition;
+		mutable Vector4 mLodCameraPositionObjectSpace;
+
+        mutable bool mWorldMatrixDirty;
+        mutable bool mViewMatrixDirty;
+        mutable bool mProjMatrixDirty;
+        mutable bool mWorldViewMatrixDirty;
+        mutable bool mViewProjMatrixDirty;
+        mutable bool mWorldViewProjMatrixDirty;
+        mutable bool mInverseWorldMatrixDirty;
+        mutable bool mInverseWorldViewMatrixDirty;
+        mutable bool mInverseViewMatrixDirty;
+        mutable bool mInverseTransposeWorldMatrixDirty;
+        mutable bool mInverseTransposeWorldViewMatrixDirty;
+		mutable bool mCameraPositionDirty;
+        mutable bool mCameraPositionObjectSpaceDirty;
+        mutable bool mTextureViewProjMatrixDirty[OGRE_MAX_SIMULTANEOUS_LIGHTS];
+		mutable bool mTextureWorldViewProjMatrixDirty[OGRE_MAX_SIMULTANEOUS_LIGHTS];
+		mutable bool mSpotlightViewProjMatrixDirty[OGRE_MAX_SIMULTANEOUS_LIGHTS];
+		mutable bool mSpotlightWorldViewProjMatrixDirty[OGRE_MAX_SIMULTANEOUS_LIGHTS];
+		mutable bool mShadowCamDepthRangesDirty[OGRE_MAX_SIMULTANEOUS_LIGHTS];
+		mutable ColourValue mAmbientLight;
+        mutable ColourValue mFogColour;
+        mutable Vector4 mFogParams;
+        mutable int mPassNumber;
+		mutable Vector4 mSceneDepthRange;
+		mutable bool mSceneDepthRangeDirty;
+		mutable bool mLodCameraPositionDirty;
+		mutable bool mLodCameraPositionObjectSpaceDirty;
+
+        const Renderable* mCurrentRenderable;
+        const Camera* mCurrentCamera;
+		bool mCameraRelativeRendering;
+		Vector3 mCameraRelativePosition;
+        const LightList* mCurrentLightList;
+        const Frustum* mCurrentTextureProjector[OGRE_MAX_SIMULTANEOUS_LIGHTS];
+        const RenderTarget* mCurrentRenderTarget;
+        const Viewport* mCurrentViewport;
+		const SceneManager* mCurrentSceneManager;
+		const VisibleObjectsBoundsInfo* mMainCamBoundsInfo;
+        const Pass* mCurrentPass;
+
+        Light mBlankLight;
+    public:
+        AutoParamDataSource();
+        virtual ~AutoParamDataSource();
+        /** Updates the current renderable */
+        virtual void setCurrentRenderable(const Renderable* rend);
+        /** Sets the world matrices, avoid query from renderable again */
+        virtual void setWorldMatrices(const Matrix4* m, size_t count);
+        /** Updates the current camera */
+        virtual void setCurrentCamera(const Camera* cam, bool useCameraRelative);
+        /** Sets the light list that should be used, and it's base index from the global list */
+        virtual void setCurrentLightList(const LightList* ll);
+        /** Sets the current texture projector for a index */
+        virtual void setTextureProjector(const Frustum* frust, size_t index);
+        /** Sets the current render target */
+        virtual void setCurrentRenderTarget(const RenderTarget* target);
+        /** Sets the current viewport */
+        virtual void setCurrentViewport(const Viewport* viewport);
+		/** Sets the shadow extrusion distance to be used for point lights. */
+		virtual void setShadowDirLightExtrusionDistance(Real dist);
+		/** Sets the main camera's scene bounding information */
+		virtual void setMainCamBoundsInfo(VisibleObjectsBoundsInfo* info);
+		/** Set the current scene manager for enquiring on demand */
+		virtual void setCurrentSceneManager(const SceneManager* sm);
+        /** Sets the current pass */
+        virtual void setCurrentPass(const Pass* pass);
+
+
+
+        virtual const Matrix4& getWorldMatrix(void) const;
+        virtual const Matrix4* getWorldMatrixArray(void) const;
+        virtual size_t getWorldMatrixCount(void) const;
+        virtual const Matrix4& getViewMatrix(void) const;
+        virtual const Matrix4& getViewProjectionMatrix(void) const;
+        virtual const Matrix4& getProjectionMatrix(void) const;
+        virtual const Matrix4& getWorldViewProjMatrix(void) const;
+        virtual const Matrix4& getWorldViewMatrix(void) const;
+        virtual const Matrix4& getInverseWorldMatrix(void) const;
+        virtual const Matrix4& getInverseWorldViewMatrix(void) const;
+        virtual const Matrix4& getInverseViewMatrix(void) const;
+        virtual const Matrix4& getInverseTransposeWorldMatrix(void) const;
+        virtual const Matrix4& getInverseTransposeWorldViewMatrix(void) const;
+        virtual const Vector4& getCameraPosition(void) const;
+        virtual const Vector4& getCameraPositionObjectSpace(void) const;
+		virtual const Vector4& getLodCameraPosition(void) const;
+		virtual const Vector4& getLodCameraPositionObjectSpace(void) const;
+		virtual bool hasLightList() const { return mCurrentLightList != 0; }
+        /** Get the light which is 'index'th closest to the current object */        
+		virtual float getLightNumber(size_t index) const;
+		virtual float getLightCount() const;
+		virtual float getLightCastsShadows(size_t index) const;
+		virtual const ColourValue& getLightDiffuseColour(size_t index) const;
+		virtual const ColourValue& getLightSpecularColour(size_t index) const;
+		virtual const ColourValue getLightDiffuseColourWithPower(size_t index) const;
+		virtual const ColourValue getLightSpecularColourWithPower(size_t index) const;
+		virtual const Vector3& getLightPosition(size_t index) const;
+		virtual Vector4 getLightAs4DVector(size_t index) const;
+		virtual const Vector3& getLightDirection(size_t index) const;
+		virtual Real getLightPowerScale(size_t index) const;
+		virtual Vector4 getLightAttenuation(size_t index) const;
+		virtual Vector4 getSpotlightParams(size_t index) const;
+		virtual void setAmbientLightColour(const ColourValue& ambient);
+		virtual const ColourValue& getAmbientLightColour(void) const;
+        virtual const ColourValue& getSurfaceAmbientColour(void) const;
+        virtual const ColourValue& getSurfaceDiffuseColour(void) const;
+        virtual const ColourValue& getSurfaceSpecularColour(void) const;
+        virtual const ColourValue& getSurfaceEmissiveColour(void) const;
+        virtual Real getSurfaceShininess(void) const;
+        virtual Real getSurfaceAlphaRejectionValue(void) const;
+        virtual ColourValue getDerivedAmbientLightColour(void) const;
+        virtual ColourValue getDerivedSceneColour(void) const;
+        virtual void setFog(FogMode mode, const ColourValue& colour, Real expDensity, Real linearStart, Real linearEnd);
+        virtual const ColourValue& getFogColour(void) const;
+        virtual const Vector4& getFogParams(void) const;
+        virtual const Matrix4& getTextureViewProjMatrix(size_t index) const;
+		virtual const Matrix4& getTextureWorldViewProjMatrix(size_t index) const;
+		virtual const Matrix4& getSpotlightViewProjMatrix(size_t index) const;
+		virtual const Matrix4& getSpotlightWorldViewProjMatrix(size_t index) const;
+        virtual const Matrix4& getTextureTransformMatrix(size_t index) const;
+        virtual const RenderTarget* getCurrentRenderTarget(void) const;
+        virtual const Renderable* getCurrentRenderable(void) const;
+        virtual const Pass* getCurrentPass(void) const;
+        virtual Vector4 getTextureSize(size_t index) const;
+        virtual Vector4 getInverseTextureSize(size_t index) const;
+        virtual Vector4 getPackedTextureSize(size_t index) const;
+		virtual Real getShadowExtrusionDistance(void) const;
+		virtual const Vector4& getSceneDepthRange() const;
+		virtual const Vector4& getShadowSceneDepthRange(size_t index) const;
+		virtual const ColourValue& getShadowColour() const;
+		virtual Matrix4 getInverseViewProjMatrix(void) const;
+		virtual Matrix4 getInverseTransposeViewProjMatrix() const;
+		virtual Matrix4 getTransposeViewProjMatrix() const;
+		virtual Matrix4 getTransposeViewMatrix() const;
+        virtual Matrix4 getInverseTransposeViewMatrix() const;
+		virtual Matrix4 getTransposeProjectionMatrix() const;
+		virtual Matrix4 getInverseProjectionMatrix() const;
+		virtual Matrix4 getInverseTransposeProjectionMatrix() const;
+		virtual Matrix4 getTransposeWorldViewProjMatrix() const;
+		virtual Matrix4 getInverseWorldViewProjMatrix() const;
+		virtual Matrix4 getInverseTransposeWorldViewProjMatrix() const;
+		virtual Matrix4 getTransposeWorldViewMatrix() const;
+		virtual Matrix4 getTransposeWorldMatrix() const;
+        virtual Real getTime(void) const;
+		virtual Real getTime_0_X(Real x) const;
+		virtual Real getCosTime_0_X(Real x) const;
+		virtual Real getSinTime_0_X(Real x) const;
+		virtual Real getTanTime_0_X(Real x) const;
+		virtual Vector4 getTime_0_X_packed(Real x) const;
+		virtual Real getTime_0_1(Real x) const;
+		virtual Real getCosTime_0_1(Real x) const;
+		virtual Real getSinTime_0_1(Real x) const;
+		virtual Real getTanTime_0_1(Real x) const;
+		virtual Vector4 getTime_0_1_packed(Real x) const;
+		virtual Real getTime_0_2Pi(Real x) const;
+		virtual Real getCosTime_0_2Pi(Real x) const;
+		virtual Real getSinTime_0_2Pi(Real x) const;
+		virtual Real getTanTime_0_2Pi(Real x) const;
+		virtual Vector4 getTime_0_2Pi_packed(Real x) const;
+        virtual Real getFrameTime(void) const;
+		virtual Real getFPS() const;
+		virtual Real getViewportWidth() const;
+		virtual Real getViewportHeight() const;
+		virtual Real getInverseViewportWidth() const;
+		virtual Real getInverseViewportHeight() const;
+		virtual Vector3 getViewDirection() const;
+		virtual Vector3 getViewSideVector() const;
+		virtual Vector3 getViewUpVector() const;
+		virtual Real getFOV() const;
+		virtual Real getNearClipDistance() const;
+		virtual Real getFarClipDistance() const;
+        virtual int getPassNumber(void) const;
+        virtual void setPassNumber(const int passNumber);
+        virtual void incPassNumber(void);
+		virtual void updateLightCustomGpuParameter(const GpuProgramParameters::AutoConstantEntry& constantEntry, GpuProgramParameters *params) const;
+    };
+	/** @} */
+	/** @} */
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreAxisAlignedBox.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreAxisAlignedBox.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreAxisAlignedBox.h	(revision 148)
@@ -0,0 +1,848 @@
+/*
+-----------------------------------------------------------------------------
+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 __AxisAlignedBox_H_
+#define __AxisAlignedBox_H_
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+
+#include "OgreVector3.h"
+#include "OgreMatrix4.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Math
+	*  @{
+	*/
+
+	/** A 3D box aligned with the x/y/z axes.
+	@remarks
+	This class represents a simple box which is aligned with the
+	axes. Internally it only stores 2 points as the extremeties of
+	the box, one which is the minima of all 3 axes, and the other
+	which is the maxima of all 3 axes. This class is typically used
+	for an axis-aligned bounding box (AABB) for collision and
+	visibility determination.
+	*/
+	class _OgreExport AxisAlignedBox
+	{
+	public:
+		enum Extent
+		{
+			EXTENT_NULL,
+			EXTENT_FINITE,
+			EXTENT_INFINITE
+		};
+	protected:
+
+		Vector3 mMinimum;
+		Vector3 mMaximum;
+		Extent mExtent;
+		mutable Vector3* mCorners;
+
+	public:
+		/*
+           1-------2
+          /|      /|
+         / |     / |
+        5-------4  |
+        |  0----|--3
+        | /     | /
+        |/      |/
+        6-------7
+		*/
+		typedef enum {
+			FAR_LEFT_BOTTOM = 0,
+			FAR_LEFT_TOP = 1,
+			FAR_RIGHT_TOP = 2,
+			FAR_RIGHT_BOTTOM = 3,
+			NEAR_RIGHT_BOTTOM = 7,
+			NEAR_LEFT_BOTTOM = 6,
+			NEAR_LEFT_TOP = 5,
+			NEAR_RIGHT_TOP = 4
+		} CornerEnum;
+		inline AxisAlignedBox() : mMinimum(Vector3::ZERO), mMaximum(Vector3::UNIT_SCALE), mCorners(0)
+		{
+			// Default to a null box 
+			setMinimum( -0.5, -0.5, -0.5 );
+			setMaximum( 0.5, 0.5, 0.5 );
+			mExtent = EXTENT_NULL;
+		}
+		inline AxisAlignedBox(Extent e) : mMinimum(Vector3::ZERO), mMaximum(Vector3::UNIT_SCALE), mCorners(0)
+		{
+			setMinimum( -0.5, -0.5, -0.5 );
+			setMaximum( 0.5, 0.5, 0.5 );
+			mExtent = e;
+		}
+
+		inline AxisAlignedBox(const AxisAlignedBox & rkBox) : mMinimum(Vector3::ZERO), mMaximum(Vector3::UNIT_SCALE), mCorners(0)
+
+		{
+			if (rkBox.isNull())
+				setNull();
+			else if (rkBox.isInfinite())
+				setInfinite();
+			else
+				setExtents( rkBox.mMinimum, rkBox.mMaximum );
+		}
+
+		inline AxisAlignedBox( const Vector3& min, const Vector3& max ) : mMinimum(Vector3::ZERO), mMaximum(Vector3::UNIT_SCALE), mCorners(0)
+		{
+			setExtents( min, max );
+		}
+
+		inline AxisAlignedBox(
+			Real mx, Real my, Real mz,
+			Real Mx, Real My, Real Mz ) : mMinimum(Vector3::ZERO), mMaximum(Vector3::UNIT_SCALE), mCorners(0)
+		{
+			setExtents( mx, my, mz, Mx, My, Mz );
+		}
+
+		AxisAlignedBox& operator=(const AxisAlignedBox& rhs)
+		{
+			// Specifically override to avoid copying mCorners
+			if (rhs.isNull())
+				setNull();
+			else if (rhs.isInfinite())
+				setInfinite();
+			else
+				setExtents(rhs.mMinimum, rhs.mMaximum);
+
+			return *this;
+		}
+
+		~AxisAlignedBox()
+		{
+			if (mCorners)
+				OGRE_FREE(mCorners, MEMCATEGORY_SCENE_CONTROL);
+		}
+
+
+		/** Gets the minimum corner of the box.
+		*/
+		inline const Vector3& getMinimum(void) const
+		{ 
+			return mMinimum; 
+		}
+
+		/** Gets a modifiable version of the minimum
+		corner of the box.
+		*/
+		inline Vector3& getMinimum(void)
+		{ 
+			return mMinimum; 
+		}
+
+		/** Gets the maximum corner of the box.
+		*/
+		inline const Vector3& getMaximum(void) const
+		{ 
+			return mMaximum;
+		}
+
+		/** Gets a modifiable version of the maximum
+		corner of the box.
+		*/
+		inline Vector3& getMaximum(void)
+		{ 
+			return mMaximum;
+		}
+
+
+		/** Sets the minimum corner of the box.
+		*/
+		inline void setMinimum( const Vector3& vec )
+		{
+			mExtent = EXTENT_FINITE;
+			mMinimum = vec;
+		}
+
+		inline void setMinimum( Real x, Real y, Real z )
+		{
+			mExtent = EXTENT_FINITE;
+			mMinimum.x = x;
+			mMinimum.y = y;
+			mMinimum.z = z;
+		}
+
+		/** Changes one of the components of the minimum corner of the box
+		used to resize only one dimension of the box
+		*/
+		inline void setMinimumX(Real x)
+		{
+			mMinimum.x = x;
+		}
+
+		inline void setMinimumY(Real y)
+		{
+			mMinimum.y = y;
+		}
+
+		inline void setMinimumZ(Real z)
+		{
+			mMinimum.z = z;
+		}
+
+		/** Sets the maximum corner of the box.
+		*/
+		inline void setMaximum( const Vector3& vec )
+		{
+			mExtent = EXTENT_FINITE;
+			mMaximum = vec;
+		}
+
+		inline void setMaximum( Real x, Real y, Real z )
+		{
+			mExtent = EXTENT_FINITE;
+			mMaximum.x = x;
+			mMaximum.y = y;
+			mMaximum.z = z;
+		}
+
+		/** Changes one of the components of the maximum corner of the box
+		used to resize only one dimension of the box
+		*/
+		inline void setMaximumX( Real x )
+		{
+			mMaximum.x = x;
+		}
+
+		inline void setMaximumY( Real y )
+		{
+			mMaximum.y = y;
+		}
+
+		inline void setMaximumZ( Real z )
+		{
+			mMaximum.z = z;
+		}
+
+		/** Sets both minimum and maximum extents at once.
+		*/
+		inline void setExtents( const Vector3& min, const Vector3& max )
+		{
+            assert( (min.x <= max.x && min.y <= max.y && min.z <= max.z) &&
+                "The minimum corner of the box must be less than or equal to maximum corner" );
+
+			mExtent = EXTENT_FINITE;
+			mMinimum = min;
+			mMaximum = max;
+		}
+
+		inline void setExtents(
+			Real mx, Real my, Real mz,
+			Real Mx, Real My, Real Mz )
+		{
+            assert( (mx <= Mx && my <= My && mz <= Mz) &&
+                "The minimum corner of the box must be less than or equal to maximum corner" );
+
+			mExtent = EXTENT_FINITE;
+
+			mMinimum.x = mx;
+			mMinimum.y = my;
+			mMinimum.z = mz;
+
+			mMaximum.x = Mx;
+			mMaximum.y = My;
+			mMaximum.z = Mz;
+
+		}
+
+		/** Returns a pointer to an array of 8 corner points, useful for
+		collision vs. non-aligned objects.
+		@remarks
+		If the order of these corners is important, they are as
+		follows: The 4 points of the minimum Z face (note that
+		because Ogre uses right-handed coordinates, the minimum Z is
+		at the 'back' of the box) starting with the minimum point of
+		all, then anticlockwise around this face (if you are looking
+		onto the face from outside the box). Then the 4 points of the
+		maximum Z face, starting with maximum point of all, then
+		anticlockwise around this face (looking onto the face from
+		outside the box). Like this:
+		<pre>
+           1-------2
+          /|      /|
+         / |     / |
+        5-------4  |
+        |  0----|--3
+        | /     | /
+        |/      |/
+        6-------7
+		</pre>
+		*/
+		inline const Vector3* getAllCorners(void) const
+		{
+			assert( (mExtent == EXTENT_FINITE) && "Can't get corners of a null or infinite AAB" );
+
+			// The order of these items is, using right-handed co-ordinates:
+			// Minimum Z face, starting with Min(all), then anticlockwise
+			//   around face (looking onto the face)
+			// Maximum Z face, starting with Max(all), then anticlockwise
+			//   around face (looking onto the face)
+			// Only for optimization/compatibility.
+			if (!mCorners)
+				mCorners = OGRE_ALLOC_T(Vector3, 8, MEMCATEGORY_SCENE_CONTROL);
+
+			mCorners[0] = mMinimum;
+			mCorners[1].x = mMinimum.x; mCorners[1].y = mMaximum.y; mCorners[1].z = mMinimum.z;
+			mCorners[2].x = mMaximum.x; mCorners[2].y = mMaximum.y; mCorners[2].z = mMinimum.z;
+			mCorners[3].x = mMaximum.x; mCorners[3].y = mMinimum.y; mCorners[3].z = mMinimum.z;            
+
+			mCorners[4] = mMaximum;
+			mCorners[5].x = mMinimum.x; mCorners[5].y = mMaximum.y; mCorners[5].z = mMaximum.z;
+			mCorners[6].x = mMinimum.x; mCorners[6].y = mMinimum.y; mCorners[6].z = mMaximum.z;
+			mCorners[7].x = mMaximum.x; mCorners[7].y = mMinimum.y; mCorners[7].z = mMaximum.z;
+
+			return mCorners;
+		}
+
+		/** Gets the position of one of the corners
+		*/
+		Vector3 getCorner(CornerEnum cornerToGet) const
+		{
+			switch(cornerToGet)
+			{
+			case FAR_LEFT_BOTTOM:
+				return mMinimum;
+			case FAR_LEFT_TOP:
+				return Vector3(mMinimum.x, mMaximum.y, mMinimum.z);
+			case FAR_RIGHT_TOP:
+				return Vector3(mMaximum.x, mMaximum.y, mMinimum.z);
+			case FAR_RIGHT_BOTTOM:
+				return Vector3(mMaximum.x, mMinimum.y, mMinimum.z);
+			case NEAR_RIGHT_BOTTOM:
+				return Vector3(mMaximum.x, mMinimum.y, mMaximum.z);
+			case NEAR_LEFT_BOTTOM:
+				return Vector3(mMinimum.x, mMinimum.y, mMaximum.z);
+			case NEAR_LEFT_TOP:
+				return Vector3(mMinimum.x, mMaximum.y, mMaximum.z);
+			case NEAR_RIGHT_TOP:
+				return mMaximum;
+			default:
+				return Vector3();
+			}
+		}
+
+		_OgreExport friend std::ostream& operator<<( std::ostream& o, const AxisAlignedBox &aab )
+		{
+			switch (aab.mExtent)
+			{
+			case EXTENT_NULL:
+				o << "AxisAlignedBox(null)";
+				return o;
+
+			case EXTENT_FINITE:
+				o << "AxisAlignedBox(min=" << aab.mMinimum << ", max=" << aab.mMaximum << ")";
+				return o;
+
+			case EXTENT_INFINITE:
+				o << "AxisAlignedBox(infinite)";
+				return o;
+
+			default: // shut up compiler
+				assert( false && "Never reached" );
+				return o;
+			}
+		}
+
+		/** Merges the passed in box into the current box. The result is the
+		box which encompasses both.
+		*/
+		void merge( const AxisAlignedBox& rhs )
+		{
+			// Do nothing if rhs null, or this is infinite
+			if ((rhs.mExtent == EXTENT_NULL) || (mExtent == EXTENT_INFINITE))
+			{
+				return;
+			}
+			// Otherwise if rhs is infinite, make this infinite, too
+			else if (rhs.mExtent == EXTENT_INFINITE)
+			{
+				mExtent = EXTENT_INFINITE;
+			}
+			// Otherwise if current null, just take rhs
+			else if (mExtent == EXTENT_NULL)
+			{
+				setExtents(rhs.mMinimum, rhs.mMaximum);
+			}
+			// Otherwise merge
+			else
+			{
+				Vector3 min = mMinimum;
+				Vector3 max = mMaximum;
+				max.makeCeil(rhs.mMaximum);
+				min.makeFloor(rhs.mMinimum);
+
+				setExtents(min, max);
+			}
+
+		}
+
+		/** Extends the box to encompass the specified point (if needed).
+		*/
+		inline void merge( const Vector3& point )
+		{
+			switch (mExtent)
+			{
+			case EXTENT_NULL: // if null, use this point
+				setExtents(point, point);
+				return;
+
+			case EXTENT_FINITE:
+				mMaximum.makeCeil(point);
+				mMinimum.makeFloor(point);
+				return;
+
+			case EXTENT_INFINITE: // if infinite, makes no difference
+				return;
+			}
+
+			assert( false && "Never reached" );
+		}
+
+		/** Transforms the box according to the matrix supplied.
+		@remarks
+		By calling this method you get the axis-aligned box which
+		surrounds the transformed version of this box. Therefore each
+		corner of the box is transformed by the matrix, then the
+		extents are mapped back onto the axes to produce another
+		AABB. Useful when you have a local AABB for an object which
+		is then transformed.
+		*/
+		inline void transform( const Matrix4& matrix )
+		{
+			// Do nothing if current null or infinite
+			if( mExtent != EXTENT_FINITE )
+				return;
+
+			Vector3 oldMin, oldMax, currentCorner;
+
+			// Getting the old values so that we can use the existing merge method.
+			oldMin = mMinimum;
+			oldMax = mMaximum;
+
+			// reset
+			setNull();
+
+			// We sequentially compute the corners in the following order :
+			// 0, 6, 5, 1, 2, 4 ,7 , 3
+			// This sequence allows us to only change one member at a time to get at all corners.
+
+			// For each one, we transform it using the matrix
+			// Which gives the resulting point and merge the resulting point.
+
+			// First corner 
+			// min min min
+			currentCorner = oldMin;
+			merge( matrix * currentCorner );
+
+			// min,min,max
+			currentCorner.z = oldMax.z;
+			merge( matrix * currentCorner );
+
+			// min max max
+			currentCorner.y = oldMax.y;
+			merge( matrix * currentCorner );
+
+			// min max min
+			currentCorner.z = oldMin.z;
+			merge( matrix * currentCorner );
+
+			// max max min
+			currentCorner.x = oldMax.x;
+			merge( matrix * currentCorner );
+
+			// max max max
+			currentCorner.z = oldMax.z;
+			merge( matrix * currentCorner );
+
+			// max min max
+			currentCorner.y = oldMin.y;
+			merge( matrix * currentCorner );
+
+			// max min min
+			currentCorner.z = oldMin.z;
+			merge( matrix * currentCorner ); 
+		}
+
+		/** Transforms the box according to the affine matrix supplied.
+		@remarks
+		By calling this method you get the axis-aligned box which
+		surrounds the transformed version of this box. Therefore each
+		corner of the box is transformed by the matrix, then the
+		extents are mapped back onto the axes to produce another
+		AABB. Useful when you have a local AABB for an object which
+		is then transformed.
+		@note
+		The matrix must be an affine matrix. @see Matrix4::isAffine.
+		*/
+		void transformAffine(const Matrix4& m)
+		{
+			assert(m.isAffine());
+
+			// Do nothing if current null or infinite
+			if ( mExtent != EXTENT_FINITE )
+				return;
+
+			Vector3 centre = getCenter();
+			Vector3 halfSize = getHalfSize();
+
+			Vector3 newCentre = m.transformAffine(centre);
+			Vector3 newHalfSize(
+				Math::Abs(m[0][0]) * halfSize.x + Math::Abs(m[0][1]) * halfSize.y + Math::Abs(m[0][2]) * halfSize.z, 
+				Math::Abs(m[1][0]) * halfSize.x + Math::Abs(m[1][1]) * halfSize.y + Math::Abs(m[1][2]) * halfSize.z,
+				Math::Abs(m[2][0]) * halfSize.x + Math::Abs(m[2][1]) * halfSize.y + Math::Abs(m[2][2]) * halfSize.z);
+
+			setExtents(newCentre - newHalfSize, newCentre + newHalfSize);
+		}
+
+		/** Sets the box to a 'null' value i.e. not a box.
+		*/
+		inline void setNull()
+		{
+			mExtent = EXTENT_NULL;
+		}
+
+		/** Returns true if the box is null i.e. empty.
+		*/
+		inline bool isNull(void) const
+		{
+			return (mExtent == EXTENT_NULL);
+		}
+
+		/** Returns true if the box is finite.
+		*/
+		bool isFinite(void) const
+		{
+			return (mExtent == EXTENT_FINITE);
+		}
+
+		/** Sets the box to 'infinite'
+		*/
+		inline void setInfinite()
+		{
+			mExtent = EXTENT_INFINITE;
+		}
+
+		/** Returns true if the box is infinite.
+		*/
+		bool isInfinite(void) const
+		{
+			return (mExtent == EXTENT_INFINITE);
+		}
+
+		/** Returns whether or not this box intersects another. */
+		inline bool intersects(const AxisAlignedBox& b2) const
+		{
+			// Early-fail for nulls
+			if (this->isNull() || b2.isNull())
+				return false;
+
+			// Early-success for infinites
+			if (this->isInfinite() || b2.isInfinite())
+				return true;
+
+			// Use up to 6 separating planes
+			if (mMaximum.x < b2.mMinimum.x)
+				return false;
+			if (mMaximum.y < b2.mMinimum.y)
+				return false;
+			if (mMaximum.z < b2.mMinimum.z)
+				return false;
+
+			if (mMinimum.x > b2.mMaximum.x)
+				return false;
+			if (mMinimum.y > b2.mMaximum.y)
+				return false;
+			if (mMinimum.z > b2.mMaximum.z)
+				return false;
+
+			// otherwise, must be intersecting
+			return true;
+
+		}
+
+		/// Calculate the area of intersection of this box and another
+		inline AxisAlignedBox intersection(const AxisAlignedBox& b2) const
+		{
+            if (this->isNull() || b2.isNull())
+			{
+				return AxisAlignedBox();
+			}
+			else if (this->isInfinite())
+			{
+				return b2;
+			}
+			else if (b2.isInfinite())
+			{
+				return *this;
+			}
+
+			Vector3 intMin = mMinimum;
+            Vector3 intMax = mMaximum;
+
+            intMin.makeCeil(b2.getMinimum());
+            intMax.makeFloor(b2.getMaximum());
+
+            // Check intersection isn't null
+            if (intMin.x < intMax.x &&
+                intMin.y < intMax.y &&
+                intMin.z < intMax.z)
+            {
+                return AxisAlignedBox(intMin, intMax);
+            }
+
+            return AxisAlignedBox();
+		}
+
+		/// Calculate the volume of this box
+		Real volume(void) const
+		{
+			switch (mExtent)
+			{
+			case EXTENT_NULL:
+				return 0.0f;
+
+			case EXTENT_FINITE:
+				{
+					Vector3 diff = mMaximum - mMinimum;
+					return diff.x * diff.y * diff.z;
+				}
+
+			case EXTENT_INFINITE:
+				return Math::POS_INFINITY;
+
+			default: // shut up compiler
+				assert( false && "Never reached" );
+				return 0.0f;
+			}
+		}
+
+		/** Scales the AABB by the vector given. */
+		inline void scale(const Vector3& s)
+		{
+			// Do nothing if current null or infinite
+			if (mExtent != EXTENT_FINITE)
+				return;
+
+			// NB assumes centered on origin
+			Vector3 min = mMinimum * s;
+			Vector3 max = mMaximum * s;
+			setExtents(min, max);
+		}
+
+		/** Tests whether this box intersects a sphere. */
+		bool intersects(const Sphere& s) const
+		{
+			return Math::intersects(s, *this); 
+		}
+		/** Tests whether this box intersects a plane. */
+		bool intersects(const Plane& p) const
+		{
+			return Math::intersects(p, *this);
+		}
+		/** Tests whether the vector point is within this box. */
+		bool intersects(const Vector3& v) const
+		{
+			switch (mExtent)
+			{
+			case EXTENT_NULL:
+				return false;
+
+			case EXTENT_FINITE:
+				return(v.x >= mMinimum.x  &&  v.x <= mMaximum.x  && 
+					v.y >= mMinimum.y  &&  v.y <= mMaximum.y  && 
+					v.z >= mMinimum.z  &&  v.z <= mMaximum.z);
+
+			case EXTENT_INFINITE:
+				return true;
+
+			default: // shut up compiler
+				assert( false && "Never reached" );
+				return false;
+			}
+		}
+		/// Gets the centre of the box
+		Vector3 getCenter(void) const
+		{
+			assert( (mExtent == EXTENT_FINITE) && "Can't get center of a null or infinite AAB" );
+
+			return Vector3(
+				(mMaximum.x + mMinimum.x) * 0.5f,
+				(mMaximum.y + mMinimum.y) * 0.5f,
+				(mMaximum.z + mMinimum.z) * 0.5f);
+		}
+		/// Gets the size of the box
+		Vector3 getSize(void) const
+		{
+			switch (mExtent)
+			{
+			case EXTENT_NULL:
+				return Vector3::ZERO;
+
+			case EXTENT_FINITE:
+				return mMaximum - mMinimum;
+
+			case EXTENT_INFINITE:
+				return Vector3(
+					Math::POS_INFINITY,
+					Math::POS_INFINITY,
+					Math::POS_INFINITY);
+
+			default: // shut up compiler
+				assert( false && "Never reached" );
+				return Vector3::ZERO;
+			}
+		}
+		/// Gets the half-size of the box
+		Vector3 getHalfSize(void) const
+		{
+			switch (mExtent)
+			{
+			case EXTENT_NULL:
+				return Vector3::ZERO;
+
+			case EXTENT_FINITE:
+				return (mMaximum - mMinimum) * 0.5;
+
+			case EXTENT_INFINITE:
+				return Vector3(
+					Math::POS_INFINITY,
+					Math::POS_INFINITY,
+					Math::POS_INFINITY);
+
+			default: // shut up compiler
+				assert( false && "Never reached" );
+				return Vector3::ZERO;
+			}
+		}
+
+        /** Tests whether the given point contained by this box.
+        */
+        bool contains(const Vector3& v) const
+        {
+            if (isNull())
+                return false;
+            if (isInfinite())
+                return true;
+
+            return mMinimum.x <= v.x && v.x <= mMaximum.x &&
+                   mMinimum.y <= v.y && v.y <= mMaximum.y &&
+                   mMinimum.z <= v.z && v.z <= mMaximum.z;
+        }
+		
+		/** Returns the squared minimum distance between a given point and any part of the box.
+		 *  This is faster than distance since avoiding a squareroot, so use if you can. */
+        Real squaredDistance(const Vector3& v) const
+        {
+
+			if (this->contains(v))
+				return 0;
+			else
+			{
+				Vector3 maxDist(0,0,0);
+
+				if (v.x < mMinimum.x)
+					maxDist.x = mMinimum.x - v.x;
+				else if (v.x > mMaximum.x)
+					maxDist.x = v.x - mMaximum.x;
+
+				if (v.y < mMinimum.y)
+					maxDist.y = mMinimum.y - v.y;
+				else if (v.y > mMaximum.y)
+					maxDist.y = v.y - mMaximum.y;
+
+				if (v.z < mMinimum.z)
+					maxDist.z = mMinimum.z - v.z;
+				else if (v.z > mMaximum.z)
+					maxDist.z = v.z - mMaximum.z;
+
+				return maxDist.squaredLength();
+			}
+        }
+        
+        /** Returns the minimum distance between a given point and any part of the box. */
+        Real distance (const Vector3& v) const
+        {
+			return Ogre::Math::Sqrt(squaredDistance(v));
+		}
+
+        /** Tests whether another box contained by this box.
+        */
+        bool contains(const AxisAlignedBox& other) const
+        {
+            if (other.isNull() || this->isInfinite())
+                return true;
+
+            if (this->isNull() || other.isInfinite())
+                return false;
+
+            return this->mMinimum.x <= other.mMinimum.x &&
+                   this->mMinimum.y <= other.mMinimum.y &&
+                   this->mMinimum.z <= other.mMinimum.z &&
+                   other.mMaximum.x <= this->mMaximum.x &&
+                   other.mMaximum.y <= this->mMaximum.y &&
+                   other.mMaximum.z <= this->mMaximum.z;
+        }
+
+        /** Tests 2 boxes for equality.
+        */
+        bool operator== (const AxisAlignedBox& rhs) const
+        {
+            if (this->mExtent != rhs.mExtent)
+                return false;
+
+            if (!this->isFinite())
+                return true;
+
+            return this->mMinimum == rhs.mMinimum &&
+                   this->mMaximum == rhs.mMaximum;
+        }
+
+        /** Tests 2 boxes for inequality.
+        */
+        bool operator!= (const AxisAlignedBox& rhs) const
+        {
+            return !(*this == rhs);
+        }
+
+		// special values
+		static const AxisAlignedBox BOX_NULL;
+		static const AxisAlignedBox BOX_INFINITE;
+
+
+	};
+
+	/** @} */
+	/** @} */
+} // namespace Ogre
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreBillboard.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreBillboard.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreBillboard.h	(revision 148)
@@ -0,0 +1,228 @@
+/*
+-----------------------------------------------------------------------------
+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 __Billboard_H__
+#define __Billboard_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreVector3.h"
+#include "OgreColourValue.h"
+#include "OgreCommon.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Effects
+	*  @{
+	*/
+
+    /** A billboard is a primitive which always faces the camera in every frame.
+        @remarks
+            Billboards can be used for special effects or some other trickery which requires the
+            triangles to always facing the camera no matter where it is. Ogre groups billboards into
+            sets for efficiency, so you should never create a billboard on it's own (it's ok to have a
+            set of one if you need it).
+        @par
+            Billboards have their geometry generated every frame depending on where the camera is. It is most
+            beneficial for all billboards in a set to be identically sized since Ogre can take advantage of this and
+            save some calculations - useful when you have sets of hundreds of billboards as is possible with special
+            effects. You can deviate from this if you wish (example: a smoke effect would probably have smoke puffs
+            expanding as they rise, so each billboard will legitimately have it's own size) but be aware the extra
+            overhead this brings and try to avoid it if you can.
+        @par
+            Billboards are just the mechanism for rendering a range of effects such as particles. It is other classes
+            which use billboards to create their individual effects, so the methods here are quite generic.
+        @see
+            BillboardSet
+    */
+
+	class _OgreExport Billboard : public FXAlloc
+    {
+        friend class BillboardSet;
+        friend class BillboardParticleRenderer;
+    protected:
+        bool mOwnDimensions;
+        bool mUseTexcoordRect;
+        uint16 mTexcoordIndex;      /// Index into the BillboardSet array of texture coordinates
+        FloatRect mTexcoordRect;    /// Individual texture coordinates
+        Real mWidth;
+        Real mHeight;
+    public:
+        // Note the intentional public access to main internal variables used at runtime
+        // Forcing access via get/set would be too costly for 000's of billboards
+        Vector3 mPosition;
+        /// Normalised direction vector
+        Vector3 mDirection;
+        BillboardSet* mParentSet;
+        ColourValue mColour;
+        Radian mRotation;
+
+        /** Default constructor.
+        */
+        Billboard();
+
+        /** Default destructor.
+        */
+        ~Billboard();
+
+        /** Normal constructor as called by BillboardSet.
+        */
+        Billboard(const Vector3& position, BillboardSet* owner, const ColourValue& colour = ColourValue::White);
+
+        /** Get the rotation of the billboard.
+            @remarks
+                This rotation is relative to the center of the billboard.
+        */
+        const Radian& getRotation(void) const { return mRotation; }
+
+        /** Set the rotation of the billboard.
+            @remarks
+                This rotation is relative to the center of the billboard.
+        */
+        void setRotation(const Radian& rotation);
+
+        /** Set the position of the billboard.
+            @remarks
+                This position is relative to a point on the quad which is the billboard. Depending on the BillboardSet,
+                this may be the center of the quad, the top-left etc. See BillboardSet::setBillboardOrigin for more info.
+        */
+        void setPosition(const Vector3& position);
+
+        /** Set the position of the billboard.
+            @remarks
+                This position is relative to a point on the quad which is the billboard. Depending on the BillboardSet,
+                this may be the center of the quad, the top-left etc. See BillboardSet::setBillboardOrigin for more info.
+        */
+        void setPosition(Real x, Real y, Real z);
+
+        /** Get the position of the billboard.
+            @remarks
+                This position is relative to a point on the quad which is the billboard. Depending on the BillboardSet,
+                this may be the center of the quad, the top-left etc. See BillboardSet::setBillboardOrigin for more info.
+        */
+        const Vector3& getPosition(void) const;
+
+        /** Sets the width and height for this billboard.
+            @remarks
+                Note that it is most efficient for every billboard in a BillboardSet to have the same dimensions. If you
+                choose to alter the dimensions of an individual billboard the set will be less efficient. Do not call
+                this method unless you really need to have different billboard dimensions within the same set. Otherwise
+                just call the BillboardSet::setDefaultDimensions method instead.
+        */
+        void setDimensions(Real width, Real height);
+
+        /** Resets this Billboard to use the parent BillboardSet's dimensions instead of it's own. */
+        void resetDimensions(void) { mOwnDimensions = false; }
+        /** Sets the colour of this billboard.
+            @remarks
+                Billboards can be tinted based on a base colour. This allows variations in colour irrespective of the
+                base colour of the material allowing more varied billboards. The default colour is white.
+                The tinting is effected using vertex colours.
+        */
+        void setColour(const ColourValue& colour);
+
+        /** Gets the colour of this billboard.
+        */
+        const ColourValue& getColour(void) const;
+
+        /** Returns true if this billboard deviates from the BillboardSet's default dimensions (i.e. if the
+            Billboard::setDimensions method has been called for this instance).
+            @see
+                Billboard::setDimensions
+        */
+        bool hasOwnDimensions(void) const;
+
+        /** Retrieves the billboard's personal width, if hasOwnDimensions is true. */
+        Real getOwnWidth(void) const;
+
+        /** Retrieves the billboard's personal height, if hasOwnDimensions is true. */
+        Real getOwnHeight(void) const;
+
+        /** Internal method for notifying the billboard of it's owner.
+        */
+        void _notifyOwner(BillboardSet* owner);
+
+        /** Returns true if this billboard use individual texture coordinate rect (i.e. if the 
+            Billboard::setTexcoordRect method has been called for this instance), or returns
+            false if use texture coordinates defined in the parent BillboardSet's texture
+            coordinates array (i.e. if the Billboard::setTexcoordIndex method has been called
+            for this instance).
+            @see
+                Billboard::setTexcoordIndex()
+                Billboard::setTexcoordRect()
+        */
+        bool isUseTexcoordRect(void) const { return mUseTexcoordRect; }
+
+        /** setTexcoordIndex() sets which texture coordinate rect this billboard will use 
+            when rendering. The parent billboard set may contain more than one, in which 
+            case a billboard can be textured with different pieces of a larger texture 
+            sheet very efficiently.
+          @see
+            BillboardSet::setTextureCoords()
+          */
+        void setTexcoordIndex(uint16 texcoordIndex);
+
+        /** getTexcoordIndex() returns the previous value set by setTexcoordIndex(). 
+            The default value is 0, which is always a valid texture coordinate set.
+            @remarks
+                This value is useful only when isUseTexcoordRect return false.
+          */
+        uint16 getTexcoordIndex(void) const { return mTexcoordIndex; }
+
+        /** setTexcoordRect() sets the individual texture coordinate rect of this billboard
+            will use when rendering. The parent billboard set may contain more than one, in
+            which case a billboard can be textured with different pieces of a larger texture
+            sheet very efficiently.
+        */
+        void setTexcoordRect(const FloatRect& texcoordRect);
+
+        /** setTexcoordRect() sets the individual texture coordinate rect of this billboard
+            will use when rendering. The parent billboard set may contain more than one, in
+            which case a billboard can be textured with different pieces of a larger texture
+            sheet very efficiently.
+        */
+        void setTexcoordRect(Real u0, Real v0, Real u1, Real v1);
+
+        /** getTexcoordRect() returns the previous value set by setTexcoordRect(). 
+            @remarks
+                This value is useful only when isUseTexcoordRect returns true.
+        */
+        const FloatRect& getTexcoordRect(void) const { return mTexcoordRect; }
+    };
+
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreBillboardChain.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreBillboardChain.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreBillboardChain.h	(revision 148)
@@ -0,0 +1,390 @@
+/*
+-----------------------------------------------------------------------------
+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.
+-----------------------------------------------------------------------------
+*/
+
+// Thanks to Vincent Cantin (karmaGfa) for the original implementation of this
+// class, although it has now been mostly rewritten
+
+#ifndef _BillboardChain_H__
+#define _BillboardChain_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreMovableObject.h"
+#include "OgreRenderable.h"
+#include "OgreResourceGroupManager.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Effects
+	*  @{
+	*/
+
+	/** Allows the rendering of a chain of connected billboards.
+	@remarks
+		A billboard chain operates much like a traditional billboard, i.e. its
+		segments always face the camera; the difference being that instead of
+		a set of disconnected quads, the elements in this class are connected
+		together in a chain which must always stay in a continuous strip. This
+		kind of effect is useful for creating effects such as trails, beams,
+		lightning effects, etc.
+	@par
+		A single instance of this class can actually render multiple separate
+		chain segments in a single render operation, provided they all use the
+		same material. To clarify the terminology: a 'segment' is a separate 
+		sub-part of the chain with its own start and end (called the 'head'
+		and the 'tail'). An 'element' is a single position / colour / texcoord
+		entry in a segment. You can add items to the head of a chain, and 
+		remove them from the tail, very efficiently. Each segment has a max
+		size, and if adding an element to the segment would exceed this size, 
+		the tail element is automatically removed and re-used as the new item
+		on the head.
+	@par
+		This class has no auto-updating features to do things like alter the
+		colour of the elements or to automatically add / remove elements over
+		time - you have to do all this yourself as a user of the class. 
+		Subclasses can however be used to provide this kind of behaviour 
+		automatically. @see RibbonTrail
+	*/
+	class _OgreExport BillboardChain : public MovableObject, public Renderable
+	{
+
+	public:
+
+		/** Contains the data of an element of the BillboardChain.
+		*/
+		class _OgreExport Element
+		{
+
+		public:
+
+			Element();
+
+			Element(const Vector3 &position,
+				Real width,
+				Real texCoord,
+				const ColourValue &colour,
+				const Quaternion &orientation);
+
+			Vector3 position;
+			Real width;
+			/// U or V texture coord depending on options
+			Real texCoord;
+			ColourValue colour;
+
+			/// Only used when mFaceCamera == false
+			Quaternion orientation;
+		};
+		typedef vector<Element>::type ElementList;
+
+		/** Constructor (don't use directly, use factory) 
+		@param name The name to give this object
+		@param maxElements The maximum number of elements per chain
+		@param numberOfChains The number of separate chain segments contained in this object
+		@param useTextureCoords If true, use texture coordinates from the chain elements
+		@param useColours If true, use vertex colours from the chain elements
+		@param dynamic If true, buffers are created with the intention of being updated
+		*/
+		BillboardChain(const String& name, size_t maxElements = 20, size_t numberOfChains = 1, 
+			bool useTextureCoords = true, bool useColours = true, bool dynamic = true);
+		/// Destructor
+		virtual ~BillboardChain();
+
+		/** Set the maximum number of chain elements per chain 
+		*/
+		virtual void setMaxChainElements(size_t maxElements);
+		/** Get the maximum number of chain elements per chain 
+		*/
+		virtual size_t getMaxChainElements(void) const { return mMaxElementsPerChain; }
+		/** Set the number of chain segments (this class can render multiple chains
+			at once using the same material). 
+		*/
+		virtual void setNumberOfChains(size_t numChains);
+		/** Get the number of chain segments (this class can render multiple chains
+		at once using the same material). 
+		*/
+		virtual size_t getNumberOfChains(void) const { return mChainCount; }
+
+		/** Sets whether texture coordinate information should be included in the
+			final buffers generated.
+		@note You must use either texture coordinates or vertex colour since the
+			vertices have no normals and without one of these there is no source of
+			colour for the vertices.
+		*/
+		virtual void setUseTextureCoords(bool use);
+		/** Gets whether texture coordinate information should be included in the
+			final buffers generated.
+		*/
+		virtual bool getUseTextureCoords(void) const { return mUseTexCoords; }
+
+		/** The direction in which texture coordinates from elements of the
+			chain are used.
+		*/
+		enum TexCoordDirection
+		{
+			/// Tex coord in elements is treated as the 'u' texture coordinate
+			TCD_U,
+			/// Tex coord in elements is treated as the 'v' texture coordinate
+			TCD_V
+		};
+		/** Sets the direction in which texture coords specified on each element
+			are deemed to run along the length of the chain.
+		@param dir The direction, default is TCD_U.
+		*/
+		virtual void setTextureCoordDirection(TexCoordDirection dir);
+		/** Gets the direction in which texture coords specified on each element
+			are deemed to run.
+		*/
+		virtual TexCoordDirection getTextureCoordDirection(void) { return mTexCoordDir; }
+
+		/** Set the range of the texture coordinates generated across the width of
+			the chain elements.
+		@param start Start coordinate, default 0.0
+		@param end End coordinate, default 1.0
+		*/
+		virtual void setOtherTextureCoordRange(Real start, Real end);
+		/** Get the range of the texture coordinates generated across the width of
+			the chain elements.
+		*/
+		virtual const Real* getOtherTextureCoordRange(void) const { return mOtherTexCoordRange; }
+
+		/** Sets whether vertex colour information should be included in the
+			final buffers generated.
+		@note You must use either texture coordinates or vertex colour since the
+			vertices have no normals and without one of these there is no source of
+			colour for the vertices.
+		*/
+		virtual void setUseVertexColours(bool use);
+		/** Gets whether vertex colour information should be included in the
+			final buffers generated.
+		*/
+		virtual bool getUseVertexColours(void) const { return mUseVertexColour; }
+
+		/** Sets whether or not the buffers created for this object are suitable
+			for dynamic alteration.
+		*/
+		virtual void setDynamic(bool dyn);
+
+		/** Gets whether or not the buffers created for this object are suitable
+			for dynamic alteration.
+		*/
+		virtual bool getDynamic(void) const { return mDynamic; }
+		
+		/** Add an element to the 'head' of a chain.
+		@remarks
+			If this causes the number of elements to exceed the maximum elements
+			per chain, the last element in the chain (the 'tail') will be removed
+			to allow the additional element to be added.
+		@param chainIndex The index of the chain
+		@param billboardChainElement The details to add
+		*/
+		virtual void addChainElement(size_t chainIndex, 
+			const Element& billboardChainElement);
+		/** Remove an element from the 'tail' of a chain.
+		@param chainIndex The index of the chain
+		*/
+		virtual void removeChainElement(size_t chainIndex);
+		/** Update the details of an existing chain element.
+		@param chainIndex The index of the chain
+		@param elementIndex The element index within the chain, measured from 
+			the 'head' of the chain
+		@param billboardChainElement The details to set
+		*/
+		virtual void updateChainElement(size_t chainIndex, size_t elementIndex, 
+			const Element& billboardChainElement);
+		/** Get the detail of a chain element.
+		@param chainIndex The index of the chain
+		@param elementIndex The element index within the chain, measured from
+			the 'head' of the chain
+		*/
+		virtual const Element& getChainElement(size_t chainIndex, size_t elementIndex) const;
+
+		/** Returns the number of chain elements. */
+		virtual size_t getNumChainElements(size_t chainIndex) const;
+
+		/** Remove all elements of a given chain (but leave the chain intact). */
+		virtual void clearChain(size_t chainIndex);
+		/** Remove all elements from all chains (but leave the chains themselves intact). */
+		virtual void clearAllChains(void);
+
+		/** Sets whether the billboard should always be facing the camera or a custom direction
+			set by each point element.
+		@remarks
+			Billboards facing the camera are useful for smoke trails, light beams, etc by
+			simulating a cylinder. However, because of this property, wide trails can cause
+			several artefacts unless the head is properly covered.
+			Therefore, non-camera-facing billboards are much more convenient for leaving big
+			trails of movement from thin objects, for example a sword swing as seen in many
+			fighting games.
+		@param faceCamera True to be always facing the camera (Default value: True)
+		@param normalVector Only used when faceCamera == false. Must be a non-zero vector.
+		This vector is the "point of reference" for each point orientation. For example,
+		if normalVector is Vector3::UNIT_Z, and the point's orientation is an identity
+		matrix, the segment corresponding to that point will be facing towards UNIT_Z
+		This vector is internally normalized.
+		*/
+		void setFaceCamera( bool faceCamera, const Vector3 &normalVector=Vector3::UNIT_X );
+
+		/// Get the material name in use
+		virtual const String& getMaterialName(void) const { return mMaterialName; }
+		/// Set the material name to use for rendering
+		virtual void setMaterialName( const String& name, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME );
+
+
+		// Overridden members follow
+		Real getSquaredViewDepth(const Camera* cam) const;
+		Real getBoundingRadius(void) const;
+		const AxisAlignedBox& getBoundingBox(void) const;
+		const MaterialPtr& getMaterial(void) const;
+		const String& getMovableType(void) const;
+		void _updateRenderQueue(RenderQueue *);
+		void getRenderOperation(RenderOperation &);
+		virtual bool preRender(SceneManager* sm, RenderSystem* rsys);
+		void getWorldTransforms(Matrix4 *) const;
+		const LightList& getLights(void) const;
+		/// @copydoc MovableObject::visitRenderables
+		void visitRenderables(Renderable::Visitor* visitor, 
+			bool debugRenderables = false);
+
+
+
+	protected:
+
+		/// Maximum length of each chain
+		size_t mMaxElementsPerChain;
+		/// Number of chains
+		size_t mChainCount;
+		/// Use texture coords?
+		bool mUseTexCoords;
+		/// Use vertex colour?
+		bool mUseVertexColour;
+		/// Dynamic use?
+		bool mDynamic;
+		/// Vertex data
+		VertexData* mVertexData;
+		/// Index data (to allow multiple unconnected chains)
+		IndexData* mIndexData;
+		/// Is the vertex declaration dirty?
+		bool mVertexDeclDirty;
+		/// Do the buffers need recreating?
+		bool mBuffersNeedRecreating;
+		/// Do the bounds need redefining?
+		mutable bool mBoundsDirty;
+		/// Is the index buffer dirty?
+		bool mIndexContentDirty;
+        /// Is the vertex buffer dirty?
+        bool mVertexContentDirty;
+		/// AABB
+		mutable AxisAlignedBox mAABB;
+		/// Bounding radius
+		mutable Real mRadius;
+		/// Material 
+		String mMaterialName;
+		MaterialPtr mMaterial;
+		/// Texture coord direction
+		TexCoordDirection mTexCoordDir;
+		/// Other texture coord range
+		Real mOtherTexCoordRange[2];
+        /// Camera last used to build the vertex buffer
+        Camera *mVertexCameraUsed;
+		/// When true, the billboards always face the camera
+		bool mFaceCamera;
+		/// Used when mFaceCamera == false; determines the billboard's "normal". i.e.
+		/// when the orientation is identity, the billboard is perpendicular to this
+		/// vector
+		Vector3 mNormalBase;
+
+
+		/// The list holding the chain elements
+		ElementList mChainElementList;
+
+		/** Simple struct defining a chain segment by referencing a subset of
+			the preallocated buffer (which will be mMaxElementsPerChain * mChainCount
+			long), by it's chain index, and a head and tail value which describe
+			the current chain. The buffer subset wraps at mMaxElementsPerChain
+			so that head and tail can move freely. head and tail are inclusive,
+			when the chain is empty head and tail are filled with high-values.
+		*/
+		struct ChainSegment
+		{
+			/// The start of this chains subset of the buffer
+			size_t start;
+			/// The 'head' of the chain, relative to start
+			size_t head;
+			/// The 'tail' of the chain, relative to start
+			size_t tail;
+		};
+		typedef vector<ChainSegment>::type ChainSegmentList;
+		ChainSegmentList mChainSegmentList;
+
+		/// Setup the STL collections
+		virtual void setupChainContainers(void);
+		/// Setup vertex declaration
+		virtual void setupVertexDeclaration(void);
+		/// Setup buffers
+		virtual void setupBuffers(void);
+		/// Update the contents of the vertex buffer
+		virtual void updateVertexBuffer(Camera* cam);
+		/// Update the contents of the index buffer
+		virtual void updateIndexBuffer(void);
+		virtual void updateBoundingBox(void) const;
+
+		/// Chain segment has no elements
+		static const size_t SEGMENT_EMPTY;
+	};
+
+
+	/** Factory object for creating BillboardChain instances */
+	class _OgreExport BillboardChainFactory : public MovableObjectFactory
+	{
+	protected:
+		MovableObject* createInstanceImpl( const String& name, const NameValuePairList* params);
+	public:
+		BillboardChainFactory() {}
+		~BillboardChainFactory() {}
+
+		static String FACTORY_TYPE_NAME;
+
+		const String& getType(void) const;
+		void destroyInstance( MovableObject* obj);  
+
+	};
+
+	/** @} */
+	/** @} */
+
+} // namespace
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreBillboardParticleRenderer.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreBillboardParticleRenderer.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreBillboardParticleRenderer.h	(revision 148)
@@ -0,0 +1,266 @@
+/*
+-----------------------------------------------------------------------------
+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 __BillboardParticleRenderer_H__
+#define __BillboardParticleRenderer_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreParticleSystemRenderer.h"
+#include "OgreBillboardSet.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+    /** \addtogroup Core
+    *  @{
+    */
+    /** \addtogroup Effects
+    *  @{
+    */
+
+    /** Specialisation of ParticleSystemRenderer to render particles using 
+        a BillboardSet. 
+    @remarks
+        This renderer has a few more options than the standard particle system,
+        which will be passed to it automatically when the particle system itself
+        does not understand them.
+    */
+    class _OgreExport BillboardParticleRenderer : public ParticleSystemRenderer
+    {
+    protected:
+        /// The billboard set that's doing the rendering
+        BillboardSet* mBillboardSet;
+    public:
+        BillboardParticleRenderer();
+        ~BillboardParticleRenderer();
+
+        /** Command object for billboard type (see ParamCommand).*/
+        class _OgrePrivate CmdBillboardType : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /** Command object for billboard origin (see ParamCommand).*/
+        class _OgrePrivate CmdBillboardOrigin : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /** Command object for billboard rotation type (see ParamCommand).*/
+        class _OgrePrivate CmdBillboardRotationType : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /** Command object for common direction (see ParamCommand).*/
+        class _OgrePrivate CmdCommonDirection : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /** Command object for common up-vector (see ParamCommand).*/
+        class _OgrePrivate CmdCommonUpVector : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /** Command object for point rendering (see ParamCommand).*/
+        class _OgrePrivate CmdPointRendering : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /** Command object for accurate facing(see ParamCommand).*/
+        class _OgrePrivate CmdAccurateFacing : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+
+        /** Sets the type of billboard to render.
+        @remarks
+            The default sort of billboard (BBT_POINT), always has both x and y axes parallel to 
+            the camera's local axes. This is fine for 'point' style billboards (e.g. flares,
+            smoke, anything which is symmetrical about a central point) but does not look good for
+            billboards which have an orientation (e.g. an elongated raindrop). In this case, the
+            oriented billboards are more suitable (BBT_ORIENTED_COMMON or BBT_ORIENTED_SELF) since they retain an independent Y axis
+            and only the X axis is generated, perpendicular to both the local Y and the camera Z.
+        @param bbt The type of billboard to render
+        */
+        void setBillboardType(BillboardType bbt);
+
+        /** Returns the billboard type in use. */
+        BillboardType getBillboardType(void) const;
+
+        /// @copydoc BillboardSet::setUseAccurateFacing
+        void setUseAccurateFacing(bool acc);
+        /// @copydoc BillboardSet::getUseAccurateFacing
+        bool getUseAccurateFacing(void) const;
+
+        /** Sets the point which acts as the origin point for all billboards in this set.
+        @remarks
+            This setting controls the fine tuning of where a billboard appears in relation to it's
+            position. It could be that a billboard's position represents it's center (e.g. for fireballs),
+            it could mean the center of the bottom edge (e.g. a tree which is positioned on the ground),
+            the top-left corner (e.g. a cursor).
+        @par
+            The default setting is BBO_CENTER.
+        @param origin
+            A member of the BillboardOrigin enum specifying the origin for all the billboards in this set.
+        */
+        void setBillboardOrigin(BillboardOrigin origin) { mBillboardSet->setBillboardOrigin(origin); }
+
+        /** Gets the point which acts as the origin point for all billboards in this set.
+        @return
+            A member of the BillboardOrigin enum specifying the origin for all the billboards in this set.
+        */
+        BillboardOrigin getBillboardOrigin(void) const { return mBillboardSet->getBillboardOrigin(); }
+
+        /** Sets billboard rotation type.
+        @remarks
+            This setting controls the billboard rotation type, you can deciding rotate the billboard's vertices
+            around their facing direction or rotate the billboard's texture coordinates.
+        @par
+            The default settings is BBR_TEXCOORD.
+        @param rotationType
+            A member of the BillboardRotationType enum specifying the rotation type for all the billboards in this set.
+        */
+        void setBillboardRotationType(BillboardRotationType rotationType);
+
+        /** Gets billboard rotation type.
+        @return
+            A member of the BillboardRotationType enum specifying the rotation type for all the billboards in this set.
+        */
+        BillboardRotationType getBillboardRotationType(void) const;
+
+        /** Use this to specify the common direction given to billboards of type BBT_ORIENTED_COMMON.
+        @remarks
+            Use BBT_ORIENTED_COMMON when you want oriented billboards but you know they are always going to 
+            be oriented the same way (e.g. rain in calm weather). It is faster for the system to calculate
+            the billboard vertices if they have a common direction.
+        @param vec The direction for all billboards.
+        */
+        void setCommonDirection(const Vector3& vec);
+
+        /** Gets the common direction for all billboards (BBT_ORIENTED_COMMON) */
+        const Vector3& getCommonDirection(void) const;
+
+        /** Use this to specify the common up-vector given to billboards of type BBT_PERPENDICULAR_SELF.
+        @remarks
+            Use BBT_PERPENDICULAR_SELF when you want oriented billboards perpendicular to their own
+            direction vector and doesn't face to camera. In this case, we need an additional vector
+            to determine the billboard X, Y axis. The generated X axis perpendicular to both the own
+            direction and up-vector, the Y axis will coplanar with both own direction and up-vector,
+            and perpendicular to own direction.
+        @param vec The up-vector for all billboards.
+        */
+        void setCommonUpVector(const Vector3& vec);
+
+        /** Gets the common up-vector for all billboards (BBT_PERPENDICULAR_SELF) */
+        const Vector3& getCommonUpVector(void) const;
+
+        /// @copydoc BillboardSet::setPointRenderingEnabled
+        void setPointRenderingEnabled(bool enabled);
+
+        /// @copydoc BillboardSet::isPointRenderingEnabled
+        bool isPointRenderingEnabled(void) const;
+
+
+
+        /// @copydoc ParticleSystemRenderer::getType
+        const String& getType(void) const;
+        /// @copydoc ParticleSystemRenderer::_updateRenderQueue
+        void _updateRenderQueue(RenderQueue* queue, 
+            list<Particle*>::type& currentParticles, bool cullIndividually);
+        /// @copydoc ParticleSystemRenderer::visitRenderables
+        void visitRenderables(Renderable::Visitor* visitor, 
+            bool debugRenderables = false);
+        /// @copydoc ParticleSystemRenderer::_setMaterial
+        void _setMaterial(MaterialPtr& mat);
+        /// @copydoc ParticleSystemRenderer::_notifyCurrentCamera
+        void _notifyCurrentCamera(Camera* cam);
+        /// @copydoc ParticleSystemRenderer::_notifyParticleRotated
+        void _notifyParticleRotated(void);
+        /// @copydoc ParticleSystemRenderer::_notifyParticleResized
+        void _notifyParticleResized(void);
+        /// @copydoc ParticleSystemRenderer::_notifyParticleQuota
+        void _notifyParticleQuota(size_t quota);
+        /// @copydoc ParticleSystemRenderer::_notifyAttached
+        void _notifyAttached(Node* parent, bool isTagPoint = false);
+        /// @copydoc ParticleSystemRenderer::_notifyDefaultDimensions
+        void _notifyDefaultDimensions(Real width, Real height);
+		/// @copydoc ParticleSystemRenderer::setRenderQueueGroup
+		void setRenderQueueGroup(uint8 queueID);
+		/// @copydoc MovableObject::setRenderQueueGroupAndPriority
+		void setRenderQueueGroupAndPriority(uint8 queueID, ushort priority);
+		/// @copydoc ParticleSystemRenderer::setKeepParticlesInLocalSpace
+		void setKeepParticlesInLocalSpace(bool keepLocal);
+        /// @copydoc ParticleSystemRenderer::_getSortMode
+        SortMode _getSortMode(void) const;
+
+        /// Access BillboardSet in use
+        BillboardSet* getBillboardSet(void) const { return mBillboardSet; }
+
+    protected:
+        static CmdBillboardType msBillboardTypeCmd;
+        static CmdBillboardOrigin msBillboardOriginCmd;
+        static CmdBillboardRotationType msBillboardRotationTypeCmd;
+        static CmdCommonDirection msCommonDirectionCmd;
+        static CmdCommonUpVector msCommonUpVectorCmd;
+        static CmdPointRendering msPointRenderingCmd;
+        static CmdAccurateFacing msAccurateFacingCmd;
+
+
+    };
+
+    /** Factory class for BillboardParticleRenderer */
+    class _OgreExport BillboardParticleRendererFactory : public ParticleSystemRendererFactory
+    {
+    public:
+        /// @copydoc FactoryObj::getType
+        const String& getType() const;
+        /// @copydoc FactoryObj::createInstance
+        ParticleSystemRenderer* createInstance( const String& name );
+        /// @copydoc FactoryObj::destroyInstance
+        void destroyInstance(ParticleSystemRenderer* ptr);
+    };
+    /** @} */
+    /** @} */
+
+} // namespace Ogre
+
+#include "OgreHeaderSuffix.h"
+
+#endif // __BillboardParticleRenderer_H__
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreBillboardSet.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreBillboardSet.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreBillboardSet.h	(revision 148)
@@ -0,0 +1,880 @@
+/*
+-----------------------------------------------------------------------------
+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 __BillboardSet_H__
+#define __BillboardSet_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreMovableObject.h"
+#include "OgreRenderable.h"
+#include "OgreRadixSort.h"
+#include "OgreCommon.h"
+#include "OgreResourceGroupManager.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+    /** \addtogroup Core
+    *  @{
+    */
+    /** \addtogroup Effects
+    *  @{
+    */
+
+    /** Enum covering what exactly a billboard's position means (center,
+        top-left etc).
+    @see
+        BillboardSet::setBillboardOrigin
+    */
+    enum BillboardOrigin
+    {
+        BBO_TOP_LEFT,
+        BBO_TOP_CENTER,
+        BBO_TOP_RIGHT,
+        BBO_CENTER_LEFT,
+        BBO_CENTER,
+        BBO_CENTER_RIGHT,
+        BBO_BOTTOM_LEFT,
+        BBO_BOTTOM_CENTER,
+        BBO_BOTTOM_RIGHT
+    };
+    /** The rotation type of billboard. */
+    enum BillboardRotationType
+    {
+        /// Rotate the billboard's vertices around their facing direction
+        BBR_VERTEX,
+        /// Rotate the billboard's texture coordinates
+        BBR_TEXCOORD
+    };
+    /** The type of billboard to use. */
+    enum BillboardType
+    {
+        /// Standard point billboard (default), always faces the camera completely and is always upright
+        BBT_POINT,
+        /// Billboards are oriented around a shared direction vector (used as Y axis) and only rotate around this to face the camera
+        BBT_ORIENTED_COMMON,
+        /// Billboards are oriented around their own direction vector (their own Y axis) and only rotate around this to face the camera
+        BBT_ORIENTED_SELF,
+        /// Billboards are perpendicular to a shared direction vector (used as Z axis, the facing direction) and X, Y axis are determined by a shared up-vertor
+        BBT_PERPENDICULAR_COMMON,
+        /// Billboards are perpendicular to their own direction vector (their own Z axis, the facing direction) and X, Y axis are determined by a shared up-vertor
+        BBT_PERPENDICULAR_SELF
+    };
+
+    /** A collection of billboards (faces which are always facing the given direction) with the same (default) dimensions, material
+        and which are fairly close proximity to each other.
+    @remarks
+        Billboards are rectangles made up of 2 tris which are always facing the given direction. They are typically used
+        for special effects like particles. This class collects together a set of billboards with the same (default) dimensions,
+        material and relative locality in order to process them more efficiently. The entire set of billboards will be
+        culled as a whole (by default, although this can be changed if you want a large set of billboards
+        which are spread out and you want them culled individually), individual Billboards have locations which are relative to the set (which itself derives it's
+        position from the SceneNode it is attached to since it is a MoveableObject), they will be rendered as a single rendering operation,
+        and some calculations will be sped up by the fact that they use the same dimensions so some workings can be reused.
+    @par
+        A BillboardSet can be created using the SceneManager::createBillboardSet method. They can also be used internally
+        by other classes to create effects.
+    @note
+        Billboard bounds are only automatically calculated when you create them.
+        If you modify the position of a billboard you may need to call 
+        _updateBounds if the billboard moves outside the original bounds. 
+        Similarly, the bounds do no shrink when you remove a billboard, 
+        if you want them to call _updateBounds, but note this requires a
+        potentially expensive examination of every billboard in the set.
+    */
+    class _OgreExport BillboardSet : public MovableObject, public Renderable
+    {
+    protected:
+        /** Private constructor (instances cannot be created directly).
+        */
+        BillboardSet();
+
+        /// Bounds of all billboards in this set
+        AxisAlignedBox mAABB;
+        /// Bounding radius
+        Real mBoundingRadius;
+
+        /// Origin of each billboard
+        BillboardOrigin mOriginType;
+        /// Rotation type of each billboard
+        BillboardRotationType mRotationType;
+
+        /// Default width of each billboard
+        Real mDefaultWidth;
+        /// Default height of each billboard
+        Real mDefaultHeight;
+
+        /// Name of the material to use
+        String mMaterialName;
+        /// Pointer to the material to use
+        MaterialPtr mMaterial;
+
+        /// True if no billboards in this set have been resized - greater efficiency.
+        bool mAllDefaultSize;
+
+        /// Flag indicating whether to autoextend pool
+        bool mAutoExtendPool;
+
+        /// Flag indicating whether the billboards has to be sorted
+        bool mSortingEnabled;
+
+        /// Use 'true' billboard to cam position facing, rather than camera direcion
+        bool mAccurateFacing;
+
+        bool mAllDefaultRotation;
+        bool mWorldSpace;
+
+        typedef list<Billboard*>::type ActiveBillboardList;
+        typedef list<Billboard*>::type FreeBillboardList;
+        typedef vector<Billboard*>::type BillboardPool;
+
+        /** Active billboard list.
+        @remarks
+            This is a linked list of pointers to billboards in the billboard pool.
+        @par
+            This allows very fast insertions and deletions from anywhere in the list to activate / deactivate billboards
+            (required for particle systems etc.) as well as reuse of Billboard instances in the pool
+            without construction & destruction which avoids memory thrashing.
+        */
+        ActiveBillboardList mActiveBillboards;
+
+        /** Free billboard queue.
+        @remarks
+            This contains a list of the billboards free for use as new instances
+            as required by the set. Billboard instances are preconstructed up to the estimated size in the
+            mBillboardPool vector and are referenced on this deque at startup. As they get used this deque
+            reduces, as they get released back to to the set they get added back to the deque.
+        */
+        FreeBillboardList mFreeBillboards;
+
+        /** Pool of billboard instances for use and reuse in the active billboard list.
+        @remarks
+            This vector will be preallocated with the estimated size of the set,and will extend as required.
+        */
+        BillboardPool mBillboardPool;
+
+        /// The vertex position data for all billboards in this set.
+        VertexData* mVertexData;
+        /// Shortcut to main buffer (positions, colours, texture coords)
+        HardwareVertexBufferSharedPtr mMainBuf;
+        /// Locked pointer to buffer
+        float* mLockPtr;
+        /// Boundary offsets based on origin and camera orientation
+        /// Vector3 vLeftOff, vRightOff, vTopOff, vBottomOff;
+        /// Final vertex offsets, used where sizes all default to save calcs
+        Vector3 mVOffset[4];
+        /// Current camera
+        Camera* mCurrentCamera;
+        /// Parametric offsets of origin
+        Real mLeftOff, mRightOff, mTopOff, mBottomOff;
+        /// Camera axes in billboard space
+        Vector3 mCamX, mCamY;
+        /// Camera direction in billboard space
+        Vector3 mCamDir;
+        /// Camera orientation in billboard space
+        Quaternion mCamQ;
+        /// Camera position in billboard space
+        Vector3 mCamPos;
+
+        /// The vertex index data for all billboards in this set (1 set only)
+        IndexData* mIndexData;
+
+        /// Flag indicating whether each billboard should be culled separately (default: false)
+        bool mCullIndividual;
+
+        typedef vector< Ogre::FloatRect >::type TextureCoordSets;
+        TextureCoordSets mTextureCoords;
+
+        /// The type of billboard to render
+        BillboardType mBillboardType;
+
+        /// Common direction for billboards of type BBT_ORIENTED_COMMON and BBT_PERPENDICULAR_COMMON
+        Vector3 mCommonDirection;
+        /// Common up-vector for billboards of type BBT_PERPENDICULAR_SELF and BBT_PERPENDICULAR_COMMON
+        Vector3 mCommonUpVector;
+
+        /// Internal method for culling individual billboards
+        inline bool billboardVisible(Camera* cam, const Billboard& bill);
+
+        /// Number of visible billboards (will be == getNumBillboards if mCullIndividual == false)
+        unsigned short mNumVisibleBillboards;
+
+        /// Internal method for increasing pool size
+        virtual void increasePool(size_t size);
+
+
+        //-----------------------------------------------------------------------
+        // The internal methods which follow are here to allow maximum flexibility as to 
+        //  when various components of the calculation are done. Depending on whether the
+        //  billboards are of fixed size and whether they are point or oriented type will
+        //  determine how much calculation has to be done per-billboard. NOT a one-size fits all approach.
+        //-----------------------------------------------------------------------
+        /** Internal method for generating billboard corners. 
+        @remarks
+            Optional parameter pBill is only present for type BBT_ORIENTED_SELF and BBT_PERPENDICULAR_SELF
+        */
+        void genBillboardAxes(Vector3* pX, Vector3 *pY, const Billboard* pBill = 0);
+
+        /** Internal method, generates parametric offsets based on origin.
+        */
+        void getParametricOffsets(Real& left, Real& right, Real& top, Real& bottom);
+
+        /** Internal method for generating vertex data. 
+        @param offsets Array of 4 Vector3 offsets
+        @param pBillboard Reference to billboard
+        */
+        void genVertices(const Vector3* const offsets, const Billboard& pBillboard);
+
+        /** Internal method generates vertex offsets.
+        @remarks
+            Takes in parametric offsets as generated from getParametericOffsets, width and height values
+            and billboard x and y axes as generated from genBillboardAxes. 
+            Fills output array of 4 vectors with vector offsets
+            from origin for left-top, right-top, left-bottom, right-bottom corners.
+        */
+        void genVertOffsets(Real inleft, Real inright, Real intop, Real inbottom,
+            Real width, Real height,
+            const Vector3& x, const Vector3& y, Vector3* pDestVec);
+
+
+        /** Sort by direction functor */
+        struct SortByDirectionFunctor
+        {
+            /// Direction to sort in
+            Vector3 sortDir;
+
+            SortByDirectionFunctor(const Vector3& dir);
+            float operator()(Billboard* bill) const;
+        };
+
+        /** Sort by distance functor */
+        struct SortByDistanceFunctor
+        {
+            /// Position to sort in
+            Vector3 sortPos;
+
+            SortByDistanceFunctor(const Vector3& pos);
+            float operator()(Billboard* bill) const;
+        };
+
+        static RadixSort<ActiveBillboardList, Billboard*, float> mRadixSorter;
+
+        /// Use point rendering?
+        bool mPointRendering;
+
+
+
+    private:
+        /// Flag indicating whether the HW buffers have been created.
+        bool mBuffersCreated;
+        /// The number of billboard in the pool.
+        size_t mPoolSize;
+        /// Is external billboard data in use?
+        bool mExternalData;
+        /// Tell if vertex buffer should be update automatically.
+        bool mAutoUpdate;
+        /// True if the billboard data changed. Will cause vertex buffer update.
+        bool mBillboardDataChanged;
+
+        /** Internal method creates vertex and index buffers.
+        */
+        void _createBuffers(void);
+        /** Internal method destroys vertex and index buffers.
+        */
+        void _destroyBuffers(void);
+
+    public:
+
+        /** Usual constructor - this is called by the SceneManager.
+        @param name
+            The name to give the billboard set (must be unique)
+        @param poolSize
+            The initial size of the billboard pool. Estimate of the number of billboards
+            which will be required, and pass it using this parameter. The set will
+            preallocate this number to avoid memory fragmentation. The default behaviour
+            once this pool has run out is to double it.
+        @param externalDataSource
+            If @c true, the source of data for drawing the 
+            billboards will not be the internal billboard list, but external 
+            data. When driving the billboard from external data, you must call
+            _notifyCurrentCamera to reorient the billboards, setPoolSize to set
+            the maximum billboards you want to use, beginBillboards to 
+            start the update, and injectBillboard per billboard, 
+            followed by endBillboards.
+        @see
+            BillboardSet::setAutoextend
+        */
+        BillboardSet( const String& name, unsigned int poolSize = 20, 
+            bool externalDataSource = false);
+
+        virtual ~BillboardSet();
+
+        /** Creates a new billboard and adds it to this set.
+        @remarks
+            Behaviour once the billboard pool has been exhausted depends on the
+            BillboardSet::setAutoextend option.
+        @param position
+            The position of the new billboard realtive to the certer of the set
+        @param colour
+            Optional base colour of the billboard.
+        @return
+            On success, a pointer to a newly created Billboard is
+            returned.
+        @par
+            On failure (i.e. no more space and can't autoextend),
+            @c NULL is returned.
+        @see
+            BillboardSet::setAutoextend
+        */
+        Billboard* createBillboard(
+            const Vector3& position,
+            const ColourValue& colour = ColourValue::White );
+
+        /** Creates a new billboard and adds it to this set.
+        @remarks
+            Behaviour once the billboard pool has been exhausted depends on the
+            BillboardSet::setAutoextend option.
+        @param x
+            The @c x position of the new billboard relative to the center of the set
+        @param y
+            The @c y position of the new billboard relative to the center of the set
+        @param z
+            The @c z position of the new billboard relative to the center of the set
+        @param colour
+            Optional base colour of the billboard.
+        @return
+            On success, a pointer to a newly created Billboard is
+            returned.
+        @par
+            On failure (i.e. no more space and can't autoextend),
+            @c NULL is returned.
+        @see
+            BillboardSet::setAutoextend
+        */
+        Billboard* createBillboard(
+            Real x, Real y, Real z,
+            const ColourValue& colour = ColourValue::White );
+
+        /** Returns the number of active billboards which currently make up this set.
+        */
+        virtual int getNumBillboards(void) const;
+
+        /** Tells the set whether to allow automatic extension of the pool of billboards.
+        @remarks
+            A BillboardSet stores a pool of pre-constructed billboards which are used as needed when
+            a new billboard is requested. This allows applications to create / remove billboards efficiently
+            without incurring construction / destruction costs (a must for sets with lots of billboards like
+            particle effects). This method allows you to configure the behaviour when a new billboard is requested
+            but the billboard pool has been exhausted.
+        @par
+            The default behaviour is to allow the pool to extend (typically this allocates double the current
+            pool of billboards when the pool is expended), equivalent to calling this method with
+            autoExtend = true. If you set the parameter to false however, any attempt to create a new billboard
+            when the pool has expired will simply fail silently, returning a null pointer.
+        @param autoextend
+            @c true to double the pool every time it runs out, @c false to fail silently.
+        */
+        virtual void setAutoextend(bool autoextend);
+
+        /** Returns true if the billboard pool automatically extends.
+        @see
+            BillboardSet::setAutoextend
+        */
+        virtual bool getAutoextend(void) const;
+
+        /** Enables sorting for this BillboardSet. (default: off)
+        @param sortenable true to sort the billboards according to their distance to the camera
+        */
+        virtual void setSortingEnabled(bool sortenable);
+
+        /** Returns true if sorting of billboards is enabled based on their distance from the camera
+        @see
+            BillboardSet::setSortingEnabled
+        */
+        virtual bool getSortingEnabled(void) const;
+
+        /** Adjusts the size of the pool of billboards available in this set.
+        @remarks
+            See the BillboardSet::setAutoextend method for full details of the billboard pool. This method adjusts
+            the preallocated size of the pool. If you try to reduce the size of the pool, the set has the option
+            of ignoring you if too many billboards are already in use. Bear in mind that calling this method will
+            incur significant construction / destruction calls so should be avoided in time-critical code. The same
+            goes for auto-extension, try to avoid it by estimating the pool size correctly up-front.
+        @param size
+            The new size for the pool.
+        */
+        virtual void setPoolSize(size_t size);
+
+        /** Returns the current size of the billboard pool.
+        @return
+            The current size of the billboard pool.
+        @see
+            BillboardSet::setAutoextend
+        */
+        virtual unsigned int getPoolSize(void) const;
+
+
+        /** Empties this set of all billboards.
+        */
+        virtual void clear();
+
+        /** Returns a pointer to the billboard at the supplied index.
+        @note
+            This method requires linear time since the billboard list is a linked list.
+        @param index
+            The index of the billboard that is requested.
+        @return
+            On success, a valid pointer to the requested billboard is
+            returned.
+        @par
+            On failure, @c NULL is returned.
+        */
+        virtual Billboard* getBillboard(unsigned int index) const;
+
+        /** Removes the billboard at the supplied index.
+        @note
+            This method requires linear time since the billboard list is a linked list.
+        */
+        virtual void removeBillboard(unsigned int index);
+
+        /** Removes a billboard from the set.
+        @note
+            This version is more efficient than removing by index.
+        */
+        virtual void removeBillboard(Billboard* pBill);
+
+        /** Sets the point which acts as the origin point for all billboards in this set.
+        @remarks
+            This setting controls the fine tuning of where a billboard appears in relation to it's
+            position. It could be that a billboard's position represents it's center (e.g. for fireballs),
+            it could mean the center of the bottom edge (e.g. a tree which is positioned on the ground),
+            the top-left corner (e.g. a cursor).
+        @par
+            The default setting is BBO_CENTER.
+        @param origin
+            A member of the BillboardOrigin enum specifying the origin for all the billboards in this set.
+        */
+        virtual void setBillboardOrigin(BillboardOrigin origin);
+
+        /** Gets the point which acts as the origin point for all billboards in this set.
+        @return
+            A member of the BillboardOrigin enum specifying the origin for all the billboards in this set.
+        */
+        virtual BillboardOrigin getBillboardOrigin(void) const;
+
+        /** Sets billboard rotation type.
+        @remarks
+            This setting controls the billboard rotation type, you can deciding rotate the billboard's vertices
+            around their facing direction or rotate the billboard's texture coordinates.
+        @par
+            The default settings is BBR_TEXCOORD.
+        @param rotationType
+            A member of the BillboardRotationType enum specifying the rotation type for all the billboards in this set.
+        */
+        virtual void setBillboardRotationType(BillboardRotationType rotationType);
+
+        /** Sets billboard rotation type.
+        @return
+            A member of the BillboardRotationType enum specifying the rotation type for all the billboards in this set.
+        */
+        virtual BillboardRotationType getBillboardRotationType(void) const;
+
+        /** Sets the default dimensions of the billboards in this set.
+        @remarks
+            All billboards in a set are created with these default dimensions. The set will render most efficiently if
+            all the billboards in the set are the default size. It is possible to alter the size of individual
+            billboards at the expense of extra calculation. See the Billboard class for more info.
+        @param width
+            The new default width for the billboards in this set.
+        @param height
+            The new default height for the billboards in this set.
+        */
+        virtual void setDefaultDimensions(Real width, Real height);
+
+        /** See setDefaultDimensions - this sets 1 component individually. */
+        virtual void setDefaultWidth(Real width);
+        /** See setDefaultDimensions - this gets 1 component individually. */
+        virtual Real getDefaultWidth(void) const;
+        /** See setDefaultDimensions - this sets 1 component individually. */
+        virtual void setDefaultHeight(Real height);
+        /** See setDefaultDimensions - this gets 1 component individually. */
+        virtual Real getDefaultHeight(void) const;
+
+        /** Sets the name of the material to be used for this billboard set.
+        @param name
+            The new name of the material to use for this set.
+        */
+        virtual void setMaterialName( const String& name, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME );
+
+        /** Sets the name of the material to be used for this billboard set.
+        @return The name of the material that is used for this set.
+        */
+        virtual const String& getMaterialName(void) const;
+
+        /** Overridden from MovableObject
+        @see
+            MovableObject
+        */
+        virtual void _notifyCurrentCamera(Camera* cam);
+
+        /** Begin injection of billboard data; applicable when 
+            constructing the BillboardSet for external data use.
+        @param numBillboards If you know the number of billboards you will be 
+            issuing, state it here to make the update more efficient.
+        */
+        void beginBillboards(size_t numBillboards = 0);
+        /** Define a billboard. */
+        void injectBillboard(const Billboard& bb);
+        /** Finish defining billboards. */
+        void endBillboards(void);
+        /** Set the bounds of the BillboardSet.
+        @remarks
+            You may need to call this if you're injecting billboards manually, 
+            and you're relying on the BillboardSet to determine culling.
+        */
+        void setBounds(const AxisAlignedBox& box, Real radius);
+
+
+        /** Overridden from MovableObject
+        @see
+            MovableObject
+        */
+        virtual const AxisAlignedBox& getBoundingBox(void) const;
+
+        /** Overridden from MovableObject
+        @see
+            MovableObject
+        */
+        virtual Real getBoundingRadius(void) const;
+        /** Overridden from MovableObject
+        @see
+            MovableObject
+        */
+        virtual void _updateRenderQueue(RenderQueue* queue);
+
+        /** Overridden from MovableObject
+        @see
+            MovableObject
+        */
+        virtual const MaterialPtr& getMaterial(void) const;
+
+        /** Sets the name of the material to be used for this billboard set.
+        @param material
+            The new material to use for this set.
+         */
+        virtual void setMaterial( const MaterialPtr& material );
+
+        /** Overridden from MovableObject
+        @see
+            MovableObject
+        */
+        virtual void getRenderOperation(RenderOperation& op);
+
+        /** Overridden from MovableObject
+        @see
+            MovableObject
+        */
+        virtual void getWorldTransforms(Matrix4* xform) const;
+
+        /** Internal callback used by Billboards to notify their parent that they have been resized.
+        */
+        virtual void _notifyBillboardResized(void);
+
+        /** Internal callback used by Billboards to notify their parent that they have been rotated.
+        */
+        virtual void _notifyBillboardRotated(void);
+
+        /** Returns whether or not billboards in this are tested individually for culling. */
+        virtual bool getCullIndividually(void) const;
+        /** Sets whether culling tests billboards in this individually as well as in a group.
+        @remarks
+            Billboard sets are always culled as a whole group, based on a bounding box which 
+            encloses all billboards in the set. For fairly localised sets, this is enough. However, you
+            can optionally tell the set to also cull individual billboards in the set, i.e. to test
+            each individual billboard before rendering. The default is not to do this.
+        @par
+            This is useful when you have a large, fairly distributed set of billboards, like maybe 
+            trees on a landscape. You probably still want to group them into more than one
+            set (maybe one set per section of landscape), which will be culled coarsely, but you also
+            want to cull the billboards individually because they are spread out. Whilst you could have
+            lots of single-tree sets which are culled separately, this would be inefficient to render
+            because each tree would be issued as it's own rendering operation.
+        @par
+            By calling this method with a parameter of true, you can have large billboard sets which 
+            are spaced out and so get the benefit of batch rendering and coarse culling, but also have
+            fine-grained culling so unnecessary rendering is avoided.
+        @param cullIndividual If true, each billboard is tested before being sent to the pipeline as well 
+            as the whole set having to pass the coarse group bounding test.
+        */
+        virtual void setCullIndividually(bool cullIndividual);
+
+        /** Sets the type of billboard to render.
+        @remarks
+            The default sort of billboard (BBT_POINT), always has both x and y axes parallel to 
+            the camera's local axes. This is fine for 'point' style billboards (e.g. flares,
+            smoke, anything which is symmetrical about a central point) but does not look good for
+            billboards which have an orientation (e.g. an elongated raindrop). In this case, the
+            oriented billboards are more suitable (BBT_ORIENTED_COMMON or BBT_ORIENTED_SELF) since
+            they retain an independent Y axis and only the X axis is generated, perpendicular to both
+            the local Y and the camera Z.
+        @par
+            In some case you might want the billboard has fixed Z axis and doesn't need to face to
+            camera (e.g. an aureola around the player and parallel to the ground). You can use
+            BBT_PERPENDICULAR_SELF which the billboard plane perpendicular to the billboard own
+            direction. Or BBT_PERPENDICULAR_COMMON which the billboard plane perpendicular to the
+            common direction.
+        @note
+            BBT_PERPENDICULAR_SELF and BBT_PERPENDICULAR_COMMON can't guarantee counterclockwise, you might
+            use double-side material (<b>cull_hardware node</b>) to ensure no billboard are culled.
+        @param bbt The type of billboard to render
+        */
+        virtual void setBillboardType(BillboardType bbt);
+
+        /** Returns the billboard type in use. */
+        virtual BillboardType getBillboardType(void) const;
+
+        /** Use this to specify the common direction given to billboards of type BBT_ORIENTED_COMMON or BBT_PERPENDICULAR_COMMON.
+        @remarks
+            Use BBT_ORIENTED_COMMON when you want oriented billboards but you know they are always going to 
+            be oriented the same way (e.g. rain in calm weather). It is faster for the system to calculate
+            the billboard vertices if they have a common direction.
+        @par
+            The common direction also use in BBT_PERPENDICULAR_COMMON, in this case the common direction
+            treat as Z axis, and an additional common up-vector was use to determine billboard X and Y
+            axis.
+            @see setCommonUpVector
+        @param vec The direction for all billboards.
+        @note
+            The direction are use as is, never normalised in internal, user are supposed to normalise it himself.
+        */
+        virtual void setCommonDirection(const Vector3& vec);
+
+        /** Gets the common direction for all billboards (BBT_ORIENTED_COMMON) */
+        virtual const Vector3& getCommonDirection(void) const;
+
+        /** Use this to specify the common up-vector given to billboards of type BBT_PERPENDICULAR_SELF or BBT_PERPENDICULAR_COMMON.
+        @remarks
+            Use BBT_PERPENDICULAR_SELF or BBT_PERPENDICULAR_COMMON when you want oriented billboards
+            perpendicular to specify direction vector (or, Z axis), and doesn't face to camera.
+            In this case, we need an additional up-vector to determine the billboard X and Y axis.
+            The generated billboard plane and X-axis guarantee perpendicular to specify direction.
+            @see setCommonDirection
+        @par
+            The specify direction is billboard own direction when billboard type is BBT_PERPENDICULAR_SELF,
+            and it's shared common direction when billboard type is BBT_PERPENDICULAR_COMMON.
+        @param vec The up-vector for all billboards.
+        @note
+            The up-vector are use as is, never normalised in internal, user are supposed to normalise it himself.
+        */
+        virtual void setCommonUpVector(const Vector3& vec);
+
+        /** Gets the common up-vector for all billboards (BBT_PERPENDICULAR_SELF and BBT_PERPENDICULAR_COMMON) */
+        virtual const Vector3& getCommonUpVector(void) const;
+        
+        /** Sets whether or not billboards should use an 'accurate' facing model
+            based on the vector from each billboard to the camera, rather than 
+            an optimised version using just the camera direction.
+        @remarks
+            By default, the axes for all billboards are calculated using the 
+            camera's view direction, not the vector from the camera position to
+            the billboard. The former is faster, and most of the time the difference
+            is not noticeable. However for some purposes (e.g. very large, static
+            billboards) the changing billboard orientation when rotating the camera
+            can be off putting, therefore you can enable this option to use a
+            more expensive, but more accurate version.
+        @param acc True to use the slower but more accurate model. Default is false.
+        */
+        virtual void setUseAccurateFacing(bool acc) { mAccurateFacing = acc; }
+        /** Gets whether or not billboards use an 'accurate' facing model
+            based on the vector from each billboard to the camera, rather than 
+            an optimised version using just the camera direction.
+        */
+        virtual bool getUseAccurateFacing(void) const { return mAccurateFacing; }
+
+        /** Overridden from MovableObject */
+        virtual const String& getMovableType(void) const;
+
+        /** Overridden, see Renderable */
+        Real getSquaredViewDepth(const Camera* cam) const;
+
+        /** Update the bounds of the billboardset */
+        virtual void _updateBounds(void);
+        /** @copydoc Renderable::getLights */
+        const LightList& getLights(void) const;
+
+        /// @copydoc MovableObject::visitRenderables
+        void visitRenderables(Renderable::Visitor* visitor, 
+            bool debugRenderables = false);
+
+        /** Sort the billboard set. Only called when enabled via setSortingEnabled */
+        virtual void _sortBillboards( Camera* cam);
+
+        /** Gets the sort mode of this billboard set */
+        virtual SortMode _getSortMode(void) const;
+
+        /** Sets whether billboards should be treated as being in world space. 
+        @remarks
+            This is most useful when you are driving the billboard set from 
+            an external data source.
+        */
+        virtual void setBillboardsInWorldSpace(bool ws) { mWorldSpace = ws; }
+
+        /** BillboardSet can use custom texture coordinates for various billboards. 
+            This is useful for selecting one of many particle images out of a tiled 
+            texture sheet, or doing flipbook animation within a single texture.
+        @par
+            The generic functionality is setTextureCoords(), which will copy the 
+            texture coordinate rects you supply into internal storage for the 
+            billboard set. If your texture sheet is a square grid, you can also 
+            use setTextureStacksAndSlices() for more convenience, which will construct 
+            the set of texture coordinates for you.
+        @par
+            When a Billboard is created, it can be assigned a texture coordinate 
+            set from within the sets you specify (that set can also be re-specified 
+            later). When drawn, the billboard will use those texture coordinates, 
+            rather than the full 0-1 range.
+
+        @param coords is a vector of texture coordinates (in UV space) to choose 
+            from for each billboard created in the set.
+        @param numCoords is how many such coordinate rectangles there are to 
+            choose from.
+        @remarks
+            Set 'coords' to 0 and/or 'numCoords' to 0 to reset the texture coord 
+            rects to the initial set of a single rectangle spanning 0 through 1 in 
+            both U and V (i e, the entire texture).
+        @see
+            BillboardSet::setTextureStacksAndSlices()
+            Billboard::setTexcoordIndex()
+        */
+        virtual void setTextureCoords( Ogre::FloatRect const * coords, uint16 numCoords );
+
+        /** setTextureStacksAndSlices() will generate texture coordinate rects as if the 
+            texture for the billboard set contained 'stacks' rows of 'slices' 
+            images each, all equal size. Thus, if the texture size is 512x512 
+            and 'stacks' is 4 and 'slices' is 8, each sub-rectangle of the texture 
+            would be 128 texels tall and 64 texels wide.
+        @remarks
+            This function is short-hand for creating a regular set and calling 
+            setTextureCoords() yourself. The numbering used for Billboard::setTexcoordIndex() 
+            counts first across, then down, so top-left is 0, the one to the right 
+            of that is 1, and the lower-right is stacks*slices-1.
+        @see
+            BillboardSet::setTextureCoords()
+        */
+        virtual void setTextureStacksAndSlices( uchar stacks, uchar slices );
+
+        /** getTextureCoords() returns the current texture coordinate rects in 
+            effect. By default, there is only one texture coordinate rect in the 
+            set, spanning the entire texture from 0 through 1 in each direction.
+        @see
+            BillboardSet::setTextureCoords()
+        */
+        virtual Ogre::FloatRect const * getTextureCoords( uint16 * oNumCoords );
+
+        /** Set whether or not the BillboardSet will use point rendering
+            rather than manually generated quads.
+        @remarks
+            By default a billboardset is rendered by generating geometry for a
+            textured quad in memory, taking into account the size and 
+            orientation settings, and uploading it to the video card. 
+            The alternative is to use hardware point rendering, which means that
+            only one position needs to be sent per billboard rather than 4 and
+            the hardware sorts out how this is rendered based on the render
+            state.
+        @par
+            Using point rendering is faster than generating quads manually, but
+            is more restrictive. The following restrictions apply:
+            \li Only the BBT_POINT type is supported
+            \li Size and appearance of each billboard is controlled by the 
+                material (Pass::setPointSize, Pass::setPointSizeAttenuation, 
+                Pass::setPointSpritesEnabled)
+            \li Per-billboard size is not supported (stems from the above)
+            \li Per-billboard rotation is not supported, this can only be 
+                controlled through texture unit rotation
+            \li Only BBO_CENTER origin is supported
+            \li Per-billboard texture coordinates are not supported
+
+        @par
+            You will almost certainly want to enable in your material pass
+            both point attenuation and point sprites if you use this option. 
+        @param enabled True to enable point rendering, false otherwise
+        */
+        virtual void setPointRenderingEnabled(bool enabled);
+
+        /** Returns whether point rendering is enabled. */
+        virtual bool isPointRenderingEnabled(void) const
+        { return mPointRendering; }
+        
+        /// Override to return specific type flag
+        uint32 getTypeFlags(void) const;
+
+        /** Set the auto update state of this billboard set.
+        @remarks
+            This methods controls the updating policy of the vertex buffer.
+            By default auto update is true so the vertex buffer is being update every time this billboard set
+            is about to be rendered. This behavior best fit when the billboards of this set changes frequently.
+            When using static or semi-static billboards, it is recommended to set auto update to false.
+            In that case one should call notifyBillboardDataChanged method to reflect changes made to the
+            billboards data.
+        */
+        void setAutoUpdate(bool autoUpdate);
+
+        /** Return the auto update state of this billboard set.*/
+        bool getAutoUpdate(void) const { return mAutoUpdate; }
+
+        /** When billboard set is not auto updating its GPU buffer, the user is responsible to inform it
+            about any billboard changes in order to reflect them at the rendering stage.
+            Calling this method will cause GPU buffers update in the next render queue update.
+        */
+        void notifyBillboardDataChanged(void) { mBillboardDataChanged = true; }
+
+    };
+
+    /** Factory object for creating BillboardSet instances */
+    class _OgreExport BillboardSetFactory : public MovableObjectFactory
+    {
+    protected:
+        MovableObject* createInstanceImpl( const String& name, const NameValuePairList* params);
+    public:
+        BillboardSetFactory() {}
+        ~BillboardSetFactory() {}
+
+        static String FACTORY_TYPE_NAME;
+
+        const String& getType(void) const;
+        void destroyInstance( MovableObject* obj);  
+
+    };
+    /** @} */
+    /** @} */
+
+} // namespace Ogre
+
+#include "OgreHeaderSuffix.h"
+
+#endif // __BillboardSet_H__
Index: /ogre_src_v1-9-0/OgreMain/include/OgreBitwise.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreBitwise.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreBitwise.h	(revision 148)
@@ -0,0 +1,331 @@
+/*
+-----------------------------------------------------------------------------
+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 _Bitwise_H__
+#define _Bitwise_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Math
+	*  @{
+	*/
+
+    /** Class for manipulating bit patterns.
+    */
+    class Bitwise {
+    public:
+        /** Returns the most significant bit set in a value.
+        */
+        static FORCEINLINE unsigned int mostSignificantBitSet(unsigned int value)
+        {
+            unsigned int result = 0;
+            while (value != 0) {
+                ++result;
+                value >>= 1;
+            }
+            return result-1;
+        }
+        /** Returns the closest power-of-two number greater or equal to value.
+            @note 0 and 1 are powers of two, so 
+                firstPO2From(0)==0 and firstPO2From(1)==1.
+        */
+        static FORCEINLINE uint32 firstPO2From(uint32 n)
+        {
+            --n;            
+            n |= n >> 16;
+            n |= n >> 8;
+            n |= n >> 4;
+            n |= n >> 2;
+            n |= n >> 1;
+            ++n;
+            return n;
+        }
+        /** Determines whether the number is power-of-two or not.
+            @note 0 and 1 are tread as power of two.
+        */
+        template<typename T>
+        static FORCEINLINE bool isPO2(T n)
+        {
+            return (n & (n-1)) == 0;
+        }
+        /** Returns the number of bits a pattern must be shifted right by to
+            remove right-hand zeros.
+        */
+		template<typename T>
+        static FORCEINLINE unsigned int getBitShift(T mask)
+		{
+			if (mask == 0)
+				return 0;
+
+			unsigned int result = 0;
+			while ((mask & 1) == 0) {
+				++result;
+				mask >>= 1;
+			}
+			return result;
+		}
+
+        /** Takes a value with a given src bit mask, and produces another
+            value with a desired bit mask.
+            @remarks
+                This routine is useful for colour conversion.
+        */
+		template<typename SrcT, typename DestT>
+        static inline DestT convertBitPattern(SrcT srcValue, SrcT srcBitMask, DestT destBitMask)
+		{
+			// Mask off irrelevant source value bits (if any)
+			srcValue = srcValue & srcBitMask;
+
+			// Shift source down to bottom of DWORD
+			const unsigned int srcBitShift = getBitShift(srcBitMask);
+			srcValue >>= srcBitShift;
+
+			// Get max value possible in source from srcMask
+			const SrcT srcMax = srcBitMask >> srcBitShift;
+
+			// Get max available in dest
+			const unsigned int destBitShift = getBitShift(destBitMask);
+			const DestT destMax = destBitMask >> destBitShift;
+
+			// Scale source value into destination, and shift back
+			DestT destValue = (srcValue * destMax) / srcMax;
+			return (destValue << destBitShift);
+		}
+
+        /**
+         * Convert N bit colour channel value to P bits. It fills P bits with the
+         * bit pattern repeated. (this is /((1<<n)-1) in fixed point)
+         */
+        static inline unsigned int fixedToFixed(uint32 value, unsigned int n, unsigned int p) 
+        {
+            if(n > p) 
+            {
+                // Less bits required than available; this is easy
+                value >>= n-p;
+            } 
+            else if(n < p)
+            {
+                // More bits required than are there, do the fill
+                // Use old fashioned division, probably better than a loop
+                if(value == 0)
+                        value = 0;
+                else if(value == (static_cast<unsigned int>(1)<<n)-1)
+                        value = (1<<p)-1;
+                else    value = value*(1<<p)/((1<<n)-1);
+            }
+            return value;    
+        }
+
+        /**
+         * Convert floating point colour channel value between 0.0 and 1.0 (otherwise clamped) 
+         * to integer of a certain number of bits. Works for any value of bits between 0 and 31.
+         */
+        static inline unsigned int floatToFixed(const float value, const unsigned int bits)
+        {
+            if(value <= 0.0f) return 0;
+            else if (value >= 1.0f) return (1<<bits)-1;
+            else return (unsigned int)(value * (1<<bits));     
+        }
+
+        /**
+         * Fixed point to float
+         */
+        static inline float fixedToFloat(unsigned value, unsigned int bits)
+        {
+            return (float)value/(float)((1<<bits)-1);
+        }
+
+        /**
+         * Write a n*8 bits integer value to memory in native endian.
+         */
+        static inline void intWrite(void *dest, const int n, const unsigned int value)
+        {
+            switch(n) {
+                case 1:
+                    ((uint8*)dest)[0] = (uint8)value;
+                    break;
+                case 2:
+                    ((uint16*)dest)[0] = (uint16)value;
+                    break;
+                case 3:
+#if OGRE_ENDIAN == OGRE_ENDIAN_BIG      
+                    ((uint8*)dest)[0] = (uint8)((value >> 16) & 0xFF);
+                    ((uint8*)dest)[1] = (uint8)((value >> 8) & 0xFF);
+                    ((uint8*)dest)[2] = (uint8)(value & 0xFF);
+#else
+                    ((uint8*)dest)[2] = (uint8)((value >> 16) & 0xFF);
+                    ((uint8*)dest)[1] = (uint8)((value >> 8) & 0xFF);
+                    ((uint8*)dest)[0] = (uint8)(value & 0xFF);
+#endif
+                    break;
+                case 4:
+                    ((uint32*)dest)[0] = (uint32)value;                
+                    break;                
+            }        
+        }
+        /**
+         * Read a n*8 bits integer value to memory in native endian.
+         */
+        static inline unsigned int intRead(const void *src, int n) {
+            switch(n) {
+                case 1:
+                    return ((const uint8*)src)[0];
+                case 2:
+                    return ((const uint16*)src)[0];
+                case 3:
+#if OGRE_ENDIAN == OGRE_ENDIAN_BIG      
+                    return ((uint32)((const uint8*)src)[0]<<16)|
+                            ((uint32)((const uint8*)src)[1]<<8)|
+                            ((uint32)((const uint8*)src)[2]);
+#else
+                    return ((uint32)((const uint8*)src)[0])|
+                            ((uint32)((const uint8*)src)[1]<<8)|
+                            ((uint32)((const uint8*)src)[2]<<16);
+#endif
+                case 4:
+                    return ((const uint32*)src)[0];
+            } 
+            return 0; // ?
+        }
+
+        /** Convert a float32 to a float16 (NV_half_float)
+         	Courtesy of OpenEXR
+        */
+        static inline uint16 floatToHalf(float i)
+        {
+            union { float f; uint32 i; } v;
+            v.f = i;
+            return floatToHalfI(v.i);
+        }
+		/** Converts float in uint32 format to a a half in uint16 format
+		*/
+        static inline uint16 floatToHalfI(uint32 i)
+        {
+            register int s =  (i >> 16) & 0x00008000;
+            register int e = ((i >> 23) & 0x000000ff) - (127 - 15);
+            register int m =   i        & 0x007fffff;
+        
+            if (e <= 0)
+            {
+                if (e < -10)
+                {
+                    return 0;
+                }
+                m = (m | 0x00800000) >> (1 - e);
+        
+                return static_cast<uint16>(s | (m >> 13));
+            }
+            else if (e == 0xff - (127 - 15))
+            {
+                if (m == 0) // Inf
+                {
+                    return static_cast<uint16>(s | 0x7c00);
+                } 
+                else    // NAN
+                {
+                    m >>= 13;
+                    return static_cast<uint16>(s | 0x7c00 | m | (m == 0));
+                }
+            }
+            else
+            {
+                if (e > 30) // Overflow
+                {
+                    return static_cast<uint16>(s | 0x7c00);
+                }
+        
+                return static_cast<uint16>(s | (e << 10) | (m >> 13));
+            }
+        }
+        
+        /**
+         * Convert a float16 (NV_half_float) to a float32
+         * Courtesy of OpenEXR
+         */
+        static inline float halfToFloat(uint16 y)
+        {
+            union { float f; uint32 i; } v;
+            v.i = halfToFloatI(y);
+            return v.f;
+        }
+		/** Converts a half in uint16 format to a float
+		 	in uint32 format
+		 */
+        static inline uint32 halfToFloatI(uint16 y)
+        {
+            register int s = (y >> 15) & 0x00000001;
+            register int e = (y >> 10) & 0x0000001f;
+            register int m =  y        & 0x000003ff;
+        
+            if (e == 0)
+            {
+                if (m == 0) // Plus or minus zero
+                {
+                    return s << 31;
+                }
+                else // Denormalized number -- renormalize it
+                {
+                    while (!(m & 0x00000400))
+                    {
+                        m <<= 1;
+                        e -=  1;
+                    }
+        
+                    e += 1;
+                    m &= ~0x00000400;
+                }
+            }
+            else if (e == 31)
+            {
+                if (m == 0) // Inf
+                {
+                    return (s << 31) | 0x7f800000;
+                }
+                else // NaN
+                {
+                    return (s << 31) | 0x7f800000 | (m << 13);
+                }
+            }
+        
+            e = e + (127 - 15);
+            m = m << 13;
+        
+            return (s << 31) | (e << 23) | m;
+        }
+         
+
+    };
+	/** @} */
+	/** @} */
+
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreBlendMode.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreBlendMode.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreBlendMode.h	(revision 148)
@@ -0,0 +1,266 @@
+/*
+-----------------------------------------------------------------------------
+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 __BLENDMODE_H__
+#define __BLENDMODE_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreColourValue.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Materials
+	*  @{
+	*/
+
+    /** Type of texture blend mode.
+    */
+    enum LayerBlendType
+    {
+        LBT_COLOUR,
+        LBT_ALPHA
+    };
+
+    /** List of valid texture blending operations, for use with TextureUnitState::setColourOperation.
+        @remarks
+            This list is a more limited list than LayerBlendOperationEx because it only
+            includes operations that are supportable in both multipass and multitexture
+            rendering and thus provides automatic fallback if multitexture hardware
+            is lacking or insufficient.
+    */
+    enum LayerBlendOperation {
+        /// Replace all colour with texture with no adjustment
+        LBO_REPLACE,
+        /// Add colour components together.
+        LBO_ADD,
+        /// Multiply colour components together.
+        LBO_MODULATE,
+        /// Blend based on texture alpha
+        LBO_ALPHA_BLEND
+
+    };
+
+    /** Expert list of valid texture blending operations, for use with TextureUnitState::setColourOperationEx
+        and TextureUnitState::setAlphaOperation, and internally in the LayerBlendModeEx class. It's worth
+        noting that these operations are for blending <i>between texture layers</i> and not between rendered objects
+        and the existing scene. Because all of these modes are only supported in multitexture hardware it may be
+        required to set up a fallback operation where this hardware is not available.
+    */
+    enum LayerBlendOperationEx {
+        /// use source1 without modification
+        LBX_SOURCE1,
+        /// use source2 without modification
+        LBX_SOURCE2,
+        /// multiply source1 and source2 together
+        LBX_MODULATE,
+        /// as LBX_MODULATE but brighten afterwards (x2)
+        LBX_MODULATE_X2,
+        /// as LBX_MODULATE but brighten more afterwards (x4)
+        LBX_MODULATE_X4,
+        /// add source1 and source2 together
+        LBX_ADD,
+        /// as LBX_ADD, but subtract 0.5 from the result
+        LBX_ADD_SIGNED,
+        /// as LBX_ADD, but subtract product from the sum
+        LBX_ADD_SMOOTH,
+        /// subtract source2 from source1
+        LBX_SUBTRACT,
+        /// use interpolated alpha value from vertices to scale source1, then add source2 scaled by (1-alpha)
+        LBX_BLEND_DIFFUSE_ALPHA,
+        /// as LBX_BLEND_DIFFUSE_ALPHA, but use alpha from texture
+        LBX_BLEND_TEXTURE_ALPHA,
+        /// as LBX_BLEND_DIFFUSE_ALPHA, but use current alpha from previous stages
+        LBX_BLEND_CURRENT_ALPHA,
+        /// as LBX_BLEND_DIFFUSE_ALPHA but use a constant manual blend value (0.0-1.0)
+        LBX_BLEND_MANUAL,
+        /// dot product of color1 and color2 
+        LBX_DOTPRODUCT,
+        /// use interpolated color values from vertices to scale source1, then add source2 scaled by (1-color)
+        LBX_BLEND_DIFFUSE_COLOUR
+    };
+
+    /** List of valid sources of values for blending operations used
+        in TextureUnitState::setColourOperation and TextureUnitState::setAlphaOperation,
+        and internally in the LayerBlendModeEx class.
+    */
+    enum LayerBlendSource
+    {
+        /// the colour as built up from previous stages
+        LBS_CURRENT,
+        /// the colour derived from the texture assigned to this layer
+        LBS_TEXTURE,
+        /// the interpolated diffuse colour from the vertices
+        LBS_DIFFUSE,
+        /// the interpolated specular colour from the vertices
+        LBS_SPECULAR,
+        /// a colour supplied manually as a separate argument
+        LBS_MANUAL
+    };
+    /** Class which manages blending of both colour and alpha components.
+        @remarks
+            This class is a utility class used by both TextureUnitState and
+            RenderSystem to wrap up the details of a blending operation. This blending
+            operation could be used for blending colour or alpha in a texture layer.
+            This class is really only for use by OGRE, since apps can deal with
+            blending modes through the TextureUnitState class methods
+            setColourOperation and setAlphaOperation.
+        @par
+            It's worth noting that these operations are for blending <i>between texture
+            layers</i> and not between rendered objects and the existing scene. If
+            you wish to make an object blend with others in the scene, e.g. to make
+            transparent objects etc, use the Material::setSceneBlending method.
+    */
+    class _OgreExport LayerBlendModeEx
+    {
+    public:
+        /// The type of blending (colour or alpha)
+        LayerBlendType blendType;
+        /// The operation to be applied
+        LayerBlendOperationEx operation;
+        /// The first source of colour/alpha
+        LayerBlendSource source1;
+        /// The second source of colour/alpha
+        LayerBlendSource source2;
+
+        /// Manual colour value for manual source1
+        ColourValue colourArg1;
+        /// Manual colour value for manual source2
+        ColourValue colourArg2;
+        /// Manual alpha value for manual source1
+        Real alphaArg1;
+        /// Manual alpha value for manual source2
+        Real alphaArg2;
+        /// Manual blending factor
+        Real factor;
+
+        bool operator==(const LayerBlendModeEx& rhs) const
+        {
+            if (blendType != rhs.blendType) return false;
+
+            if (blendType == LBT_COLOUR)
+            {
+
+                if (operation == rhs.operation &&
+                    source1 == rhs.source1 &&
+                    source2 == rhs.source2 &&
+                    colourArg1 == rhs.colourArg1 &&
+                    colourArg2 == rhs.colourArg2 &&
+                    factor == rhs.factor)
+                {
+                    return true;
+                }
+            }
+            else // if (blendType == LBT_ALPHA)
+            {
+                if (operation == rhs.operation &&
+                    source1 == rhs.source1 &&
+                    source2 == rhs.source2 &&
+                    alphaArg1 == rhs.alphaArg1 &&
+                    alphaArg2 == rhs.alphaArg2 &&
+                    factor == rhs.factor)
+                {
+                    return true;
+                }
+            }
+            return false;
+        }
+
+        bool operator!=(const LayerBlendModeEx& rhs) const
+        {
+            return !(*this == rhs);
+        }
+
+
+
+    };
+
+    /** Types of blending that you can specify between an object and the existing contents of the scene.
+        @remarks
+            As opposed to the LayerBlendType, which classifies blends between texture layers, these blending
+            types blend between the output of the texture units and the pixels already in the viewport,
+            allowing for object transparency, glows, etc.
+        @par
+            These types are provided to give quick and easy access to common effects. You can also use
+            the more manual method of supplying source and destination blending factors.
+            See Material::setSceneBlending for more details.
+        @see
+            Material::setSceneBlending
+    */
+    enum SceneBlendType
+    {
+        /// Make the object transparent based on the final alpha values in the texture
+        SBT_TRANSPARENT_ALPHA,
+        /// Make the object transparent based on the colour values in the texture (brighter = more opaque)
+        SBT_TRANSPARENT_COLOUR,
+        /// Add the texture values to the existing scene content
+        SBT_ADD,
+		/// Multiply the 2 colours together
+		SBT_MODULATE,
+        /// The default blend mode where source replaces destination
+        SBT_REPLACE
+        // TODO : more
+    };
+
+    /** Blending factors for manually blending objects with the scene. If there isn't a predefined
+        SceneBlendType that you like, then you can specify the blending factors directly to affect the
+        combination of object and the existing scene. See Material::setSceneBlending for more details.
+    */
+    enum SceneBlendFactor
+    {
+        SBF_ONE,
+        SBF_ZERO,
+        SBF_DEST_COLOUR,
+        SBF_SOURCE_COLOUR,
+        SBF_ONE_MINUS_DEST_COLOUR,
+        SBF_ONE_MINUS_SOURCE_COLOUR,
+        SBF_DEST_ALPHA,
+        SBF_SOURCE_ALPHA,
+        SBF_ONE_MINUS_DEST_ALPHA,
+        SBF_ONE_MINUS_SOURCE_ALPHA
+
+    };
+
+	/** Blending operations controls how objects are blended into the scene. The default operation
+		is add (+) but by changing this you can change how drawn objects are blended into the
+		existing scene.
+	*/
+	enum SceneBlendOperation
+	{
+		SBO_ADD,
+		SBO_SUBTRACT,
+		SBO_REVERSE_SUBTRACT,
+		SBO_MIN,
+		SBO_MAX
+	};
+	/** @} */
+	/** @} */
+
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreBone.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreBone.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreBone.h	(revision 148)
@@ -0,0 +1,154 @@
+/*
+-----------------------------------------------------------------------------
+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 __Bone_H__
+#define __Bone_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreNode.h"
+
+
+namespace Ogre 
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Animation
+	*  @{
+	*/
+
+    /** A bone in a skeleton.
+    @remarks
+        See Skeleton for more information about the principles behind skeletal animation.
+        This class is a node in the joint hierarchy. Mesh vertices also have assignments
+        to bones to define how they move in relation to the skeleton.
+    */
+    class _OgreExport Bone : public Node
+    {
+    public:
+        /** Constructor, not to be used directly (use Bone::createChild or Skeleton::createBone) */
+        Bone(unsigned short handle, Skeleton* creator);
+        /** Constructor, not to be used directly (use Bone::createChild or Skeleton::createBone) */
+        Bone(const String& name, unsigned short handle, Skeleton* creator);
+        ~Bone();
+
+        /** Creates a new Bone as a child of this bone.
+        @remarks
+            This method creates a new bone which will inherit the transforms of this
+            bone, with the handle specified.
+            @param 
+                handle The numeric handle to give the new bone; must be unique within the Skeleton.
+            @param
+                translate Initial translation offset of child relative to parent
+            @param
+                rotate Initial rotation relative to parent
+        */
+        Bone* createChild(unsigned short handle, 
+            const Vector3& translate = Vector3::ZERO, const Quaternion& rotate = Quaternion::IDENTITY);
+
+
+        /** Gets the numeric handle for this bone (unique within the skeleton). */
+        unsigned short getHandle(void) const;
+
+        /** Sets the current position / orientation to be the 'binding pose' ie the layout in which 
+            bones were originally bound to a mesh.
+        */
+        void setBindingPose(void);
+
+        /** Resets the position and orientation of this Bone to the original binding position.
+        @remarks
+            Bones are bound to the mesh in a binding pose. They are then modified from this
+            position during animation. This method returns the bone to it's original position and
+            orientation.
+        */
+        void reset(void);
+
+        /** Sets whether or not this bone is manually controlled. 
+        @remarks
+            Manually controlled bones can be altered by the application at runtime, 
+            and their positions will not be reset by the animation routines. Note 
+            that you should also make sure that there are no AnimationTrack objects
+            referencing this bone, or if there are, you should disable them using
+            pAnimation->destroyTrack(pBone->getHandle());
+		@par
+			You can also use AnimationState::setBlendMask to mask out animation from 
+		    chosen tracks if you want to prevent application of a scripted animation 
+		    to a bone without altering the Animation definition.
+        */
+        void setManuallyControlled(bool manuallyControlled);
+
+        /** Getter for mManuallyControlled Flag */
+        bool isManuallyControlled() const;
+
+        
+        /** Gets the transform which takes bone space to current from the binding pose. 
+        @remarks
+            Internal use only.
+        */
+        void _getOffsetTransform(Matrix4& m) const;
+
+		/** Gets the inverted binding pose scale. */
+		const Vector3& _getBindingPoseInverseScale(void) const { return mBindDerivedInverseScale; }
+		/** Gets the inverted binding pose position. */
+		const Vector3& _getBindingPoseInversePosition(void) const { return mBindDerivedInversePosition; }
+		/** Gets the inverted binding pose orientation. */
+		const Quaternion& _getBindingPoseInverseOrientation(void) const { return mBindDerivedInverseOrientation; }
+
+		/// @see Node::needUpdate
+		void needUpdate(bool forceParentUpdate = false);
+
+
+    protected:
+        /// The numeric handle of this bone
+        unsigned short mHandle;
+
+        /** Bones set as manuallyControlled are not reseted in Skeleton::reset() */
+        bool mManuallyControlled;
+
+        /** See Node. */
+        Node* createChildImpl(void);
+        /** See Node. */
+        Node* createChildImpl(const String& name);
+
+        /// Pointer back to creator, for child creation (not smart ptr so child does not preserve parent)
+        Skeleton* mCreator;
+
+        /// The inversed derived scale of the bone in the binding pose
+        Vector3 mBindDerivedInverseScale;
+        /// The inversed derived orientation of the bone in the binding pose
+        Quaternion mBindDerivedInverseOrientation;
+        /// The inversed derived position of the bone in the binding pose
+        Vector3 mBindDerivedInversePosition;
+    };
+
+	/** @} */
+	/** @} */
+
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreBuildSettings.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreBuildSettings.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreBuildSettings.h	(revision 148)
@@ -0,0 +1,81 @@
+#ifndef __Custom_Config_H_
+#define __Custom_Config_H_
+
+// CMake auto-generated configuration options
+
+/* #undef OGRE_STATIC_LIB */
+
+/* #undef OGRE_BUILD_RENDERSYSTEM_D3D9 */
+/* #undef OGRE_BUILD_RENDERSYSTEM_D3D11 */
+#define OGRE_BUILD_RENDERSYSTEM_GL
+/* #undef OGRE_BUILD_RENDERSYSTEM_GL3PLUS */
+/* #undef OGRE_BUILD_RENDERSYSTEM_GLES */
+/* #undef OGRE_BUILD_RENDERSYSTEM_GLES2 */
+#define OGRE_BUILD_PLUGIN_BSP
+#define OGRE_BUILD_PLUGIN_OCTREE
+#define OGRE_BUILD_PLUGIN_PCZ
+#define OGRE_BUILD_PLUGIN_PFX
+/* #undef OGRE_BUILD_PLUGIN_CG */
+#define OGRE_BUILD_COMPONENT_PAGING
+#define OGRE_BUILD_COMPONENT_TERRAIN
+#define OGRE_BUILD_COMPONENT_VOLUME
+#define OGRE_BUILD_COMPONENT_PROPERTY
+#define OGRE_BUILD_COMPONENT_OVERLAY
+#define OGRE_BUILD_COMPONENT_RTSHADERSYSTEM
+
+#define OGRE_CONFIG_LITTLE_ENDIAN
+/* #undef OGRE_CONFIG_BIG_ENDIAN */
+
+#define OGRE_DOUBLE_PRECISION 0
+
+#define OGRE_MEMORY_ALLOCATOR 4
+
+#define OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR 1
+
+#define OGRE_STRING_USE_CUSTOM_MEMORY_ALLOCATOR 0
+
+#define OGRE_MEMORY_TRACKER_DEBUG_MODE 0
+
+#define OGRE_MEMORY_TRACKER_RELEASE_MODE 0
+
+#define OGRE_ASSERT_MODE 0
+
+#define OGRE_THREAD_SUPPORT 2
+
+#define OGRE_THREAD_PROVIDER 1
+
+#define OGRE_NO_FREEIMAGE 0
+
+#define OGRE_NO_DDS_CODEC 0
+
+#define OGRE_NO_PVRTC_CODEC 1
+
+#define OGRE_NO_ETC_CODEC 1
+
+#define OGRE_NO_ZIP_ARCHIVE 0
+
+#define OGRE_NO_VIEWPORT_ORIENTATIONMODE 1
+
+#define OGRE_NO_GLES2_CG_SUPPORT 1
+
+#define OGRE_NO_GLES2_GLSL_OPTIMISER 1
+
+#define OGRE_NO_GLES2_VAO_SUPPORT 1
+
+#define OGRE_NO_GL_STATE_CACHE_SUPPORT 1
+
+#define OGRE_NO_GLES3_SUPPORT 1
+
+#define OGRE_NO_LIBCPP_SUPPORT 1
+
+#define OGRE_USE_BOOST 1
+
+#define OGRE_PROFILING 0
+
+#define RTSHADER_SYSTEM_BUILD_CORE_SHADERS
+
+#define RTSHADER_SYSTEM_BUILD_EXT_SHADERS
+
+/* #undef __FLASHCC__ */
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreCamera.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreCamera.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreCamera.h	(revision 148)
@@ -0,0 +1,683 @@
+/*
+-----------------------------------------------------------------------------
+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 __Camera_H__
+#define __Camera_H__
+
+// Default options
+#include "OgrePrerequisites.h"
+
+#include "OgreString.h"
+#include "OgreMovableObject.h"
+
+// Matrices & Vectors
+#include "OgreMatrix4.h"
+#include "OgreVector3.h"
+#include "OgrePlane.h"
+#include "OgreQuaternion.h"
+#include "OgreCommon.h"
+#include "OgreFrustum.h"
+#include "OgreRay.h"
+#include "OgrePlaneBoundedVolume.h"
+#include "OgreHeaderPrefix.h"
+
+
+namespace Ogre {
+
+    /** \addtogroup Core
+    *  @{
+    */
+    /** \addtogroup Scene
+    *  @{
+    */
+
+    /** A viewpoint from which the scene will be rendered.
+    @remarks
+        OGRE renders scenes from a camera viewpoint into a buffer of
+        some sort, normally a window or a texture (a subclass of
+        RenderTarget). OGRE cameras support both perspective projection (the default,
+        meaning objects get smaller the further away they are) and
+        orthographic projection (blueprint-style, no decrease in size
+        with distance). Each camera carries with it a style of rendering,
+        e.g. full textured, flat shaded, wireframe), field of view,
+        rendering distances etc, allowing you to use OGRE to create
+        complex multi-window views if required. In addition, more than
+        one camera can point at a single render target if required,
+        each rendering to a subset of the target, allowing split screen
+        and picture-in-picture views.
+    @par
+        Cameras maintain their own aspect ratios, field of view, and frustum,
+        and project co-ordinates into a space measured from -1 to 1 in x and y,
+        and 0 to 1 in z. At render time, the camera will be rendering to a
+        Viewport which will translate these parametric co-ordinates into real screen
+        co-ordinates. Obviously it is advisable that the viewport has the same
+        aspect ratio as the camera to avoid distortion (unless you want it!).
+    @par
+        Note that a Camera can be attached to a SceneNode, using the method
+        SceneNode::attachObject. If this is done the Camera will combine it's own
+        position/orientation settings with it's parent SceneNode. 
+        This is useful for implementing more complex Camera / object
+        relationships i.e. having a camera attached to a world object.
+    */
+    class _OgreExport Camera : public Frustum
+    {
+    public:
+        /** Listener interface so you can be notified of Camera events. 
+        */
+        class _OgreExport Listener 
+        {
+        public:
+            Listener() {}
+            virtual ~Listener() {}
+
+            /// Called prior to the scene being rendered with this camera
+            virtual void cameraPreRenderScene(Camera* cam)
+                        { (void)cam; }
+
+            /// Called after the scene has been rendered with this camera
+            virtual void cameraPostRenderScene(Camera* cam)
+                        { (void)cam; }
+
+            /// Called when the camera is being destroyed
+            virtual void cameraDestroyed(Camera* cam)
+                        { (void)cam; }
+
+        };
+    protected:
+        /// Scene manager responsible for the scene
+        SceneManager *mSceneMgr;
+
+        /// Camera orientation, quaternion style
+        Quaternion mOrientation;
+
+        /// Camera position - default (0,0,0)
+        Vector3 mPosition;
+
+        /// Derived orientation/position of the camera, including reflection
+        mutable Quaternion mDerivedOrientation;
+        mutable Vector3 mDerivedPosition;
+
+        /// Real world orientation/position of the camera
+        mutable Quaternion mRealOrientation;
+        mutable Vector3 mRealPosition;
+
+        /// Whether to yaw around a fixed axis.
+        bool mYawFixed;
+        /// Fixed axis to yaw around
+        Vector3 mYawFixedAxis;
+
+        /// Rendering type
+        PolygonMode mSceneDetail;
+
+        /// Stored number of visible faces in the last render
+        unsigned int mVisFacesLastRender;
+
+        /// Stored number of visible batches in the last render
+        unsigned int mVisBatchesLastRender;
+
+        /// Shared class-level name for Movable type
+        static String msMovableType;
+
+        /// SceneNode which this Camera will automatically track
+        SceneNode* mAutoTrackTarget;
+        /// Tracking offset for fine tuning
+        Vector3 mAutoTrackOffset;
+
+        /// Scene LOD factor used to adjust overall LOD
+        Real mSceneLodFactor;
+        /// Inverted scene LOD factor, can be used by Renderables to adjust their LOD
+        Real mSceneLodFactorInv;
+
+
+        /** Viewing window. 
+        @remarks
+        Generalize camera class for the case, when viewing frustum doesn't cover all viewport.
+        */
+        Real mWLeft, mWTop, mWRight, mWBottom;
+        /// Is viewing window used.
+        bool mWindowSet;
+        /// Windowed viewport clip planes 
+        mutable vector<Plane>::type mWindowClipPlanes;
+        /// Was viewing window changed.
+        mutable bool mRecalcWindow;
+        /// The last viewport to be added using this camera
+        Viewport* mLastViewport;
+        /** Whether aspect ratio will automatically be recalculated 
+            when a viewport changes its size
+        */
+        bool mAutoAspectRatio;
+        /// Custom culling frustum
+        Frustum *mCullFrustum;
+        /// Whether or not the rendering distance of objects should take effect for this camera
+        bool mUseRenderingDistance;
+        /// Camera to use for LOD calculation
+        const Camera* mLodCamera;
+        
+        /// Whether or not the minimum display size of objects should take effect for this camera
+        bool mUseMinPixelSize;
+        /// @see Camera::getPixelDisplayRatio
+        Real mPixelDisplayRatio;
+
+        typedef vector<Listener*>::type ListenerList;
+        ListenerList mListeners;
+
+
+        // Internal functions for calcs
+        bool isViewOutOfDate(void) const;
+        /// Signal to update frustum information.
+        void invalidateFrustum(void) const;
+        /// Signal to update view information.
+        void invalidateView(void) const;
+
+
+        /** Do actual window setting, using parameters set in SetWindow call
+        @remarks
+            The method will called on demand.
+        */
+        virtual void setWindowImpl(void) const;
+
+        /** Helper function for forwardIntersect that intersects rays with canonical plane */
+        virtual vector<Vector4>::type getRayForwardIntersect(const Vector3& anchor, const Vector3 *dir, Real planeOffset) const;
+
+    public:
+        /** Standard constructor.
+        */
+        Camera( const String& name, SceneManager* sm);
+
+        /** Standard destructor.
+        */
+        virtual ~Camera();
+
+        /// Add a listener to this camera
+        virtual void addListener(Listener* l);
+        /// Remove a listener to this camera
+        virtual void removeListener(Listener* l);
+
+        /** Returns a pointer to the SceneManager this camera is rendering through.
+        */
+        SceneManager* getSceneManager(void) const;
+
+        /** Sets the level of rendering detail required from this camera.
+        @remarks
+            Each camera is set to render at full detail by default, that is
+            with full texturing, lighting etc. This method lets you change
+            that behaviour, allowing you to make the camera just render a
+            wireframe view, for example.
+        */
+        void setPolygonMode(PolygonMode sd);
+
+        /** Retrieves the level of detail that the camera will render.
+        */
+        PolygonMode getPolygonMode(void) const;
+
+        /** Sets the camera's position.
+        */
+        void setPosition(Real x, Real y, Real z);
+
+        /** Sets the camera's position.
+        */
+        void setPosition(const Vector3& vec);
+
+        /** Retrieves the camera's position.
+        */
+        const Vector3& getPosition(void) const;
+
+        /** Moves the camera's position by the vector offset provided along world axes.
+        */
+        void move(const Vector3& vec);
+
+        /** Moves the camera's position by the vector offset provided along it's own axes (relative to orientation).
+        */
+        void moveRelative(const Vector3& vec);
+
+        /** Sets the camera's direction vector.
+        @remarks
+            Note that the 'up' vector for the camera will automatically be recalculated based on the
+            current 'up' vector (i.e. the roll will remain the same).
+        */
+        void setDirection(Real x, Real y, Real z);
+
+        /** Sets the camera's direction vector.
+        */
+        void setDirection(const Vector3& vec);
+
+        /** Gets the camera's direction.
+        */
+        Vector3 getDirection(void) const;
+
+        /** Gets the camera's up vector.
+        */
+        Vector3 getUp(void) const;
+
+        /** Gets the camera's right vector.
+        */
+        Vector3 getRight(void) const;
+
+        /** Points the camera at a location in worldspace.
+        @remarks
+            This is a helper method to automatically generate the
+            direction vector for the camera, based on it's current position
+            and the supplied look-at point.
+        @param
+            targetPoint A vector specifying the look at point.
+        */
+        void lookAt( const Vector3& targetPoint );
+        /** Points the camera at a location in worldspace.
+        @remarks
+            This is a helper method to automatically generate the
+            direction vector for the camera, based on it's current position
+            and the supplied look-at point.
+        @param x
+            The @c x co-ordinates of the point to look at.
+        @param y
+            The @c y co-ordinates of the point to look at.
+        @param z
+            The @c z co-ordinates of the point to look at.
+        */
+        void lookAt(Real x, Real y, Real z);
+
+        /** Rolls the camera anticlockwise, around its local z axis.
+        */
+        void roll(const Radian& angle);
+
+        /** Rotates the camera anticlockwise around it's local y axis.
+        */
+        void yaw(const Radian& angle);
+
+        /** Pitches the camera up/down anticlockwise around it's local z axis.
+        */
+        void pitch(const Radian& angle);
+
+        /** Rotate the camera around an arbitrary axis.
+        */
+        void rotate(const Vector3& axis, const Radian& angle);
+
+        /** Rotate the camera around an arbitrary axis using a Quaternion.
+        */
+        void rotate(const Quaternion& q);
+
+        /** Tells the camera whether to yaw around it's own local Y axis or a 
+            fixed axis of choice.
+        @remarks
+            This method allows you to change the yaw behaviour of the camera
+            - by default, the camera yaws around a fixed Y axis. This is 
+            often what you want - for example if you're making a first-person 
+            shooter, you really don't want the yaw axis to reflect the local 
+            camera Y, because this would mean a different yaw axis if the 
+            player is looking upwards rather than when they are looking
+            straight ahead. You can change this behaviour by calling this 
+            method, which you will want to do if you are making a completely
+            free camera like the kind used in a flight simulator. 
+        @param useFixed
+            If @c true, the axis passed in the second parameter will 
+            always be the yaw axis no matter what the camera orientation. 
+            If false, the camera yaws around the local Y.
+        @param fixedAxis
+            The axis to use if the first parameter is true.
+        */
+        void setFixedYawAxis( bool useFixed, const Vector3& fixedAxis = Vector3::UNIT_Y );
+
+
+        /** Returns the camera's current orientation.
+        */
+        const Quaternion& getOrientation(void) const;
+
+        /** Sets the camera's orientation.
+        */
+        void setOrientation(const Quaternion& q);
+
+        /** Tells the Camera to contact the SceneManager to render from it's viewpoint.
+        @param vp The viewport to render to
+        @param includeOverlays Whether or not any overlay objects should be included
+        */
+        void _renderScene(Viewport *vp, bool includeOverlays);
+
+        /** Function for outputting to a stream.
+        */
+        _OgreExport friend std::ostream& operator<<(std::ostream& o, const Camera& c);
+
+        /** Internal method to notify camera of the visible faces in the last render.
+        */
+        void _notifyRenderedFaces(unsigned int numfaces);
+
+        /** Internal method to notify camera of the visible batches in the last render.
+        */
+        void _notifyRenderedBatches(unsigned int numbatches);
+
+        /** Internal method to retrieve the number of visible faces in the last render.
+        */
+        unsigned int _getNumRenderedFaces(void) const;
+
+        /** Internal method to retrieve the number of visible batches in the last render.
+        */
+        unsigned int _getNumRenderedBatches(void) const;
+
+        /** Gets the derived orientation of the camera, including any
+            rotation inherited from a node attachment and reflection matrix. */
+        const Quaternion& getDerivedOrientation(void) const;
+        /** Gets the derived position of the camera, including any
+            translation inherited from a node attachment and reflection matrix. */
+        const Vector3& getDerivedPosition(void) const;
+        /** Gets the derived direction vector of the camera, including any
+            rotation inherited from a node attachment and reflection matrix. */
+        Vector3 getDerivedDirection(void) const;
+        /** Gets the derived up vector of the camera, including any
+            rotation inherited from a node attachment and reflection matrix. */
+        Vector3 getDerivedUp(void) const;
+        /** Gets the derived right vector of the camera, including any
+            rotation inherited from a node attachment and reflection matrix. */
+        Vector3 getDerivedRight(void) const;
+
+        /** Gets the real world orientation of the camera, including any
+            rotation inherited from a node attachment */
+        const Quaternion& getRealOrientation(void) const;
+        /** Gets the real world position of the camera, including any
+            translation inherited from a node attachment. */
+        const Vector3& getRealPosition(void) const;
+        /** Gets the real world direction vector of the camera, including any
+            rotation inherited from a node attachment. */
+        Vector3 getRealDirection(void) const;
+        /** Gets the real world up vector of the camera, including any
+            rotation inherited from a node attachment. */
+        Vector3 getRealUp(void) const;
+        /** Gets the real world right vector of the camera, including any
+            rotation inherited from a node attachment. */
+        Vector3 getRealRight(void) const;
+
+        /** Overridden from Frustum/Renderable */
+        void getWorldTransforms(Matrix4* mat) const;
+
+        /** Overridden from MovableObject */
+        const String& getMovableType(void) const;
+
+        /** Enables / disables automatic tracking of a SceneNode.
+        @remarks
+            If you enable auto-tracking, this Camera will automatically rotate to
+            look at the target SceneNode every frame, no matter how 
+            it or SceneNode move. This is handy if you want a Camera to be focused on a
+            single object or group of objects. Note that by default the Camera looks at the 
+            origin of the SceneNode, if you want to tweak this, e.g. if the object which is
+            attached to this target node is quite big and you want to point the camera at
+            a specific point on it, provide a vector in the 'offset' parameter and the 
+            camera's target point will be adjusted.
+        @param enabled If true, the Camera will track the SceneNode supplied as the next 
+            parameter (cannot be null). If false the camera will cease tracking and will
+            remain in it's current orientation.
+        @param target Pointer to the SceneNode which this Camera will track. Make sure you don't
+            delete this SceneNode before turning off tracking (e.g. SceneManager::clearScene will
+            delete it so be careful of this). Can be null if and only if the enabled param is false.
+        @param offset If supplied, the camera targets this point in local space of the target node
+            instead of the origin of the target node. Good for fine tuning the look at point.
+        */
+        void setAutoTracking(bool enabled, SceneNode* const target = 0, 
+            const Vector3& offset = Vector3::ZERO);
+
+
+        /** Sets the level-of-detail factor for this Camera.
+        @remarks
+            This method can be used to influence the overall level of detail of the scenes 
+            rendered using this camera. Various elements of the scene have level-of-detail
+            reductions to improve rendering speed at distance; this method allows you 
+            to hint to those elements that you would like to adjust the level of detail that
+            they would normally use (up or down). 
+        @par
+            The most common use for this method is to reduce the overall level of detail used
+            for a secondary camera used for sub viewports like rear-view mirrors etc.
+            Note that scene elements are at liberty to ignore this setting if they choose,
+            this is merely a hint.
+        @param factor The factor to apply to the usual level of detail calculation. Higher
+            values increase the detail, so 2.0 doubles the normal detail and 0.5 halves it.
+        */
+        void setLodBias(Real factor = 1.0);
+
+        /** Returns the level-of-detail bias factor currently applied to this camera. 
+        @remarks
+            See Camera::setLodBias for more details.
+        */
+        Real getLodBias(void) const;
+
+        /** Set a pointer to the camera which should be used to determine
+            LOD settings. 
+        @remarks
+            Sometimes you don't want the LOD of a render to be based on the camera
+            that's doing the rendering, you want it to be based on a different
+            camera. A good example is when rendering shadow maps, since they will 
+            be viewed from the perspective of another camera. Therefore this method
+            lets you associate a different camera instance to use to determine the LOD.
+        @par
+            To revert the camera to determining LOD based on itself, call this method with 
+            a pointer to itself. 
+        */
+        virtual void setLodCamera(const Camera* lodCam);
+
+        /** Get a pointer to the camera which should be used to determine 
+            LOD settings. 
+        @remarks
+            If setLodCamera hasn't been called with a different camera, this
+            method will return 'this'. 
+        */
+        virtual const Camera* getLodCamera() const;
+
+
+        /** Gets a world space ray as cast from the camera through a viewport position.
+        @param screenx, screeny The x and y position at which the ray should intersect the viewport,
+            in normalised screen coordinates [0,1]
+        */
+        Ray getCameraToViewportRay(Real screenx, Real screeny) const;
+        /** Gets a world space ray as cast from the camera through a viewport position.
+        @param screenx, screeny The x and y position at which the ray should intersect the viewport, 
+            in normalised screen coordinates [0,1]
+        @param outRay Ray instance to populate with result
+        */
+        void getCameraToViewportRay(Real screenx, Real screeny, Ray* outRay) const;
+
+        /** Gets a world-space list of planes enclosing a volume based on a viewport
+            rectangle. 
+        @remarks
+            Can be useful for populating a PlaneBoundedVolumeListSceneQuery, e.g. 
+            for a rubber-band selection. 
+        @param screenLeft, screenTop, screenRight, screenBottom The bounds of the
+            on-screen rectangle, expressed in normalised screen coordinates [0,1]
+        @param includeFarPlane If true, the volume is truncated by the camera far plane, 
+            by default it is left open-ended
+        */
+        PlaneBoundedVolume getCameraToViewportBoxVolume(Real screenLeft, 
+            Real screenTop, Real screenRight, Real screenBottom, bool includeFarPlane = false);
+
+        /** Gets a world-space list of planes enclosing a volume based on a viewport
+            rectangle. 
+        @remarks
+            Can be useful for populating a PlaneBoundedVolumeListSceneQuery, e.g. 
+            for a rubber-band selection. 
+        @param screenLeft, screenTop, screenRight, screenBottom The bounds of the
+            on-screen rectangle, expressed in normalised screen coordinates [0,1]
+        @param outVolume The plane list to populate with the result
+        @param includeFarPlane If true, the volume is truncated by the camera far plane, 
+            by default it is left open-ended
+        */
+        void getCameraToViewportBoxVolume(Real screenLeft, 
+            Real screenTop, Real screenRight, Real screenBottom, 
+            PlaneBoundedVolume* outVolume, bool includeFarPlane = false);
+
+        /** Internal method for OGRE to use for LOD calculations. */
+        Real _getLodBiasInverse(void) const;
+
+
+        /** Internal method used by OGRE to update auto-tracking cameras. */
+        void _autoTrack(void);
+
+
+        /** Sets the viewing window inside of viewport.
+        @remarks
+            This method can be used to set a subset of the viewport as the rendering
+            target. 
+        @param left Relative to Viewport - 0 corresponds to left edge, 1 - to right edge (default - 0).
+        @param top Relative to Viewport - 0 corresponds to top edge, 1 - to bottom edge (default - 0).
+        @param right Relative to Viewport - 0 corresponds to left edge, 1 - to right edge (default - 1).
+        @param bottom Relative to Viewport - 0 corresponds to top edge, 1 - to bottom edge (default - 1).
+        */
+        virtual void setWindow (Real left, Real top, Real right, Real bottom);
+        /// Cancel view window.
+        virtual void resetWindow (void);
+        /// Returns if a viewport window is being used
+        virtual bool isWindowSet(void) const { return mWindowSet; }
+        /// Gets the window clip planes, only applicable if isWindowSet == true
+        const vector<Plane>::type& getWindowPlanes(void) const;
+
+        /** Overridden from MovableObject */
+        Real getBoundingRadius(void) const;
+        /** Get the auto tracking target for this camera, if any. */
+        SceneNode* getAutoTrackTarget(void) const { return mAutoTrackTarget; }
+        /** Get the auto tracking offset for this camera, if it is auto tracking. */
+        const Vector3& getAutoTrackOffset(void) const { return mAutoTrackOffset; }
+        
+        /** Get the last viewport which was attached to this camera. 
+        @note This is not guaranteed to be the only viewport which is
+            using this camera, just the last once which was created referring
+            to it.
+        */
+        Viewport* getViewport(void) const {return mLastViewport;}
+        /** Notifies this camera that a viewport is using it.*/
+        void _notifyViewport(Viewport* viewport) {mLastViewport = viewport;}
+
+        /** If set to true a viewport that owns this frustum will be able to 
+            recalculate the aspect ratio whenever the frustum is resized.
+        @remarks
+            You should set this to true only if the frustum / camera is used by 
+            one viewport at the same time. Otherwise the aspect ratio for other 
+            viewports may be wrong.
+        */    
+        void setAutoAspectRatio(bool autoratio);
+
+        /** Retrieves if AutoAspectRatio is currently set or not
+        */
+        bool getAutoAspectRatio(void) const;
+
+        /** Tells the camera to use a separate Frustum instance to perform culling.
+        @remarks
+            By calling this method, you can tell the camera to perform culling
+            against a different frustum to it's own. This is mostly useful for
+            debug cameras that allow you to show the culling behaviour of another
+            camera, or a manual frustum instance. 
+        @param frustum Pointer to a frustum to use; this can either be a manual
+            Frustum instance (which you can attach to scene nodes like any other
+            MovableObject), or another camera. If you pass 0 to this method it
+            reverts the camera to normal behaviour.
+        */
+        void setCullingFrustum(Frustum* frustum) { mCullFrustum = frustum; }
+        /** Returns the custom culling frustum in use. */
+        Frustum* getCullingFrustum(void) const { return mCullFrustum; }
+
+        /** Forward projects frustum rays to find forward intersection with plane.
+        @remarks
+            Forward projection may lead to intersections at infinity.
+        */
+        virtual void forwardIntersect(const Plane& worldPlane, vector<Vector4>::type* intersect3d) const;
+
+        /// @copydoc Frustum::isVisible(const AxisAlignedBox&, FrustumPlane*) const
+        bool isVisible(const AxisAlignedBox& bound, FrustumPlane* culledBy = 0) const;
+        /// @copydoc Frustum::isVisible(const Sphere&, FrustumPlane*) const
+        bool isVisible(const Sphere& bound, FrustumPlane* culledBy = 0) const;
+        /// @copydoc Frustum::isVisible(const Vector3&, FrustumPlane*) const
+        bool isVisible(const Vector3& vert, FrustumPlane* culledBy = 0) const;
+        /// @copydoc Frustum::getWorldSpaceCorners
+        const Vector3* getWorldSpaceCorners(void) const;
+        /// @copydoc Frustum::getFrustumPlane
+        const Plane& getFrustumPlane( unsigned short plane ) const;
+        /// @copydoc Frustum::projectSphere
+        bool projectSphere(const Sphere& sphere, 
+            Real* left, Real* top, Real* right, Real* bottom) const;
+        /// @copydoc Frustum::getNearClipDistance
+        Real getNearClipDistance(void) const;
+        /// @copydoc Frustum::getFarClipDistance
+        Real getFarClipDistance(void) const;
+        /// @copydoc Frustum::getViewMatrix
+        const Matrix4& getViewMatrix(void) const;
+        /** Specialised version of getViewMatrix allowing caller to differentiate
+            whether the custom culling frustum should be allowed or not. 
+        @remarks
+            The default behaviour of the standard getViewMatrix is to delegate to 
+            the alternate culling frustum, if it is set. This is expected when 
+            performing CPU calculations, but the final rendering must be performed
+            using the real view matrix in order to display the correct debug view.
+        */
+        const Matrix4& getViewMatrix(bool ownFrustumOnly) const;
+        /** Set whether this camera should use the 'rendering distance' on
+            objects to exclude distant objects from the final image. The
+            default behaviour is to use it.
+        @param use True to use the rendering distance, false not to.
+        */
+        virtual void setUseRenderingDistance(bool use) { mUseRenderingDistance = use; }
+        /** Get whether this camera should use the 'rendering distance' on
+            objects to exclude distant objects from the final image.
+        */
+        virtual bool getUseRenderingDistance(void) const { return mUseRenderingDistance; }
+
+        /** Synchronise core camera settings with another. 
+        @remarks
+            Copies the position, orientation, clip distances, projection type, 
+            FOV, focal length and aspect ratio from another camera. Other settings like query flags, 
+            reflection etc are preserved.
+        */
+        virtual void synchroniseBaseSettingsWith(const Camera* cam);
+
+        /** Get the derived position of this frustum. */
+        const Vector3& getPositionForViewUpdate(void) const;
+        /** Get the derived orientation of this frustum. */
+        const Quaternion& getOrientationForViewUpdate(void) const;
+
+        /** @brief Sets whether to use min display size calculations.
+            When active, objects that derive from MovableObject whose size on the screen is less then a MovableObject::mMinPixelSize will not
+            be rendered.
+        */
+        void setUseMinPixelSize(bool enable) { mUseMinPixelSize = enable; }
+        /** Returns whether to use min display size calculations 
+        @see Camera::setUseMinDisplaySize
+        */
+        bool getUseMinPixelSize() const { return mUseMinPixelSize; }
+
+        /** Returns an estimated ratio between a pixel and the display area it represents.
+            For orthographic cameras this function returns the amount of meters covered by
+            a single pixel along the vertical axis. For perspective cameras the value
+            returned is the amount of meters covered by a single pixel per meter distance 
+            from the camera.
+        @note
+            This parameter is calculated just before the camera is rendered
+        @note
+            This parameter is used in min display size calculations.
+        */
+        Real getPixelDisplayRatio() const { return mPixelDisplayRatio; }
+        
+    };
+    /** @} */
+    /** @} */
+
+} // namespace Ogre
+
+#include "OgreHeaderSuffix.h"
+
+#endif // __Camera_H__
Index: /ogre_src_v1-9-0/OgreMain/include/OgreCodec.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreCodec.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreCodec.h	(revision 148)
@@ -0,0 +1,179 @@
+/*
+-----------------------------------------------------------------------------
+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 _Codec_H__
+#define _Codec_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreSharedPtr.h"
+#include "OgreDataStream.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreStringVector.h"
+#include "OgreException.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+
+    /** Abstract class that defines a 'codec'.
+        @remarks
+            A codec class works like a two-way filter for data - data entered on
+            one end (the decode end) gets processed and transformed into easily
+            usable data while data passed the other way around codes it back.
+        @par
+            The codec concept is a pretty generic one - you can easily understand
+            how it can be used for images, sounds, archives, even compressed data.
+    */
+	class _OgreExport Codec : public CodecAlloc
+    {
+    protected:
+        typedef map< String, Codec* >::type CodecList; 
+        /** A map that contains all the registered codecs.
+        */
+        static CodecList msMapCodecs;
+
+    public:
+        class _OgrePrivate CodecData : public CodecAlloc
+        {
+        public:
+            virtual ~CodecData() {}
+
+            /** Returns the type of the data.
+            */
+            virtual String dataType() const { return "CodecData"; }
+        };
+        typedef SharedPtr<CodecData> CodecDataPtr;
+
+        typedef ConstMapIterator<CodecList> CodecIterator;
+
+    public:
+    	virtual ~Codec();
+    	
+        /** Registers a new codec in the database.
+        */
+        static void registerCodec( Codec *pCodec )
+        {
+			CodecList::iterator i = msMapCodecs.find(pCodec->getType());
+			if (i != msMapCodecs.end())
+				OGRE_EXCEPT(Exception::ERR_DUPLICATE_ITEM, 
+					pCodec->getType() + " already has a registered codec. ", __FUNCTION__);
+
+            msMapCodecs[pCodec->getType()] = pCodec;
+        }
+
+		/** Return whether a codec is registered already. 
+		*/
+		static bool isCodecRegistered( const String& codecType )
+		{
+			return msMapCodecs.find(codecType) != msMapCodecs.end();
+		}
+
+		/** Unregisters a codec from the database.
+        */
+        static void unregisterCodec( Codec *pCodec )
+        {
+            msMapCodecs.erase(pCodec->getType());
+        }
+
+        /** Gets the iterator for the registered codecs. */
+        static CodecIterator getCodecIterator(void)
+        {
+            return CodecIterator(msMapCodecs.begin(), msMapCodecs.end());
+        }
+
+        /** Gets the file extension list for the registered codecs. */
+        static StringVector getExtensions(void);
+
+        /** Gets the codec registered for the passed in file extension. */
+        static Codec* getCodec(const String& extension);
+
+		/** Gets the codec that can handle the given 'magic' identifier. 
+		@param magicNumberPtr Pointer to a stream of bytes which should identify the file.
+			Note that this may be more than needed - each codec may be looking for 
+			a different size magic number.
+		@param maxbytes The number of bytes passed
+		*/
+		static Codec* getCodec(char *magicNumberPtr, size_t maxbytes);
+
+        /** Codes the data in the input stream and saves the result in the output
+            stream.
+        */
+        virtual DataStreamPtr encode(MemoryDataStreamPtr& input, CodecDataPtr& pData) const = 0;
+        /** Codes the data in the input chunk and saves the result in the output
+            filename provided. Provided for efficiency since coding to memory is
+            progressive therefore memory required is unknown leading to reallocations.
+        @param input The input data
+        @param outFileName The filename to write to
+        @param pData Extra information to be passed to the codec (codec type specific)
+        */
+        virtual void encodeToFile(MemoryDataStreamPtr& input, const String& outFileName, CodecDataPtr& pData) const = 0;
+
+        /// Result of a decoding; both a decoded data stream and CodecData metadata
+        typedef std::pair<MemoryDataStreamPtr, CodecDataPtr> DecodeResult;
+        /** Codes the data from the input chunk into the output chunk.
+            @param input Stream containing the encoded data
+        */
+        virtual DecodeResult decode(DataStreamPtr& input) const = 0;
+
+        /** Returns the type of the codec as a String
+        */
+        virtual String getType() const = 0;
+
+        /** Returns the type of the data that supported by this codec as a String
+        */
+        virtual String getDataType() const = 0;
+
+		/** Returns whether a magic number header matches this codec.
+		@param magicNumberPtr Pointer to a stream of bytes which should identify the file.
+			Note that this may be more than needed - each codec may be looking for 
+			a different size magic number.
+		@param maxbytes The number of bytes passed
+		*/
+		virtual bool magicNumberMatch(const char *magicNumberPtr, size_t maxbytes) const 
+		{ return !magicNumberToFileExt(magicNumberPtr, maxbytes).empty(); }
+		/** Maps a magic number header to a file extension, if this codec recognises it.
+		@param magicNumberPtr Pointer to a stream of bytes which should identify the file.
+			Note that this may be more than needed - each codec may be looking for 
+			a different size magic number.
+		@param maxbytes The number of bytes passed
+		@return A blank string if the magic number was unknown, or a file extension.
+		*/
+		virtual String magicNumberToFileExt(const char *magicNumberPtr, size_t maxbytes) const = 0;
+    };
+	/** @} */
+	/** @} */
+
+} // namespace
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreColourValue.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreColourValue.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreColourValue.h	(revision 148)
@@ -0,0 +1,334 @@
+/*
+-----------------------------------------------------------------------------
+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 _COLOURVALUE_H__
+#define _COLOURVALUE_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+
+    typedef uint32 RGBA;
+    typedef uint32 ARGB;
+    typedef uint32 ABGR;
+	typedef uint32 BGRA;
+
+    /** Class representing colour.
+	    @remarks
+		    Colour is represented as 4 components, each of which is a
+		    floating-point value from 0.0 to 1.0.
+	    @par
+		    The 3 'normal' colour components are red, green and blue, a higher
+		    number indicating greater amounts of that component in the colour.
+		    The forth component is the 'alpha' value, which represents
+		    transparency. In this case, 0.0 is completely transparent and 1.0 is
+		    fully opaque.
+    */
+    class _OgreExport ColourValue
+    {
+    public:
+        static const ColourValue ZERO;
+        static const ColourValue Black;
+        static const ColourValue White;
+        static const ColourValue Red;
+        static const ColourValue Green;
+        static const ColourValue Blue;
+
+	    explicit ColourValue( float red = 1.0f,
+				    float green = 1.0f,
+				    float blue = 1.0f,
+				    float alpha = 1.0f ) : r(red), g(green), b(blue), a(alpha)
+        { }
+
+	    bool operator==(const ColourValue& rhs) const;
+	    bool operator!=(const ColourValue& rhs) const;
+
+        float r,g,b,a;
+
+	    /** Retrieves colour as RGBA.
+	    */
+	    RGBA getAsRGBA(void) const;
+
+	    /** Retrieves colour as ARGB.
+	    */
+	    ARGB getAsARGB(void) const;
+
+		/** Retrieves colour as BGRA.
+		*/
+		BGRA getAsBGRA(void) const;
+
+		/** Retrieves colours as ABGR */
+	    ABGR getAsABGR(void) const;
+
+	    /** Sets colour as RGBA.
+	    */
+        void setAsRGBA(const RGBA val);
+
+	    /** Sets colour as ARGB.
+	    */
+        void setAsARGB(const ARGB val);
+
+		/** Sets colour as BGRA.
+		*/
+		void setAsBGRA(const BGRA val);
+
+	    /** Sets colour as ABGR.
+	    */
+        void setAsABGR(const ABGR val);
+
+        /** Clamps colour value to the range [0, 1].
+        */
+        void saturate(void)
+        {
+            if (r < 0)
+                r = 0;
+            else if (r > 1)
+                r = 1;
+
+            if (g < 0)
+                g = 0;
+            else if (g > 1)
+                g = 1;
+
+            if (b < 0)
+                b = 0;
+            else if (b > 1)
+                b = 1;
+
+            if (a < 0)
+                a = 0;
+            else if (a > 1)
+                a = 1;
+        }
+
+        /** As saturate, except that this colour value is unaffected and
+            the saturated colour value is returned as a copy. */
+        ColourValue saturateCopy(void) const
+        {
+            ColourValue ret = *this;
+            ret.saturate();
+            return ret;
+        }
+
+		/// Array accessor operator
+		inline float operator [] ( const size_t i ) const
+		{
+			assert( i < 4 );
+
+			return *(&r+i);
+		}
+
+		/// Array accessor operator
+		inline float& operator [] ( const size_t i )
+		{
+			assert( i < 4 );
+
+			return *(&r+i);
+		}
+
+		/// Pointer accessor for direct copying
+		inline float* ptr()
+		{
+			return &r;
+		}
+		/// Pointer accessor for direct copying
+		inline const float* ptr() const
+		{
+			return &r;
+		}
+
+		
+		// arithmetic operations
+        inline ColourValue operator + ( const ColourValue& rkVector ) const
+        {
+            ColourValue kSum;
+
+            kSum.r = r + rkVector.r;
+            kSum.g = g + rkVector.g;
+            kSum.b = b + rkVector.b;
+            kSum.a = a + rkVector.a;
+
+            return kSum;
+        }
+
+        inline ColourValue operator - ( const ColourValue& rkVector ) const
+        {
+            ColourValue kDiff;
+
+            kDiff.r = r - rkVector.r;
+            kDiff.g = g - rkVector.g;
+            kDiff.b = b - rkVector.b;
+            kDiff.a = a - rkVector.a;
+
+            return kDiff;
+        }
+
+        inline ColourValue operator * (const float fScalar ) const
+        {
+            ColourValue kProd;
+
+            kProd.r = fScalar*r;
+            kProd.g = fScalar*g;
+            kProd.b = fScalar*b;
+            kProd.a = fScalar*a;
+
+            return kProd;
+        }
+
+        inline ColourValue operator * ( const ColourValue& rhs) const
+        {
+            ColourValue kProd;
+
+            kProd.r = rhs.r * r;
+            kProd.g = rhs.g * g;
+            kProd.b = rhs.b * b;
+            kProd.a = rhs.a * a;
+
+            return kProd;
+        }
+
+        inline ColourValue operator / ( const ColourValue& rhs) const
+        {
+            ColourValue kProd;
+
+            kProd.r = r / rhs.r;
+            kProd.g = g / rhs.g;
+            kProd.b = b / rhs.b;
+            kProd.a = a / rhs.a;
+
+            return kProd;
+        }
+
+        inline ColourValue operator / (const float fScalar ) const
+        {
+            assert( fScalar != 0.0 );
+
+            ColourValue kDiv;
+
+            float fInv = 1.0f / fScalar;
+            kDiv.r = r * fInv;
+            kDiv.g = g * fInv;
+            kDiv.b = b * fInv;
+            kDiv.a = a * fInv;
+
+            return kDiv;
+        }
+
+        inline friend ColourValue operator * (const float fScalar, const ColourValue& rkVector )
+        {
+            ColourValue kProd;
+
+            kProd.r = fScalar * rkVector.r;
+            kProd.g = fScalar * rkVector.g;
+            kProd.b = fScalar * rkVector.b;
+            kProd.a = fScalar * rkVector.a;
+
+            return kProd;
+        }
+
+        // arithmetic updates
+        inline ColourValue& operator += ( const ColourValue& rkVector )
+        {
+            r += rkVector.r;
+            g += rkVector.g;
+            b += rkVector.b;
+            a += rkVector.a;
+
+            return *this;
+        }
+
+        inline ColourValue& operator -= ( const ColourValue& rkVector )
+        {
+            r -= rkVector.r;
+            g -= rkVector.g;
+            b -= rkVector.b;
+            a -= rkVector.a;
+
+            return *this;
+        }
+
+        inline ColourValue& operator *= (const float fScalar )
+        {
+            r *= fScalar;
+            g *= fScalar;
+            b *= fScalar;
+            a *= fScalar;
+            return *this;
+        }
+
+        inline ColourValue& operator /= (const float fScalar )
+        {
+            assert( fScalar != 0.0 );
+
+            float fInv = 1.0f / fScalar;
+
+            r *= fInv;
+            g *= fInv;
+            b *= fInv;
+            a *= fInv;
+
+            return *this;
+        }
+
+		/** Set a colour value from Hue, Saturation and Brightness.
+		@param hue Hue value, scaled to the [0,1] range as opposed to the 0-360
+		@param saturation Saturation level, [0,1]
+		@param brightness Brightness level, [0,1]
+		*/
+		void setHSB(Real hue, Real saturation, Real brightness);
+
+		/** Convert the current colour to Hue, Saturation and Brightness values. 
+		@param hue Output hue value, scaled to the [0,1] range as opposed to the 0-360
+		@param saturation Output saturation level, [0,1]
+		@param brightness Output brightness level, [0,1]
+		*/
+		void getHSB(Real* hue, Real* saturation, Real* brightness) const;
+
+
+
+		/** Function for writing to a stream.
+		*/
+		inline _OgreExport friend std::ostream& operator <<
+			( std::ostream& o, const ColourValue& c )
+		{
+			o << "ColourValue(" << c.r << ", " << c.g << ", " << c.b << ", " << c.a << ")";
+			return o;
+		}
+
+    };
+	/** @} */
+	/** @} */
+
+} // namespace
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreCommon.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreCommon.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreCommon.h	(revision 148)
@@ -0,0 +1,772 @@
+/*
+-----------------------------------------------------------------------------
+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 __Common_H__
+#define __Common_H__
+// Common stuff
+
+#include "OgreString.h"
+
+#if defined ( OGRE_GCC_VISIBILITY )
+#   pragma GCC visibility push(default)
+#endif
+
+#if defined ( OGRE_GCC_VISIBILITY )
+#   pragma GCC visibility pop
+#endif
+
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+
+	/// Fast general hashing algorithm
+	uint32 _OgreExport FastHash (const char * data, int len, uint32 hashSoFar = 0);
+	/// Combine hashes with same style as boost::hash_combine
+	template <typename T>
+	uint32 HashCombine (uint32 hashSoFar, const T& data)
+	{
+		return FastHash((const char*)&data, sizeof(T), hashSoFar);
+	}
+
+
+    /** Comparison functions used for the depth/stencil buffer operations and 
+		others. */
+    enum CompareFunction
+    {
+        CMPF_ALWAYS_FAIL,
+        CMPF_ALWAYS_PASS,
+        CMPF_LESS,
+        CMPF_LESS_EQUAL,
+        CMPF_EQUAL,
+        CMPF_NOT_EQUAL,
+        CMPF_GREATER_EQUAL,
+        CMPF_GREATER
+    };
+
+    /** High-level filtering options providing shortcuts to settings the
+        minification, magnification and mip filters. */
+    enum TextureFilterOptions
+    {
+        /// Equal to: min=FO_POINT, mag=FO_POINT, mip=FO_NONE
+        TFO_NONE,
+        /// Equal to: min=FO_LINEAR, mag=FO_LINEAR, mip=FO_POINT
+        TFO_BILINEAR,
+        /// Equal to: min=FO_LINEAR, mag=FO_LINEAR, mip=FO_LINEAR
+        TFO_TRILINEAR,
+        /// Equal to: min=FO_ANISOTROPIC, max=FO_ANISOTROPIC, mip=FO_LINEAR
+		TFO_ANISOTROPIC
+    };
+
+    enum FilterType
+    {
+        /// The filter used when shrinking a texture
+        FT_MIN,
+        /// The filter used when magnifying a texture
+        FT_MAG,
+        /// The filter used when determining the mipmap
+        FT_MIP
+    };
+    /** Filtering options for textures / mipmaps. */
+    enum FilterOptions
+    {
+        /// No filtering, used for FT_MIP to turn off mipmapping
+        FO_NONE,
+        /// Use the closest pixel
+        FO_POINT,
+        /// Average of a 2x2 pixel area, denotes bilinear for MIN and MAG, trilinear for MIP
+        FO_LINEAR,
+        /// Similar to FO_LINEAR, but compensates for the angle of the texture plane
+        FO_ANISOTROPIC
+    };
+
+    /** Light shading modes. */
+    enum ShadeOptions
+    {
+        SO_FLAT,
+        SO_GOURAUD,
+        SO_PHONG
+    };
+
+    /** Fog modes. */
+    enum FogMode
+    {
+        /// No fog. Duh.
+        FOG_NONE,
+        /// Fog density increases  exponentially from the camera (fog = 1/e^(distance * density))
+        FOG_EXP,
+        /// Fog density increases at the square of FOG_EXP, i.e. even quicker (fog = 1/e^(distance * density)^2)
+        FOG_EXP2,
+        /// Fog density increases linearly between the start and end distances
+        FOG_LINEAR
+    };
+
+    /** Hardware culling modes based on vertex winding.
+        This setting applies to how the hardware API culls triangles it is sent. */
+    enum CullingMode
+    {
+        /// Hardware never culls triangles and renders everything it receives.
+        CULL_NONE = 1,
+        /// Hardware culls triangles whose vertices are listed clockwise in the view (default).
+        CULL_CLOCKWISE = 2,
+        /// Hardware culls triangles whose vertices are listed anticlockwise in the view.
+        CULL_ANTICLOCKWISE = 3
+    };
+
+    /** Manual culling modes based on vertex normals.
+        This setting applies to how the software culls triangles before sending them to the 
+		hardware API. This culling mode is used by scene managers which choose to implement it -
+		normally those which deal with large amounts of fixed world geometry which is often 
+		planar (software culling movable variable geometry is expensive). */
+    enum ManualCullingMode
+    {
+        /// No culling so everything is sent to the hardware.
+        MANUAL_CULL_NONE = 1,
+        /// Cull triangles whose normal is pointing away from the camera (default).
+        MANUAL_CULL_BACK = 2,
+        /// Cull triangles whose normal is pointing towards the camera.
+        MANUAL_CULL_FRONT = 3
+    };
+
+    /** Enumerates the wave types usable with the Ogre engine. */
+    enum WaveformType
+    {
+        /// Standard sine wave which smoothly changes from low to high and back again.
+        WFT_SINE,
+        /// An angular wave with a constant increase / decrease speed with pointed peaks.
+        WFT_TRIANGLE,
+        /// Half of the time is spent at the min, half at the max with instant transition between.
+        WFT_SQUARE,
+        /// Gradual steady increase from min to max over the period with an instant return to min at the end.
+        WFT_SAWTOOTH,
+        /// Gradual steady decrease from max to min over the period, with an instant return to max at the end.
+        WFT_INVERSE_SAWTOOTH,
+		/// Pulse Width Modulation. Works like WFT_SQUARE, except the high to low transition is controlled by duty cycle. 
+		/// With a duty cycle of 50% (0.5) will give the same output as WFT_SQUARE.
+		WFT_PWM
+    };
+
+    /** The polygon mode to use when rasterising. */
+    enum PolygonMode
+    {
+		/// Only points are rendered.
+        PM_POINTS = 1,
+		/// Wireframe models are rendered.
+        PM_WIREFRAME = 2,
+		/// Solid polygons are rendered.
+        PM_SOLID = 3
+    };
+
+    /** An enumeration of broad shadow techniques */
+    enum ShadowTechnique
+    {
+        /** No shadows */
+        SHADOWTYPE_NONE = 0x00,
+		/** Mask for additive shadows (not for direct use, use  SHADOWTYPE_ enum instead)
+		*/
+		SHADOWDETAILTYPE_ADDITIVE = 0x01,
+		/** Mask for modulative shadows (not for direct use, use  SHADOWTYPE_ enum instead)
+		*/
+		SHADOWDETAILTYPE_MODULATIVE = 0x02,
+		/** Mask for integrated shadows (not for direct use, use SHADOWTYPE_ enum instead)
+		*/
+		SHADOWDETAILTYPE_INTEGRATED = 0x04,
+		/** Mask for stencil shadows (not for direct use, use  SHADOWTYPE_ enum instead)
+		*/
+		SHADOWDETAILTYPE_STENCIL = 0x10,
+		/** Mask for texture shadows (not for direct use, use  SHADOWTYPE_ enum instead)
+		*/
+		SHADOWDETAILTYPE_TEXTURE = 0x20,
+		
+        /** Stencil shadow technique which renders all shadow volumes as
+            a modulation after all the non-transparent areas have been 
+            rendered. This technique is considerably less fillrate intensive 
+            than the additive stencil shadow approach when there are multiple
+            lights, but is not an accurate model. 
+        */
+        SHADOWTYPE_STENCIL_MODULATIVE = 0x12,
+        /** Stencil shadow technique which renders each light as a separate
+            additive pass to the scene. This technique can be very fillrate
+            intensive because it requires at least 2 passes of the entire
+            scene, more if there are multiple lights. However, it is a more
+            accurate model than the modulative stencil approach and this is
+            especially apparent when using coloured lights or bump mapping.
+        */
+        SHADOWTYPE_STENCIL_ADDITIVE = 0x11,
+        /** Texture-based shadow technique which involves a monochrome render-to-texture
+            of the shadow caster and a projection of that texture onto the 
+            shadow receivers as a modulative pass. 
+        */
+        SHADOWTYPE_TEXTURE_MODULATIVE = 0x22,
+		
+        /** Texture-based shadow technique which involves a render-to-texture
+            of the shadow caster and a projection of that texture onto the 
+            shadow receivers, built up per light as additive passes. 
+			This technique can be very fillrate intensive because it requires numLights + 2 
+			passes of the entire scene. However, it is a more accurate model than the 
+			modulative approach and this is especially apparent when using coloured lights 
+			or bump mapping.
+        */
+        SHADOWTYPE_TEXTURE_ADDITIVE = 0x21,
+
+		/** Texture-based shadow technique which involves a render-to-texture
+		of the shadow caster and a projection of that texture on to the shadow
+		receivers, with the usage of those shadow textures completely controlled
+		by the materials of the receivers.
+		This technique is easily the most flexible of all techniques because 
+		the material author is in complete control over how the shadows are
+		combined with regular rendering. It can perform shadows as accurately
+		as SHADOWTYPE_TEXTURE_ADDITIVE but more efficiently because it requires
+		less passes. However it also requires more expertise to use, and 
+		in almost all cases, shader capable hardware to really use to the full.
+		@note The 'additive' part of this mode means that the colour of
+		the rendered shadow texture is by default plain black. It does
+		not mean it does the adding on your receivers automatically though, how you
+		use that result is up to you.
+		*/
+		SHADOWTYPE_TEXTURE_ADDITIVE_INTEGRATED = 0x25,
+		/** Texture-based shadow technique which involves a render-to-texture
+			of the shadow caster and a projection of that texture on to the shadow
+			receivers, with the usage of those shadow textures completely controlled
+			by the materials of the receivers.
+			This technique is easily the most flexible of all techniques because 
+			the material author is in complete control over how the shadows are
+			combined with regular rendering. It can perform shadows as accurately
+			as SHADOWTYPE_TEXTURE_ADDITIVE but more efficiently because it requires
+			less passes. However it also requires more expertise to use, and 
+			in almost all cases, shader capable hardware to really use to the full.
+			@note The 'modulative' part of this mode means that the colour of
+			the rendered shadow texture is by default the 'shadow colour'. It does
+			not mean it modulates on your receivers automatically though, how you
+			use that result is up to you.
+		*/
+		SHADOWTYPE_TEXTURE_MODULATIVE_INTEGRATED = 0x26
+    };
+
+    /** An enumeration describing which material properties should track the vertex colours */
+    typedef int TrackVertexColourType;
+    enum TrackVertexColourEnum {
+        TVC_NONE        = 0x0,
+        TVC_AMBIENT     = 0x1,        
+        TVC_DIFFUSE     = 0x2,
+        TVC_SPECULAR    = 0x4,
+        TVC_EMISSIVE    = 0x8
+    };
+
+    /** Sort mode for billboard-set and particle-system */
+    enum SortMode
+    {
+        /** Sort by direction of the camera */
+        SM_DIRECTION,
+        /** Sort by distance from the camera */
+        SM_DISTANCE
+    };
+
+    /** Defines the frame buffer types. */
+    enum FrameBufferType {
+        FBT_COLOUR  = 0x1,
+        FBT_DEPTH   = 0x2,
+        FBT_STENCIL = 0x4
+    };
+
+	/** Flags for the Instance Manager when calculating ideal number of instances per batch */
+	enum InstanceManagerFlags
+	{
+		/** Forces an amount of instances per batch low enough so that vertices * numInst < 65535
+			since usually improves performance. In HW instanced techniques, this flag is ignored
+		*/
+		IM_USE16BIT		= 0x0001,
+
+		/** The num. of instances is adjusted so that as few pixels as possible are wasted
+			in the vertex texture */
+		IM_VTFBESTFIT	= 0x0002,
+
+		/** Use a limited number of skeleton animations shared among all instances. 
+		Update only that limited amount of animations in the vertex texture.*/
+		IM_VTFBONEMATRIXLOOKUP = 0x0004,
+
+		IM_USEBONEDUALQUATERNIONS = 0x0008,
+
+		/** Use one weight per vertex when recommended (i.e. VTF). */
+		IM_USEONEWEIGHT = 0x0010,
+
+		/** All techniques are forced to one weight per vertex. */
+		IM_FORCEONEWEIGHT = 0x0020,
+
+		IM_USEALL		= IM_USE16BIT|IM_VTFBESTFIT|IM_USEONEWEIGHT
+	};
+    
+	
+	/** A hashed vector.
+	*/
+	template <typename T>
+	class HashedVector
+	{
+	public:
+		typedef std::vector<T, STLAllocator<T, GeneralAllocPolicy> > VectorImpl;
+	protected:
+		VectorImpl mList;
+		mutable uint32 mListHash;
+		mutable bool mListHashDirty;
+
+		void addToHash(const T& newPtr) const
+		{
+			mListHash = FastHash((const char*)&newPtr, sizeof(T), mListHash);
+		}
+		void recalcHash() const
+		{
+			mListHash = 0;
+			for (const_iterator i = mList.begin(); i != mList.end(); ++i)
+				addToHash(*i);
+			mListHashDirty = false;
+			
+		}
+
+	public:
+		typedef typename VectorImpl::value_type value_type;
+		typedef typename VectorImpl::pointer pointer;
+		typedef typename VectorImpl::reference reference;
+		typedef typename VectorImpl::const_reference const_reference;
+		typedef typename VectorImpl::size_type size_type;
+		typedef typename VectorImpl::difference_type difference_type;
+		typedef typename VectorImpl::iterator iterator;
+		typedef typename VectorImpl::const_iterator const_iterator;
+		typedef typename VectorImpl::reverse_iterator reverse_iterator;
+		typedef typename VectorImpl::const_reverse_iterator const_reverse_iterator;
+
+		void dirtyHash()
+		{
+			mListHashDirty = true;
+		}
+		bool isHashDirty() const
+		{
+			return mListHashDirty;
+		}
+
+		iterator begin() 
+		{ 
+			// we have to assume that hash needs recalculating on non-const
+			dirtyHash();
+			return mList.begin(); 
+		}
+		iterator end() { return mList.end(); }
+		const_iterator begin() const { return mList.begin(); }
+		const_iterator end() const { return mList.end(); }
+		reverse_iterator rbegin() 
+		{ 
+			// we have to assume that hash needs recalculating on non-const
+			dirtyHash();
+			return mList.rbegin(); 
+		}
+		reverse_iterator rend() { return mList.rend(); }
+		const_reverse_iterator rbegin() const { return mList.rbegin(); }
+		const_reverse_iterator rend() const { return mList.rend(); }
+		size_type size() const { return mList.size(); }
+		size_type max_size() const { return mList.max_size(); }
+		size_type capacity() const { return mList.capacity(); }
+		bool empty() const { return mList.empty(); }
+		reference operator[](size_type n) 
+		{ 
+			// we have to assume that hash needs recalculating on non-const
+			dirtyHash();
+			return mList[n]; 
+		}
+		const_reference operator[](size_type n) const { return mList[n]; }
+		reference at(size_type n) 
+		{ 
+			// we have to assume that hash needs recalculating on non-const
+			dirtyHash();
+			return mList.const_iterator(n); 
+		}
+		const_reference at(size_type n) const { return mList.at(n); }
+		HashedVector() : mListHash(0), mListHashDirty(false) {}
+		HashedVector(size_type n) : mList(n), mListHash(0), mListHashDirty(n > 0) {}
+		HashedVector(size_type n, const T& t) : mList(n, t), mListHash(0), mListHashDirty(n > 0) {}
+		HashedVector(const HashedVector<T>& rhs) 
+			: mList(rhs.mList), mListHash(rhs.mListHash), mListHashDirty(rhs.mListHashDirty) {}
+
+		template <class InputIterator>
+		HashedVector(InputIterator a, InputIterator b)
+			: mList(a, b), mListHashDirty(false)
+		{
+			dirtyHash();
+		}
+
+		~HashedVector() {}
+		HashedVector<T>& operator=(const HashedVector<T>& rhs)
+		{
+			mList = rhs.mList;
+			mListHash = rhs.mListHash;
+			mListHashDirty = rhs.mListHashDirty;
+			return *this;
+		}
+
+		void reserve(size_t t) { mList.reserve(t); }
+		reference front() 
+		{ 
+			// we have to assume that hash needs recalculating on non-const
+			dirtyHash();
+			return mList.front(); 
+		}
+		const_reference front() const { return mList.front(); }
+		reference back()  
+		{ 
+			// we have to assume that hash needs recalculating on non-const
+			dirtyHash();
+			return mList.back(); 
+		}
+		const_reference back() const { return mList.back(); }
+		void push_back(const T& t)
+		{ 
+			mList.push_back(t);
+			// Quick progressive hash add
+			if (!isHashDirty())
+				addToHash(t);
+		}
+		void pop_back()
+		{
+			mList.pop_back();
+			dirtyHash();
+		}
+		void swap(HashedVector<T>& rhs)
+		{
+			mList.swap(rhs.mList);
+			dirtyHash();
+		}
+		iterator insert(iterator pos, const T& t)
+		{
+			bool recalc = (pos != end());
+			iterator ret = mList.insert(pos, t);
+			if (recalc)
+				dirtyHash();
+			else
+				addToHash(t);
+			return ret;
+		}
+
+		template <class InputIterator>
+		void insert(iterator pos,
+			InputIterator f, InputIterator l)
+		{
+			mList.insert(pos, f, l);
+			dirtyHash();
+		}
+
+		void insert(iterator pos, size_type n, const T& x)
+		{
+			mList.insert(pos, n, x);
+			dirtyHash();
+		}
+
+		iterator erase(iterator pos)
+		{
+			iterator ret = mList.erase(pos);
+			dirtyHash();
+			return ret;
+		}
+		iterator erase(iterator first, iterator last)
+		{
+			iterator ret = mList.erase(first, last);
+			dirtyHash();
+			return ret;
+		}
+		void clear()
+		{
+			mList.clear();
+			mListHash = 0;
+			mListHashDirty = false;
+		}
+
+		void resize(size_type n, const T& t = T())
+		{
+			bool recalc = false;
+			if (n != size())
+				recalc = true;
+
+			mList.resize(n, t);
+			if (recalc)
+				dirtyHash();
+		}
+
+		bool operator==(const HashedVector<T>& b)
+		{ return mListHash == b.mListHash; }
+
+		bool operator<(const HashedVector<T>& b)
+		{ return mListHash < b.mListHash; }
+
+
+		/// Get the hash value
+		uint32 getHash() const 
+		{ 
+			if (isHashDirty())
+				recalcHash();
+
+			return mListHash; 
+		}
+	public:
+
+
+
+	};
+
+	class Light;
+	typedef HashedVector<Light*> LightList;
+
+
+
+    typedef map<String, bool>::type UnaryOptionList;
+    typedef map<String, String>::type BinaryOptionList;
+
+	/// Name / value parameter pair (first = name, second = value)
+	typedef map<String, String>::type NameValuePairList;
+
+    /// Alias / Texture name pair (first = alias, second = texture name)
+    typedef map<String, String>::type AliasTextureNamePairList;
+
+        template< typename T > struct TRect
+        {
+          T left, top, right, bottom;
+          TRect() : left(0), top(0), right(0), bottom(0) {}
+          TRect( T const & l, T const & t, T const & r, T const & b )
+            : left( l ), top( t ), right( r ), bottom( b )
+          {
+          }
+          TRect( TRect const & o )
+            : left( o.left ), top( o.top ), right( o.right ), bottom( o.bottom )
+          {
+          }
+          TRect & operator=( TRect const & o )
+          {
+            left = o.left;
+            top = o.top;
+            right = o.right;
+            bottom = o.bottom;
+            return *this;
+          }
+          T width() const
+          {
+            return right - left;
+          }
+          T height() const
+          {
+            return bottom - top;
+          }
+		  bool isNull() const
+		  {
+			  return width() == 0 || height() == 0;
+		  }
+		  void setNull()
+		  {
+			  left = right = top = bottom = 0;
+		  }
+		  TRect & merge(const TRect& rhs)
+		  {
+			  if (isNull())
+			  {
+				  *this = rhs;
+			  }
+			  else if (!rhs.isNull())
+			  {
+				  left = std::min(left, rhs.left);
+				  right = std::max(right, rhs.right);
+				  top = std::min(top, rhs.top);
+				  bottom = std::max(bottom, rhs.bottom);
+			  }
+
+			  return *this;
+
+		  }
+		  TRect intersect(const TRect& rhs) const
+		  {
+			  TRect ret;
+			  if (isNull() || rhs.isNull())
+			  {
+				  // empty
+				  return ret;
+			  }
+			  else
+			  {
+				  ret.left = std::max(left, rhs.left);
+				  ret.right = std::min(right, rhs.right);
+				  ret.top = std::max(top, rhs.top);
+				  ret.bottom = std::min(bottom, rhs.bottom);
+			  }
+
+			  if (ret.left > ret.right || ret.top > ret.bottom)
+			  {
+				  // no intersection, return empty
+				  ret.left = ret.top = ret.right = ret.bottom = 0;
+			  }
+
+			  return ret;
+
+		  }
+
+        };
+		template<typename T>
+		std::ostream& operator<<(std::ostream& o, const TRect<T>& r)
+		{
+			o << "TRect<>(l:" << r.left << ", t:" << r.top << ", r:" << r.right << ", b:" << r.bottom << ")";
+			return o;
+		}
+
+        /** Structure used to define a rectangle in a 2-D floating point space.
+        */
+        typedef TRect<float> FloatRect;
+
+		/** Structure used to define a rectangle in a 2-D floating point space, 
+			subject to double / single floating point settings.
+		*/
+		typedef TRect<Real> RealRect;
+
+        /** Structure used to define a rectangle in a 2-D integer space.
+        */
+        typedef TRect< long > Rect;
+
+        /** Structure used to define a box in a 3-D integer space.
+         	Note that the left, top, and front edges are included but the right, 
+         	bottom and back ones are not.
+         */
+        struct Box
+        {
+            uint32 left, top, right, bottom, front, back;
+			/// Parameterless constructor for setting the members manually
+            Box()
+				: left(0), top(0), right(1), bottom(1), front(0), back(1)
+            {
+            }
+            /** Define a box from left, top, right and bottom coordinates
+            	This box will have depth one (front=0 and back=1).
+            	@param	l	x value of left edge
+            	@param	t	y value of top edge
+            	@param	r	x value of right edge
+            	@param	b	y value of bottom edge
+            	@note Note that the left, top, and front edges are included 
+ 		           	but the right, bottom and back ones are not.
+            */
+            Box( uint32 l, uint32 t, uint32 r, uint32 b ):
+                left(l),
+                top(t),   
+                right(r),
+                bottom(b),
+                front(0),
+                back(1)
+            {
+          		assert(right >= left && bottom >= top && back >= front);
+            }
+            /** Define a box from left, top, front, right, bottom and back
+            	coordinates.
+            	@param	l	x value of left edge
+            	@param	t	y value of top edge
+            	@param  ff  z value of front edge
+            	@param	r	x value of right edge
+            	@param	b	y value of bottom edge
+            	@param  bb  z value of back edge
+            	@note Note that the left, top, and front edges are included 
+ 		           	but the right, bottom and back ones are not.
+            */
+            Box( uint32 l, uint32 t, uint32 ff, uint32 r, uint32 b, uint32 bb ):
+                left(l),
+                top(t),   
+                right(r),
+                bottom(b),
+                front(ff),
+                back(bb)
+            {
+          		assert(right >= left && bottom >= top && back >= front);
+            }
+            
+            /// Return true if the other box is a part of this one
+            bool contains(const Box &def) const
+            {
+            	return (def.left >= left && def.top >= top && def.front >= front &&
+					def.right <= right && def.bottom <= bottom && def.back <= back);
+            }
+            
+            /// Get the width of this box
+            uint32 getWidth() const { return right-left; }
+            /// Get the height of this box
+            uint32 getHeight() const { return bottom-top; }
+            /// Get the depth of this box
+            uint32 getDepth() const { return back-front; }
+        };
+
+    
+	
+	/** Locate command-line options of the unary form '-blah' and of the
+        binary form '-blah foo', passing back the index of the next non-option.
+    @param numargs, argv The standard parameters passed to the main method
+    @param unaryOptList Map of unary options (i.e. those that do not require a parameter).
+        Should be pre-populated with, for example '-e' in the key and false in the 
+        value. Options which are found will be set to true on return.
+    @param binOptList Map of binary options (i.e. those that require a parameter
+        e.g. '-e afile.txt').
+        Should be pre-populated with, for example '-e' and the default setting. 
+        Options which are found will have the value updated.
+    */
+    int _OgreExport findCommandLineOpts(int numargs, char** argv, UnaryOptionList& unaryOptList, 
+        BinaryOptionList& binOptList);
+
+	/// Generic result of clipping
+	enum ClipResult
+	{
+		/// Nothing was clipped
+		CLIPPED_NONE = 0,
+		/// Partially clipped
+		CLIPPED_SOME = 1, 
+		/// Everything was clipped away
+		CLIPPED_ALL = 2
+	};
+
+	/// Render window creation parameters.
+	struct RenderWindowDescription
+	{
+		String				name;
+		unsigned int		width;
+		unsigned int		height;
+		bool				useFullScreen;
+		NameValuePairList	miscParams;
+	};
+
+	/// Render window creation parameters container.
+	typedef vector<RenderWindowDescription>::type RenderWindowDescriptionList;
+
+	/// Render window container.
+	typedef vector<RenderWindow*>::type RenderWindowList;
+
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreCompositionPass.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreCompositionPass.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreCompositionPass.h	(revision 148)
@@ -0,0 +1,359 @@
+/*
+-----------------------------------------------------------------------------
+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 __CompositionPass_H__
+#define __CompositionPass_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreMaterial.h"
+#include "OgreRenderSystem.h"
+#include "OgreRenderQueue.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Effects
+	*  @{
+	*/
+	/** Object representing one pass or operation in a composition sequence. This provides a 
+		method to conveniently interleave RenderSystem commands between Render Queues.
+	 */
+	class _OgreExport CompositionPass : public CompositorInstAlloc
+    {
+    public:
+        CompositionPass(CompositionTargetPass *parent);
+        ~CompositionPass();
+        
+        /** Enumeration that enumerates the various composition pass types.
+        */
+        enum PassType
+        {
+            PT_CLEAR,           /// Clear target to one colour
+			PT_STENCIL,			/// Set stencil operation
+            PT_RENDERSCENE,     /// Render the scene or part of it
+            PT_RENDERQUAD,      /// Render a full screen quad
+			PT_RENDERCUSTOM		/// Render a custom sequence
+        };
+        
+        /** Set the type of composition pass */
+        void setType(PassType type);
+        /** Get the type of composition pass */
+        PassType getType() const;
+        
+		/** Set an identifier for this pass. This identifier can be used to
+			"listen in" on this pass with an CompositorInstance::Listener. 
+		*/
+		void setIdentifier(uint32 id);
+		/** Get the identifier for this pass */
+		uint32 getIdentifier() const;
+
+        /** Set the material used by this pass
+			@note applies when PassType is RENDERQUAD 
+		*/
+        void setMaterial(const MaterialPtr& mat);
+        /** Set the material used by this pass 
+			@note applies when PassType is RENDERQUAD 
+		*/
+        void setMaterialName(const String &name);
+        /** Get the material used by this pass 
+			@note applies when PassType is RENDERQUAD 
+		*/
+        const MaterialPtr& getMaterial() const;
+		/** Set the first render queue to be rendered in this pass (inclusive) 
+			@note applies when PassType is RENDERSCENE
+		*/
+        void setFirstRenderQueue(uint8 id);
+		/** Get the first render queue to be rendered in this pass (inclusive) 
+			@note applies when PassType is RENDERSCENE
+		*/
+		uint8 getFirstRenderQueue() const;
+		/** Set the last render queue to be rendered in this pass (inclusive) 
+			@note applies when PassType is RENDERSCENE
+		*/
+        void setLastRenderQueue(uint8 id);
+		/** Get the last render queue to be rendered in this pass (inclusive) 
+			@note applies when PassType is RENDERSCENE
+		*/
+		uint8 getLastRenderQueue() const;
+
+		/** Set the material scheme used by this pass.
+		@remarks
+			Only applicable to passes that render the scene.
+			@see Technique::setScheme.
+		*/
+		void setMaterialScheme(const String& schemeName);
+		/** Get the material scheme used by this pass.
+		@remarks
+			Only applicable to passes that render the scene.
+			@see Technique::setScheme.
+		*/
+		const String& getMaterialScheme(void) const;
+
+		/** Would be nice to have for RENDERSCENE:
+			flags to:
+				exclude transparents
+				override material (at least -- color)
+		*/
+
+        /** Set the viewport clear buffers  (defaults to FBT_COLOUR|FBT_DEPTH)
+            @param val is a combination of FBT_COLOUR, FBT_DEPTH, FBT_STENCIL.
+			@note applies when PassType is CLEAR
+        */
+        void setClearBuffers(uint32 val);
+        /** Get the viewport clear buffers.
+			@note applies when PassType is CLEAR
+        */
+        uint32 getClearBuffers() const;
+        /** Set the viewport clear colour (defaults to 0,0,0,0) 
+			@note applies when PassType is CLEAR
+		 */
+        void setClearColour(ColourValue val);
+        /** Get the viewport clear colour (defaults to 0,0,0,0)	
+			@note applies when PassType is CLEAR
+		 */
+        const ColourValue &getClearColour() const;
+        /** Set the viewport clear depth (defaults to 1.0) 
+			@note applies when PassType is CLEAR
+		*/
+        void setClearDepth(Real depth);
+        /** Get the viewport clear depth (defaults to 1.0) 
+			@note applies when PassType is CLEAR
+		*/
+        Real getClearDepth() const;
+		/** Set the viewport clear stencil value (defaults to 0) 
+			@note applies when PassType is CLEAR
+		*/
+        void setClearStencil(uint32 value);
+        /** Get the viewport clear stencil value (defaults to 0) 
+			@note applies when PassType is CLEAR
+		*/
+        uint32 getClearStencil() const;
+
+		/** Set stencil check on or off.
+			@note applies when PassType is STENCIL
+		*/
+		void setStencilCheck(bool value);
+		/** Get stencil check enable.
+			@note applies when PassType is STENCIL
+		*/
+		bool getStencilCheck() const;
+		/** Set stencil compare function.
+			@note applies when PassType is STENCIL
+		*/
+		void setStencilFunc(CompareFunction value); 
+		/** Get stencil compare function.
+			@note applies when PassType is STENCIL
+		*/
+		CompareFunction getStencilFunc() const; 
+		/** Set stencil reference value.
+			@note applies when PassType is STENCIL
+		*/
+		void setStencilRefValue(uint32 value);
+		/** Get stencil reference value.
+			@note applies when PassType is STENCIL
+		*/
+		uint32 getStencilRefValue() const;
+		/** Set stencil mask.
+			@note applies when PassType is STENCIL
+		*/
+		void setStencilMask(uint32 value);
+		/** Get stencil mask.
+			@note applies when PassType is STENCIL
+		*/
+		uint32 getStencilMask() const;
+		/** Set stencil fail operation.
+			@note applies when PassType is STENCIL
+		*/
+		void setStencilFailOp(StencilOperation value);
+		/** Get stencil fail operation.
+			@note applies when PassType is STENCIL
+		*/
+		StencilOperation getStencilFailOp() const;
+		/** Set stencil depth fail operation.
+			@note applies when PassType is STENCIL
+		*/
+		void setStencilDepthFailOp(StencilOperation value);
+		/** Get stencil depth fail operation.
+			@note applies when PassType is STENCIL
+		*/
+		StencilOperation getStencilDepthFailOp() const;
+		/** Set stencil pass operation.
+			@note applies when PassType is STENCIL
+		*/
+		void setStencilPassOp(StencilOperation value);
+		/** Get stencil pass operation.
+			@note applies when PassType is STENCIL
+		*/
+		StencilOperation getStencilPassOp() const;
+		/** Set two sided stencil operation.
+			@note applies when PassType is STENCIL
+		*/
+		void setStencilTwoSidedOperation(bool value);
+		/** Get two sided stencil operation.
+			@note applies when PassType is STENCIL
+		*/
+		bool getStencilTwoSidedOperation() const;
+
+		/// Inputs (for material used for rendering the quad)
+		struct InputTex
+		{
+			/// Name (local) of the input texture (empty == no input)
+			String name;
+			/// MRT surface index if applicable
+			size_t mrtIndex;
+			InputTex() : name(StringUtil::BLANK), mrtIndex(0) {}
+			InputTex(const String& _name, size_t _mrtIndex = 0)
+				: name(_name), mrtIndex(_mrtIndex) {}
+		};
+
+        /** Set an input local texture. An empty string clears the input.
+            @param id    Input to set. Must be in 0..OGRE_MAX_TEXTURE_LAYERS-1
+            @param input Which texture to bind to this input. An empty string clears the input.
+			@param mrtIndex Which surface of an MRT to retrieve
+			@note applies when PassType is RENDERQUAD 
+        */
+        void setInput(size_t id, const String &input=StringUtil::BLANK, size_t mrtIndex=0);
+        
+        /** Get the value of an input.
+            @param id    Input to get. Must be in 0..OGRE_MAX_TEXTURE_LAYERS-1.
+			@note applies when PassType is RENDERQUAD 
+        */
+        const InputTex &getInput(size_t id) const;
+        
+        /** Get the number of inputs used.
+			@note applies when PassType is RENDERQUAD 
+        */
+        size_t getNumInputs() const;
+        
+        /** Clear all inputs.
+			@note applies when PassType is RENDERQUAD 
+        */
+        void clearAllInputs();
+        
+        /** Get parent object 
+			@note applies when PassType is RENDERQUAD 
+		*/
+        CompositionTargetPass *getParent();
+
+        /** Determine if this target pass is supported on the current rendering device. 
+         */
+        bool _isSupported(void);
+
+        /** Set quad normalised positions [-1;1]x[-1;1]
+            @note applies when PassType is RENDERQUAD
+         */
+        void setQuadCorners(Real left,Real top,Real right,Real bottom);
+
+        /** Get quad normalised positions [-1;1]x[-1;1]
+            @note applies when PassType is RENDERQUAD 
+         */
+        bool getQuadCorners(Real & left,Real & top,Real & right,Real & bottom) const;
+            
+		/** Sets the use of camera frustum far corners provided in the quad's normals
+			@note applies when PassType is RENDERQUAD 
+		*/
+		void setQuadFarCorners(bool farCorners, bool farCornersViewSpace);
+
+		/** Returns true if camera frustum far corners are provided in the quad.
+			@note applies when PassType is RENDERQUAD 
+		*/
+		bool getQuadFarCorners() const;
+
+		/** Returns true if the far corners provided in the quad are in view space
+			@note applies when PassType is RENDERQUAD 
+		*/
+		bool getQuadFarCornersViewSpace() const;
+
+		/** Set the type name of this custom composition pass.
+			@note applies when PassType is RENDERCUSTOM
+			@see CompositorManager::registerCustomCompositionPass
+		*/
+		void setCustomType(const String& customType);
+
+		/** Get the type name of this custom composition pass.
+			@note applies when PassType is RENDERCUSTOM
+			@see CompositorManager::registerCustomCompositionPass
+		*/
+		const String& getCustomType() const;
+
+    private:
+        /// Parent technique
+        CompositionTargetPass *mParent;
+        /// Type of composition pass
+        PassType mType;
+		/// Identifier for this pass
+		uint32 mIdentifier;
+        /// Material used for rendering
+        MaterialPtr mMaterial;
+        /// [first,last] render queue to render this pass (in case of PT_RENDERSCENE)
+		uint8 mFirstRenderQueue;
+		uint8 mLastRenderQueue;
+		/// Material scheme name
+		String mMaterialScheme;
+        /// Clear buffers (in case of PT_CLEAR)
+        uint32 mClearBuffers;
+        /// Clear colour (in case of PT_CLEAR)
+        ColourValue mClearColour;
+		/// Clear depth (in case of PT_CLEAR)
+		Real mClearDepth;
+		/// Clear stencil value (in case of PT_CLEAR)
+		uint32 mClearStencil;
+        /** Inputs (for material used for rendering the quad).
+            An empty string signifies that no input is used */
+        InputTex mInputs[OGRE_MAX_TEXTURE_LAYERS];
+		/// Stencil operation parameters
+		bool mStencilCheck;
+		CompareFunction mStencilFunc; 
+		uint32 mStencilRefValue;
+		uint32 mStencilMask;
+		StencilOperation mStencilFailOp;
+		StencilOperation mStencilDepthFailOp;
+		StencilOperation mStencilPassOp;
+		bool mStencilTwoSidedOperation;
+
+        /// True if quad should not cover whole screen
+        bool mQuadCornerModified;
+        /// quad positions in normalised coordinates [-1;1]x[-1;1] (in case of PT_RENDERQUAD)
+        Real mQuadLeft;
+        Real mQuadTop;
+        Real mQuadRight;
+        Real mQuadBottom;
+
+		bool mQuadFarCorners, mQuadFarCornersViewSpace;
+		/// The type name of the custom composition pass.
+		String mCustomType;
+    };
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreCompositionTargetPass.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreCompositionTargetPass.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreCompositionTargetPass.h	(revision 148)
@@ -0,0 +1,177 @@
+/*
+-----------------------------------------------------------------------------
+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 __CompositionTargetPass_H__
+#define __CompositionTargetPass_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Effects
+	*  @{
+	*/
+	/** Object representing one render to a RenderTarget or Viewport in the Ogre Composition
+		framework.
+	 */
+	class _OgreExport CompositionTargetPass : public CompositorInstAlloc
+    {
+    public:
+        CompositionTargetPass(CompositionTechnique *parent);
+        ~CompositionTargetPass();
+        
+        /** Input mode of a TargetPass
+        */
+        enum InputMode
+        {
+            IM_NONE,        /// No input
+            IM_PREVIOUS     /// Output of previous Composition in chain
+        };
+        typedef vector<CompositionPass *>::type Passes;
+        typedef VectorIterator<Passes> PassIterator;
+        
+        /** Set input mode of this TargetPass
+        */
+        void setInputMode(InputMode mode);
+        /** Get input mode */
+        InputMode getInputMode() const;
+        
+        /** Set output local texture name */
+        void setOutputName(const String &out);
+        /** Get output local texture name */
+        const String &getOutputName() const;
+        
+        /** Set "only initial" flag. This makes that this target pass is only executed initially 
+            after the effect has been enabled.
+        */
+        void setOnlyInitial(bool value);
+        /** Get "only initial" flag.
+        */
+        bool getOnlyInitial();
+        
+        /** Set the scene visibility mask used by this pass 
+        */
+        void setVisibilityMask(uint32 mask);
+        /** Get the scene visibility mask used by this pass 
+        */
+        uint32 getVisibilityMask();
+
+		/** Set the material scheme used by this target pass.
+		@remarks
+			Only applicable to targets that render the scene as
+			one of their passes.
+			@see Technique::setScheme.
+		*/
+		void setMaterialScheme(const String& schemeName);
+		/** Get the material scheme used by this target pass.
+		@remarks
+			Only applicable to targets that render the scene as
+			one of their passes.
+			@see Technique::setScheme.
+		*/
+		const String& getMaterialScheme(void) const;
+        
+		/** Set whether shadows are enabled in this target pass.
+		@remarks
+			Only applicable to targets that render the scene as
+			one of their passes.
+		*/
+		void setShadowsEnabled(bool enabled);
+		/** Get whether shadows are enabled in this target pass.
+		@remarks
+			Only applicable to targets that render the scene as
+			one of their passes.
+		*/
+		bool getShadowsEnabled(void) const;
+        /** Set the scene LOD bias used by this pass. The default is 1.0,
+            everything below that means lower quality, higher means higher quality.
+        */
+        void setLodBias(float bias);
+        /** Get the scene LOD bias used by this pass 
+        */
+        float getLodBias();
+        
+        /** Create a new pass, and return a pointer to it.
+        */
+        CompositionPass *createPass();
+        /** Remove a pass. It will also be destroyed.
+        */
+        void removePass(size_t idx);
+        /** Get a pass.
+        */
+        CompositionPass *getPass(size_t idx);
+        /** Get the number of passes.
+        */
+        size_t getNumPasses();
+        
+        /** Remove all passes
+        */
+        void removeAllPasses();
+    
+        /** Get an iterator over the Passes in this TargetPass. */
+        PassIterator getPassIterator(void);
+        
+        /** Get parent object */
+        CompositionTechnique *getParent();
+
+        /** Determine if this target pass is supported on the current rendering device. 
+         */
+        bool _isSupported(void);
+
+    private:
+        /// Parent technique
+        CompositionTechnique *mParent;
+        /// Input mode
+        InputMode mInputMode;
+        /// (local) output texture
+        String mOutputName;
+        /// Passes
+        Passes mPasses;
+        /// This target pass is only executed initially after the effect
+        /// has been enabled.
+        bool mOnlyInitial;
+        /// Visibility mask for this render
+        uint32 mVisibilityMask;
+        /// LOD bias of this render
+        float mLodBias;
+		/// Material scheme name
+		String mMaterialScheme;
+		/// Shadows option
+		bool mShadowsEnabled;
+    };
+
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreCompositionTechnique.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreCompositionTechnique.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreCompositionTechnique.h	(revision 148)
@@ -0,0 +1,191 @@
+/*
+-----------------------------------------------------------------------------
+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 __CompositionTechnique_H__
+#define __CompositionTechnique_H__
+
+#include "OgrePrerequisites.h"
+#include "OgrePixelFormat.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Effects
+	*  @{
+	*/
+	/** Base composition technique, can be subclassed in plugins.
+     */
+	class _OgreExport CompositionTechnique : public CompositorInstAlloc
+    {
+    public:
+        CompositionTechnique(Compositor *parent);
+        virtual ~CompositionTechnique();
+    
+        //The scope of a texture defined by the compositor
+        enum TextureScope { 
+            //Local texture - only available to the compositor passes in this technique
+            TS_LOCAL, 
+            //Chain texture - available to the other compositors in the chain
+            TS_CHAIN, 
+            //Global texture - available to everyone in every scope
+            TS_GLOBAL 
+        };
+
+        /// Local texture definition
+        class TextureDefinition : public CompositorInstAlloc
+        {
+        public:
+            String name;
+			//Texture definition being a reference is determined by these two fields not being empty.
+			String refCompName; //If a reference, the name of the compositor being referenced
+			String refTexName;	//If a reference, the name of the texture in the compositor being referenced
+            size_t width;       // 0 means adapt to target width
+            size_t height;      // 0 means adapt to target height
+			float widthFactor;  // multiple of target width to use (if width = 0)
+			float heightFactor; // multiple of target height to use (if height = 0)
+            PixelFormatList formatList; // more than one means MRT
+			bool fsaa;			// FSAA enabled; true = determine from main target (if render_scene), false = disable
+			bool hwGammaWrite;	// Do sRGB gamma correction on write (only 8-bit per channel formats) 
+			uint16 depthBufferId;//Depth Buffer's pool ID. (unrelated to "pool" variable below)
+			bool pooled;		// whether to use pooled textures for this one
+            TextureScope scope; // Which scope has access to this texture
+
+			TextureDefinition() :width(0), height(0), widthFactor(1.0f), heightFactor(1.0f), 
+				fsaa(true), hwGammaWrite(false), depthBufferId(1), pooled(false), scope(TS_LOCAL) {}
+        };
+        /// Typedefs for several iterators
+        typedef vector<CompositionTargetPass *>::type TargetPasses;
+        typedef VectorIterator<TargetPasses> TargetPassIterator;
+        typedef vector<TextureDefinition*>::type TextureDefinitions;
+        typedef VectorIterator<TextureDefinitions> TextureDefinitionIterator;
+        
+        /** Create a new local texture definition, and return a pointer to it.
+            @param name     Name of the local texture
+        */
+        TextureDefinition *createTextureDefinition(const String &name);
+        
+        /** Remove and destroy a local texture definition.
+        */
+        void removeTextureDefinition(size_t idx);
+        
+        /** Get a local texture definition.
+        */
+        TextureDefinition *getTextureDefinition(size_t idx);
+        
+		/** Get a local texture definition with a specific name.
+		*/
+		TextureDefinition *getTextureDefinition(const String& name);
+
+		/** Get the number of local texture definitions.
+        */
+        size_t getNumTextureDefinitions();
+        
+        /** Remove all Texture Definitions
+        */
+        void removeAllTextureDefinitions();
+        
+        /** Get an iterator over the TextureDefinitions in this Technique. */
+        TextureDefinitionIterator getTextureDefinitionIterator(void);
+        
+        /** Create a new target pass, and return a pointer to it.
+        */
+        CompositionTargetPass *createTargetPass();
+        
+        /** Remove a target pass. It will also be destroyed.
+        */
+        void removeTargetPass(size_t idx);
+        
+        /** Get a target pass.
+        */
+        CompositionTargetPass *getTargetPass(size_t idx);
+        
+        /** Get the number of target passes.
+        */
+        size_t getNumTargetPasses();
+        
+        /** Remove all target passes.
+        */
+        void removeAllTargetPasses();
+        
+        /** Get an iterator over the TargetPasses in this Technique. */
+        TargetPassIterator getTargetPassIterator(void);
+        
+        /** Get output (final) target pass
+         */
+        CompositionTargetPass *getOutputTargetPass();
+        
+        /** Determine if this technique is supported on the current rendering device. 
+		@param allowTextureDegradation True to accept a reduction in texture depth
+         */
+        virtual bool isSupported(bool allowTextureDegradation);
+        
+		/** Assign a scheme name to this technique, used to switch between 
+			multiple techniques by choice rather than for hardware compatibility.
+		*/
+		virtual void setSchemeName(const String& schemeName);
+		/** Get the scheme name assigned to this technique. */
+		const String& getSchemeName() const { return mSchemeName; }
+        
+		/** Set the name of the compositor logic assigned to this technique.
+			Instances of this technique will be auto-coupled with the matching logic.
+		*/
+		void setCompositorLogicName(const String& compositorLogicName) 
+			{ mCompositorLogicName = compositorLogicName; }
+		/** Get the compositor logic name assigned to this technique */
+		const String& getCompositorLogicName() const { return mCompositorLogicName; }
+
+        /** Get parent object */
+        Compositor *getParent();
+    private:
+        /// Parent compositor
+        Compositor *mParent;
+        /// Local texture definitions
+        TextureDefinitions mTextureDefinitions;
+        
+        /// Intermediate target passes
+        TargetPasses mTargetPasses;
+        /// Output target pass (can be only one)
+        CompositionTargetPass *mOutputTarget;  
+
+		/// Optional scheme name
+		String mSchemeName;
+		
+		/// Optional compositor logic name
+		String mCompositorLogicName;
+
+    };
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreCompositor.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreCompositor.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreCompositor.h	(revision 148)
@@ -0,0 +1,182 @@
+/*
+-----------------------------------------------------------------------------
+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 __Compositor_H__
+#define __Compositor_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreResource.h"
+#include "OgreTexture.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Effects
+	*  @{
+	*/
+	/** Class representing a Compositor object. Compositors provide the means 
+        to flexibly "composite" the final rendering result from multiple scene renders
+        and intermediate operations like rendering fullscreen quads. This makes 
+        it possible to apply postfilter effects, HDRI postprocessing, and shadow 
+        effects to a Viewport.
+     */
+    class _OgreExport Compositor: public Resource
+    {
+    public:
+        Compositor(ResourceManager* creator, const String& name, ResourceHandle handle,
+            const String& group, bool isManual = false, ManualResourceLoader* loader = 0);
+        ~Compositor();
+        
+        /// Data types for internal lists
+        typedef vector<CompositionTechnique *>::type Techniques;
+        typedef VectorIterator<Techniques> TechniqueIterator;
+        
+        /** Create a new technique, and return a pointer to it.
+        */
+        CompositionTechnique *createTechnique();
+        
+        /** Remove a technique. It will also be destroyed.
+        */
+        void removeTechnique(size_t idx);
+        
+        /** Get a technique.
+        */
+        CompositionTechnique *getTechnique(size_t idx);
+        
+        /** Get the number of techniques.
+        */
+        size_t getNumTechniques();
+        
+        /** Remove all techniques
+        */
+        void removeAllTechniques();
+        
+        /** Get an iterator over the Techniques in this compositor. */
+        TechniqueIterator getTechniqueIterator(void);
+        
+        /** Get a supported technique.
+        @remarks
+            The supported technique list is only available after this compositor has been compiled,
+            which typically happens on loading it. Therefore, if this method returns
+            an empty list, try calling Compositor::load.
+        */
+        CompositionTechnique *getSupportedTechnique(size_t idx);
+        
+        /** Get the number of supported techniques.
+        @remarks
+            The supported technique list is only available after this compositor has been compiled,
+            which typically happens on loading it. Therefore, if this method returns
+            an empty list, try calling Compositor::load.
+        */
+        size_t getNumSupportedTechniques();
+        
+        /** Gets an iterator over all the Techniques which are supported by the current card. 
+        @remarks
+            The supported technique list is only available after this compositor has been compiled,
+            which typically happens on loading it. Therefore, if this method returns
+            an empty list, try calling Compositor::load.
+        */
+        TechniqueIterator getSupportedTechniqueIterator(void);
+
+		/** Get a pointer to a supported technique for a given scheme. 
+		@remarks
+			If there is no specific supported technique with this scheme name, 
+			then the first supported technique with no specific scheme will be returned.
+		@param schemeName The scheme name you are looking for. Blank means to 
+			look for techniques with no scheme associated
+		*/
+		CompositionTechnique *getSupportedTechnique(const String& schemeName = StringUtil::BLANK);
+
+		/** Get the instance name for a global texture.
+		@param name The name of the texture in the original compositor definition
+		@param mrtIndex If name identifies a MRT, which texture attachment to retrieve
+		@return The instance name for the texture, corresponds to a real texture
+		*/
+		const String& getTextureInstanceName(const String& name, size_t mrtIndex);
+
+		/** Get the instance of a global texture.
+		@param name The name of the texture in the original compositor definition
+		@param mrtIndex If name identifies a MRT, which texture attachment to retrieve
+		@return The texture pointer, corresponds to a real texture
+		*/
+		TexturePtr getTextureInstance(const String& name, size_t mrtIndex);
+
+		/** Get the render target for a given render texture name. 
+		@remarks
+			You can use this to add listeners etc, but do not use it to update the
+			targets manually or any other modifications, the compositor instance 
+			is in charge of this.
+		*/
+		RenderTarget* getRenderTarget(const String& name);
+
+    protected:
+        /// @copydoc Resource::loadImpl
+        void loadImpl(void);
+
+        /// @copydoc Resource::unloadImpl
+        void unloadImpl(void);
+        /// @copydoc Resource::calculateSize
+        size_t calculateSize(void) const;
+        
+        /** Check supportedness of techniques.
+         */
+        void compile();
+    private:
+        Techniques mTechniques;
+        Techniques mSupportedTechniques;
+        
+        /// Compilation required
+        /// This is set if the techniques change and the supportedness of techniques has to be
+        /// re-evaluated.
+        bool mCompilationRequired;
+
+		/** Create global rendertextures.
+        */
+        void createGlobalTextures();
+        
+        /** Destroy global rendertextures.
+        */
+        void freeGlobalTextures();
+
+		//TODO GSOC : These typedefs are duplicated from CompositorInstance. Solve?
+		/// Map from name->local texture
+        typedef map<String,TexturePtr>::type GlobalTextureMap;
+        GlobalTextureMap mGlobalTextures;
+		/// Store a list of MRTs we've created
+		typedef map<String,MultiRenderTarget*>::type GlobalMRTMap;
+		GlobalMRTMap mGlobalMRTs;
+    };
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreCompositorChain.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreCompositorChain.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreCompositorChain.h	(revision 148)
@@ -0,0 +1,250 @@
+/*
+-----------------------------------------------------------------------------
+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 __CompositorChain_H__
+#define __CompositorChain_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreRenderTargetListener.h"
+#include "OgreRenderQueueListener.h"
+#include "OgreCompositorInstance.h"
+#include "OgreCompositor.h"
+#include "OgreViewport.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+    /** \addtogroup Core
+    *  @{
+    */
+    /** \addtogroup Effects
+    *  @{
+    */
+    /** Chain of compositor effects applying to one viewport.
+    */
+    class _OgreExport CompositorChain : public RenderTargetListener, public Viewport::Listener, public CompositorInstAlloc
+    {
+    public:
+        CompositorChain(Viewport *vp);
+        /** Another gcc warning here, which is no problem because RenderTargetListener is never used
+            to delete an object.
+        */
+        virtual ~CompositorChain();
+        
+        /// Data types
+        typedef vector<CompositorInstance*>::type Instances;
+        typedef VectorIterator<Instances> InstanceIterator;
+        
+        /// Identifier for "last" compositor in chain.
+        static const size_t LAST = (size_t)-1;
+        /// Identifier for best technique.
+        static const size_t BEST = 0;
+        
+        /** Apply a compositor. Initially, the filter is enabled.
+        @param filter
+            Filter to apply.
+        @param addPosition
+            Position in filter chain to insert this filter at; defaults to the end (last applied filter).
+        @param scheme
+            Scheme to use (blank means default).
+        */
+        CompositorInstance* addCompositor(CompositorPtr filter, size_t addPosition=LAST, const String& scheme = StringUtil::BLANK);
+
+        /** Remove a compositor.
+        @param position
+            Position in filter chain of filter to remove; defaults to the end (last applied filter)
+        */
+        void removeCompositor(size_t position=LAST);
+        
+        /** Get the number of compositors.
+        */
+        size_t getNumCompositors();
+        
+        /** Remove all compositors.
+        */
+        void removeAllCompositors();
+        
+        /** Get compositor instance by position.
+        */
+        CompositorInstance *getCompositor(size_t index);
+
+        /** Get compositor instance by name. Returns null if not found.
+        */
+        CompositorInstance *getCompositor(const String& name);
+
+        /** Get the original scene compositor instance for this chain (internal use). 
+        */
+        CompositorInstance* _getOriginalSceneCompositor(void) { return mOriginalScene; }
+
+        /** Get an iterator over the compositor instances. The first compositor in this list is applied first, the last one is applied last.
+        */
+        InstanceIterator getCompositors();
+    
+        /** Enable or disable a compositor, by position. Disabling a compositor stops it from rendering
+            but does not free any resources. This can be more efficient than using removeCompositor and 
+            addCompositor in cases the filter is switched on and off a lot.
+        @param position
+            Position in filter chain of filter
+        */
+        void setCompositorEnabled(size_t position, bool state);
+
+        /** @see RenderTargetListener::preRenderTargetUpdate */
+        virtual void preRenderTargetUpdate(const RenderTargetEvent& evt);
+        /** @see RenderTargetListener::postRenderTargetUpdate */
+        virtual void postRenderTargetUpdate(const RenderTargetEvent& evt);
+        /** @see RenderTargetListener::preViewportUpdate */
+        virtual void preViewportUpdate(const RenderTargetViewportEvent& evt);
+        /** @see RenderTargetListener::postViewportUpdate */
+        virtual void postViewportUpdate(const RenderTargetViewportEvent& evt);
+
+        /** @see Viewport::Listener::viewportCameraChanged */
+        virtual void viewportCameraChanged(Viewport* viewport);
+        /** @see Viewport::Listener::viewportDimensionsChanged */
+        virtual void viewportDimensionsChanged(Viewport* viewport);
+        /** @see Viewport::Listener::viewportDestroyed */
+        virtual void viewportDestroyed(Viewport* viewport);
+
+        /** Mark state as dirty, and to be recompiled next frame.
+        */
+        void _markDirty();
+        
+        /** Get viewport that is the target of this chain
+        */
+        Viewport *getViewport();
+
+        /** Remove a compositor by pointer. This is internally used by CompositionTechnique to
+            "weak" remove any instanced of a deleted technique.
+        */
+        void _removeInstance(CompositorInstance *i);
+
+        /** Internal method for registering a queued operation for deletion later **/
+        void _queuedOperation(CompositorInstance::RenderSystemOperation* op);
+
+        /** Compile this Composition chain into a series of RenderTarget operations.
+        */
+        void _compile();
+
+        /** Get the previous instance in this chain to the one specified. 
+        */
+        CompositorInstance* getPreviousInstance(CompositorInstance* curr, bool activeOnly = true);
+        /** Get the next instance in this chain to the one specified. 
+        */
+        CompositorInstance* getNextInstance(CompositorInstance* curr, bool activeOnly = true);
+
+    protected:
+        /// Viewport affected by this CompositorChain
+        Viewport *mViewport;
+        
+        /** Plainly renders the scene; implicit first compositor in the chain.
+        */
+        CompositorInstance *mOriginalScene;
+        
+        /// Postfilter instances in this chain
+        Instances mInstances;
+        
+        /// State needs recompile
+        bool mDirty;
+        /// Any compositors enabled?
+        bool mAnyCompositorsEnabled;
+
+        String mOriginalSceneScheme;
+
+        /// Compiled state (updated with _compile)
+        CompositorInstance::CompiledState mCompiledState;
+        CompositorInstance::TargetOperation mOutputOperation;
+        /// Render System operations queued by last compile, these are created by this
+        /// instance thus managed and deleted by it. The list is cleared with 
+        /// clearCompilationState()
+        typedef vector<CompositorInstance::RenderSystemOperation*>::type RenderSystemOperations;
+        RenderSystemOperations mRenderSystemOperations;
+
+        /** Clear compiled state */
+        void clearCompiledState();
+        
+        /** Prepare a viewport, the camera and the scene for a rendering operation
+        */
+        void preTargetOperation(CompositorInstance::TargetOperation &op, Viewport *vp, Camera *cam);
+        
+        /** Restore a viewport, the camera and the scene after a rendering operation
+        */
+        void postTargetOperation(CompositorInstance::TargetOperation &op, Viewport *vp, Camera *cam);
+
+        void createOriginalScene();
+        void destroyOriginalScene();
+
+        /// destroy internal resources
+        void destroyResources(void);
+
+        /** Render queue listener used to set up rendering events. */
+        class _OgreExport RQListener: public RenderQueueListener
+        {
+        public:
+            RQListener() : mOperation(0), mSceneManager(0), mRenderSystem(0), mViewport(0) {}
+
+            /** @copydoc RenderQueueListener::renderQueueStarted
+            */
+            virtual void renderQueueStarted(uint8 queueGroupId, const String& invocation, bool& skipThisInvocation);
+            /** @copydoc RenderQueueListener::renderQueueEnded
+            */
+            virtual void renderQueueEnded(uint8 queueGroupId, const String& invocation, bool& repeatThisInvocation);
+
+            /** Set current operation and target. */
+            void setOperation(CompositorInstance::TargetOperation *op,SceneManager *sm,RenderSystem *rs);
+
+            /** Notify current destination viewport. */
+            void notifyViewport(Viewport* vp) { mViewport = vp; }
+
+            /** Flush remaining render system operations. */
+            void flushUpTo(uint8 id);
+        private:
+            CompositorInstance::TargetOperation *mOperation;
+            SceneManager *mSceneManager;
+            RenderSystem *mRenderSystem;
+            Viewport* mViewport;
+            CompositorInstance::RenderSystemOpPairs::iterator currentOp, lastOp;
+        };
+        RQListener mOurListener;
+        /// Old viewport settings
+        unsigned int mOldClearEveryFrameBuffers;
+        /// Store old scene visibility mask
+        uint32 mOldVisibilityMask;
+        /// Store old find visible objects
+        bool mOldFindVisibleObjects;
+        /// Store old camera LOD bias
+        float mOldLodBias;
+        /// Store old viewport material scheme
+        String mOldMaterialScheme;
+        /// Store old shadows enabled flag
+        bool mOldShadowsEnabled;
+
+    };
+    /** @} */
+    /** @} */
+} // namespace Ogre
+
+#include "OgreHeaderSuffix.h"
+
+#endif // __CompositorChain_H__
Index: /ogre_src_v1-9-0/OgreMain/include/OgreCompositorInstance.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreCompositorInstance.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreCompositorInstance.h	(revision 148)
@@ -0,0 +1,394 @@
+/*
+-----------------------------------------------------------------------------
+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 __CompositorInstance_H__
+#define __CompositorInstance_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreMaterialManager.h"
+#include "OgreTexture.h"
+#include "OgreRenderQueue.h"
+#include "OgreCompositionTechnique.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+    /** \addtogroup Core
+    *  @{
+    */
+    /** \addtogroup Effects
+    *  @{
+    */
+    const size_t RENDER_QUEUE_COUNT = RENDER_QUEUE_MAX+1;       
+            
+    /** An instance of a Compositor object for one Viewport. It is part of the CompositorChain
+        for a Viewport.
+    */
+    class _OgreExport CompositorInstance : public CompositorInstAlloc
+    {
+    public:
+        CompositorInstance(CompositionTechnique *technique, CompositorChain *chain);
+        virtual ~CompositorInstance();
+        /** Provides an interface to "listen in" to to render system operations executed by this 
+            CompositorInstance.
+        */
+        class _OgreExport Listener
+        {
+        public:
+            virtual ~Listener();
+
+            /** Notification of when a render target operation involving a material (like
+                rendering a quad) is compiled, so that miscellaneous parameters that are different
+                per Compositor instance can be set up.
+            @param pass_id
+                Pass identifier within Compositor instance, this is specified 
+                by the user by CompositionPass::setIdentifier().
+            @param mat
+                Material, this may be changed at will and will only affect
+                the current instance of the Compositor, not the global material
+                it was cloned from.
+             */
+            virtual void notifyMaterialSetup(uint32 pass_id, MaterialPtr &mat);
+
+            /** Notification before a render target operation involving a material (like
+                rendering a quad), so that material parameters can be varied.
+            @param pass_id
+                Pass identifier within Compositor instance, this is specified 
+                by the user by CompositionPass::setIdentifier().
+            @param mat
+                Material, this may be changed at will and will only affect
+                the current instance of the Compositor, not the global material
+                it was cloned from.
+             */
+            virtual void notifyMaterialRender(uint32 pass_id, MaterialPtr &mat);
+
+            /** Notification after resources have been created (or recreated).
+            @param forResizeOnly
+                Was the creation because the viewport was resized?
+            */
+            virtual void notifyResourcesCreated(bool forResizeOnly);
+
+        };
+        /** Specific render system operation. A render target operation does special operations
+            between render queues like rendering a quad, clearing the frame buffer or 
+            setting stencil state.
+        */
+        class _OgreExport RenderSystemOperation : public CompositorInstAlloc
+        {
+        public:
+            virtual ~RenderSystemOperation();
+            /// Set state to SceneManager and RenderSystem
+            virtual void execute(SceneManager *sm, RenderSystem *rs) = 0;
+        };
+        typedef map<int, MaterialPtr>::type QuadMaterialMap;
+        typedef std::pair<int, RenderSystemOperation*> RenderSystemOpPair;
+        typedef vector<RenderSystemOpPair>::type RenderSystemOpPairs;
+        /** Operation setup for a RenderTarget (collected).
+        */
+        class TargetOperation
+        {
+        public:
+            TargetOperation()
+            { 
+            }
+            TargetOperation(RenderTarget *inTarget):
+                target(inTarget), currentQueueGroupID(0), visibilityMask(0xFFFFFFFF),
+                lodBias(1.0f),
+                onlyInitial(false), hasBeenRendered(false), findVisibleObjects(false), 
+                materialScheme(MaterialManager::DEFAULT_SCHEME_NAME), shadowsEnabled(true)
+            { 
+            }
+            /// Target
+            RenderTarget *target;
+
+            /// Current group ID
+            int currentQueueGroupID;
+
+            /// RenderSystem operations to queue into the scene manager, by
+            /// uint8
+            RenderSystemOpPairs renderSystemOperations;
+
+            /// Scene visibility mask
+            /// If this is 0, the scene is not rendered at all
+            uint32 visibilityMask;
+            
+            /// LOD offset. This is multiplied with the camera LOD offset
+            /// 1.0 is default, lower means lower detail, higher means higher detail
+            float lodBias;
+            
+            /** A set of render queues to either include or exclude certain render queues.
+            */
+            typedef std::bitset<RENDER_QUEUE_COUNT> RenderQueueBitSet;
+
+            /// Which renderqueues to render from scene
+            RenderQueueBitSet renderQueues;
+            
+            /** @see CompositionTargetPass::mOnlyInitial
+            */
+            bool onlyInitial;
+            /** "Has been rendered" flag; used in combination with
+                onlyInitial to determine whether to skip this target operation.
+            */
+            bool hasBeenRendered;
+            /** Whether this op needs to find visible scene objects or not 
+            */
+            bool findVisibleObjects;
+            /** Which material scheme this op will use */
+            String materialScheme;
+            /** Whether shadows will be enabled */
+            bool shadowsEnabled;
+        };
+        typedef vector<TargetOperation>::type CompiledState;
+        
+        /** Set enabled flag. The compositor instance will only render if it is
+            enabled, otherwise it is pass-through. Resources are only created if
+            they weren't alive when enabling.
+        */
+        void setEnabled(bool value);
+        
+        /** Get enabled flag.
+        */
+        bool getEnabled() const { return mEnabled; }
+
+        /** Set alive/active flag. The compositor instance will create resources when alive,
+            and destroy them when inactive.
+        @remarks
+            Killing an instance means also disabling it: setAlive(false) implies
+            setEnabled(false)
+        */
+        void setAlive(bool value);
+
+        /** Get alive flag.
+        */
+        bool getAlive() const { return mAlive; }
+
+        /** Get the instance name for a local texture.
+        @note It is only valid to call this when local textures have been loaded, 
+            which in practice means that the compositor instance is active. Calling
+            it at other times will cause an exception. Note that since textures
+            are cleaned up aggressively, this name is not guaranteed to stay the
+            same if you disable and re-enable the compositor instance.
+        @param name
+            The name of the texture in the original compositor definition.
+        @param mrtIndex
+            If name identifies a MRT, which texture attachment to retrieve.
+        @return
+            The instance name for the texture, corresponds to a real texture.
+        */
+        const String& getTextureInstanceName(const String& name, size_t mrtIndex);
+
+        /** Get the instance of a local texture.
+        @note Textures are only valid when local textures have been loaded, 
+            which in practice means that the compositor instance is active. Calling
+            this method at other times will return null pointers. Note that since textures
+            are cleaned up aggressively, this pointer is not guaranteed to stay the
+            same if you disable and re-enable the compositor instance.
+        @param name
+            The name of the texture in the original compositor definition.
+        @param mrtIndex
+            If name identifies a MRT, which texture attachment to retrieve.
+        @return
+            The texture pointer, corresponds to a real texture.
+        */
+        TexturePtr getTextureInstance(const String& name, size_t mrtIndex);
+
+        /** Get the render target for a given render texture name. 
+        @remarks
+            You can use this to add listeners etc, but do not use it to update the
+            targets manually or any other modifications, the compositor instance 
+            is in charge of this.
+        */
+        RenderTarget* getRenderTarget(const String& name);
+
+       
+        /** Recursively collect target states (except for final Pass).
+        @param compiledState
+            This vector will contain a list of TargetOperation objects.
+        */
+        virtual void _compileTargetOperations(CompiledState &compiledState);
+        
+        /** Compile the final (output) operation. This is done separately because this
+            is combined with the input in chained filters.
+        */
+        virtual void _compileOutputOperation(TargetOperation &finalState);
+        
+        /** Get Compositor of which this is an instance
+        */
+        Compositor *getCompositor();
+        
+        /** Get CompositionTechnique used by this instance
+        */
+        CompositionTechnique *getTechnique();
+
+        /** Change the technique we're using to render this compositor. 
+        @param tech
+            The technique to use (must be supported and from the same Compositor)
+        @param reuseTextures
+            If textures have already been created for the current
+            technique, whether to try to re-use them if sizes & formats match.
+        */
+        void setTechnique(CompositionTechnique* tech, bool reuseTextures = true);
+
+        /** Pick a technique to use to render this compositor based on a scheme. 
+        @remarks
+            If there is no specific supported technique with this scheme name, 
+            then the first supported technique with no specific scheme will be used.
+        @see CompositionTechnique::setSchemeName
+        @param schemeName
+            The scheme to use 
+        @param reuseTextures
+            If textures have already been created for the current
+            technique, whether to try to re-use them if sizes & formats match.
+            Note that for this feature to be of benefit, the textures must have been created
+            with the 'pooled' option enabled.
+        */
+        void setScheme(const String& schemeName, bool reuseTextures = true);
+
+        /// Returns the name of the scheme this compositor is using.
+        const String& getScheme() const { return mTechnique ? mTechnique->getSchemeName() : StringUtil::BLANK; }
+
+        /** Notify this instance that the primary surface has been resized. 
+        @remarks
+            This will allow the instance to recreate its resources that 
+            are dependent on the size. 
+        */
+        void notifyResized();
+
+        /** Get Chain that this instance is part of
+        */
+        CompositorChain *getChain();
+
+        /** Add a listener. Listeners provide an interface to "listen in" to to render system 
+            operations executed by this CompositorInstance so that materials can be 
+            programmatically set up.
+        @see CompositorInstance::Listener
+        */
+        void addListener(Listener *l);
+
+        /** Remove a listener.
+        @see CompositorInstance::Listener
+        */
+        void removeListener(Listener *l);
+
+        /** Notify listeners of a material compilation.
+        */
+        void _fireNotifyMaterialSetup(uint32 pass_id, MaterialPtr &mat);
+
+        /** Notify listeners of a material render.
+        */
+        void _fireNotifyMaterialRender(uint32 pass_id, MaterialPtr &mat);
+
+        /** Notify listeners of a material render.
+        */
+        void _fireNotifyResourcesCreated(bool forResizeOnly);
+    private:
+        /// Compositor of which this is an instance.
+        Compositor *mCompositor;
+        /// Composition technique used by this instance.
+        CompositionTechnique *mTechnique;
+        /// Composition chain of which this instance is part.
+        CompositorChain *mChain;
+        /// Is this instance enabled?
+        bool mEnabled;
+        /// Is this instance allocating resources?
+        bool mAlive;
+        /// Map from name->local texture.
+        typedef map<String,TexturePtr>::type LocalTextureMap;
+        LocalTextureMap mLocalTextures;
+        /// Store a list of MRTs we've created.
+        typedef map<String,MultiRenderTarget*>::type LocalMRTMap;
+        LocalMRTMap mLocalMRTs;
+        typedef map<CompositionTechnique::TextureDefinition*, TexturePtr>::type ReserveTextureMap;
+        /** Textures that are not currently in use, but that we want to keep for now,
+            for example if we switch techniques but want to keep all textures available
+            in case we switch back. 
+        */
+        ReserveTextureMap mReserveTextures;
+
+        /// Vector of listeners.
+        typedef vector<Listener*>::type Listeners;
+        Listeners mListeners;
+        
+        /// Previous instance (set by chain).
+        CompositorInstance *mPreviousInstance;
+        
+        /** Collect rendering passes. Here, passes are converted into render target operations
+            and queued with queueRenderSystemOp.
+        */
+        virtual void collectPasses(TargetOperation &finalState, CompositionTargetPass *target);
+        
+        /** Create a local dummy material with one technique but no passes.
+            The material is detached from the Material Manager to make sure it is destroyed
+            when going out of scope.
+        */
+        MaterialPtr createLocalMaterial(const String& srcName);
+        
+        /** Create local rendertextures and other resources. Builds mLocalTextures.
+        */
+        void createResources(bool forResizeOnly);
+        
+        /** Destroy local rendertextures and other resources.
+        */
+        void freeResources(bool forResizeOnly, bool clearReserveTextures);
+
+        /** Get RenderTarget for a named local texture.
+        */
+        RenderTarget *getTargetForTex(const String &name);
+        
+        /** Get source texture name for a named local texture.
+        @param name
+            The local name of the texture as given to it in the compositor.
+        @param mrtIndex
+            For MRTs, which attached surface to retrieve.
+        */
+        const String &getSourceForTex(const String &name, size_t mrtIndex = 0);
+
+        /** Queue a render system operation.
+        */
+        void queueRenderSystemOp(TargetOperation &finalState, RenderSystemOperation *op);
+
+        /// Util method for assigning a local texture name to a MRT attachment
+        String getMRTTexLocalName(const String& baseName, size_t attachment);
+
+        /** Search for options like AA and hardware gamma which we may want to 
+            inherit from the main render target to which we're attached. 
+        */
+        void deriveTextureRenderTargetOptions(const String& texname, 
+            bool *hwGammaWrite, uint *fsaa, String* fsaaHint);
+
+        /// Notify this instance that the primary viewport's camera has changed.
+        void notifyCameraChanged(Camera* camera);
+
+        friend class CompositorChain;
+    };
+    /** @} */
+    /** @} */
+
+} // namespace Ogre
+
+#include "OgreHeaderSuffix.h"
+
+#endif // __CompositorInstance_H__
Index: /ogre_src_v1-9-0/OgreMain/include/OgreCompositorLogic.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreCompositorLogic.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreCompositorLogic.h	(revision 148)
@@ -0,0 +1,68 @@
+/*
+-----------------------------------------------------------------------------
+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 __CompositorLogic_H__
+#define __CompositorLogic_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Effects
+	*  @{
+	*/
+	/** Interface for compositor logics, which can be automatically binded to compositors,
+	*	allowing per-compositor logic (such as attaching a relevant listener) to happen
+	*	automatically.
+	*	@remarks All methods have empty implementations to not force an implementer into
+	*		extending all of them.
+    */
+    class _OgreExport CompositorLogic
+    {
+	public:
+		/** Called when a compositor instance has been created.
+			@remarks
+			This happens after its setup was finished, so the chain is also accessible.
+			This is an ideal method to automatically attach a compositor listener.
+        */
+		virtual void compositorInstanceCreated(CompositorInstance* newInstance) {}
+
+		/** Called when a compositor instance has been destroyed
+			@remarks
+			The chain that contained the compositor is still alive during this call.
+        */
+		virtual void compositorInstanceDestroyed(CompositorInstance* destroyedInstance) {}
+
+		virtual ~CompositorLogic() {}
+	};
+	/** @} */
+	/** @} */
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreCompositorManager.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreCompositorManager.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreCompositorManager.h	(revision 148)
@@ -0,0 +1,307 @@
+/*
+-----------------------------------------------------------------------------
+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 __CompositorManager_H__
+#define __CompositorManager_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreResourceManager.h"
+#include "OgreCompositor.h"
+#include "OgreRectangle2D.h"
+#include "OgreRenderSystem.h"
+#include "OgreCompositionTechnique.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Effects
+	*  @{
+	*/
+	/** Class for managing Compositor settings for Ogre. Compositors provide the means
+        to flexibly "composite" the final rendering result from multiple scene renders
+        and intermediate operations like rendering fullscreen quads. This makes
+        it possible to apply postfilter effects, HDRI postprocessing, and shadow
+        effects to a Viewport.
+        @par
+            When loaded from a script, a Compositor is in an 'unloaded' state and only stores the settings
+            required. It does not at that stage load any textures. This is because the material settings may be
+            loaded 'en masse' from bulk material script files, but only a subset will actually be required.
+        @par
+            Because this is a subclass of ResourceManager, any files loaded will be searched for in any path or
+            archive added to the resource paths/archives. See ResourceManager for details.
+    */
+    class _OgreExport CompositorManager : public ResourceManager, public Singleton<CompositorManager>
+    {
+    public:
+        CompositorManager();
+        virtual ~CompositorManager();
+
+        /// Overridden from ResourceManager
+        Resource* createImpl(const String& name, ResourceHandle handle,
+            const String& group, bool isManual, ManualResourceLoader* loader,
+            const NameValuePairList* params);
+
+        /** Initialises the Compositor manager, which also triggers it to
+            parse all available .compositor scripts. */
+        void initialise(void);
+
+		/**
+		 * Create a new compositor
+		 * @see ResourceManager::createResource
+		 */
+		CompositorPtr create (const String& name, const String& group,
+							bool isManual = false, ManualResourceLoader* loader = 0,
+							const NameValuePairList* createParams = 0);
+
+		/// Get a resource by name
+		/// @see ResourceManager::getResourceByName
+		CompositorPtr getByName(const String& name, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME);
+
+
+        /** @see ScriptLoader::parseScript
+        */
+        void parseScript(DataStreamPtr& stream, const String& groupName);
+
+        /** Get the compositor chain for a Viewport. If there is none yet, a new
+			compositor chain is registered.
+			XXX We need a _notifyViewportRemoved to find out when this viewport disappears,
+			so we can destroy its chain as well.
+        */
+        CompositorChain *getCompositorChain(Viewport *vp);
+
+		/** Returns whether exists compositor chain for a viewport.
+        */
+		bool hasCompositorChain(Viewport *vp) const;
+
+		/** Remove the compositor chain from a viewport if exists.
+		*/
+        void removeCompositorChain(Viewport *vp);
+
+		/** Add a compositor to a viewport. By default, it is added to end of the chain,
+			after the other compositors.
+			@param vp			Viewport to modify
+			@param compositor	The name of the compositor to apply
+			@param addPosition	At which position to add, defaults to the end (-1).
+			@return pointer to instance, or 0 if it failed.
+		*/
+		CompositorInstance *addCompositor(Viewport *vp, const String &compositor, int addPosition=-1);
+
+		/** Remove a compositor from a viewport
+		*/
+		void removeCompositor(Viewport *vp, const String &compositor);
+
+		/** Set the state of a compositor on a viewport to enabled or disabled.
+			Disabling a compositor stops it from rendering but does not free any resources.
+			This can be more efficient than using removeCompositor and addCompositor in cases
+			the filter is switched on and off a lot.
+		*/
+		void setCompositorEnabled(Viewport *vp, const String &compositor, bool value);
+
+		/** Get a textured fullscreen 2D rectangle, for internal use.
+		*/
+		Renderable *_getTexturedRectangle2D();
+
+		/** Overridden from ResourceManager since we have to clean up chains too. */
+		void removeAll(void);
+
+		/** Internal method for forcing all active compositors to recreate their resources. */
+		void _reconstructAllCompositorResources();
+
+		typedef set<Texture*>::type UniqueTextureSet;
+
+		/** Utility function to get an existing pooled texture matching a given
+			definition, or creating one if one doesn't exist. It also takes into
+			account whether a pooled texture has already been supplied to this
+			same requester already, in which case it won't give the same texture
+			twice (this is important for example if you request 2 ping-pong textures, 
+			you don't want to get the same texture for both requests!
+		*/
+		TexturePtr getPooledTexture(const String& name, const String& localName, 
+			size_t w, size_t h, 
+			PixelFormat f, uint aa, const String& aaHint, bool srgb, UniqueTextureSet& texturesAlreadyAssigned, 
+			CompositorInstance* inst, CompositionTechnique::TextureScope scope);
+
+		/** Free pooled textures from the shared pool (compositor instances still 
+			using them will keep them in memory though). 
+		*/
+		void freePooledTextures(bool onlyIfUnreferenced = true);
+
+		/** Register a compositor logic for listening in to expecting composition
+			techniques.
+		*/
+		void registerCompositorLogic(const String& name, CompositorLogic* logic);
+
+		/** Removes a listener for compositor logic registered with registerCompositorLogic
+		*/
+		void unregisterCompositorLogic(const String& name);
+		
+		/** Get a compositor logic by its name
+		*/
+		CompositorLogic* getCompositorLogic(const String& name);
+
+		/** Register a custom composition pass.
+		*/
+		void registerCustomCompositionPass(const String& name, CustomCompositionPass* customPass);
+		
+		/** Get a custom composition pass by its name 
+		*/
+		CustomCompositionPass* getCustomCompositionPass(const String& name);
+
+		/** Override standard Singleton retrieval.
+		@remarks
+		Why do we do this? Well, it's because the Singleton
+		implementation is in a .h file, which means it gets compiled
+		into anybody who includes it. This is needed for the
+		Singleton template to work, but we actually only want it
+		compiled into the implementation of the class based on the
+		Singleton, not all of them. If we don't change this, we get
+		link errors when trying to use the Singleton-based class from
+		an outside dll.
+		@par
+		This method just delegates to the template version anyway,
+		but the implementation stays in this single compilation unit,
+		preventing link errors.
+		*/
+		static CompositorManager& getSingleton(void);
+		/** Override standard Singleton retrieval.
+		@remarks
+		Why do we do this? Well, it's because the Singleton
+		implementation is in a .h file, which means it gets compiled
+		into anybody who includes it. This is needed for the
+		Singleton template to work, but we actually only want it
+		compiled into the implementation of the class based on the
+		Singleton, not all of them. If we don't change this, we get
+		link errors when trying to use the Singleton-based class from
+		an outside dll.
+		@par
+		This method just delegates to the template version anyway,
+		but the implementation stays in this single compilation unit,
+		preventing link errors.
+		*/
+		static CompositorManager* getSingletonPtr(void);
+
+	
+	private:
+        typedef map<Viewport*, CompositorChain*>::type Chains;
+        Chains mChains;
+
+        /** Clear composition chains for all viewports
+         */
+        void freeChains();
+
+		Rectangle2D *mRectangle;
+
+		/// List of instances
+		typedef vector<CompositorInstance *>::type Instances;
+		Instances mInstances;
+
+		/// Map of registered compositor logics
+		typedef map<String, CompositorLogic*>::type CompositorLogicMap;
+		CompositorLogicMap mCompositorLogics;
+
+		/// Map of registered custom composition passes
+		typedef map<String, CustomCompositionPass*>::type CustomCompositionPassMap;
+		CustomCompositionPassMap mCustomCompositionPasses;
+
+		typedef vector<TexturePtr>::type TextureList;
+		typedef VectorIterator<TextureList> TextureIterator;
+
+		struct TextureDef
+		{
+			size_t width, height;
+			PixelFormat format;
+			uint fsaa;
+			String fsaaHint;
+			bool sRGBwrite;
+
+			TextureDef(size_t w, size_t h, PixelFormat f, uint aa, const String& aaHint, bool srgb)
+				: width(w), height(h), format(f), fsaa(aa), fsaaHint(aaHint), sRGBwrite(srgb)
+			{
+
+			}
+		};
+		struct TextureDefLess
+		{
+			bool _OgreExport operator()(const TextureDef& x, const TextureDef& y) const
+			{
+				if (x.format < y.format)
+					return true;
+				else if (x.format == y.format)
+				{
+					if (x.width < y.width)
+						return true;
+					else if (x.width == y.width)
+					{
+						if (x.height < y.height)
+							return true;
+						else if (x.height == y.height)
+						{
+							if (x.fsaa < y.fsaa)
+								return true;
+							else if (x.fsaa == y.fsaa)
+							{
+								if (x.fsaaHint < y.fsaaHint)
+									return true;
+								else if (x.fsaaHint == y.fsaaHint)
+								{
+									if (!x.sRGBwrite && y.sRGBwrite)
+										return true;
+								}
+
+							}
+						}
+					}
+				}
+				return false;
+			}
+			virtual ~TextureDefLess() {}
+		};
+		typedef map<TextureDef, TextureList*, TextureDefLess>::type TexturesByDef;
+		TexturesByDef mTexturesByDef;
+
+		typedef std::pair<String, String> StringPair;
+		typedef map<TextureDef, TexturePtr, TextureDefLess>::type TextureDefMap;
+		typedef map<StringPair, TextureDefMap>::type ChainTexturesByDef;
+		
+		ChainTexturesByDef mChainTexturesByDef;
+
+		bool isInputPreviousTarget(CompositorInstance* inst, const Ogre::String& localName);
+		bool isInputPreviousTarget(CompositorInstance* inst, TexturePtr tex);
+		bool isInputToOutputTarget(CompositorInstance* inst, const Ogre::String& localName);
+		bool isInputToOutputTarget(CompositorInstance* inst, TexturePtr tex);
+
+    };
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreConfig.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreConfig.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreConfig.h	(revision 148)
@@ -0,0 +1,187 @@
+/*
+-----------------------------------------------------------------------------
+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 __Config_H_
+#define __Config_H_
+
+// Include the CMake-generated build settings.
+// If you get complaints that this file is missing, then you're probably
+// trying to link directly against your source dir. You must then add
+// %BUILD_DIR%/include to your include search path to find OgreBuildSettings.h.
+#include "OgreBuildSettings.h"
+
+/** If set to 1, profiling code will be included in the application. When you
+	are deploying your application you will probably want to set this to 0 */
+#ifndef OGRE_PROFILING
+#define OGRE_PROFILING 0
+#endif
+
+/** There are three modes for handling asserts in OGRE:
+0 - STANDARD - Standard asserts in debug builds, nothing in release builds
+1 - RELEASE_EXCEPTIONS - Standard asserts in debug builds, exceptions in release builds
+2 - EXCEPTIONS - Exceptions in debug builds, exceptions in release builds
+*/
+#ifndef OGRE_ASSERT_MODE
+#define OGRE_ASSERT_MODE 0
+#endif
+
+/** If set to >0, OGRE will always 'think' that the graphics card only has the
+    number of texture units specified. Very useful for testing multipass fallback.
+*/
+#define OGRE_PRETEND_TEXTURE_UNITS 0
+
+/** If set to 1, Real is typedef'ed to double. Otherwise, Real is typedef'ed
+    to float. Setting this allows you to perform mathematical operations in the
+	CPU (Quaternion, Vector3 etc) with more precision, but bear in mind that the
+	GPU still operates in single-precision mode.
+*/
+#ifndef OGRE_DOUBLE_PRECISION
+#define OGRE_DOUBLE_PRECISION 0
+#endif
+
+/** Define number of texture coordinate sets allowed per vertex.
+*/
+#define OGRE_MAX_TEXTURE_COORD_SETS 8
+
+/** Define max number of texture layers allowed per pass on any card.
+*/
+#define OGRE_MAX_TEXTURE_LAYERS 16
+
+/** Define max number of lights allowed per pass.
+*/
+#define OGRE_MAX_SIMULTANEOUS_LIGHTS 8
+
+/** Define max number of blending weights allowed per vertex.
+*/
+#define OGRE_MAX_BLEND_WEIGHTS 4
+
+// define the memory allocator configuration to use
+#define OGRE_MEMORY_ALLOCATOR_STD 1
+#define OGRE_MEMORY_ALLOCATOR_NED 2
+#define OGRE_MEMORY_ALLOCATOR_USER 3
+#define OGRE_MEMORY_ALLOCATOR_NEDPOOLING 4
+
+#ifndef OGRE_MEMORY_ALLOCATOR
+#  define OGRE_MEMORY_ALLOCATOR OGRE_MEMORY_ALLOCATOR_NEDPOOLING
+#endif
+
+// Whether to use the custom memory allocator in STL containers
+#ifndef OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR
+#  define OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR 1
+#endif
+
+//if you want to make Ogre::String use the custom memory allocator then set:
+//#define OGRE_STRING_USE_CUSTOM_MEMORY_ALLOCATOR 1
+// Doing this will mean Ogre's strings will not be compatible with std::string however
+#ifndef OGRE_STRING_USE_CUSTOM_MEMORY_ALLOCATOR
+#	define OGRE_STRING_USE_CUSTOM_MEMORY_ALLOCATOR 0
+#endif
+
+// enable or disable the memory tracker, recording the memory allocations & tracking leaks
+// default is to disable since it's expensive, but you can enable if needed per build target
+
+#ifndef OGRE_MEMORY_TRACKER_DEBUG_MODE
+#  define OGRE_MEMORY_TRACKER_DEBUG_MODE 0
+#endif
+
+#ifndef OGRE_MEMORY_TRACKER_RELEASE_MODE
+#  define OGRE_MEMORY_TRACKER_RELEASE_MODE 0
+#endif
+/** Define max number of multiple render targets (MRTs) to render to at once.
+*/
+#define OGRE_MAX_MULTIPLE_RENDER_TARGETS 8
+
+/** Support for multithreading, there are 3 options
+
+OGRE_THREAD_SUPPORT = 0
+	No support for threading.		
+OGRE_THREAD_SUPPORT = 1
+	Thread support for background loading, by both loading and constructing resources
+	in a background thread. Resource management and SharedPtr handling becomes
+	thread-safe, and resources may be completely loaded in the background. 
+	The places where threading is available are clearly
+	marked, you should assume state is NOT thread safe unless otherwise
+	stated in relation to this flag.
+OGRE_THREAD_SUPPORT = 2
+	Thread support for background resource preparation. This means that resource
+	data can streamed into memory in the background, but the final resource
+	construction (including RenderSystem dependencies) is still done in the primary
+	thread. Has a lower synchronisation primitive overhead than full threading
+	while still allowing the major blocking aspects of resource management (I/O)
+	to be done in the background.
+*/
+#ifndef OGRE_THREAD_SUPPORT
+#define OGRE_THREAD_SUPPORT 0
+#endif
+#if OGRE_THREAD_SUPPORT != 0 && OGRE_THREAD_SUPPORT != 1 && OGRE_THREAD_SUPPORT != 2
+#define OGRE_THREAD_SUPPORT 0
+#endif
+
+/** Provider for threading functionality, there are 4 options.
+
+OGRE_THREAD_PROVIDER = 0
+	No support for threading.
+OGRE_THREAD_PROVIDER = 1
+	Boost libraries provide threading functionality.
+OGRE_THREAD_PROVIDER = 2
+	Poco libraries provide threading functionality.
+OGRE_THREAD_PROVIDER = 3
+	TBB library provides threading functionality.
+*/
+#ifndef OGRE_THREAD_PROVIDER
+#define OGRE_THREAD_PROVIDER 0
+#endif
+
+/** Disables use of the FreeImage image library for loading images.
+WARNING: Use only when you want to provide your own image loading code via codecs.
+*/
+#ifndef OGRE_NO_FREEIMAGE
+#define OGRE_NO_FREEIMAGE 0
+#endif
+
+/** Disables use of the internal image codec for loading DDS files.
+WARNING: Use only when you want to provide your own image loading code via codecs.
+*/
+#ifndef OGRE_NO_DDS_CODEC
+#define OGRE_NO_DDS_CODEC 0
+#endif
+
+/** Disables use of the internal image codec for loading ETC files.
+ WARNING: Use only when you want to provide your own image loading code via codecs.
+ */
+#ifndef OGRE_NO_ETC_CODEC
+#define OGRE_NO_ETC_CODEC 1
+#endif
+
+/** Disables use of the ZIP archive support.
+WARNING: Disabling this will make the samples unusable.
+*/
+#ifndef OGRE_NO_ZIP_ARCHIVE
+#define OGRE_NO_ZIP_ARCHIVE 0
+#endif
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreConfigDialog.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreConfigDialog.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreConfigDialog.h	(revision 148)
@@ -0,0 +1,59 @@
+/*
+-----------------------------------------------------------------------------
+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 __CommonConfigDialog_H__
+#define __CommonConfigDialog_H__
+
+#include "OgrePrerequisites.h"
+#include "OgrePlatform.h"
+
+// Bring in the specific platform's header file: first allow forced override
+#if defined OGRE_GUI_WIN32
+# include "WIN32/OgreConfigDialogImp.h"
+#elif defined OGRE_GUI_gtk
+# include "gtk/OgreConfigDialogImp.h"
+#elif defined OGRE_GUI_GLX
+# include "GLX/OgreConfigDialogImp.h"
+#elif OGRE_PLATFORM == OGRE_PLATFORM_WIN32
+# include "WIN32/OgreConfigDialogImp.h"
+#elif OGRE_PLATFORM == OGRE_PLATFORM_WINRT
+# include "WIN32/OgreConfigDialogImpWinRT.h"
+#elif OGRE_PLATFORM == OGRE_PLATFORM_LINUX
+# include "GLX/OgreConfigDialogImp.h"
+#elif OGRE_PLATFORM == OGRE_PLATFORM_NACL
+# include "NaCl/OgreConfigDialogImp.h"
+#elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+# include "OSX/OgreConfigDialogImp.h"
+#elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS
+# include "iOS/OgreConfigDialogImp.h"
+#elif OGRE_PLATFORM == OGRE_PLATFORM_ANDROID
+# include "Android/OgreConfigDialogImp.h"
+#elif OGRE_PLATFORM == OGRE_PLATFORM_FLASHCC
+# include "FlashCC/OgreConfigDialogImp.h"
+#endif
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreConfigFile.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreConfigFile.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreConfigFile.h	(revision 148)
@@ -0,0 +1,110 @@
+/*
+-----------------------------------------------------------------------------
+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 __ConfigFile_H__
+#define __ConfigFile_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreString.h"
+#include "OgreStringVector.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreDataStream.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+	/** Class for quickly loading settings from a text file.
+        @remarks
+            This class is designed to quickly parse a simple file containing
+            key/value pairs, mainly for use in configuration settings.
+        @par
+            This is a very simplified approach, no multiple values per key
+            are allowed, no grouping or context is being kept etc.
+        @par
+            By default the key/values pairs are tokenised based on a
+            separator of Tab, the colon (:) or equals (=) character. Each
+            key - value pair must end in a carriage return.
+        @par
+            Settings can be optionally grouped in sections, using a header
+            beforehand of the form [SectionName]. 
+    */
+	class _OgreExport ConfigFile : public ConfigAlloc
+    {
+    public:
+
+        ConfigFile();
+        virtual ~ConfigFile();
+        /// load from a filename (not using resource group locations)
+        void load(const String& filename, const String& separators = "\t:=", bool trimWhitespace = true);
+        /// load from a data stream
+        void load(const DataStreamPtr& stream, const String& separators = "\t:=", bool trimWhitespace = true);
+		/// load from a filename (not using resource group locations)
+		void loadDirect(const String& filename, const String& separators = "\t:=", bool trimWhitespace = true);
+		/// load from a filename (using resource group locations)
+		void loadFromResourceSystem(const String& filename, const String& resourceGroup, const String& separators = "\t:=", bool trimWhitespace = true);
+
+        /** Gets the first setting from the file with the named key. 
+        @param key The name of the setting
+        @param section The name of the section it must be in (if any)
+		@param defaultValue The value to return if the setting is not found
+        */
+        String getSetting(const String& key, const String& section = StringUtil::BLANK, const String& defaultValue = StringUtil::BLANK) const;
+        /** Gets all settings from the file with the named key. */
+        StringVector getMultiSetting(const String& key, const String& section = StringUtil::BLANK) const;
+
+        typedef multimap<String, String>::type SettingsMultiMap;
+        typedef MapIterator<SettingsMultiMap> SettingsIterator;
+        /** Gets an iterator for stepping through all the keys / values in the file. */
+        typedef map<String, SettingsMultiMap*>::type SettingsBySection;
+        typedef MapIterator<SettingsBySection> SectionIterator;
+        /** Get an iterator over all the available sections in the config file */
+        SectionIterator getSectionIterator(void);
+        /** Get an iterator over all the available settings in a section */
+        SettingsIterator getSettingsIterator(const String& section = StringUtil::BLANK);
+
+
+        
+        /** Clear the settings */
+        void clear(void);
+    protected:
+        SettingsBySection mSettings;
+    };
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreConfigOptionMap.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreConfigOptionMap.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreConfigOptionMap.h	(revision 148)
@@ -0,0 +1,63 @@
+/*
+-----------------------------------------------------------------------------
+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 _ConfigOptionMap_H__
+#define _ConfigOptionMap_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreStringVector.h"
+#include "OgreString.h"
+
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+	/** Packages the details of a configuration option.
+        @remarks
+            Used for RenderSystem::getConfigOptions. If immutable is true, this
+            option must be disabled for modifying.
+    */
+    typedef struct _ConfigOption
+    {
+        String name;
+        String currentValue;
+        StringVector possibleValues;
+        bool immutable;
+    } ConfigOption;
+
+    typedef map< String, ConfigOption >::type ConfigOptionMap;
+	/** @} */
+	/** @} */
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreController.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreController.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreController.h	(revision 148)
@@ -0,0 +1,233 @@
+/*
+-----------------------------------------------------------------------------
+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 __Controller_H__
+#define __Controller_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreSharedPtr.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+	
+	
+	/** Subclasses of this class are responsible for performing a function on an input value for a Controller.
+        @remarks
+            This abstract class provides the interface that needs to be supported for a custom function which
+            can be 'plugged in' to a Controller instance, which controls some object value based on an input value.
+            For example, the WaveControllerFunction class provided by Ogre allows you to use various waveforms to
+            translate an input value to an output value.
+        @par
+            You are free to create your own subclasses in order to define any function you wish.
+    */
+	template <typename T>
+	class ControllerFunction : public ControllerAlloc
+    {
+    protected:
+        /// If true, function will add input values together and wrap at 1.0 before evaluating
+        bool mDeltaInput;
+        T mDeltaCount;
+
+        /** Gets the input value as adjusted by any delta.
+        */
+        T getAdjustedInput(T input)
+        {
+            if (mDeltaInput)
+            {
+                mDeltaCount += input;
+                // Wrap
+                while (mDeltaCount >= 1.0)
+                    mDeltaCount -= 1.0;
+                while (mDeltaCount < 0.0)
+                    mDeltaCount += 1.0;
+
+                return mDeltaCount;
+            }
+            else
+			{
+                return input;
+            }
+        }
+
+    public:
+        /** Constructor.
+            @param
+                deltaInput If true, signifies that the input will be a delta value such that the function should
+                add it to an internal counter before calculating the output.
+        */
+        ControllerFunction(bool deltaInput)
+        {
+            mDeltaInput = deltaInput;
+            mDeltaCount = 0;
+        }
+
+		virtual ~ControllerFunction() {}
+
+        virtual T calculate(T sourceValue) = 0;
+    };
+
+
+    /** Can either be used as an input or output value.
+    */
+	template <typename T>
+	class ControllerValue : public ControllerAlloc
+    {
+
+    public:
+        virtual ~ControllerValue() { }
+        virtual T getValue(void) const = 0;
+        virtual void setValue(T value) = 0;
+
+    };
+
+    /** Instances of this class 'control' the value of another object in the system.
+        @remarks
+            Controller classes are used to manage the values of object automatically based
+            on the value of some input. For example, a Controller could animate a texture
+            by controlling the current frame of the texture based on time, or a different Controller
+            could change the colour of a material used for a spaceship shield mesh based on the remaining
+            shield power level of the ship.
+        @par
+            The Controller is an intentionally abstract concept - it can generate values
+            based on input and a function, which can either be one of the standard ones
+            supplied, or a function can be 'plugged in' for custom behaviour - see the ControllerFunction class for details.
+            Both the input and output values are via ControllerValue objects, meaning that any value can be both
+            input and output of the controller.
+        @par
+            Whilst this is very flexible, it can be a little bit confusing so to make it simpler the most often used
+            controller setups are available by calling methods on the ControllerManager object.
+        @see
+            ControllerFunction
+
+    */
+	template <typename T>
+	class Controller : public ControllerAlloc
+    {
+    protected:
+        /// Source value
+        SharedPtr< ControllerValue<T> > mSource;
+        /// Destination value
+        SharedPtr< ControllerValue<T> > mDest;
+        /// Function
+        SharedPtr< ControllerFunction<T> > mFunc;
+		/// Controller is enabled or not
+        bool mEnabled;
+
+
+    public:
+
+        /** Usual constructor.
+            @remarks
+                Requires source and destination values, and a function object. None of these are destroyed
+                with the Controller when it is deleted (they can be shared) so you must delete these as appropriate.
+        */
+        Controller(const SharedPtr< ControllerValue<T> >& src, 
+			const SharedPtr< ControllerValue<T> >& dest, const SharedPtr< ControllerFunction<T> >& func)
+			: mSource(src), mDest(dest), mFunc(func)
+		{
+			mEnabled = true;
+		}
+
+        /** Default d-tor.
+        */
+		virtual ~Controller() {}
+
+
+		/// Sets the input controller value
+        void setSource(const SharedPtr< ControllerValue<T> >& src)
+		{
+			mSource = src;
+		}
+		/// Gets the input controller value
+        const SharedPtr< ControllerValue<T> >& getSource(void) const
+		{
+			return mSource;
+		}
+		/// Sets the output controller value
+        void setDestination(const SharedPtr< ControllerValue<T> >& dest)
+		{
+			mDest = dest;
+		}
+
+		/// Gets the output controller value
+        const SharedPtr< ControllerValue<T> >& getDestination(void) const
+		{
+			return mDest;
+		}
+
+        /// Returns true if this controller is currently enabled
+        bool getEnabled(void) const
+		{
+			return mEnabled;
+		}
+
+        /// Sets whether this controller is enabled
+        void setEnabled(bool enabled)
+		{
+			mEnabled = enabled;
+		}
+
+        /** Sets the function object to be used by this controller.
+        */
+        void setFunction(const SharedPtr< ControllerFunction<T> >& func)
+		{
+			mFunc = func;
+		}
+
+        /** Returns a pointer to the function object used by this controller.
+        */
+        const SharedPtr< ControllerFunction<T> >& getFunction(void) const
+		{
+			return mFunc;
+		}
+
+		/** Tells this controller to map it's input controller value
+		    to it's output controller value, via the controller function. 
+		@remarks
+			This method is called automatically every frame by ControllerManager.
+		*/
+		void update(void)
+		{
+			if(mEnabled)
+				mDest->setValue(mFunc->calculate(mSource->getValue()));
+		}
+
+    };
+
+	/** @} */
+	/** @} */
+
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreControllerManager.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreControllerManager.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreControllerManager.h	(revision 148)
@@ -0,0 +1,304 @@
+/*
+-----------------------------------------------------------------------------
+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 __ControllerManager_H__
+#define __ControllerManager_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreCommon.h"
+#include "OgreSingleton.h"
+#include "OgreController.h"
+#include "OgrePredefinedControllers.h"
+#include "OgreTextureUnitState.h"
+#include "OgreSharedPtr.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+    /** \addtogroup Core
+    *  @{
+    */
+    /** \addtogroup General
+    *  @{
+    */
+
+    typedef SharedPtr< ControllerValue<Real> > ControllerValueRealPtr;
+    typedef SharedPtr< ControllerFunction<Real> > ControllerFunctionRealPtr;
+
+    /** Class for managing Controller instances.
+    @remarks
+        This class is responsible to keeping tabs on all the Controller instances registered
+        and updating them when requested. It also provides a number of convenience methods
+        for creating commonly used controllers (such as texture animators).
+    */
+    class _OgreExport ControllerManager : public Singleton<ControllerManager>, public ControllerAlloc
+    {
+    protected:
+        typedef set<Controller<Real>*>::type ControllerList;
+        ControllerList mControllers;
+
+        /// Global predefined controller
+        ControllerValueRealPtr mFrameTimeController;
+        
+        /// Global predefined controller
+        ControllerFunctionRealPtr mPassthroughFunction;
+
+        /// Last frame number updated
+        unsigned long mLastFrameNumber;
+
+    public:
+        ControllerManager();
+        ~ControllerManager();
+
+        /** Creates a new controller and registers it with the manager.
+        */
+        Controller<Real>* createController(const ControllerValueRealPtr& src,
+            const ControllerValueRealPtr& dest, const ControllerFunctionRealPtr& func);
+
+        /** Creates a new controller use frame time source and passthrough controller function.
+        */
+        Controller<Real>* createFrameTimePassthroughController(
+            const ControllerValueRealPtr& dest);
+
+        /** Destroys all the controllers in existence.
+        */
+        void clearControllers(void);
+
+        /** Updates all the registered controllers.
+        */
+        void updateAllControllers(void);
+
+
+        /** Returns a ControllerValue which provides the time since the last frame as a control value source.
+        @remarks
+            A common source value to use to feed into a controller is the time since the last frame. This method
+            returns a pointer to a common source value which provides this information.
+        @par
+            Remember the value will only be up to date after the RenderSystem::beginFrame method is called.
+        @see
+            RenderSystem::beginFrame
+        */
+        const ControllerValueRealPtr& getFrameTimeSource(void) const;
+
+        /** Retrieve a simple passthrough controller function. */
+        const ControllerFunctionRealPtr& getPassthroughControllerFunction(void) const;
+
+        /** Creates a texture layer animator controller.
+        @remarks
+            This helper method creates the Controller, ControllerValue and ControllerFunction classes required
+            to animate a texture.
+        @param layer
+            TextureUnitState object to animate
+        @param sequenceTime
+            The amount of time in seconds it will take to loop through all the frames.
+        */
+        Controller<Real>* createTextureAnimator(TextureUnitState* layer, Real sequenceTime);
+
+        /** Creates a basic time-based texture uv coordinate modifier designed for creating scrolling textures.
+        @remarks
+            This simple method allows you to easily create constant-speed uv scrolling textures. If you want to 
+            specify different speed values for horizontal and vertical scroll, use the specific methods
+            ControllerManager::createTextureUScroller and ControllerManager::createTextureVScroller.
+            If you want more control, look up the ControllerManager::createTextureWaveTransformer 
+            for more complex wave-based scrollers / stretchers / rotators.
+        @param layer
+            The texture layer to animate.
+        @param speed
+            Speed of horizontal (u-coord) and vertical (v-coord) scroll, in complete wraps per second.
+        */
+        Controller<Real>* createTextureUVScroller(TextureUnitState* layer, Real speed);
+
+        /** Creates a basic time-based texture u coordinate modifier designed for creating scrolling textures.
+        @remarks
+            This simple method allows you to easily create constant-speed u scrolling textures. If you want more
+            control, look up the ControllerManager::createTextureWaveTransformer for more complex wave-based
+            scrollers / stretchers / rotators.
+        @param layer
+            The texture layer to animate.
+        @param uSpeed
+            Speed of horizontal (u-coord) scroll, in complete wraps per second.
+        */
+        Controller<Real>* createTextureUScroller(TextureUnitState* layer, Real uSpeed);
+
+        /** Creates a basic time-based texture v coordinate modifier designed for creating scrolling textures.
+        @remarks
+            This simple method allows you to easily create constant-speed v scrolling textures. If you want more
+            control, look up the ControllerManager::createTextureWaveTransformer for more complex wave-based
+            scrollers / stretchers / rotators.
+        @param layer
+            The texture layer to animate.
+        @param vSpeed
+            Speed of vertical (v-coord) scroll, in complete wraps per second.
+        */
+        Controller<Real>* createTextureVScroller(TextureUnitState* layer, Real vSpeed);
+
+        /** Creates a basic time-based texture coordinate modifier designed for creating rotating textures.
+        @return
+            This simple method allows you to easily create constant-speed rotating textures. If you want more
+            control, look up the ControllerManager::createTextureWaveTransformer for more complex wave-based
+            scrollers / stretchers / rotators.
+        @param layer
+            The texture layer to rotate.
+        @param speed
+            Speed of rotation, in complete anticlockwise revolutions per second.
+        */
+        Controller<Real>* createTextureRotater(TextureUnitState* layer, Real speed);
+
+        /** Creates a very flexible time-based texture transformation which can alter the scale, position or
+            rotation of a texture based on a wave function.
+        @param layer
+            The texture layer to affect.
+        @param ttype
+            The type of transform, either translate (scroll), scale (stretch) or rotate (spin).
+        @param waveType
+            The shape of the wave, see WaveformType enum for details.
+        @param base
+            The base value of the output.
+        @param frequency
+            The speed of the wave in cycles per second.
+        @param phase
+            The offset of the start of the wave, e.g. 0.5 to start half-way through the wave.
+        @param amplitude
+            Scales the output so that instead of lying within 0..1 it lies within 0..1*amplitude for exaggerated effects.
+        */
+        Controller<Real>* createTextureWaveTransformer(TextureUnitState* layer, TextureUnitState::TextureTransformType ttype,
+            WaveformType waveType, Real base = 0, Real frequency = 1, Real phase = 0, Real amplitude = 1);
+
+        /** Creates a controller for passing a frame time value through to a vertex / fragment program parameter.
+        @remarks
+            The destination parameter is expected to be a float, and the '.x' attribute will be populated
+            with the appropriately scaled time value.
+        @param params
+            The parameters to update.
+        @param paramIndex
+            The index of the parameter to update; if you want a named parameter, then
+            retrieve the index beforehand using GpuProgramParameters::getParamIndex.
+        @param timeFactor
+            The factor by which to adjust the time elapsed by before passing it to the program.
+        */
+        Controller<Real>* createGpuProgramTimerParam(GpuProgramParametersSharedPtr params, size_t paramIndex,
+            Real timeFactor = 1.0f);
+
+        /** Removes & destroys the controller passed in as a pointer.
+        */
+        void destroyController(Controller<Real>* controller);
+
+        /** Return relative speed of time as perceived by time based controllers.
+        @remarks
+            See setTimeFactor for full information on the meaning of this value.
+        */
+        Real getTimeFactor(void) const;
+
+        /** Set the relative speed to update frame time based controllers.
+        @remarks
+            Normally any controllers which use time as an input (FrameTimeController) are updated
+            automatically in line with the real passage of time. This method allows you to change
+            that, so that controllers are told that the time is passing slower or faster than it
+            actually is. Use this to globally speed up / slow down the effect of time-based controllers.
+        @param tf
+            The virtual speed of time (1.0 is real time).
+        */
+        void setTimeFactor(Real tf);
+
+        /** Gets the constant that is added to time lapsed between each frame.
+        @remarks
+            See setFrameDelay for full information on the meaning of this value.
+        */
+        Real getFrameDelay(void) const;
+
+        /** Sets a constant frame rate.
+        @remarks
+            This function is useful when rendering a sequence to
+            files that should create a film clip with constant frame
+            rate.
+            It will ensure that scrolling textures and animations
+            move at a constant frame rate.
+        @param fd
+            The delay in seconds wanted between each frame 
+            (1.0f / 25.0f means a seconds worth of animation is done 
+            in 25 frames).
+        */
+        void setFrameDelay(Real fd);
+
+        /** Return the elapsed time.
+        @remarks
+            See setElapsedTime for full information on the meaning of this value.
+        */
+        Real getElapsedTime(void) const;
+
+        /** Set the elapsed time.
+        @remarks
+            Normally elapsed time accumulated all frames time (which speed relative to time
+            factor) since the rendering loop started. This method allows your to change that to
+            special time, so some elapsed-time-based globally effect is repeatable.
+        @param elapsedTime
+            The new elapsed time.
+        */
+        void setElapsedTime(Real elapsedTime);
+
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static ControllerManager& getSingleton(void);
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static ControllerManager* getSingletonPtr(void);
+    };
+
+    /** @} */
+    /** @} */
+
+} // namespace Ogre
+
+#include "OgreHeaderSuffix.h"
+
+#endif // __ControllerManager_H__
Index: /ogre_src_v1-9-0/OgreMain/include/OgreConvexBody.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreConvexBody.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreConvexBody.h	(revision 148)
@@ -0,0 +1,266 @@
+/*
+-----------------------------------------------------------------------------
+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
+Copyright (c) 2006 Matthias Fink, netAllied GmbH <matthias.fink@web.de>								
+
+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 __ConvexBody_H__
+#define __ConvexBody_H__
+
+#include "OgrePrerequisites.h"
+#include "OgrePolygon.h"
+#if OGRE_THREAD_SUPPORT
+#include "Threading/OgreThreadHeaders.h"
+#endif
+#include "OgreHeaderPrefix.h"
+
+
+namespace Ogre
+{
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Math
+	*  @{
+	*/
+	/** Holds a solid representation of a convex body.
+		@remarks
+			Administers a convex body. All polygons of the body are convex and
+			planar. Several operations may be applied, ranging from intersection
+			to join where each result it itself a convex body.
+	*/
+	class _OgreExport ConvexBody
+	{
+	public:
+		typedef vector< Polygon* >::type	PolygonList;
+
+	protected:
+		PolygonList mPolygons;
+
+		// Static 'free list' of polygons to save reallocation, shared between all bodies
+		static PolygonList msFreePolygons;
+#if OGRE_THREAD_SUPPORT
+		OGRE_STATIC_MUTEX(msFreePolygonsMutex);
+#endif
+
+	public:
+		ConvexBody();
+		~ConvexBody();
+		ConvexBody( const ConvexBody& cpy );
+
+		/** Build a new polygon representation from a frustum.
+		*/
+		void define(const Frustum& frustum);
+
+		/** Build a new polygon representation from an AAB.
+		*/
+		void define(const AxisAlignedBox& aab);
+
+		/** Clips the body with a frustum. The resulting holes
+			are filled with new polygons.
+		*/
+		void clip( const Frustum& frustum );
+
+		/** Clips the body with an AAB. The resulting holes
+			are filled with new polygons.
+		*/
+		void clip( const AxisAlignedBox& aab );
+
+		/** Clips the body with another body.
+		*/
+		void clip(const ConvexBody& body);
+
+		/** Clips the object by the positive half space of a plane
+		*/
+		void clip(const Plane& pl, bool keepNegative = true);
+
+		/** Extends the existing body to incorporate the passed in point as a
+			convex hull.
+		@remarks
+			You must already have constructed a basic body using a 'construct' 
+			method.
+		*/
+		void extend(const Vector3& pt);
+
+		/** Resets the object.
+		*/
+		void reset( void );
+
+		/** Returns the current number of polygons.
+		*/
+		size_t getPolygonCount( void ) const;
+
+		/** Returns the number of vertices for a polygon
+		*/
+		size_t getVertexCount( size_t poly ) const;
+
+		/** Returns a polygon.
+		*/
+		const Polygon& getPolygon( size_t poly ) const;
+
+		/** Returns a specific vertex of a polygon.
+		*/
+		const Vector3& getVertex( size_t poly, size_t vertex ) const;
+
+		/** Returns the normal of a specified polygon.
+		*/
+		const Vector3& getNormal( size_t poly );
+
+		/** Returns an AABB representation.
+		*/
+		AxisAlignedBox getAABB( void ) const;
+
+		/** Checks if the body has a closed hull.
+		*/
+		bool hasClosedHull( void ) const;
+
+		/** Merges all neighboring polygons into one single polygon if they are
+			lay in the same plane.
+		*/
+		void mergePolygons( void );
+
+		/** Determines if the current object is equal to the compared one.
+		*/
+		bool operator == ( const ConvexBody& rhs ) const;
+
+		/** Determines if the current object is not equal to the compared one.
+		*/
+		bool operator != ( const ConvexBody& rhs ) const
+		{ return !( *this == rhs ); }
+
+		/** Prints out the body with all its polygons.
+		*/
+		_OgreExport friend std::ostream& operator<< ( std::ostream& strm, const ConvexBody& body );
+
+		/** Log details of this body */
+		void logInfo() const;
+
+		/// Initialise the internal polygon pool used to minimise allocations
+		static void _initialisePool();
+		/// Tear down the internal polygon pool used to minimise allocations
+		static void _destroyPool();
+
+
+	protected:
+		/** Get a new polygon from the pool.
+		*/
+		static Polygon* allocatePolygon();
+		/** Release a polygon back tot he pool. */
+		static void freePolygon(Polygon* poly);
+		/** Inserts a polygon at a particular point in the body.
+		@note
+			After this method is called, the ConvexBody 'owns' this Polygon
+			and will be responsible for deleting it.
+		*/
+		void insertPolygon(Polygon* pdata, size_t poly);
+		/** Inserts a polygon at the end.
+		@note
+			After this method is called, the ConvexBody 'owns' this Polygon
+			and will be responsible for deleting it.
+		*/
+		void insertPolygon(Polygon* pdata);
+
+		/** Inserts a vertex for a polygon at a particular point.
+		@note
+			No checks are done whether the assembled polygon is (still) planar, 
+			the caller must ensure that this is the case.
+		*/
+		void insertVertex(size_t poly, const Vector3& vdata, size_t vertex);
+		/** Inserts a vertex for a polygon at the end.
+		@note
+			No checks are done whether the assembled polygon is (still) planar, 
+			the caller must ensure that this is the case.
+		*/
+		void insertVertex(size_t poly, const Vector3& vdata);
+		/** Deletes a specific polygon.
+		*/
+		void deletePolygon(size_t poly);
+
+		/** Removes a specific polygon from the body without deleting it.
+		@note
+			The retrieved polygon needs to be deleted later by the caller.
+		*/
+		Polygon* unlinkPolygon(size_t poly);
+
+		/** Moves all polygons from the parameter body to this instance.
+		@note Both the passed in object and this instance are modified
+		*/
+		void moveDataFromBody(ConvexBody& body);
+
+		/** Deletes a specific vertex of a specific polygon.
+		*/
+		void deleteVertex(size_t poly, size_t vertex);
+
+		/** Replace a polygon at a particular index.
+		@note Again, the passed in polygon is owned by this object after this
+			call returns, and this object is resonsible for deleting it.
+		*/
+		void setPolygon(Polygon* pdata, size_t poly );
+
+		/** Replace a specific vertex of a polygon.
+		@note
+			No checks are done whether the assembled polygon is (still) planar, 
+			the caller must ensure that this is the case.
+		*/
+		void setVertex( size_t poly, const Vector3& vdata, size_t vertex );
+
+		/** Returns the single edges in an EdgeMap (= edges where one side is a vertex and the
+			other is empty space (a hole in the body)).
+		*/
+		Polygon::EdgeMap getSingleEdges() const;
+
+		/** Stores the edges of a specific polygon in a passed in structure.
+		*/
+		void storeEdgesOfPolygon(size_t poly, Polygon::EdgeMap *edgeMap) const;
+			
+		/** Allocates space for an specified amount of polygons with
+			each of them having a specified number of vertices.
+			@note
+				Old data (if available) will be erased.
+		*/
+		void allocateSpace(size_t numPolygons, size_t numVertices);
+
+		/** Searches for a pair (an edge) in the intersectionList with an entry
+			that equals vec, and removes it from the passed in list.
+		@param vec The vertex to search for in intersectionEdges
+		@param intersectionEdges A list of edges, which is updated if a match is found
+		@param vNext A reference to a vector which will be filled with the other
+			vertex at the matching edge, if found.
+		@return True if a match was found
+		*/
+		bool findAndEraseEdgePair(const Vector3& vec, 
+			Polygon::EdgeMap& intersectionEdges, Vector3& vNext ) const;
+
+	};
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif 
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreCustomCompositionPass.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreCustomCompositionPass.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreCustomCompositionPass.h	(revision 148)
@@ -0,0 +1,65 @@
+/*
+-----------------------------------------------------------------------------
+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 __CustomCompositionPass_H__
+#define __CustomCompositionPass_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreCompositionPass.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Effects
+	*  @{
+	*/
+	/** Interface for custom composition passes, allowing custom operations (in addition to
+	*	the quad, scene and clear operations) in composition passes.
+	*	@see CompositorManager::registerCustomCompositionPass
+    */
+    class _OgreExport CustomCompositionPass
+    {
+	public:
+		/** Create a custom composition operation.
+			@param pass The CompositionPass that triggered the request
+			@param instance The compositor instance that this operation will be performed in
+			@remarks This call only happens once during creation. The RenderSystemOperation will
+			get called each render.
+			@remarks The created operation must be instanciated using the OGRE_NEW macro.
+		*/
+		virtual CompositorInstance::RenderSystemOperation* createOperation(
+			CompositorInstance* instance, const CompositionPass* pass) = 0;
+
+	protected:
+		virtual ~CustomCompositionPass() {}
+	};
+	/** @} */
+	/** @} */
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreDDSCodec.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreDDSCodec.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreDDSCodec.h	(revision 148)
@@ -0,0 +1,99 @@
+/*
+-----------------------------------------------------------------------------
+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 __OgreDDSCodec_H__
+#define __OgreDDSCodec_H__
+
+#include "OgreImageCodec.h"
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Image
+	*  @{
+	*/
+
+	// Forward declarations
+	struct DXTColourBlock;
+	struct DXTExplicitAlphaBlock;
+	struct DXTInterpolatedAlphaBlock;
+
+    /** Codec specialized in loading DDS (Direct Draw Surface) images.
+	@remarks
+		We implement our own codec here since we need to be able to keep DXT
+		data compressed if the card supports it.
+    */
+    class _OgreExport DDSCodec : public ImageCodec
+    {
+    private:
+        String mType;
+
+    	void flipEndian(void * pData, size_t size, size_t count) const;
+	    void flipEndian(void * pData, size_t size) const;
+
+		PixelFormat convertFourCCFormat(uint32 fourcc) const;
+		PixelFormat convertDXToOgreFormat(uint32 fourcc) const;
+		PixelFormat convertPixelFormat(uint32 rgbBits, uint32 rMask,
+			uint32 gMask, uint32 bMask, uint32 aMask) const;
+
+		/// Unpack DXT colours into array of 16 colour values
+		void unpackDXTColour(PixelFormat pf, const DXTColourBlock& block, ColourValue* pCol) const;
+		/// Unpack DXT alphas into array of 16 colour values
+		void unpackDXTAlpha(const DXTExplicitAlphaBlock& block, ColourValue* pCol) const;
+		/// Unpack DXT alphas into array of 16 colour values
+		void unpackDXTAlpha(const DXTInterpolatedAlphaBlock& block, ColourValue* pCol) const;
+
+		/// Single registered codec instance
+		static DDSCodec* msInstance;
+	public:
+        DDSCodec();
+        virtual ~DDSCodec() { }
+
+        /// @copydoc Codec::encode
+        DataStreamPtr encode(MemoryDataStreamPtr& input, CodecDataPtr& pData) const;
+        /// @copydoc Codec::encodeToFile
+        void encodeToFile(MemoryDataStreamPtr& input, const String& outFileName, CodecDataPtr& pData) const;
+        /// @copydoc Codec::decode
+        DecodeResult decode(DataStreamPtr& input) const;
+		/// @copydoc Codec::magicNumberToFileExt
+		String magicNumberToFileExt(const char *magicNumberPtr, size_t maxbytes) const;
+        
+        virtual String getType() const;        
+
+		/// Static method to startup and register the DDS codec
+		static void startup(void);
+		/// Static method to shutdown and unregister the DDS codec
+		static void shutdown(void);
+
+    };
+	/** @} */
+	/** @} */
+
+} // namespace
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreDataStream.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreDataStream.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreDataStream.h	(revision 148)
@@ -0,0 +1,668 @@
+/*
+-----------------------------------------------------------------------------
+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 __DataStream_H__
+#define __DataStream_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreString.h"
+#include "OgreSharedPtr.h"
+#include <istream>
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+	
+	/** Template version of cache based on static array.
+	 'cacheSize' defines size of cache in bytes. */
+	template <size_t cacheSize>
+	class StaticCache
+	{
+	protected:
+		/// Static buffer
+		char mBuffer[cacheSize];
+		
+		/// Number of bytes valid in cache (written from the beginning of static buffer)
+		size_t mValidBytes;
+		/// Current read position
+		size_t mPos;
+		
+	public:
+		/// Constructor
+		StaticCache()
+		{
+			mValidBytes = 0;
+			mPos = 0;
+		}
+		
+		/** Cache data pointed by 'buf'. If 'count' is greater than cache size, we cache only last bytes.
+		 Returns number of bytes written to cache. */
+		size_t cacheData(const void* buf, size_t count)
+		{
+			assert(avail() == 0 && "It is assumed that you cache data only after you have read everything.");
+			
+			if (count < cacheSize)
+			{
+				// number of bytes written is less than total size of cache
+				if (count + mValidBytes <= cacheSize)
+				{
+					// just append
+					memcpy(mBuffer + mValidBytes, buf, count);
+					mValidBytes += count;
+				}
+				else
+				{
+					size_t begOff = count - (cacheSize - mValidBytes);
+					// override old cache content in the beginning
+					memmove(mBuffer, mBuffer + begOff, mValidBytes - begOff);
+					// append new data
+					memcpy(mBuffer + cacheSize - count, buf, count);
+					mValidBytes = cacheSize;
+				}
+				mPos = mValidBytes;
+				return count;
+			}
+			else
+			{
+				// discard all
+				memcpy(mBuffer, (const char*)buf + count - cacheSize, cacheSize);
+				mValidBytes = mPos = cacheSize;
+				return cacheSize;
+			}
+		}
+		/** Read data from cache to 'buf' (maximum 'count' bytes). Returns number of bytes read from cache. */
+		size_t read(void* buf, size_t count)
+		{
+			size_t rb = avail();
+			rb = (rb < count) ? rb : count;
+			memcpy(buf, mBuffer + mPos, rb);
+			mPos += rb;
+			return rb;
+		}
+		
+		/** Step back in cached stream by 'count' bytes. Returns 'true' if cache contains resulting position. */
+		bool rewind(size_t count)
+		{
+			if (mPos < count)
+			{
+				clear();
+				return false;
+			}
+			else
+			{
+				mPos -= count;
+				return true;
+			}
+		}
+		/** Step forward in cached stream by 'count' bytes. Returns 'true' if cache contains resulting position. */
+		bool ff(size_t count)
+		{
+			if (avail() < count)
+			{
+				clear();
+				return false;
+			}
+			else
+			{
+				mPos += count;
+				return true;
+			}
+		}
+		
+		/** Returns number of bytes available for reading in cache after rewinding. */
+		size_t avail() const
+		{
+			return mValidBytes - mPos;
+		}
+		
+		/** Clear the cache */
+		void clear()
+		{
+			mValidBytes = 0;
+			mPos = 0;
+		}
+	};
+	
+	
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Resources
+	*  @{
+	*/
+
+	/** General purpose class used for encapsulating the reading and writing of data.
+	@remarks
+		This class performs basically the same tasks as std::basic_istream, 
+		except that it does not have any formatting capabilities, and is
+		designed to be subclassed to receive data from multiple sources,
+		including libraries which have no compatibility with the STL's
+		stream interfaces. As such, this is an abstraction of a set of 
+		wrapper classes which pretend to be standard stream classes but 
+		can actually be implemented quite differently. 
+	@par
+		Generally, if a plugin or application provides an ArchiveFactory, 
+		it should also provide a DataStream subclass which will be used
+		to stream data out of that Archive implementation, unless it can 
+		use one of the common implementations included.
+	@note
+		Ogre makes no guarantees about thread safety, for performance reasons.
+		If you wish to access stream data asynchronously then you should
+		organise your own mutexes to avoid race conditions. 
+	*/
+	class _OgreExport DataStream : public StreamAlloc
+	{
+	public:
+		enum AccessMode
+		{
+			READ = 1, 
+			WRITE = 2
+		};
+	protected:
+		/// The name (e.g. resource name) that can be used to identify the source for this data (optional)
+		String mName;		
+        /// Size of the data in the stream (may be 0 if size cannot be determined)
+        size_t mSize;
+		/// What type of access is allowed (AccessMode)
+		uint16 mAccess;
+
+        #define OGRE_STREAM_TEMP_SIZE 128
+	public:
+		/// Constructor for creating unnamed streams
+        DataStream(uint16 accessMode = READ) : mSize(0), mAccess(accessMode) {}
+		/// Constructor for creating named streams
+		DataStream(const String& name, uint16 accessMode = READ) 
+			: mName(name), mSize(0), mAccess(accessMode) {}
+		/// Returns the name of the stream, if it has one.
+		const String& getName(void) { return mName; }
+		/// Gets the access mode of the stream
+		uint16 getAccessMode() const { return mAccess; }
+		/** Reports whether this stream is readable. */
+		virtual bool isReadable() const { return (mAccess & READ) != 0; }
+		/** Reports whether this stream is writeable. */
+		virtual bool isWriteable() const { return (mAccess & WRITE) != 0; }
+        virtual ~DataStream() {}
+		// Streaming operators
+        template<typename T> DataStream& operator>>(T& val);
+		/** Read the requisite number of bytes from the stream, 
+			stopping at the end of the file.
+		@param buf Reference to a buffer pointer
+		@param count Number of bytes to read
+		@return The number of bytes read
+		*/
+		virtual size_t read(void* buf, size_t count) = 0;
+		/** Write the requisite number of bytes from the stream (only applicable to 
+			streams that are not read-only)
+		@param buf Pointer to a buffer containing the bytes to write
+		@param count Number of bytes to write
+		@return The number of bytes written
+		*/
+		virtual size_t write(const void* buf, size_t count)
+		{
+                        (void)buf;
+                        (void)count;
+			// default to not supported
+			return 0;
+		}
+
+		/** Get a single line from the stream.
+		@remarks
+			The delimiter character is not included in the data
+			returned, and it is skipped over so the next read will occur
+			after it. The buffer contents will include a
+			terminating character.
+        @note
+            If you used this function, you <b>must</b> open the stream in <b>binary mode</b>,
+            otherwise, it'll produce unexpected results.
+		@param buf Reference to a buffer pointer
+		@param maxCount The maximum length of data to be read, excluding the terminating character
+		@param delim The delimiter to stop at
+		@return The number of bytes read, excluding the terminating character
+		*/
+		virtual size_t readLine(char* buf, size_t maxCount, const String& delim = "\n");
+		
+	    /** Returns a String containing the next line of data, optionally 
+		    trimmed for whitespace. 
+	    @remarks
+		    This is a convenience method for text streams only, allowing you to 
+		    retrieve a String object containing the next line of data. The data
+		    is read up to the next newline character and the result trimmed if
+		    required.
+        @note
+            If you used this function, you <b>must</b> open the stream in <b>binary mode</b>,
+            otherwise, it'll produce unexpected results.
+	    @param 
+		    trimAfter If true, the line is trimmed for whitespace (as in 
+		    String.trim(true,true))
+	    */
+	    virtual String getLine( bool trimAfter = true );
+
+	    /** Returns a String containing the entire stream. 
+	    @remarks
+		    This is a convenience method for text streams only, allowing you to 
+		    retrieve a String object containing all the data in the stream.
+	    */
+	    virtual String getAsString(void);
+
+		/** Skip a single line from the stream.
+        @note
+            If you used this function, you <b>must</b> open the stream in <b>binary mode</b>,
+            otherwise, it'll produce unexpected results.
+		@param delim The delimiter(s) to stop at
+		@return The number of bytes skipped
+		*/
+		virtual size_t skipLine(const String& delim = "\n");
+
+		/** Skip a defined number of bytes. This can also be a negative value, in which case
+		the file pointer rewinds a defined number of bytes. */
+		virtual void skip(long count) = 0;
+	
+		/** Repositions the read point to a specified byte.
+	    */
+	    virtual void seek( size_t pos ) = 0;
+		
+		/** Returns the current byte offset from beginning */
+	    virtual size_t tell(void) const = 0;
+
+		/** Returns true if the stream has reached the end.
+	    */
+	    virtual bool eof(void) const = 0;
+
+		/** Returns the total size of the data to be read from the stream, 
+			or 0 if this is indeterminate for this stream. 
+		*/
+        size_t size(void) const { return mSize; }
+
+        /** Close the stream; this makes further operations invalid. */
+        virtual void close(void) = 0;
+		
+
+	};
+
+	/** Shared pointer to allow data streams to be passed around without
+		worrying about deallocation
+	*/
+	typedef SharedPtr<DataStream> DataStreamPtr;
+
+	/// List of DataStream items
+	typedef list<DataStreamPtr>::type DataStreamList;
+	/// Shared pointer to list of DataStream items
+	typedef SharedPtr<DataStreamList> DataStreamListPtr;
+
+	/** Common subclass of DataStream for handling data from chunks of memory.
+	*/
+	class _OgreExport MemoryDataStream : public DataStream
+	{
+	protected:
+        /// Pointer to the start of the data area
+	    uchar* mData;
+        /// Pointer to the current position in the memory
+	    uchar* mPos;
+        /// Pointer to the end of the memory
+	    uchar* mEnd;
+        /// Do we delete the memory on close
+		bool mFreeOnClose;			
+	public:
+		
+		/** Wrap an existing memory chunk in a stream.
+		@param pMem Pointer to the existing memory
+		@param size The size of the memory chunk in bytes
+		@param freeOnClose If true, the memory associated will be destroyed
+			when the stream is closed. Note: it's important that if you set
+			this option to true, that you allocated the memory using OGRE_ALLOC_T
+			with a category of MEMCATEGORY_GENERAL to ensure the freeing of memory 
+			matches up.
+		@param readOnly Whether to make the stream on this memory read-only once created
+		*/
+		MemoryDataStream(void* pMem, size_t size, bool freeOnClose = false, bool readOnly = false);
+		
+		/** Wrap an existing memory chunk in a named stream.
+		@param name The name to give the stream
+		@param pMem Pointer to the existing memory
+		@param size The size of the memory chunk in bytes
+		@param freeOnClose If true, the memory associated will be destroyed
+			when the stream is destroyed. Note: it's important that if you set
+			this option to true, that you allocated the memory using OGRE_ALLOC_T
+			with a category of MEMCATEGORY_GENERAL ensure the freeing of memory 
+			matches up.
+		@param readOnly Whether to make the stream on this memory read-only once created
+		*/
+		MemoryDataStream(const String& name, void* pMem, size_t size, 
+				bool freeOnClose = false, bool readOnly = false);
+
+		/** Create a stream which pre-buffers the contents of another stream.
+		@remarks
+			This constructor can be used to intentionally read in the entire
+			contents of another stream, copying them to the internal buffer
+			and thus making them available in memory as a single unit.
+		@param sourceStream Another DataStream which will provide the source
+			of data
+		@param freeOnClose If true, the memory associated will be destroyed
+			when the stream is destroyed.
+		@param readOnly Whether to make the stream on this memory read-only once created
+		*/
+		MemoryDataStream(DataStream& sourceStream, 
+				bool freeOnClose = true, bool readOnly = false);
+		
+		/** Create a stream which pre-buffers the contents of another stream.
+		@remarks
+			This constructor can be used to intentionally read in the entire
+			contents of another stream, copying them to the internal buffer
+			and thus making them available in memory as a single unit.
+		@param sourceStream Another DataStream which will provide the source
+			of data
+		@param freeOnClose If true, the memory associated will be destroyed
+			when the stream is destroyed.
+		@param readOnly Whether to make the stream on this memory read-only once created
+		*/
+		MemoryDataStream(DataStreamPtr& sourceStream, 
+				bool freeOnClose = true, bool readOnly = false);
+
+		/** Create a named stream which pre-buffers the contents of 
+			another stream.
+		@remarks
+			This constructor can be used to intentionally read in the entire
+			contents of another stream, copying them to the internal buffer
+			and thus making them available in memory as a single unit.
+		@param name The name to give the stream
+		@param sourceStream Another DataStream which will provide the source
+			of data
+		@param freeOnClose If true, the memory associated will be destroyed
+			when the stream is destroyed.
+		@param readOnly Whether to make the stream on this memory read-only once created
+		*/
+		MemoryDataStream(const String& name, DataStream& sourceStream, 
+				bool freeOnClose = true, bool readOnly = false);
+
+        /** Create a named stream which pre-buffers the contents of 
+        another stream.
+        @remarks
+        This constructor can be used to intentionally read in the entire
+        contents of another stream, copying them to the internal buffer
+        and thus making them available in memory as a single unit.
+        @param name The name to give the stream
+        @param sourceStream Another DataStream which will provide the source
+        of data
+        @param freeOnClose If true, the memory associated will be destroyed
+        when the stream is destroyed.
+		@param readOnly Whether to make the stream on this memory read-only once created
+        */
+        MemoryDataStream(const String& name, const DataStreamPtr& sourceStream, 
+            bool freeOnClose = true, bool readOnly = false);
+
+        /** Create a stream with a brand new empty memory chunk.
+		@param size The size of the memory chunk to create in bytes
+		@param freeOnClose If true, the memory associated will be destroyed
+			when the stream is destroyed.
+		@param readOnly Whether to make the stream on this memory read-only once created
+		*/
+		MemoryDataStream(size_t size, bool freeOnClose = true, bool readOnly = false);
+		/** Create a named stream with a brand new empty memory chunk.
+		@param name The name to give the stream
+		@param size The size of the memory chunk to create in bytes
+		@param freeOnClose If true, the memory associated will be destroyed
+			when the stream is destroyed.
+		@param readOnly Whether to make the stream on this memory read-only once created
+		*/
+		MemoryDataStream(const String& name, size_t size, 
+				bool freeOnClose = true, bool readOnly = false);
+
+		~MemoryDataStream();
+
+		/** Get a pointer to the start of the memory block this stream holds. */
+		uchar* getPtr(void) { return mData; }
+		
+		/** Get a pointer to the current position in the memory block this stream holds. */
+		uchar* getCurrentPtr(void) { return mPos; }
+		
+		/** @copydoc DataStream::read
+		*/
+		size_t read(void* buf, size_t count);
+
+		/** @copydoc DataStream::write
+		*/
+		size_t write(const void* buf, size_t count);
+
+		/** @copydoc DataStream::readLine
+		*/
+		size_t readLine(char* buf, size_t maxCount, const String& delim = "\n");
+		
+		/** @copydoc DataStream::skipLine
+		*/
+		size_t skipLine(const String& delim = "\n");
+
+		/** @copydoc DataStream::skip
+		*/
+		void skip(long count);
+	
+		/** @copydoc DataStream::seek
+		*/
+	    void seek( size_t pos );
+		
+		/** @copydoc DataStream::tell
+		*/
+	    size_t tell(void) const;
+
+		/** @copydoc DataStream::eof
+		*/
+	    bool eof(void) const;
+
+        /** @copydoc DataStream::close
+        */
+        void close(void);
+
+		/** Sets whether or not to free the encapsulated memory on close. */
+		void setFreeOnClose(bool free) { mFreeOnClose = free; }
+	};
+
+    /** Shared pointer to allow memory data streams to be passed around without
+    worrying about deallocation
+    */
+    typedef SharedPtr<MemoryDataStream> MemoryDataStreamPtr;
+
+    /** Common subclass of DataStream for handling data from 
+		std::basic_istream.
+	*/
+	class _OgreExport FileStreamDataStream : public DataStream
+	{
+	protected:
+		/// Reference to source stream (read)
+		std::istream* mInStream;
+		/// Reference to source file stream (read-only)
+		std::ifstream* mFStreamRO;
+		/// Reference to source file stream (read-write)
+		std::fstream* mFStream;
+        bool mFreeOnClose;	
+
+		void determineAccess();
+	public:
+		/** Construct a read-only stream from an STL stream
+        @param s Pointer to source stream
+        @param freeOnClose Whether to delete the underlying stream on 
+            destruction of this class
+        */
+		FileStreamDataStream(std::ifstream* s, 
+            bool freeOnClose = true);
+		/** Construct a read-write stream from an STL stream
+		@param s Pointer to source stream
+		@param freeOnClose Whether to delete the underlying stream on 
+		destruction of this class
+		*/
+		FileStreamDataStream(std::fstream* s, 
+			bool freeOnClose = true);
+
+		/** Construct named read-only stream from an STL stream
+        @param name The name to give this stream
+        @param s Pointer to source stream
+        @param freeOnClose Whether to delete the underlying stream on 
+            destruction of this class
+        */
+		FileStreamDataStream(const String& name, 
+            std::ifstream* s, 
+            bool freeOnClose = true);
+
+		/** Construct named read-write stream from an STL stream
+		@param name The name to give this stream
+		@param s Pointer to source stream
+		@param freeOnClose Whether to delete the underlying stream on 
+		destruction of this class
+		*/
+		FileStreamDataStream(const String& name, 
+			std::fstream* s, 
+			bool freeOnClose = true);
+
+		/** Construct named read-only stream from an STL stream, and tell it the size
+        @remarks
+            This variant tells the class the size of the stream too, which 
+            means this class does not need to seek to the end of the stream 
+            to determine the size up-front. This can be beneficial if you have
+            metadata about the contents of the stream already.
+        @param name The name to give this stream
+        @param s Pointer to source stream
+        @param size Size of the stream contents in bytes
+        @param freeOnClose Whether to delete the underlying stream on 
+            destruction of this class. If you specify 'true' for this you
+			must ensure that the stream was allocated using OGRE_NEW_T with 
+			MEMCATEGRORY_GENERAL.
+        */
+		FileStreamDataStream(const String& name, 
+            std::ifstream* s, 
+            size_t size, 
+            bool freeOnClose = true);
+
+		/** Construct named read-write stream from an STL stream, and tell it the size
+		@remarks
+		This variant tells the class the size of the stream too, which 
+		means this class does not need to seek to the end of the stream 
+		to determine the size up-front. This can be beneficial if you have
+		metadata about the contents of the stream already.
+		@param name The name to give this stream
+		@param s Pointer to source stream
+		@param size Size of the stream contents in bytes
+		@param freeOnClose Whether to delete the underlying stream on 
+		destruction of this class. If you specify 'true' for this you
+		must ensure that the stream was allocated using OGRE_NEW_T with 
+		MEMCATEGRORY_GENERAL.
+		*/
+		FileStreamDataStream(const String& name, 
+			std::fstream* s, 
+			size_t size, 
+			bool freeOnClose = true);
+
+		~FileStreamDataStream();
+
+		/** @copydoc DataStream::read
+		*/
+		size_t read(void* buf, size_t count);
+
+		/** @copydoc DataStream::write
+		*/
+		size_t write(const void* buf, size_t count);
+
+		/** @copydoc DataStream::readLine
+		*/
+        size_t readLine(char* buf, size_t maxCount, const String& delim = "\n");
+		
+		/** @copydoc DataStream::skip
+		*/
+		void skip(long count);
+	
+		/** @copydoc DataStream::seek
+		*/
+	    void seek( size_t pos );
+
+		/** @copydoc DataStream::tell
+		*/
+		size_t tell(void) const;
+
+		/** @copydoc DataStream::eof
+		*/
+	    bool eof(void) const;
+
+        /** @copydoc DataStream::close
+        */
+        void close(void);
+		
+		
+	};
+
+	/** Common subclass of DataStream for handling data from C-style file 
+		handles.
+    @remarks
+        Use of this class is generally discouraged; if you want to wrap file
+        access in a DataStream, you should definitely be using the C++ friendly
+        FileStreamDataStream. However, since there are quite a few applications
+        and libraries still wedded to the old FILE handle access, this stream
+        wrapper provides some backwards compatibility.
+	*/
+	class _OgreExport FileHandleDataStream : public DataStream
+	{
+	protected:
+		FILE* mFileHandle;
+	public:
+		/// Create stream from a C file handle
+		FileHandleDataStream(FILE* handle, uint16 accessMode = READ);
+		/// Create named stream from a C file handle
+		FileHandleDataStream(const String& name, FILE* handle, uint16 accessMode = READ);
+        ~FileHandleDataStream();
+
+		/** @copydoc DataStream::read
+		*/
+		size_t read(void* buf, size_t count);
+
+		/** @copydoc DataStream::write
+		*/
+		size_t write(const void* buf, size_t count);
+
+		/** @copydoc DataStream::skip
+		*/
+		void skip(long count);
+	
+		/** @copydoc DataStream::seek
+		*/
+	    void seek( size_t pos );
+
+		/** @copydoc DataStream::tell
+		*/
+		size_t tell(void) const;
+
+		/** @copydoc DataStream::eof
+		*/
+	    bool eof(void) const;
+
+        /** @copydoc DataStream::close
+        */
+        void close(void);
+
+	};
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreDefaultHardwareBufferManager.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreDefaultHardwareBufferManager.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreDefaultHardwareBufferManager.h	(revision 148)
@@ -0,0 +1,202 @@
+/*
+-----------------------------------------------------------------------------
+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 __DefaultHardwareBufferManager_H__
+#define __DefaultHardwareBufferManager_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreHardwareBufferManager.h"
+#include "OgreHardwareCounterBuffer.h"
+#include "OgreHardwareIndexBuffer.h"
+#include "OgreHardwareUniformBuffer.h"
+#include "OgreHardwareVertexBuffer.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup RenderSystem
+	*  @{
+	*/
+
+    /// Specialisation of HardwareVertexBuffer for emulation
+    class _OgreExport DefaultHardwareVertexBuffer : public HardwareVertexBuffer 
+    {
+	protected:
+		unsigned char* mData;
+        /** See HardwareBuffer. */
+        void* lockImpl(size_t offset, size_t length, LockOptions options);
+        /** See HardwareBuffer. */
+		void unlockImpl(void);
+    public:
+		DefaultHardwareVertexBuffer(size_t vertexSize, size_t numVertices, HardwareBuffer::Usage usage);
+		DefaultHardwareVertexBuffer(HardwareBufferManagerBase* mgr, size_t vertexSize, size_t numVertices, 
+            HardwareBuffer::Usage usage);
+        ~DefaultHardwareVertexBuffer();
+        /** See HardwareBuffer. */
+        void readData(size_t offset, size_t length, void* pDest);
+        /** See HardwareBuffer. */
+        void writeData(size_t offset, size_t length, const void* pSource,
+				bool discardWholeBuffer = false);
+        /** Override HardwareBuffer to turn off all shadowing. */
+        void* lock(size_t offset, size_t length, LockOptions options);
+        /** Override HardwareBuffer to turn off all shadowing. */
+		void unlock(void);
+
+
+    };
+
+	/// Specialisation of HardwareIndexBuffer for emulation
+    class _OgreExport DefaultHardwareIndexBuffer : public HardwareIndexBuffer
+    {
+	protected:
+		unsigned char* mData;
+        /** See HardwareBuffer. */
+        void* lockImpl(size_t offset, size_t length, LockOptions options);
+        /** See HardwareBuffer. */
+		void unlockImpl(void);
+    public:
+		DefaultHardwareIndexBuffer(IndexType idxType, size_t numIndexes, HardwareBuffer::Usage usage);
+        ~DefaultHardwareIndexBuffer();
+        /** See HardwareBuffer. */
+        void readData(size_t offset, size_t length, void* pDest);
+        /** See HardwareBuffer. */
+        void writeData(size_t offset, size_t length, const void* pSource,
+				bool discardWholeBuffer = false);
+        /** Override HardwareBuffer to turn off all shadowing. */
+        void* lock(size_t offset, size_t length, LockOptions options);
+        /** Override HardwareBuffer to turn off all shadowing. */
+		void unlock(void);
+
+    };
+
+	/// Specialisation of HardwareUniformBuffer for emulation
+	class _OgreExport DefaultHardwareUniformBuffer : public HardwareUniformBuffer
+	{
+	protected:
+		unsigned char* mData;
+		/** See HardwareBuffer. */
+        void* lockImpl(size_t offset, size_t length, LockOptions options);
+        /** See HardwareBuffer. */
+		void unlockImpl(void);
+		/**  */
+		//bool updateStructure(const Any& renderSystemInfo);
+
+	public:
+		DefaultHardwareUniformBuffer(HardwareBufferManagerBase* mgr, size_t sizeBytes, HardwareBuffer::Usage usage, bool useShadowBuffer = false, const String& name = "");
+		~DefaultHardwareUniformBuffer();
+		/** See HardwareBuffer. */
+        void readData(size_t offset, size_t length, void* pDest);
+        /** See HardwareBuffer. */
+        void writeData(size_t offset, size_t length, const void* pSource,
+				bool discardWholeBuffer = false);
+        /** Override HardwareBuffer to turn off all shadowing. */
+        void* lock(size_t offset, size_t length, LockOptions options);
+        /** Override HardwareBuffer to turn off all shadowing. */
+		void unlock(void);
+	};
+
+    /// Specialisation of HardwareCounterBuffer for emulation
+	class _OgreExport DefaultHardwareCounterBuffer : public HardwareCounterBuffer
+	{
+	protected:
+		unsigned char* mData;
+		/** See HardwareBuffer. */
+        void* lockImpl(size_t offset, size_t length, LockOptions options);
+        /** See HardwareBuffer. */
+		void unlockImpl(void);
+		/**  */
+		//bool updateStructure(const Any& renderSystemInfo);
+
+	public:
+		DefaultHardwareCounterBuffer(HardwareBufferManagerBase* mgr, size_t sizeBytes, HardwareBuffer::Usage usage, bool useShadowBuffer = false, const String& name = "");
+		~DefaultHardwareCounterBuffer();
+		/** See HardwareBuffer. */
+        void readData(size_t offset, size_t length, void* pDest);
+        /** See HardwareBuffer. */
+        void writeData(size_t offset, size_t length, const void* pSource,
+                       bool discardWholeBuffer = false);
+        /** Override HardwareBuffer to turn off all shadowing. */
+        void* lock(size_t offset, size_t length, LockOptions options);
+        /** Override HardwareBuffer to turn off all shadowing. */
+		void unlock(void);
+	};
+
+	/** Specialisation of HardwareBufferManagerBase to emulate hardware buffers.
+	@remarks
+		You might want to instantiate this class if you want to utilise
+		classes like MeshSerializer without having initialised the 
+		rendering system (which is required to create a 'real' hardware
+		buffer manager).
+	*/
+	class _OgreExport DefaultHardwareBufferManagerBase : public HardwareBufferManagerBase
+	{
+    public:
+        DefaultHardwareBufferManagerBase();
+        ~DefaultHardwareBufferManagerBase();
+        /// Creates a vertex buffer
+		HardwareVertexBufferSharedPtr 
+            createVertexBuffer(size_t vertexSize, size_t numVerts, 
+				HardwareBuffer::Usage usage, bool useShadowBuffer = false);
+		/// Create a hardware index buffer
+		HardwareIndexBufferSharedPtr 
+            createIndexBuffer(HardwareIndexBuffer::IndexType itype, size_t numIndexes, 
+				HardwareBuffer::Usage usage, bool useShadowBuffer = false);
+		/// Create a hardware vertex buffer
+		RenderToVertexBufferSharedPtr createRenderToVertexBuffer();
+		/// Create a hardware uniform buffer
+		HardwareUniformBufferSharedPtr createUniformBuffer(size_t sizeBytes, 
+									HardwareBuffer::Usage usage = HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY_DISCARDABLE, 
+									bool useShadowBuffer = false, const String& name = "");
+		/// Create a hardware counter buffer
+		HardwareCounterBufferSharedPtr createCounterBuffer(size_t sizeBytes,
+                                                           HardwareBuffer::Usage usage = HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY_DISCARDABLE,
+                                                           bool useShadowBuffer = false, const String& name = "");
+    };
+
+	/// DefaultHardwareBufferManager as a Singleton
+	class _OgreExport DefaultHardwareBufferManager : public HardwareBufferManager
+	{
+	public:
+		DefaultHardwareBufferManager()
+			: HardwareBufferManager(OGRE_NEW DefaultHardwareBufferManagerBase()) 
+		{
+
+		}
+		~DefaultHardwareBufferManager()
+		{
+			OGRE_DELETE mImpl;
+		}
+	};
+
+	/** @} */
+	/** @} */
+
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreDeflate.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreDeflate.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreDeflate.h	(revision 148)
@@ -0,0 +1,143 @@
+/*
+ -----------------------------------------------------------------------------
+ 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 __OGRE_DEFLATE_H__
+#define __OGRE_DEFLATE_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreDataStream.h"
+#include "OgreHeaderPrefix.h"
+
+/// forward decls
+struct z_stream_s;
+typedef struct z_stream_s z_stream;
+
+namespace Ogre
+{
+	/** Stream which compresses / uncompresses data using the 'deflate' compression
+		algorithm.
+	@remarks
+		This stream is designed to wrap another stream for the actual source / destination
+		of the compressed data, it has no concrete source / data itself. The idea is
+		that you pass uncompressed data through this stream, and the underlying
+		stream reads/writes compressed data to the final source.
+	@note
+		This is an alternative to using a compressed archive since it is able to 
+		compress & decompress regardless of the actual source of the stream.
+		You should avoid using this with already compressed archives.
+		Also note that this cannot be used as a read / write stream, only a read-only
+		or write-only stream.
+	*/
+	class _OgreExport DeflateStream : public DataStream
+	{
+	protected:
+		DataStreamPtr mCompressedStream;
+		DataStreamPtr mTmpWriteStream;
+		String mTempFileName;
+		z_stream* mZStream;
+		size_t mCurrentPos;
+		size_t mAvailIn;
+		
+		/// Cache for read data in case skipping around
+		StaticCache<16 * OGRE_STREAM_TEMP_SIZE> mReadCache;
+		
+		/// Intermediate buffer for read / write
+		unsigned char *mTmp;
+		
+		/// Whether the underlying stream is valid compressed data
+		bool mIsCompressedValid;
+		
+		void init();
+		void destroy();
+		void compressFinal();
+
+		size_t getAvailInForSinglePass();
+	public:
+		/** Constructor for creating unnamed stream wrapping another stream.
+		 @param compressedStream The stream that this stream will use when reading / 
+			writing compressed data. The access mode from this stream will be matched.
+		 @param tmpFileName Path/Filename to be used for temporary storage of incoming data
+		 @param avail_in Available data length to be uncompressed. With it we can uncompress
+			DataStream partly.
+		*/
+        DeflateStream(const DataStreamPtr& compressedStream, const String& tmpFileName = "",
+			size_t avail_in = 0);
+		/** Constructor for creating named stream wrapping another stream.
+		 @param name The name to give this stream
+		 @param compressedStream The stream that this stream will use when reading / 
+			writing compressed data. The access mode from this stream will be matched.
+		 @param tmpFileName Path/Filename to be used for temporary storage of incoming data
+		 @param avail_in Available data length to be uncompressed. With it we can uncompress
+			DataStream partly.
+		 */
+		DeflateStream(const String& name, const DataStreamPtr& compressedStream, const String& tmpFileName="",
+			size_t avail_in = 0);
+		
+		~DeflateStream();
+		
+		/** Returns whether the compressed stream is valid deflated data.
+		 @remarks
+			If you pass this class a READ stream which is not compressed with the 
+			deflate algorithm, this method returns false and all read commands
+			will actually be executed as passthroughs as a fallback. 
+		*/
+		bool isCompressedStreamValid() const { return mIsCompressedValid; }
+		
+		/** @copydoc DataStream::read
+		 */
+		size_t read(void* buf, size_t count);
+		
+		/** @copydoc DataStream::write
+		 */
+		size_t write(const void* buf, size_t count);
+				
+		/** @copydoc DataStream::skip
+		 */
+		void skip(long count);
+		
+		/** @copydoc DataStream::seek
+		 */
+	    void seek( size_t pos );
+		
+		/** @copydoc DataStream::tell
+		 */
+		size_t tell(void) const;
+		
+		/** @copydoc DataStream::eof
+		 */
+	    bool eof(void) const;
+		
+        /** @copydoc DataStream::close
+		 */
+        void close(void);
+		
+	};
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreDepthBuffer.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreDepthBuffer.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreDepthBuffer.h	(revision 148)
@@ -0,0 +1,158 @@
+/*
+-----------------------------------------------------------------------------
+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 __DepthBuffer_H__
+#define __DepthBuffer_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup RenderSystem
+	*  @{
+	*/
+
+	/** An abstract class that contains a depth/stencil buffer.
+		Depth Buffers can be attached to render targets. Note we handle Depth & Stencil together.
+		DepthBuffer sharing is handled automatically for you. However, there are times where you want
+		to specifically control depth buffers to achieve certain effects or increase performance.
+		You can control this by hinting Ogre with POOL IDs. Created depth buffers can live in different
+		pools, or all together in the same one.
+		Usually, a depth buffer can only be attached to a RenderTarget if it's dimensions are bigger
+		and have the same bit depth and same multisample settings. Depth Buffers are created automatically
+		for new RTs when needed, and stored in the pool where the RenderTarget should have drawn from.
+		By default, all RTs have the Id POOL_DEFAULT, which means all depth buffers are stored by default
+		in that pool. By choosing a different Pool Id for a specific RenderTarget, that RT will only
+		retrieve depth buffers from _that_ pool, therefore not conflicting with sharing depth buffers
+		with other RTs (such as shadows maps).
+		Setting an RT to POOL_MANUAL_USAGE means Ogre won't manage the DepthBuffer for you (not recommended)
+		RTs with POOL_NO_DEPTH are very useful when you don't want to create a DepthBuffer for it. You can
+		still manually attach a depth buffer though as internally POOL_NO_DEPTH & POOL_MANUAL_USAGE are
+		handled in the same way.
+
+		Behavior is consistent across all render systems, if, and only if, the same RSC flags are set
+		RSC flags that affect this class are:
+			* RSC_RTT_SEPARATE_DEPTHBUFFER:
+				The RTT can create a custom depth buffer different from the main depth buffer. This means,
+				an RTT is able to not share it's depth buffer with the main window if it wants to.
+			* RSC_RTT_MAIN_DEPTHBUFFER_ATTACHABLE:
+				When RSC_RTT_SEPARATE_DEPTHBUFFER is set, some APIs (ie. OpenGL w/ FBO) don't allow using
+				the main depth buffer for offscreen RTTs. When this flag is set, the depth buffer can be
+				shared between the main window and an RTT.
+			* RSC_RTT_DEPTHBUFFER_RESOLUTION_LESSEQUAL:
+				When this flag isn't set, the depth buffer can only be shared across RTTs who have the EXACT
+				same resolution. When it's set, it can be shared with RTTs as long as they have a
+				resolution less or equal than the depth buffer's.
+
+        @remarks
+			Design discussion http://www.ogre3d.org/forums/viewtopic.php?f=4&t=53534&p=365582
+        @author
+            Matias N. Goldberg
+        @version
+            1.0
+     */
+	class _OgreExport DepthBuffer : public RenderSysAlloc
+	{
+	public:
+		enum PoolId
+		{
+			POOL_NO_DEPTH		= 0,
+			POOL_MANUAL_USAGE	= 0,
+			POOL_DEFAULT		= 1
+		};
+
+		DepthBuffer( uint16 poolId, uint16 bitDepth, uint32 width, uint32 height,
+					 uint32 fsaa, const String &fsaaHint, bool manual );
+		virtual ~DepthBuffer();
+
+		/** Sets the pool id in which this DepthBuffer lives.
+            Note this will detach any render target from this depth buffer */
+		void _setPoolId( uint16 poolId );
+
+		/// Gets the pool id in which this DepthBuffer lives
+		virtual uint16 getPoolId() const;
+		virtual uint16 getBitDepth() const;
+		virtual uint32 getWidth() const;
+		virtual uint32 getHeight() const;
+		virtual uint32 getFsaa() const;
+		virtual const String& getFsaaHint() const;
+
+		/** Manual DepthBuffers are cleared in RenderSystem's destructor. Non-manual ones are released
+            with it's render target (aka, a backbuffer or similar) */
+		bool isManual() const;
+
+		/** Returns whether the specified RenderTarget is compatible with this DepthBuffer
+			That is, this DepthBuffer can be attached to that RenderTarget
+            @remarks
+                Most APIs impose the following restrictions:
+				Width & height must be equal or higher than the render target's
+				They must be of the same bit depth.
+				They need to have the same FSAA setting
+			@param renderTarget The render target to test against
+        */
+		virtual bool isCompatible( RenderTarget *renderTarget ) const;
+
+		/** Called when a RenderTarget is attaches this DepthBuffer
+            @remarks
+                This function doesn't actually attach. It merely informs the DepthBuffer
+				which RenderTarget did attach. The real attachment happens in
+				RenderTarget::attachDepthBuffer()
+			@param renderTarget The RenderTarget that has just been attached
+        */
+		virtual void _notifyRenderTargetAttached( RenderTarget *renderTarget );
+
+		/** Called when a RenderTarget is detaches from this DepthBuffer
+            @remarks
+                Same as DepthBuffer::_notifyRenderTargetAttached()
+			@param renderTarget The RenderTarget that has just been detached
+        */
+		virtual void _notifyRenderTargetDetached( RenderTarget *renderTarget );
+
+	protected:
+		typedef set<RenderTarget*>::type RenderTargetSet;
+
+		uint16						mPoolId;
+		uint16						mBitDepth;
+		uint32						mWidth;
+		uint32						mHeight;
+		uint32						mFsaa;
+		String						mFsaaHint;
+
+		bool						mManual; //We don't Release manual surfaces on destruction
+		RenderTargetSet				mAttachedRenderTargets;
+
+		void detachFromAllRenderTargets();
+	};
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreDistanceLodStrategy.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreDistanceLodStrategy.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreDistanceLodStrategy.h	(revision 148)
@@ -0,0 +1,240 @@
+/*
+-----------------------------------------------------------------------------
+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 __Distance_Lod_Strategy_H__
+#define __Distance_Lod_Strategy_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreLodStrategy.h"
+#include "OgreSingleton.h"
+#include "OgreNode.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup LOD
+	*  @{
+	*/
+
+    /** Level of detail strategy based on distance from camera. This is an abstract base class for DistanceLodBoxStrategy and DistanceLodSphereStrategy.
+        @remarks
+            The purpose of the reference view is to ensure a consistent experience for all users. Monitors of different resolutions and aspect ratios will each have different results for the distance queries.
+        @par
+            It depends on gameplay testing. If all testers had 16:9 monitors and 110° FOV, then that's the value you should enter (to ensure as much as possible the experience stays consistent for all other users who don't have a 16:9 monitor and/or use a different FOV).
+        @par
+            If all your testers had 4:3 monitors, then enter a 4:3 resolution.
+        @par
+            If all your testers had varying resolutions or you just didn't care, then this feature is useless for you and should be disabled (default: disabled).
+     */
+    class _OgreExport DistanceLodStrategy : public LodStrategy
+    {
+    protected:
+        /// @copydoc LodStrategy::getValueImpl
+        virtual Real getValueImpl(const MovableObject *movableObject, const Camera *camera) const;
+
+    public:
+        /** Default constructor. */
+        DistanceLodStrategy(const String& name);
+
+        /// @copydoc LodStrategy::getBaseValue
+        virtual Real getBaseValue() const;
+
+        /// @copydoc LodStrategy::transformBias
+        virtual Real transformBias(Real factor) const;
+
+        /// @copydoc LodStrategy::transformUserValue
+        virtual Real transformUserValue(Real userValue) const;
+
+        /// @copydoc LodStrategy::getIndex
+        virtual ushort getIndex(Real value, const Mesh::MeshLodUsageList& meshLodUsageList) const;
+
+        /// @copydoc LodStrategy::getIndex
+        virtual ushort getIndex(Real value, const Material::LodValueList& materialLodValueList) const;
+
+        /// @copydoc LodStrategy::sort
+        virtual void sort(Mesh::MeshLodUsageList& meshLodUsageList) const;
+
+        /// @copydoc LodStrategy::isSorted
+        virtual bool isSorted(const Mesh::LodValueList& values) const;
+
+        /** Get the squared depth from camera to the LOD object */
+        virtual Real getSquaredDepth(const MovableObject *movableObject, const Ogre::Camera *camera) const = 0;
+
+        /** Sets the reference view upon which the distances were based.
+        @note
+            This automatically enables use of the reference view.
+        @note
+            There is no corresponding get method for these values as
+            they are not saved, but used to compute a reference value.
+        */
+        void setReferenceView(Real viewportWidth, Real viewportHeight, Radian fovY);
+
+        /** Enables to disables use of the reference view.
+        @note Do not enable use of the reference view before setting it.
+        */
+        void setReferenceViewEnabled(bool value);
+
+        /** Determine if use of the reference view is enabled */
+        bool isReferenceViewEnabled() const;
+
+    private:
+        bool mReferenceViewEnabled;
+        Real mReferenceViewValue;
+
+    };
+	/** @} */
+	/** @} */
+
+    /** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup LOD
+	*  @{
+	*/
+
+    /** Level of detail strategy based on distance from camera to an object's bounding sphere.
+        @remarks
+            The purpose of the reference view is to ensure a consistent experience for all users. Monitors of different resolutions and aspect ratios will each have different results for the distance queries.
+        @par
+            It depends on gameplay testing. If all testers had 16:9 monitors and 110° FOV, then that's the value you should enter (to ensure as much as possible the experience stays consistent for all other users who don't have a 16:9 monitor and/or use a different FOV).
+        @par
+            If all your testers had 4:3 monitors, then enter a 4:3 resolution.
+        @par
+            If all your testers had varying resolutions or you just didn't care, then this feature is useless for you and should be disabled (default: disabled).
+     */
+    class _OgreExport DistanceLodSphereStrategy : public DistanceLodStrategy, public Singleton<DistanceLodSphereStrategy>
+    {
+    public:
+        /** Default constructor. */
+        DistanceLodSphereStrategy();
+
+        /// @copydoc DistanceLodStrategy::getSquaredDepth
+        Real getSquaredDepth(const MovableObject *movableObject, const Ogre::Camera *camera) const;
+
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static DistanceLodSphereStrategy& getSingleton(void);
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static DistanceLodSphereStrategy* getSingletonPtr(void);
+    };
+    /** @} */
+    /** @} */
+
+    /** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup LOD
+	*  @{
+	*/
+
+    /** Level of detail strategy based on distance from camera to an object's bounding box.
+        @remarks
+            The purpose of the reference view is to ensure a consistent experience for all users. Monitors of different resolutions and aspect ratios will each have different results for the distance queries.
+        @par
+            It depends on gameplay testing. If all testers had 16:9 monitors and 110° FOV, then that's the value you should enter (to ensure as much as possible the experience stays consistent for all other users who don't have a 16:9 monitor and/or use a different FOV).
+        @par
+            If all your testers had 4:3 monitors, then enter a 4:3 resolution.
+        @par
+            If all your testers had varying resolutions or you just didn't care, then this feature is useless for you and should be disabled (default: disabled).
+     */
+    class _OgreExport DistanceLodBoxStrategy : public DistanceLodStrategy, public Singleton<DistanceLodBoxStrategy>
+    {
+    public:
+        /** Default constructor. */
+        DistanceLodBoxStrategy();
+
+        /// @copydoc DistanceLodStrategy::getSquaredDepth
+        Real getSquaredDepth(const MovableObject *movableObject, const Ogre::Camera *camera) const;
+
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static DistanceLodBoxStrategy& getSingleton(void);
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static DistanceLodBoxStrategy* getSingletonPtr(void);
+    };
+    /** @} */
+    /** @} */
+
+} // namespace
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreDualQuaternion.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreDualQuaternion.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreDualQuaternion.h	(revision 148)
@@ -0,0 +1,184 @@
+/*
+-----------------------------------------------------------------------------
+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 __DualQuaternion_H__
+#define __DualQuaternion_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreMath.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Math
+	*  @{
+	*/
+	/** Implementation of a dual quaternion, i.e. a rotation around an axis and a translation.
+	    This implementation may note be appropriate as a general implementation, but is intended for use with
+	    dual quaternion skinning.
+	*/
+	class _OgreExport DualQuaternion
+	{
+	public:
+		/// Default constructor, initializes to identity rotation (aka 0°), and zero translation (0,0,0)
+		inline DualQuaternion ()
+			: w(1), x(0), y(0), z(0), dw(1), dx(0), dy(0), dz(0)
+		{
+		}
+		
+		/// Construct from an explicit list of values
+		inline DualQuaternion (Real fW, Real fX, Real fY, Real fZ, 
+				Real fdW, Real fdX, Real fdY, Real fdZ)
+			: w(fW), x(fX), y(fY), z(fZ), dw(fdW), dx(fdX), dy(fdY), dz(fdZ)
+		{
+		}
+        
+		/// Construct a dual quaternion from a transformation matrix
+		inline DualQuaternion(const Matrix4& rot)
+		{
+			this->fromTransformationMatrix(rot);
+		}
+		
+		/// Construct a dual quaternion from a unit quaternion and a translation vector
+		inline DualQuaternion(const Quaternion& q, const Vector3& trans)
+		{
+			this->fromRotationTranslation(q, trans);
+		}
+		
+		/// Construct a dual quaternion from 8 manual w/x/y/z/dw/dx/dy/dz values
+		inline DualQuaternion(Real* valptr)
+		{
+			memcpy(&w, valptr, sizeof(Real)*8);
+		}
+
+		/// Array accessor operator
+		inline Real operator [] ( const size_t i ) const
+		{
+			assert( i < 8 );
+
+			return *(&w+i);
+		}
+
+		/// Array accessor operator
+		inline Real& operator [] ( const size_t i )
+		{
+			assert( i < 8 );
+
+			return *(&w+i);
+		}
+		
+		inline DualQuaternion& operator= (const DualQuaternion& rkQ)
+		{
+			w = rkQ.w;
+			x = rkQ.x;
+			y = rkQ.y;
+			z = rkQ.z;
+			dw = rkQ.dw;
+			dx = rkQ.dx;
+			dy = rkQ.dy;
+			dz = rkQ.dz;
+			
+			return *this;
+		}
+
+		inline bool operator== (const DualQuaternion& rhs) const
+		{
+			return (rhs.w == w) && (rhs.x == x) && (rhs.y == y) && (rhs.z == z) && 
+				(rhs.dw == dw) && (rhs.dx == dx) && (rhs.dy == dy) && (rhs.dz == dz);
+		}
+
+		inline bool operator!= (const DualQuaternion& rhs) const
+		{
+			return !operator==(rhs);
+		}
+
+		/// Pointer accessor for direct copying
+		inline Real* ptr()
+		{
+			return &w;
+		}
+
+		/// Pointer accessor for direct copying
+		inline const Real* ptr() const
+		{
+			return &w;
+		}
+		
+		/// Exchange the contents of this dual quaternion with another. 
+		inline void swap(DualQuaternion& other)
+		{
+			std::swap(w, other.w);
+			std::swap(x, other.x);
+			std::swap(y, other.y);
+			std::swap(z, other.z);
+			std::swap(dw, other.dw);
+			std::swap(dx, other.dx);
+			std::swap(dy, other.dy);
+			std::swap(dz, other.dz);
+		}
+		
+		/// Check whether this dual quaternion contains valid values
+		inline bool isNaN() const
+		{
+			return Math::isNaN(w) || Math::isNaN(x) || Math::isNaN(y) || Math::isNaN(z) ||  
+				Math::isNaN(dw) || Math::isNaN(dx) || Math::isNaN(dy) || Math::isNaN(dz);
+		}
+
+		/// Construct a dual quaternion from a rotation described by a Quaternion and a translation described by a Vector3
+		void fromRotationTranslation (const Quaternion& q, const Vector3& trans);
+		
+		/// Convert a dual quaternion into its two components, a Quaternion representing the rotation and a Vector3 representing the translation
+		void toRotationTranslation (Quaternion& q, Vector3& translation) const;
+
+		/// Construct a dual quaternion from a 4x4 transformation matrix
+		void fromTransformationMatrix (const Matrix4& kTrans);
+		
+		/// Convert a dual quaternion to a 4x4 transformation matrix
+		void toTransformationMatrix (Matrix4& kTrans) const;
+
+		Real w, x, y, z, dw, dx, dy, dz;
+
+		/** 
+		Function for writing to a stream. Outputs "DualQuaternion(w, x, y, z, dw, dx, dy, dz)" with w, x, y, z, dw, dx, dy, dz
+		being the member values of the dual quaternion.
+		*/
+		inline _OgreExport friend std::ostream& operator <<
+		( std::ostream& o, const DualQuaternion& q )
+		{
+			o << "DualQuaternion(" << q.w << ", " << q.x << ", " << q.y << ", " << q.z << ", " << q.dw << ", " << q.dx << ", " << q.dy << ", " << q.dz << ")";
+			return o;
+		}
+	};
+	/** @} */
+	/** @} */
+
+}
+
+#endif 
Index: /ogre_src_v1-9-0/OgreMain/include/OgreDynLib.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreDynLib.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreDynLib.h	(revision 148)
@@ -0,0 +1,135 @@
+/*
+-----------------------------------------------------------------------------
+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 _DynLib_H__
+#define _DynLib_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreHeaderPrefix.h"
+
+#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
+#    define DYNLIB_HANDLE hInstance
+#    define DYNLIB_LOAD( a ) LoadLibraryEx( a, NULL, 0 ) // we can not use LOAD_WITH_ALTERED_SEARCH_PATH with relative paths
+#    define DYNLIB_GETSYM( a, b ) GetProcAddress( a, b )
+#    define DYNLIB_UNLOAD( a ) !FreeLibrary( a )
+
+struct HINSTANCE__;
+typedef struct HINSTANCE__* hInstance;
+
+#elif OGRE_PLATFORM == OGRE_PLATFORM_WINRT
+#    define DYNLIB_HANDLE hInstance
+#    define DYNLIB_LOAD( a ) LoadPackagedLibrary( UTFString(a).asWStr_c_str(), 0 )
+#    define DYNLIB_GETSYM( a, b ) GetProcAddress( a, b )
+#    define DYNLIB_UNLOAD( a ) !FreeLibrary( a )
+
+struct HINSTANCE__;
+typedef struct HINSTANCE__* hInstance;
+
+#elif OGRE_PLATFORM == OGRE_PLATFORM_LINUX || OGRE_PLATFORM == OGRE_PLATFORM_ANDROID || OGRE_PLATFORM == OGRE_PLATFORM_NACL || OGRE_PLATFORM == OGRE_PLATFORM_FLASHCC
+#    define DYNLIB_HANDLE void*
+#    define DYNLIB_LOAD( a ) dlopen( a, RTLD_LAZY | RTLD_GLOBAL)
+#    define DYNLIB_GETSYM( a, b ) dlsym( a, b )
+#    define DYNLIB_UNLOAD( a ) dlclose( a )
+
+#elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE || OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS
+#    define DYNLIB_HANDLE void*
+#    define DYNLIB_LOAD( a ) mac_loadDylib( a )
+#    define FRAMEWORK_LOAD( a ) mac_loadFramework( a )
+#    define DYNLIB_GETSYM( a, b ) dlsym( a, b )
+#    define DYNLIB_UNLOAD( a ) dlclose( a )
+
+#endif
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+
+    /** Resource holding data about a dynamic library.
+        @remarks
+            This class holds the data required to get symbols from
+            libraries loaded at run-time (i.e. from DLL's for so's)
+        @author
+            Adrian Cearn„u (cearny@cearny.ro)
+        @since
+            27 January 2002
+    */
+	class _OgreExport DynLib : public DynLibAlloc
+    {
+	protected:
+		String mName;
+        /// Gets the last loading error
+        String dynlibError(void);
+    public:
+        /** Default constructor - used by DynLibManager.
+            @warning
+                Do not call directly
+        */
+        DynLib( const String& name );
+
+        /** Default destructor.
+        */
+        ~DynLib();
+
+        /** Load the library
+        */
+        void load();
+        /** Unload the library
+        */
+        void unload();
+		/// Get the name of the library
+		const String& getName(void) const { return mName; }
+
+        /**
+            Returns the address of the given symbol from the loaded library.
+            @param
+                strName The name of the symbol to search for
+            @return
+                If the function succeeds, the returned value is a handle to
+                the symbol.
+            @par
+                If the function fails, the returned value is <b>NULL</b>.
+
+        */
+        void* getSymbol( const String& strName ) const throw();
+
+    protected:
+
+        /// Handle to the loaded library.
+        DYNLIB_HANDLE mInst;
+    };
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreDynLibManager.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreDynLibManager.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreDynLibManager.h	(revision 148)
@@ -0,0 +1,120 @@
+/*
+-----------------------------------------------------------------------------
+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 __DynLibManager_H__
+#define __DynLibManager_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreSingleton.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+    /** \addtogroup Core
+    *  @{
+    */
+    /** \addtogroup General
+    *  @{
+    */
+    /** Manager for Dynamic-loading Libraries.
+    @remarks
+        This manager keeps a track of all the open dynamic-loading
+        libraries, opens them and returns references to already-open
+        libraries.
+    */
+    class _OgreExport DynLibManager: public Singleton<DynLibManager>, public DynLibAlloc
+    {
+    protected:
+        typedef map<String, DynLib*>::type DynLibList;
+        DynLibList mLibList;
+    public:
+        /** Default constructor.
+        @note
+            <br>Should never be called as the singleton is automatically
+            created during the creation of the Root object.
+        @see
+            Root::Root
+        */
+        DynLibManager();
+
+        /** Default destructor.
+        @see
+            Root::~Root
+        */
+        virtual ~DynLibManager();
+
+        /** Loads the passed library.
+        @param filename
+            The name of the library. The extension can be omitted.
+        */
+        DynLib* load(const String& filename);
+
+        /** Unloads the passed library.
+        @param lib
+            The library.
+        */
+        void unload(DynLib* lib);
+
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static DynLibManager& getSingleton(void);
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static DynLibManager* getSingletonPtr(void);
+    };
+    /** @} */
+    /** @} */
+} // namespace Ogre
+
+#include "OgreHeaderSuffix.h"
+
+#endif // __DynLibManager_H__
Index: /ogre_src_v1-9-0/OgreMain/include/OgreETCCodec.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreETCCodec.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreETCCodec.h	(revision 148)
@@ -0,0 +1,88 @@
+/*
+-----------------------------------------------------------------------------
+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 __OgreETCCodec_H__
+#define __OgreETCCodec_H__
+
+#include "OgreImageCodec.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Image
+	*  @{
+	*/
+
+    /** Codec specialized in loading ETC (Ericsson Texture Compression) images.
+	@remarks
+		We implement our own codec here since we need to be able to keep ETC
+		data compressed if the card supports it.
+    */
+    class _OgreExport ETCCodec : public ImageCodec
+    {
+    protected:
+        String mType;
+        
+        void flipEndian(void * pData, size_t size, size_t count) const;
+	    void flipEndian(void * pData, size_t size) const;
+
+		/// Single registered codec instance
+        static ETCCodec* msPKMInstance;
+        static ETCCodec* msKTXInstance;
+
+	public:
+        ETCCodec(const String &type);
+        virtual ~ETCCodec() { }
+
+        /// @copydoc Codec::encode
+        DataStreamPtr encode(MemoryDataStreamPtr& input, CodecDataPtr& pData) const;
+        /// @copydoc Codec::encodeToFile
+        void encodeToFile(MemoryDataStreamPtr& input, const String& outFileName, CodecDataPtr& pData) const;
+        /// @copydoc Codec::decode
+        DecodeResult decode(DataStreamPtr& input) const;
+		/// @copydoc Codec::magicNumberToFileExt
+		String magicNumberToFileExt(const char *magicNumberPtr, size_t maxbytes) const;
+        
+        virtual String getType() const;        
+
+		/// Static method to startup and register the ETC codec
+		static void startup(void);
+		/// Static method to shutdown and unregister the ETC codec
+		static void shutdown(void);
+    private:
+        bool decodePKM(DataStreamPtr& input, DecodeResult& result) const;
+        bool decodeKTX(DataStreamPtr& input, DecodeResult& result) const;
+
+    };
+	/** @} */
+	/** @} */
+
+} // namespace
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreEdgeListBuilder.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreEdgeListBuilder.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreEdgeListBuilder.h	(revision 148)
@@ -0,0 +1,278 @@
+/*
+-----------------------------------------------------------------------------
+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 __EdgeListBuilder_H__
+#define __EdgeListBuilder_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreVector4.h"
+#include "OgreHardwareVertexBuffer.h"
+#include "OgreRenderOperation.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Math
+	*  @{
+	*/
+
+
+    /** This class contains the information required to describe the edge connectivity of a
+        given set of vertices and indexes. 
+    @remarks 
+        This information is built using the EdgeListBuilder class. Note that for a given mesh,
+        which can be made up of multiple submeshes, there are separate edge lists for when 
+    */
+	class _OgreExport EdgeData : public EdgeDataAlloc
+    {
+    public:
+		
+		EdgeData();
+		
+        /** Basic triangle structure. */
+        struct Triangle {
+            /** The set of indexes this triangle came from (NB it is possible that the triangles on 
+               one side of an edge are using a different vertex buffer from those on the other side.) */
+            size_t indexSet; 
+            /** The vertex set these vertices came from. */
+            size_t vertexSet;
+            /// Vertex indexes, relative to the original buffer
+            size_t vertIndex[3];
+            /** Vertex indexes, relative to a shared vertex buffer with
+                duplicates eliminated (this buffer is not exposed) */
+            size_t sharedVertIndex[3];
+
+			Triangle() :indexSet(0), vertexSet(0) {}
+        };
+        /** Edge data. */
+        struct Edge {
+            /** The indexes of the 2 tris attached, note that tri 0 is the one where the 
+                indexes run _anti_ clockwise along the edge. Indexes must be
+                reversed for tri 1. */
+            size_t triIndex[2];
+            /** The vertex indices for this edge. Note that both vertices will be in the vertex
+                set as specified in 'vertexSet', which will also be the same as tri 0 */
+            size_t vertIndex[2];
+            /** Vertex indices as used in the shared vertex list, not exposed. */
+            size_t sharedVertIndex[2];
+            /** Indicates if this is a degenerate edge, ie it does not have 2 triangles */
+            bool degenerate;
+        };
+
+        /** Array of 4D vector of triangle face normal, which is unit vector orthogonal
+            to the triangles, plus distance from origin.
+            Use aligned policy here because we are intended to use in SIMD optimised routines. */
+        typedef std::vector<Vector4, STLAllocator<Vector4, CategorisedAlignAllocPolicy<MEMCATEGORY_GEOMETRY> > > TriangleFaceNormalList;
+
+        /** Working vector used when calculating the silhouette.
+            Use std::vector<char> instead of std::vector<bool> which might implemented
+            similar bit-fields causing loss performance. */
+        typedef vector<char>::type TriangleLightFacingList;
+
+        typedef vector<Triangle>::type TriangleList;
+        typedef vector<Edge>::type EdgeList;
+
+        /** A group of edges sharing the same vertex data. */
+        struct EdgeGroup
+        {
+            /** The vertex set index that contains the vertices for this edge group. */
+            size_t vertexSet;
+            /** Pointer to vertex data used by this edge group. */
+            const VertexData* vertexData;
+            /** Index to main triangles array, indicate the first triangle of this edge
+                group, and all triangles of this edge group are stored continuous in
+                main triangles array.
+            */
+            size_t triStart;
+            /** Number triangles of this edge group. */
+            size_t triCount;
+            /** The edges themselves. */
+            EdgeList edges;
+
+        };
+
+        typedef vector<EdgeGroup>::type EdgeGroupList;
+
+        /** Main triangles array, stores all triangles of this edge list. Note that
+            triangles are grouping against edge group.
+        */
+        TriangleList triangles;
+        /** All triangle face normals. It should be 1:1 with triangles. */
+        TriangleFaceNormalList triangleFaceNormals;
+        /** Triangle light facing states. It should be 1:1 with triangles. */
+        TriangleLightFacingList triangleLightFacings;
+        /** All edge groups of this edge list. */
+        EdgeGroupList edgeGroups;
+        /** Flag indicate the mesh is manifold. */
+        bool isClosed;
+
+
+        /** Calculate the light facing state of the triangles in this edge list
+        @remarks
+            This is normally the first stage of calculating a silhouette, i.e.
+            establishing which tris are facing the light and which are facing
+            away. This state is stored in the 'triangleLightFacings'.
+        @param lightPos 4D position of the light in object space, note that 
+            for directional lights (which have no position), the w component
+            is 0 and the x/y/z position are the direction.
+        */
+        void updateTriangleLightFacing(const Vector4& lightPos);
+        /** Updates the face normals for this edge list based on (changed)
+            position information, useful for animated objects. 
+        @param vertexSet The vertex set we are updating
+        @param positionBuffer The updated position buffer, must contain ONLY xyz
+        */
+        void updateFaceNormals(size_t vertexSet, const HardwareVertexBufferSharedPtr& positionBuffer);
+
+
+
+        /// Debugging method
+        void log(Log* log);
+        
+    };
+
+    /** General utility class for building edge lists for geometry.
+    @remarks
+        You can add multiple sets of vertex and index data to build and edge list. 
+        Edges will be built between the various sets as well as within sets; this allows 
+        you to use a model which is built from multiple SubMeshes each using 
+        separate index and (optionally) vertex data and still get the same connectivity 
+        information. It's important to note that the indexes for the edge will be constrained
+        to a single vertex buffer though (this is required in order to render the edge).
+    */
+    class _OgreExport EdgeListBuilder 
+    {
+    public:
+
+        EdgeListBuilder();
+        virtual ~EdgeListBuilder();
+        /** Add a set of vertex geometry data to the edge builder. 
+        @remarks
+            You must add at least one set of vertex data to the builder before invoking the
+            build method.
+        */
+        void addVertexData(const VertexData* vertexData);
+        /** Add a set of index geometry data to the edge builder. 
+        @remarks
+            You must add at least one set of index data to the builder before invoking the
+            build method.
+        @param indexData The index information which describes the triangles.
+        @param vertexSet The vertex data set this index data refers to; you only need to alter this
+            if you have added multiple sets of vertices
+        @param opType The operation type used to render these indexes. Only triangle types
+            are supported (no point or line types)
+        */
+        void addIndexData(const IndexData* indexData, size_t vertexSet = 0, 
+            RenderOperation::OperationType opType = RenderOperation::OT_TRIANGLE_LIST);
+
+        /** Builds the edge information based on the information built up so far.
+        @remarks
+            The caller takes responsibility for deleting the returned structure.
+        */
+        EdgeData* build(void);
+
+        /// Debugging method
+        void log(Log* l);
+    protected:
+
+        /** A vertex can actually represent several vertices in the final model, because
+		vertices along texture seams etc will have been duplicated. In order to properly
+		evaluate the surface properties, a single common vertex is used for these duplicates,
+		and the faces hold the detail of the duplicated vertices.
+		*/
+        struct CommonVertex {
+            Vector3  position;  /// Location of point in euclidean space
+	        size_t index;       /// Place of vertex in common vertex list
+            size_t vertexSet;   /// The vertex set this came from
+            size_t indexSet;    /// The index set this was referenced (first) from
+            size_t originalIndex; /// Place of vertex in original vertex set
+        };
+        /** A set of indexed geometry data */
+        struct Geometry {
+            size_t vertexSet;           /// The vertex data set this geometry data refers to
+            size_t indexSet;            /// The index data set this geometry data refers to
+            const IndexData* indexData; /// The index information which describes the triangles.
+            RenderOperation::OperationType opType;  /// The operation type used to render this geometry
+        };
+        /** Comparator for sorting geometries by vertex set */
+        struct geometryLess {
+            bool operator()(const Geometry& a, const Geometry& b) const
+            {
+                if (a.vertexSet < b.vertexSet) return true;
+                if (a.vertexSet > b.vertexSet) return false;
+                return a.indexSet < b.indexSet;
+            }
+        };
+        /** Comparator for unique vertex list */
+        struct vectorLess {
+            bool operator()(const Vector3& a, const Vector3& b) const
+            {
+                if (a.x < b.x) return true;
+                if (a.x > b.x) return false;
+                if (a.y < b.y) return true;
+                if (a.y > b.y) return false;
+                return a.z < b.z;
+            }
+        };
+
+        typedef vector<const VertexData*>::type VertexDataList;
+        typedef vector<Geometry>::type GeometryList;
+        typedef vector<CommonVertex>::type CommonVertexList;
+
+        GeometryList mGeometryList;
+        VertexDataList mVertexDataList;
+        CommonVertexList mVertices;
+        EdgeData* mEdgeData;
+		/// Map for identifying common vertices
+		typedef map<Vector3, size_t, vectorLess>::type CommonVertexMap;
+		CommonVertexMap mCommonVertexMap;
+        /** Edge map, used to connect edges. Note we allow many triangles on an edge,
+        after connected an existing edge, we will remove it and never used again.
+        */
+        typedef multimap< std::pair<size_t, size_t>, std::pair<size_t, size_t> >::type EdgeMap;
+        EdgeMap mEdgeMap;
+
+        void buildTrianglesEdges(const Geometry &geometry);
+
+        /// Finds an existing common vertex, or inserts a new one
+        size_t findOrCreateCommonVertex(const Vector3& vec, size_t vertexSet, 
+            size_t indexSet, size_t originalIndex);
+        /// Connect existing edge or create a new edge - utility method during building
+        void connectOrCreateEdge(size_t vertexSet, size_t triangleIndex, size_t vertIndex0, size_t vertIndex1, 
+            size_t sharedVertIndex0, size_t sharedVertIndex1);
+    };
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreEntity.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreEntity.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreEntity.h	(revision 148)
@@ -0,0 +1,881 @@
+/*
+-----------------------------------------------------------------------------
+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 __Entity_H__
+#define __Entity_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreCommon.h"
+
+#include "OgreString.h"
+#include "OgreMovableObject.h"
+#include "OgreQuaternion.h"
+#include "OgreVector3.h"
+#include "OgreHardwareBufferManager.h"
+#include "OgreMesh.h"
+#include "OgreRenderable.h"
+#include "OgreResourceGroupManager.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+    /** \addtogroup Core
+    *  @{
+    */
+    /** \addtogroup Scene
+    *  @{
+    */
+    /** Defines an instance of a discrete, movable object based on a Mesh.
+    @remarks
+        Ogre generally divides renderable objects into 2 groups, discrete
+        (separate) and relatively small objects which move around the world,
+        and large, sprawling geometry which makes up generally immovable
+        scenery, aka 'level geometry'.
+    @par
+        The Mesh and SubMesh classes deal with the definition of the geometry
+        used by discrete movable objects. Entities are actual instances of
+        objects based on this geometry in the world. Therefore there is
+        usually a single set Mesh for a car, but there may be multiple
+        entities based on it in the world. Entities are able to override
+        aspects of the Mesh it is defined by, such as changing material
+        properties per instance (so you can have many cars using the same
+        geometry but different textures for example). Because a Mesh is split
+        into SubMeshes for this purpose, the Entity class is a grouping class
+        (much like the Mesh class) and much of the detail regarding
+        individual changes is kept in the SubEntity class. There is a 1:1
+        relationship between SubEntity instances and the SubMesh instances
+        associated with the Mesh the Entity is based on.
+    @par
+        Entity and SubEntity classes are never created directly. Use the
+        createEntity method of the SceneManager (passing a model name) to
+        create one.
+    @par
+        Entities are included in the scene by associating them with a
+        SceneNode, using the attachEntity method. See the SceneNode class
+        for full information.
+    @note
+        No functions were declared virtual to improve performance.
+    */
+    class _OgreExport Entity: public MovableObject, public Resource::Listener
+    {
+        // Allow EntityFactory full access
+        friend class EntityFactory;
+        friend class SubEntity;
+    public:
+        
+        typedef set<Entity*>::type EntitySet;
+        typedef map<unsigned short, bool>::type SchemeHardwareAnimMap;
+
+    protected:
+
+        /** Private constructor (instances cannot be created directly).
+        */
+        Entity();
+        /** Private constructor - specify name (the usual constructor used).
+        */
+        Entity( const String& name, const MeshPtr& mesh);
+
+        /** The Mesh that this Entity is based on.
+        */
+        MeshPtr mMesh;
+
+        /** List of SubEntities (point to SubMeshes).
+        */
+        typedef vector<SubEntity*>::type SubEntityList;
+        SubEntityList mSubEntityList;
+
+
+        /// State of animation for animable meshes
+        AnimationStateSet* mAnimationState;
+
+
+        /// Temp buffer details for software skeletal anim of shared geometry
+        TempBlendedBufferInfo mTempSkelAnimInfo;
+        /// Vertex data details for software skeletal anim of shared geometry
+        VertexData* mSkelAnimVertexData;
+        /// Temp buffer details for software vertex anim of shared geometry
+        TempBlendedBufferInfo mTempVertexAnimInfo;
+        /// Vertex data details for software vertex anim of shared geometry
+        VertexData* mSoftwareVertexAnimVertexData;
+        /// Vertex data details for hardware vertex anim of shared geometry
+        /// - separate since we need to s/w anim for shadows whilst still altering
+        ///   the vertex data for hardware morphing (pos2 binding)
+        VertexData* mHardwareVertexAnimVertexData;
+        /// Have we applied any vertex animation to shared geometry?
+        bool mVertexAnimationAppliedThisFrame;
+        /// Have the temp buffers already had their geometry prepared for use in rendering shadow volumes?
+        bool mPreparedForShadowVolumes;
+
+        /** Internal method - given vertex data which could be from the Mesh or
+            any submesh, finds the temporary blend copy.
+        */
+        const VertexData* findBlendedVertexData(const VertexData* orig);
+        /** Internal method - given vertex data which could be from the Mesh or
+            any SubMesh, finds the corresponding SubEntity.
+        */
+        SubEntity* findSubEntityForVertexData(const VertexData* orig);
+
+        /** Internal method for extracting metadata out of source vertex data
+            for fast assignment of temporary buffers later.
+        */
+        void extractTempBufferInfo(VertexData* sourceData, TempBlendedBufferInfo* info);
+        /** Internal method to clone vertex data definitions but to remove blend buffers. */
+        VertexData* cloneVertexDataRemoveBlendInfo(const VertexData* source);
+        /** Internal method for preparing this Entity for use in animation. */
+        void prepareTempBlendBuffers(void);
+        /** Mark all vertex data as so far unanimated.
+        */
+        void markBuffersUnusedForAnimation(void);
+        /** Internal method to restore original vertex data where we didn't
+            perform any vertex animation this frame.
+        */
+        void restoreBuffersForUnusedAnimation(bool hardwareAnimation);
+
+        /** Ensure that any unbound  pose animation buffers are bound to a safe
+            default.
+        @param srcData
+            Original vertex data containing original positions.
+        @param destData
+            Hardware animation vertex data to be checked.
+        */
+        void bindMissingHardwarePoseBuffers(const VertexData* srcData, 
+            VertexData* destData);
+            
+        /** When performing software pose animation, initialise software copy
+            of vertex data.
+        */
+        void initialisePoseVertexData(const VertexData* srcData, VertexData* destData, 
+            bool animateNormals);
+
+        /** When animating normals for pose animation, finalise normals by filling in
+            with the reference mesh normal where applied normal weights < 1.
+        */
+        void finalisePoseNormals(const VertexData* srcData, VertexData* destData);
+
+        /// Cached bone matrices, including any world transform.
+        Matrix4 *mBoneWorldMatrices;
+        /// Cached bone matrices in skeleton local space, might shares with other entity instances.
+        Matrix4 *mBoneMatrices;
+        unsigned short mNumBoneMatrices;
+        /// Records the last frame in which animation was updated.
+        unsigned long mFrameAnimationLastUpdated;
+
+        /// Perform all the updates required for an animated entity.
+        void updateAnimation(void);
+
+        /// Records the last frame in which the bones was updated.
+        /// It's a pointer because it can be shared between different entities with
+        /// a shared skeleton.
+        unsigned long *mFrameBonesLastUpdated;
+
+        /** A set of all the entities which shares a single SkeletonInstance.
+            This is only created if the entity is in fact sharing it's SkeletonInstance with
+            other Entities.
+        */
+        EntitySet* mSharedSkeletonEntities;
+
+        /** Private method to cache bone matrices from skeleton.
+        @return
+            True if the bone matrices cache has been updated. False if note.
+        */
+        bool cacheBoneMatrices(void);
+
+        /// Flag determines whether or not to display skeleton.
+        bool mDisplaySkeleton;
+        /** Flag indicating whether hardware animation is supported by this entities materials
+            data is saved per scehme number.
+        */
+        SchemeHardwareAnimMap mSchemeHardwareAnim;
+
+        /// Current state of the hardware animation as represented by the entities parameters.
+        bool mCurrentHWAnimationState;
+
+        /// Number of hardware poses supported by materials.
+        ushort mHardwarePoseCount;
+        /// Flag indicating whether we have a vertex program in use on any of our subentities.
+        bool mVertexProgramInUse;
+        /// Counter indicating number of requests for software animation.
+        int mSoftwareAnimationRequests;
+        /// Counter indicating number of requests for software blended normals.
+        int mSoftwareAnimationNormalsRequests;
+        /// Flag indicating whether to skip automatic updating of the Skeleton's AnimationState.
+        bool mSkipAnimStateUpdates;
+        /// Flag indicating whether to update the main entity skeleton even when an LOD is displayed.
+        bool mAlwaysUpdateMainSkeleton;
+
+
+        /// The LOD number of the mesh to use, calculated by _notifyCurrentCamera.
+        ushort mMeshLodIndex;
+
+        /// LOD bias factor, transformed for optimisation when calculating adjusted LOD value.
+        Real mMeshLodFactorTransformed;
+        /// Index of minimum detail LOD (NB higher index is lower detail).
+        ushort mMinMeshLodIndex;
+        /// Index of maximum detail LOD (NB lower index is higher detail).
+        ushort mMaxMeshLodIndex;
+
+        /// LOD bias factor, not transformed.
+        Real mMaterialLodFactor;
+        /// LOD bias factor, transformed for optimisation when calculating adjusted LOD value.
+        Real mMaterialLodFactorTransformed;
+        /// Index of minimum detail LOD (NB higher index is lower detail).
+        ushort mMinMaterialLodIndex;
+        /// Index of maximum detail LOD (NB lower index is higher detail).
+        ushort mMaxMaterialLodIndex;
+
+        /** List of LOD Entity instances (for manual LODs).
+            We don't know when the mesh is using manual LODs whether one LOD to the next will have the
+            same number of SubMeshes, therefore we have to allow a separate Entity list
+            with each alternate one.
+        */
+        typedef vector<Entity*>::type LODEntityList;
+        LODEntityList mLodEntityList;
+
+        /** This Entity's personal copy of the skeleton, if skeletally animated.
+        */
+        SkeletonInstance* mSkeletonInstance;
+
+        /// Has this entity been initialised yet?
+        bool mInitialised;
+
+        /// Last parent transform.
+        Matrix4 mLastParentXform;
+
+        /// Mesh state count, used to detect differences.
+        size_t mMeshStateCount;
+
+        /** Builds a list of SubEntities based on the SubMeshes contained in the Mesh. */
+        void buildSubEntityList(MeshPtr& mesh, SubEntityList* sublist);
+
+        /// Internal implementation of attaching a 'child' object to this entity and assign the parent node to the child entity.
+        void attachObjectImpl(MovableObject *pMovable, TagPoint *pAttachingPoint);
+
+        /// Internal implementation of detaching a 'child' object of this entity and clear the parent node of the child entity.
+        void detachObjectImpl(MovableObject* pObject);
+
+        /// Internal implementation of detaching all 'child' objects of this entity.
+        void detachAllObjectsImpl(void);
+
+        /// Ensures reevaluation of the vertex processing usage.
+        void reevaluateVertexProcessing(void);
+
+        /** Calculates the kind of vertex processing in use.
+        @remarks
+            This function's return value is calculated according to the current 
+            active scheme. This is due to the fact that RTSS schemes may be different
+            in their handling of hardware animation.
+        */
+        bool calcVertexProcessing(void);
+    
+        /// Apply vertex animation.
+        void applyVertexAnimation(bool hardwareAnimation, bool stencilShadows);
+        /// Initialise the hardware animation elements for given vertex data.
+        ushort initHardwareAnimationElements(VertexData* vdata, ushort numberOfElements, bool animateNormals);
+        /// Are software vertex animation temp buffers bound?
+        bool tempVertexAnimBuffersBound(void) const;
+        /// Are software skeleton animation temp buffers bound?
+        bool tempSkelAnimBuffersBound(bool requestNormals) const;
+
+    public:
+        /// Contains the child objects (attached to bones) indexed by name.
+        typedef map<String, MovableObject*>::type ChildObjectList;
+    protected:
+        ChildObjectList mChildObjectList;
+
+
+        /// Bounding box that 'contains' all the mesh of each child entity.
+        mutable AxisAlignedBox mFullBoundingBox;
+
+        ShadowRenderableList mShadowRenderables;
+
+        /** Nested class to allow entity shadows. */
+        class _OgreExport EntityShadowRenderable : public ShadowRenderable
+        {
+        protected:
+            Entity* mParent;
+            /// Shared link to position buffer.
+            HardwareVertexBufferSharedPtr mPositionBuffer;
+            /// Shared link to w-coord buffer (optional).
+            HardwareVertexBufferSharedPtr mWBuffer;
+            /// Link to current vertex data used to bind (maybe changes).
+            const VertexData* mCurrentVertexData;
+            /// Original position buffer source binding.
+            unsigned short mOriginalPosBufferBinding;
+            /// Link to SubEntity, only present if SubEntity has it's own geometry.
+            SubEntity* mSubEntity;
+
+
+        public:
+            EntityShadowRenderable(Entity* parent,
+                HardwareIndexBufferSharedPtr* indexBuffer, const VertexData* vertexData,
+                bool createSeparateLightCap, SubEntity* subent, bool isLightCap = false);
+            ~EntityShadowRenderable();
+            
+            /// Create the separate light cap if it doesn't already exists.
+            void _createSeparateLightCap();
+            /// @copydoc ShadowRenderable::getWorldTransforms.
+            void getWorldTransforms(Matrix4* xform) const;
+            HardwareVertexBufferSharedPtr getPositionBuffer(void) { return mPositionBuffer; }
+            HardwareVertexBufferSharedPtr getWBuffer(void) { return mWBuffer; }
+            /// Rebind the source positions (for temp buffer users).
+            void rebindPositionBuffer(const VertexData* vertexData, bool force);
+            /// @copydoc ShadowRenderable::isVisible.
+            bool isVisible(void) const;
+            /// @copydoc ShadowRenderable::rebindIndexBuffer.
+            virtual void rebindIndexBuffer(const HardwareIndexBufferSharedPtr& indexBuffer);
+        };
+    public:
+        /** Default destructor.
+        */
+        ~Entity();
+
+        /** Gets the Mesh that this Entity is based on.
+        */
+        const MeshPtr& getMesh(void) const;
+
+        /** Gets a pointer to a SubEntity, ie a part of an Entity.
+        */
+        SubEntity* getSubEntity(unsigned int index) const;
+
+        /** Gets a pointer to a SubEntity by name
+        @remarks 
+            Names should be initialized during a Mesh creation.
+        */
+        SubEntity* getSubEntity( const String& name ) const;
+
+        /** Retrieves the number of SubEntity objects making up this entity.
+        */
+        unsigned int getNumSubEntities(void) const;
+
+        /** Clones this entity and returns a pointer to the clone.
+        @remarks
+            Useful method for duplicating an entity. The new entity must be
+            given a unique name, and is not attached to the scene in any way
+            so must be attached to a SceneNode to be visible (exactly as
+            entities returned from SceneManager::createEntity).
+        @param newName
+            Name for the new entity.
+        */
+        Entity* clone( const String& newName ) const;
+
+        /** Sets the material to use for the whole of this entity.
+        @remarks
+            This is a shortcut method to set all the materials for all
+            subentities of this entity. Only use this method is you want to
+            set the same material for all subentities or if you know there
+            is only one. Otherwise call getSubEntity() and call the same
+            method on the individual SubEntity.
+        */
+        void setMaterialName( const String& name, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME );
+
+        
+        /** Sets the material to use for the whole of this entity.
+        @remarks
+            This is a shortcut method to set all the materials for all
+            subentities of this entity. Only use this method is you want to
+            set the same material for all subentities or if you know there
+            is only one. Otherwise call getSubEntity() and call the same
+            method on the individual SubEntity.
+        */
+        void setMaterial(const MaterialPtr& material);
+
+        /** @copydoc MovableObject::_notifyCurrentCamera.
+        */
+        void _notifyCurrentCamera(Camera* cam);
+
+        /// @copydoc MovableObject::setRenderQueueGroup.
+        void setRenderQueueGroup(uint8 queueID);
+
+        /// @copydoc MovableObject::setRenderQueueGroupAndPriority.
+        void setRenderQueueGroupAndPriority(uint8 queueID, ushort priority);
+
+        /** @copydoc MovableObject::getBoundingBox.
+        */
+        const AxisAlignedBox& getBoundingBox(void) const;
+
+        /// Merge all the child object Bounds a return it.
+        AxisAlignedBox getChildObjectsBoundingBox(void) const;
+
+        /** @copydoc MovableObject::_updateRenderQueue.
+        */
+        void _updateRenderQueue(RenderQueue* queue);
+
+        /** @copydoc MovableObject::getMovableType */
+        const String& getMovableType(void) const;
+
+        /** For entities based on animated meshes, gets the AnimationState object for a single animation.
+        @remarks
+            You animate an entity by updating the animation state objects. Each of these represents the
+            current state of each animation available to the entity. The AnimationState objects are
+            initialised from the Mesh object.
+        */
+        AnimationState* getAnimationState(const String& name) const;
+        /** Returns whether the AnimationState with the given name exists. */
+        bool hasAnimationState(const String& name) const;
+        /** For entities based on animated meshes, gets the AnimationState objects for all animations.
+        @return
+            In case the entity is animated, this functions returns the pointer to a AnimationStateSet
+            containing all animations of the entries. If the entity is not animated, it returns 0.
+        @remarks
+            You animate an entity by updating the animation state objects. Each of these represents the
+            current state of each animation available to the entity. The AnimationState objects are
+            initialised from the Mesh object.
+        */
+        AnimationStateSet* getAllAnimationStates(void) const;
+
+        /** Tells the Entity whether or not it should display it's skeleton, if it has one.
+        */
+        void setDisplaySkeleton(bool display);
+
+        /** Returns whether or not the entity is currently displaying its skeleton.
+        */
+        bool getDisplaySkeleton(void) const;
+
+
+        /** Gets a pointer to the entity representing the numbered manual level of detail.
+        @remarks
+            The zero-based index never includes the original entity, unlike
+            Mesh::getLodLevel.
+        */
+        Entity* getManualLodLevel(size_t index) const;
+
+        /** Returns the number of manual levels of detail that this entity supports.
+        @remarks
+            This number never includes the original entity, it is difference
+            with Mesh::getNumLodLevels.
+        */
+        size_t getNumManualLodLevels(void) const;
+
+        /** Returns the current LOD used to render
+        */
+        ushort getCurrentLodIndex() { return mMeshLodIndex; }
+
+        /** Sets a level-of-detail bias for the mesh detail of this entity.
+        @remarks
+            Level of detail reduction is normally applied automatically based on the Mesh
+            settings. However, it is possible to influence this behaviour for this entity
+            by adjusting the LOD bias. This 'nudges' the mesh level of detail used for this
+            entity up or down depending on your requirements. You might want to use this
+            if there was a particularly important entity in your scene which you wanted to
+            detail better than the others, such as a player model.
+        @par
+            There are three parameters to this method; the first is a factor to apply; it
+            defaults to 1.0 (no change), by increasing this to say 2.0, this model would
+            take twice as long to reduce in detail, whilst at 0.5 this entity would use lower
+            detail versions twice as quickly. The other 2 parameters are hard limits which
+            let you set the maximum and minimum level-of-detail version to use, after all
+            other calculations have been made. This lets you say that this entity should
+            never be simplified, or that it can only use LODs below a certain level even
+            when right next to the camera.
+        @param factor
+            Proportional factor to apply to the distance at which LOD is changed.
+            Higher values increase the distance at which higher LODs are displayed (2.0 is
+            twice the normal distance, 0.5 is half).
+        @param maxDetailIndex
+            The index of the maximum LOD this entity is allowed to use (lower
+            indexes are higher detail: index 0 is the original full detail model).
+        @param minDetailIndex
+            The index of the minimum LOD this entity is allowed to use (higher
+            indexes are lower detail). Use something like 99 if you want unlimited LODs (the actual
+            LOD will be limited by the number in the Mesh).
+        */
+        void setMeshLodBias(Real factor, ushort maxDetailIndex = 0, ushort minDetailIndex = 99);
+
+        /** Sets a level-of-detail bias for the material detail of this entity.
+        @remarks
+            Level of detail reduction is normally applied automatically based on the Material
+            settings. However, it is possible to influence this behaviour for this entity
+            by adjusting the LOD bias. This 'nudges' the material level of detail used for this
+            entity up or down depending on your requirements. You might want to use this
+            if there was a particularly important entity in your scene which you wanted to
+            detail better than the others, such as a player model.
+        @par
+            There are three parameters to this method; the first is a factor to apply; it
+            defaults to 1.0 (no change), by increasing this to say 2.0, this entity would
+            take twice as long to use a lower detail material, whilst at 0.5 this entity
+            would use lower detail versions twice as quickly. The other 2 parameters are
+            hard limits which let you set the maximum and minimum level-of-detail index
+            to use, after all other calculations have been made. This lets you say that
+            this entity should never be simplified, or that it can only use LODs below
+            a certain level even when right next to the camera.
+        @param factor
+            Proportional factor to apply to the distance at which LOD is changed.
+            Higher values increase the distance at which higher LODs are displayed (2.0 is
+            twice the normal distance, 0.5 is half).
+        @param maxDetailIndex
+            The index of the maximum LOD this entity is allowed to use (lower
+            indexes are higher detail: index 0 is the original full detail model).
+        @param minDetailIndex
+            The index of the minimum LOD this entity is allowed to use (higher
+            indexes are lower detail. Use something like 99 if you want unlimited LODs (the actual
+            LOD will be limited by the number of LOD indexes used in the Material).
+        */
+        void setMaterialLodBias(Real factor, ushort maxDetailIndex = 0, ushort minDetailIndex = 99);
+
+        /** Sets whether the polygon mode of this entire entity may be
+            overridden by the camera detail settings.
+        */
+        void setPolygonModeOverrideable(bool PolygonModeOverrideable);
+        /** Attaches another object to a certain bone of the skeleton which this entity uses.
+        @remarks
+            This method can be used to attach another object to an animated part of this entity,
+            by attaching it to a bone in the skeleton (with an offset if required). As this entity
+            is animated, the attached object will move relative to the bone to which it is attached.
+        @par
+            An exception is thrown if the movable object is already attached to the bone, another bone or scenenode.
+            If the entity has no skeleton or the bone name cannot be found then an exception is thrown.
+        @param boneName
+            The name of the bone (in the skeleton) to attach this object
+        @param pMovable
+            Pointer to the object to attach
+        @param offsetOrientation
+            An adjustment to the orientation of the attached object, relative to the bone.
+        @param offsetPosition
+            An adjustment to the position of the attached object, relative to the bone.
+        @return
+            The TagPoint to which the object has been attached
+        */
+        TagPoint* attachObjectToBone(const String &boneName,
+            MovableObject *pMovable,
+            const Quaternion &offsetOrientation = Quaternion::IDENTITY,
+            const Vector3 &offsetPosition = Vector3::ZERO);
+
+        /** Detach a MovableObject previously attached using attachObjectToBone.
+            If the movable object name is not found then an exception is raised.
+        @param movableName
+            The name of the movable object to be detached.
+        */
+        MovableObject* detachObjectFromBone(const String &movableName);
+
+        /** Detaches an object by pointer.
+        @remarks
+            Use this method to destroy a MovableObject which is attached to a bone of belonging this entity.
+            But sometimes the object may be not in the child object list because it is a LOD entity,
+            this method can safely detect and ignore in this case and won't raise an exception.
+        */
+        void detachObjectFromBone(MovableObject* obj);
+
+        /// Detach all MovableObjects previously attached using attachObjectToBone
+        void detachAllObjectsFromBone(void);
+
+        typedef MapIterator<ChildObjectList> ChildObjectListIterator;
+        /** Gets an iterator to the list of objects attached to bones on this entity. */
+        ChildObjectListIterator getAttachedObjectIterator(void);
+        /** @copydoc MovableObject::getBoundingRadius */
+        Real getBoundingRadius(void) const;
+
+        /** @copydoc MovableObject::getWorldBoundingBox */
+        const AxisAlignedBox& getWorldBoundingBox(bool derive = false) const;
+        /** @copydoc MovableObject::getWorldBoundingSphere */
+        const Sphere& getWorldBoundingSphere(bool derive = false) const;
+
+        /** @copydoc ShadowCaster::getEdgeList. */
+        EdgeData* getEdgeList(void);
+        /** @copydoc ShadowCaster::hasEdgeList. */
+        bool hasEdgeList(void);
+        /** @copydoc ShadowCaster::getShadowVolumeRenderableIterator. */
+        ShadowRenderableListIterator getShadowVolumeRenderableIterator(
+            ShadowTechnique shadowTechnique, const Light* light,
+            HardwareIndexBufferSharedPtr* indexBuffer, size_t* indexBufferUsedSize,
+            bool extrudeVertices, Real extrusionDistance, unsigned long flags = 0 );
+
+        /** Internal method for retrieving bone matrix information. */
+        const Matrix4* _getBoneMatrices(void) const { return mBoneMatrices;}
+        /** Internal method for retrieving bone matrix information. */
+        unsigned short _getNumBoneMatrices(void) const { return mNumBoneMatrices; }
+        /** Returns whether or not this entity is skeletally animated. */
+        bool hasSkeleton(void) const { return mSkeletonInstance != 0; }
+        /** Get this Entity's personal skeleton instance. */
+        SkeletonInstance* getSkeleton(void) const { return mSkeletonInstance; }
+        /** Returns whether or not hardware animation is enabled.
+        @remarks
+            Because fixed-function indexed vertex blending is rarely supported
+            by existing graphics cards, hardware animation can only be done if
+            the vertex programs in the materials used to render an entity support
+            it. Therefore, this method will only return true if all the materials
+            assigned to this entity have vertex programs assigned, and all those
+            vertex programs must support 'includes_morph_animation true' if using
+            morph animation, 'includes_pose_animation true' if using pose animation
+            and 'includes_skeletal_animation true' if using skeletal animation.
+
+            Also note the the function returns value according to the current active
+            scheme. This is due to the fact that RTSS schemes may be different in their
+            handling of hardware animation.
+        */
+        bool isHardwareAnimationEnabled(void);
+
+        /** @copydoc MovableObject::_notifyAttached */
+        void _notifyAttached(Node* parent, bool isTagPoint = false);
+        /** Returns the number of requests that have been made for software animation
+        @remarks
+            If non-zero then software animation will be performed in updateAnimation
+            regardless of the current setting of isHardwareAnimationEnabled or any
+            internal optimise for eliminate software animation. Requests for software
+            animation are made by calling the addSoftwareAnimationRequest() method.
+        */
+        int getSoftwareAnimationRequests(void) const { return mSoftwareAnimationRequests; }
+        /** Returns the number of requests that have been made for software animation of normals
+        @remarks
+            If non-zero, and getSoftwareAnimationRequests() also returns non-zero,
+            then software animation of normals will be performed in updateAnimation
+            regardless of the current setting of isHardwareAnimationEnabled or any
+            internal optimise for eliminate software animation. Currently it is not
+            possible to force software animation of only normals. Consequently this
+            value is always less than or equal to that returned by getSoftwareAnimationRequests().
+            Requests for software animation of normals are made by calling the
+            addSoftwareAnimationRequest() method with 'true' as the parameter.
+        */
+        int getSoftwareAnimationNormalsRequests(void) const { return mSoftwareAnimationNormalsRequests; }
+        /** Add a request for software animation
+        @remarks
+            Tells the entity to perform animation calculations for skeletal/vertex
+            animations in software, regardless of the current setting of
+            isHardwareAnimationEnabled().  Software animation will be performed
+            any time one or more requests have been made.  If 'normalsAlso' is
+            'true', then the entity will also do software blending on normal
+            vectors, in addition to positions. This advanced method useful for
+            situations in which access to actual mesh vertices is required,
+            such as accurate collision detection or certain advanced shading
+            techniques. When software animation is no longer needed,
+            the caller of this method should always remove the request by calling
+            removeSoftwareAnimationRequest(), passing the same value for
+            'normalsAlso'.
+        */
+        void addSoftwareAnimationRequest(bool normalsAlso);
+        /** Removes a request for software animation
+        @remarks
+            Calling this decrements the entity's internal counter of the number
+            of requests for software animation.  If the counter is already zero
+            then calling this method throws an exception.  The 'normalsAlso'
+            flag if set to 'true' will also decrement the internal counter of
+            number of requests for software animation of normals.
+        */
+        void removeSoftwareAnimationRequest(bool normalsAlso);
+
+        /** Shares the SkeletonInstance with the supplied entity.
+            Note that in order for this to work, both entities must have the same
+            Skeleton.
+        */
+        void shareSkeletonInstanceWith(Entity* entity);
+
+        /** Returns whether or not this entity is either morph or pose animated.
+        */
+        bool hasVertexAnimation(void) const;
+
+
+        /** Stops sharing the SkeletonInstance with other entities.
+        */
+        void stopSharingSkeletonInstance();
+
+
+        /** Returns whether this entity shares it's SkeltonInstance with other entity instances.
+        */
+        inline bool sharesSkeletonInstance() const { return mSharedSkeletonEntities != NULL; }
+
+        /** Returns a pointer to the set of entities which share a SkeletonInstance.
+            If this instance does not share it's SkeletonInstance with other instances @c NULL will be returned
+        */
+        inline const EntitySet* getSkeletonInstanceSharingSet() const { return mSharedSkeletonEntities; }
+
+        /** Updates the internal animation state set to include the latest
+            available animations from the attached skeleton.
+        @remarks
+            Use this method if you manually add animations to a skeleton, or have
+            linked the skeleton to another for animation purposes since creating
+            this entity.
+        @note
+            If you have called getAnimationState prior to calling this method,
+            the pointers will still remain valid.
+        */
+        void refreshAvailableAnimationState(void);
+
+        /** Advanced method to perform all the updates required for an animated entity.
+        @remarks
+            You don't normally need to call this, but it's here in case you wish
+            to manually update the animation of an Entity at a specific point in
+            time. Animation will not be updated more than once a frame no matter
+            how many times you call this method.
+        */
+        void _updateAnimation(void);
+
+        /** Tests if any animation applied to this entity.
+        @remarks
+            An entity is animated if any animation state is enabled, or any manual bone
+            applied to the skeleton.
+        */
+        bool _isAnimated(void) const;
+
+        /** Tests if skeleton was animated.
+        */
+        bool _isSkeletonAnimated(void) const;
+
+        /** Advanced method to get the temporarily blended skeletal vertex information
+            for entities which are software skinned.
+        @remarks
+            Internal engine will eliminate software animation if possible, this
+            information is unreliable unless added request for software animation
+            via addSoftwareAnimationRequest.
+        @note
+            The positions/normals of the returned vertex data is in object space.
+        */
+        VertexData* _getSkelAnimVertexData(void) const;
+        /** Advanced method to get the temporarily blended software vertex animation information
+        @remarks
+            Internal engine will eliminate software animation if possible, this
+            information is unreliable unless added request for software animation
+            via addSoftwareAnimationRequest.
+        @note
+            The positions/normals of the returned vertex data is in object space.
+        */
+        VertexData* _getSoftwareVertexAnimVertexData(void) const;
+        /** Advanced method to get the hardware morph vertex information
+        @note
+            The positions/normals of the returned vertex data is in object space.
+        */
+        VertexData* _getHardwareVertexAnimVertexData(void) const;
+        /** Advanced method to get the temp buffer information for software
+            skeletal animation.
+        */
+        TempBlendedBufferInfo* _getSkelAnimTempBufferInfo(void);
+        /** Advanced method to get the temp buffer information for software
+            morph animation.
+        */
+        TempBlendedBufferInfo* _getVertexAnimTempBufferInfo(void);
+        /// Override to return specific type flag.
+        uint32 getTypeFlags(void) const;
+        /// Retrieve the VertexData which should be used for GPU binding.
+        VertexData* getVertexDataForBinding(void);
+
+        /// Identify which vertex data we should be sending to the renderer.
+        enum VertexDataBindChoice
+        {
+            BIND_ORIGINAL,
+            BIND_SOFTWARE_SKELETAL,
+            BIND_SOFTWARE_MORPH,
+            BIND_HARDWARE_MORPH
+        };
+        /// Choose which vertex data to bind to the renderer.
+        VertexDataBindChoice chooseVertexDataForBinding(bool hasVertexAnim);
+
+        /** Are buffers already marked as vertex animated? */
+        bool _getBuffersMarkedForAnimation(void) const { return mVertexAnimationAppliedThisFrame; }
+        /** Mark just this vertex data as animated.
+        */
+        void _markBuffersUsedForAnimation(void);
+
+        /** Has this Entity been initialised yet?
+        @remarks
+            If this returns false, it means this Entity hasn't been completely
+            constructed yet from the underlying resources (Mesh, Skeleton), which 
+            probably means they were delay-loaded and aren't available yet. This
+            Entity won't render until it has been successfully initialised, nor
+            will many of the manipulation methods function.
+        */
+        bool isInitialised(void) const { return mInitialised; }
+
+        /** Try to initialise the Entity from the underlying resources.
+        @remarks
+            This method builds the internal structures of the Entity based on it
+            resources (Mesh, Skeleton). This may or may not succeed if the 
+            resources it references have been earmarked for background loading,
+            so you should check isInitialised afterwards to see if it was successful.
+        @param forceReinitialise
+            If @c true, this forces the Entity to tear down it's
+            internal structures and try to rebuild them. Useful if you changed the
+            content of a Mesh or Skeleton at runtime.
+        */
+        void _initialise(bool forceReinitialise = false);
+        /** Tear down the internal structures of this Entity, rendering it uninitialised. */
+        void _deinitialise(void);
+
+        /** Resource::Listener hook to notify Entity that a delay-loaded Mesh is
+            complete.
+        */
+        void backgroundLoadingComplete(Resource* res);
+
+        /// @copydoc MovableObject::visitRenderables
+        void visitRenderables(Renderable::Visitor* visitor, 
+            bool debugRenderables = false);
+
+        /** Get the LOD strategy transformation of the mesh LOD factor. */
+        Real _getMeshLodFactorTransformed() const;
+        
+        /** Entity's skeleton's AnimationState will not be automatically updated when set to true.
+            Useful if you wish to handle AnimationState updates manually.
+        */
+        void setSkipAnimationStateUpdate(bool skip) {
+            mSkipAnimStateUpdates = skip;
+        }
+        
+        /** Entity's skeleton's AnimationState will not be automatically updated when set to true.
+            Useful if you wish to handle AnimationState updates manually.
+        */
+        bool getSkipAnimationStateUpdate() const {
+            return mSkipAnimStateUpdates;
+        }
+
+        /** The skeleton of the main entity will be updated even if the an LOD entity is being displayed.
+            useful if you have entities attached to the main entity. Otherwise position of attached
+            entities will not be updated.
+        */
+        void setAlwaysUpdateMainSkeleton(bool update) {
+            mAlwaysUpdateMainSkeleton = update;
+        }
+
+        /** The skeleton of the main entity will be updated even if the an LOD entity is being displayed.
+            useful if you have entities attached to the main entity. Otherwise position of attached
+            entities will not be updated.
+        */
+        bool getAlwaysUpdateMainSkeleton() const {
+            return mAlwaysUpdateMainSkeleton;
+        }
+
+        
+    };
+
+    /** Factory object for creating Entity instances */
+    class _OgreExport EntityFactory : public MovableObjectFactory
+    {
+    protected:
+        MovableObject* createInstanceImpl( const String& name, const NameValuePairList* params);
+    public:
+        EntityFactory() {}
+        ~EntityFactory() {}
+
+        static String FACTORY_TYPE_NAME;
+
+        const String& getType(void) const;
+        void destroyInstance( MovableObject* obj);
+
+    };
+    /** @} */
+    /** @} */
+
+} // namespace Ogre
+
+#include "OgreHeaderSuffix.h"
+
+#endif // __Entity_H__
Index: /ogre_src_v1-9-0/OgreMain/include/OgreErrorDialog.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreErrorDialog.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreErrorDialog.h	(revision 148)
@@ -0,0 +1,57 @@
+/*
+-----------------------------------------------------------------------------
+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 __COMMON_OGRE_ERRORDIALOG_H__
+#define __COMMON_OGRE_ERRORDIALOG_H__
+
+#include "OgrePrerequisites.h"
+#include "OgrePlatform.h"
+
+// Bring in the specific platform's header file
+#if defined OGRE_GUI_WIN32
+# include "WIN32/OgreErrorDialogImp.h"
+#elif defined OGRE_GUI_gtk
+# include "gtk/OgreErrorDialogImp.h"
+#elif defined OGRE_GUI_GLX
+# include "GLX/OgreErrorDialogImp.h"
+#elif OGRE_PLATFORM == OGRE_PLATFORM_WIN32
+# include "WIN32/OgreErrorDialogImp.h"
+#elif OGRE_PLATFORM == OGRE_PLATFORM_WINRT
+# include "WIN32/OgreErrorDialogImpWinRT.h"
+#elif OGRE_PLATFORM == OGRE_PLATFORM_LINUX
+# include "GLX/OgreErrorDialogImp.h"
+#elif OGRE_PLATFORM == OGRE_PLATFORM_NACL
+# include "NaCl/OgreErrorDialogImp.h"
+#elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+# include "OSX/OgreErrorDialogImp.h"
+#elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS
+# include "iOS/OgreErrorDialogImp.h"
+#elif OGRE_PLATFORM == OGRE_PLATFORM_ANDROID
+# include "Android/OgreErrorDialogImp.h"
+#endif
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreException.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreException.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreException.h	(revision 148)
@@ -0,0 +1,344 @@
+/*
+-----------------------------------------------------------------------------
+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 __Exception_H_
+#define __Exception_H_
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+#include "OgreString.h"
+#include <exception>
+#include "OgreHeaderPrefix.h"
+
+// Check for OGRE assert mode
+
+// RELEASE_EXCEPTIONS mode
+#if OGRE_ASSERT_MODE == 1
+#   if OGRE_DEBUG_MODE
+#       define OgreAssert( a, b ) assert( (a) && (b) )
+#   else
+#       if OGRE_COMP != OGRE_COMPILER_BORL
+#           define OgreAssert( a, b ) if( !(a) ) OGRE_EXCEPT( Ogre::Exception::ERR_RT_ASSERTION_FAILED, (b), "no function info")
+#       else
+#           define OgreAssert( a, b ) if( !(a) ) OGRE_EXCEPT( Ogre::Exception::ERR_RT_ASSERTION_FAILED, (b), __FUNC__ )
+#       endif
+#   endif
+
+// EXCEPTIONS mode
+#elif OGRE_ASSERT_MODE == 2
+#   if OGRE_COMP != OGRE_COMPILER_BORL
+#       define OgreAssert( a, b ) if( !(a) ) OGRE_EXCEPT( Ogre::Exception::ERR_RT_ASSERTION_FAILED, (b), "no function info")
+#   else
+#       define OgreAssert( a, b ) if( !(a) ) OGRE_EXCEPT( Ogre::Exception::ERR_RT_ASSERTION_FAILED, (b), __FUNC__ )
+#   endif
+
+// STANDARD mode
+#else
+#   define OgreAssert( a, b ) assert( (a) && (b) )
+#endif
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+	/** When thrown, provides information about an error that has occurred inside the engine.
+        @remarks
+            OGRE never uses return values to indicate errors. Instead, if an
+            error occurs, an exception is thrown, and this is the object that
+            encapsulates the detail of the problem. The application using
+            OGRE should always ensure that the exceptions are caught, so all
+            OGRE engine functions should occur within a
+            try{} catch(Ogre::Exception& e) {} block.
+        @par
+            The user application should never create any instances of this
+            object unless it wishes to unify its error handling using the
+            same object.
+    */
+	class _OgreExport Exception : public std::exception
+    {
+    protected:
+        long line;
+        int number;
+		String typeName;
+        String description;
+        String source;
+        String file;
+		mutable String fullDesc;
+    public:
+        /** Static definitions of error codes.
+            @todo
+                Add many more exception codes, since we want the user to be able
+                to catch most of them.
+        */
+        enum ExceptionCodes {
+            ERR_CANNOT_WRITE_TO_FILE,
+            ERR_INVALID_STATE,
+            ERR_INVALIDPARAMS,
+            ERR_RENDERINGAPI_ERROR,
+            ERR_DUPLICATE_ITEM,
+            ERR_ITEM_NOT_FOUND,
+            ERR_FILE_NOT_FOUND,
+            ERR_INTERNAL_ERROR,
+            ERR_RT_ASSERTION_FAILED, 
+			ERR_NOT_IMPLEMENTED
+        };
+
+        /** Default constructor.
+        */
+        Exception( int number, const String& description, const String& source );
+
+        /** Advanced constructor.
+        */
+        Exception( int number, const String& description, const String& source, const char* type, const char* file, long line );
+
+        /** Copy constructor.
+        */
+        Exception(const Exception& rhs);
+
+		/// Needed for compatibility with std::exception
+		~Exception() throw() {}
+
+        /** Assignment operator.
+        */
+        void operator = (const Exception& rhs);
+
+        /** Returns a string with the full description of this error.
+            @remarks
+                The description contains the error number, the description
+                supplied by the thrower, what routine threw the exception,
+                and will also supply extra platform-specific information
+                where applicable. For example - in the case of a rendering
+                library error, the description of the error will include both
+                the place in which OGRE found the problem, and a text
+                description from the 3D rendering library, if available.
+        */
+        virtual const String& getFullDescription(void) const;
+
+        /** Gets the error code.
+        */
+        virtual int getNumber(void) const throw();
+
+        /** Gets the source function.
+        */
+        virtual const String &getSource() const { return source; }
+
+        /** Gets source file name.
+        */
+        virtual const String &getFile() const { return file; }
+
+        /** Gets line number.
+        */
+        virtual long getLine() const { return line; }
+
+		/** Returns a string with only the 'description' field of this exception. Use 
+			getFullDescriptionto get a full description of the error including line number,
+			error number and what function threw the exception.
+        */
+		virtual const String &getDescription(void) const { return description; }
+
+		/// Override std::exception::what
+		const char* what() const throw() { return getFullDescription().c_str(); }
+        
+    };
+
+
+	/** Template struct which creates a distinct type for each exception code.
+	@note
+	This is useful because it allows us to create an overloaded method
+	for returning different exception types by value without ambiguity. 
+	From 'Modern C++ Design' (Alexandrescu 2001).
+	*/
+	template <int num>
+	struct ExceptionCodeType
+	{
+		enum { number = num };
+	};
+
+	// Specialised exceptions allowing each to be caught specifically
+	// backwards-compatible since exception codes still used
+
+	class _OgreExport UnimplementedException : public Exception 
+	{
+	public:
+		UnimplementedException(int inNumber, const String& inDescription, const String& inSource, const char* inFile, long inLine)
+			: Exception(inNumber, inDescription, inSource, "UnimplementedException", inFile, inLine) {}
+	};
+	class _OgreExport FileNotFoundException : public Exception
+	{
+	public:
+		FileNotFoundException(int inNumber, const String& inDescription, const String& inSource, const char* inFile, long inLine)
+			: Exception(inNumber, inDescription, inSource, "FileNotFoundException", inFile, inLine) {}
+	};
+	class _OgreExport IOException : public Exception
+	{
+	public:
+		IOException(int inNumber, const String& inDescription, const String& inSource, const char* inFile, long inLine)
+			: Exception(inNumber, inDescription, inSource, "IOException", inFile, inLine) {}
+	};
+	class _OgreExport InvalidStateException : public Exception
+	{
+	public:
+		InvalidStateException(int inNumber, const String& inDescription, const String& inSource, const char* inFile, long inLine)
+			: Exception(inNumber, inDescription, inSource, "InvalidStateException", inFile, inLine) {}
+	};
+	class _OgreExport InvalidParametersException : public Exception
+	{
+	public:
+		InvalidParametersException(int inNumber, const String& inDescription, const String& inSource, const char* inFile, long inLine)
+			: Exception(inNumber, inDescription, inSource, "InvalidParametersException", inFile, inLine) {}
+	};
+	class _OgreExport ItemIdentityException : public Exception
+	{
+	public:
+		ItemIdentityException(int inNumber, const String& inDescription, const String& inSource, const char* inFile, long inLine)
+			: Exception(inNumber, inDescription, inSource, "ItemIdentityException", inFile, inLine) {}
+	};
+	class _OgreExport InternalErrorException : public Exception
+	{
+	public:
+		InternalErrorException(int inNumber, const String& inDescription, const String& inSource, const char* inFile, long inLine)
+			: Exception(inNumber, inDescription, inSource, "InternalErrorException", inFile, inLine) {}
+	};
+	class _OgreExport RenderingAPIException : public Exception
+	{
+	public:
+		RenderingAPIException(int inNumber, const String& inDescription, const String& inSource, const char* inFile, long inLine)
+			: Exception(inNumber, inDescription, inSource, "RenderingAPIException", inFile, inLine) {}
+	};
+	class _OgreExport RuntimeAssertionException : public Exception
+	{
+	public:
+		RuntimeAssertionException(int inNumber, const String& inDescription, const String& inSource, const char* inFile, long inLine)
+			: Exception(inNumber, inDescription, inSource, "RuntimeAssertionException", inFile, inLine) {}
+	};
+
+
+	/** Class implementing dispatch methods in order to construct by-value
+		exceptions of a derived type based just on an exception code.
+	@remarks
+		This nicely handles construction of derived Exceptions by value (needed
+		for throwing) without suffering from ambiguity - each code is turned into
+		a distinct type so that methods can be overloaded. This allows OGRE_EXCEPT
+		to stay small in implementation (desirable since it is embedded) whilst
+		still performing rich code-to-type mapping. 
+	*/
+	class ExceptionFactory
+	{
+	private:
+		/// Private constructor, no construction
+		ExceptionFactory() {}
+	public:
+		static UnimplementedException create(
+			ExceptionCodeType<Exception::ERR_NOT_IMPLEMENTED> code, 
+			const String& desc, 
+			const String& src, const char* file, long line)
+		{
+			return UnimplementedException(code.number, desc, src, file, line);
+		}
+		static FileNotFoundException create(
+			ExceptionCodeType<Exception::ERR_FILE_NOT_FOUND> code, 
+			const String& desc, 
+			const String& src, const char* file, long line)
+		{
+			return FileNotFoundException(code.number, desc, src, file, line);
+		}
+		static IOException create(
+			ExceptionCodeType<Exception::ERR_CANNOT_WRITE_TO_FILE> code, 
+			const String& desc, 
+			const String& src, const char* file, long line)
+		{
+			return IOException(code.number, desc, src, file, line);
+		}
+		static InvalidStateException create(
+			ExceptionCodeType<Exception::ERR_INVALID_STATE> code, 
+			const String& desc, 
+			const String& src, const char* file, long line)
+		{
+			return InvalidStateException(code.number, desc, src, file, line);
+		}
+		static InvalidParametersException create(
+			ExceptionCodeType<Exception::ERR_INVALIDPARAMS> code, 
+			const String& desc, 
+			const String& src, const char* file, long line)
+		{
+			return InvalidParametersException(code.number, desc, src, file, line);
+		}
+		static ItemIdentityException create(
+			ExceptionCodeType<Exception::ERR_ITEM_NOT_FOUND> code, 
+			const String& desc, 
+			const String& src, const char* file, long line)
+		{
+			return ItemIdentityException(code.number, desc, src, file, line);
+		}
+		static ItemIdentityException create(
+			ExceptionCodeType<Exception::ERR_DUPLICATE_ITEM> code, 
+			const String& desc, 
+			const String& src, const char* file, long line)
+		{
+			return ItemIdentityException(code.number, desc, src, file, line);
+		}
+		static InternalErrorException create(
+			ExceptionCodeType<Exception::ERR_INTERNAL_ERROR> code, 
+			const String& desc, 
+			const String& src, const char* file, long line)
+		{
+			return InternalErrorException(code.number, desc, src, file, line);
+		}
+		static RenderingAPIException create(
+			ExceptionCodeType<Exception::ERR_RENDERINGAPI_ERROR> code, 
+			const String& desc, 
+			const String& src, const char* file, long line)
+		{
+			return RenderingAPIException(code.number, desc, src, file, line);
+		}
+		static RuntimeAssertionException create(
+			ExceptionCodeType<Exception::ERR_RT_ASSERTION_FAILED> code, 
+			const String& desc, 
+			const String& src, const char* file, long line)
+		{
+			return RuntimeAssertionException(code.number, desc, src, file, line);
+		}
+
+	};
+	
+
+	
+#ifndef OGRE_EXCEPT
+#define OGRE_EXCEPT(num, desc, src) throw Ogre::ExceptionFactory::create( \
+	Ogre::ExceptionCodeType<num>(), desc, src, __FILE__, __LINE__ );
+#endif
+	/** @} */
+	/** @} */
+
+} // Namespace Ogre
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreExternalTextureSource.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreExternalTextureSource.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreExternalTextureSource.h	(revision 148)
@@ -0,0 +1,194 @@
+/*
+-----------------------------------------------------------------------------
+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 _OgreExternalTextureSource_H
+#define _OgreExternalTextureSource_H
+ 
+/***************************************************************************
+OgreExternalTextureSource.h  -  
+	Base class that texture plugins need to derive from. This provides the hooks
+	necessary for a plugin developer to easily extend the functionality of dynamic textures.
+	It makes creation/destruction of dynamic textures more streamlined. While the plugin
+	will need to talk with Ogre for the actual modification of textures, this class allows
+	easy integration with Ogre apps. Material script files can be used to aid in the 
+	creation of dynamic textures. Functionality can be added that is not defined here
+	through the use of the base dictionary. For an example of how to use this class and the
+	string interface see ffmpegVideoPlugIn.
+
+-------------------
+date                 : Jan 1 2004
+email                : pjcast@yahoo.com
+***************************************************************************/
+
+#include "OgreStringInterface.h"
+#include "OgreResourceGroupManager.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Materials
+	*  @{
+	*/
+	/** Enum for type of texture play mode */
+	enum eTexturePlayMode
+	{
+		TextureEffectPause = 0,			/// Video starts out paused
+		TextureEffectPlay_ASAP = 1,		/// Video starts playing as soon as possible
+		TextureEffectPlay_Looping = 2	/// Video Plays Instantly && Loops
+	};
+
+	/** IMPORTANT: **Plugins must override default dictionary name!** 
+	Base class that texture plugins derive from. Any specific 
+	requirements that the plugin needs to have defined before 
+	texture/material creation must be define using the stringinterface
+	before calling create defined texture... or it will fail, though, it 
+	is up to the plugin to report errors to the log file, or raise an 
+	exception if need be. */
+	class _OgreExport ExternalTextureSource : public StringInterface
+	{
+	public:
+		/** Constructor */
+		ExternalTextureSource();
+		/** Virtual destructor */
+		virtual ~ExternalTextureSource() {}
+
+		//------------------------------------------------------------------------------//
+		/* Command objects for specifying some base features							*/
+		/* Any Plugins wishing to add more specific params to "ExternalTextureSourcePlugins"*/
+		/* dictionary, feel free to do so, that's why this is here						*/
+        class _OgrePrivate CmdInputFileName : public ParamCommand
+        {
+        public:
+			String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        class _OgrePrivate CmdFPS : public ParamCommand
+        {
+        public:
+			String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        class _OgrePrivate CmdPlayMode : public ParamCommand
+        {
+        public:
+			String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        class _OgrePrivate CmdTecPassState : public ParamCommand
+        {
+        public:
+			String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+		//--------------------------------------------------------//
+		//Base Functions that work with Command String Interface... Or can be called
+		//manually to create video through code 
+
+		/// Sets an input file name - if needed by plugin
+		void setInputName( String sIN ) { mInputFileName = sIN; }
+		/// Gets currently set input file name
+		const String& getInputName( ) const	{ return mInputFileName; }
+		/// Sets the frames per second - plugin may or may not use this
+		void setFPS( int iFPS ) { mFramesPerSecond = iFPS; }
+		/// Gets currently set frames per second
+		int getFPS( ) const { return mFramesPerSecond; }
+		/// Sets a play mode
+		void setPlayMode( eTexturePlayMode eMode )	{ mMode = eMode; }
+		/// Gets currently set play mode
+		eTexturePlayMode getPlayMode() const { return mMode; }
+
+		/// Used for attaching texture to Technique, State, and texture unit layer
+		void setTextureTecPassStateLevel( int t, int p, int s ) 
+				{ mTechniqueLevel = t;mPassLevel = p;mStateLevel = s; }
+		/// Get currently selected Texture attribs.
+		void getTextureTecPassStateLevel( int& t, int& p, int& s ) const
+				{t = mTechniqueLevel;	p = mPassLevel;	s = mStateLevel;}
+		
+		/** Call from derived classes to ensure the dictionary is setup */
+		void addBaseParams();
+
+		/** Returns the string name of this Plugin (as set by the Plugin)*/
+		const String& getPluginStringName( void ) const { return mPluginName; }
+		/** Returns dictionary name */
+		const String& getDictionaryStringName( void ) const { return mDictionaryName; }
+
+		//Pure virtual functions that plugins must Override
+		/** Call this function from manager to init system */
+		virtual bool initialise() = 0;
+		/** Shuts down Plugin */
+		virtual void shutDown() = 0;
+
+		/** Creates a texture into an already defined material or one that is created new
+		(it's up to plugin to use a material or create one)
+		Before calling, ensure that needed params have been defined via the stringInterface
+		or regular methods */
+		virtual void createDefinedTexture( const String& sMaterialName,
+			const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME) = 0;
+		/** What this destroys is dependent on the plugin... See specific plugin
+		doc to know what is all destroyed (normally, plugins will destroy only
+		what they created, or used directly - ie. just texture unit) */
+		virtual void destroyAdvancedTexture( const String& sTextureName,
+			const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME) = 0;
+
+	protected:
+        static CmdInputFileName msCmdInputFile;		/// Command for setting input file name
+		static CmdFPS msCmdFramesPerSecond;			/// Command for setting frames per second
+		static CmdPlayMode msCmdPlayMode;			/// Command for setting play mode
+		static CmdTecPassState msCmdTecPassState;	/// Command for setting the technique, pass, & state level
+
+
+		/// String Name of this Plugin
+		String mPluginName;
+	
+		//------ Vars used for setting/getting dictionary stuff -----------//
+		eTexturePlayMode mMode;
+		
+		String mInputFileName;
+		
+		bool mUpdateEveryFrame;
+		
+		int mFramesPerSecond,
+			mTechniqueLevel,
+			mPassLevel,	
+			mStateLevel;
+		//------------------------------------------------------------------//
+
+	protected:
+		/** The string name of the dictionary name - each plugin
+		must override default name */
+		String mDictionaryName;
+	};
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreExternalTextureSourceManager.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreExternalTextureSourceManager.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreExternalTextureSourceManager.h	(revision 148)
@@ -0,0 +1,128 @@
+/*
+-----------------------------------------------------------------------------
+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 _OgreExternalTextureSourceManager_H
+#define _OgreExternalTextureSourceManager_H
+
+/***************************************************************************
+OgreExternalTextureSourceManager.h  -  
+	Handles the registering / unregistering of texture modifier plugins
+
+-------------------
+date                 : Jan 1 2004
+email                : pjcast@yahoo.com
+***************************************************************************/
+#include "OgreSingleton.h"
+#include "OgreString.h"
+#include "OgreResourceGroupManager.h"
+#include "OgreExternalTextureSource.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Materials
+	*  @{
+	*/
+	/** 
+	Singleton Class which handles the registering and control of texture plugins. The plugins
+	will be mostly controlled via a string interface. */
+	class _OgreExport ExternalTextureSourceManager : public Singleton<ExternalTextureSourceManager>, public ResourceAlloc
+	{
+	public:
+		/** Constructor */
+		ExternalTextureSourceManager();
+		/** Destructor */
+		~ExternalTextureSourceManager();
+
+		/** Sets active plugin (ie. "video", "effect", "generic", etc..) */
+		void setCurrentPlugIn( const String& sTexturePlugInType );
+
+		/** Returns currently selected plugin, may be null if none selected */
+		ExternalTextureSource* getCurrentPlugIn( void ) const { return mCurrExternalTextureSource; }
+	
+		/** Calls the destroy method of all registered plugins... 
+		Only the owner plugin should perform the destroy action. */
+		void destroyAdvancedTexture( const String& sTextureName,
+			const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+
+		/** Returns the plugin which registered itself with a specific name 
+		(eg. "video"), or null if specified plugin not found */
+		ExternalTextureSource* getExternalTextureSource( const String& sTexturePlugInType );
+
+		/** Called from plugin to register itself */
+		void setExternalTextureSource( const String& sTexturePlugInType, ExternalTextureSource* pTextureSystem );
+
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static ExternalTextureSourceManager& getSingleton(void);
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static ExternalTextureSourceManager* getSingletonPtr(void);
+	protected:
+		/// The current texture controller selected
+		ExternalTextureSource* mCurrExternalTextureSource;
+		
+        // Collection of loaded texture System PlugIns, keyed by registered type
+        typedef map< String, ExternalTextureSource*>::type TextureSystemList;
+        TextureSystemList mTextureSystems;
+    };
+	/** @} */
+	/** @} */
+} 
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreFactoryObj.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreFactoryObj.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreFactoryObj.h	(revision 148)
@@ -0,0 +1,72 @@
+/*
+-----------------------------------------------------------------------------
+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 _FactoryObj_H__
+#define _FactoryObj_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+    /** \addtogroup Core
+    *  @{
+    */
+    /** \addtogroup General
+    *  @{
+    */
+    /** Abstract factory class. Does nothing by itself, but derived classes can add
+        functionality.
+    */
+    template< typename T > class FactoryObj
+    {
+    public:
+        virtual ~FactoryObj() {}
+
+        /** Returns the factory type.
+        @return
+            The factory type.
+        */
+        virtual const String& getType() const = 0;
+
+        /** Creates a new object.
+        @param name Name of the object to create
+        @return
+            An object created by the factory. The type of the object depends on
+            the factory.
+        */
+        virtual T* createInstance(const String& name) = 0;
+        /** Destroys an object which was created by this factory.
+        @param ptr Pointer to the object to destroy
+        */
+        virtual void destroyInstance(T* ptr) = 0;
+    };
+
+    /** @} */
+    /** @} */
+} // namespace Ogre
+
+#endif // _FactoryObj_H__
Index: /ogre_src_v1-9-0/OgreMain/include/OgreFileSystem.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreFileSystem.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreFileSystem.h	(revision 148)
@@ -0,0 +1,149 @@
+/*
+-----------------------------------------------------------------------------
+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 __FileSystem_H__
+#define __FileSystem_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreArchive.h"
+#include "OgreArchiveFactory.h"
+#include "Threading/OgreThreadHeaders.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+    /** \addtogroup Core
+    *  @{
+    */
+    /** \addtogroup Resources
+    *  @{
+    */
+    /** Specialisation of the Archive class to allow reading of files from 
+        filesystem folders / directories.
+    */
+    class _OgreExport FileSystemArchive : public Archive 
+    {
+    protected:
+        /** Utility method to retrieve all files in a directory matching pattern.
+        @param pattern
+            File pattern.
+        @param recursive
+            Whether to cascade down directories.
+        @param dirs
+            Set to @c true if you want the directories to be listed instead of files.
+        @param simpleList
+            Populated if retrieving a simple list.
+        @param detailList
+            Populated if retrieving a detailed list.
+        */
+        void findFiles(const String& pattern, bool recursive, bool dirs,
+            StringVector* simpleList, FileInfoList* detailList) const;
+
+        OGRE_AUTO_MUTEX;
+    public:
+        FileSystemArchive(const String& name, const String& archType, bool readOnly );
+        ~FileSystemArchive();
+
+        /// @copydoc Archive::isCaseSensitive
+        bool isCaseSensitive(void) const;
+
+        /// @copydoc Archive::load
+        void load();
+        /// @copydoc Archive::unload
+        void unload();
+
+        /// @copydoc Archive::open
+        DataStreamPtr open(const String& filename, bool readOnly = true) const;
+
+        /// @copydoc Archive::create
+        DataStreamPtr create(const String& filename) const;
+
+        /// @copydoc Archive::remove
+        void remove(const String& filename) const;
+
+        /// @copydoc Archive::list
+        StringVectorPtr list(bool recursive = true, bool dirs = false);
+
+        /// @copydoc Archive::listFileInfo
+        FileInfoListPtr listFileInfo(bool recursive = true, bool dirs = false);
+
+        /// @copydoc Archive::find
+        StringVectorPtr find(const String& pattern, bool recursive = true,
+            bool dirs = false);
+
+        /// @copydoc Archive::findFileInfo
+        FileInfoListPtr findFileInfo(const String& pattern, bool recursive = true,
+            bool dirs = false) const;
+
+        /// @copydoc Archive::exists
+        bool exists(const String& filename);
+
+        /// @copydoc Archive::getModifiedTime
+        time_t getModifiedTime(const String& filename);
+
+        /// Set whether filesystem enumeration will include hidden files or not.
+        /// This should be called prior to declaring and/or initializing filesystem
+        /// resource locations. The default is true (ignore hidden files).
+        static void setIgnoreHidden(bool ignore)
+        {
+            msIgnoreHidden = ignore;
+        }
+
+        /// Get whether hidden files are ignored during filesystem enumeration.
+        static bool getIgnoreHidden()
+        {
+            return msIgnoreHidden;
+        }
+
+        static bool msIgnoreHidden;
+    };
+
+    /** Specialisation of ArchiveFactory for FileSystem files. */
+    class _OgreExport FileSystemArchiveFactory : public ArchiveFactory
+    {
+    public:
+        virtual ~FileSystemArchiveFactory() {}
+        /// @copydoc FactoryObj::getType
+        const String& getType(void) const;
+        /// @copydoc FactoryObj::createInstance
+        Archive *createInstance( const String& name, bool readOnly ) 
+        {
+            return OGRE_NEW FileSystemArchive(name, "FileSystem", readOnly);
+        }
+        /// @copydoc FactoryObj::destroyInstance
+        void destroyInstance(Archive* ptr) { OGRE_DELETE ptr; }
+    };
+
+    /** @} */
+    /** @} */
+
+} // namespace Ogre
+
+#include "OgreHeaderSuffix.h"
+
+#endif // __FileSystem_H__
Index: /ogre_src_v1-9-0/OgreMain/include/OgreFileSystemLayer.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreFileSystemLayer.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreFileSystemLayer.h	(revision 148)
@@ -0,0 +1,143 @@
+/*
+ -----------------------------------------------------------------------------
+ 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 __FileSystemLayer_H__
+#define __FileSystemLayer_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreStringVector.h"
+
+namespace Ogre
+{
+	/** Provides methods to find out where the Ogre config files are stored
+	    and where logs and settings files should be written to.
+		@remarks
+			In modern multi-user OS, a standard user account will often not
+			have write access to the path where the SampleBrowser is stored.
+			In order to still be able to store graphics settings and log
+			output and for the user to overwrite the default Ogre config files, 
+			this class tries to create a folder inside the user's home directory. 
+			Specialised implementations for each individual platform must
+			subclass this abstract interface.
+	  */
+
+    /** Implementation for the FileSystemLayer interface. */
+	class _OgreExport FileSystemLayer : public FileSystemLayerAlloc
+	{
+	public:
+		/** Creates a concrete platform-dependent implementation of FileSystemLayer.
+         @param subdir
+         A subdirectory inside the user's path to distinguish between
+         different Ogre releases.
+		 */
+		FileSystemLayer(const Ogre::String& subdir)
+		{
+			// determine directories to search for config files
+			getConfigPaths();
+			// prepare write location in user directory
+			prepareUserHome(subdir);
+		}
+        
+		/** Search for the given config file in the user's home path. If it can't
+         be found there, the function falls back to the system-wide install
+         path for Ogre config files. (Usually the same place where the
+         SampleBrowser resides, or a special config path above that path.)
+         @param filename
+         The config file name (without path)
+         @return
+         The full path to the config file.
+		 */
+		const Ogre::String getConfigFilePath(Ogre::String filename) const
+		{
+            #if OGRE_DEBUG_MODE == 1 && (OGRE_PLATFORM != OGRE_PLATFORM_APPLE && OGRE_PLATFORM != OGRE_PLATFORM_APPLE_IOS)
+			    // add OGRE_BUILD_SUFFIX (default: "_d") to config file names
+			    Ogre::String::size_type pos = filename.rfind('.');
+			    if (pos != Ogre::String::npos)
+				    filename = filename.substr(0, pos) + OGRE_BUILD_SUFFIX + filename.substr(pos);
+            #endif
+
+			// look for the requested file in several locations:
+            
+			// 1. in the writable path (so user can provide custom files)
+			Ogre::String path = getWritablePath(filename);
+			if (fileExists(path))
+				return path;
+            
+			// 2. in the config file search paths
+			for (size_t i = 0; i < mConfigPaths.size(); ++i)
+			{
+				path = mConfigPaths[i] + filename;
+				if (fileExists(path))
+					return path;
+			}
+            
+			// 3. fallback to current working dir
+			return filename;
+		}
+        
+		/** Find a path where the given filename can be written to. This path 
+         will usually be in the user's home directory. This function should
+         be used for any output like logs and graphics settings.
+         @param filename
+         Name of the file.
+         @return
+         The full path to a writable location for the given filename.
+		 */
+		const Ogre::String getWritablePath(const Ogre::String& filename) const
+		{
+			return mHomePath + filename;
+		}
+		
+		void setConfigPaths(const Ogre::StringVector &paths){
+			mConfigPaths = paths;
+		}
+		
+		void setHomePath(const Ogre::String &path){
+			mHomePath = path;
+		}
+        
+		/** Create a directory */
+		bool createDirectory(const Ogre::String& name);
+        
+	private:
+		Ogre::StringVector mConfigPaths;
+		Ogre::String mHomePath;
+        
+		/** Determine config search paths. */
+		void getConfigPaths();
+        
+		/** Create an Ogre directory and the given subdir in the user's home. */
+		void prepareUserHome(const Ogre::String& subdir);
+        
+		/** Test if the given file exists. */
+		bool fileExists(const Ogre::String& path) const;
+	};
+
+}
+
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreFrameListener.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreFrameListener.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreFrameListener.h	(revision 148)
@@ -0,0 +1,137 @@
+/*
+-----------------------------------------------------------------------------
+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 __FrameListener_H__
+#define __FrameListener_H__
+
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+	/** Struct containing information about a frame event.
+    */
+    struct FrameEvent
+    {
+        /** Elapsed time in seconds since the last event.
+            This gives you time between frame start & frame end,
+            and between frame end and next frame start.
+            @remarks
+                This may not be the elapsed time but the average
+                elapsed time between recently fired events.
+        */
+        Real timeSinceLastEvent;
+        /** Elapsed time in seconds since the last event of the same type,
+            i.e. time for a complete frame.
+            @remarks
+                This may not be the elapsed time but the average
+                elapsed time between recently fired events of the same type.
+        */
+        Real timeSinceLastFrame;
+    };
+
+
+    /** A interface class defining a listener which can be used to receive
+        notifications of frame events.
+        @remarks
+            A 'listener' is an interface designed to be called back when
+            particular events are called. This class defines the
+            interface relating to frame events. In order to receive
+            notifications of frame events, you should create a subclass of
+            FrameListener and override the methods for which you would like
+            to customise the resulting processing. You should then call
+            Root::addFrameListener passing an instance of this class.
+            There is no limit to the number of frame listeners you can register,
+            allowing you to register multiple listeners for different purposes.
+            Note that a frame event occurs once for all rendering targets,
+            not once per target.
+    */
+    class _OgreExport FrameListener
+    {
+        /*
+        Note that this could have been an abstract class, but I made
+        the explicit choice not to do this, because I wanted to give
+        people the option of only implementing the methods they wanted,
+        rather than having to create 'do nothing' implementations for
+        those they weren't interested in. As such this class follows
+        the 'Adapter' classes in Java rather than pure interfaces.
+        */
+    public:
+        /** Called when a frame is about to begin rendering.
+		@remarks
+			This event happens before any render targets have begun updating. 
+            @return
+                True to go ahead, false to abort rendering and drop
+                out of the rendering loop.
+        */
+        virtual bool frameStarted(const FrameEvent& evt)
+        { (void)evt; return true; }
+		
+		/** Called after all render targets have had their rendering commands 
+			issued, but before render windows have been asked to flip their 
+			buffers over.
+		@remarks
+			The usefulness of this event comes from the fact that rendering 
+			commands are queued for the GPU to process. These can take a little
+			while to finish, and so while that is happening the CPU can be doing
+			useful things. Once the request to 'flip buffers' happens, the thread
+			requesting it will block until the GPU is ready, which can waste CPU
+			cycles. Therefore, it is often a good idea to use this callback to 
+			perform per-frame processing. Of course because the frame's rendering
+			commands have already been issued, any changes you make will only
+			take effect from the next frame, but in most cases that's not noticeable.
+		@return
+			True to continue rendering, false to drop out of the rendering loop.
+		*/
+		virtual bool frameRenderingQueued(const FrameEvent& evt)
+                { (void)evt; return true; }
+
+        /** Called just after a frame has been rendered.
+		@remarks
+			This event happens after all render targets have been fully updated
+			and the buffers switched.
+            @return
+                True to continue with the next frame, false to drop
+                out of the rendering loop.
+        */
+        virtual bool frameEnded(const FrameEvent& evt)
+        { (void)evt; return true; }
+
+		virtual ~FrameListener() {}
+		
+    };
+	/** @} */
+	/** @} */
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreFreeImageCodec.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreFreeImageCodec.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreFreeImageCodec.h	(revision 148)
@@ -0,0 +1,87 @@
+/*
+-----------------------------------------------------------------------------
+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 _FreeImageCodec_H__
+#define _FreeImageCodec_H__
+
+#include "OgreImageCodec.h"
+// Forward-declaration to avoid external dependency on FreeImage
+struct FIBITMAP;
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Image
+	*  @{
+	*/
+	/** Codec specialized in images loaded using FreeImage.
+        @remarks
+            The users implementing subclasses of ImageCodec are required to return
+            a valid pointer to a ImageData class from the decode(...) function.
+    */
+    class _OgreExport FreeImageCodec : public ImageCodec
+    {
+    private:
+        String mType;
+        unsigned int mFreeImageType;
+
+		typedef list<ImageCodec*>::type RegisteredCodecList;
+		static RegisteredCodecList msCodecList;
+
+		/** Common encoding routine. */
+		FIBITMAP* encodeBitmap(MemoryDataStreamPtr& input, CodecDataPtr& pData) const;
+
+    public:
+        FreeImageCodec(const String &type, unsigned int fiType);
+        virtual ~FreeImageCodec() { }
+
+        /// @copydoc Codec::encode
+        DataStreamPtr encode(MemoryDataStreamPtr& input, CodecDataPtr& pData) const;
+        /// @copydoc Codec::encodeToFile
+        void encodeToFile(MemoryDataStreamPtr& input, const String& outFileName, CodecDataPtr& pData) const;
+        /// @copydoc Codec::decode
+        DecodeResult decode(DataStreamPtr& input) const;
+
+        
+        virtual String getType() const;        
+
+		/// @copydoc Codec::magicNumberToFileExt
+		String magicNumberToFileExt(const char *magicNumberPtr, size_t maxbytes) const;
+
+		/// Static method to startup FreeImage and register the FreeImage codecs
+		static void startup(void);
+		/// Static method to shutdown FreeImage and unregister the FreeImage codecs
+		static void shutdown(void);
+    };
+	/** @} */
+	/** @} */
+
+} // namespace
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreFrustum.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreFrustum.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreFrustum.h	(revision 148)
@@ -0,0 +1,692 @@
+/*
+-----------------------------------------------------------------------------
+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 __Frustum_H__
+#define __Frustum_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreMovableObject.h"
+#include "OgreRenderable.h"
+#include "OgreAxisAlignedBox.h"
+#include "OgreVertexIndexData.h"
+#include "OgreMovablePlane.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre
+{
+    /** \addtogroup Core
+    *  @{
+    */
+    /** \addtogroup Math
+    *  @{
+    */
+    /** Specifies orientation mode.
+    */
+    enum OrientationMode
+    {
+        OR_DEGREE_0       = 0,
+        OR_DEGREE_90      = 1,
+        OR_DEGREE_180     = 2,
+        OR_DEGREE_270     = 3,
+
+        OR_PORTRAIT       = OR_DEGREE_0,
+        OR_LANDSCAPERIGHT = OR_DEGREE_90,
+        OR_LANDSCAPELEFT  = OR_DEGREE_270
+    };
+
+    /** Specifies perspective (realistic) or orthographic (architectural) projection.
+    */
+    enum ProjectionType
+    {
+        PT_ORTHOGRAPHIC,
+        PT_PERSPECTIVE
+    };
+
+    /** Worldspace clipping planes.
+    */
+    enum FrustumPlane
+    {
+        FRUSTUM_PLANE_NEAR   = 0,
+        FRUSTUM_PLANE_FAR    = 1,
+        FRUSTUM_PLANE_LEFT   = 2,
+        FRUSTUM_PLANE_RIGHT  = 3,
+        FRUSTUM_PLANE_TOP    = 4,
+        FRUSTUM_PLANE_BOTTOM = 5
+    };
+
+    /** A frustum represents a pyramid, capped at the near and far end which is
+        used to represent either a visible area or a projection area. Can be used
+        for a number of applications.
+    */
+    class _OgreExport Frustum : public MovableObject, public Renderable
+    {
+    protected:
+        /// Orthographic or perspective?
+        ProjectionType mProjType;
+
+        /// y-direction field-of-view (default 45)
+        Radian mFOVy;
+        /// Far clip distance - default 10000
+        Real mFarDist;
+        /// Near clip distance - default 100
+        Real mNearDist;
+        /// x/y viewport ratio - default 1.3333
+        Real mAspect;
+        /// Ortho height size (world units)
+        Real mOrthoHeight;
+        /// Off-axis frustum center offset - default (0.0, 0.0)
+        Vector2 mFrustumOffset;
+        /// Focal length of frustum (for stereo rendering, defaults to 1.0)
+        Real mFocalLength;
+
+        /// The 6 main clipping planes
+        mutable Plane mFrustumPlanes[6];
+
+        /// Stored versions of parent orientation / position
+        mutable Quaternion mLastParentOrientation;
+        mutable Vector3 mLastParentPosition;
+
+        /// Pre-calced projection matrix for the specific render system
+        mutable Matrix4 mProjMatrixRS;
+        /// Pre-calced standard projection matrix but with render system depth range
+        mutable Matrix4 mProjMatrixRSDepth;
+        /// Pre-calced standard projection matrix
+        mutable Matrix4 mProjMatrix;
+        /// Pre-calced view matrix
+        mutable Matrix4 mViewMatrix;
+        /// Something's changed in the frustum shape?
+        mutable bool mRecalcFrustum;
+        /// Something re the view pos has changed
+        mutable bool mRecalcView;
+        /// Something re the frustum planes has changed
+        mutable bool mRecalcFrustumPlanes;
+        /// Something re the world space corners has changed
+        mutable bool mRecalcWorldSpaceCorners;
+        /// Something re the vertex data has changed
+        mutable bool mRecalcVertexData;
+        /// Are we using a custom view matrix?
+        bool mCustomViewMatrix;
+        /// Are we using a custom projection matrix?
+        bool mCustomProjMatrix;
+        /// Have the frustum extents been manually set?
+        bool mFrustumExtentsManuallySet;
+        /// Frustum extents
+        mutable Real mLeft, mRight, mTop, mBottom;
+        /// Frustum orientation mode
+        mutable OrientationMode mOrientationMode;
+        
+        // Internal functions for calcs
+        virtual void calcProjectionParameters(Real& left, Real& right, Real& bottom, Real& top) const;
+        /// Update frustum if out of date
+        virtual void updateFrustum(void) const;
+        /// Update view if out of date
+        virtual void updateView(void) const;
+        /// Implementation of updateFrustum (called if out of date)
+        virtual void updateFrustumImpl(void) const;
+        /// Implementation of updateView (called if out of date)
+        virtual void updateViewImpl(void) const;
+        virtual void updateFrustumPlanes(void) const;
+        /// Implementation of updateFrustumPlanes (called if out of date)
+        virtual void updateFrustumPlanesImpl(void) const;
+        virtual void updateWorldSpaceCorners(void) const;
+        /// Implementation of updateWorldSpaceCorners (called if out of date)
+        virtual void updateWorldSpaceCornersImpl(void) const;
+        virtual void updateVertexData(void) const;
+        virtual bool isViewOutOfDate(void) const;
+        virtual bool isFrustumOutOfDate(void) const;
+        /// Signal to update frustum information.
+        virtual void invalidateFrustum(void) const;
+        /// Signal to update view information.
+        virtual void invalidateView(void) const;
+
+        /// Shared class-level name for Movable type
+        static String msMovableType;
+
+        mutable AxisAlignedBox mBoundingBox;
+        mutable VertexData mVertexData;
+
+        MaterialPtr mMaterial;
+        mutable Vector3 mWorldSpaceCorners[8];
+
+        /// Is this frustum to act as a reflection of itself?
+        bool mReflect;
+        /// Derived reflection matrix
+        mutable Matrix4 mReflectMatrix;
+        /// Fixed reflection plane
+        mutable Plane mReflectPlane;
+        /// Pointer to a reflection plane (automatically updated)
+        const MovablePlane* mLinkedReflectPlane;
+        /// Record of the last world-space reflection plane info used
+        mutable Plane mLastLinkedReflectionPlane;
+        
+        /// Is this frustum using an oblique depth projection?
+        bool mObliqueDepthProjection;
+        /// Fixed oblique projection plane
+        mutable Plane mObliqueProjPlane;
+        /// Pointer to oblique projection plane (automatically updated)
+        const MovablePlane* mLinkedObliqueProjPlane;
+        /// Record of the last world-space oblique depth projection plane info used
+        mutable Plane mLastLinkedObliqueProjPlane;
+
+    public:
+
+        /// Named constructor
+        Frustum(const String& name = StringUtil::BLANK);
+
+        virtual ~Frustum();
+        /** Sets the Y-dimension Field Of View (FOV) of the frustum.
+        @remarks
+            Field Of View (FOV) is the angle made between the frustum's position, and the edges
+            of the 'screen' onto which the scene is projected. High values (90+ degrees) result in a wide-angle,
+            fish-eye kind of view, low values (30- degrees) in a stretched, telescopic kind of view. Typical values
+            are between 45 and 60 degrees.
+        @par
+            This value represents the VERTICAL field-of-view. The horizontal field of view is calculated from
+            this depending on the dimensions of the viewport (they will only be the same if the viewport is square).
+        @note
+            Setting the FOV overrides the value supplied for frustum::setNearClipPlane.
+         */
+        virtual void setFOVy(const Radian& fovy);
+
+        /** Retrieves the frustums Y-dimension Field Of View (FOV).
+        */
+        virtual const Radian& getFOVy(void) const;
+
+        /** Sets the position of the near clipping plane.
+        @remarks
+            The position of the near clipping plane is the distance from the frustums position to the screen
+            on which the world is projected. The near plane distance, combined with the field-of-view and the
+            aspect ratio, determines the size of the viewport through which the world is viewed (in world
+            co-ordinates). Note that this world viewport is different to a screen viewport, which has it's
+            dimensions expressed in pixels. The frustums viewport should have the same aspect ratio as the
+            screen viewport it renders into to avoid distortion.
+        @param nearDist
+            The distance to the near clipping plane from the frustum in world coordinates.
+         */
+        virtual void setNearClipDistance(Real nearDist);
+
+        /** Sets the position of the near clipping plane.
+        */
+        virtual Real getNearClipDistance(void) const;
+
+        /** Sets the distance to the far clipping plane.
+        @remarks
+            The view frustum is a pyramid created from the frustum position and the edges of the viewport.
+            This method sets the distance for the far end of that pyramid. 
+            Different applications need different values: e.g. a flight sim
+            needs a much further far clipping plane than a first-person 
+            shooter. An important point here is that the larger the ratio 
+            between near and far clipping planes, the lower the accuracy of
+            the Z-buffer used to depth-cue pixels. This is because the
+            Z-range is limited to the size of the Z buffer (16 or 32-bit) 
+            and the max values must be spread over the gap between near and
+            far clip planes. As it happens, you can affect the accuracy far 
+            more by altering the near distance rather than the far distance, 
+            but keep this in mind.
+        @param farDist
+            The distance to the far clipping plane from the frustum in 
+            world coordinates.If you specify 0, this means an infinite view
+            distance which is useful especially when projecting shadows; but
+            be careful not to use a near distance too close.
+        */
+        virtual void setFarClipDistance(Real farDist);
+
+        /** Retrieves the distance from the frustum to the far clipping plane.
+        */
+        virtual Real getFarClipDistance(void) const;
+
+        /** Sets the aspect ratio for the frustum viewport.
+        @remarks
+            The ratio between the x and y dimensions of the rectangular area visible through the frustum
+            is known as aspect ratio: aspect = width / height .
+        @par
+            The default for most fullscreen windows is 1.3333 - this is also assumed by Ogre unless you
+            use this method to state otherwise.
+        */
+        virtual void setAspectRatio(Real ratio);
+
+        /** Retrieves the current aspect ratio.
+        */
+        virtual Real getAspectRatio(void) const;
+
+        /** Sets frustum offsets, used in stereo rendering.
+        @remarks
+            You can set both horizontal and vertical plane offsets of "eye"; in
+            stereo rendering frustum is moved in horizontal plane. To be able to
+            render from two "eyes" you'll need two cameras rendering on two
+            RenderTargets.
+        @par
+            The frustum offsets is in world coordinates, and default to (0, 0) - no offsets.
+        @param offset
+            The horizontal and vertical plane offsets.
+        */
+        virtual void setFrustumOffset(const Vector2& offset);
+
+        /** Sets frustum offsets, used in stereo rendering.
+        @remarks
+            You can set both horizontal and vertical plane offsets of "eye"; in
+            stereo rendering frustum is moved in horizontal plane. To be able to
+            render from two "eyes" you'll need two cameras rendering on two
+            RenderTargets.
+        @par
+            The frustum offsets is in world coordinates, and default to (0, 0) - no offsets.
+        @param horizontal
+            The horizontal plane offset.
+        @param vertical
+            The vertical plane offset.
+        */
+        virtual void setFrustumOffset(Real horizontal = 0.0, Real vertical = 0.0);
+
+        /** Retrieves the frustum offsets.
+        */
+        virtual const Vector2& getFrustumOffset() const;
+
+        /** Sets frustum focal length (used in stereo rendering).
+        @param focalLength
+            The distance to the focal plane from the frustum in world coordinates.
+        */
+        virtual void setFocalLength(Real focalLength = 1.0);
+
+        /** Returns focal length of frustum.
+        */
+        virtual Real getFocalLength() const;
+
+        /** Manually set the extents of the frustum.
+        @param left, right, top, bottom The position where the side clip planes intersect
+            the near clip plane, in eye space
+        */
+        virtual void setFrustumExtents(Real left, Real right, Real top, Real bottom);
+        /** Reset the frustum extents to be automatically derived from other params. */
+        virtual void resetFrustumExtents(); 
+        /** Get the extents of the frustum in view space. */
+        virtual void getFrustumExtents(Real& outleft, Real& outright, Real& outtop, Real& outbottom) const;
+
+
+        /** Gets the projection matrix for this frustum adjusted for the current
+            rendersystem specifics (may be right or left-handed, depth range
+            may vary).
+        @remarks
+            This method retrieves the rendering-API dependent version of the projection
+            matrix. If you want a 'typical' projection matrix then use 
+            getProjectionMatrix.
+        */
+        virtual const Matrix4& getProjectionMatrixRS(void) const;
+        /** Gets the depth-adjusted projection matrix for the current rendersystem,
+            but one which still conforms to right-hand rules.
+        @remarks
+            This differs from the rendering-API dependent getProjectionMatrix
+            in that it always returns a right-handed projection matrix result 
+            no matter what rendering API is being used - this is required for
+            vertex and fragment programs for example. However, the resulting depth
+            range may still vary between render systems since D3D uses [0,1] and 
+            GL uses [-1,1], and the range must be kept the same between programmable
+            and fixed-function pipelines.
+        */
+        virtual const Matrix4& getProjectionMatrixWithRSDepth(void) const;
+        /** Gets the normal projection matrix for this frustum, ie the 
+            projection matrix which conforms to standard right-handed rules and
+            uses depth range [-1,+1].
+        @remarks
+            This differs from the rendering-API dependent getProjectionMatrixRS
+            in that it always returns a right-handed projection matrix with depth
+            range [-1,+1], result no matter what rendering API is being used - this
+            is required for some uniform algebra for example.
+        */
+        virtual const Matrix4& getProjectionMatrix(void) const;
+
+        /** Gets the view matrix for this frustum. Mainly for use by OGRE internally.
+        */
+        virtual const Matrix4& getViewMatrix(void) const;
+
+        /** Calculate a view matrix for this frustum, relative to a potentially dynamic point. 
+            Mainly for use by OGRE internally when using camera-relative rendering
+            for frustums that are not the centre (e.g. texture projection)
+        */
+        virtual void calcViewMatrixRelative(const Vector3& relPos, Matrix4& matToUpdate) const;
+
+        /** Set whether to use a custom view matrix on this frustum.
+        @remarks
+            This is an advanced method which allows you to manually set
+            the view matrix on this frustum, rather than having it calculate
+            itself based on it's position and orientation. 
+        @note
+            After enabling a custom view matrix, the frustum will no longer
+            update on its own based on position / orientation changes. You 
+            are completely responsible for keeping the view matrix up to date.
+            The custom matrix will be returned from getViewMatrix.
+        @param enable If @c true, the custom view matrix passed as the second 
+            parameter will be used in preference to an auto calculated one. If
+            false, the frustum will revert to auto calculating the view matrix.
+        @param viewMatrix The custom view matrix to use, the matrix must be an
+            affine matrix.
+        @see Frustum::setCustomProjectionMatrix, Matrix4::isAffine
+        */
+        virtual void setCustomViewMatrix(bool enable, 
+            const Matrix4& viewMatrix = Matrix4::IDENTITY);
+        /// Returns whether a custom view matrix is in use
+        virtual bool isCustomViewMatrixEnabled(void) const 
+        { return mCustomViewMatrix; }
+        
+        /** Set whether to use a custom projection matrix on this frustum.
+        @remarks
+            This is an advanced method which allows you to manually set
+            the projection matrix on this frustum, rather than having it 
+            calculate itself based on it's position and orientation. 
+        @note
+            After enabling a custom projection matrix, the frustum will no 
+            longer update on its own based on field of view and near / far
+            distance changes. You are completely responsible for keeping the 
+            projection matrix up to date if those values change. The custom 
+            matrix will be returned from getProjectionMatrix and derivative
+            functions.
+        @param enable
+            If @c true, the custom projection matrix passed as the 
+            second parameter will be used in preference to an auto calculated 
+            one. If @c false, the frustum will revert to auto calculating the 
+            projection matrix.
+        @param projectionMatrix
+            The custom view matrix to use.
+        @see Frustum::setCustomViewMatrix
+        */
+        virtual void setCustomProjectionMatrix(bool enable, 
+            const Matrix4& projectionMatrix = Matrix4::IDENTITY);
+        /// Returns whether a custom projection matrix is in use
+        virtual bool isCustomProjectionMatrixEnabled(void) const
+        { return mCustomProjMatrix; }
+
+        /** Retrieves the clipping planes of the frustum (world space).
+        @remarks
+            The clipping planes are ordered as declared in enumerate constants FrustumPlane.
+        */
+        virtual const Plane* getFrustumPlanes(void) const;
+
+        /** Retrieves a specified plane of the frustum (world space).
+        @remarks
+            Gets a reference to one of the planes which make up the frustum frustum, e.g. for clipping purposes.
+        */
+        virtual const Plane& getFrustumPlane( unsigned short plane ) const;
+
+        /** Tests whether the given container is visible in the Frustum.
+        @param bound
+            Bounding box to be checked (world space).
+        @param culledBy
+            Optional pointer to an int which will be filled by the plane number which culled
+            the box if the result was @c false;
+        @return
+            If the box was visible, @c true is returned.
+        @par
+            Otherwise, @c false is returned.
+        */
+        virtual bool isVisible(const AxisAlignedBox& bound, FrustumPlane* culledBy = 0) const;
+
+        /** Tests whether the given container is visible in the Frustum.
+        @param bound
+            Bounding sphere to be checked (world space).
+        @param culledBy
+            Optional pointer to an int which will be filled by the plane number which culled
+            the box if the result was @c false;
+        @return
+            If the sphere was visible, @c true is returned.
+        @par
+            Otherwise, @c false is returned.
+        */
+        virtual bool isVisible(const Sphere& bound, FrustumPlane* culledBy = 0) const;
+
+        /** Tests whether the given vertex is visible in the Frustum.
+        @param vert
+            Vertex to be checked (world space).
+        @param culledBy
+            Optional pointer to an int which will be filled by the plane number which culled
+            the box if the result was @c false;
+        @return
+            If the sphere was visible, @c true is returned.
+        @par
+            Otherwise, @c false is returned.
+        */
+        virtual bool isVisible(const Vector3& vert, FrustumPlane* culledBy = 0) const;
+
+        /// Overridden from MovableObject::getTypeFlags
+        uint32 getTypeFlags(void) const;
+
+        /** Overridden from MovableObject */
+        const AxisAlignedBox& getBoundingBox(void) const;
+
+        /** Overridden from MovableObject */
+        Real getBoundingRadius(void) const;
+
+        /** Overridden from MovableObject */
+        void _updateRenderQueue(RenderQueue* queue);
+
+        /** Overridden from MovableObject */
+        const String& getMovableType(void) const;
+
+        /** Overridden from MovableObject */
+        void _notifyCurrentCamera(Camera* cam);
+
+        /** Overridden from Renderable */
+        const MaterialPtr& getMaterial(void) const;
+
+        /** Overridden from Renderable */
+        void getRenderOperation(RenderOperation& op);
+
+        /** Overridden from Renderable */
+        void getWorldTransforms(Matrix4* xform) const;
+
+        /** Overridden from Renderable */
+        Real getSquaredViewDepth(const Camera* cam) const;
+
+        /** Overridden from Renderable */
+        const LightList& getLights(void) const;
+
+        /** Gets the world space corners of the frustum.
+        @remarks
+            The corners are ordered as follows: top-right near, 
+            top-left near, bottom-left near, bottom-right near, 
+            top-right far, top-left far, bottom-left far, bottom-right far.
+        */
+        virtual const Vector3* getWorldSpaceCorners(void) const;
+
+        /** Sets the type of projection to use (orthographic or perspective). Default is perspective.
+        */
+        virtual void setProjectionType(ProjectionType pt);
+
+        /** Retrieves info on the type of projection used (orthographic or perspective).
+        */
+        virtual ProjectionType getProjectionType(void) const;
+
+        /** Sets the orthographic window settings, for use with orthographic rendering only. 
+        @note Calling this method will recalculate the aspect ratio, use 
+            setOrthoWindowHeight or setOrthoWindowWidth alone if you wish to 
+            preserve the aspect ratio but just fit one or other dimension to a 
+            particular size.
+        @param w
+            The width of the view window in world units.
+        @param h
+            The height of the view window in world units.
+        */
+        virtual void setOrthoWindow(Real w, Real h);
+        /** Sets the orthographic window height, for use with orthographic rendering only. 
+        @note The width of the window will be calculated from the aspect ratio. 
+        @param h
+            The height of the view window in world units.
+        */
+        virtual void setOrthoWindowHeight(Real h);
+        /** Sets the orthographic window width, for use with orthographic rendering only. 
+        @note The height of the window will be calculated from the aspect ratio. 
+        @param w
+            The width of the view window in world units.
+        */
+        virtual void setOrthoWindowWidth(Real w);
+        /** Gets the orthographic window height, for use with orthographic rendering only. 
+        */
+        virtual Real getOrthoWindowHeight() const;
+        /** Gets the orthographic window width, for use with orthographic rendering only. 
+        @note This is calculated from the orthographic height and the aspect ratio
+        */
+        virtual Real getOrthoWindowWidth() const;
+
+        /** Modifies this frustum so it always renders from the reflection of itself through the
+            plane specified.
+        @remarks
+            This is obviously useful for performing planar reflections. 
+        */
+        virtual void enableReflection(const Plane& p);
+        /** Modifies this frustum so it always renders from the reflection of itself through the
+            plane specified. Note that this version of the method links to a plane
+            so that changes to it are picked up automatically. It is important that
+            this plane continues to exist whilst this object does; do not destroy
+            the plane before the frustum.
+        @remarks
+            This is obviously useful for performing planar reflections. 
+        */
+        virtual void enableReflection(const MovablePlane* p);
+
+        /** Disables reflection modification previously turned on with enableReflection */
+        virtual void disableReflection(void);
+
+        /// Returns whether this frustum is being reflected
+        virtual bool isReflected(void) const { return mReflect; }
+        /// Returns the reflection matrix of the frustum if appropriate
+        virtual const Matrix4& getReflectionMatrix(void) const { return mReflectMatrix; }
+        /// Returns the reflection plane of the frustum if appropriate
+        virtual const Plane& getReflectionPlane(void) const { return mReflectPlane; }
+
+        /** Project a sphere onto the near plane and get the bounding rectangle. 
+        @param sphere The world-space sphere to project.
+        @param left
+            Pointers to destination values, these will be completed with 
+            the normalised device coordinates (in the range {-1,1}).
+        @param top
+            Pointers to destination values, these will be completed with 
+            the normalised device coordinates (in the range {-1,1}).
+        @param right
+            Pointers to destination values, these will be completed with 
+            the normalised device coordinates (in the range {-1,1}).
+        @param bottom
+            Pointers to destination values, these will be completed with 
+            the normalised device coordinates (in the range {-1,1}).
+        @return @c true if the sphere was projected to a subset of the near plane,
+            @c false if the entire near plane was contained.
+        */
+        virtual bool projectSphere(const Sphere& sphere, 
+            Real* left, Real* top, Real* right, Real* bottom) const;
+
+
+        /** Links the frustum to a custom near clip plane, which can be used
+            to clip geometry in a custom manner without using user clip planes.
+        @remarks
+            There are several applications for clipping a scene arbitrarily by
+            a single plane; the most common is when rendering a reflection to 
+            a texture, and you only want to render geometry that is above the 
+            water plane (to do otherwise results in artefacts). Whilst it is
+            possible to use user clip planes, they are not supported on all
+            cards, and sometimes are not hardware accelerated when they are
+            available. Instead, where a single clip plane is involved, this
+            technique uses a 'fudging' of the near clip plane, which is 
+            available and fast on all hardware, to perform as the arbitrary
+            clip plane. This does change the shape of the frustum, leading 
+            to some depth buffer loss of precision, but for many of the uses of
+            this technique that is not an issue.
+        @par 
+            This version of the method links to a plane, rather than requiring
+            a by-value plane definition, and therefore you can 
+            make changes to the plane (e.g. by moving / rotating the node it is
+            attached to) and they will automatically affect this object.
+        @note This technique only works for perspective projection.
+        @param plane
+            The plane to link to to perform the clipping. This plane
+            must continue to exist while the camera is linked to it; do not
+            destroy it before the frustum. 
+        */
+        virtual void enableCustomNearClipPlane(const MovablePlane* plane);
+        /** Links the frustum to a custom near clip plane, which can be used
+            to clip geometry in a custom manner without using user clip planes.
+        @remarks
+            There are several applications for clipping a scene arbitrarily by
+            a single plane; the most common is when rendering a reflection to  
+            a texture, and you only want to render geometry that is above the 
+            water plane (to do otherwise results in artefacts). Whilst it is
+            possible to use user clip planes, they are not supported on all
+            cards, and sometimes are not hardware accelerated when they are
+            available. Instead, where a single clip plane is involved, this
+            technique uses a 'fudging' of the near clip plane, which is 
+            available and fast on all hardware, to perform as the arbitrary
+            clip plane. This does change the shape of the frustum, leading 
+            to some depth buffer loss of precision, but for many of the uses of
+            this technique that is not an issue.
+        @note This technique only works for perspective projection.
+        @param plane
+            The plane to link to to perform the clipping. This plane
+            must continue to exist while the camera is linked to it; do not
+            destroy it before the frustum. 
+        */
+        virtual void enableCustomNearClipPlane(const Plane& plane);
+        /** Disables any custom near clip plane. */
+        virtual void disableCustomNearClipPlane(void);
+        /** Is a custom near clip plane in use? */
+        virtual bool isCustomNearClipPlaneEnabled(void) const 
+        { return mObliqueDepthProjection; }
+
+        /// @copydoc MovableObject::visitRenderables
+        void visitRenderables(Renderable::Visitor* visitor, 
+            bool debugRenderables = false);
+
+        /// Small constant used to reduce far plane projection to avoid inaccuracies
+        static const Real INFINITE_FAR_PLANE_ADJUST;
+
+        /** Get the derived position of this frustum. */
+        virtual const Vector3& getPositionForViewUpdate(void) const;
+        /** Get the derived orientation of this frustum. */
+        virtual const Quaternion& getOrientationForViewUpdate(void) const;
+
+        /** Gets a world-space list of planes enclosing the frustum.
+        */
+        PlaneBoundedVolume getPlaneBoundedVolume();
+        /** Set the orientation mode of the frustum. Default is OR_DEGREE_0
+        @remarks
+            Setting the orientation of a frustum is only supported on
+            iOS at this time.  An exception is thrown on other platforms.
+        */
+        void setOrientationMode(OrientationMode orientationMode);
+
+        /** Get the orientation mode of the frustum.
+        @remarks
+            Getting the orientation of a frustum is only supported on
+            iOS at this time.  An exception is thrown on other platforms.
+        */
+        OrientationMode getOrientationMode() const;
+
+    };
+
+    /** @} */
+    /** @} */
+
+} // namespace Ogre
+
+#include "OgreHeaderSuffix.h"
+
+#endif // __Frustum_H__
Index: /ogre_src_v1-9-0/OgreMain/include/OgreGpuProgram.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreGpuProgram.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreGpuProgram.h	(revision 148)
@@ -0,0 +1,434 @@
+/*
+-----------------------------------------------------------------------------
+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 __GpuProgram_H_
+#define __GpuProgram_H_
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+#include "OgreResource.h"
+#include "OgreSharedPtr.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreSerializer.h"
+#include "OgreRenderOperation.h"
+#include "OgreGpuProgramParams.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Resources
+	*  @{
+	*/
+	/** Enumerates the types of programs which can run on the GPU. */
+	enum GpuProgramType
+	{
+		GPT_VERTEX_PROGRAM,
+		GPT_FRAGMENT_PROGRAM,
+		GPT_GEOMETRY_PROGRAM,
+		GPT_DOMAIN_PROGRAM,
+		GPT_HULL_PROGRAM,
+		GPT_COMPUTE_PROGRAM
+	};
+
+	/** Defines a program which runs on the GPU such as a vertex or fragment program. 
+	@remarks
+		This class defines the low-level program in assembler code, the sort used to
+		directly assemble into machine instructions for the GPU to execute. By nature,
+		this means that the assembler source is rendersystem specific, which is why this
+		is an abstract class - real instances are created through the RenderSystem. 
+		If you wish to use higher level shading languages like HLSL and Cg, you need to 
+		use the HighLevelGpuProgram class instead.
+	*/
+	class _OgreExport GpuProgram : public Resource
+	{
+	protected:
+		/// Command object - see ParamCommand 
+		class _OgreExport CmdType : public ParamCommand
+		{
+		public:
+			String doGet(const void* target) const;
+			void doSet(void* target, const String& val);
+		};
+		class _OgreExport CmdSyntax : public ParamCommand
+		{
+		public:
+			String doGet(const void* target) const;
+			void doSet(void* target, const String& val);
+		};
+		class _OgreExport CmdSkeletal : public ParamCommand
+		{
+		public:
+			String doGet(const void* target) const;
+			void doSet(void* target, const String& val);
+		};
+		class _OgreExport CmdMorph : public ParamCommand
+		{
+		public:
+			String doGet(const void* target) const;
+			void doSet(void* target, const String& val);
+		};
+		class _OgreExport CmdPose : public ParamCommand
+		{
+		public:
+			String doGet(const void* target) const;
+			void doSet(void* target, const String& val);
+		};
+		class _OgreExport CmdVTF : public ParamCommand
+		{
+		public:
+			String doGet(const void* target) const;
+			void doSet(void* target, const String& val);
+		};
+		class _OgreExport CmdManualNamedConstsFile : public ParamCommand
+		{
+		public:
+			String doGet(const void* target) const;
+			void doSet(void* target, const String& val);
+		};
+		class _OgreExport CmdAdjacency : public ParamCommand
+		{
+		public:
+			String doGet(const void* target) const;
+			void doSet(void* target, const String& val);
+		};
+		// Command object for setting / getting parameters
+		static CmdType msTypeCmd;
+		static CmdSyntax msSyntaxCmd;
+		static CmdSkeletal msSkeletalCmd;
+		static CmdMorph msMorphCmd;
+		static CmdPose msPoseCmd;
+		static CmdVTF msVTFCmd;
+		static CmdManualNamedConstsFile msManNamedConstsFileCmd;
+		static CmdAdjacency msAdjacencyCmd;
+		/// The type of the program
+		GpuProgramType mType;
+		/// The name of the file to load source from (may be blank)
+		String mFilename;
+        /// The assembler source of the program (may be blank until file loaded)
+        String mSource;
+        /// Whether we need to load source from file or not
+        bool mLoadFromFile;
+        /// Syntax code e.g. arbvp1, vs_2_0 etc
+        String mSyntaxCode;
+        /// Does this (vertex) program include skeletal animation?
+        bool mSkeletalAnimation;
+		/// Does this (vertex) program include morph animation?
+		bool mMorphAnimation;
+		/// Does this (vertex) program include pose animation (count of number of poses supported)
+		ushort mPoseAnimation;
+		/// Does this (vertex) program require support for vertex texture fetch?
+		bool mVertexTextureFetch;
+		/// Does this (geometry) program require adjacency information?
+		bool mNeedsAdjacencyInfo;
+		/// The default parameters for use with this object
+		GpuProgramParametersSharedPtr mDefaultParams;
+		/// Did we encounter a compilation error?
+		bool mCompileError;
+		/** Record of logical to physical buffer maps. Mandatory for low-level
+			programs or high-level programs which set their params the same way. 
+			This is a shared pointer because if the program is recompiled and the parameters
+			change, this definition will alter, but previous params may reference the old def. */
+		mutable GpuLogicalBufferStructPtr mFloatLogicalToPhysical;
+		/** Record of logical to physical buffer maps. Mandatory for low-level
+         programs or high-level programs which set their params the same way.
+         This is a shared pointer because if the program is recompiled and the parameters
+         change, this definition will alter, but previous params may reference the old def. */
+		mutable GpuLogicalBufferStructPtr mDoubleLogicalToPhysical;
+		/** Record of logical to physical buffer maps. Mandatory for low-level
+			programs or high-level programs which set their params the same way. 
+			This is a shared pointer because if the program is recompiled and the parameters
+			change, this definition will alter, but previous params may reference the old def.*/
+		mutable GpuLogicalBufferStructPtr mIntLogicalToPhysical;
+		/** Parameter name -> ConstantDefinition map, shared instance used by all parameter objects.
+		This is a shared pointer because if the program is recompiled and the parameters
+		change, this definition will alter, but previous params may reference the old def.
+		*/
+		mutable GpuNamedConstantsPtr mConstantDefs;
+		/// File from which to load named constants manually
+		String mManualNamedConstantsFile;
+		bool mLoadedManualNamedConstants;
+
+
+		/** Internal method for setting up the basic parameter definitions for a subclass. 
+		@remarks
+		Because StringInterface holds a dictionary of parameters per class, subclasses need to
+		call this to ask the base class to add it's parameters to their dictionary as well.
+		Can't do this in the constructor because that runs in a non-virtual context.
+		@par
+		The subclass must have called it's own createParamDictionary before calling this method.
+		*/
+		void setupBaseParamDictionary(void);
+
+        /** Internal method returns whether required capabilities for this program is supported.
+        */
+        bool isRequiredCapabilitiesSupported(void) const;
+
+		/// @copydoc Resource::loadImpl
+		void loadImpl(void);
+
+		/// Create the internal params logical & named mapping structures
+		void createParameterMappingStructures(bool recreateIfExists = true) const;
+		/// Create the internal params logical mapping structures
+		void createLogicalParameterMappingStructures(bool recreateIfExists = true) const;
+		/// Create the internal params named mapping structures
+		void createNamedParameterMappingStructures(bool recreateIfExists = true) const;
+
+	public:
+
+		GpuProgram(ResourceManager* creator, const String& name, ResourceHandle handle,
+			const String& group, bool isManual = false, ManualResourceLoader* loader = 0);
+
+		virtual ~GpuProgram() {}
+
+        /** Sets the filename of the source assembly for this program.
+        @remarks
+            Setting this will have no effect until you (re)load the program.
+        */
+        virtual void setSourceFile(const String& filename);
+
+		/** Sets the source assembly for this program from an in-memory string.
+        @remarks
+            Setting this will have no effect until you (re)load the program.
+        */
+        virtual void setSource(const String& source);
+
+        /** Gets the syntax code for this program e.g. arbvp1, fp20, vs_1_1 etc */
+        virtual const String& getSyntaxCode(void) const { return mSyntaxCode; }
+
+		/** Sets the syntax code for this program e.g. arbvp1, fp20, vs_1_1 etc */
+		virtual void setSyntaxCode(const String& syntax);
+
+		/** Gets the name of the file used as source for this program. */
+		virtual const String& getSourceFile(void) const { return mFilename; }
+        /** Gets the assembler source for this program. */
+        virtual const String& getSource(void) const { return mSource; }
+		/// Set the program type (only valid before load)
+		virtual void setType(GpuProgramType t);
+        /// Get the program type
+        virtual GpuProgramType getType(void) const { return mType; }
+
+        /** Returns the GpuProgram which should be bound to the pipeline.
+        @remarks
+            This method is simply to allow some subclasses of GpuProgram to delegate
+            the program which is bound to the pipeline to a delegate, if required. */
+        virtual GpuProgram* _getBindingDelegate(void) { return this; }
+
+        /** Returns whether this program can be supported on the current renderer and hardware. */
+        virtual bool isSupported(void) const;
+
+        /** Creates a new parameters object compatible with this program definition. 
+        @remarks
+            It is recommended that you use this method of creating parameters objects
+            rather than going direct to GpuProgramManager, because this method will
+            populate any implementation-specific extras (like named parameters) where
+            they are appropriate.
+        */
+        virtual GpuProgramParametersSharedPtr createParameters(void);
+
+        /** Sets whether a vertex program includes the required instructions
+        to perform skeletal animation. 
+        @remarks
+        If this is set to true, OGRE will not blend the geometry according to 
+        skeletal animation, it will expect the vertex program to do it.
+        */
+        virtual void setSkeletalAnimationIncluded(bool included) 
+        { mSkeletalAnimation = included; }
+
+        /** Returns whether a vertex program includes the required instructions
+            to perform skeletal animation. 
+        @remarks
+            If this returns true, OGRE will not blend the geometry according to 
+            skeletal animation, it will expect the vertex program to do it.
+        */
+        virtual bool isSkeletalAnimationIncluded(void) const { return mSkeletalAnimation; }
+
+        /** Sets whether a vertex program includes the required instructions
+        to perform morph animation. 
+        @remarks
+        If this is set to true, OGRE will not blend the geometry according to 
+        morph animation, it will expect the vertex program to do it.
+        */
+        virtual void setMorphAnimationIncluded(bool included) 
+		{ mMorphAnimation = included; }
+
+        /** Sets whether a vertex program includes the required instructions
+        to perform pose animation. 
+        @remarks
+        If this is set to true, OGRE will not blend the geometry according to 
+        pose animation, it will expect the vertex program to do it.
+		@param poseCount The number of simultaneous poses the program can blend
+        */
+        virtual void setPoseAnimationIncluded(ushort poseCount) 
+		{ mPoseAnimation = poseCount; }
+
+		/** Returns whether a vertex program includes the required instructions
+            to perform morph animation. 
+        @remarks
+            If this returns true, OGRE will not blend the geometry according to 
+            morph animation, it will expect the vertex program to do it.
+        */
+        virtual bool isMorphAnimationIncluded(void) const { return mMorphAnimation; }
+
+		/** Returns whether a vertex program includes the required instructions
+            to perform pose animation. 
+        @remarks
+            If this returns true, OGRE will not blend the geometry according to 
+            pose animation, it will expect the vertex program to do it.
+        */
+        virtual bool isPoseAnimationIncluded(void) const { return mPoseAnimation > 0; }
+		/** Returns the number of simultaneous poses the vertex program can 
+			blend, for use in pose animation.
+        */
+        virtual ushort getNumberOfPosesIncluded(void) const { return mPoseAnimation; }
+		/** Sets whether this vertex program requires support for vertex 
+			texture fetch from the hardware.
+		*/
+		virtual void setVertexTextureFetchRequired(bool r) { mVertexTextureFetch = r; }
+		/** Returns whether this vertex program requires support for vertex 
+			texture fetch from the hardware.
+		*/
+		virtual bool isVertexTextureFetchRequired(void) const { return mVertexTextureFetch; }
+
+		/** Sets whether this geometry program requires adjacency information
+			from the input primitives.
+		*/
+		virtual void setAdjacencyInfoRequired(bool r) { mNeedsAdjacencyInfo = r; }
+		/** Returns whether this geometry program requires adjacency information 
+			from the input primitives.
+		*/
+		virtual bool isAdjacencyInfoRequired(void) const { return mNeedsAdjacencyInfo; }
+		
+		/** Get a reference to the default parameters which are to be used for all
+			uses of this program.
+		@remarks
+			A program can be set up with a list of default parameters, which can save time when 
+			using a program many times in a material with roughly the same settings. By 
+			retrieving the default parameters and populating it with the most used options, 
+			any new parameter objects created from this program afterwards will automatically include
+			the default parameters; thus users of the program need only change the parameters
+			which are unique to their own usage of the program.
+		*/
+		virtual GpuProgramParametersSharedPtr getDefaultParameters(void);
+
+        /** Returns true if default parameters have been set up.  
+        */
+        virtual bool hasDefaultParameters(void) const { return !mDefaultParams.isNull(); }
+
+		/** Returns whether a vertex program wants light and material states to be passed
+		through fixed pipeline low level API rendering calls (default false, subclasses can override)
+		@remarks
+			Most vertex programs do not need this material information, however GLSL
+			shaders can refer to this material and lighting state so enable this option
+		*/
+		virtual bool getPassSurfaceAndLightStates(void) const { return false; }
+
+		/** Returns whether a fragment program wants fog state to be passed
+		through fixed pipeline low level API rendering calls (default true, subclasses can override)
+		@remarks
+		On DirectX, shader model 2 and earlier continues to have fixed-function fog
+		applied to it, so fog state is still passed (you should disable fog on the
+		pass if you want to perform fog in the shader). In OpenGL it is also
+		common to be able to access the fixed-function fog state inside the shader. 
+		*/
+		virtual bool getPassFogStates(void) const { return true; }
+
+		/** Returns whether a vertex program wants transform state to be passed
+		through fixed pipeline low level API rendering calls
+		@remarks
+		Most vertex programs do not need fixed-function transform information, however GLSL
+		shaders can refer to this state so enable this option
+		*/
+		virtual bool getPassTransformStates(void) const { return false; }
+
+		/** Returns a string that specifies the language of the gpu programs as specified
+        in a material script. ie: asm, cg, hlsl, glsl
+        */
+        virtual const String& getLanguage(void) const;
+
+		/** Did this program encounter a compile error when loading?
+		*/
+		virtual bool hasCompileError(void) const { return mCompileError; }
+
+		/** Reset a compile error if it occurred, allowing the load to be retried
+		*/
+		virtual void resetCompileError(void) { mCompileError = false; }
+
+		/** Allows you to manually provide a set of named parameter mappings
+			to a program which would not be able to derive named parameters itself.
+		@remarks
+			You may wish to use this if you have assembler programs that were compiled
+			from a high-level source, and want the convenience of still being able
+			to use the named parameters from the original high-level source.
+		@see setManualNamedConstantsFile
+		*/
+		virtual void setManualNamedConstants(const GpuNamedConstants& namedConstants);
+
+		/// Get a read-only reference to the named constants registered for this program (manually or automatically)
+		virtual const GpuNamedConstants& getNamedConstants() const { return *mConstantDefs.get(); }
+
+		/** Specifies the name of a file from which to load named parameters mapping
+			for a program which would not be able to derive named parameters itself.
+		@remarks
+			You may wish to use this if you have assembler programs that were compiled
+			from a high-level source, and want the convenience of still being able
+			to use the named parameters from the original high-level source. This
+			method will make a low-level program search in the resource group of the
+			program for the named file from which to load parameter names from. 
+			The file must be in the format produced by GpuNamedConstants::save.
+		*/
+		virtual void setManualNamedConstantsFile(const String& paramDefFile);
+
+		/** Gets the name of a file from which to load named parameters mapping
+			for a program which would not be able to derive named parameters itself.
+		*/
+		virtual const String& getManualNamedConstantsFile() const { return mManualNamedConstantsFile; }
+		/** Get the full list of named constants.
+		@note
+		Only available if this parameters object has named parameters, which means either
+		a high-level program which loads them, or a low-level program which has them
+		specified manually.
+		*/
+		virtual const GpuNamedConstants& getConstantDefinitions() const { return *mConstantDefs.get(); }
+
+		/// @copydoc Resource::calculateSize
+		virtual size_t calculateSize(void) const;
+
+    protected:
+        /// Virtual method which must be implemented by subclasses, load from mSource
+        virtual void loadFromSource(void) = 0;
+
+	};
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreGpuProgramManager.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreGpuProgramManager.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreGpuProgramManager.h	(revision 148)
@@ -0,0 +1,279 @@
+/*
+-----------------------------------------------------------------------------
+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 __GpuProgramManager_H_
+#define __GpuProgramManager_H_
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+#include "OgreResourceManager.h"
+#include "OgreException.h"
+#include "OgreGpuProgram.h"
+#include "OgreSingleton.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Resources
+	*  @{
+	*/
+	class _OgreExport GpuProgramManager : public ResourceManager, public Singleton<GpuProgramManager>
+	{
+	public:
+
+		typedef set<String>::type SyntaxCodes;
+		typedef map<String, GpuSharedParametersPtr>::type SharedParametersMap;
+
+		typedef MemoryDataStreamPtr Microcode;
+		typedef map<String, Microcode>::type MicrocodeMap;
+
+	protected:
+
+		SharedParametersMap mSharedParametersMap;
+		MicrocodeMap mMicrocodeCache;
+		bool mSaveMicrocodesToCache;
+		bool mCacheDirty;			// When this is true the cache is 'dirty' and should be resaved to disk.
+			
+		static String addRenderSystemToName( const String &  name );
+
+        /// Specialised create method with specific parameters
+        virtual Resource* createImpl(const String& name, ResourceHandle handle, 
+            const String& group, bool isManual, ManualResourceLoader* loader,
+            GpuProgramType gptype, const String& syntaxCode) = 0;
+	public:
+		GpuProgramManager();
+		virtual ~GpuProgramManager();
+
+		/// Get a resource by name
+		/// @see GpuProgramManager::getResourceByName
+		GpuProgramPtr getByName(const String& name, bool preferHighLevelPrograms = true);
+
+        /** Loads a GPU program from a file of assembly. 
+		@remarks
+			This method creates a new program of the type specified as the second parameter.
+			As with all types of ResourceManager, this class will search for the file in
+			all resource locations it has been configured to look in.
+		@param name The name of the GpuProgram
+		@param groupName The name of the resource group
+		@param filename The file to load
+		@param gptype The type of program to create
+        @param syntaxCode The name of the syntax to be used for this program e.g. arbvp1, vs_1_1
+		*/
+		virtual GpuProgramPtr load(const String& name, const String& groupName, 
+			const String& filename, GpuProgramType gptype, 
+            const String& syntaxCode);
+
+		/** Loads a GPU program from a string of assembly code.
+		@remarks
+			The assembly code must be compatible with this manager - call the 
+			getSupportedSyntax method for details of the supported syntaxes 
+		@param name The identifying name to give this program, which can be used to
+			retrieve this program later with getByName.
+		@param groupName The name of the resource group
+		@param code A string of assembly code which will form the program to run
+		@param gptype The type of program to create.
+        @param syntaxCode The name of the syntax to be used for this program e.g. arbvp1, vs_1_1
+		*/
+		virtual GpuProgramPtr loadFromString(const String& name, const String& groupName,
+			const String& code, GpuProgramType gptype,
+            const String& syntaxCode);
+
+		/** Returns the syntaxes that this manager supports. */
+		virtual const SyntaxCodes& getSupportedSyntax(void) const;
+		 
+
+        /** Returns whether a given syntax code (e.g. "ps_1_3", "fp20", "arbvp1") is supported. */
+        virtual bool isSyntaxSupported(const String& syntaxCode) const;
+		
+		/** Creates a new GpuProgramParameters instance which can be used to bind
+            parameters to your programs.
+        @remarks
+            Program parameters can be shared between multiple programs if you wish.
+        */
+        virtual GpuProgramParametersSharedPtr createParameters(void);
+        
+        /** Create a new, unloaded GpuProgram from a file of assembly. 
+        @remarks    
+            Use this method in preference to the 'load' methods if you wish to define
+            a GpuProgram, but not load it yet; useful for saving memory.
+		@par
+			This method creates a new program of the type specified as the second parameter.
+			As with all types of ResourceManager, this class will search for the file in
+			all resource locations it has been configured to look in. 
+		@param name The name of the program
+		@param groupName The name of the resource group
+		@param filename The file to load
+        @param syntaxCode The name of the syntax to be used for this program e.g. arbvp1, vs_1_1
+		@param gptype The type of program to create
+		*/
+		virtual GpuProgramPtr createProgram(const String& name, 
+			const String& groupName, const String& filename, 
+			GpuProgramType gptype, const String& syntaxCode);
+
+		/** Create a GPU program from a string of assembly code.
+        @remarks    
+            Use this method in preference to the 'load' methods if you wish to define
+            a GpuProgram, but not load it yet; useful for saving memory.
+		@par
+			The assembly code must be compatible with this manager - call the 
+			getSupportedSyntax method for details of the supported syntaxes 
+		@param name The identifying name to give this program, which can be used to
+			retrieve this program later with getByName.
+		@param groupName The name of the resource group
+		@param code A string of assembly code which will form the program to run
+		@param gptype The type of program to create.
+        @param syntaxCode The name of the syntax to be used for this program e.g. arbvp1, vs_1_1
+		*/
+		virtual GpuProgramPtr createProgramFromString(const String& name, 
+			const String& groupName, const String& code, 
+            GpuProgramType gptype, const String& syntaxCode);
+
+        /** General create method, using specific create parameters
+            instead of name / value pairs. 
+        */
+        virtual ResourcePtr create(const String& name, const String& group, 
+            GpuProgramType gptype, const String& syntaxCode, bool isManual = false, 
+            ManualResourceLoader* loader = 0);
+
+        /** Overrides the standard ResourceManager getResourceByName method.
+        @param name The name of the program to retrieve
+        @param preferHighLevelPrograms If set to true (the default), high level programs will be
+            returned in preference to low-level programs.
+        */
+        ResourcePtr getResourceByName(const String& name, bool preferHighLevelPrograms = true);
+
+
+		/** Create a new set of shared parameters, which can be used across many 
+			GpuProgramParameters objects of different structures.
+		@param name The name to give the shared parameters so you can refer to them
+			later.
+		*/
+		virtual GpuSharedParametersPtr createSharedParameters(const String& name);
+
+		/** Retrieve a set of shared parameters, which can be used across many 
+		GpuProgramParameters objects of different structures.
+		*/
+		virtual GpuSharedParametersPtr getSharedParameters(const String& name) const;
+
+		/** Get (const) access to the available shared parameter sets. 
+		*/
+		virtual const SharedParametersMap& getAvailableSharedParameters() const;
+
+        /** Get if the microcode of a shader should be saved to a cache
+        */
+		bool getSaveMicrocodesToCache();
+        /** Set if the microcode of a shader should be saved to a cache
+        */
+		void setSaveMicrocodesToCache( const bool val );
+
+		/** Returns true if the microcodecache changed during the run.
+		*/
+		bool isCacheDirty(void) const;
+
+		bool canGetCompiledShaderBuffer();
+        /** Check if a microcode is available for a program in the microcode cache.
+        @param name The name of the program.
+        */
+		virtual bool isMicrocodeAvailableInCache( const String & name ) const;
+        /** Returns a microcode for a program from the microcode cache.
+        @param name The name of the program.
+        */
+		virtual const Microcode & getMicrocodeFromCache( const String & name ) const;
+
+        /** Creates a microcode to be later added to the cache.
+		@param size The size of the microcode in bytes
+        */
+		virtual Microcode createMicrocode( const uint32 size ) const;
+
+        /** Adds a microcode for a program to the microcode cache.
+        @param name The name of the program.
+        */
+		virtual void addMicrocodeToCache( const String & name, const Microcode & microcode );
+
+		/** Removes a microcode for a program from the microcode cache.
+        @param name The name of the program.
+        */
+		virtual void removeMicrocodeFromCache( const String & name );
+
+        /** Saves the microcode cache to disk.
+        @param stream The destination stream
+        */
+		virtual void saveMicrocodeCache( DataStreamPtr stream ) const;
+        /** Loads the microcode cache from disk.
+        @param stream The source stream
+        */
+		virtual void loadMicrocodeCache( DataStreamPtr stream );
+		
+
+
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static GpuProgramManager& getSingleton(void);
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static GpuProgramManager* getSingletonPtr(void);
+    
+
+
+	};
+
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreGpuProgramParams.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreGpuProgramParams.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreGpuProgramParams.h	(revision 148)
@@ -0,0 +1,2059 @@
+/*
+-----------------------------------------------------------------------------
+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 __GpuProgramParams_H_
+#define __GpuProgramParams_H_
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+#include "OgreSharedPtr.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreSerializer.h"
+#include "OgreRenderOperation.h"
+#include "OgreAny.h"
+#include "Threading/OgreThreadHeaders.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Materials
+	*  @{
+	*/
+	/** Enumeration of the types of constant we may encounter in programs. 
+	@note Low-level programs, by definition, will always use either
+	float4 or int4 constant types since that is the fundamental underlying
+	type in assembler.
+	*/
+	enum GpuConstantType
+	{
+		GCT_FLOAT1 = 1,
+		GCT_FLOAT2 = 2,
+		GCT_FLOAT3 = 3,
+		GCT_FLOAT4 = 4,
+		GCT_SAMPLER1D = 5,
+		GCT_SAMPLER2D = 6,
+		GCT_SAMPLER3D = 7,
+		GCT_SAMPLERCUBE = 8,
+		GCT_SAMPLERRECT = 9,
+		GCT_SAMPLER1DSHADOW = 10,
+		GCT_SAMPLER2DSHADOW = 11,
+		GCT_SAMPLER2DARRAY = 12,
+		GCT_MATRIX_2X2 = 13,
+		GCT_MATRIX_2X3 = 14,
+		GCT_MATRIX_2X4 = 15,
+		GCT_MATRIX_3X2 = 16,
+		GCT_MATRIX_3X3 = 17,
+		GCT_MATRIX_3X4 = 18,
+		GCT_MATRIX_4X2 = 19,
+		GCT_MATRIX_4X3 = 20,
+		GCT_MATRIX_4X4 = 21,
+		GCT_INT1 = 22,
+		GCT_INT2 = 23,
+		GCT_INT3 = 24,
+		GCT_INT4 = 25,
+		GCT_SUBROUTINE = 26,
+		GCT_DOUBLE1 = 27,
+		GCT_DOUBLE2 = 28,
+		GCT_DOUBLE3 = 29,
+		GCT_DOUBLE4 = 30,
+		GCT_MATRIX_DOUBLE_2X2 = 31,
+		GCT_MATRIX_DOUBLE_2X3 = 32,
+		GCT_MATRIX_DOUBLE_2X4 = 33,
+		GCT_MATRIX_DOUBLE_3X2 = 34,
+		GCT_MATRIX_DOUBLE_3X3 = 35,
+		GCT_MATRIX_DOUBLE_3X4 = 36,
+		GCT_MATRIX_DOUBLE_4X2 = 37,
+		GCT_MATRIX_DOUBLE_4X3 = 38,
+		GCT_MATRIX_DOUBLE_4X4 = 39,
+		GCT_UNKNOWN = 99
+	};
+
+	/** The variability of a GPU parameter, as derived from auto-params targeting it.
+	These values must be powers of two since they are used in masks.
+	*/
+	enum GpuParamVariability
+	{
+		/// No variation except by manual setting - the default
+		GPV_GLOBAL = 1, 
+		/// Varies per object (based on an auto param usually), but not per light setup
+		GPV_PER_OBJECT = 2, 
+		/// Varies with light setup
+		GPV_LIGHTS = 4, 
+		/// Varies with pass iteration number
+		GPV_PASS_ITERATION_NUMBER = 8,
+
+
+		/// Full mask (16-bit)
+		GPV_ALL = 0xFFFF
+
+	};
+
+	/** Information about predefined program constants. 
+	@note Only available for high-level programs but is referenced generically
+	by GpuProgramParameters.
+	*/
+	struct _OgreExport GpuConstantDefinition
+	{
+		/// Data type
+		GpuConstantType constType;
+		/// Physical start index in buffer (either float, double or int buffer)
+		size_t physicalIndex;
+		/// Logical index - used to communicate this constant to the rendersystem
+		size_t logicalIndex;
+		/** Number of raw buffer slots per element 
+		(some programs pack each array element to float4, some do not) */
+		size_t elementSize;
+		/// Length of array
+		size_t arraySize;
+		/// How this parameter varies (bitwise combination of GpuProgramVariability)
+		mutable uint16 variability;
+
+		bool isFloat() const
+		{
+			return isFloat(constType);
+		}
+
+		static bool isFloat(GpuConstantType c)
+		{
+			switch(c)
+			{
+			case GCT_INT1:
+			case GCT_INT2:
+			case GCT_INT3:
+			case GCT_INT4:
+			case GCT_SAMPLER1D:
+			case GCT_SAMPLER2D:
+            case GCT_SAMPLER2DARRAY:
+			case GCT_SAMPLER3D:
+			case GCT_SAMPLERCUBE:
+			case GCT_SAMPLER1DSHADOW:
+			case GCT_SAMPLER2DSHADOW:
+				return false;
+			default:
+				return true;
+			};
+
+		}
+
+        bool isDouble() const
+		{
+			return isDouble(constType);
+		}
+
+		static bool isDouble(GpuConstantType c)
+		{
+			switch(c)
+			{
+                case GCT_INT1:
+                case GCT_INT2:
+                case GCT_INT3:
+                case GCT_INT4:
+                case GCT_FLOAT1:
+                case GCT_FLOAT2:
+                case GCT_FLOAT3:
+                case GCT_FLOAT4:
+                case GCT_SAMPLER1D:
+                case GCT_SAMPLER2D:
+                case GCT_SAMPLER2DARRAY:
+                case GCT_SAMPLER3D:
+                case GCT_SAMPLERCUBE:
+                case GCT_SAMPLER1DSHADOW:
+                case GCT_SAMPLER2DSHADOW:
+                    return false;
+                default:
+                    return true;
+			};
+            
+		}
+
+		bool isSampler() const
+		{
+			return isSampler(constType);
+		}
+
+		static bool isSampler(GpuConstantType c)
+		{
+			switch(c)
+			{
+			case GCT_SAMPLER1D:
+			case GCT_SAMPLER2D:
+            case GCT_SAMPLER2DARRAY:
+			case GCT_SAMPLER3D:
+			case GCT_SAMPLERCUBE:
+			case GCT_SAMPLER1DSHADOW:
+			case GCT_SAMPLER2DSHADOW:
+				return true;
+			default:
+				return false;
+			};
+
+		}
+
+		bool isSubroutine() const
+		{
+			return isSubroutine(constType);
+		}
+
+		static bool isSubroutine(GpuConstantType c)
+		{
+			return c == GCT_SUBROUTINE;
+		}
+
+		/** Get the element size of a given type, including whether to pad the 
+			elements into multiples of 4 (e.g. SM1 and D3D does, GLSL doesn't)
+		*/
+		static size_t getElementSize(GpuConstantType ctype, bool padToMultiplesOf4)
+		{
+			if (padToMultiplesOf4)
+			{
+				switch(ctype)
+				{
+				case GCT_FLOAT1:
+				case GCT_INT1:
+				case GCT_SAMPLER1D:
+				case GCT_SAMPLER2D:
+                case GCT_SAMPLER2DARRAY:
+				case GCT_SAMPLER3D:
+				case GCT_SAMPLERCUBE:
+				case GCT_SAMPLER1DSHADOW:
+				case GCT_SAMPLER2DSHADOW:
+				case GCT_FLOAT2:
+				case GCT_INT2:
+				case GCT_FLOAT3:
+				case GCT_INT3:
+				case GCT_FLOAT4:
+				case GCT_INT4:
+					return 4;
+				case GCT_MATRIX_2X2:
+				case GCT_MATRIX_2X3:
+				case GCT_MATRIX_2X4:
+                case GCT_DOUBLE1:
+                case GCT_DOUBLE2:
+                case GCT_DOUBLE3:
+                case GCT_DOUBLE4:
+					return 8; // 2 float4s
+				case GCT_MATRIX_3X2:
+				case GCT_MATRIX_3X3:
+				case GCT_MATRIX_3X4:
+					return 12; // 3 float4s
+				case GCT_MATRIX_4X2:
+				case GCT_MATRIX_4X3:
+				case GCT_MATRIX_4X4:
+                case GCT_MATRIX_DOUBLE_2X2:
+                case GCT_MATRIX_DOUBLE_2X3:
+                case GCT_MATRIX_DOUBLE_2X4:
+					return 16; // 4 float4s
+                case GCT_MATRIX_DOUBLE_3X2:
+                case GCT_MATRIX_DOUBLE_3X3:
+                case GCT_MATRIX_DOUBLE_3X4:
+                    return 24;
+                case GCT_MATRIX_DOUBLE_4X2:
+                case GCT_MATRIX_DOUBLE_4X3:
+                case GCT_MATRIX_DOUBLE_4X4:
+                    return 32;
+				default:
+					return 4;
+				};
+			}
+			else
+			{
+				switch(ctype)
+				{
+				case GCT_FLOAT1:
+                case GCT_DOUBLE1:
+				case GCT_INT1:
+				case GCT_SAMPLER1D:
+				case GCT_SAMPLER2D:
+                case GCT_SAMPLER2DARRAY:
+				case GCT_SAMPLER3D:
+				case GCT_SAMPLERCUBE:
+				case GCT_SAMPLER1DSHADOW:
+				case GCT_SAMPLER2DSHADOW:
+					return 1;
+				case GCT_FLOAT2:
+				case GCT_INT2:
+                case GCT_DOUBLE2:
+					return 2;
+				case GCT_FLOAT3:
+				case GCT_INT3:
+                case GCT_DOUBLE3:
+					return 3;
+				case GCT_FLOAT4:
+				case GCT_INT4:
+                case GCT_DOUBLE4:
+					return 4;
+				case GCT_MATRIX_2X2:
+                case GCT_MATRIX_DOUBLE_2X2:
+					return 4;
+				case GCT_MATRIX_2X3:
+				case GCT_MATRIX_3X2:
+                case GCT_MATRIX_DOUBLE_2X3:
+                case GCT_MATRIX_DOUBLE_3X2:
+					return 6;
+				case GCT_MATRIX_2X4:
+				case GCT_MATRIX_4X2:
+                case GCT_MATRIX_DOUBLE_2X4:
+                case GCT_MATRIX_DOUBLE_4X2:
+					return 8;
+				case GCT_MATRIX_3X3:
+                case GCT_MATRIX_DOUBLE_3X3:
+					return 9;
+				case GCT_MATRIX_3X4:
+				case GCT_MATRIX_4X3:
+                case GCT_MATRIX_DOUBLE_3X4:
+                case GCT_MATRIX_DOUBLE_4X3:
+					return 12;
+				case GCT_MATRIX_4X4:
+                case GCT_MATRIX_DOUBLE_4X4:
+					return 16;
+				default:
+					return 4;
+				};
+
+			}
+		}
+
+		GpuConstantDefinition()
+			: constType(GCT_UNKNOWN)
+			, physicalIndex((std::numeric_limits<size_t>::max)())
+            , logicalIndex(0)
+			, elementSize(0)
+			, arraySize(1)
+			, variability(GPV_GLOBAL) {}
+	};
+	typedef map<String, GpuConstantDefinition>::type GpuConstantDefinitionMap;
+	typedef ConstMapIterator<GpuConstantDefinitionMap> GpuConstantDefinitionIterator;
+
+	/// Struct collecting together the information for named constants.
+	struct _OgreExport GpuNamedConstants : public GpuParamsAlloc
+	{
+		/// Total size of the float buffer required
+		size_t floatBufferSize;
+		/// Total size of the double buffer required
+		size_t doubleBufferSize;
+		/// Total size of the int buffer required
+		size_t intBufferSize;
+		/// Map of parameter names to GpuConstantDefinition
+		GpuConstantDefinitionMap map;
+
+		GpuNamedConstants() : floatBufferSize(0), doubleBufferSize(0), intBufferSize(0) {}
+
+		/** Generate additional constant entries for arrays based on a base definition.
+		@remarks
+		Array uniforms will be added just with their base name with no array
+		suffix. This method will add named entries for array suffixes too
+		so individual array entries can be addressed. Note that we only 
+		individually index array elements if the array size is up to 16
+		entries in size. Anything larger than that only gets a [0] entry
+		as well as the main entry, to save cluttering up the name map. After
+		all, you can address the larger arrays in a bulk fashion much more
+		easily anyway. 
+		*/
+		void generateConstantDefinitionArrayEntries(const String& paramName, 
+			const GpuConstantDefinition& baseDef);
+
+		/// Indicates whether all array entries will be generated and added to the definitions map
+		static bool getGenerateAllConstantDefinitionArrayEntries();
+
+		/** Sets whether all array entries will be generated and added to the definitions map.
+		@remarks
+		Usually, array entries can only be individually indexed if they're up to 16 entries long,
+		to save memory - arrays larger than that can be set but only via the bulk setting
+		methods. This option allows you to choose to individually index every array entry. 
+		*/
+		static void setGenerateAllConstantDefinitionArrayEntries(bool generateAll);
+
+		/** Saves constant definitions to a file, compatible with GpuProgram::setManualNamedConstantsFile. 
+		@see GpuProgram::setManualNamedConstantsFile
+		*/
+		void save(const String& filename) const;
+		/** Loads constant definitions from a stream, compatible with GpuProgram::setManualNamedConstantsFile. 
+		@see GpuProgram::setManualNamedConstantsFile
+		*/
+		void load(DataStreamPtr& stream);
+
+        size_t calculateSize(void) const;
+
+	protected:
+		/** Indicates whether all array entries will be generated and added to the definitions map
+		@remarks
+		Normally, the number of array entries added to the definitions map is capped at 16
+		to save memory. Setting this value to <code>true</code> allows all of the entries
+		to be generated and added to the map.
+		*/
+		static bool msGenerateAllConstantDefinitionArrayEntries;
+	};
+	typedef SharedPtr<GpuNamedConstants> GpuNamedConstantsPtr;
+
+	/// Simple class for loading / saving GpuNamedConstants
+	class _OgreExport GpuNamedConstantsSerializer : public Serializer
+	{
+	public:
+		GpuNamedConstantsSerializer();
+		virtual ~GpuNamedConstantsSerializer();
+		void exportNamedConstants(const GpuNamedConstants* pConsts, const String& filename,
+			Endian endianMode = ENDIAN_NATIVE);
+		void exportNamedConstants(const GpuNamedConstants* pConsts, DataStreamPtr stream,
+			Endian endianMode = ENDIAN_NATIVE);
+		void importNamedConstants(DataStreamPtr& stream, GpuNamedConstants* pDest);
+	};
+
+	/** Structure recording the use of a physical buffer by a logical parameter
+	index. Only used for low-level programs.
+	*/
+	struct _OgreExport GpuLogicalIndexUse
+	{
+		/// Physical buffer index
+		size_t physicalIndex;
+		/// Current physical size allocation
+		size_t currentSize;
+		/// How the contents of this slot vary
+		mutable uint16 variability;
+
+		GpuLogicalIndexUse() 
+			: physicalIndex(99999), currentSize(0), variability(GPV_GLOBAL) {}
+		GpuLogicalIndexUse(size_t bufIdx, size_t curSz, uint16 v) 
+			: physicalIndex(bufIdx), currentSize(curSz), variability(v) {}
+	};
+	typedef map<size_t, GpuLogicalIndexUse>::type GpuLogicalIndexUseMap;
+	/// Container struct to allow params to safely & update shared list of logical buffer assignments
+	struct _OgreExport GpuLogicalBufferStruct : public GpuParamsAlloc
+	{
+            OGRE_MUTEX(mutex);
+            
+            /// Map from logical index to physical buffer location
+            GpuLogicalIndexUseMap map;
+            /// Shortcut to know the buffer size needs
+            size_t bufferSize;
+            GpuLogicalBufferStruct() : bufferSize(0) {}
+	};
+	typedef SharedPtr<GpuLogicalBufferStruct> GpuLogicalBufferStructPtr;
+
+	/** Definition of container that holds the current float constants.
+	@note Not necessarily in direct index order to constant indexes, logical
+	to physical index map is derived from GpuProgram
+	*/
+	typedef vector<float>::type FloatConstantList;
+	/** Definition of container that holds the current double constants.
+     @note Not necessarily in direct index order to constant indexes, logical
+     to physical index map is derived from GpuProgram
+     */
+	typedef vector<double>::type DoubleConstantList;
+	/** Definition of container that holds the current float constants.
+	@note Not necessarily in direct index order to constant indexes, logical
+	to physical index map is derived from GpuProgram
+	*/
+	typedef vector<int>::type IntConstantList;
+
+	/** A group of manually updated parameters that are shared between many parameter sets.
+	@remarks
+		Sometimes you want to set some common parameters across many otherwise 
+		different parameter sets, and keep them all in sync together. This class
+		allows you to define a set of parameters that you can share across many
+		parameter sets and have the parameters that match automatically be pulled
+		from the shared set, rather than you having to set them on all the parameter
+		sets individually.
+	@par
+		Parameters in a shared set are matched up with instances in a GpuProgramParameters
+		structure by matching names. It is up to you to define the named parameters
+		that a shared set contains, and ensuring the definition matches.
+	@note
+		Shared parameter sets can be named, and looked up using the GpuProgramManager.
+	*/
+	class _OgreExport GpuSharedParameters : public GpuParamsAlloc
+	{
+	protected:
+		GpuNamedConstants mNamedConstants;
+		FloatConstantList mFloatConstants;
+		DoubleConstantList mDoubleConstants;
+		IntConstantList mIntConstants;
+		String mName;
+
+		// Optional data the rendersystem might want to store
+		mutable Any mRenderSystemData;
+
+		/// Not used when copying data, but might be useful to RS using shared buffers
+		size_t mFrameLastUpdated;
+
+		/// Version number of the definitions in this buffer
+		unsigned long mVersion; 
+
+	public:
+		GpuSharedParameters(const String& name);
+		virtual ~GpuSharedParameters();
+
+		/// Get the name of this shared parameter set
+		const String& getName() { return mName; }
+
+		/** Add a new constant definition to this shared set of parameters.
+		@remarks
+			Unlike GpuProgramParameters, where the parameter list is defined by the
+			program being compiled, this shared parameter set is defined by the
+			user. Only parameters which have been predefined here may be later
+			updated.
+		*/
+		void addConstantDefinition(const String& name, GpuConstantType constType, size_t arraySize = 1);
+
+		/** Remove a constant definition from this shared set of parameters.
+		*/
+		void removeConstantDefinition(const String& name);
+
+		/** Remove a constant definition from this shared set of parameters.
+		*/
+		void removeAllConstantDefinitions();
+
+		/** Get the version number of this shared parameter set, can be used to identify when 
+			changes have occurred. 
+		*/
+		unsigned long getVersion() const { return mVersion; }
+
+        size_t calculateSize(void) const;
+
+		/** Mark the shared set as being dirty (values modified).
+		@remarks
+		You do not need to call this yourself, set is marked as dirty whenever
+		setNamedConstant or (non const) getFloatPointer et al are called.
+		*/
+		void _markDirty();
+		/// Get the frame in which this shared parameter set was last updated
+		size_t getFrameLastUpdated() const { return mFrameLastUpdated; }
+
+		/** Gets an iterator over the named GpuConstantDefinition instances as defined
+			by the user. 
+		*/
+		GpuConstantDefinitionIterator getConstantDefinitionIterator(void) const;
+
+		/** Get a specific GpuConstantDefinition for a named parameter.
+		*/
+		const GpuConstantDefinition& getConstantDefinition(const String& name) const;
+
+		/** Get the full list of GpuConstantDefinition instances.
+		*/
+		const GpuNamedConstants& getConstantDefinitions() const;
+	
+		/** @copydoc GpuProgramParameters::setNamedConstant(const String& name, Real val) */
+		void setNamedConstant(const String& name, Real val);
+		/** @copydoc GpuProgramParameters::setNamedConstant(const String& name, int val) */
+		void setNamedConstant(const String& name, int val);
+		/** @copydoc GpuProgramParameters::setNamedConstant(const String& name, const Vector4& vec) */
+		void setNamedConstant(const String& name, const Vector4& vec);
+		/** @copydoc GpuProgramParameters::setNamedConstant(const String& name, const Vector3& vec) */
+		void setNamedConstant(const String& name, const Vector3& vec);
+		/** @copydoc GpuProgramParameters::setNamedConstant(const String& name, const Vector2& vec) */
+		void setNamedConstant(const String& name, const Vector2& vec);
+		/** @copydoc GpuProgramParameters::setNamedConstant(const String& name, const Matrix4& m) */
+		void setNamedConstant(const String& name, const Matrix4& m);
+		/** @copydoc GpuProgramParameters::setNamedConstant(const String& name, const Matrix4* m, size_t numEntries) */
+		void setNamedConstant(const String& name, const Matrix4* m, size_t numEntries);
+		/** @copydoc GpuProgramParameters::setNamedConstant(const String& name, const float *val, size_t count) */
+		void setNamedConstant(const String& name, const float *val, size_t count);
+		/** @copydoc GpuProgramParameters::setNamedConstant(const String& name, const double *val, size_t count) */
+		void setNamedConstant(const String& name, const double *val, size_t count);
+		/** @copydoc GpuProgramParameters::setNamedConstant(const String& name, const ColourValue& colour) */
+		void setNamedConstant(const String& name, const ColourValue& colour);
+		/** @copydoc GpuProgramParameters::setNamedConstant(const String& name, const int *val, size_t count) */
+		void setNamedConstant(const String& name, const int *val, size_t count);
+
+		/// Get a pointer to the 'nth' item in the float buffer
+		float* getFloatPointer(size_t pos) { _markDirty(); return &mFloatConstants[pos]; }
+		/// Get a pointer to the 'nth' item in the float buffer
+		const float* getFloatPointer(size_t pos) const { return &mFloatConstants[pos]; }
+		/// Get a pointer to the 'nth' item in the double buffer
+		double* getDoublePointer(size_t pos) { _markDirty(); return &mDoubleConstants[pos]; }
+		/// Get a pointer to the 'nth' item in the double buffer
+		const double* getDoublePointer(size_t pos) const { return &mDoubleConstants[pos]; }
+		/// Get a pointer to the 'nth' item in the int buffer
+		int* getIntPointer(size_t pos) { _markDirty(); return &mIntConstants[pos]; }
+		/// Get a pointer to the 'nth' item in the int buffer
+		const int* getIntPointer(size_t pos) const { return &mIntConstants[pos]; }
+
+		/// Get a reference to the list of float constants
+		const FloatConstantList& getFloatConstantList() const { return mFloatConstants; }
+		/// Get a reference to the list of double constants
+		const DoubleConstantList& getDoubleConstantList() const { return mDoubleConstants; }
+		/// Get a reference to the list of int constants
+		const IntConstantList& getIntConstantList() const { return mIntConstants; }
+
+		/** Internal method that the RenderSystem might use to store optional data. */
+		void _setRenderSystemData(const Any& data) const { mRenderSystemData = data; }
+		/** Internal method that the RenderSystem might use to store optional data. */
+		const Any& _getRenderSystemData() const { return mRenderSystemData; }
+
+	};
+
+	/// Shared pointer used to hold references to GpuProgramParameters instances
+	typedef SharedPtr<GpuSharedParameters> GpuSharedParametersPtr;
+
+	class GpuProgramParameters;
+
+	/** This class records the usage of a set of shared parameters in a concrete
+		set of GpuProgramParameters.
+	*/
+	class _OgreExport GpuSharedParametersUsage : public GpuParamsAlloc
+	{
+	protected:
+		GpuSharedParametersPtr mSharedParams;
+		// Not a shared pointer since this is also parent
+		GpuProgramParameters* mParams;
+		// list of physical mappings that we are going to bring in
+		struct CopyDataEntry
+		{
+			const GpuConstantDefinition* srcDefinition;
+			const GpuConstantDefinition* dstDefinition;
+		};
+		typedef vector<CopyDataEntry>::type CopyDataList;
+
+		CopyDataList mCopyDataList;
+
+		// Optional data the rendersystem might want to store
+		mutable Any mRenderSystemData;
+
+		/// Version of shared params we based the copydata on
+		unsigned long mCopyDataVersion;
+
+		void initCopyData();
+
+
+	public:
+		/// Construct usage
+		GpuSharedParametersUsage(GpuSharedParametersPtr sharedParams, 
+			GpuProgramParameters* params);
+
+		/** Update the target parameters by copying the data from the shared
+			parameters.
+		@note This method  may not actually be called if the RenderSystem
+			supports using shared parameters directly in their own shared buffer; in
+			which case the values should not be copied out of the shared area
+			into the individual parameter set, but bound separately.
+		*/
+		void _copySharedParamsToTargetParams();
+
+		/// Get the name of the shared parameter set
+		const String& getName() const { return mSharedParams->getName(); }
+
+		GpuSharedParametersPtr getSharedParams() const { return mSharedParams; }
+		GpuProgramParameters* getTargetParams() const { return mParams; }
+
+		/** Internal method that the RenderSystem might use to store optional data. */
+		void _setRenderSystemData(const Any& data) const { mRenderSystemData = data; }
+		/** Internal method that the RenderSystem might use to store optional data. */
+		const Any& _getRenderSystemData() const { return mRenderSystemData; }
+
+
+	};
+
+	/** Collects together the program parameters used for a GpuProgram.
+	@remarks
+	Gpu program state includes constant parameters used by the program, and
+	bindings to render system state which is propagated into the constants 
+	by the engine automatically if requested.
+	@par
+	GpuProgramParameters objects should be created through the GpuProgram and
+	may be shared between multiple Pass instances. For this reason they
+	are managed using a shared pointer, which will ensure they are automatically
+	deleted when no Pass is using them anymore. 
+	@par
+	High-level programs use named parameters (uniforms), low-level programs 
+	use indexed constants. This class supports both, but you can tell whether 
+	named constants are supported by calling hasNamedParameters(). There are
+	references in the documentation below to 'logical' and 'physical' indexes;
+	logical indexes are the indexes used by low-level programs and represent 
+	indexes into an array of float4's, some of which may be settable, some of
+	which may be predefined constants in the program. We only store those
+	constants which have actually been set, therefore our buffer could have 
+	gaps if we used the logical indexes in our own buffers. So instead we map
+	these logical indexes to physical indexes in our buffer. When using 
+	high-level programs, logical indexes don't necessarily exist, although they
+	might if the high-level program has a direct, exposed mapping from parameter
+	names to logical indexes. In addition, high-level languages may or may not pack
+	arrays of elements that are smaller than float4 (e.g. float2/vec2) contiguously.
+	This kind of information is held in the ConstantDefinition structure which 
+	is only populated for high-level programs. You don't have to worry about
+	any of this unless you intend to read parameters back from this structure
+	rather than just setting them.
+	*/
+	class _OgreExport GpuProgramParameters : public GpuParamsAlloc
+	{
+	public:
+		/** Defines the types of automatically updated values that may be bound to GpuProgram
+		parameters, or used to modify parameters on a per-object basis.
+		*/
+		enum AutoConstantType
+		{
+			/// The current world matrix
+			ACT_WORLD_MATRIX,
+			/// The current world matrix, inverted
+			ACT_INVERSE_WORLD_MATRIX,
+			/** Provides transpose of world matrix.
+			Equivalent to RenderMonkey's "WorldTranspose".
+			*/
+			ACT_TRANSPOSE_WORLD_MATRIX,
+			/// The current world matrix, inverted & transposed
+			ACT_INVERSE_TRANSPOSE_WORLD_MATRIX,
+
+			/// The current array of world matrices, as a 3x4 matrix, used for blending
+			ACT_WORLD_MATRIX_ARRAY_3x4,
+			/// The current array of world matrices, used for blending
+			ACT_WORLD_MATRIX_ARRAY,
+			/// The current array of world matrices transformed to an array of dual quaternions, represented as a 2x4 matrix
+			ACT_WORLD_DUALQUATERNION_ARRAY_2x4,
+			/// The scale and shear components of the current array of world matrices
+			ACT_WORLD_SCALE_SHEAR_MATRIX_ARRAY_3x4,
+			
+			/// The current view matrix
+			ACT_VIEW_MATRIX,
+			/// The current view matrix, inverted
+			ACT_INVERSE_VIEW_MATRIX,
+			/** Provides transpose of view matrix.
+			Equivalent to RenderMonkey's "ViewTranspose".
+			*/
+			ACT_TRANSPOSE_VIEW_MATRIX,
+			/** Provides inverse transpose of view matrix.
+			Equivalent to RenderMonkey's "ViewInverseTranspose".
+			*/
+			ACT_INVERSE_TRANSPOSE_VIEW_MATRIX,
+
+
+			/// The current projection matrix
+			ACT_PROJECTION_MATRIX,
+			/** Provides inverse of projection matrix.
+			Equivalent to RenderMonkey's "ProjectionInverse".
+			*/
+			ACT_INVERSE_PROJECTION_MATRIX,
+			/** Provides transpose of projection matrix.
+			Equivalent to RenderMonkey's "ProjectionTranspose".
+			*/
+			ACT_TRANSPOSE_PROJECTION_MATRIX,
+			/** Provides inverse transpose of projection matrix.
+			Equivalent to RenderMonkey's "ProjectionInverseTranspose".
+			*/
+			ACT_INVERSE_TRANSPOSE_PROJECTION_MATRIX,
+
+
+			/// The current view & projection matrices concatenated
+			ACT_VIEWPROJ_MATRIX,
+			/** Provides inverse of concatenated view and projection matrices.
+			Equivalent to RenderMonkey's "ViewProjectionInverse".
+			*/
+			ACT_INVERSE_VIEWPROJ_MATRIX,
+			/** Provides transpose of concatenated view and projection matrices.
+			Equivalent to RenderMonkey's "ViewProjectionTranspose".
+			*/
+			ACT_TRANSPOSE_VIEWPROJ_MATRIX,
+			/** Provides inverse transpose of concatenated view and projection matrices.
+			Equivalent to RenderMonkey's "ViewProjectionInverseTranspose".
+			*/
+			ACT_INVERSE_TRANSPOSE_VIEWPROJ_MATRIX,
+
+
+			/// The current world & view matrices concatenated
+			ACT_WORLDVIEW_MATRIX,
+			/// The current world & view matrices concatenated, then inverted
+			ACT_INVERSE_WORLDVIEW_MATRIX,
+			/** Provides transpose of concatenated world and view matrices.
+			Equivalent to RenderMonkey's "WorldViewTranspose".
+			*/
+			ACT_TRANSPOSE_WORLDVIEW_MATRIX,
+			/// The current world & view matrices concatenated, then inverted & transposed
+			ACT_INVERSE_TRANSPOSE_WORLDVIEW_MATRIX,
+			/// view matrices.
+
+
+			/// The current world, view & projection matrices concatenated
+			ACT_WORLDVIEWPROJ_MATRIX,
+			/** Provides inverse of concatenated world, view and projection matrices.
+			Equivalent to RenderMonkey's "WorldViewProjectionInverse".
+			*/
+			ACT_INVERSE_WORLDVIEWPROJ_MATRIX,
+			/** Provides transpose of concatenated world, view and projection matrices.
+			Equivalent to RenderMonkey's "WorldViewProjectionTranspose".
+			*/
+			ACT_TRANSPOSE_WORLDVIEWPROJ_MATRIX,
+			/** Provides inverse transpose of concatenated world, view and projection
+			matrices. Equivalent to RenderMonkey's "WorldViewProjectionInverseTranspose".
+			*/
+			ACT_INVERSE_TRANSPOSE_WORLDVIEWPROJ_MATRIX,
+
+
+			/// render target related values
+			/** -1 if requires texture flipping, +1 otherwise. It's useful when you bypassed
+			projection matrix transform, still able use this value to adjust transformed y position.
+			*/
+			ACT_RENDER_TARGET_FLIPPING,
+
+			/** -1 if the winding has been inverted (e.g. for reflections), +1 otherwise.
+			*/
+			ACT_VERTEX_WINDING,
+
+			/// Fog colour
+			ACT_FOG_COLOUR,
+			/// Fog params: density, linear start, linear end, 1/(end-start)
+			ACT_FOG_PARAMS,
+
+
+			/// Surface ambient colour, as set in Pass::setAmbient
+			ACT_SURFACE_AMBIENT_COLOUR,
+			/// Surface diffuse colour, as set in Pass::setDiffuse
+			ACT_SURFACE_DIFFUSE_COLOUR,
+			/// Surface specular colour, as set in Pass::setSpecular
+			ACT_SURFACE_SPECULAR_COLOUR,
+			/// Surface emissive colour, as set in Pass::setSelfIllumination
+			ACT_SURFACE_EMISSIVE_COLOUR,
+			/// Surface shininess, as set in Pass::setShininess
+			ACT_SURFACE_SHININESS,
+			/// Surface alpha rejection value, not as set in Pass::setAlphaRejectionValue, but a floating number between 0.0f and 1.0f instead (255.0f / Pass::getAlphaRejectionValue())
+			ACT_SURFACE_ALPHA_REJECTION_VALUE,
+
+
+			/// The number of active light sources (better than gl_MaxLights)
+			ACT_LIGHT_COUNT,
+
+
+			/// The ambient light colour set in the scene
+			ACT_AMBIENT_LIGHT_COLOUR, 
+
+			/// Light diffuse colour (index determined by setAutoConstant call)
+			ACT_LIGHT_DIFFUSE_COLOUR,
+			/// Light specular colour (index determined by setAutoConstant call)
+			ACT_LIGHT_SPECULAR_COLOUR,
+			/// Light attenuation parameters, Vector4(range, constant, linear, quadric)
+			ACT_LIGHT_ATTENUATION,
+			/** Spotlight parameters, Vector4(innerFactor, outerFactor, falloff, isSpot)
+			innerFactor and outerFactor are cos(angle/2)
+			The isSpot parameter is 0.0f for non-spotlights, 1.0f for spotlights.
+			Also for non-spotlights the inner and outer factors are 1 and nearly 1 respectively
+			*/ 
+			ACT_SPOTLIGHT_PARAMS,
+			/// A light position in world space (index determined by setAutoConstant call)
+			ACT_LIGHT_POSITION,
+			/// A light position in object space (index determined by setAutoConstant call)
+			ACT_LIGHT_POSITION_OBJECT_SPACE,
+			/// A light position in view space (index determined by setAutoConstant call)
+			ACT_LIGHT_POSITION_VIEW_SPACE,
+			/// A light direction in world space (index determined by setAutoConstant call)
+			ACT_LIGHT_DIRECTION,
+			/// A light direction in object space (index determined by setAutoConstant call)
+			ACT_LIGHT_DIRECTION_OBJECT_SPACE,
+			/// A light direction in view space (index determined by setAutoConstant call)
+			ACT_LIGHT_DIRECTION_VIEW_SPACE,
+			/** The distance of the light from the center of the object
+			a useful approximation as an alternative to per-vertex distance
+			calculations.
+			*/
+			ACT_LIGHT_DISTANCE_OBJECT_SPACE,
+			/** Light power level, a single scalar as set in Light::setPowerScale  (index determined by setAutoConstant call) */
+			ACT_LIGHT_POWER_SCALE,
+			/// Light diffuse colour pre-scaled by Light::setPowerScale (index determined by setAutoConstant call)
+			ACT_LIGHT_DIFFUSE_COLOUR_POWER_SCALED,
+			/// Light specular colour pre-scaled by Light::setPowerScale (index determined by setAutoConstant call)
+			ACT_LIGHT_SPECULAR_COLOUR_POWER_SCALED,
+			/// Array of light diffuse colours (count set by extra param)
+			ACT_LIGHT_DIFFUSE_COLOUR_ARRAY,
+			/// Array of light specular colours (count set by extra param)
+			ACT_LIGHT_SPECULAR_COLOUR_ARRAY,
+			/// Array of light diffuse colours scaled by light power (count set by extra param)
+			ACT_LIGHT_DIFFUSE_COLOUR_POWER_SCALED_ARRAY,
+			/// Array of light specular colours scaled by light power (count set by extra param)
+			ACT_LIGHT_SPECULAR_COLOUR_POWER_SCALED_ARRAY,
+			/// Array of light attenuation parameters, Vector4(range, constant, linear, quadric) (count set by extra param)
+			ACT_LIGHT_ATTENUATION_ARRAY,
+			/// Array of light positions in world space (count set by extra param)
+			ACT_LIGHT_POSITION_ARRAY,
+			/// Array of light positions in object space (count set by extra param)
+			ACT_LIGHT_POSITION_OBJECT_SPACE_ARRAY,
+			/// Array of light positions in view space (count set by extra param)
+			ACT_LIGHT_POSITION_VIEW_SPACE_ARRAY,
+			/// Array of light directions in world space (count set by extra param)
+			ACT_LIGHT_DIRECTION_ARRAY,
+			/// Array of light directions in object space (count set by extra param)
+			ACT_LIGHT_DIRECTION_OBJECT_SPACE_ARRAY,
+			/// Array of light directions in view space (count set by extra param)
+			ACT_LIGHT_DIRECTION_VIEW_SPACE_ARRAY,
+			/** Array of distances of the lights from the center of the object
+			a useful approximation as an alternative to per-vertex distance
+			calculations. (count set by extra param)
+			*/
+			ACT_LIGHT_DISTANCE_OBJECT_SPACE_ARRAY,
+			/** Array of light power levels, a single scalar as set in Light::setPowerScale 
+			(count set by extra param)
+			*/
+			ACT_LIGHT_POWER_SCALE_ARRAY,
+			/** Spotlight parameters array of Vector4(innerFactor, outerFactor, falloff, isSpot)
+			innerFactor and outerFactor are cos(angle/2)
+			The isSpot parameter is 0.0f for non-spotlights, 1.0f for spotlights.
+			Also for non-spotlights the inner and outer factors are 1 and nearly 1 respectively.
+			(count set by extra param)
+			*/ 
+			ACT_SPOTLIGHT_PARAMS_ARRAY,
+
+			/** The derived ambient light colour, with 'r', 'g', 'b' components filled with
+			product of surface ambient colour and ambient light colour, respectively,
+			and 'a' component filled with surface ambient alpha component.
+			*/
+			ACT_DERIVED_AMBIENT_LIGHT_COLOUR,
+			/** The derived scene colour, with 'r', 'g' and 'b' components filled with sum
+			of derived ambient light colour and surface emissive colour, respectively,
+			and 'a' component filled with surface diffuse alpha component.
+			*/
+			ACT_DERIVED_SCENE_COLOUR,
+
+			/** The derived light diffuse colour (index determined by setAutoConstant call),
+			with 'r', 'g' and 'b' components filled with product of surface diffuse colour,
+			light power scale and light diffuse colour, respectively, and 'a' component filled with surface
+			diffuse alpha component.
+			*/
+			ACT_DERIVED_LIGHT_DIFFUSE_COLOUR,
+			/** The derived light specular colour (index determined by setAutoConstant call),
+			with 'r', 'g' and 'b' components filled with product of surface specular colour
+			and light specular colour, respectively, and 'a' component filled with surface
+			specular alpha component.
+			*/
+			ACT_DERIVED_LIGHT_SPECULAR_COLOUR,
+
+			/// Array of derived light diffuse colours (count set by extra param)
+			ACT_DERIVED_LIGHT_DIFFUSE_COLOUR_ARRAY,
+			/// Array of derived light specular colours (count set by extra param)
+			ACT_DERIVED_LIGHT_SPECULAR_COLOUR_ARRAY,
+			/** The absolute light number of a local light index. Each pass may have
+			a number of lights passed to it, and each of these lights will have
+			an index in the overall light list, which will differ from the local
+			light index due to factors like setStartLight and setIteratePerLight.
+			This binding provides the global light index for a local index.
+			*/
+			ACT_LIGHT_NUMBER,
+			/// Returns (int) 1 if the  given light casts shadows, 0 otherwise (index set in extra param)
+			ACT_LIGHT_CASTS_SHADOWS,
+			/// Returns (int) 1 if the  given light casts shadows, 0 otherwise (index set in extra param)
+			ACT_LIGHT_CASTS_SHADOWS_ARRAY,
+
+
+			/** The distance a shadow volume should be extruded when using
+			finite extrusion programs.
+			*/
+			ACT_SHADOW_EXTRUSION_DISTANCE,
+			/// The current camera's position in world space
+			ACT_CAMERA_POSITION,
+			/// The current camera's position in object space 
+			ACT_CAMERA_POSITION_OBJECT_SPACE,
+			/// The view/projection matrix of the assigned texture projection frustum
+			ACT_TEXTURE_VIEWPROJ_MATRIX,
+			/// Array of view/projection matrices of the first n texture projection frustums
+			ACT_TEXTURE_VIEWPROJ_MATRIX_ARRAY,
+			/** The view/projection matrix of the assigned texture projection frustum, 
+			combined with the current world matrix
+			*/
+			ACT_TEXTURE_WORLDVIEWPROJ_MATRIX,
+			/// Array of world/view/projection matrices of the first n texture projection frustums
+			ACT_TEXTURE_WORLDVIEWPROJ_MATRIX_ARRAY,
+			/// The view/projection matrix of a given spotlight
+			ACT_SPOTLIGHT_VIEWPROJ_MATRIX,
+			/// Array of view/projection matrix of a given spotlight
+			ACT_SPOTLIGHT_VIEWPROJ_MATRIX_ARRAY,
+			/** The view/projection matrix of a given spotlight projection frustum, 
+			combined with the current world matrix
+			*/
+			ACT_SPOTLIGHT_WORLDVIEWPROJ_MATRIX,
+			/** An array of the view/projection matrix of a given spotlight projection frustum,
+             combined with the current world matrix
+             */
+			ACT_SPOTLIGHT_WORLDVIEWPROJ_MATRIX_ARRAY,
+			/// A custom parameter which will come from the renderable, using 'data' as the identifier
+			ACT_CUSTOM,
+			/** provides current elapsed time
+			*/
+			ACT_TIME,
+			/** Single float value, which repeats itself based on given as
+			parameter "cycle time". Equivalent to RenderMonkey's "Time0_X".
+			*/
+			ACT_TIME_0_X,
+			/// Cosine of "Time0_X". Equivalent to RenderMonkey's "CosTime0_X".
+			ACT_COSTIME_0_X,
+			/// Sine of "Time0_X". Equivalent to RenderMonkey's "SinTime0_X".
+			ACT_SINTIME_0_X,
+			/// Tangent of "Time0_X". Equivalent to RenderMonkey's "TanTime0_X".
+			ACT_TANTIME_0_X,
+			/** Vector of "Time0_X", "SinTime0_X", "CosTime0_X", 
+			"TanTime0_X". Equivalent to RenderMonkey's "Time0_X_Packed".
+			*/
+			ACT_TIME_0_X_PACKED,
+			/** Single float value, which represents scaled time value [0..1],
+			which repeats itself based on given as parameter "cycle time".
+			Equivalent to RenderMonkey's "Time0_1".
+			*/
+			ACT_TIME_0_1,
+			/// Cosine of "Time0_1". Equivalent to RenderMonkey's "CosTime0_1".
+			ACT_COSTIME_0_1,
+			/// Sine of "Time0_1". Equivalent to RenderMonkey's "SinTime0_1".
+			ACT_SINTIME_0_1,
+			/// Tangent of "Time0_1". Equivalent to RenderMonkey's "TanTime0_1".
+			ACT_TANTIME_0_1,
+			/** Vector of "Time0_1", "SinTime0_1", "CosTime0_1",
+			"TanTime0_1". Equivalent to RenderMonkey's "Time0_1_Packed".
+			*/
+			ACT_TIME_0_1_PACKED,
+			/**	Single float value, which represents scaled time value [0..2*Pi],
+			which repeats itself based on given as parameter "cycle time".
+			Equivalent to RenderMonkey's "Time0_2PI".
+			*/
+			ACT_TIME_0_2PI,
+			/// Cosine of "Time0_2PI". Equivalent to RenderMonkey's "CosTime0_2PI".
+			ACT_COSTIME_0_2PI,
+			/// Sine of "Time0_2PI". Equivalent to RenderMonkey's "SinTime0_2PI".
+			ACT_SINTIME_0_2PI,
+			/// Tangent of "Time0_2PI". Equivalent to RenderMonkey's "TanTime0_2PI".
+			ACT_TANTIME_0_2PI,
+			/** Vector of "Time0_2PI", "SinTime0_2PI", "CosTime0_2PI",
+			"TanTime0_2PI". Equivalent to RenderMonkey's "Time0_2PI_Packed".
+			*/
+			ACT_TIME_0_2PI_PACKED,
+			/// provides the scaled frame time, returned as a floating point value.
+			ACT_FRAME_TIME,
+			/// provides the calculated frames per second, returned as a floating point value.
+			ACT_FPS,
+			/// viewport-related values
+			/** Current viewport width (in pixels) as floating point value.
+			Equivalent to RenderMonkey's "ViewportWidth".
+			*/
+			ACT_VIEWPORT_WIDTH,
+			/** Current viewport height (in pixels) as floating point value.
+			Equivalent to RenderMonkey's "ViewportHeight".
+			*/
+			ACT_VIEWPORT_HEIGHT,
+			/** This variable represents 1.0/ViewportWidth. 
+			Equivalent to RenderMonkey's "ViewportWidthInverse".
+			*/
+			ACT_INVERSE_VIEWPORT_WIDTH,
+			/** This variable represents 1.0/ViewportHeight.
+			Equivalent to RenderMonkey's "ViewportHeightInverse".
+			*/
+			ACT_INVERSE_VIEWPORT_HEIGHT,
+			/** Packed of "ViewportWidth", "ViewportHeight", "ViewportWidthInverse",
+			"ViewportHeightInverse".
+			*/
+			ACT_VIEWPORT_SIZE,
+
+			/// view parameters
+			/** This variable provides the view direction vector (world space).
+			Equivalent to RenderMonkey's "ViewDirection".
+			*/
+			ACT_VIEW_DIRECTION,
+			/** This variable provides the view side vector (world space).
+			Equivalent to RenderMonkey's "ViewSideVector".
+			*/
+			ACT_VIEW_SIDE_VECTOR,
+			/** This variable provides the view up vector (world space).
+			Equivalent to RenderMonkey's "ViewUpVector".
+			*/
+			ACT_VIEW_UP_VECTOR,
+			/** This variable provides the field of view as a floating point value.
+			Equivalent to RenderMonkey's "FOV".
+			*/
+			ACT_FOV,
+			/**	This variable provides the near clip distance as a floating point value.
+			Equivalent to RenderMonkey's "NearClipPlane".
+			*/
+			ACT_NEAR_CLIP_DISTANCE,
+			/**	This variable provides the far clip distance as a floating point value.
+			Equivalent to RenderMonkey's "FarClipPlane".
+			*/
+			ACT_FAR_CLIP_DISTANCE,
+
+			/** provides the pass index number within the technique
+			of the active materil.
+			*/
+			ACT_PASS_NUMBER,
+
+			/** provides the current iteration number of the pass. The iteration
+			number is the number of times the current render operation has
+			been drawn for the active pass.
+			*/
+			ACT_PASS_ITERATION_NUMBER,
+
+
+			/** Provides a parametric animation value [0..1], only available
+			where the renderable specifically implements it.
+			*/
+			ACT_ANIMATION_PARAMETRIC,
+
+			/** Provides the texel offsets required by this rendersystem to map
+			texels to pixels. Packed as 
+			float4(absoluteHorizontalOffset, absoluteVerticalOffset, 
+			horizontalOffset / viewportWidth, verticalOffset / viewportHeight)
+			*/
+			ACT_TEXEL_OFFSETS,
+
+			/** Provides information about the depth range of the scene as viewed
+			from the current camera. 
+			Passed as float4(minDepth, maxDepth, depthRange, 1 / depthRange)
+			*/
+			ACT_SCENE_DEPTH_RANGE,
+
+			/** Provides information about the depth range of the scene as viewed
+			from a given shadow camera. Requires an index parameter which maps
+			to a light index relative to the current light list.
+			Passed as float4(minDepth, maxDepth, depthRange, 1 / depthRange)
+			*/
+			ACT_SHADOW_SCENE_DEPTH_RANGE,
+
+            /** Provides an array of information about the depth range of the scene as viewed
+             from a given shadow camera. Requires an index parameter which maps
+             to a light index relative to the current light list.
+             Passed as float4(minDepth, maxDepth, depthRange, 1 / depthRange)
+            */
+			ACT_SHADOW_SCENE_DEPTH_RANGE_ARRAY,
+
+			/** Provides the fixed shadow colour as configured via SceneManager::setShadowColour;
+			useful for integrated modulative shadows.
+			*/
+			ACT_SHADOW_COLOUR,
+			/** Provides texture size of the texture unit (index determined by setAutoConstant
+			call). Packed as float4(width, height, depth, 1)
+			*/
+			ACT_TEXTURE_SIZE,
+			/** Provides inverse texture size of the texture unit (index determined by setAutoConstant
+			call). Packed as float4(1 / width, 1 / height, 1 / depth, 1)
+			*/
+			ACT_INVERSE_TEXTURE_SIZE,
+			/** Provides packed texture size of the texture unit (index determined by setAutoConstant
+			call). Packed as float4(width, height, 1 / width, 1 / height)
+			*/
+			ACT_PACKED_TEXTURE_SIZE,
+
+			/** Provides the current transform matrix of the texture unit (index determined by setAutoConstant
+			call), as seen by the fixed-function pipeline. 
+			*/
+			ACT_TEXTURE_MATRIX, 
+
+			/** Provides the position of the LOD camera in world space, allowing you 
+			to perform separate LOD calculations in shaders independent of the rendering
+			camera. If there is no separate LOD camera then this is the real camera
+			position. See Camera::setLodCamera.
+			*/
+			ACT_LOD_CAMERA_POSITION, 
+			/** Provides the position of the LOD camera in object space, allowing you 
+			to perform separate LOD calculations in shaders independent of the rendering
+			camera. If there is no separate LOD camera then this is the real camera
+			position. See Camera::setLodCamera.
+			*/
+			ACT_LOD_CAMERA_POSITION_OBJECT_SPACE, 
+			/** Binds custom per-light constants to the shaders. */
+			ACT_LIGHT_CUSTOM,
+
+            ACT_UNKNOWN = 999
+		};
+
+		/** Defines the type of the extra data item used by the auto constant.
+
+		*/
+		enum ACDataType {
+			/// no data is required
+			ACDT_NONE,
+			/// the auto constant requires data of type int
+			ACDT_INT,
+			/// the auto constant requires data of type real
+			ACDT_REAL
+		};
+
+		/** Defines the base element type of the auto constant
+		*/
+		enum ElementType {
+			ET_INT,
+			ET_REAL
+		};
+
+		/** Structure defining an auto constant that's available for use in 
+		a parameters object.
+		*/
+		struct AutoConstantDefinition
+		{
+			AutoConstantType acType;
+			String name;
+			size_t elementCount;
+			/// The type of the constant in the program
+			ElementType elementType;
+			/// The type of any extra data
+			ACDataType dataType;
+
+			AutoConstantDefinition(AutoConstantType _acType, const String& _name, 
+				size_t _elementCount, ElementType _elementType, 
+				ACDataType _dataType)
+				:acType(_acType), name(_name), elementCount(_elementCount), 
+				elementType(_elementType), dataType(_dataType)
+			{
+
+			}
+		};
+
+		/** Structure recording the use of an automatic parameter. */
+		class AutoConstantEntry
+		{
+		public:
+			/// The type of parameter
+			AutoConstantType paramType;
+			/// The target (physical) constant index
+			size_t physicalIndex;
+			/** The number of elements per individual entry in this constant
+			Used in case people used packed elements smaller than 4 (e.g. GLSL)
+			and bind an auto which is 4-element packed to it */
+			size_t elementCount;
+			/// Additional information to go with the parameter
+			union{
+				size_t data;
+				Real fData;
+			};
+			/// The variability of this parameter (see GpuParamVariability)
+			uint16 variability;
+
+			AutoConstantEntry(AutoConstantType theType, size_t theIndex, size_t theData, 
+				uint16 theVariability, size_t theElemCount = 4)
+				: paramType(theType), physicalIndex(theIndex), elementCount(theElemCount), 
+				data(theData), variability(theVariability) {}
+
+			AutoConstantEntry(AutoConstantType theType, size_t theIndex, Real theData, 
+				uint16 theVariability, size_t theElemCount = 4)
+				: paramType(theType), physicalIndex(theIndex), elementCount(theElemCount), 
+				fData(theData), variability(theVariability) {}
+
+		};
+		// Auto parameter storage
+		typedef vector<AutoConstantEntry>::type AutoConstantList;
+
+		typedef vector<GpuSharedParametersUsage>::type GpuSharedParamUsageList;
+
+		// Map that store subroutines associated with slots
+		typedef HashMap<unsigned int, String> SubroutineMap;
+		typedef HashMap<unsigned int, String>::const_iterator SubroutineIterator;
+
+	protected:
+		SubroutineMap mSubroutineMap;
+
+		static AutoConstantDefinition AutoConstantDictionary[];
+		/// Packed list of floating-point constants (physical indexing)
+		FloatConstantList mFloatConstants;
+		/// Packed list of double-point constants (physical indexing)
+		DoubleConstantList mDoubleConstants;
+		/// Packed list of integer constants (physical indexing)
+		IntConstantList mIntConstants;
+		/** Logical index to physical index map - for low-level programs
+         or high-level programs which pass params this way. */
+		GpuLogicalBufferStructPtr mFloatLogicalToPhysical;
+		/** Logical index to physical index map - for low-level programs
+		or high-level programs which pass params this way. */
+		GpuLogicalBufferStructPtr mDoubleLogicalToPhysical;
+		/** Logical index to physical index map - for low-level programs
+		or high-level programs which pass params this way. */
+		GpuLogicalBufferStructPtr mIntLogicalToPhysical;
+		/// Mapping from parameter names to def - high-level programs are expected to populate this
+		GpuNamedConstantsPtr mNamedConstants;
+		/// List of automatically updated parameters
+		AutoConstantList mAutoConstants;
+		/// The combined variability masks of all parameters
+		uint16 mCombinedVariability;
+		/// Do we need to transpose matrices?
+		bool mTransposeMatrices;
+		/// flag to indicate if names not found will be ignored
+		bool mIgnoreMissingParams;
+		/// physical index for active pass iteration parameter real constant entry;
+		size_t mActivePassIterationIndex;
+
+		/** Gets the low-level structure for a logical index. 
+		*/
+		GpuLogicalIndexUse* _getFloatConstantLogicalIndexUse(size_t logicalIndex, size_t requestedSize, uint16 variability);
+		/** Gets the low-level structure for a logical index.
+         */
+		GpuLogicalIndexUse* _getDoubleConstantLogicalIndexUse(size_t logicalIndex, size_t requestedSize, uint16 variability);
+		/** Gets the physical buffer index associated with a logical int constant index.
+		*/
+		GpuLogicalIndexUse* _getIntConstantLogicalIndexUse(size_t logicalIndex, size_t requestedSize, uint16 variability);
+
+		/// Return the variability for an auto constant
+		uint16 deriveVariability(AutoConstantType act);
+
+		void copySharedParamSetUsage(const GpuSharedParamUsageList& srcList);
+
+		GpuSharedParamUsageList mSharedParamSets;
+
+		// Optional data the rendersystem might want to store
+		mutable Any mRenderSystemData;
+
+
+
+	public:
+		GpuProgramParameters();
+		~GpuProgramParameters() {}
+
+		/// Copy constructor
+		GpuProgramParameters(const GpuProgramParameters& oth);
+		/// Operator = overload
+		GpuProgramParameters& operator=(const GpuProgramParameters& oth);
+
+		/** Internal method for providing a link to a name->definition map for parameters. */
+		void _setNamedConstants(const GpuNamedConstantsPtr& constantmap);
+
+		/** Internal method for providing a link to a logical index->physical index map for parameters. */
+		void _setLogicalIndexes(const GpuLogicalBufferStructPtr& floatIndexMap, const GpuLogicalBufferStructPtr& doubleIndexMap,
+			const GpuLogicalBufferStructPtr&  intIndexMap);
+
+
+		/// Does this parameter set include named parameters?
+		bool hasNamedParameters() const { return !mNamedConstants.isNull(); }
+		/** Does this parameter set include logically indexed parameters?
+		@note Not mutually exclusive with hasNamedParameters since some high-level
+		programs still use logical indexes to set the parameters on the 
+		rendersystem.
+		*/
+		bool hasLogicalIndexedParameters() const { return !mFloatLogicalToPhysical.isNull(); }
+
+		/** Sets a 4-element floating-point parameter to the program.
+		@param index The logical constant index at which to place the parameter 
+		(each constant is a 4D float)
+		@param vec The value to set
+		*/
+		void setConstant(size_t index, const Vector4& vec);
+		/** Sets a single floating-point parameter to the program.
+		@note This is actually equivalent to calling 
+		setConstant(index Vector4(val, 0, 0, 0)) since all constants are 4D.
+		@param index The logical constant index at which to place the parameter (each constant is
+		a 4D float)
+		@param val The value to set
+		*/
+		void setConstant(size_t index, Real val);
+		/** Sets a 4-element floating-point parameter to the program via Vector3.
+		@param index The logical constant index at which to place the parameter (each constant is
+		a 4D float).
+		Note that since you're passing a Vector3, the last element of the 4-element
+		value will be set to 1 (a homogeneous vector)
+		@param vec The value to set
+		*/
+		void setConstant(size_t index, const Vector3& vec);
+		/** Sets a 4-element floating-point parameter to the program via Vector2.
+         @param index The logical constant index at which to place the parameter (each constant is
+         a 4D float).
+         Note that since you're passing a Vector2, the last 2 elements of the 4-element
+         value will be set to 1 (a homogeneous vector)
+         @param vec The value to set
+         */
+		void setConstant(size_t index, const Vector2& vec);
+		/** Sets a Matrix4 parameter to the program.
+		@param index The logical constant index at which to place the parameter (each constant is
+		a 4D float).
+		NB since a Matrix4 is 16 floats long, this parameter will take up 4 indexes.
+		@param m The value to set
+		*/
+		void setConstant(size_t index, const Matrix4& m);
+		/** Sets a list of Matrix4 parameters to the program.
+		@param index The logical constant index at which to start placing the parameter (each constant is
+		a 4D float).
+		NB since a Matrix4 is 16 floats long, so each entry will take up 4 indexes.
+		@param m Pointer to an array of matrices to set
+		@param numEntries Number of Matrix4 entries
+		*/
+		void setConstant(size_t index, const Matrix4* m, size_t numEntries);
+		/** Sets a multiple value constant floating-point parameter to the program.
+		@param index The logical constant index at which to start placing parameters (each constant is
+		a 4D float)
+		@param val Pointer to the values to write, must contain 4*count floats
+		@param count The number of groups of 4 floats to write
+		*/
+		void setConstant(size_t index, const float *val, size_t count);
+		/** Sets a multiple value constant floating-point parameter to the program.
+		@param index The logical constant index at which to start placing parameters (each constant is
+		a 4D float)
+		@param val Pointer to the values to write, must contain 4*count floats
+		@param count The number of groups of 4 floats to write
+		*/
+		void setConstant(size_t index, const double *val, size_t count);
+		/** Sets a ColourValue parameter to the program.
+		@param index The logical constant index at which to place the parameter (each constant is
+		a 4D float)
+		@param colour The value to set
+		*/
+		void setConstant(size_t index, const ColourValue& colour);
+
+		/** Sets a multiple value constant integer parameter to the program.
+		@remarks
+		Different types of GPU programs support different types of constant parameters.
+		For example, it's relatively common to find that vertex programs only support
+		floating point constants, and that fragment programs only support integer (fixed point)
+		parameters. This can vary depending on the program version supported by the
+		graphics card being used. You should consult the documentation for the type of
+		low level program you are using, or alternatively use the methods
+		provided on RenderSystemCapabilities to determine the options.
+		@param index The logical constant index at which to place the parameter (each constant is
+		a 4D integer)
+		@param val Pointer to the values to write, must contain 4*count ints
+		@param count The number of groups of 4 ints to write
+		*/
+		void setConstant(size_t index, const int *val, size_t count);
+
+		/** Write a series of floating point values into the underlying float 
+		constant buffer at the given physical index.
+		@param physicalIndex The buffer position to start writing
+		@param val Pointer to a list of values to write
+		@param count The number of floats to write
+		*/
+		void _writeRawConstants(size_t physicalIndex, const float* val, size_t count);
+		/** Write a series of floating point values into the underlying float 
+		constant buffer at the given physical index.
+		@param physicalIndex The buffer position to start writing
+		@param val Pointer to a list of values to write
+		@param count The number of floats to write
+		*/
+		void _writeRawConstants(size_t physicalIndex, const double* val, size_t count);
+		/** Write a series of integer values into the underlying integer
+		constant buffer at the given physical index.
+		@param physicalIndex The buffer position to start writing
+		@param val Pointer to a list of values to write
+		@param count The number of ints to write
+		*/
+		void _writeRawConstants(size_t physicalIndex, const int* val, size_t count);
+		/** Read a series of floating point values from the underlying float 
+		constant buffer at the given physical index.
+		@param physicalIndex The buffer position to start reading
+		@param count The number of floats to read
+		@param dest Pointer to a buffer to receive the values
+		*/
+		void _readRawConstants(size_t physicalIndex, size_t count, float* dest);
+		/** Read a series of integer values from the underlying integer 
+		constant buffer at the given physical index.
+		@param physicalIndex The buffer position to start reading
+		@param count The number of ints to read
+		@param dest Pointer to a buffer to receive the values
+		*/
+		void _readRawConstants(size_t physicalIndex, size_t count, int* dest);
+
+		/** Write a 4-element floating-point parameter to the program directly to 
+		the underlying constants buffer.
+		@note You can use these methods if you have already derived the physical
+		constant buffer location, for a slight speed improvement over using
+		the named / logical index versions.
+		@param physicalIndex The physical buffer index at which to place the parameter 
+		@param vec The value to set
+		@param count The number of floats to write; if for example
+		the uniform constant 'slot' is smaller than a Vector4
+		*/
+		void _writeRawConstant(size_t physicalIndex, const Vector4& vec, 
+			size_t count = 4);
+		/** Write a single floating-point parameter to the program.
+		@note You can use these methods if you have already derived the physical
+		constant buffer location, for a slight speed improvement over using
+		the named / logical index versions.
+		@param physicalIndex The physical buffer index at which to place the parameter 
+		@param val The value to set
+		*/
+		void _writeRawConstant(size_t physicalIndex, Real val);
+		/** Write a variable number of floating-point parameters to the program.
+         @note You can use these methods if you have already derived the physical
+         constant buffer location, for a slight speed improvement over using
+         the named / logical index versions.
+         @param physicalIndex The physical buffer index at which to place the parameter
+         @param val The value to set
+         */
+		void _writeRawConstant(size_t physicalIndex, Real val, size_t count);
+		/** Write a single integer parameter to the program.
+		@note You can use these methods if you have already derived the physical
+		constant buffer location, for a slight speed improvement over using
+		the named / logical index versions.
+		@param physicalIndex The physical buffer index at which to place the parameter 
+		@param val The value to set
+		*/
+		void _writeRawConstant(size_t physicalIndex, int val);
+		/** Write a 3-element floating-point parameter to the program via Vector3.
+		@note You can use these methods if you have already derived the physical
+		constant buffer location, for a slight speed improvement over using
+		the named / logical index versions.
+		@param physicalIndex The physical buffer index at which to place the parameter 
+		@param vec The value to set
+		*/
+		void _writeRawConstant(size_t physicalIndex, const Vector3& vec);
+		/** Write a 2-element floating-point parameter to the program via Vector2.
+         @note You can use these methods if you have already derived the physical
+         constant buffer location, for a slight speed improvement over using
+         the named / logical index versions.
+         @param physicalIndex The physical buffer index at which to place the parameter
+         @param vec The value to set
+         */
+		void _writeRawConstant(size_t physicalIndex, const Vector2& vec);
+		/** Write a Matrix4 parameter to the program.
+		@note You can use these methods if you have already derived the physical
+		constant buffer location, for a slight speed improvement over using
+		the named / logical index versions.
+		@param physicalIndex The physical buffer index at which to place the parameter 
+		@param m The value to set
+		@param elementCount actual element count used with shader
+		*/
+		void _writeRawConstant(size_t physicalIndex, const Matrix4& m, size_t elementCount);
+		/** Write a list of Matrix4 parameters to the program.
+		@note You can use these methods if you have already derived the physical
+		constant buffer location, for a slight speed improvement over using
+		the named / logical index versions.
+		@param physicalIndex The physical buffer index at which to place the parameter 
+		@param numEntries Number of Matrix4 entries
+		*/
+		void _writeRawConstant(size_t physicalIndex, const Matrix4* m, size_t numEntries);
+		/** Write a ColourValue parameter to the program.
+		@note You can use these methods if you have already derived the physical
+		constant buffer location, for a slight speed improvement over using
+		the named / logical index versions.
+		@param physicalIndex The physical buffer index at which to place the parameter 
+		@param colour The value to set
+		@param count The number of floats to write; if for example
+		the uniform constant 'slot' is smaller than a Vector4
+		*/
+		void _writeRawConstant(size_t physicalIndex, const ColourValue& colour, 
+			size_t count = 4);
+
+
+		/** Gets an iterator over the named GpuConstantDefinition instances as defined
+		by the program for which these parameters exist.
+		@note
+		Only available if this parameters object has named parameters.
+		*/
+		GpuConstantDefinitionIterator getConstantDefinitionIterator(void) const;
+
+		/** Get a specific GpuConstantDefinition for a named parameter.
+		@note
+		Only available if this parameters object has named parameters.
+		*/
+		const GpuConstantDefinition& getConstantDefinition(const String& name) const;
+
+		/** Get the full list of GpuConstantDefinition instances.
+		@note
+		Only available if this parameters object has named parameters.
+		*/
+		const GpuNamedConstants& getConstantDefinitions() const;
+
+		/** Get the current list of mappings from low-level logical param indexes
+		to physical buffer locations in the float buffer.
+		@note
+		Only applicable to low-level programs.
+		*/
+		const GpuLogicalBufferStructPtr& getFloatLogicalBufferStruct() const { return mFloatLogicalToPhysical; }
+
+		/** Retrieves the logical index relating to a physical index in the float
+		buffer, for programs which support that (low-level programs and 
+		high-level programs which use logical parameter indexes).
+		@return std::numeric_limits<size_t>::max() if not found
+		*/
+		size_t getFloatLogicalIndexForPhysicalIndex(size_t physicalIndex);
+		/** Retrieves the logical index relating to a physical index in the int
+		buffer, for programs which support that (low-level programs and 
+		high-level programs which use logical parameter indexes).
+		@return std::numeric_limits<size_t>::max() if not found
+		*/
+		/** Get the current list of mappings from low-level logical param indexes
+         to physical buffer locations in the double buffer.
+         @note
+         Only applicable to low-level programs.
+         */
+		const GpuLogicalBufferStructPtr& getDoubleLogicalBufferStruct() const { return mDoubleLogicalToPhysical; }
+
+		/** Retrieves the logical index relating to a physical index in the double
+         buffer, for programs which support that (low-level programs and
+         high-level programs which use logical parameter indexes).
+         @return std::numeric_limits<size_t>::max() if not found
+         */
+		size_t getDoubleLogicalIndexForPhysicalIndex(size_t physicalIndex);
+		/** Retrieves the logical index relating to a physical index in the int
+         buffer, for programs which support that (low-level programs and
+         high-level programs which use logical parameter indexes).
+         @return std::numeric_limits<size_t>::max() if not found
+         */
+		size_t getIntLogicalIndexForPhysicalIndex(size_t physicalIndex);
+
+		/** Get the current list of mappings from low-level logical param indexes
+		to physical buffer locations in the integer buffer.
+		@note
+		Only applicable to low-level programs.
+		*/
+		const GpuLogicalBufferStructPtr& getIntLogicalBufferStruct() const { return mIntLogicalToPhysical; }
+		/// Get a reference to the list of float constants
+		const FloatConstantList& getFloatConstantList() const { return mFloatConstants; }
+		/// Get a pointer to the 'nth' item in the float buffer
+		float* getFloatPointer(size_t pos) { return &mFloatConstants[pos]; }
+		/// Get a pointer to the 'nth' item in the float buffer
+		const float* getFloatPointer(size_t pos) const { return &mFloatConstants[pos]; }
+		/// Get a reference to the list of double constants
+		const DoubleConstantList& getDoubleConstantList() const { return mDoubleConstants; }
+		/// Get a pointer to the 'nth' item in the double buffer
+		double* getDoublePointer(size_t pos) { return &mDoubleConstants[pos]; }
+		/// Get a pointer to the 'nth' item in the double buffer
+		const double* getDoublePointer(size_t pos) const { return &mDoubleConstants[pos]; }
+		/// Get a reference to the list of int constants
+		const IntConstantList& getIntConstantList() const { return mIntConstants; }
+		/// Get a pointer to the 'nth' item in the int buffer
+		int* getIntPointer(size_t pos) { return &mIntConstants[pos]; }
+		/// Get a pointer to the 'nth' item in the int buffer
+		const int* getIntPointer(size_t pos) const { return &mIntConstants[pos]; }
+		/// Get a reference to the list of auto constant bindings
+		const AutoConstantList& getAutoConstantList() const { return mAutoConstants; }
+
+		/** Sets up a constant which will automatically be updated by the system.
+		@remarks
+		Vertex and fragment programs often need parameters which are to do with the
+		current render state, or particular values which may very well change over time,
+		and often between objects which are being rendered. This feature allows you 
+		to set up a certain number of predefined parameter mappings that are kept up to 
+		date for you.
+		@param index The location in the constant list to place this updated constant every time
+		it is changed. Note that because of the nature of the types, we know how big the 
+		parameter details will be so you don't need to set that like you do for manual constants.
+		@param acType The type of automatic constant to set
+		@param extraInfo If the constant type needs more information (like a light index) put it here.
+		*/
+		void setAutoConstant(size_t index, AutoConstantType acType, size_t extraInfo = 0);
+		void setAutoConstantReal(size_t index, AutoConstantType acType, Real rData);
+
+		/** Sets up a constant which will automatically be updated by the system.
+		@remarks
+		Vertex and fragment programs often need parameters which are to do with the
+		current render state, or particular values which may very well change over time,
+		and often between objects which are being rendered. This feature allows you 
+		to set up a certain number of predefined parameter mappings that are kept up to 
+		date for you.
+		@param index The location in the constant list to place this updated constant every time
+		it is changed. Note that because of the nature of the types, we know how big the 
+		parameter details will be so you don't need to set that like you do for manual constants.
+		@param acType The type of automatic constant to set
+		@param extraInfo1 The first extra parameter required by the auto constant type
+		@param extraInfo2 The first extra parameter required by the auto constant type
+		*/
+		void setAutoConstant(size_t index, AutoConstantType acType, uint16 extraInfo1, uint16 extraInfo2);
+
+		/** As setAutoConstant, but sets up the auto constant directly against a
+		physical buffer index.
+		*/
+		void _setRawAutoConstant(size_t physicalIndex, AutoConstantType acType, size_t extraInfo, 
+			uint16 variability, size_t elementSize = 4);
+		/** As setAutoConstantReal, but sets up the auto constant directly against a
+		physical buffer index.
+		*/
+		void _setRawAutoConstantReal(size_t physicalIndex, AutoConstantType acType, Real rData, 
+			uint16 variability, size_t elementSize = 4);
+
+
+		/** Unbind an auto constant so that the constant is manually controlled again. */
+		void clearAutoConstant(size_t index);
+
+		/** Sets a named parameter up to track a derivation of the current time.
+		@param index The index of the parameter
+		@param factor The amount by which to scale the time value
+		*/  
+		void setConstantFromTime(size_t index, Real factor);
+
+		/** Clears all the existing automatic constants. */
+		void clearAutoConstants(void);
+		typedef ConstVectorIterator<AutoConstantList> AutoConstantIterator;
+		/** Gets an iterator over the automatic constant bindings currently in place. */
+		AutoConstantIterator getAutoConstantIterator(void) const;
+		/// Gets the number of int constants that have been set
+		size_t getAutoConstantCount(void) const { return mAutoConstants.size(); }
+		/** Gets a specific Auto Constant entry if index is in valid range
+		otherwise returns a NULL
+		@param index which entry is to be retrieved
+		*/
+		AutoConstantEntry* getAutoConstantEntry(const size_t index);
+		/** Returns true if this instance has any automatic constants. */
+		bool hasAutoConstants(void) const { return !(mAutoConstants.empty()); }
+		/** Finds an auto constant that's affecting a given logical parameter 
+		index for floating-point values.
+		@note Only applicable for low-level programs.
+		*/
+		const AutoConstantEntry* findFloatAutoConstantEntry(size_t logicalIndex);
+		/** Finds an auto constant that's affecting a given logical parameter
+         index for double-point values.
+         @note Only applicable for low-level programs.
+         */
+		const AutoConstantEntry* findDoubleAutoConstantEntry(size_t logicalIndex);
+		/** Finds an auto constant that's affecting a given logical parameter
+		index for integer values.
+		@note Only applicable for low-level programs.
+		*/
+		const AutoConstantEntry* findIntAutoConstantEntry(size_t logicalIndex);
+		/** Finds an auto constant that's affecting a given named parameter index.
+		@note Only applicable to high-level programs.
+		*/
+		const AutoConstantEntry* findAutoConstantEntry(const String& paramName);
+		/** Finds an auto constant that's affecting a given physical position in 
+		the floating-point buffer
+		*/
+		const AutoConstantEntry* _findRawAutoConstantEntryFloat(size_t physicalIndex);
+		/** Finds an auto constant that's affecting a given physical position in
+         the double-point buffer
+         */
+		const AutoConstantEntry* _findRawAutoConstantEntryDouble(size_t physicalIndex);
+		/** Finds an auto constant that's affecting a given physical position in
+		the integer buffer
+		*/
+		const AutoConstantEntry* _findRawAutoConstantEntryInt(size_t physicalIndex);
+
+		/** Update automatic parameters.
+		@param source The source of the parameters
+		@param variabilityMask A mask of GpuParamVariability which identifies which autos will need updating
+		*/
+		void _updateAutoParams(const AutoParamDataSource* source, uint16 variabilityMask);
+
+		/** Tells the program whether to ignore missing parameters or not.
+		*/
+		void setIgnoreMissingParams(bool state) { mIgnoreMissingParams = state; }
+
+		/** Sets a single value constant floating-point parameter to the program.
+		@remarks
+		Different types of GPU programs support different types of constant parameters.
+		For example, it's relatively common to find that vertex programs only support
+		floating point constants, and that fragment programs only support integer (fixed point)
+		parameters. This can vary depending on the program version supported by the
+		graphics card being used. You should consult the documentation for the type of
+		low level program you are using, or alternatively use the methods
+		provided on RenderSystemCapabilities to determine the options.
+		@par
+		Another possible limitation is that some systems only allow constants to be set
+		on certain boundaries, e.g. in sets of 4 values for example. Again, see
+		RenderSystemCapabilities for full details.
+		@note
+		This named option will only work if you are using a parameters object created
+		from a high-level program (HighLevelGpuProgram).
+		@param name The name of the parameter
+		@param val The value to set
+		*/
+		void setNamedConstant(const String& name, Real val);
+		/** Sets a single value constant integer parameter to the program.
+		@remarks
+		Different types of GPU programs support different types of constant parameters.
+		For example, it's relatively common to find that vertex programs only support
+		floating point constants, and that fragment programs only support integer (fixed point)
+		parameters. This can vary depending on the program version supported by the
+		graphics card being used. You should consult the documentation for the type of
+		low level program you are using, or alternatively use the methods
+		provided on RenderSystemCapabilities to determine the options.
+		@par
+		Another possible limitation is that some systems only allow constants to be set
+		on certain boundaries, e.g. in sets of 4 values for example. Again, see
+		RenderSystemCapabilities for full details.
+		@note
+		This named option will only work if you are using a parameters object created
+		from a high-level program (HighLevelGpuProgram).
+		@param name The name of the parameter
+		@param val The value to set
+		*/
+		void setNamedConstant(const String& name, int val);
+		/** Sets a Vector4 parameter to the program.
+		@param name The name of the parameter
+		@param vec The value to set
+		*/
+		void setNamedConstant(const String& name, const Vector4& vec);
+		/** Sets a Vector3 parameter to the program.
+		@note
+		This named option will only work if you are using a parameters object created
+		from a high-level program (HighLevelGpuProgram).
+        @param name The name of the parameter
+		@param vec The value to set
+		*/
+		void setNamedConstant(const String& name, const Vector3& vec);
+		/** Sets a Vector2 parameter to the program.
+         @param name The name of the parameter
+         @param vec The value to set
+         */
+		void setNamedConstant(const String& name, const Vector2& vec);
+		/** Sets a Matrix4 parameter to the program.
+		@param name The name of the parameter
+		@param m The value to set
+		*/
+		void setNamedConstant(const String& name, const Matrix4& m);
+		/** Sets a list of Matrix4 parameters to the program.
+		@param name The name of the parameter; this must be the first index of an array,
+		for examples 'matrices[0]'
+		NB since a Matrix4 is 16 floats long, so each entry will take up 4 indexes.
+		@param m Pointer to an array of matrices to set
+		@param numEntries Number of Matrix4 entries
+		*/
+		void setNamedConstant(const String& name, const Matrix4* m, size_t numEntries);
+		/** Sets a multiple value constant floating-point parameter to the program.
+		@par
+		Some systems only allow constants to be set on certain boundaries, 
+		e.g. in sets of 4 values for example. The 'multiple' parameter allows
+		you to control that although you should only change it if you know
+		your chosen language supports that (at the time of writing, only
+		GLSL allows constants which are not a multiple of 4).
+		@note
+		This named option will only work if you are using a parameters object created
+		from a high-level program (HighLevelGpuProgram).
+		@param name The name of the parameter
+		@param val Pointer to the values to write
+		@param count The number of 'multiples' of floats to write
+		@param multiple The number of raw entries in each element to write, 
+		the default is 4 so count = 1 would write 4 floats.
+		*/
+		void setNamedConstant(const String& name, const float *val, size_t count, 
+			size_t multiple = 4);
+		/** Sets a multiple value constant floating-point parameter to the program.
+		@par
+		Some systems only allow constants to be set on certain boundaries, 
+		e.g. in sets of 4 values for example. The 'multiple' parameter allows
+		you to control that although you should only change it if you know
+		your chosen language supports that (at the time of writing, only
+		GLSL allows constants which are not a multiple of 4).
+		@note
+		This named option will only work if you are using a parameters object created
+		from a high-level program (HighLevelGpuProgram).
+		@param name The name of the parameter
+		@param val Pointer to the values to write
+		@param count The number of 'multiples' of floats to write
+		@param multiple The number of raw entries in each element to write, 
+		the default is 4 so count = 1 would write 4 floats.
+		*/
+		void setNamedConstant(const String& name, const double *val, size_t count, 
+			size_t multiple = 4);
+		/** Sets a ColourValue parameter to the program.
+		@param name The name of the parameter
+		@param colour The value to set
+		*/
+		void setNamedConstant(const String& name, const ColourValue& colour);
+
+		/** Sets a multiple value constant floating-point parameter to the program.
+		@par
+		Some systems only allow constants to be set on certain boundaries, 
+		e.g. in sets of 4 values for example. The 'multiple' parameter allows
+		you to control that although you should only change it if you know
+		your chosen language supports that (at the time of writing, only
+		GLSL allows constants which are not a multiple of 4).
+		@note
+		This named option will only work if you are using a parameters object created
+		from a high-level program (HighLevelGpuProgram).
+		@param name The name of the parameter
+		@param val Pointer to the values to write
+		@param count The number of 'multiples' of floats to write
+		@param multiple The number of raw entries in each element to write, 
+		the default is 4 so count = 1 would write 4 floats.
+		*/
+		void setNamedConstant(const String& name, const int *val, size_t count, 
+			size_t multiple = 4);
+
+		/** Sets up a constant which will automatically be updated by the system.
+		@remarks
+		Vertex and fragment programs often need parameters which are to do with the
+		current render state, or particular values which may very well change over time,
+		and often between objects which are being rendered. This feature allows you 
+		to set up a certain number of predefined parameter mappings that are kept up to 
+		date for you.
+		@note
+		This named option will only work if you are using a parameters object created
+		from a high-level program (HighLevelGpuProgram).
+		@param name The name of the parameter
+		@param acType The type of automatic constant to set
+		@param extraInfo If the constant type needs more information (like a light index) put it here.
+		*/
+		void setNamedAutoConstant(const String& name, AutoConstantType acType, size_t extraInfo = 0);
+		void setNamedAutoConstantReal(const String& name, AutoConstantType acType, Real rData);
+
+		/** Sets up a constant which will automatically be updated by the system.
+		@remarks
+		Vertex and fragment programs often need parameters which are to do with the
+		current render state, or particular values which may very well change over time,
+		and often between objects which are being rendered. This feature allows you 
+		to set up a certain number of predefined parameter mappings that are kept up to 
+		date for you.
+		@note
+		This named option will only work if you are using a parameters object created
+		from a high-level program (HighLevelGpuProgram).
+		@param name The name of the parameter
+		@param acType The type of automatic constant to set
+		@param extraInfo1 The first extra info required by this auto constant type
+		@param extraInfo2 The first extra info required by this auto constant type
+		*/
+		void setNamedAutoConstant(const String& name, AutoConstantType acType, uint16 extraInfo1, uint16 extraInfo2);
+
+		/** Sets a named parameter up to track a derivation of the current time.
+		@note
+		This named option will only work if you are using a parameters object created
+		from a high-level program (HighLevelGpuProgram).
+		@param name The name of the parameter
+		@param factor The amount by which to scale the time value
+		*/  
+		void setNamedConstantFromTime(const String& name, Real factor);
+
+		/** Unbind an auto constant so that the constant is manually controlled again. */
+		void clearNamedAutoConstant(const String& name);
+
+		/** Find a constant definition for a named parameter.
+		@remarks
+		This method returns null if the named parameter did not exist, unlike
+		getConstantDefinition which is more strict; unless you set the 
+		last parameter to true.
+		@param name The name to look up
+		@param throwExceptionIfMissing If set to true, failure to find an entry
+		will throw an exception.
+		*/
+		const GpuConstantDefinition* _findNamedConstantDefinition(
+			const String& name, bool throwExceptionIfMissing = false) const;
+		/** Gets the physical buffer index associated with a logical float constant index. 
+		@note Only applicable to low-level programs.
+		@param logicalIndex The logical parameter index
+		@param requestedSize The requested size - pass 0 to ignore missing entries
+		and return std::numeric_limits<size_t>::max() 
+		*/
+		size_t _getFloatConstantPhysicalIndex(size_t logicalIndex, size_t requestedSize, uint16 variability);
+		/** Gets the physical buffer index associated with a logical double constant index.
+         @note Only applicable to low-level programs.
+         @param logicalIndex The logical parameter index
+         @param requestedSize The requested size - pass 0 to ignore missing entries
+         and return std::numeric_limits<size_t>::max()
+         */
+		size_t _getDoubleConstantPhysicalIndex(size_t logicalIndex, size_t requestedSize, uint16 variability);
+		/** Gets the physical buffer index associated with a logical int constant index.
+		@note Only applicable to low-level programs.
+		@param logicalIndex The logical parameter index
+		@param requestedSize The requested size - pass 0 to ignore missing entries
+		and return std::numeric_limits<size_t>::max() 
+		*/
+		size_t _getIntConstantPhysicalIndex(size_t logicalIndex, size_t requestedSize, uint16 variability);
+
+		/** Sets whether or not we need to transpose the matrices passed in from the rest of OGRE.
+		@remarks
+		D3D uses transposed matrices compared to GL and OGRE; this is not important when you
+		use programs which are written to process row-major matrices, such as those generated
+		by Cg, but if you use a program written to D3D's matrix layout you will need to enable
+		this flag.
+		*/
+		void setTransposeMatrices(bool val) { mTransposeMatrices = val; } 
+		/// Gets whether or not matrices are to be transposed when set
+		bool getTransposeMatrices(void) const { return mTransposeMatrices; } 
+
+		/** Copies the values of all constants (including auto constants) from another
+		GpuProgramParameters object.
+		@note This copes the internal storage of the paarameters object and therefore
+		can only be used for parameters objects created from the same GpuProgram.
+		To merge parameters that match from different programs, use copyMatchingNamedConstantsFrom.
+		*/
+		void copyConstantsFrom(const GpuProgramParameters& source);
+
+		/** Copies the values of all matching named constants (including auto constants) from 
+		another GpuProgramParameters object. 
+		@remarks
+		This method iterates over the named constants in another parameters object
+		and copies across the values where they match. This method is safe to
+		use when the 2 parameters objects came from different programs, but only
+		works for named parameters.
+		*/
+		void copyMatchingNamedConstantsFrom(const GpuProgramParameters& source);
+
+		/** gets the auto constant definition associated with name if found else returns NULL
+		@param name The name of the auto constant
+		*/
+		static const AutoConstantDefinition* getAutoConstantDefinition(const String& name);
+		/** gets the auto constant definition using an index into the auto constant definition array.
+		If the index is out of bounds then NULL is returned;
+		@param idx The auto constant index
+		*/
+		static const AutoConstantDefinition* getAutoConstantDefinition(const size_t idx);
+		/** Returns the number of auto constant definitions
+		*/
+		static size_t getNumAutoConstantDefinitions(void);
+
+
+		/** increments the multipass number entry by 1 if it exists
+		*/
+		void incPassIterationNumber(void);
+		/** Does this parameters object have a pass iteration number constant? */
+		bool hasPassIterationNumber() const 
+		{ return mActivePassIterationIndex != (std::numeric_limits<size_t>::max)(); }
+		/** Get the physical buffer index of the pass iteration number constant */
+		size_t getPassIterationNumberIndex() const 
+		{ return mActivePassIterationIndex; }
+
+
+		/** Use a set of shared parameters in this parameters object.
+		@remarks
+			Allows you to use a set of shared parameters to automatically update 
+			this parameter set.
+		*/
+		void addSharedParameters(GpuSharedParametersPtr sharedParams);
+
+		/** Use a set of shared parameters in this parameters object.
+		@remarks
+			Allows you to use a set of shared parameters to automatically update 
+			this parameter set.
+		@param sharedParamsName The name of a shared parameter set as defined in
+			GpuProgramManager
+		*/
+		void addSharedParameters(const String& sharedParamsName);
+
+		/** Returns whether this parameter set is using the named shared parameter set. */
+		bool isUsingSharedParameters(const String& sharedParamsName) const;
+
+		/** Stop using the named shared parameter set. */
+		void removeSharedParameters(const String& sharedParamsName);
+
+		/** Stop using all shared parameter sets. */
+		void removeAllSharedParameters();
+
+		/** Get the list of shared parameter sets. */
+		const GpuSharedParamUsageList& getSharedParameters() const;
+
+		/** Internal method that the RenderSystem might use to store optional data. */
+		void _setRenderSystemData(const Any& data) const { mRenderSystemData = data; }
+		/** Internal method that the RenderSystem might use to store optional data. */
+		const Any& _getRenderSystemData() const { return mRenderSystemData; }
+
+		/** Update the parameters by copying the data from the shared
+		parameters.
+		@note This method  may not actually be called if the RenderSystem
+		supports using shared parameters directly in their own shared buffer; in
+		which case the values should not be copied out of the shared area
+		into the individual parameter set, but bound separately.
+		*/
+		void _copySharedParams();
+
+		size_t calculateSize(void) const;
+
+		/** Set subroutine name by slot name
+		 */
+		void setNamedSubroutine(const String& subroutineSlot, const String& subroutine);
+		
+		/** Set subroutine name by slot index
+		 */
+		void setSubroutine(size_t index, const String& subroutine);
+
+		/** Get map with 
+		 */
+		const SubroutineMap& getSubroutineMap() const { return mSubroutineMap; }
+	};
+
+	/// Shared pointer used to hold references to GpuProgramParameters instances
+	typedef SharedPtr<GpuProgramParameters> GpuProgramParametersSharedPtr;
+
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreGpuProgramUsage.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreGpuProgramUsage.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreGpuProgramUsage.h	(revision 148)
@@ -0,0 +1,154 @@
+/*
+-----------------------------------------------------------------------------
+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 __GpuProgramUsage_H__
+#define __GpuProgramUsage_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreGpuProgram.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre 
+{
+	class Pass;
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Materials
+	*  @{
+	*/
+	/** This class makes the usage of a vertex and fragment programs (low-level or high-level), 
+        with a given set of parameters, explicit.
+    @remarks
+        Using a vertex or fragment program can get fairly complex; besides the fairly rudimentary
+        process of binding a program to the GPU for rendering, managing usage has few
+        complications, such as:
+        <ul>
+        <li>Programs can be high level (e.g. Cg, RenderMonkey) or low level (assembler). Using
+        either should be relatively seamless, although high-level programs give you the advantage
+        of being able to use named parameters, instead of just indexed registers</li>
+        <li>Programs and parameters can be shared between multiple usages, in order to save
+        memory</li>
+        <li>When you define a user of a program, such as a material, you often want to be able to
+        set up the definition but not load / compile / assemble the program at that stage, because
+        it is not needed just yet. The program should be loaded when it is first needed, or
+        earlier if specifically requested. The program may not be defined at this time, you
+        may want to have scripts that can set up the definitions independent of the order in which
+        those scripts are loaded.</li>
+        </ul>
+        This class packages up those details so you don't have to worry about them. For example,
+        this class lets you define a high-level program and set up the parameters for it, without
+        having loaded the program (which you normally could not do). When the program is loaded and
+        compiled, this class will then validate the parameters you supplied earlier and turn them
+        into runtime parameters.
+    @par
+        Just incase it wasn't clear from the above, this class provides linkage to both 
+        GpuProgram and HighLevelGpuProgram, despite its name.
+    */
+	class _OgreExport GpuProgramUsage : public Resource::Listener, public PassAlloc
+    {
+    protected:
+        GpuProgramType mType;
+		Pass* mParent;
+        /// The program link
+        GpuProgramPtr mProgram;
+
+        /// Program parameters
+        GpuProgramParametersSharedPtr mParameters;
+		
+		/// Whether to recreate parameters next load
+		bool mRecreateParams;
+
+		void recreateParameters();
+
+    public:
+        /** Default constructor.
+        @param gptype The type of program to link to
+        */
+        GpuProgramUsage(GpuProgramType gptype, Pass* parent);
+
+		/** Copy constructor */
+		GpuProgramUsage(const GpuProgramUsage& rhs, Pass* newparent);
+
+		~GpuProgramUsage();
+
+        /** Gets the type of program we're trying to link to. */
+        GpuProgramType getType(void) const { return mType; }
+
+		/** Sets the name of the program to use. 
+        @param name The name of the program to use
+        @param resetParams
+            If true, this will create a fresh set of parameters from the
+            new program being linked, so if you had previously set parameters
+            you will have to set them again. If you set this to false, you must
+            be absolutely sure that the parameters match perfectly, and in the
+            case of named parameters refers to the indexes underlying them, 
+            not just the names.
+        */
+		void setProgramName(const String& name, bool resetParams = true);
+		/** Sets the program to use.
+        @remarks
+            Note that this will create a fresh set of parameters from the
+            new program being linked, so if you had previously set parameters
+            you will have to set them again.
+        */
+        void setProgram(GpuProgramPtr& prog);
+		/** Gets the program being used. */
+        const GpuProgramPtr& getProgram() const { return mProgram; }
+		/** Gets the program being used. */
+        const String& getProgramName(void) const { return mProgram->getName(); }
+
+        /** Sets the program parameters that should be used; because parameters can be
+            shared between multiple usages for efficiency, this method is here for you
+            to register externally created parameter objects. Otherwise, the parameters
+            will be created for you when a program is linked.
+        */
+        void setParameters(GpuProgramParametersSharedPtr params);
+        /** Gets the parameters being used here. 
+        */
+        GpuProgramParametersSharedPtr getParameters(void);
+
+        /// Load this usage (and ensure program is loaded)
+        void _load(void);
+        /// Unload this usage 
+        void _unload(void);
+
+        size_t calculateSize(void) const;
+
+		// Resource Listener
+		void unloadingComplete(Resource* prog);
+		void loadingComplete(Resource* prog);
+
+    };
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreHardwareBuffer.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreHardwareBuffer.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreHardwareBuffer.h	(revision 148)
@@ -0,0 +1,380 @@
+/*
+-----------------------------------------------------------------------------
+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 __HardwareBuffer__
+#define __HardwareBuffer__
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+#include "OgreException.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup RenderSystem
+	*  @{
+	*/
+	/** Abstract class defining common features of hardware buffers.
+    @remarks
+ 	    A 'hardware buffer' is any area of memory held outside of core system ram,
+	    and in our case refers mostly to video ram, although in theory this class
+	    could be used with other memory areas such as sound card memory, custom
+	    coprocessor memory etc.
+    @par
+ 	    This reflects the fact that memory held outside of main system RAM must 
+	    be interacted with in a more formal fashion in order to promote
+	    cooperative and optimal usage of the buffers between the various 
+	    processing units which manipulate them.
+    @par
+ 	    This abstract class defines the core interface which is common to all
+	    buffers, whether it be vertex buffers, index buffers, texture memory
+	    or framebuffer memory etc.
+	@par
+		Buffers have the ability to be 'shadowed' in system memory, this is because
+		the kinds of access allowed on hardware buffers is not always as flexible as
+		that allowed for areas of system memory - for example it is often either 
+		impossible, or extremely undesirable from a performance standpoint to read from
+		a hardware buffer; when writing to hardware buffers, you should also write every
+		byte and do it sequentially. In situations where this is too restrictive, 
+		it is possible to create a hardware, write-only buffer (the most efficient kind) 
+		and to back it with a system memory 'shadow' copy which can be read and updated arbitrarily.
+		Ogre handles synchronising this buffer with the real hardware buffer (which should still be
+		created with the HBU_DYNAMIC flag if you intend to update it very frequently). Whilst this
+		approach does have it's own costs, such as increased memory overhead, these costs can 
+		often be outweighed by the performance benefits of using a more hardware efficient buffer.
+		You should look for the 'useShadowBuffer' parameter on the creation methods used to create
+		the buffer of the type you require (see HardwareBufferManager) to enable this feature.
+    */
+	class _OgreExport HardwareBuffer : public BufferAlloc
+    {
+
+	    public:
+		    /// Enums describing buffer usage; not mutually exclusive
+		    enum Usage 
+		    {
+                /** Static buffer which the application rarely modifies once created. Modifying 
+                the contents of this buffer will involve a performance hit.
+                */
+                HBU_STATIC = 1,
+			    /** Indicates the application would like to modify this buffer with the CPU
+			    fairly often. 
+			    Buffers created with this flag will typically end up in AGP memory rather 
+			    than video memory.
+			    */
+			    HBU_DYNAMIC = 2,
+			    /** Indicates the application will never read the contents of the buffer back, 
+			    it will only ever write data. Locking a buffer with this flag will ALWAYS 
+			    return a pointer to new, blank memory rather than the memory associated 
+			    with the contents of the buffer; this avoids DMA stalls because you can 
+			    write to a new memory area while the previous one is being used. 
+			    */
+			    HBU_WRITE_ONLY = 4,
+                /** Indicates that the application will be refilling the contents
+                of the buffer regularly (not just updating, but generating the
+                contents from scratch), and therefore does not mind if the contents 
+                of the buffer are lost somehow and need to be recreated. This
+                allows and additional level of optimisation on the buffer.
+                This option only really makes sense when combined with 
+                HBU_DYNAMIC_WRITE_ONLY.
+                */
+                HBU_DISCARDABLE = 8,
+				/// Combination of HBU_STATIC and HBU_WRITE_ONLY
+				HBU_STATIC_WRITE_ONLY = 5, 
+				/** Combination of HBU_DYNAMIC and HBU_WRITE_ONLY. If you use 
+                this, strongly consider using HBU_DYNAMIC_WRITE_ONLY_DISCARDABLE
+                instead if you update the entire contents of the buffer very 
+                regularly. 
+                */
+				HBU_DYNAMIC_WRITE_ONLY = 6,
+                /// Combination of HBU_DYNAMIC, HBU_WRITE_ONLY and HBU_DISCARDABLE
+                HBU_DYNAMIC_WRITE_ONLY_DISCARDABLE = 14
+
+
+		    };
+		    /// Locking options
+		    enum LockOptions
+		    {
+                /** Normal mode, ie allows read/write and contents are preserved. */
+                HBL_NORMAL,
+			    /** Discards the <em>entire</em> buffer while locking; this allows optimisation to be 
+				performed because synchronisation issues are relaxed. Only allowed on buffers 
+			    created with the HBU_DYNAMIC flag. 
+			    */
+			    HBL_DISCARD,
+			    /** Lock the buffer for reading only. Not allowed in buffers which are created with HBU_WRITE_ONLY. 
+				Mandatory on static buffers, i.e. those created without the HBU_DYNAMIC flag. 
+				*/ 
+			    HBL_READ_ONLY,
+                /** As HBL_DISCARD, except the application guarantees not to overwrite any 
+                region of the buffer which has already been used in this frame, can allow
+                some optimisation on some APIs. */
+                HBL_NO_OVERWRITE,
+				/** Lock the buffer for writing only.*/
+				HBL_WRITE_ONLY
+    			
+		    };
+	    protected:
+		    size_t mSizeInBytes;
+		    Usage mUsage;
+		    bool mIsLocked;
+			size_t mLockStart;
+			size_t mLockSize;
+			bool mSystemMemory;
+            bool mUseShadowBuffer;
+            HardwareBuffer* mShadowBuffer;
+            bool mShadowUpdated;
+            bool mSuppressHardwareUpdate;
+    		
+            /// Internal implementation of lock()
+		    virtual void* lockImpl(size_t offset, size_t length, LockOptions options) = 0;
+            /// Internal implementation of unlock()
+		    virtual void unlockImpl(void) = 0;
+
+    public:
+		    /// Constructor, to be called by HardwareBufferManager only
+            HardwareBuffer(Usage usage, bool systemMemory, bool useShadowBuffer) 
+				: mUsage(usage), mIsLocked(false), mLockStart(0), mLockSize(0), mSystemMemory(systemMemory), 
+                mUseShadowBuffer(useShadowBuffer), mShadowBuffer(NULL), mShadowUpdated(false), 
+                mSuppressHardwareUpdate(false) 
+            {
+                // If use shadow buffer, upgrade to WRITE_ONLY on hardware side
+                if (useShadowBuffer && usage == HBU_DYNAMIC)
+                {
+                    mUsage = HBU_DYNAMIC_WRITE_ONLY;
+                }
+                else if (useShadowBuffer && usage == HBU_STATIC)
+                {
+                    mUsage = HBU_STATIC_WRITE_ONLY;
+                }
+            }
+            virtual ~HardwareBuffer() {}
+		    /** Lock the buffer for (potentially) reading / writing.
+		    @param offset The byte offset from the start of the buffer to lock
+		    @param length The size of the area to lock, in bytes
+		    @param options Locking options
+		    @return Pointer to the locked memory
+		    */
+		    virtual void* lock(size_t offset, size_t length, LockOptions options)
+            {
+                assert(!isLocked() && "Cannot lock this buffer, it is already locked!");
+
+				void* ret = NULL;
+				if ((length + offset) > mSizeInBytes)
+				{
+					OGRE_EXCEPT(Exception::ERR_INVALIDPARAMS,
+						"Lock request out of bounds.",
+						"HardwareBuffer::lock");
+				}
+				else if (mUseShadowBuffer)
+                {
+					if (options != HBL_READ_ONLY)
+					{
+						// we have to assume a read / write lock so we use the shadow buffer
+						// and tag for sync on unlock()
+                        mShadowUpdated = true;
+                    }
+
+                    ret = mShadowBuffer->lock(offset, length, options);
+                }
+                else
+                {
+					// Lock the real buffer if there is no shadow buffer 
+                    ret = lockImpl(offset, length, options);
+                    mIsLocked = true;
+                }
+				mLockStart = offset;
+				mLockSize = length;
+                return ret;
+            }
+
+            /** Lock the entire buffer for (potentially) reading / writing.
+		    @param options Locking options
+		    @return Pointer to the locked memory
+            */
+            void* lock(LockOptions options)
+            {
+                return this->lock(0, mSizeInBytes, options);
+            }
+		    /** Releases the lock on this buffer. 
+            @remarks 
+                Locking and unlocking a buffer can, in some rare circumstances such as 
+                switching video modes whilst the buffer is locked, corrupt the 
+                contents of a buffer. This is pretty rare, but if it occurs, 
+                this method will throw an exception, meaning you
+                must re-upload the data.
+            @par
+                Note that using the 'read' and 'write' forms of updating the buffer does not
+                suffer from this problem, so if you want to be 100% sure your
+                data will not be lost, use the 'read' and 'write' forms instead.
+            */
+		    virtual void unlock(void)
+            {
+                assert(isLocked() && "Cannot unlock this buffer, it is not locked!");
+
+				// If we used the shadow buffer this time...
+                if (mUseShadowBuffer && mShadowBuffer->isLocked())
+                {
+                    mShadowBuffer->unlock();
+                    // Potentially update the 'real' buffer from the shadow buffer
+                    _updateFromShadow();
+                }
+                else
+                {
+					// Otherwise, unlock the real one
+                    unlockImpl();
+                    mIsLocked = false;
+                }
+
+            }
+
+            /** Reads data from the buffer and places it in the memory pointed to by pDest.
+		    @param offset The byte offset from the start of the buffer to read
+		    @param length The size of the area to read, in bytes
+            @param pDest The area of memory in which to place the data, must be large enough to 
+                accommodate the data!
+            */
+            virtual void readData(size_t offset, size_t length, void* pDest) = 0;
+            /** Writes data to the buffer from an area of system memory; note that you must
+                ensure that your buffer is big enough.
+		    @param offset The byte offset from the start of the buffer to start writing
+		    @param length The size of the data to write to, in bytes
+            @param pSource The source of the data to be written
+			@param discardWholeBuffer If true, this allows the driver to discard the entire buffer when writing,
+				such that DMA stalls can be avoided; use if you can.
+            */
+            virtual void writeData(size_t offset, size_t length, const void* pSource,
+					bool discardWholeBuffer = false) = 0;
+
+			/** Copy data from another buffer into this one.
+			@remarks
+				Note that the source buffer must not be created with the
+                usage HBU_WRITE_ONLY otherwise this will fail. 
+			@param srcBuffer The buffer from which to read the copied data
+			@param srcOffset Offset in the source buffer at which to start reading
+			@param dstOffset Offset in the destination buffer to start writing
+			@param length Length of the data to copy, in bytes.
+			@param discardWholeBuffer If true, will discard the entire contents of this buffer before copying
+			*/
+			virtual void copyData(HardwareBuffer& srcBuffer, size_t srcOffset, 
+				size_t dstOffset, size_t length, bool discardWholeBuffer = false)
+			{
+				const void *srcData = srcBuffer.lock(
+					srcOffset, length, HBL_READ_ONLY);
+				this->writeData(dstOffset, length, srcData, discardWholeBuffer);
+				srcBuffer.unlock();
+			}
+
+			/** Copy all data from another buffer into this one. 
+			@remarks
+				Normally these buffers should be of identical size, but if they're
+				not, the routine will use the smallest of the two sizes.
+			*/
+			virtual void copyData(HardwareBuffer& srcBuffer)
+			{
+				size_t sz = std::min(getSizeInBytes(), srcBuffer.getSizeInBytes()); 
+				copyData(srcBuffer, 0, 0, sz, true);
+			}
+			
+			/// Updates the real buffer from the shadow buffer, if required
+            virtual void _updateFromShadow(void)
+            {
+                if (mUseShadowBuffer && mShadowUpdated && !mSuppressHardwareUpdate)
+                {
+                    // Do this manually to avoid locking problems
+                    const void *srcData = mShadowBuffer->lockImpl(
+    					mLockStart, mLockSize, HBL_READ_ONLY);
+					// Lock with discard if the whole buffer was locked, otherwise normal
+					LockOptions lockOpt;
+					if (mLockStart == 0 && mLockSize == mSizeInBytes)
+						lockOpt = HBL_DISCARD;
+					else
+						lockOpt = HBL_NORMAL;
+					
+                    void *destData = this->lockImpl(
+    					mLockStart, mLockSize, lockOpt);
+					// Copy shadow to real
+                    memcpy(destData, srcData, mLockSize);
+                    this->unlockImpl();
+                    mShadowBuffer->unlockImpl();
+                    mShadowUpdated = false;
+                }
+            }
+
+            /// Returns the size of this buffer in bytes
+            size_t getSizeInBytes(void) const { return mSizeInBytes; }
+            /// Returns the Usage flags with which this buffer was created
+            Usage getUsage(void) const { return mUsage; }
+			/// Returns whether this buffer is held in system memory
+			bool isSystemMemory(void) const { return mSystemMemory; }
+			/// Returns whether this buffer has a system memory shadow for quicker reading
+			bool hasShadowBuffer(void) const { return mUseShadowBuffer; }
+            /// Returns whether or not this buffer is currently locked.
+            bool isLocked(void) const { 
+                return mIsLocked || (mUseShadowBuffer && mShadowBuffer->isLocked()); 
+            }
+            /// Pass true to suppress hardware upload of shadow buffer changes
+            void suppressHardwareUpdate(bool suppress) {
+                mSuppressHardwareUpdate = suppress;
+                if (!suppress)
+                    _updateFromShadow();
+            }
+
+
+
+
+    		
+    };
+	/** @} */
+	/** @} */
+
+	/** Locking helper. Guaranteed unlocking even in case of exception. */
+    template <typename T> struct HardwareBufferLockGuard
+    {
+        HardwareBufferLockGuard(const T& p, HardwareBuffer::LockOptions options)
+            : pBuf(p)
+        {
+            pData = pBuf->lock(options);
+        }
+        HardwareBufferLockGuard(const T& p, size_t offset, size_t length, HardwareBuffer::LockOptions options)
+            : pBuf(p)
+        {
+            pData = pBuf->lock(offset, length, options);
+        }		
+        ~HardwareBufferLockGuard()
+        {
+            pBuf->unlock();
+        }
+        
+        const T& pBuf;
+        void* pData;
+    };
+}
+#endif
+
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreHardwareBufferManager.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreHardwareBufferManager.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreHardwareBufferManager.h	(revision 148)
@@ -0,0 +1,609 @@
+/*
+-----------------------------------------------------------------------------
+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 __HardwareBufferManager__
+#define __HardwareBufferManager__
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+
+#include "OgreSingleton.h"
+#include "OgreHardwareCounterBuffer.h"
+#include "OgreHardwareIndexBuffer.h"
+#include "OgreHardwareUniformBuffer.h"
+#include "OgreHardwareVertexBuffer.h"
+#include "OgreRenderToVertexBuffer.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+    /** \addtogroup Core
+    *  @{
+    */
+    /** \addtogroup RenderSystem
+    *  @{
+    */
+
+    /** Abstract interface representing a 'licensee' of a hardware buffer copy.
+    @remarks
+        Often it's useful to have temporary buffers which are used for working
+        but are not necessarily needed permanently. However, creating and 
+        destroying buffers is expensive, so we need a way to share these 
+        working areas, especially those based on existing fixed buffers. 
+        This class represents a licensee of one of those temporary buffers, 
+        and must be implemented by any user of a temporary buffer if they 
+        wish to be notified when the license is expired. 
+    */
+    class _OgreExport HardwareBufferLicensee
+    {
+    public:
+        virtual ~HardwareBufferLicensee() { }
+        /** This method is called when the buffer license is expired and is about
+            to be returned to the shared pool.
+        */
+        virtual void licenseExpired(HardwareBuffer* buffer) = 0;
+    };
+
+    /** Structure for recording the use of temporary blend buffers. */
+    class _OgreExport TempBlendedBufferInfo : public HardwareBufferLicensee, public BufferAlloc
+    {
+    private:
+        // Pre-blended 
+        HardwareVertexBufferSharedPtr srcPositionBuffer;
+        HardwareVertexBufferSharedPtr srcNormalBuffer;
+        // Post-blended 
+        HardwareVertexBufferSharedPtr destPositionBuffer;
+        HardwareVertexBufferSharedPtr destNormalBuffer;
+        /// Both positions and normals are contained in the same buffer.
+        bool posNormalShareBuffer;
+        unsigned short posBindIndex;
+        unsigned short normBindIndex;
+        bool bindPositions;
+        bool bindNormals;
+
+    public:
+        ~TempBlendedBufferInfo(void);
+        /// Utility method, extract info from the given VertexData.
+        void extractFrom(const VertexData* sourceData);
+        /// Utility method, checks out temporary copies of src into dest.
+        void checkoutTempCopies(bool positions = true, bool normals = true);
+        /// Utility method, binds dest copies into a given VertexData struct.
+        void bindTempCopies(VertexData* targetData, bool suppressHardwareUpload);
+        /** Overridden member from HardwareBufferLicensee. */
+        void licenseExpired(HardwareBuffer* buffer);
+        /** Detect currently have buffer copies checked out and touch it. */
+        bool buffersCheckedOut(bool positions = true, bool normals = true) const;
+    };
+
+
+    /** Base definition of a hardware buffer manager.
+    @remarks
+        This class is deliberately not a Singleton, so that multiple types can 
+        exist at once. The Singleton is wrapped via the Decorator pattern
+        in HardwareBufferManager, below. Each concrete implementation should
+        provide a subclass of HardwareBufferManagerBase, which does the actual
+        work, and also a very simple subclass of HardwareBufferManager which 
+        simply constructs the instance of the HardwareBufferManagerBase subclass 
+        and passes it to the HardwareBufferManager superclass as a delegate. 
+        This subclass must also delete the implementation instance it creates.
+    */
+    class _OgreExport HardwareBufferManagerBase : public BufferAlloc
+    {
+        friend class HardwareVertexBufferSharedPtr;
+        friend class HardwareIndexBufferSharedPtr;
+    protected:
+        /** WARNING: The following two members should place before all other members.
+            Members destruct order is very important here, because destructing other
+            members will cause notify back to this class, and then will access to this
+            two members.
+        */
+        typedef set<HardwareVertexBuffer*>::type VertexBufferList;
+        typedef set<HardwareIndexBuffer*>::type IndexBufferList;
+		typedef set<HardwareUniformBuffer*>::type UniformBufferList;
+		typedef set<HardwareCounterBuffer*>::type CounterBufferList;
+        VertexBufferList mVertexBuffers;
+        IndexBufferList mIndexBuffers;
+		UniformBufferList mUniformBuffers;
+		CounterBufferList mCounterBuffers;
+
+
+        typedef set<VertexDeclaration*>::type VertexDeclarationList;
+        typedef set<VertexBufferBinding*>::type VertexBufferBindingList;
+        VertexDeclarationList mVertexDeclarations;
+        VertexBufferBindingList mVertexBufferBindings;
+
+        // Mutexes
+        OGRE_MUTEX(mVertexBuffersMutex);
+        OGRE_MUTEX(mIndexBuffersMutex);
+        OGRE_MUTEX(mUniformBuffersMutex);
+        OGRE_MUTEX(mCounterBuffersMutex);
+        OGRE_MUTEX(mVertexDeclarationsMutex);
+        OGRE_MUTEX(mVertexBufferBindingsMutex);
+
+        /// Internal method for destroys all vertex declarations.
+        virtual void destroyAllDeclarations(void);
+        /// Internal method for destroys all vertex buffer bindings.
+        virtual void destroyAllBindings(void);
+
+        /// Internal method for creates a new vertex declaration, may be overridden by certain rendering APIs.
+        virtual VertexDeclaration* createVertexDeclarationImpl(void);
+        /// Internal method for destroys a vertex declaration, may be overridden by certain rendering APIs.
+        virtual void destroyVertexDeclarationImpl(VertexDeclaration* decl);
+
+        /// Internal method for creates a new VertexBufferBinding, may be overridden by certain rendering APIs.
+        virtual VertexBufferBinding* createVertexBufferBindingImpl(void);
+        /// Internal method for destroys a VertexBufferBinding, may be overridden by certain rendering APIs.
+        virtual void destroyVertexBufferBindingImpl(VertexBufferBinding* binding);
+
+    public:
+
+        enum BufferLicenseType
+        {
+            /// Licensee will only release buffer when it says so.
+            BLT_MANUAL_RELEASE,
+            /// Licensee can have license revoked.
+            BLT_AUTOMATIC_RELEASE
+        };
+
+    protected:
+        /** Struct holding details of a license to use a temporary shared buffer. */
+        class _OgrePrivate VertexBufferLicense
+        {
+        public:
+            HardwareVertexBuffer* originalBufferPtr;
+            BufferLicenseType licenseType;
+            size_t expiredDelay;
+            HardwareVertexBufferSharedPtr buffer;
+            HardwareBufferLicensee* licensee;
+            VertexBufferLicense(
+                HardwareVertexBuffer* orig,
+                BufferLicenseType ltype, 
+                size_t delay,
+                HardwareVertexBufferSharedPtr buf, 
+                HardwareBufferLicensee* lic) 
+                : originalBufferPtr(orig)
+                , licenseType(ltype)
+                , expiredDelay(delay)
+                , buffer(buf)
+                , licensee(lic)
+            {}
+
+        };
+
+        /// Map from original buffer to temporary buffers.
+        typedef multimap<HardwareVertexBuffer*, HardwareVertexBufferSharedPtr>::type FreeTemporaryVertexBufferMap;
+        /// Map of current available temp buffers.
+        FreeTemporaryVertexBufferMap mFreeTempVertexBufferMap;
+        /// Map from temporary buffer to details of a license.
+        typedef map<HardwareVertexBuffer*, VertexBufferLicense>::type TemporaryVertexBufferLicenseMap;
+        /// Map of currently licensed temporary buffers.
+        TemporaryVertexBufferLicenseMap mTempVertexBufferLicenses;
+        /// Number of frames elapsed since temporary buffers utilization was above half the available.
+        size_t mUnderUsedFrameCount;
+        /// Number of frames to wait before free unused temporary buffers.
+        static const size_t UNDER_USED_FRAME_THRESHOLD;
+        /// Frame delay for BLT_AUTOMATIC_RELEASE temporary buffers.
+        static const size_t EXPIRED_DELAY_FRAME_THRESHOLD;
+        // Mutexes
+        OGRE_MUTEX(mTempBuffersMutex);
+
+
+        /// Creates a new buffer as a copy of the source, does not copy data.
+        virtual HardwareVertexBufferSharedPtr makeBufferCopy(
+            const HardwareVertexBufferSharedPtr& source, 
+            HardwareBuffer::Usage usage, bool useShadowBuffer);
+
+    public:
+        HardwareBufferManagerBase();
+        virtual ~HardwareBufferManagerBase();
+        /** Create a hardware vertex buffer.
+        @remarks
+            This method creates a new vertex buffer; this will act as a source of geometry
+            data for rendering objects. Note that because the meaning of the contents of
+            the vertex buffer depends on the usage, this method does not specify a
+            vertex format; the user of this buffer can actually insert whatever data 
+            they wish, in any format. However, in order to use this with a RenderOperation,
+            the data in this vertex buffer will have to be associated with a semantic element
+            of the rendering pipeline, e.g. a position, or texture coordinates. This is done 
+            using the VertexDeclaration class, which itself contains VertexElement structures
+            referring to the source data.
+        @remarks Note that because vertex buffers can be shared, they are reference
+            counted so you do not need to worry about destroying themm this will be done
+            automatically.
+        @param vertexSize
+            The size in bytes of each vertex in this buffer; you must calculate
+            this based on the kind of data you expect to populate this buffer with.
+        @param numVerts
+            The number of vertices in this buffer.
+        @param usage
+            One or more members of the HardwareBuffer::Usage enumeration; you are
+            strongly advised to use HBU_STATIC_WRITE_ONLY wherever possible, if you need to 
+            update regularly, consider HBU_DYNAMIC_WRITE_ONLY and useShadowBuffer=true.
+        @param useShadowBuffer
+            If set to @c true, this buffer will be 'shadowed' by one stored in 
+            system memory rather than GPU or AGP memory. You should set this flag if you intend 
+            to read data back from the vertex buffer, because reading data from a buffer
+            in the GPU or AGP memory is very expensive, and is in fact impossible if you
+            specify HBU_WRITE_ONLY for the main buffer. If you use this option, all 
+            reads and writes will be done to the shadow buffer, and the shadow buffer will
+            be synchronised with the real buffer at an appropriate time.
+        */
+        virtual HardwareVertexBufferSharedPtr 
+            createVertexBuffer(size_t vertexSize, size_t numVerts, HardwareBuffer::Usage usage, 
+            bool useShadowBuffer = false) = 0;
+        /** Create a hardware index buffer.
+        @remarks Note that because buffers can be shared, they are reference
+            counted so you do not need to worry about destroying them this will be done
+            automatically.
+        @param itype
+            The type in index, either 16- or 32-bit, depending on how many vertices
+            you need to be able to address
+        @param numIndexes
+            The number of indexes in the buffer
+        @param usage
+            One or more members of the HardwareBuffer::Usage enumeration.
+        @param useShadowBuffer
+            If set to @c true, this buffer will be 'shadowed' by one stored in 
+            system memory rather than GPU or AGP memory. You should set this flag if you intend 
+            to read data back from the index buffer, because reading data from a buffer
+            in the GPU or AGP memory is very expensive, and is in fact impossible if you
+            specify HBU_WRITE_ONLY for the main buffer. If you use this option, all 
+            reads and writes will be done to the shadow buffer, and the shadow buffer will
+            be synchronised with the real buffer at an appropriate time.
+        */
+        virtual HardwareIndexBufferSharedPtr 
+            createIndexBuffer(HardwareIndexBuffer::IndexType itype, size_t numIndexes, 
+            HardwareBuffer::Usage usage, bool useShadowBuffer = false) = 0;
+
+        /** Create a render to vertex buffer.
+        @remarks The parameters (such as vertex size etc) are determined later
+            and are allocated when needed.
+        */
+        virtual RenderToVertexBufferSharedPtr createRenderToVertexBuffer() = 0;
+
+		/**
+		 * Create uniform buffer. This type of buffer allows the upload of shader constants once,
+		 * and sharing between shader stages or even shaders from another materials. 
+		 * The update shall be triggered by GpuProgramParameters, if is dirty
+		 */
+		virtual HardwareUniformBufferSharedPtr createUniformBuffer(size_t sizeBytes, 
+									HardwareBuffer::Usage usage = HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY_DISCARDABLE, 
+									bool useShadowBuffer = false, const String& name = "") = 0;
+
+        /**
+		 * Create counter buffer.
+		 * The update shall be triggered by GpuProgramParameters, if is dirty
+		 */
+		virtual HardwareCounterBufferSharedPtr createCounterBuffer(size_t sizeBytes,
+                                                                   HardwareBuffer::Usage usage = HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY_DISCARDABLE,
+                                                                   bool useShadowBuffer = false, const String& name = "") = 0;
+
+        /** Creates a new vertex declaration. */
+        virtual VertexDeclaration* createVertexDeclaration(void);
+        /** Destroys a vertex declaration. */
+        virtual void destroyVertexDeclaration(VertexDeclaration* decl);
+
+        /** Creates a new VertexBufferBinding. */
+        virtual VertexBufferBinding* createVertexBufferBinding(void);
+        /** Destroys a VertexBufferBinding. */
+        virtual void destroyVertexBufferBinding(VertexBufferBinding* binding);
+
+        /** Registers a vertex buffer as a copy of another.
+        @remarks
+            This is useful for registering an existing buffer as a temporary buffer
+            which can be allocated just like a copy.
+        */
+        virtual void registerVertexBufferSourceAndCopy(
+            const HardwareVertexBufferSharedPtr& sourceBuffer,
+            const HardwareVertexBufferSharedPtr& copy);
+
+        /** Allocates a copy of a given vertex buffer.
+        @remarks
+            This method allocates a temporary copy of an existing vertex buffer.
+            This buffer is subsequently stored and can be made available for 
+            other purposes later without incurring the cost of construction / 
+            destruction.
+        @param sourceBuffer
+            The source buffer to use as a copy.
+        @param licenseType
+            The type of license required on this buffer - automatic
+            release causes this class to release licenses every frame so that 
+            they can be reallocated anew.
+        @param licensee
+            Pointer back to the class requesting the copy, which must
+            implement HardwareBufferLicense in order to be notified when the license
+            expires.
+        @param copyData
+            If @c true, the current data is copied as well as the 
+            structure of the buffer/
+        */
+        virtual HardwareVertexBufferSharedPtr allocateVertexBufferCopy(
+            const HardwareVertexBufferSharedPtr& sourceBuffer, 
+            BufferLicenseType licenseType,
+            HardwareBufferLicensee* licensee,
+            bool copyData = false);
+
+        /** Manually release a vertex buffer copy for others to subsequently use.
+        @remarks
+            Only required if the original call to allocateVertexBufferCopy
+            included a licenseType of BLT_MANUAL_RELEASE. 
+        @param bufferCopy
+            The buffer copy. The caller is expected to delete
+            or at least no longer use this reference, since another user may
+            well begin to modify the contents of the buffer.
+        */
+        virtual void releaseVertexBufferCopy(
+            const HardwareVertexBufferSharedPtr& bufferCopy); 
+
+        /** Tell engine that the vertex buffer copy intent to reuse.
+        @remarks
+            Ogre internal keep an expired delay counter of BLT_AUTOMATIC_RELEASE
+            buffers, when the counter count down to zero, it'll release for other
+            purposes later. But you can use this function to reset the counter to
+            the internal configured value, keep the buffer not get released for
+            some frames.
+        @param bufferCopy
+            The buffer copy. The caller is expected to keep this
+            buffer copy for use.
+        */
+        virtual void touchVertexBufferCopy(const HardwareVertexBufferSharedPtr& bufferCopy);
+
+        /** Free all unused vertex buffer copies.
+        @remarks
+            This method free all temporary vertex buffers that not in used.
+            In normally, temporary vertex buffers are subsequently stored and can
+            be made available for other purposes later without incurring the cost
+            of construction / destruction. But in some cases you want to free them
+            to save hardware memory (e.g. application was runs in a long time, you
+            might free temporary buffers periodically to avoid memory overload).
+        */
+        virtual void _freeUnusedBufferCopies(void);
+
+        /** Internal method for releasing all temporary buffers which have been 
+           allocated using BLT_AUTOMATIC_RELEASE; is called by OGRE.
+        @param forceFreeUnused
+            If @c true, free all unused temporary buffers.
+            If @c false, auto detect and free all unused temporary buffers based on
+            temporary buffers utilization.
+        */
+        virtual void _releaseBufferCopies(bool forceFreeUnused = false);
+
+        /** Internal method that forces the release of copies of a given buffer.
+        @remarks
+            This usually means that the buffer which the copies are based on has
+            been changed in some fundamental way, and the owner of the original 
+            wishes to make that known so that new copies will reflect the
+            changes.
+        @param sourceBuffer
+            The source buffer as a shared pointer.  Any buffer copies created
+            from the source buffer are deleted.
+        */
+        virtual void _forceReleaseBufferCopies(const HardwareVertexBufferSharedPtr& sourceBuffer);
+
+        /** Internal method that forces the release of copies of a given buffer.
+        @remarks
+            This usually means that the buffer which the copies are based on has
+            been changed in some fundamental way, and the owner of the original 
+            wishes to make that known so that new copies will reflect the
+            changes.
+        @param sourceBuffer
+            The source buffer as a pointer. Any buffer copies created from
+            the source buffer are deleted.
+        */
+        virtual void _forceReleaseBufferCopies(HardwareVertexBuffer* sourceBuffer);
+
+        /// Notification that a hardware vertex buffer has been destroyed.
+        void _notifyVertexBufferDestroyed(HardwareVertexBuffer* buf);
+        /// Notification that a hardware index buffer has been destroyed.
+        void _notifyIndexBufferDestroyed(HardwareIndexBuffer* buf);
+		/// Notification that at hardware uniform buffer has been destroyed
+		void _notifyUniformBufferDestroyed(HardwareUniformBuffer* buf);
+		/// Notification that at hardware counter buffer has been destroyed
+		void _notifyCounterBufferDestroyed(HardwareCounterBuffer* buf);
+    };
+
+    /** Singleton wrapper for hardware buffer manager. */
+    class _OgreExport HardwareBufferManager : public HardwareBufferManagerBase, public Singleton<HardwareBufferManager>
+    {
+        friend class HardwareVertexBufferSharedPtr;
+        friend class HardwareIndexBufferSharedPtr;
+    protected:
+        HardwareBufferManagerBase* mImpl;
+    public:
+        HardwareBufferManager(HardwareBufferManagerBase* imp);
+        ~HardwareBufferManager();
+
+        /** @copydoc HardwareBufferManagerBase::createVertexBuffer */
+        HardwareVertexBufferSharedPtr 
+            createVertexBuffer(size_t vertexSize, size_t numVerts, HardwareBuffer::Usage usage, 
+            bool useShadowBuffer = false)
+        {
+            return mImpl->createVertexBuffer(vertexSize, numVerts, usage, useShadowBuffer);
+        }
+        /** @copydoc HardwareBufferManagerBase::createIndexBuffer */
+        HardwareIndexBufferSharedPtr 
+            createIndexBuffer(HardwareIndexBuffer::IndexType itype, size_t numIndexes, 
+            HardwareBuffer::Usage usage, bool useShadowBuffer = false)
+        {
+            return mImpl->createIndexBuffer(itype, numIndexes, usage, useShadowBuffer);
+        }
+
+        /** @copydoc HardwareBufferManagerBase::createRenderToVertexBuffer */
+        RenderToVertexBufferSharedPtr createRenderToVertexBuffer()
+        {
+            return mImpl->createRenderToVertexBuffer();
+        }
+
+        /** @copydoc HardwareBufferManagerBase::createUniformBuffer */
+		HardwareUniformBufferSharedPtr
+				createUniformBuffer(size_t sizeBytes, HardwareBuffer::Usage usage, bool useShadowBuffer, const String& name = "")
+		{
+			return mImpl->createUniformBuffer(sizeBytes, usage, useShadowBuffer, name);
+		}
+        
+        /** @copydoc HardwareBufferManagerBase::createCounterBuffer */
+		HardwareCounterBufferSharedPtr
+        createCounterBuffer(size_t sizeBytes, HardwareBuffer::Usage usage, bool useShadowBuffer, const String& name = "")
+		{
+			return mImpl->createCounterBuffer(sizeBytes, usage, useShadowBuffer, name);
+		}
+
+		/** @copydoc HardwareBufferManagerInterface::createVertexDeclaration */
+        virtual VertexDeclaration* createVertexDeclaration(void)
+        {
+            return mImpl->createVertexDeclaration();
+        }
+        /** @copydoc HardwareBufferManagerBase::destroyVertexDeclaration */
+        virtual void destroyVertexDeclaration(VertexDeclaration* decl)
+        {
+            mImpl->destroyVertexDeclaration(decl);
+        }
+
+        /** @copydoc HardwareBufferManagerBase::createVertexBufferBinding */
+        virtual VertexBufferBinding* createVertexBufferBinding(void)
+        {
+            return mImpl->createVertexBufferBinding();
+        }
+        /** @copydoc HardwareBufferManagerBase::destroyVertexBufferBinding */
+        virtual void destroyVertexBufferBinding(VertexBufferBinding* binding)
+        {
+            mImpl->destroyVertexBufferBinding(binding);
+        }
+        /** @copydoc HardwareBufferManagerBase::registerVertexBufferSourceAndCopy */
+        virtual void registerVertexBufferSourceAndCopy(
+            const HardwareVertexBufferSharedPtr& sourceBuffer,
+            const HardwareVertexBufferSharedPtr& copy)
+        {
+            mImpl->registerVertexBufferSourceAndCopy(sourceBuffer, copy);
+        }
+        /** @copydoc HardwareBufferManagerBase::allocateVertexBufferCopy */
+        virtual HardwareVertexBufferSharedPtr allocateVertexBufferCopy(
+            const HardwareVertexBufferSharedPtr& sourceBuffer, 
+            BufferLicenseType licenseType,
+            HardwareBufferLicensee* licensee,
+            bool copyData = false)
+        {
+            return mImpl->allocateVertexBufferCopy(sourceBuffer, licenseType, licensee, copyData);
+        }
+        /** @copydoc HardwareBufferManagerBase::releaseVertexBufferCopy */
+        virtual void releaseVertexBufferCopy(
+            const HardwareVertexBufferSharedPtr& bufferCopy)
+        {
+            mImpl->releaseVertexBufferCopy(bufferCopy);
+        }
+
+        /** @copydoc HardwareBufferManagerBase::touchVertexBufferCopy */
+        virtual void touchVertexBufferCopy(
+            const HardwareVertexBufferSharedPtr& bufferCopy)
+        {
+            mImpl->touchVertexBufferCopy(bufferCopy);
+        }
+
+        /** @copydoc HardwareBufferManagerBase::_freeUnusedBufferCopies */
+        virtual void _freeUnusedBufferCopies(void)
+        {
+            mImpl->_freeUnusedBufferCopies();
+        }
+        /** @copydoc HardwareBufferManagerBase::_releaseBufferCopies */
+        virtual void _releaseBufferCopies(bool forceFreeUnused = false)
+        {
+            mImpl->_releaseBufferCopies(forceFreeUnused);
+        }
+        /** @copydoc HardwareBufferManagerBase::_forceReleaseBufferCopies */
+        virtual void _forceReleaseBufferCopies(
+            const HardwareVertexBufferSharedPtr& sourceBuffer)
+        {
+            mImpl->_forceReleaseBufferCopies(sourceBuffer);
+        }
+        /** @copydoc HardwareBufferManagerBase::_forceReleaseBufferCopies */
+        virtual void _forceReleaseBufferCopies(HardwareVertexBuffer* sourceBuffer)
+        {
+            mImpl->_forceReleaseBufferCopies(sourceBuffer);
+        }
+        /** @copydoc HardwareBufferManagerBase::_notifyVertexBufferDestroyed */
+        void _notifyVertexBufferDestroyed(HardwareVertexBuffer* buf)
+        {
+            mImpl->_notifyVertexBufferDestroyed(buf);
+        }
+        /** @copydoc HardwareBufferManagerBase::_notifyIndexBufferDestroyed */
+        void _notifyIndexBufferDestroyed(HardwareIndexBuffer* buf)
+        {
+            mImpl->_notifyIndexBufferDestroyed(buf);
+        }
+		/** @copydoc HardwareBufferManagerInterface::_notifyUniformBufferDestroyed */
+		void _notifyUniformBufferDestroyed(HardwareUniformBuffer* buf)
+		{
+			mImpl->_notifyUniformBufferDestroyed(buf);
+		}
+		/** @copydoc HardwareBufferManagerInterface::_notifyCounterBufferDestroyed */
+		void _notifyConterBufferDestroyed(HardwareCounterBuffer* buf)
+		{
+			mImpl->_notifyCounterBufferDestroyed(buf);
+		}
+
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static HardwareBufferManager& getSingleton(void);
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static HardwareBufferManager* getSingletonPtr(void);
+
+    };
+
+    /** @} */
+    /** @} */
+} // namespace Ogre
+
+#include "OgreHeaderSuffix.h"
+
+#endif // __HardwareBufferManager__
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreHardwareCounterBuffer.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreHardwareCounterBuffer.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreHardwareCounterBuffer.h	(revision 148)
@@ -0,0 +1,79 @@
+/*
+-----------------------------------------------------------------------------
+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 __HardwareCounterBuffer__
+#define __HardwareCounterBuffer__
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+#include "OgreHardwareBuffer.h"
+#include "OgreSharedPtr.h"
+#include "OgreGpuProgramParams.h"
+#include "OgreAny.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+	class HardwareBufferManagerBase;
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup RenderSystem
+	*  @{
+	*/
+	/** Specialisation of HardwareBuffer for a counter buffer. */
+	class _OgreExport HardwareCounterBuffer : public HardwareBuffer
+    {
+	    protected:
+		    HardwareBufferManagerBase* mMgr;
+			String mName;
+
+	    public:
+		    /// Should be called by HardwareBufferManager
+		    HardwareCounterBuffer(HardwareBufferManagerBase* mgr, size_t sizeBytes, 
+							HardwareBuffer::Usage usage, bool useShadowBuffer = false, const String& name = "");
+		    ~HardwareCounterBuffer();
+		    /// Return the manager of this buffer, if any
+		    HardwareBufferManagerBase* getManager() const { return mMgr; }
+
+			const String& getName() const { return mName; }
+
+    };
+
+    /** Shared pointer implementation used to share counter buffers. */
+    class _OgreExport HardwareCounterBufferSharedPtr : public SharedPtr<HardwareCounterBuffer>
+    {
+    public:
+        HardwareCounterBufferSharedPtr() : SharedPtr<HardwareCounterBuffer>() {}
+        explicit HardwareCounterBufferSharedPtr(HardwareCounterBuffer* buf);
+    };
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreHardwareIndexBuffer.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreHardwareIndexBuffer.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreHardwareIndexBuffer.h	(revision 148)
@@ -0,0 +1,93 @@
+/*
+-----------------------------------------------------------------------------
+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 __HardwareIndexBuffer__
+#define __HardwareIndexBuffer__
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+#include "OgreHardwareBuffer.h"
+#include "OgreSharedPtr.h"
+
+namespace Ogre {
+	class HardwareBufferManagerBase;
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup RenderSystem
+	*  @{
+	*/
+	/** Specialisation of HardwareBuffer for vertex index buffers, still abstract. */
+    class _OgreExport HardwareIndexBuffer : public HardwareBuffer
+    {
+	    public:
+		    enum IndexType {
+			    IT_16BIT,
+			    IT_32BIT
+		    };
+
+	    protected:
+			HardwareBufferManagerBase* mMgr;
+		    IndexType mIndexType;
+		    size_t mNumIndexes;
+            size_t mIndexSize;
+
+	    public:
+		    /// Should be called by HardwareBufferManager
+		    HardwareIndexBuffer(HardwareBufferManagerBase* mgr, IndexType idxType, size_t numIndexes, HardwareBuffer::Usage usage,
+                bool useSystemMemory, bool useShadowBuffer);
+            ~HardwareIndexBuffer();
+			/// Return the manager of this buffer, if any
+			HardwareBufferManagerBase* getManager() const { return mMgr; }
+    		/// Get the type of indexes used in this buffer
+            IndexType getType(void) const { return mIndexType; }
+            /// Get the number of indexes in this buffer
+            size_t getNumIndexes(void) const { return mNumIndexes; }
+            /// Get the size in bytes of each index
+            size_t getIndexSize(void) const { return mIndexSize; }
+
+		    // NB subclasses should override lock, unlock, readData, writeData
+    };
+
+
+    /** Shared pointer implementation used to share index buffers. */
+    class _OgreExport HardwareIndexBufferSharedPtr : public SharedPtr<HardwareIndexBuffer>
+    {
+    public:
+        HardwareIndexBufferSharedPtr() : SharedPtr<HardwareIndexBuffer>() {}
+        explicit HardwareIndexBufferSharedPtr(HardwareIndexBuffer* buf);
+    };
+    
+    /** Locking helper. */    
+    typedef HardwareBufferLockGuard<HardwareIndexBufferSharedPtr> HardwareIndexBufferLockGuard;
+
+	/** @} */
+	/** @} */
+}
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreHardwareOcclusionQuery.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreHardwareOcclusionQuery.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreHardwareOcclusionQuery.h	(revision 148)
@@ -0,0 +1,132 @@
+/*
+-----------------------------------------------------------------------------
+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 _HardwareOcclusionQuery__
+#define _HardwareOcclusionQuery__
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup RenderSystem
+	*  @{
+	*/
+/**
+  * This is a abstract class that that provides the interface for the query class for 
+  * hardware occlusion.
+  *
+  * @author Lee Sandberg
+  * Updated on 13/8/2005 by Tuan Kuranes email: tuan.kuranes@free.fr
+  */
+	class _OgreExport HardwareOcclusionQuery : public RenderSysAlloc
+{
+//----------------------------------------------------------------------
+// Public methods
+//--
+public:
+	/**
+	  * Object public member functions
+	  */
+
+	/**
+	  * Default object constructor
+	  * 
+	  */
+	HardwareOcclusionQuery();
+
+	/**
+	  * Object destructor
+	  */
+	virtual ~HardwareOcclusionQuery();
+
+	/**
+	  * Starts the hardware occlusion query
+	  * @remarks	Simple usage: Create one or more OcclusionQuery object one per outstanding query or one per tested object 
+	  *				OcclusionQuery* mOcclusionQuery;
+	  *				createOcclusionQuery( &mOcclusionQuery );
+	  *				In the rendering loop:
+	  *				Draw all occluders
+	  *				mOcclusionQuery->startOcclusionQuery();
+	  *				Draw the polygons to be tested
+	  *				mOcclusionQuery->endOcclusionQuery();
+	  *
+	  *				Results must be pulled using:
+	  *				UINT	mNumberOfPixelsVisable;
+	  *				pullOcclusionQuery( &mNumberOfPixelsVisable );
+	  *			
+	  */
+	virtual void beginOcclusionQuery() = 0;
+
+	/**
+	  * Ends the hardware occlusion test
+	  */
+	virtual void endOcclusionQuery() = 0;
+
+	/**
+      * Pulls the hardware occlusion query.
+	  * @note Waits until the query result is available; use isStillOutstanding
+	  *		if just want to test if the result is available.
+      * @retval NumOfFragments will get the resulting number of fragments.
+      * @return True if success or false if not.
+      */
+	virtual bool pullOcclusionQuery(unsigned int* NumOfFragments) = 0;
+
+	/**
+	  * Let's you get the last pixel count with out doing the hardware occlusion test
+	  * @return The last fragment count from the last test.
+	  * Remarks This function won't give you new values, just the old value.
+	  */
+	unsigned int getLastQuerysPixelcount() const { return mPixelCount; }
+
+	/**
+	  * Lets you know when query is done, or still be processed by the Hardware
+	  * @return true if query isn't finished.
+	  */
+	 virtual bool isStillOutstanding(void) = 0; 
+
+
+    //----------------------------------------------------------------------
+    // protected members
+    //--
+    protected :
+        /// Number of visible pixels determined by last query
+        unsigned int mPixelCount;
+        /// Has the query returned a result yet?
+		bool		 mIsQueryResultStillOutstanding;
+};
+
+	/** @} */
+	/** @} */
+}
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreHardwarePixelBuffer.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreHardwarePixelBuffer.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreHardwarePixelBuffer.h	(revision 148)
@@ -0,0 +1,209 @@
+/*
+-----------------------------------------------------------------------------
+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 __HardwarePixelBuffer__
+#define __HardwarePixelBuffer__
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+#include "OgreHardwareBuffer.h"
+#include "OgreSharedPtr.h"
+#include "OgrePixelFormat.h"
+#include "OgreImage.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup RenderSystem
+	*  @{
+	*/
+	/** Specialisation of HardwareBuffer for a pixel buffer. The
+    	HardwarePixelbuffer abstracts an 1D, 2D or 3D quantity of pixels
+    	stored by the rendering API. The buffer can be located on the card
+    	or in main memory depending on its usage. One mipmap level of a
+    	texture is an example of a HardwarePixelBuffer.
+    */
+    class _OgreExport HardwarePixelBuffer : public HardwareBuffer
+    {
+    protected: 
+        /// Extents
+        uint32 mWidth, mHeight, mDepth;
+        /// Pitches (offsets between rows and slices)
+        size_t mRowPitch, mSlicePitch;
+        /// Internal format
+        PixelFormat mFormat;
+        /// Currently locked region (local coords)
+        PixelBox mCurrentLock;
+		/// The current locked box of this surface (entire surface coords)
+		Image::Box mLockedBox;
+
+        
+        /// Internal implementation of lock(), must be overridden in subclasses
+        virtual PixelBox lockImpl(const Image::Box lockBox,  LockOptions options) = 0;
+
+        /** Internal implementation of lock(), do not OVERRIDE or CALL this
+            for HardwarePixelBuffer implementations, but override the previous method */
+        virtual void* lockImpl(size_t offset, size_t length, LockOptions options);
+
+		/** Notify TextureBuffer of destruction of render target.
+			Called by RenderTexture when destroyed.
+		*/
+		virtual void _clearSliceRTT(size_t zoffset);
+		friend class RenderTexture;
+    public:
+        /// Should be called by HardwareBufferManager
+        HardwarePixelBuffer(uint32 mWidth, uint32 mHeight, uint32 mDepth,
+                PixelFormat mFormat,
+                HardwareBuffer::Usage usage, bool useSystemMemory, bool useShadowBuffer);
+        ~HardwarePixelBuffer();
+
+        /** Make every lock method from HardwareBuffer available.
+        See http://www.research.att.com/~bs/bs_faq2.html#overloadderived
+        */
+        using HardwareBuffer::lock;	
+
+        /** Lock the buffer for (potentially) reading / writing.
+		    @param lockBox Region of the buffer to lock
+		    @param options Locking options
+		    @return PixelBox containing the locked region, the pitches and
+		    	the pixel format
+		*/
+		virtual const PixelBox& lock(const Image::Box& lockBox, LockOptions options);
+		/// @copydoc HardwareBuffer::lock
+        virtual void* lock(size_t offset, size_t length, LockOptions options);
+
+		/** Get the current locked region. This is the same value as returned
+		    by lock(const Image::Box, LockOptions)
+		    @return PixelBox containing the locked region
+		*/        
+        const PixelBox& getCurrentLock();
+		
+		/// @copydoc HardwareBuffer::readData
+		virtual void readData(size_t offset, size_t length, void* pDest);
+		/// @copydoc HardwareBuffer::writeData
+		virtual void writeData(size_t offset, size_t length, const void* pSource,
+				bool discardWholeBuffer = false);
+        
+        /** Copies a box from another PixelBuffer to a region of the 
+        	this PixelBuffer. 
+			@param src		Source pixel buffer
+        	@param srcBox	Image::Box describing the source region in src
+        	@param dstBox	Image::Box describing the destination region in this buffer
+			@remarks The source and destination regions dimensions don't have to match, in which
+		   	case scaling is done. This scaling is generally done using a bilinear filter in hardware,
+            but it is faster to pass the source image in the right dimensions.
+			@note Only call this function when both  buffers are unlocked. 
+         */        
+        virtual void blit(const HardwarePixelBufferSharedPtr &src, const Image::Box &srcBox, const Image::Box &dstBox);
+
+		/** Convenience function that blits the entire source pixel buffer to this buffer. 
+			If source and destination dimensions don't match, scaling is done.
+			@param src		PixelBox containing the source pixels and format in memory
+			@note Only call this function when the buffer is unlocked. 
+		*/
+		void blit(const HardwarePixelBufferSharedPtr &src); 
+		
+		/** Copies a region from normal memory to a region of this pixelbuffer. The source
+			image can be in any pixel format supported by OGRE, and in any size. 
+		   	@param src		PixelBox containing the source pixels and format in memory
+		   	@param dstBox	Image::Box describing the destination region in this buffer
+            @remarks The source and destination regions dimensions don't have to match, in which
+            case scaling is done. This scaling is generally done using a bilinear filter in hardware,
+            but it is faster to pass the source image in the right dimensions.
+			@note Only call this function when the buffer is unlocked. 
+		*/
+		virtual void blitFromMemory(const PixelBox &src, const Image::Box &dstBox) = 0;
+		
+		/** Convenience function that blits a pixelbox from memory to the entire 
+			buffer. The source image is scaled as needed.
+			@param src		PixelBox containing the source pixels and format in memory
+			@note Only call this function when the buffer is unlocked. 
+		*/
+		void blitFromMemory(const PixelBox &src)
+		{
+			blitFromMemory(src, Box(0,0,0,mWidth,mHeight,mDepth));
+		}
+		
+		/** Copies a region of this pixelbuffer to normal memory.
+		   	@param srcBox	Image::Box describing the source region of this buffer
+		   	@param dst		PixelBox describing the destination pixels and format in memory
+		   	@remarks The source and destination regions don't have to match, in which
+		   	case scaling is done.
+			@note Only call this function when the buffer is unlocked. 
+		 */
+		virtual void blitToMemory(const Image::Box &srcBox, const PixelBox &dst) = 0;
+
+		/** Convenience function that blits this entire buffer to a pixelbox.
+			The image is scaled as needed.
+			@param dst		PixelBox describing the destination pixels and format in memory
+			@note Only call this function when the buffer is unlocked. 
+		*/
+		void blitToMemory(const PixelBox &dst)
+		{
+			blitToMemory(Box(0,0,0,mWidth,mHeight,mDepth), dst);
+		}
+        
+        /** Get a render target for this PixelBuffer, or a slice of it. The texture this
+            was acquired from must have TU_RENDERTARGET set, otherwise it is possible to
+            render to it and this method will throw an ERR_RENDERSYSTEM exception.
+            @param slice    Which slice
+            @return A pointer to the render target. This pointer has the lifespan of this
+            PixelBuffer.
+        */
+        virtual RenderTexture *getRenderTarget(size_t slice=0);
+        
+        /// Gets the width of this buffer
+        uint32 getWidth() const { return mWidth; }
+        /// Gets the height of this buffer
+        uint32 getHeight() const { return mHeight; }
+        /// Gets the depth of this buffer
+        uint32 getDepth() const { return mDepth; }
+        /// Gets the native pixel format of this buffer
+        PixelFormat getFormat() const { return mFormat; }
+    };
+
+    /** Shared pointer implementation used to share pixel buffers. */
+    class _OgreExport HardwarePixelBufferSharedPtr : public SharedPtr<HardwarePixelBuffer>
+    {
+    public:
+        HardwarePixelBufferSharedPtr() : SharedPtr<HardwarePixelBuffer>() {}
+        explicit HardwarePixelBufferSharedPtr(HardwarePixelBuffer* buf);
+
+
+    };
+
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreHardwareUniformBuffer.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreHardwareUniformBuffer.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreHardwareUniformBuffer.h	(revision 148)
@@ -0,0 +1,79 @@
+/*
+-----------------------------------------------------------------------------
+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 __HardwareUniformBuffer__
+#define __HardwareUniformBuffer__
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+#include "OgreHardwareBuffer.h"
+#include "OgreSharedPtr.h"
+#include "OgreGpuProgramParams.h"
+#include "OgreAny.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+	class HardwareBufferManagerBase;
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup RenderSystem
+	*  @{
+	*/
+	/** Specialisation of HardwareBuffer for a uniform buffer. */
+	class _OgreExport HardwareUniformBuffer : public HardwareBuffer
+    {
+	    protected:
+		    HardwareBufferManagerBase* mMgr;
+			String mName;
+
+	    public:
+		    /// Should be called by HardwareBufferManager
+		    HardwareUniformBuffer(HardwareBufferManagerBase* mgr, size_t sizeBytes, 
+							HardwareBuffer::Usage usage, bool useShadowBuffer = false, const String& name = "");
+		    ~HardwareUniformBuffer();
+		    /// Return the manager of this buffer, if any
+		    HardwareBufferManagerBase* getManager() const { return mMgr; }
+
+			const String& getName() const { return mName; }
+
+    };
+
+    /** Shared pointer implementation used to share uniform buffers. */
+    class _OgreExport HardwareUniformBufferSharedPtr : public SharedPtr<HardwareUniformBuffer>
+    {
+    public:
+        HardwareUniformBufferSharedPtr() : SharedPtr<HardwareUniformBuffer>() {}
+        explicit HardwareUniformBufferSharedPtr(HardwareUniformBuffer* buf);
+    };
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreHardwareVertexBuffer.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreHardwareVertexBuffer.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreHardwareVertexBuffer.h	(revision 148)
@@ -0,0 +1,604 @@
+/*
+-----------------------------------------------------------------------------
+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 __HardwareVertexBuffer__
+#define __HardwareVertexBuffer__
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+#include "OgreHardwareBuffer.h"
+#include "OgreSharedPtr.h"
+#include "OgreColourValue.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+	class HardwareBufferManagerBase;
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup RenderSystem
+	*  @{
+	*/
+	/** Specialisation of HardwareBuffer for a vertex buffer. */
+    class _OgreExport HardwareVertexBuffer : public HardwareBuffer
+    {
+	    protected:
+
+		    HardwareBufferManagerBase* mMgr;
+		    size_t mNumVertices;
+		    size_t mVertexSize;
+		    bool mIsInstanceData;
+			size_t mInstanceDataStepRate;			
+		    /// Checks if vertex instance data is supported by the render system
+		    virtual bool checkIfVertexInstanceDataIsSupported();
+
+	    public:
+		    /// Should be called by HardwareBufferManager
+		    HardwareVertexBuffer(HardwareBufferManagerBase* mgr, size_t vertexSize, size_t numVertices,
+		        HardwareBuffer::Usage usage, bool useSystemMemory, bool useShadowBuffer);
+		    ~HardwareVertexBuffer();
+		    /// Return the manager of this buffer, if any
+		    HardwareBufferManagerBase* getManager() const { return mMgr; }
+		    /// Gets the size in bytes of a single vertex in this buffer
+		    size_t getVertexSize(void) const { return mVertexSize; }
+		    /// Get the number of vertices in this buffer
+		    size_t getNumVertices(void) const { return mNumVertices; }
+		    /// Get if this vertex buffer is an "instance data" buffer (per instance)
+		    bool isInstanceData() const { return mIsInstanceData; }
+		    /// Set if this vertex buffer is an "instance data" buffer (per instance)
+		    void setIsInstanceData(const bool val);
+			/// Get the number of instances to draw using the same per-instance data before advancing in the buffer by one element.
+			size_t getInstanceDataStepRate() const;
+			/// Set the number of instances to draw using the same per-instance data before advancing in the buffer by one element.
+			void setInstanceDataStepRate(const size_t val);
+
+
+		    // NB subclasses should override lock, unlock, readData, writeData
+
+    };
+
+    /** Shared pointer implementation used to share vertex buffers. */
+    class _OgreExport HardwareVertexBufferSharedPtr : public SharedPtr<HardwareVertexBuffer>
+    {
+    public:
+        HardwareVertexBufferSharedPtr() : SharedPtr<HardwareVertexBuffer>() {}
+        explicit HardwareVertexBufferSharedPtr(HardwareVertexBuffer* buf);
+
+
+    };
+
+    /** Locking helper. */    
+    typedef HardwareBufferLockGuard<HardwareVertexBufferSharedPtr> HardwareVertexBufferLockGuard;
+
+    /// Vertex element semantics, used to identify the meaning of vertex buffer contents
+	enum VertexElementSemantic {
+		/// Position, 3 reals per vertex
+		VES_POSITION = 1,
+		/// Blending weights
+		VES_BLEND_WEIGHTS = 2,
+        /// Blending indices
+        VES_BLEND_INDICES = 3,
+		/// Normal, 3 reals per vertex
+		VES_NORMAL = 4,
+		/// Diffuse colours
+		VES_DIFFUSE = 5,
+		/// Specular colours
+		VES_SPECULAR = 6,
+		/// Texture coordinates
+		VES_TEXTURE_COORDINATES = 7,
+        /// Binormal (Y axis if normal is Z)
+        VES_BINORMAL = 8,
+        /// Tangent (X axis if normal is Z)
+        VES_TANGENT = 9,
+        /// The  number of VertexElementSemantic elements (note - the first value VES_POSITION is 1) 
+        VES_COUNT = 9
+	};
+
+	/// Vertex element type, used to identify the base types of the vertex contents
+	enum VertexElementType
+    {
+        VET_FLOAT1 = 0,
+        VET_FLOAT2 = 1,
+        VET_FLOAT3 = 2,
+        VET_FLOAT4 = 3,
+        /// alias to more specific colour type - use the current rendersystem's colour packing
+		VET_COLOUR = 4,
+		VET_SHORT1 = 5,
+		VET_SHORT2 = 6,
+		VET_SHORT3 = 7,
+		VET_SHORT4 = 8,
+        VET_UBYTE4 = 9,
+        /// D3D style compact colour
+        VET_COLOUR_ARGB = 10,
+        /// GL style compact colour
+        VET_COLOUR_ABGR = 11,
+		VET_DOUBLE1 = 12,
+        VET_DOUBLE2 = 13,
+        VET_DOUBLE3 = 14,
+        VET_DOUBLE4 = 15,
+        VET_USHORT1 = 16,
+        VET_USHORT2 = 17,
+        VET_USHORT3 = 18,
+        VET_USHORT4 = 19,      
+        VET_INT1 = 20,
+        VET_INT2 = 21,
+        VET_INT3 = 22,
+        VET_INT4 = 23,
+        VET_UINT1 = 24,
+        VET_UINT2 = 25,
+        VET_UINT3 = 26,
+        VET_UINT4 = 27
+    };
+
+    /** This class declares the usage of a single vertex buffer as a component
+        of a complete VertexDeclaration.
+        @remarks
+        Several vertex buffers can be used to supply the input geometry for a
+        rendering operation, and in each case a vertex buffer can be used in
+        different ways for different operations; the buffer itself does not
+        define the semantics (position, normal etc), the VertexElement
+        class does.
+    */
+	class _OgreExport VertexElement : public VertexDataAlloc
+    {
+    protected:
+        /// The source vertex buffer, as bound to an index using VertexBufferBinding
+        unsigned short mSource;
+        /// The offset in the buffer that this element starts at
+        size_t mOffset;
+        /// The type of element
+        VertexElementType mType;
+        /// The meaning of the element
+        VertexElementSemantic mSemantic;
+        /// Index of the item, only applicable for some elements like texture coords
+        unsigned short mIndex;
+    public:
+		/// Constructor, should not be called directly, only needed because of list
+		VertexElement() {}
+        /// Constructor, should not be called directly, call VertexDeclaration::addElement
+        VertexElement(unsigned short source, size_t offset, VertexElementType theType,
+            VertexElementSemantic semantic, unsigned short index = 0);
+        /// Gets the vertex buffer index from where this element draws it's values
+        unsigned short getSource(void) const { return mSource; }
+        /// Gets the offset into the buffer where this element starts
+        size_t getOffset(void) const { return mOffset; }
+        /// Gets the data format of this element
+        VertexElementType getType(void) const { return mType; }
+        /// Gets the meaning of this element
+        VertexElementSemantic getSemantic(void) const { return mSemantic; }
+        /// Gets the index of this element, only applicable for repeating elements
+        unsigned short getIndex(void) const { return mIndex; }
+		/// Gets the size of this element in bytes
+		size_t getSize(void) const;
+		/// Utility method for helping to calculate offsets
+		static size_t getTypeSize(VertexElementType etype);
+		/// Utility method which returns the count of values in a given type
+		static unsigned short getTypeCount(VertexElementType etype);
+		/** Simple converter function which will turn a single-value type into a
+			multi-value type based on a parameter.
+		*/
+		static VertexElementType multiplyTypeCount(VertexElementType baseType, unsigned short count);
+		/** Simple converter function which will a type into it's single-value
+			equivalent - makes switches on type easier.
+		*/
+		static VertexElementType getBaseType(VertexElementType multiType);
+
+		/** Utility method for converting colour from
+			one packed 32-bit colour type to another.
+		@param srcType The source type
+		@param dstType The destination type
+		@param ptr Read / write value to change
+		*/
+		static void convertColourValue(VertexElementType srcType,
+			VertexElementType dstType, uint32* ptr);
+
+		/** Utility method for converting colour to
+			a packed 32-bit colour type.
+		@param src source colour
+		@param dst The destination type
+		*/
+		static uint32 convertColourValue(const ColourValue& src,
+			VertexElementType dst);
+
+		/** Utility method to get the most appropriate packed colour vertex element format. */
+		static VertexElementType getBestColourVertexElementType(void);
+
+        inline bool operator== (const VertexElement& rhs) const
+        {
+            if (mType != rhs.mType ||
+                mIndex != rhs.mIndex ||
+                mOffset != rhs.mOffset ||
+                mSemantic != rhs.mSemantic ||
+                mSource != rhs.mSource)
+                return false;
+            else
+                return true;
+
+        }
+        /** Adjusts a pointer to the base of a vertex to point at this element.
+        @remarks
+            This variant is for void pointers, passed as a parameter because we can't
+            rely on covariant return types.
+        @param pBase Pointer to the start of a vertex in this buffer.
+        @param pElem Pointer to a pointer which will be set to the start of this element.
+        */
+        inline void baseVertexPointerToElement(void* pBase, void** pElem) const
+        {
+            // The only way we can do this is to cast to char* in order to use byte offset
+            // then cast back to void*.
+            *pElem = static_cast<void*>(
+            	static_cast<unsigned char*>(pBase) + mOffset);
+        }
+        /** Adjusts a pointer to the base of a vertex to point at this element.
+        @remarks
+            This variant is for float pointers, passed as a parameter because we can't
+            rely on covariant return types.
+        @param pBase Pointer to the start of a vertex in this buffer.
+        @param pElem Pointer to a pointer which will be set to the start of this element.
+        */
+        inline void baseVertexPointerToElement(void* pBase, float** pElem) const
+        {
+            // The only way we can do this is to cast to char* in order to use byte offset
+            // then cast back to float*. However we have to go via void* because casting
+            // directly is not allowed
+            *pElem = static_cast<float*>(
+                static_cast<void*>(
+                    static_cast<unsigned char*>(pBase) + mOffset));
+        }
+
+        /** Adjusts a pointer to the base of a vertex to point at this element.
+        @remarks
+            This variant is for RGBA pointers, passed as a parameter because we can't
+            rely on covariant return types.
+        @param pBase Pointer to the start of a vertex in this buffer.
+        @param pElem Pointer to a pointer which will be set to the start of this element.
+        */
+        inline void baseVertexPointerToElement(void* pBase, RGBA** pElem) const
+        {
+            *pElem = static_cast<RGBA*>(
+                static_cast<void*>(
+                    static_cast<unsigned char*>(pBase) + mOffset));
+        }
+        /** Adjusts a pointer to the base of a vertex to point at this element.
+        @remarks
+            This variant is for char pointers, passed as a parameter because we can't
+            rely on covariant return types.
+        @param pBase Pointer to the start of a vertex in this buffer.
+        @param pElem Pointer to a pointer which will be set to the start of this element.
+        */
+        inline void baseVertexPointerToElement(void* pBase, unsigned char** pElem) const
+        {
+            *pElem = static_cast<unsigned char*>(pBase) + mOffset;
+        }
+
+        /** Adjusts a pointer to the base of a vertex to point at this element.
+        @remarks
+        This variant is for ushort pointers, passed as a parameter because we can't
+        rely on covariant return types.
+        @param pBase Pointer to the start of a vertex in this buffer.
+        @param pElem Pointer to a pointer which will be set to the start of this element.
+        */
+        inline void baseVertexPointerToElement(void* pBase, unsigned short** pElem) const
+        {
+			*pElem = static_cast<unsigned short*>(
+				static_cast<void*>(
+					static_cast<unsigned char*>(pBase) + mOffset));
+        }
+
+
+    };
+    /** This class declares the format of a set of vertex inputs, which
+        can be issued to the rendering API through a RenderOperation.
+	@remarks
+	You should be aware that the ordering and structure of the
+	VertexDeclaration can be very important on DirectX with older
+	cards,so if you want to maintain maximum compatibility with
+	all render systems and all cards you should be careful to follow these
+	rules:<ol>
+	<li>VertexElements should be added in the following order, and the order of the
+	elements within a shared buffer should be as follows:
+	position, blending weights, normals, diffuse colours, specular colours,
+            texture coordinates (in order, with no gaps)</li>
+	<li>You must not have unused gaps in your buffers which are not referenced
+	by any VertexElement</li>
+	<li>You must not cause the buffer & offset settings of 2 VertexElements to overlap</li>
+	</ol>
+	Whilst GL and more modern graphics cards in D3D will allow you to defy these rules,
+	sticking to them will ensure that your buffers have the maximum compatibility.
+	@par
+	Like the other classes in this functional area, these declarations should be created and
+	destroyed using the HardwareBufferManager.
+    */
+	class _OgreExport VertexDeclaration : public VertexDataAlloc
+    {
+    public:
+		/// Defines the list of vertex elements that makes up this declaration
+        typedef list<VertexElement>::type VertexElementList;
+        /// Sort routine for vertex elements
+        static bool vertexElementLess(const VertexElement& e1, const VertexElement& e2);
+    protected:
+        VertexElementList mElementList;
+    public:
+        /// Standard constructor, not you should use HardwareBufferManager::createVertexDeclaration
+        VertexDeclaration();
+        virtual ~VertexDeclaration();
+
+        /** Get the number of elements in the declaration. */
+        size_t getElementCount(void) const { return mElementList.size(); }
+        /** Gets read-only access to the list of vertex elements. */
+        const VertexElementList& getElements(void) const;
+        /** Get a single element. */
+        const VertexElement* getElement(unsigned short index) const;
+
+        /** Sorts the elements in this list to be compatible with the maximum
+            number of rendering APIs / graphics cards.
+        @remarks
+            Older graphics cards require vertex data to be presented in a more
+            rigid way, as defined in the main documentation for this class. As well
+            as the ordering being important, where shared source buffers are used, the
+            declaration must list all the elements for each source in turn.
+        */
+        void sort(void);
+
+        /** Remove any gaps in the source buffer list used by this declaration.
+        @remarks
+            This is useful if you've modified a declaration and want to remove
+            any gaps in the list of buffers being used. Note, however, that if this
+            declaration is already being used with a VertexBufferBinding, you will
+            need to alter that too. This method is mainly useful when reorganising
+            buffers based on an altered declaration.
+        @note
+            This will cause the vertex declaration to be re-sorted.
+        */
+        void closeGapsInSource(void);
+
+        /** Generates a new VertexDeclaration for optimal usage based on the current
+            vertex declaration, which can be used with VertexData::reorganiseBuffers later
+            if you wish, or simply used as a template.
+		@remarks
+			Different buffer organisations and buffer usages will be returned
+            depending on the parameters passed to this method.
+        @param skeletalAnimation Whether this vertex data is going to be
+			skeletally animated
+		@param vertexAnimation Whether this vertex data is going to be vertex animated
+		@param vertexAnimationNormals Whether vertex data animation is going to include normals animation
+        */
+        VertexDeclaration* getAutoOrganisedDeclaration(bool skeletalAnimation,
+			bool vertexAnimation, bool vertexAnimationNormals) const;
+
+        /** Gets the index of the highest source value referenced by this declaration. */
+        unsigned short getMaxSource(void) const;
+
+
+
+        /** Adds a new VertexElement to this declaration.
+        @remarks
+            This method adds a single element (positions, normals etc) to the end of the
+            vertex declaration. <b>Please read the information in VertexDeclaration about
+	    the importance of ordering and structure for compatibility with older D3D drivers</b>.
+	    @param source The binding index of HardwareVertexBuffer which will provide the source for this element.
+			See VertexBufferBinding for full information.
+        @param offset The offset in bytes where this element is located in the buffer
+        @param theType The data format of the element (3 floats, a colour etc)
+        @param semantic The meaning of the data (position, normal, diffuse colour etc)
+        @param index Optional index for multi-input elements like texture coordinates
+		@return A reference to the VertexElement added.
+        */
+        virtual const VertexElement& addElement(unsigned short source, size_t offset, VertexElementType theType,
+            VertexElementSemantic semantic, unsigned short index = 0);
+        /** Inserts a new VertexElement at a given position in this declaration.
+        @remarks
+        This method adds a single element (positions, normals etc) at a given position in this
+        vertex declaration. <b>Please read the information in VertexDeclaration about
+        the importance of ordering and structure for compatibility with older D3D drivers</b>.
+        @param source The binding index of HardwareVertexBuffer which will provide the source for this element.
+        See VertexBufferBinding for full information.
+        @param offset The offset in bytes where this element is located in the buffer
+        @param theType The data format of the element (3 floats, a colour etc)
+        @param semantic The meaning of the data (position, normal, diffuse colour etc)
+        @param index Optional index for multi-input elements like texture coordinates
+        @return A reference to the VertexElement added.
+        */
+        virtual const VertexElement& insertElement(unsigned short atPosition,
+            unsigned short source, size_t offset, VertexElementType theType,
+            VertexElementSemantic semantic, unsigned short index = 0);
+
+        /** Remove the element at the given index from this declaration. */
+        virtual void removeElement(unsigned short elem_index);
+
+        /** Remove the element with the given semantic and usage index.
+        @remarks
+            In this case 'index' means the usage index for repeating elements such
+            as texture coordinates. For other elements this will always be 0 and does
+            not refer to the index in the vector.
+        */
+        virtual void removeElement(VertexElementSemantic semantic, unsigned short index = 0);
+
+		/** Remove all elements. */
+		virtual void removeAllElements(void);
+
+        /** Modify an element in-place, params as addElement.
+	   @remarks
+	   <b>Please read the information in VertexDeclaration about
+	    the importance of ordering and structure for compatibility with older D3D drivers</b>.
+	 */
+        virtual void modifyElement(unsigned short elem_index, unsigned short source, size_t offset, VertexElementType theType,
+            VertexElementSemantic semantic, unsigned short index = 0);
+
+		/** Finds a VertexElement with the given semantic, and index if there is more than
+			one element with the same semantic.
+        @remarks
+            If the element is not found, this method returns null.
+		*/
+		virtual const VertexElement* findElementBySemantic(VertexElementSemantic sem, unsigned short index = 0) const;
+		/** Based on the current elements, gets the size of the vertex for a given buffer source.
+		@param source The buffer binding index for which to get the vertex size.
+		*/
+
+		/** Gets a list of elements which use a given source.
+		@remarks
+			Note that the list of elements is returned by value therefore is separate from
+			the declaration as soon as this method returns.
+		*/
+		virtual VertexElementList findElementsBySource(unsigned short source) const;
+
+		/** Gets the vertex size defined by this declaration for a given source. */
+        virtual size_t getVertexSize(unsigned short source) const;
+		
+		/** Return the index of the next free texture coordinate set which may be added
+			to this declaration.
+		*/
+		virtual unsigned short getNextFreeTextureCoordinate() const;
+
+        /** Clones this declaration. 
+		@param mgr Optional HardwareBufferManager to use for creating the clone
+			(if null, use the current default).
+		*/
+        virtual VertexDeclaration* clone(HardwareBufferManagerBase* mgr = 0) const;
+
+        inline bool operator== (const VertexDeclaration& rhs) const
+        {
+            if (mElementList.size() != rhs.mElementList.size())
+                return false;
+
+            VertexElementList::const_iterator i, iend, rhsi, rhsiend;
+            iend = mElementList.end();
+            rhsiend = rhs.mElementList.end();
+            rhsi = rhs.mElementList.begin();
+            for (i = mElementList.begin(); i != iend && rhsi != rhsiend; ++i, ++rhsi)
+            {
+                if ( !(*i == *rhsi) )
+                    return false;
+            }
+
+            return true;
+        }
+        inline bool operator!= (const VertexDeclaration& rhs) const
+        {
+            return !(*this == rhs);
+        }
+
+    };
+
+	/** Records the state of all the vertex buffer bindings required to provide a vertex declaration
+		with the input data it needs for the vertex elements.
+	@remarks
+		Why do we have this binding list rather than just have VertexElement referring to the
+		vertex buffers direct? Well, in the underlying APIs, binding the vertex buffers to an
+		index (or 'stream') is the way that vertex data is linked, so this structure better
+		reflects the realities of that. In addition, by separating the vertex declaration from
+		the list of vertex buffer bindings, it becomes possible to reuse bindings between declarations
+		and vice versa, giving opportunities to reduce the state changes required to perform rendering.
+	@par
+		Like the other classes in this functional area, these binding maps should be created and
+		destroyed using the HardwareBufferManager.
+	*/
+	class _OgreExport VertexBufferBinding : public VertexDataAlloc
+	{
+	public:
+		/// Defines the vertex buffer bindings used as source for vertex declarations
+		typedef map<unsigned short, HardwareVertexBufferSharedPtr>::type VertexBufferBindingMap;
+	protected:
+		VertexBufferBindingMap mBindingMap;
+		mutable unsigned short mHighIndex;
+	public:
+		/// Constructor, should not be called direct, use HardwareBufferManager::createVertexBufferBinding
+		VertexBufferBinding();
+		virtual ~VertexBufferBinding();
+		/** Set a binding, associating a vertex buffer with a given index.
+		@remarks
+			If the index is already associated with a vertex buffer,
+            the association will be replaced. This may cause the old buffer
+            to be destroyed if nothing else is referring to it.
+			You should assign bindings from 0 and not leave gaps, although you can
+			bind them in any order.
+		*/
+		virtual void setBinding(unsigned short index, const HardwareVertexBufferSharedPtr& buffer);
+		/** Removes an existing binding. */
+		virtual void unsetBinding(unsigned short index);
+
+        /** Removes all the bindings. */
+        virtual void unsetAllBindings(void);
+
+		/// Gets a read-only version of the buffer bindings
+		virtual const VertexBufferBindingMap& getBindings(void) const;
+
+		/// Gets the buffer bound to the given source index
+		virtual const HardwareVertexBufferSharedPtr& getBuffer(unsigned short index) const;
+		/// Gets whether a buffer is bound to the given source index
+		virtual bool isBufferBound(unsigned short index) const;
+
+        virtual size_t getBufferCount(void) const { return mBindingMap.size(); }
+
+		/** Gets the highest index which has already been set, plus 1.
+		@remarks
+			This is to assist in binding the vertex buffers such that there are
+			not gaps in the list.
+		*/
+		virtual unsigned short getNextIndex(void) const { return mHighIndex++; }
+
+        /** Gets the last bound index.
+        */
+        virtual unsigned short getLastBoundIndex(void) const;
+
+        typedef map<ushort, ushort>::type BindingIndexMap;
+
+        /** Check whether any gaps in the bindings.
+        */
+        virtual bool hasGaps(void) const;
+
+        /** Remove any gaps in the bindings.
+        @remarks
+            This is useful if you've removed vertex buffer from this vertex buffer
+            bindings and want to remove any gaps in the bindings. Note, however,
+            that if this bindings is already being used with a VertexDeclaration,
+            you will need to alter that too. This method is mainly useful when
+            reorganising buffers manually.
+        @param
+            bindingIndexMap To be retrieve the binding index map that used to
+            translation old index to new index; will be cleared by this method
+            before fill-in.
+        */
+        virtual void closeGaps(BindingIndexMap& bindingIndexMap);
+
+        /// Returns true if this binding has an element that contains instance data
+        virtual bool hasInstanceData() const;
+
+
+	};
+	/** @} */
+	/** @} */
+
+
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreHeaderPrefix.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreHeaderPrefix.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreHeaderPrefix.h	(revision 148)
@@ -0,0 +1,82 @@
+/*-------------------------------------------------------------------------
+This source file is a 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
+-------------------------------------------------------------------------*/
+// ATTENTION: No header guard as this header is meant to be included
+// multiple times.
+//#ifndef __OgreHeaderPrefix_H__
+//#define __OgreHeaderPrefix_H__
+
+#if OGRE_COMPILER == OGRE_COMPILER_MSVC
+
+// Save warnings state
+#   pragma warning (push)
+// Turn off warnings generated by long std templates
+// This warns about truncation to 255 characters in debug/browse info
+#   pragma warning (disable : 4786)
+
+// Turn off warnings generated by long std templates
+// This warns about truncation to 255 characters in debug/browse info
+#   pragma warning (disable : 4503)
+
+// disable: "<type> needs to have dll-interface to be used by clients'
+// Happens on STL member variables which are not public therefore is ok
+#   pragma warning (disable : 4251)
+
+// disable: "non dll-interface class used as base for dll-interface class"
+// Happens when deriving from Singleton because bug in compiler ignores
+// template export
+#   pragma warning (disable : 4275)
+
+// disable: "C++ Exception Specification ignored"
+// This is because MSVC 6 did not implement all the C++ exception
+// specifications in the ANSI C++ draft.
+#   pragma warning( disable : 4290 )
+
+// disable: "no suitable definition provided for explicit template
+// instantiation request" Occurs in VC7 for no justifiable reason on all
+// #includes of Singleton
+#   pragma warning( disable: 4661)
+
+// disable: deprecation warnings when using CRT calls in VC8
+// These show up on all C runtime lib code in VC8, disable since they clutter
+// the warnings with things we may not be able to do anything about (e.g.
+// generated code from nvparse etc). I doubt very much that these calls
+// will ever be actually removed from VC anyway, it would break too much code.
+#	pragma warning( disable: 4996)
+
+// disable: "conditional expression constant", always occurs on 
+// OGRE_MUTEX_CONDITIONAL when no threading enabled
+#   pragma warning (disable : 4127)
+
+// disable: "unreferenced formal parameter"
+// Many versions of VC have bugs which generate this error in cases where they shouldn't
+#   pragma warning (disable : 4100)
+
+#endif
+
+
+//#endif
+
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreHeaderSuffix.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreHeaderSuffix.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreHeaderSuffix.h	(revision 148)
@@ -0,0 +1,40 @@
+/*-------------------------------------------------------------------------
+This source file is a 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
+-------------------------------------------------------------------------*/
+// ATTENTION: No header guard as this header is meant to be included
+// multiple times.
+//#ifndef __OgreHeaderSuffix_H__
+//#define __OgreHeaderSuffix_H__
+
+#if OGRE_COMPILER == OGRE_COMPILER_MSVC && OGRE_PLATFORM != OGRE_PLATFORM_WINRT
+
+// restore previous warnings settings
+#   pragma warning (pop)
+
+
+#endif
+
+
+//#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreHighLevelGpuProgram.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreHighLevelGpuProgram.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreHighLevelGpuProgram.h	(revision 148)
@@ -0,0 +1,137 @@
+/*
+-----------------------------------------------------------------------------
+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 __HighLevelGpuProgram_H__
+#define __HighLevelGpuProgram_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreGpuProgram.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Resources
+	*  @{
+	*/
+	/** Abstract base class representing a high-level program (a vertex or
+        fragment program).
+    @remarks
+        High-level programs are vertex and fragment programs written in a high-level
+        language such as Cg or HLSL, and as such do not require you to write assembler code
+        like GpuProgram does. However, the high-level program does eventually 
+        get converted (compiled) into assembler and then eventually microcode which is
+        what runs on the GPU. As well as the convenience, some high-level languages like Cg allow
+        you to write a program which will operate under both Direct3D and OpenGL, something
+        which you cannot do with just GpuProgram (which requires you to write 2 programs and
+        use each in a Technique to provide cross-API compatibility). Ogre will be creating
+        a GpuProgram for you based on the high-level program, which is compiled specifically 
+        for the API being used at the time, but this process is transparent.
+    @par
+        You cannot create high-level programs direct - use HighLevelGpuProgramManager instead.
+        Plugins can register new implementations of HighLevelGpuProgramFactory in order to add
+        support for new languages without requiring changes to the core Ogre API. To allow 
+        custom parameters to be set, this class extends StringInterface - the application
+        can query on the available custom parameters and get/set them without having to 
+        link specifically with it.
+    */
+    class _OgreExport HighLevelGpuProgram : public GpuProgram
+    {
+    protected:
+        /// Whether the high-level program (and it's parameter defs) is loaded
+        bool mHighLevelLoaded;
+        /// The underlying assembler program
+        GpuProgramPtr mAssemblerProgram;
+		/// Have we built the name->index parameter map yet?
+		mutable bool mConstantDefsBuilt;
+
+        /// Internal load high-level portion if not loaded
+        virtual void loadHighLevel(void);
+        /// Internal unload high-level portion if loaded
+        virtual void unloadHighLevel(void);
+        /** Internal load implementation, loads just the high-level portion, enough to 
+            get parameters.
+        */
+        virtual void loadHighLevelImpl(void);
+        /** Internal method for creating an appropriate low-level program from this
+        high-level program, must be implemented by subclasses. */
+        virtual void createLowLevelImpl(void) = 0;
+        /// Internal unload implementation, must be implemented by subclasses
+        virtual void unloadHighLevelImpl(void) = 0;
+        /// Populate the passed parameters with name->index map
+        virtual void populateParameterNames(GpuProgramParametersSharedPtr params);
+		/** Build the constant definition map, must be overridden.
+		@note The implementation must fill in the (inherited) mConstantDefs field at a minimum, 
+			and if the program requires that parameters are bound using logical 
+			parameter indexes then the mFloatLogicalToPhysical and mIntLogicalToPhysical
+			maps must also be populated.
+		*/
+		virtual void buildConstantDefinitions() const = 0;
+
+        /** @copydoc Resource::loadImpl */
+        void loadImpl();
+        /** @copydoc Resource::unloadImpl */
+        void unloadImpl();
+    public:
+        /** Constructor, should be used only by factory classes. */
+        HighLevelGpuProgram(ResourceManager* creator, const String& name, ResourceHandle handle,
+            const String& group, bool isManual = false, ManualResourceLoader* loader = 0);
+        ~HighLevelGpuProgram();
+
+
+        /** Creates a new parameters object compatible with this program definition. 
+        @remarks
+            Unlike low-level assembly programs, parameters objects are specific to the
+            program and therefore must be created from it rather than by the 
+            HighLevelGpuProgramManager. This method creates a new instance of a parameters
+            object containing the definition of the parameters this program understands.
+        */
+        GpuProgramParametersSharedPtr createParameters(void);
+        /** @copydoc GpuProgram::_getBindingDelegate */
+        GpuProgram* _getBindingDelegate(void) { return mAssemblerProgram.getPointer(); }
+
+		/** Get the full list of GpuConstantDefinition instances.
+		@note
+		Only available if this parameters object has named parameters.
+		*/
+		const GpuNamedConstants& getConstantDefinitions() const;
+
+		/// Override GpuProgram::getNamedConstants to ensure built
+		const GpuNamedConstants& getNamedConstants() const { return getConstantDefinitions(); }
+
+		virtual size_t calculateSize(void) const;
+
+
+
+
+    };
+	/** @} */
+	/** @} */
+
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreHighLevelGpuProgramManager.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreHighLevelGpuProgramManager.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreHighLevelGpuProgramManager.h	(revision 148)
@@ -0,0 +1,164 @@
+/*
+-----------------------------------------------------------------------------
+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 __HighLevelGpuProgramManager_H__
+#define __HighLevelGpuProgramManager_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreResourceManager.h"
+#include "OgreSingleton.h"
+#include "OgreException.h"
+#include "OgreHighLevelGpuProgram.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Resources
+	*  @{
+	*/
+	/** Interface definition for factories of HighLevelGpuProgram. */
+	class _OgreExport HighLevelGpuProgramFactory : public FactoryAlloc
+	{
+	public:
+        HighLevelGpuProgramFactory() {}
+        virtual ~HighLevelGpuProgramFactory();
+		/// Get the name of the language this factory creates programs for
+		virtual const String& getLanguage(void) const = 0;
+        virtual HighLevelGpuProgram* create(ResourceManager* creator, 
+            const String& name, ResourceHandle handle,
+            const String& group, bool isManual, ManualResourceLoader* loader) = 0;
+		virtual void destroy(HighLevelGpuProgram* prog) = 0;
+	};
+	/** This ResourceManager manages high-level vertex and fragment programs. 
+	@remarks
+		High-level vertex and fragment programs can be used instead of assembler programs
+		as managed by GpuProgramManager; however they typically result in a GpuProgram
+		being created as a derivative of the high-level program. High-level programs are
+		easier to write, and can often be API-independent, unlike assembler programs. 
+	@par
+		This class not only manages the programs themselves, it also manages the factory
+		classes which allow the creation of high-level programs using a variety of high-level
+		syntaxes. Plugins can be created which register themselves as high-level program
+		factories and as such the engine can be extended to accept virtually any kind of
+		program provided a plugin is written.
+	*/
+	class _OgreExport HighLevelGpuProgramManager 
+		: public ResourceManager, public Singleton<HighLevelGpuProgramManager>
+	{
+	public:
+		typedef map<String, HighLevelGpuProgramFactory*>::type FactoryMap;
+	protected:
+		/// Factories capable of creating HighLevelGpuProgram instances
+		FactoryMap mFactories;
+
+		/// Factory for dealing with programs for languages we can't create
+		HighLevelGpuProgramFactory* mNullFactory;
+		/// Factory for unified high-level programs
+		HighLevelGpuProgramFactory* mUnifiedFactory;
+
+		HighLevelGpuProgramFactory* getFactory(const String& language);
+
+        /// @copydoc ResourceManager::createImpl
+        Resource* createImpl(const String& name, ResourceHandle handle, 
+            const String& group, bool isManual, ManualResourceLoader* loader,
+            const NameValuePairList* createParams);
+	public:
+		HighLevelGpuProgramManager();
+		~HighLevelGpuProgramManager();
+		/** Add a new factory object for high-level programs of a given language. */
+		void addFactory(HighLevelGpuProgramFactory* factory);
+		/** Remove a factory object for high-level programs of a given language. */
+		void removeFactory(HighLevelGpuProgramFactory* factory);
+
+		/** Returns whether a given high-level language is supported. */
+		bool isLanguageSupported(const String& lang);
+
+		/// Get a resource by name
+		/// @see ResourceManager::getResourceByName
+		HighLevelGpuProgramPtr getByName(const String& name, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME);
+
+        /** Create a new, unloaded HighLevelGpuProgram. 
+		@par
+			This method creates a new program of the type specified as the second and third parameters.
+			You will have to call further methods on the returned program in order to 
+			define the program fully before you can load it.
+		@param name The identifying name of the program
+        @param groupName The name of the resource group which this program is
+            to be a member of
+		@param language Code of the language to use (e.g. "cg")
+		@param gptype The type of program to create
+		*/
+		HighLevelGpuProgramPtr createProgram(
+			const String& name, const String& groupName, 
+            const String& language, GpuProgramType gptype);
+
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static HighLevelGpuProgramManager& getSingleton(void);
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static HighLevelGpuProgramManager* getSingletonPtr(void);
+
+
+	};
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreImage.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreImage.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreImage.h	(revision 148)
@@ -0,0 +1,510 @@
+/*
+-----------------------------------------------------------------------------
+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 _Image_H__
+#define _Image_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreCommon.h"
+#include "OgrePixelFormat.h"
+#include "OgreDataStream.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Image
+	*  @{
+	*/
+
+    enum ImageFlags
+    {
+        IF_COMPRESSED = 0x00000001,
+        IF_CUBEMAP    = 0x00000002,
+        IF_3D_TEXTURE = 0x00000004
+    };
+    /** Class representing an image file.
+        @remarks
+            The Image class usually holds uncompressed image data and is the
+            only object that can be loaded in a texture. Image  objects handle 
+            image data decoding themselves by the means of locating the correct 
+            Codec object for each data type.
+        @par
+            Typically, you would want to use an Image object to load a texture
+            when extra processing needs to be done on an image before it is
+            loaded or when you want to blit to an existing texture.
+    */
+	class _OgreExport Image : public ImageAlloc
+    {
+    public:
+    	typedef Ogre::Box Box;
+    	typedef Ogre::Rect Rect;
+    public:
+        /** Standard constructor.
+        */
+        Image();
+        /** Copy-constructor - copies all the data from the target image.
+        */
+        Image( const Image &img );
+
+        /** Standard destructor.
+        */
+        virtual ~Image();
+
+        /** Assignment operator - copies all the data from the target image.
+        */
+        Image & operator = ( const Image & img );
+
+        /** Flips (mirrors) the image around the Y-axis. 
+            @remarks
+                An example of an original and flipped image:
+                <pre>                
+                originalimg
+                00000000000
+                00000000000
+                00000000000
+                00000000000
+                00000000000
+                ------------> flip axis
+                00000000000
+                00000000000
+                00000000000
+                00000000000
+                00000000000
+                originalimg
+                </pre>
+        */
+        Image & flipAroundY();
+
+        /** Flips (mirrors) the image around the X-axis.
+            @remarks
+                An example of an original and flipped image:
+                <pre>
+                        flip axis
+                            |
+                originalimg|gmilanigiro
+                00000000000|00000000000
+                00000000000|00000000000
+                00000000000|00000000000
+                00000000000|00000000000
+                00000000000|00000000000
+                </pre>
+        */                 
+        Image & flipAroundX();
+
+        /** Stores a pointer to raw data in memory. The pixel format has to be specified.
+            @remarks
+                This method loads an image into memory held in the object. The 
+                pixel format will be either greyscale or RGB with an optional
+                Alpha component.
+                The type can be determined by calling getFormat().             
+            @note
+				Whilst typically your image is likely to be a simple 2D image,
+				you can define complex images including cube maps, volume maps,
+				and images including custom mip levels. The layout of the 
+				internal memory should be:
+				<ul><li>face 0, mip 0 (top), width x height (x depth)</li>
+				<li>face 0, mip 1, width/2 x height/2 (x depth/2)</li>
+				<li>face 0, mip 2, width/4 x height/4 (x depth/4)</li>
+				<li>.. remaining mips for face 0 .. </li>
+				<li>face 1, mip 0 (top), width x height (x depth)</li
+				<li>.. and so on. </li>
+				</ul>
+				Of course, you will never have multiple faces (cube map) and
+				depth too.
+			@param data
+                The data pointer
+            @param width
+				Width of image
+            @param height
+				Height of image
+			@param depth
+                Image Depth (in 3d images, numbers of layers, otherwise 1)
+            @param format
+				Pixel Format
+            @param autoDelete
+                If memory associated with this buffer is to be destroyed
+				with the Image object. Note: it's important that if you set
+				this option to true, that you allocated the memory using OGRE_ALLOC_T
+				with a category of MEMCATEGORY_GENERAL to ensure the freeing of memory 
+				matches up.
+			@param numFaces
+				The number of faces the image data has inside (6 for cubemaps, 1 otherwise)
+            @param numMipMaps
+                The number of mipmaps the image data has inside
+            @note
+                 The memory associated with this buffer is NOT destroyed with the
+                 Image object, unless autoDelete is set to true.
+			@remarks 
+				The size of the buffer must be numFaces*PixelUtil::getMemorySize(width, height, depth, format)
+         */
+		Image& loadDynamicImage( uchar* data, uint32 width, uint32 height,
+							uint32 depth,
+							 PixelFormat format, bool autoDelete = false, 
+							 size_t numFaces = 1, uint8 numMipMaps = 0);
+		
+		/** Stores a pointer to raw data in memory. The pixel format has to be specified.
+            @remarks
+                This method loads an image into memory held in the object. The 
+                pixel format will be either greyscale or RGB with an optional
+                Alpha component.
+                The type can be determined by calling getFormat().             
+            @note
+				Whilst typically your image is likely to be a simple 2D image,
+				you can define complex images including cube maps
+				and images including custom mip levels. The layout of the 
+				internal memory should be:
+				<ul><li>face 0, mip 0 (top), width x height</li>
+				<li>face 0, mip 1, width/2 x height/2 </li>
+				<li>face 0, mip 2, width/4 x height/4 </li>
+				<li>.. remaining mips for face 0 .. </li>
+				<li>face 1, mip 0 (top), width x height (x depth)</li
+				<li>.. and so on. </li>
+				</ul>
+				Of course, you will never have multiple faces (cube map) and
+				depth too.
+            @param data
+                The data pointer
+            @param width
+				Width of image
+            @param height
+				Height of image
+            @param format
+				Pixel Format
+            @note
+                 The memory associated with this buffer is NOT destroyed with the
+                 Image object.
+			@remarks This function is deprecated; one should really use the
+				Image::loadDynamicImage(data, width, height, depth, format, ...) to be compatible
+				with future Ogre versions.
+         */
+ 		Image& loadDynamicImage( uchar* data, uint32 width,
+								 uint32 height, PixelFormat format)
+		{
+			return loadDynamicImage(data, width, height, 1, format);
+		}
+		/** Loads raw data from a stream. See the function
+			loadDynamicImage for a description of the parameters.
+			@remarks 
+				The size of the buffer must be numFaces*PixelUtil::getMemorySize(width, height, depth, format)
+            @note
+				Whilst typically your image is likely to be a simple 2D image,
+				you can define complex images including cube maps
+				and images including custom mip levels. The layout of the 
+				internal memory should be:
+				<ul><li>face 0, mip 0 (top), width x height (x depth)</li>
+				<li>face 0, mip 1, width/2 x height/2 (x depth/2)</li>
+				<li>face 0, mip 2, width/4 x height/4 (x depth/4)</li>
+				<li>.. remaining mips for face 0 .. </li>
+				<li>face 1, mip 0 (top), width x height (x depth)</li
+				<li>.. and so on. </li>
+				</ul>
+				Of course, you will never have multiple faces (cube map) and
+				depth too.
+        */
+        Image & loadRawData( 
+            DataStreamPtr& stream, 
+            uint32 width, uint32 height, uint32 depth,
+            PixelFormat format,
+			size_t numFaces = 1, size_t numMipMaps = 0);
+        /** Loads raw data from a stream. The pixel format has to be specified. 
+			@remarks This function is deprecated; one should really use the
+				Image::loadRawData(stream, width, height, depth, format, ...) to be compatible
+				with future Ogre versions.
+            @note
+				Whilst typically your image is likely to be a simple 2D image,
+				you can define complex images including cube maps
+				and images including custom mip levels. The layout of the 
+				internal memory should be:
+				<ul><li>face 0, mip 0 (top), width x height</li>
+				<li>face 0, mip 1, width/2 x height/2 </li>
+				<li>face 0, mip 2, width/4 x height/4 </li>
+				<li>.. remaining mips for face 0 .. </li>
+				<li>face 1, mip 0 (top), width x height (x depth)</li
+				<li>.. and so on. </li>
+				</ul>
+				Of course, you will never have multiple faces (cube map) and
+				depth too.
+        */
+        Image & loadRawData( 
+            DataStreamPtr& stream, 
+            uint32 width, uint32 height,
+            PixelFormat format )
+		{
+			return loadRawData(stream, width, height, 1, format);
+		}
+
+        /** Loads an image file.
+            @remarks
+                This method loads an image into memory. Any format for which 
+				an associated ImageCodec is registered can be loaded. 
+				This can include complex formats like DDS with embedded custom 
+				mipmaps, cube faces and volume textures.
+                The type can be determined by calling getFormat().             
+            @param
+                filename Name of an image file to load.
+            @param
+                groupName Name of the resource group to search for the image
+            @note
+                The memory associated with this buffer is destroyed with the
+                Image object.
+        */
+        Image & load( const String& filename, const String& groupName );
+
+        /** Loads an image file from a stream.
+            @remarks
+                This method works in the same way as the filename-based load 
+                method except it loads the image from a DataStream object. 
+				This DataStream is expected to contain the 
+                encoded data as it would be held in a file. 
+                Any format for which an associated ImageCodec is registered 
+				can be loaded. 
+				This can include complex formats like DDS with embedded custom 
+				mipmaps, cube faces and volume textures.
+                The type can be determined by calling getFormat().             
+            @param
+                stream The source data.
+            @param
+                type The type of the image. Used to decide what decompression
+                codec to use. Can be left blank if the stream data includes
+				a header to identify the data.
+            @see
+                Image::load( const String& filename )
+        */
+		Image & load(DataStreamPtr& stream, const String& type = StringUtil::BLANK );
+
+		/** Utility method to combine 2 separate images into this one, with the first
+		image source supplying the RGB channels, and the second image supplying the 
+		alpha channel (as luminance or separate alpha). 
+		@param rgbFilename Filename of image supplying the RGB channels (any alpha is ignored)
+		@param alphaFilename Filename of image supplying the alpha channel. If a luminance image the
+			single channel is used directly, if an RGB image then the values are
+			converted to greyscale.
+		@param groupName The resource group from which to load the images
+		@param format The destination format
+		*/
+		Image & loadTwoImagesAsRGBA(const String& rgbFilename, const String& alphaFilename,
+			const String& groupName, PixelFormat format = PF_BYTE_RGBA);
+
+		/** Utility method to combine 2 separate images into this one, with the first
+		image source supplying the RGB channels, and the second image supplying the 
+		alpha channel (as luminance or separate alpha). 
+		@param rgbStream Stream of image supplying the RGB channels (any alpha is ignored)
+		@param alphaStream Stream of image supplying the alpha channel. If a luminance image the
+			single channel is used directly, if an RGB image then the values are
+			converted to greyscale.
+		@param format The destination format
+		@param rgbType The type of the RGB image. Used to decide what decompression
+			codec to use. Can be left blank if the stream data includes
+			a header to identify the data.
+		@param alphaType The type of the alpha image. Used to decide what decompression
+			codec to use. Can be left blank if the stream data includes
+			a header to identify the data.
+		*/
+		Image & loadTwoImagesAsRGBA(DataStreamPtr& rgbStream, DataStreamPtr& alphaStream, PixelFormat format = PF_BYTE_RGBA,
+			const String& rgbType = StringUtil::BLANK, const String& alphaType = StringUtil::BLANK);
+
+		/** Utility method to combine 2 separate images into this one, with the first
+			image source supplying the RGB channels, and the second image supplying the 
+			alpha channel (as luminance or separate alpha). 
+		@param rgb Image supplying the RGB channels (any alpha is ignored)
+		@param alpha Image supplying the alpha channel. If a luminance image the
+			single channel is used directly, if an RGB image then the values are
+			converted to greyscale.
+		@param format The destination format
+		*/
+		Image & combineTwoImagesAsRGBA(const Image& rgb, const Image& alpha, PixelFormat format = PF_BYTE_RGBA);
+
+        
+        /** Save the image as a file. 
+		@remarks
+			Saving and loading are implemented by back end (sometimes third 
+			party) codecs.  Implemented saving functionality is more limited
+			than loading in some cases.	Particularly DDS file format support 
+			is currently limited to true colour or single channel float32, 
+			square, power of two textures with no mipmaps.  Volumetric support
+			is currently limited to DDS files.
+		*/
+        void save(const String& filename);
+
+		/** Encode the image and return a stream to the data. 
+			@param formatextension An extension to identify the image format
+				to encode into, e.g. "jpg" or "png"
+		*/
+		DataStreamPtr encode(const String& formatextension);
+
+		/** Returns a pointer to the internal image buffer.
+		@remarks
+			Be careful with this method. You will almost certainly
+			prefer to use getPixelBox, especially with complex images
+			which include many faces or custom mipmaps.
+        */
+        uchar* getData(void);
+
+        /** Returns a const pointer to the internal image buffer.
+		@remarks
+			Be careful with this method. You will almost certainly
+			prefer to use getPixelBox, especially with complex images
+			which include many faces or custom mipmaps.
+        */
+        const uchar * getData() const;       
+
+        /** Returns the size of the data buffer.
+        */
+        size_t getSize() const;
+
+        /** Returns the number of mipmaps contained in the image.
+        */
+        uint8 getNumMipmaps() const;
+
+        /** Returns true if the image has the appropriate flag set.
+        */
+        bool hasFlag(const ImageFlags imgFlag) const;
+
+        /** Gets the width of the image in pixels.
+        */
+        uint32 getWidth(void) const;
+
+        /** Gets the height of the image in pixels.
+        */
+        uint32 getHeight(void) const;
+
+        /** Gets the depth of the image.
+        */
+        uint32 getDepth(void) const;
+		
+		/** Get the number of faces of the image. This is usually 6 for a cubemap, and
+		    1 for a normal image.
+		*/
+		size_t getNumFaces(void) const;
+
+        /** Gets the physical width in bytes of each row of pixels.
+        */
+        size_t getRowSpan(void) const;
+
+        /** Returns the image format.
+        */
+        PixelFormat getFormat() const;
+
+        /** Returns the number of bits per pixel.
+        */
+        uchar getBPP() const;
+
+        /** Returns true if the image has an alpha component.
+        */
+        bool getHasAlpha() const;
+		
+		/** Does gamma adjustment.
+            @note
+                Basic algo taken from Titan Engine, copyright (c) 2000 Ignacio 
+                Castano Iguado
+        */
+        static void applyGamma( uchar *buffer, Real gamma, size_t size, uchar bpp );
+
+        /**
+         * Get colour value from a certain location in the image. The z coordinate
+         * is only valid for cubemaps and volume textures. This uses the first (largest)
+         * mipmap.
+         */
+        ColourValue getColourAt(size_t x, size_t y, size_t z) const;
+        
+        /**
+         * Set colour value at a certain location in the image. The z coordinate
+         * is only valid for cubemaps and volume textures. This uses the first (largest)
+         * mipmap.
+         */
+        void setColourAt(ColourValue const &cv, size_t x, size_t y, size_t z);
+
+        /**
+         * Get a PixelBox encapsulating the image data of a mipmap
+         */
+        PixelBox getPixelBox(size_t face = 0, size_t mipmap = 0) const;
+
+		/// Delete all the memory held by this image, if owned by this image (not dynamic)
+		void freeMemory();
+
+		enum Filter
+		{
+			FILTER_NEAREST,
+			FILTER_LINEAR,
+			FILTER_BILINEAR,
+			FILTER_BOX,
+			FILTER_TRIANGLE,
+			FILTER_BICUBIC
+		};
+		/** Scale a 1D, 2D or 3D image volume. 
+			@param 	src			PixelBox containing the source pointer, dimensions and format
+			@param 	dst			PixelBox containing the destination pointer, dimensions and format
+			@param 	filter		Which filter to use
+			@remarks 	This function can do pixel format conversion in the process.
+			@note	dst and src can point to the same PixelBox object without any problem
+		*/
+		static void scale(const PixelBox &src, const PixelBox &dst, Filter filter = FILTER_BILINEAR);
+		
+		/** Resize a 2D image, applying the appropriate filter. */
+		void resize(ushort width, ushort height, Filter filter = FILTER_BILINEAR);
+		
+        /// Static function to calculate size in bytes from the number of mipmaps, faces and the dimensions
+        static size_t calculateSize(size_t mipmaps, size_t faces, uint32 width, uint32 height, uint32 depth, PixelFormat format);
+
+		/// Static function to get an image type string from a stream via magic numbers
+		static String getFileExtFromMagic(DataStreamPtr stream);
+
+    protected:
+        /// The width of the image in pixels
+		uint32 mWidth;
+        /// The height of the image in pixels
+		uint32 mHeight;
+        /// The depth of the image
+		uint32 mDepth;
+        /// The size of the image buffer
+		size_t mBufSize;
+        /// The number of mipmaps the image contains
+		uint8 mNumMipmaps;
+        /// Image specific flags.
+		int mFlags;
+
+        /// The pixel format of the image
+		PixelFormat mFormat;
+
+        /// The number of bytes per pixel
+		uchar mPixelSize;
+		uchar* mBuffer;
+
+		/// A bool to determine if we delete the buffer or the calling app does
+		bool mAutoDelete;
+    };
+
+	typedef vector<Image*>::type ImagePtrList;
+	typedef vector<const Image*>::type ConstImagePtrList;
+
+	/** @} */
+	/** @} */
+
+} // namespace
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreImageCodec.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreImageCodec.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreImageCodec.h	(revision 148)
@@ -0,0 +1,89 @@
+/*
+-----------------------------------------------------------------------------
+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 _ImageCodec_H__
+#define _ImageCodec_H__
+
+#include "OgreCodec.h"
+#include "OgrePixelFormat.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Image
+	*  @{
+	*/
+	/** Codec specialized in images.
+        @remarks
+            The users implementing subclasses of ImageCodec are required to return
+            a valid pointer to a ImageData class from the decode(...) function.
+    */
+    class _OgreExport ImageCodec : public Codec
+    {
+    public:
+        virtual ~ImageCodec();
+        /** Codec return class for images. Has information about the size and the
+            pixel format of the image. */
+        class _OgrePrivate ImageData : public Codec::CodecData
+        {
+        public:
+			ImageData():
+				height(0), width(0), depth(1), size(0),
+				num_mipmaps(0), flags(0), format(PF_UNKNOWN)
+			{
+			}
+            uint32 height;
+            uint32 width;
+			uint32 depth;
+            size_t size;
+            
+            uint8 num_mipmaps;
+            uint flags;
+
+            PixelFormat format;
+
+        public:
+            String dataType() const
+            {
+                return "ImageData";
+            }
+        };
+
+    public:
+        String getDataType() const
+        {
+            return "ImageData";
+        }
+    };
+
+	/** @} */
+	/** @} */
+} // namespace
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreInstanceBatch.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreInstanceBatch.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreInstanceBatch.h	(revision 148)
@@ -0,0 +1,364 @@
+/*
+-----------------------------------------------------------------------------
+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 __InstanceBatch_H__
+#define __InstanceBatch_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreRenderOperation.h"
+#include "OgreRenderable.h"
+#include "OgreMovableObject.h"
+#include "OgreMesh.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre
+{
+    /** \addtogroup Core
+    *  @{
+    */
+    /** \addtogroup Scene
+    *  @{
+    */
+
+    /** InstanceBatch forms part of the new Instancing system
+        This is an abstract class that must be derived to implement different instancing techniques
+        (@see InstanceManager::InstancingTechnique)
+        OGRE wasn't truly thought for instancing. OGRE assumes that either:
+            a. One MovableObject -> No Renderable
+            b. One MovableObject -> One Renderable
+            c. One MovableObject -> Many Renderable.
+        However, instances work on reverse: Many MovableObject have the same Renderable.
+        <b>Instancing is already difficult to cull by a CPU</b>, but the main drawback from this assumption
+        is that it makes it even harder to take advantage from OGRE's culling capabilities
+        (i.e. @see OctreeSceneManager)
+    @par
+        To workaround this problem, InstanceBatch updates on almost every frame,
+        growing the bounding box to fit all instances that are not being culled individually.
+        This helps by avoiding a huge bbox that may cover the whole scene, which decreases shadow
+        quality considerably (as it is seen as large shadow receiver)
+        Furthermore, if no individual instance is visible, the InstanceBatch switches it's visibility
+        (@see MovableObject::setVisible) to avoid sending this Renderable to the GPU. This happens because
+        even when no individual instance is visible, their merged bounding box may cause OGRE to think
+        the batch is visible (i.e. the camera is looking between object A & B, but A & B aren't visible)
+    @par
+        <b>As it happens with instancing in general, all instanced entities from the same batch will share
+        the same textures and materials</b>
+    @par
+        Each InstanceBatch preallocates a fixed amount of mInstancesPerBatch instances once it's been
+        built (@see build, @see buildFrom).
+        @see createInstancedEntity and @see removeInstancedEntity on how to retrieve those instances
+        remove them from scene.
+        Note that, on GPU side, removing an instance from scene doesn't save GPU cycles on what
+        respects vertex shaders, but saves a little fillrate and pixel shaders; unless all instances
+        are removed, which saves GPU.
+        For more information, @see InstancedEntity
+        For information on how Ogre manages multiple Instance batches, @see InstanceManager
+
+    @remarks
+        Design discussion webpage
+    @author
+        Matias N. Goldberg ("dark_sylinc")
+    @version
+        1.0
+    */
+    class _OgreExport InstanceBatch : public Renderable, public MovableObject
+    {
+    public:
+        typedef vector<InstancedEntity*>::type  InstancedEntityVec;
+        typedef vector<Vector4>::type           CustomParamsVec;
+    protected:
+        RenderOperation     mRenderOperation;
+        size_t              mInstancesPerBatch;
+
+        InstanceManager     *mCreator;
+
+        MaterialPtr         mMaterial;
+
+        MeshPtr             mMeshReference;
+        Mesh::IndexMap const *mIndexToBoneMap;
+
+        //InstancedEntities are all allocated at build time and kept as "unused"
+        //when they're requested, they're removed from there when requested,
+        //and put back again when they're no longer needed
+        //Note each InstancedEntity has a unique ID ranging from [0; mInstancesPerBatch)
+        InstancedEntityVec  mInstancedEntities;
+        InstancedEntityVec  mUnusedEntities;
+
+        ///@see InstanceManager::setNumCustomParams(). Because this may not even be used,
+        ///our implementations keep the params separate from the InstancedEntity to lower
+        ///the memory overhead. They default to Vector4::ZERO
+        CustomParamsVec		mCustomParams;
+
+        /// This bbox contains all (visible) instanced entities
+        AxisAlignedBox      mFullBoundingBox;
+        Real                mBoundingRadius;
+        bool                mBoundsDirty;
+        bool                mBoundsUpdated; //Set to false by derived classes that need it
+        Camera              *mCurrentCamera;
+
+        unsigned short      mMaterialLodIndex;
+
+        bool                mDirtyAnimation; //Set to false at start of each _updateRenderQueue
+
+        /// False if a technique doesn't support skeletal animation
+        bool                mTechnSupportsSkeletal;
+
+        /// Cached distance to last camera for getSquaredViewDepth
+        mutable Real mCachedCameraDist;
+        /// The camera for which the cached distance is valid
+        mutable const Camera *mCachedCamera;
+
+        /// Tells that the list of entity instances with shared transforms has changed
+        bool mTransformSharingDirty;
+
+        /// When true remove the memory of the VertexData we've created because no one else will
+        bool mRemoveOwnVertexData;
+        /// When true remove the memory of the IndexData we've created because no one else will
+        bool mRemoveOwnIndexData;
+
+        virtual void setupVertices( const SubMesh* baseSubMesh ) = 0;
+        virtual void setupIndices( const SubMesh* baseSubMesh ) = 0;
+        virtual void createAllInstancedEntities(void);
+        virtual void deleteAllInstancedEntities(void);
+        virtual void deleteUnusedInstancedEntities(void);
+        /// Creates a new InstancedEntity instance
+        virtual InstancedEntity* generateInstancedEntity(size_t num);
+
+        /** Takes an array of 3x4 matrices and makes it camera relative. Note the second argument
+            takes number of floats in the array, not number of matrices. Assumes mCachedCamera
+            contains the camera which is about to be rendered to.
+        */
+        void makeMatrixCameraRelative3x4( float *mat3x4, size_t numFloats );
+
+        /// Returns false on errors that would prevent building this batch from the given submesh
+        virtual bool checkSubMeshCompatibility( const SubMesh* baseSubMesh );
+
+        void updateVisibility(void);
+
+        /** @see _defragmentBatch */
+        void defragmentBatchNoCull( InstancedEntityVec &usedEntities, CustomParamsVec &usedParams );
+
+        /** @see _defragmentBatch
+            This one takes the entity closest to the minimum corner of the bbox, then starts
+            gathering entities closest to this entity. There might be much better algorithms (i.e.
+            involving space partition), but this one is simple and works well enough
+        */
+        void defragmentBatchDoCull( InstancedEntityVec &usedEntities, CustomParamsVec &usedParams );
+
+    public:
+        InstanceBatch( InstanceManager *creator, MeshPtr &meshReference, const MaterialPtr &material,
+                       size_t instancesPerBatch, const Mesh::IndexMap *indexToBoneMap,
+                       const String &batchName );
+        virtual ~InstanceBatch();
+
+        MeshPtr& _getMeshRef() { return mMeshReference; }
+
+        /** Raises an exception if trying to change it after being built
+        */
+        void _setInstancesPerBatch( size_t instancesPerBatch );
+
+        const Mesh::IndexMap* _getIndexToBoneMap() const { return mIndexToBoneMap; }
+
+        /** Returns true if this technique supports skeletal animation
+        @remarks
+            A virtual function could have been used, but using a simple variable overridden
+            by the derived class is faster than virtual call overhead. And both are clean
+            ways of implementing it.
+        */
+        bool _supportsSkeletalAnimation() const { return mTechnSupportsSkeletal; }
+
+        /** @see InstanceManager::updateDirtyBatches */
+        void _updateBounds(void);
+
+        /** Some techniques have a limit on how many instances can be done.
+            Sometimes even depends on the material being used.
+        @par
+            Note this is a helper function, as such it takes a submesh base to compute
+            the parameters, instead of using the object's own. This allows
+            querying for a technique without requiering to actually build it.
+        @param baseSubMesh The base submesh that will be using to build it.
+        @param flags Flags to pass to the InstanceManager. @see InstanceManagerFlags
+        @return The max instances limit
+        */
+        virtual size_t calculateMaxNumInstances( const SubMesh *baseSubMesh, uint16 flags ) const = 0;
+
+        /** Constructs all the data needed to use this batch, as well as the
+            InstanceEntities. Placed here because in the constructor virtual
+            tables may not have been yet filled.
+        @param baseSubMesh A sub mesh which the instances will be based upon from.
+        @remarks
+            Call this only ONCE. This is done automatically by Ogre::InstanceManager
+            Caller is responsable for freeing buffers in this RenderOperation
+            Buffers inside the RenderOp may be null if the built failed.
+        @return
+            A render operation which is very useful to pass to other InstanceBatches
+            (@see buildFrom) so that they share the same vertex buffers and indices,
+            when possible
+        */
+        virtual RenderOperation build( const SubMesh* baseSubMesh );
+
+        /** Instancing consumes significantly more GPU memory than regular rendering
+            methods. However, multiple batches can share most, if not all, of the
+            vertex & index buffers to save memory.
+            Derived classes are free to overload this method to manipulate what to
+            reference from Render Op.
+            For example, Hardware based instancing uses it's own vertex buffer for the
+            last source binding, but shares the other sources.
+        @param renderOperation The RenderOp to reference.
+        @remarks
+            Caller is responsable for freeing buffers passed as input arguments
+            This function replaces the need to call build()
+        */
+        virtual void buildFrom( const SubMesh *baseSubMesh, const RenderOperation &renderOperation );
+
+        const Ogre::MeshPtr& _getMeshReference(void) const { return mMeshReference; }
+
+        /** @return true if it can not create more InstancedEntities
+            (Num InstancedEntities == mInstancesPerBatch)
+        */
+        bool isBatchFull(void) const { return mUnusedEntities.empty(); }
+
+        /** Returns true if it no instanced entity has been requested or all of them have been removed
+        */
+        bool isBatchUnused(void) const { return mUnusedEntities.size() == mInstancedEntities.size(); }
+
+        /** Fills the input vector with the instances that are currently being used or were requested.
+            Used for defragmentation, @see InstanceManager::defragmentBatches
+        */
+		void getInstancedEntitiesInUse( InstancedEntityVec &outEntities, CustomParamsVec &outParams );
+
+        /** @see InstanceManager::defragmentBatches
+            This function takes InstancedEntities and pushes back all entities it can fit here
+            Extra entities in mUnusedEntities are destroyed
+            (so that used + unused = mInstancedEntities.size())
+        @param optimizeCulling true will call the DoCull version, false the NoCull
+        @param usedEntities Array of InstancedEntities to parent with this batch. Those reparented
+            are removed from this input vector
+        @param usedParams Array of Custom parameters correlated with the InstancedEntities in usedEntities.
+			They follow the fate of the entities in that vector.
+		@remarks:
+			This function assumes caller holds data to mInstancedEntities! Otherwise
+			you can get memory leaks. Don't call this directly if you don't know what you're doing!
+		*/
+		void _defragmentBatch( bool optimizeCulling, InstancedEntityVec &usedEntities,
+								CustomParamsVec &usedParams );
+
+		/** @see InstanceManager::_defragmentBatchDiscard
+			Destroys unused entities and clears the mInstancedEntity container which avoids leaving
+			dangling pointers from reparented InstancedEntities
+			Usually called before deleting this pointer. Don't call directly!
+		*/
+		void _defragmentBatchDiscard(void);
+
+		/** Called by InstancedEntity(s) to tell us we need to update the bounds
+			(we touch the SceneNode so the SceneManager aknowledges such change)
+        */
+		virtual void _boundsDirty(void);
+
+		/** Tells this batch to stop updating animations, positions, rotations, and display
+			all it's active instances. Currently only InstanceBatchHW & InstanceBatchHW_VTF support it.
+			This option makes the batch behave pretty much like Static Geometry, but with the GPU RAM
+			memory advantages (less VRAM, less bandwidth) and not LOD support. Very useful for
+			billboards of trees, repeating vegetation, etc.
+			@remarks
+				This function moves a lot of processing time from the CPU to the GPU. If the GPU
+				is already a bottleneck, you may see a decrease in performance instead!
+				Call this function again (with bStatic=true) if you've made a change to an
+				InstancedEntity and wish this change to take effect.
+				Be sure to call this after you've set all your instances
+				@see InstanceBatchHW::setStaticAndUpdate
+		*/
+		virtual void setStaticAndUpdate( bool bStatic )		{}
+
+		/** Returns true if this batch was set as static. @see setStaticAndUpdate
+		*/
+		virtual bool isStatic() const						{ return false; }
+
+		/** Returns a pointer to a new InstancedEntity ready to use
+			Note it's actually preallocated, so no memory allocation happens at
+			this point.
+			@remarks
+				Returns NULL if all instances are being used
+        */
+		InstancedEntity* createInstancedEntity();
+
+		/** Removes an InstancedEntity from the scene retrieved with
+			getNewInstancedEntity, putting back into a queue
+			@remarks
+				Throws an exception if the instanced entity wasn't created by this batch
+				Removed instanced entities save little CPU time, but _not_ GPU
+        */
+		void removeInstancedEntity( InstancedEntity *instancedEntity );
+
+		/** Tells whether world bone matrices need to be calculated.
+			This does not include bone matrices which are calculated regardless
+        */
+		virtual bool useBoneWorldMatrices() const { return true; }
+
+		/** Tells that the list of entity instances with shared transforms has changed */
+		void _markTransformSharingDirty() { mTransformSharingDirty = true; }
+
+		/** @see InstancedEntity::setCustomParam */
+		void _setCustomParam( InstancedEntity *instancedEntity, unsigned char idx, const Vector4 &newParam );
+
+		/** @see InstancedEntity::getCustomParam */
+		const Vector4& _getCustomParam( InstancedEntity *instancedEntity, unsigned char idx );
+
+		//Renderable overloads
+        /** @copydoc Renderable::getMaterial. */
+		const MaterialPtr& getMaterial(void) const		{ return mMaterial; }
+        /** @copydoc Renderable::getRenderOperation. */
+		void getRenderOperation( RenderOperation& op )	{ op = mRenderOperation; }
+
+        /** @copydoc Renderable::getSquaredViewDepth. */
+		Real getSquaredViewDepth( const Camera* cam ) const;
+        /** @copydoc Renderable::getLights. */
+        const LightList& getLights( void ) const;
+        /** @copydoc Renderable::getTechnique. */
+		Technique* getTechnique(void) const;
+
+        /** @copydoc MovableObject::getMovableType. */
+		const String& getMovableType(void) const;
+        /** @copydoc MovableObject::_notifyCurrentCamera. */
+		void _notifyCurrentCamera( Camera* cam );
+        /** @copydoc MovableObject::getBoundingBox. */
+		const AxisAlignedBox& getBoundingBox(void) const;
+        /** @copydoc MovableObject::getBoundingRadius. */
+		Real getBoundingRadius(void) const;
+
+		virtual void _updateRenderQueue(RenderQueue* queue);
+		void visitRenderables( Renderable::Visitor* visitor, bool debugRenderables = false );
+
+        // resolve ambiguity of get/setUserAny due to inheriting from Renderable and MovableObject
+        using Renderable::getUserAny;
+        using Renderable::setUserAny;
+	};
+} // namespace Ogre
+
+#include "OgreHeaderSuffix.h"
+
+#endif // __InstanceBatch_H__
Index: /ogre_src_v1-9-0/OgreMain/include/OgreInstanceBatchHW.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreInstanceBatchHW.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreInstanceBatchHW.h	(revision 148)
@@ -0,0 +1,110 @@
+/*
+-----------------------------------------------------------------------------
+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 __InstanceBatchHW_H__
+#define __InstanceBatchHW_H__
+
+#include "OgreInstanceBatch.h"
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Scene
+	*  @{
+	*/
+
+	/** This is technique requires true instancing hardware support.
+		Basically it creates a cloned vertex buffer from the original, with an extra buffer containing
+		3 additional TEXCOORDS (12 bytes) repeated as much as the instance count.
+		That will be used for each instance data.
+		@par
+		The main advantage of this technique is that it's <u>VERY</u> fast; but it doesn't support
+		skeletal animation at all. Very reduced memory consumption and bandwidth. Great for particles,
+		debris, bricks, trees, sprites.
+		This batch is one of the few (if not the only) techniques that allows culling on an individual
+		basis. This means we can save vertex shader performance for instances that aren't in scene or
+		just not focused by the camera.
+
+        @remarks
+			Design discussion webpage: http://www.ogre3d.org/forums/viewtopic.php?f=4&t=59902
+        @author
+            Matias N. Goldberg ("dark_sylinc")
+        @version
+            1.1
+     */
+	class _OgreExport InstanceBatchHW : public InstanceBatch
+	{
+		bool	mKeepStatic;
+
+		void setupVertices( const SubMesh* baseSubMesh );
+		void setupIndices( const SubMesh* baseSubMesh );
+
+		void removeBlendData();
+		virtual bool checkSubMeshCompatibility( const SubMesh* baseSubMesh );
+
+		size_t updateVertexBuffer( Camera *currentCamera );
+
+	public:
+		InstanceBatchHW( InstanceManager *creator, MeshPtr &meshReference, const MaterialPtr &material,
+							size_t instancesPerBatch, const Mesh::IndexMap *indexToBoneMap,
+							const String &batchName );
+		virtual ~InstanceBatchHW();
+
+		/** @see InstanceBatch::calculateMaxNumInstances */
+		size_t calculateMaxNumInstances( const SubMesh *baseSubMesh, uint16 flags ) const;
+
+		/** @see InstanceBatch::buildFrom */
+		void buildFrom( const SubMesh *baseSubMesh, const RenderOperation &renderOperation );
+
+		/** Overloaded so that we don't perform needless updates when in static mode. Also doing that
+			could cause glitches with shadow mapping (since Ogre thinks we're small/bigger than we
+			really are when displaying, or that we're somewhere else)
+        */
+		void _boundsDirty(void);
+
+		/** @see InstanceBatch::setStaticAndUpdate. While this flag is true, no individual per-entity
+			cull check is made. This means if the camera is looking at only one instance, all instances
+			are sent to the vertex shader (unlike when this flag is false). This saves a lot of CPU
+			power and a bit of bus bandwidth.
+		*/
+		void setStaticAndUpdate( bool bStatic );
+
+		bool isStatic() const						{ return mKeepStatic; }
+
+		//Renderable overloads
+		void getWorldTransforms( Matrix4* xform ) const;
+		unsigned short getNumWorldTransforms(void) const;
+
+		/** Overloaded to avoid updating skeletons (which we don't support), check visibility on a
+			per unit basis and finally updated the vertex buffer */
+		virtual void _updateRenderQueue( RenderQueue* queue );
+	};
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreInstanceBatchHW_VTF.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreInstanceBatchHW_VTF.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreInstanceBatchHW_VTF.h	(revision 148)
@@ -0,0 +1,113 @@
+/*
+-----------------------------------------------------------------------------
+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 __InstanceBatchHW_VTF_H__
+#define __InstanceBatchHW_VTF_H__
+
+#include "OgreInstanceBatchVTF.h"
+#include "OgreTexture.h"
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Scene
+	*  @{
+	*/
+
+	/** Instancing implementation using vertex texture through Vertex Texture Fetch (VTF) and
+		hardware instancing.
+		@see BaseInstanceBatchVTF and @see InstanceBatchHW
+
+		The advantage over TextureVTF technique, is that this implements a basic culling algorithm
+		to avoid useless processing in vertex shader and uses a lot less VRAM and memory bandwidth
+
+		Basically it has the benefits of both TextureVTF (skeleton animations) and HWInstancingBasic
+		(lower memory consumption and basic culling) techniques
+
+        @remarks
+			Design discussion webpage: http://www.ogre3d.org/forums/viewtopic.php?f=4&t=59902
+        @author
+            Matias N. Goldberg ("dark_sylinc")
+        @version
+            1.2
+     */
+	class _OgreExport InstanceBatchHW_VTF : public BaseInstanceBatchVTF
+	{
+	protected:
+		bool	mKeepStatic;
+
+		//Pointer to the buffer containing the per instance vertex data
+		HardwareVertexBufferSharedPtr mInstanceVertexBuffer;
+
+		void setupVertices( const SubMesh* baseSubMesh );
+		void setupIndices( const SubMesh* baseSubMesh );
+
+		/** Creates 2 TEXCOORD semantics that will be used to sample the vertex texture */
+		void createVertexSemantics( VertexData *thisVertexData, VertexData *baseVertexData,
+			const HWBoneIdxVec &hwBoneIdx, const HWBoneWgtVec& hwBoneWgt );
+
+		/** updates the vertex buffer containing the per instance data 
+		@param[in] isFirstTime Tells if this is the first time the buffer is being updated
+		@param[in] currentCamera The camera being used for render (valid when using bone matrix lookup)
+		@return The number of instances to be rendered
+		*/
+		virtual size_t updateInstanceDataBuffer(bool isFirstTime, Camera* currentCamera);
+
+
+		virtual bool checkSubMeshCompatibility( const SubMesh* baseSubMesh );
+
+		/** Keeps filling the VTF with world matrix data. Overloaded to avoid culled objects
+			and update visible instances' animation
+		*/
+		size_t updateVertexTexture( Camera *currentCamera );
+
+		virtual bool matricesTogetherPerRow() const { return true; }
+	public:
+		InstanceBatchHW_VTF( InstanceManager *creator, MeshPtr &meshReference, const MaterialPtr &material,
+							size_t instancesPerBatch, const Mesh::IndexMap *indexToBoneMap,
+							const String &batchName );
+		virtual ~InstanceBatchHW_VTF();
+		/** @see InstanceBatch::calculateMaxNumInstances */
+		size_t calculateMaxNumInstances( const SubMesh *baseSubMesh, uint16 flags ) const;
+
+		/** @copydoc InstanceBatchHW::_boundsDirty */
+		void _boundsDirty(void);
+
+		/** @copydoc InstanceBatchHW::setStaticAndUpdate */
+		void setStaticAndUpdate( bool bStatic );
+
+		bool isStatic() const { return mKeepStatic; }
+
+		/** Overloaded to visibility on a per unit basis and finally updated the vertex texture */
+		virtual void _updateRenderQueue( RenderQueue* queue );
+	};
+
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreInstanceBatchShader.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreInstanceBatchShader.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreInstanceBatchShader.h	(revision 148)
@@ -0,0 +1,99 @@
+/*
+-----------------------------------------------------------------------------
+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 __InstanceBatchShader_H__
+#define __InstanceBatchShader_H__
+
+#include "OgreInstanceBatch.h"
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Scene
+	*  @{
+	*/
+
+	/** This is the same technique the old "InstancedGeometry" implementation used (with improvements).
+		Basically it creates a large vertex buffer with many repeating entities, and sends per instance
+		data through shader constants. Because SM 2.0 & 3.0 have up to 256 shader constant registers,
+		this means there can be approx up to 84 instances per batch, assuming they're not skinned
+		But using shader constants for other stuff (i.e. lighting) also affects negatively this number
+		A mesh with skeletally animated 2 bones reduces the number 84 to 42 instances per batch.
+		@par
+		The main advantage of this technique is that it's supported on a high variety of hardware
+		(SM 2.0 cards are required) and the same shader can be used for both skeletally animated
+		normal entities and instanced entities without a single change required.
+		@par
+		Unlike the old InstancedGeometry implementation, the developer doesn't need to worry about
+		reaching the 84 instances limit, the InstanceManager automatically takes care of splitting
+		and creating new batches. But beware internally, this means less performance improvement.
+		Another improvement is that vertex buffers are shared between batches, which significantly
+		reduces GPU VRAM usage.
+
+        @remarks
+			Design discussion webpage: http://www.ogre3d.org/forums/viewtopic.php?f=4&t=59902
+        @author
+            Matias N. Goldberg ("dark_sylinc")
+        @version
+            1.0
+     */
+	class _OgreExport InstanceBatchShader : public InstanceBatch
+	{
+		unsigned short	mNumWorldMatrices;
+
+		void setupVertices( const SubMesh* baseSubMesh );
+		void setupIndices( const SubMesh* baseSubMesh );
+
+		/** When the mesh is (hardware) skinned, a different code path is called so that
+			we reuse the index buffers and modify them in place. For example Instance #2
+			with reference to bone #5 would have BlendIndex = 2 + 5 = 7
+			Everything is copied identically except the VES_BLEND_INDICES semantic
+		*/
+		void setupHardwareSkinned( const SubMesh* baseSubMesh, VertexData *thisVertexData,
+									VertexData *baseVertexData );
+
+	public:
+		InstanceBatchShader( InstanceManager *creator, MeshPtr &meshReference, const MaterialPtr &material,
+							size_t instancesPerBatch, const Mesh::IndexMap *indexToBoneMap,
+							const String &batchName );
+		virtual ~InstanceBatchShader();
+
+		/** @see InstanceBatch::calculateMaxNumInstances */
+		size_t calculateMaxNumInstances( const SubMesh *baseSubMesh, uint16 flags ) const;
+
+		/** @see InstanceBatch::buildFrom */
+		void buildFrom( const SubMesh *baseSubMesh, const RenderOperation &renderOperation );
+
+		//Renderable overloads
+		void getWorldTransforms( Matrix4* xform ) const;
+		unsigned short getNumWorldTransforms(void) const;
+	};
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreInstanceBatchVTF.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreInstanceBatchVTF.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreInstanceBatchVTF.h	(revision 148)
@@ -0,0 +1,226 @@
+/*
+-----------------------------------------------------------------------------
+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 __BaseInstanceBatchVTF_H__
+#define __BaseInstanceBatchVTF_H__
+
+#include "OgreInstanceBatch.h"
+#include "OgreTexture.h"
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Scene
+	*  @{
+	*/
+
+	/** Instancing implementation using vertex texture through Vertex Texture Fetch (VTF)
+		This implementation has the following advantages:
+		  * Supports huge amount of instances per batch
+		  * Supports skinning even with huge ammounts of instances per batch
+		  * Doesn't need shader constants registers.
+		  * Best suited for skinned entities
+
+		But beware the disadvantages:
+		  * VTF is only fast on modern GPUs (ATI Radeon HD 2000+, GeForce 8+ series onwards)
+		  * On GeForce 6/7 series VTF is too slow
+		  * VTF isn't (controversely) supported on old ATI X1800 hardware
+		  * Only one bone weight per vertex is supported
+		  * GPUs with low memory bandwidth (i.e. laptops and integrated GPUs)
+		  may perform even worse than no instancing
+
+		Whether this performs great or bad depends on the hardware. It improved up to 4x performance on
+		a Intel Core 2 Quad Core X9650 GeForce 8600 GTS, and in an Intel Core 2 Duo P7350 ATI
+		Mobility Radeon HD 4650, but went 0.75x slower on an AthlonX2 5000+ integrated nForce 6150 SE
+		Each BaseInstanceBatchVTF has it's own texture, which occupies memory in VRAM.
+		Approx VRAM usage can be computed by doing 12 bytes * 3 * numInstances * numBones
+		Use flag IM_VTFBESTFIT to avoid wasting VRAM (but may reduce amount of instances per batch).
+		@par
+		The material requires at least a texture unit stage named "InstancingVTF"
+
+        @remarks
+			Design discussion webpage: http://www.ogre3d.org/forums/viewtopic.php?f=4&t=59902
+        @author
+            Matias N. Goldberg ("dark_sylinc")
+        @version
+            1.0
+     */
+	class _OgreExport BaseInstanceBatchVTF : public InstanceBatch
+	{
+	protected:
+		typedef vector<uint8>::type HWBoneIdxVec;
+		typedef vector<float>::type HWBoneWgtVec;
+		typedef vector<Matrix4>::type Matrix4Vec;
+
+		size_t					mMatricesPerInstance; //number of bone matrices per instance
+		size_t					mNumWorldMatrices;	//Num bones * num instances
+		TexturePtr				mMatrixTexture;	//The VTF
+
+		//Used when all matrices from each instance must be in the same row (i.e. HW Instancing).
+		//A few pixels are wasted, but resizing the texture puts the danger of not sampling the
+		//right pixel... (in theory it should work, but in practice doesn't)
+		size_t					mWidthFloatsPadding;
+		size_t					mMaxFloatsPerLine;
+
+		size_t					mRowLength;
+		size_t 					mWeightCount;
+		//Temporary array used to store 3x4 matrices before they are converted to dual quaternions
+		float* 					mTempTransformsArray3x4;
+
+		// The state of the usage of bone matrix lookup
+		bool mUseBoneMatrixLookup;
+		size_t mMaxLookupTableInstances;
+
+		bool mUseBoneDualQuaternions;
+		bool mForceOneWeight;
+		bool mUseOneWeight;
+
+		/** Clones the base material so it can have it's own vertex texture, and also
+			clones it's shadow caster materials, if it has any
+		*/
+		void cloneMaterial( const MaterialPtr &material );
+
+		/** Retrieves bone data from the original sub mesh and puts it into an appropriate buffer,
+			later to be read when creating the vertex semantics.
+			Assumes outBoneIdx has enough space (base submesh vertex count)
+		*/
+		void retrieveBoneIdx( VertexData *baseVertexData, HWBoneIdxVec &outBoneIdx );
+
+		/** @see retrieveBoneIdx()
+			Assumes outBoneIdx has enough space (twice the base submesh vertex count, one for each weight)
+			Assumes outBoneWgt has enough space (twice the base submesh vertex count, one for each weight)
+		*/
+		void retrieveBoneIdxWithWeights(VertexData *baseVertexData, HWBoneIdxVec &outBoneIdx, HWBoneWgtVec &outBoneWgt);
+
+		/** Setups the material to use a vertex texture */
+		void setupMaterialToUseVTF( TextureType textureType, MaterialPtr &material );
+
+		/** Creates the vertex texture */
+		void createVertexTexture( const SubMesh* baseSubMesh );
+
+		/** Creates 2 TEXCOORD semantics that will be used to sample the vertex texture */
+		virtual void createVertexSemantics( VertexData *thisVertexData, VertexData *baseVertexData,
+									const HWBoneIdxVec &hwBoneIdx, const HWBoneWgtVec &hwBoneWgt) = 0;
+
+		size_t convert3x4MatricesToDualQuaternions(float* matrices, size_t numOfMatrices, float* outDualQuaternions);
+									
+		/** Keeps filling the VTF with world matrix data */
+		void updateVertexTexture(void);
+
+		/** Affects VTF texture's width dimension */
+		virtual bool matricesTogetherPerRow() const = 0;
+
+		/** update the lookup numbers for entities with shared transforms */
+		virtual void updateSharedLookupIndexes();
+
+		/** @see InstanceBatch::generateInstancedEntity() */
+		virtual InstancedEntity* generateInstancedEntity(size_t num);
+
+	public:
+		BaseInstanceBatchVTF( InstanceManager *creator, MeshPtr &meshReference, const MaterialPtr &material,
+							size_t instancesPerBatch, const Mesh::IndexMap *indexToBoneMap,
+							const String &batchName);
+		virtual ~BaseInstanceBatchVTF();
+
+		/** @see InstanceBatch::buildFrom */
+		void buildFrom( const SubMesh *baseSubMesh, const RenderOperation &renderOperation );
+
+		//Renderable overloads
+		void getWorldTransforms( Matrix4* xform ) const;
+		unsigned short getNumWorldTransforms(void) const;
+
+		/** Overloaded to be able to updated the vertex texture */
+		void _updateRenderQueue(RenderQueue* queue);
+
+		/** Sets the state of the usage of bone matrix lookup
+		
+		Under default condition each instance entity is assigned a specific area in the vertex 
+		texture for bone matrix data. When turned on the amount of area in the vertex texture 
+		assigned for bone matrix data will be relative to the amount of unique animation states.
+		Instanced entities sharing the same animation state will share the same area in the matrix.
+		The specific position of each entity is placed in the vertex data and added in a second phase
+		in the shader.
+
+		Note this feature only works in VTF_HW for now.
+		This value needs to be set before adding any instanced entities
+		*/
+		void setBoneMatrixLookup(bool enable, size_t maxLookupTableInstances) { assert(mInstancedEntities.empty()); 
+			mUseBoneMatrixLookup = enable; mMaxLookupTableInstances = maxLookupTableInstances; }
+
+		/** Tells whether to use bone matrix lookup
+		@see setBoneMatrixLookup()
+		*/
+		bool useBoneMatrixLookup() const { return mUseBoneMatrixLookup; }
+
+		void setBoneDualQuaternions(bool enable) { assert(mInstancedEntities.empty());
+			mUseBoneDualQuaternions = enable; mRowLength = (mUseBoneDualQuaternions ? 2 : 3); }
+
+		bool useBoneDualQuaternions() const { return mUseBoneDualQuaternions; }
+
+		void setForceOneWeight(bool enable) {  assert(mInstancedEntities.empty());
+			mForceOneWeight = enable; }
+
+		bool forceOneWeight() const { return mForceOneWeight; }
+
+		void setUseOneWeight(bool enable) {  assert(mInstancedEntities.empty());
+			mUseOneWeight = enable; }
+
+		bool useOneWeight() const { return mUseOneWeight; }
+
+		/** @see InstanceBatch::useBoneWorldMatrices()	*/
+		virtual bool useBoneWorldMatrices() const { return !mUseBoneMatrixLookup; }
+
+		/** @return the maximum amount of shared transform entities when using lookup table*/
+		virtual size_t getMaxLookupTableInstances() const { return mMaxLookupTableInstances; }
+		
+	};
+
+	class _OgreExport InstanceBatchVTF : public BaseInstanceBatchVTF
+	{
+		
+		void setupVertices( const SubMesh* baseSubMesh );
+		void setupIndices( const SubMesh* baseSubMesh );
+
+		/** Creates 2 TEXCOORD semantics that will be used to sample the vertex texture */
+		void createVertexSemantics( VertexData *thisVertexData, VertexData *baseVertexData,
+			const HWBoneIdxVec &hwBoneIdx, const HWBoneWgtVec &hwBoneWgt );
+
+		virtual bool matricesTogetherPerRow() const { return false; }
+	public:
+		InstanceBatchVTF( InstanceManager *creator, MeshPtr &meshReference, const MaterialPtr &material,
+							size_t instancesPerBatch, const Mesh::IndexMap *indexToBoneMap,
+							const String &batchName);
+		virtual ~InstanceBatchVTF();
+
+		/** @see InstanceBatch::calculateMaxNumInstances */
+		size_t calculateMaxNumInstances( const SubMesh *baseSubMesh, uint16 flags ) const;
+	};
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreInstanceManager.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreInstanceManager.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreInstanceManager.h	(revision 148)
@@ -0,0 +1,324 @@
+/*
+-----------------------------------------------------------------------------
+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 __InstanceManager_H__
+#define __InstanceManager_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreMesh.h"
+#include "OgreRenderOperation.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre
+{
+    /** \addtogroup Core
+    *  @{
+    */
+    /** \addtogroup Scene
+    *  @{
+    */
+
+    /** This is the main starting point for the new instancing system.
+        Each InstanceManager can control one technique and one mesh, but it can manage
+        multiple materials at the same time.
+        @see SceneManager::createInstanceManager, which creates this InstanceManager. Each one
+        must have a unique name. It's wasteless to create two InstanceManagers with the same
+        mesh reference, instancing technique and instances per batch count.
+        This class takes care of managing batches automatically, so that more are created when
+        needed, and reuse existing ones as much as possible; thus the user doesn't have to worry
+        of managing all those low level issues.
+        @see InstanceBatch & @see InstanceEntity for more information.
+
+    @remarks
+        Design discussion webpage: http://www.ogre3d.org/forums/viewtopic.php?f=4&t=59902
+    @author
+        Matias N. Goldberg ("dark_sylinc")
+    @version
+        1.0
+     */
+    class _OgreExport InstanceManager : public FactoryAlloc
+    {
+    public:
+        enum InstancingTechnique
+        {
+            ShaderBased,            ///< Any SM 2.0+ @see InstanceBatchShader
+            TextureVTF,             ///< Needs Vertex Texture Fetch & SM 3.0+ @see InstanceBatchVTF
+            HWInstancingBasic,      ///< Needs SM 3.0+ and HW instancing support @see InstanceBatchHW
+            HWInstancingVTF,        ///< Needs SM 3.0+, HW instancing support & VTF @see InstanceBatchHW_VTF
+            InstancingTechniquesCount
+        };
+
+        /** Values to be used in setSetting() & BatchSettings::setting */
+        enum BatchSettingId
+        {
+            /// Makes all batches from same material cast shadows
+            CAST_SHADOWS        = 0,
+            /// Makes each batch to display it's bounding box. Useful for debugging or profiling
+            SHOW_BOUNDINGBOX,
+
+            NUM_SETTINGS
+        };
+
+    private:
+        struct BatchSettings
+        {
+            //These are all per material
+            bool setting[NUM_SETTINGS];
+
+            BatchSettings()
+            {
+                setting[CAST_SHADOWS]     = true;
+                setting[SHOW_BOUNDINGBOX] = false;
+            }
+        };
+
+        typedef vector<InstanceBatch*>::type        InstanceBatchVec;   //vec[batchN] = Batch
+        typedef map<String, InstanceBatchVec>::type InstanceBatchMap;   //map[materialName] = Vec
+
+        typedef map<String, BatchSettings>::type    BatchSettingsMap;
+
+        const String            mName;                  //Not the name of the mesh
+        MeshPtr                 mMeshReference;
+        InstanceBatchMap        mInstanceBatches;
+        size_t                  mIdCount;
+
+        InstanceBatchVec        mDirtyBatches;
+
+        RenderOperation         mSharedRenderOperation;
+
+        size_t                  mInstancesPerBatch;
+        InstancingTechnique     mInstancingTechnique;
+        uint16                  mInstancingFlags;       ///< @see InstanceManagerFlags
+        unsigned short          mSubMeshIdx;
+        
+        BatchSettingsMap        mBatchSettings;
+        SceneManager*           mSceneManager;
+
+        size_t                  mMaxLookupTableInstances;
+        unsigned char			mNumCustomParams;		//Number of custom params per instance.
+
+        /** Finds a batch with at least one free instanced entity we can use.
+            If none found, creates one.
+        */
+        inline InstanceBatch* getFreeBatch( const String &materialName );
+
+        /** Called when batches are fully exhausted (can't return more instances) so a new batch
+            is created.
+            For the first time use, it can take big build time.
+            It takes care of getting the render operation which will be shared by further batches,
+            which decreases their build time, and prevents GPU RAM from skyrocketing.
+        @param materialName The material name, to know where to put this batch in the map
+        @param firstTime True if this is the first time it is called
+        @return The created InstancedManager for convenience
+        */
+        InstanceBatch* buildNewBatch( const String &materialName, bool firstTime );
+
+        /** @see defragmentBatches overload, this takes care of an array of batches
+            for a specific material */
+        void defragmentBatches( bool optimizeCull, vector<InstancedEntity*>::type &entities,
+								vector<Ogre::Vector4>::type &usedParams,
+								InstanceBatchVec &fragmentedBatches );
+
+        /** @see setSetting. This function helps it by setting the given parameter to all batches
+            in container.
+        */
+        void applySettingToBatches( BatchSettingId id, bool value, const InstanceBatchVec &container );
+
+		/** Called when we you use a mesh which has shared vertices, the function creates separate
+			vertex/index buffers and also recreates the bone assignments.
+		*/
+		void unshareVertices(const Ogre::MeshPtr &mesh);
+
+    public:
+        InstanceManager( const String &customName, SceneManager *sceneManager,
+                         const String &meshName, const String &groupName,
+                         InstancingTechnique instancingTechnique, uint16 instancingFlags,
+                         size_t instancesPerBatch, unsigned short subMeshIdx, bool useBoneMatrixLookup = false);
+        virtual ~InstanceManager();
+
+        const String& getName() const { return mName; }
+
+        SceneManager* getSceneManager() const { return mSceneManager; }
+
+        /** Raises an exception if trying to change it after creating the first InstancedEntity
+        @remarks The actual value may be less if the technique doesn't support having so much
+        @see getMaxOrBestNumInstancesPerBatches for the usefulness of this function
+        @param instancesPerBatch New instances per batch number
+        */
+        void setInstancesPerBatch( size_t instancesPerBatch );
+
+        /** Sets the size of the lookup table for techniques supporting bone lookup table.
+            Raises an exception if trying to change it after creating the first InstancedEntity.
+            Setting this value below the number of unique (non-sharing) entity instance animations
+            will produce a crash during runtime. Setting this value above will increase memory
+            consumption and reduce framerate.
+        @remarks The value should be as close but not below the actual value. 
+        @param maxLookupTableInstances New size of the lookup table
+        */
+        void setMaxLookupTableInstances( size_t maxLookupTableInstances );
+
+		/** Sets the number of custom parameters per instance. Some techniques (i.e. HWInstancingBasic)
+			support this, but not all of them. They also may have limitations to the max number. All
+			instancing implementations assume each instance param is a Vector4 (4 floats).
+		@remarks
+			This function cannot be called after the first batch has been created. Otherwise
+			it will raise an exception. If the technique doesn't support custom params, it will
+			raise an exception at the time of building the first InstanceBatch.
+
+			HWInstancingBasic:
+				* Each custom params adds an additional float4 TEXCOORD.
+			HWInstancingVTF:
+				* Not implemented. (Recommendation: Implement this as an additional float4 VTF fetch)
+			TextureVTF:
+				* Not implemented. (see HWInstancingVTF's recommendation)
+			ShaderBased:
+				* Not supported.
+		@param numCustomParams Number of custom parameters each instance will have. Default: 0
+		*/
+		void setNumCustomParams( unsigned char numCustomParams );
+
+		unsigned char getNumCustomParams() const
+		{ return mNumCustomParams; }
+
+        /** @return Instancing technique this manager was created for. Can't be changed after creation */
+        InstancingTechnique getInstancingTechnique() const
+        { return mInstancingTechnique; }
+
+        /** Calculates the maximum (or the best amount, depending on flags) of instances
+            per batch given the suggested size for the technique this manager was created for.
+        @remarks
+            This is done automatically when creating an instanced entity, but this function in conjunction
+            with @see setInstancesPerBatch allows more flexible control over the amount of instances
+            per batch
+        @param materialName Name of the material to base on
+        @param suggestedSize Suggested amount of instances per batch
+        @param flags Flags to pass to the InstanceManager. @see InstanceManagerFlags
+        @return The max/best amount of instances per batch given the suggested size and flags
+        */
+        size_t getMaxOrBestNumInstancesPerBatch( String materialName, size_t suggestedSize, uint16 flags );
+
+        /** @copydoc SceneManager::createInstancedEntity */
+        InstancedEntity* createInstancedEntity( const String &materialName );
+
+        /** This function can be useful to improve CPU speed after having too many instances
+            created, which where now removed, thus freeing many batches with zero used Instanced Entities
+            However the batches aren't automatically removed from memory until the InstanceManager is
+            destroyed, or this function is called. This function removes those batches which are completely
+            unused (only wasting memory).
+        */
+        void cleanupEmptyBatches(void);
+
+        /** After creating many entities (which turns in many batches) and then removing entities that
+            are in the middle of these batches, there might be many batches with many free entities.
+            Worst case scenario, there could be left one batch per entity. Imagine there can be
+            80 entities per batch, there are 80 batches, making a total of 6400 entities. Then
+            6320 of those entities are removed in a very specific way, which leads to having
+            80 batches, 80 entities, and GPU vertex shader still needs to process 6400!
+            This is called fragmentation. This function reparents the InstancedEntities
+            to fewer batches, in this case leaving only one batch with 80 entities
+
+        @remarks
+            This function takes time. Make sure to call this only when you're sure there's
+            too much of fragmentation and you won't be creating more InstancedEntities soon
+            Also in many cases cleanupEmptyBatches() ought to be enough
+            Defragmentation is done per material
+            Static batches won't be defragmented. If you want to degragment them, set them
+            to dynamic again, and switch back to static after calling this function.
+
+        @param optimizeCulling When true, entities close together will be reorganized
+            in the same batch for more efficient CPU culling. This can take more CPU
+            time. You want this to be false if you now you're entities are moving very
+            randomly which tends them to get separated and spread all over the scene
+            (which nullifies any CPU culling)
+        */
+        void defragmentBatches( bool optimizeCulling );
+
+        /** Applies a setting for all batches using the same material_ existing ones and
+            those that will be created in the future.
+        @par
+            For example setSetting( BatchSetting::CAST_SHADOWS, false ) disables shadow
+            casting for all instanced entities (@see MovableObject::setCastShadow)
+        @par
+            For example setSetting( BatchSetting::SHOW_BOUNDINGBOX, true, "MyMat" )
+            will display the bounding box of the batch (not individual InstancedEntities)
+            from all batches using material "MyMat"
+        @note If the material name hasn't been used, the settings are still stored
+            This allows setting up batches before they get even created.
+        @param id Setting Id to setup, @see BatchSettings::BatchSettingId
+        @param enabled Boolean value. It's meaning depends on the id.
+        @param materialName When Blank, the setting is applied to all existing materials
+        */
+        void setSetting( BatchSettingId id, bool enabled, const String &materialName = StringUtil::BLANK );
+
+        /// If settings for the given material didn't exist, default value is returned
+        bool getSetting( BatchSettingId id, const String &materialName ) const;
+
+        /** Returns true if settings were already created for the given material name.
+            If false is returned, it means getSetting will return default settings.
+        */
+        bool hasSettings( const String &materialName ) const
+        { return mBatchSettings.find( materialName ) != mBatchSettings.end(); }
+
+        /** @copydoc InstanceBatch::setStaticAndUpdate */
+        void setBatchesAsStaticAndUpdate( bool bStatic );
+
+        /** Called by an InstanceBatch when it requests their bounds to be updated for proper culling
+        @param dirtyBatch The batch which is dirty, usually same as caller.
+        */
+        void _addDirtyBatch( InstanceBatch *dirtyBatch );
+
+        /** Called by SceneManager when we told it we have at least one dirty batch */
+        void _updateDirtyBatches(void);
+
+        typedef ConstMapIterator<InstanceBatchMap> InstanceBatchMapIterator;
+        typedef ConstVectorIterator<InstanceBatchVec> InstanceBatchIterator;
+
+        /// Get non-updateable iterator over instance batches per material
+        InstanceBatchMapIterator getInstanceBatchMapIterator(void) const
+        { return InstanceBatchMapIterator( mInstanceBatches.begin(), mInstanceBatches.end() ); }
+
+        /** Get non-updateable iterator over instance batches for given material
+        @remarks
+            Each InstanceBatch pointer may be modified for low level usage (i.e.
+            setCustomParameter), but there's no synchronization mechanism when
+            multithreading or creating more instances, that's up to the user.
+        */
+        InstanceBatchIterator getInstanceBatchIterator( const String &materialName ) const
+        {
+            InstanceBatchMap::const_iterator it = mInstanceBatches.find( materialName );
+            if(it != mInstanceBatches.end())
+                return InstanceBatchIterator( it->second.begin(), it->second.end() );
+            else
+                OGRE_EXCEPT(Exception::ERR_INVALID_STATE, "Cannot create instance batch iterator. "
+                            "Material " + materialName + " cannot be found.", "InstanceManager::getInstanceBatchIterator");
+        }
+    };
+} // namespace Ogre
+
+#include "OgreHeaderSuffix.h"
+
+#endif // __InstanceManager_H__
Index: /ogre_src_v1-9-0/OgreMain/include/OgreInstancedEntity.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreInstancedEntity.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreInstancedEntity.h	(revision 148)
@@ -0,0 +1,295 @@
+/*
+-----------------------------------------------------------------------------
+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 __InstancedEntity_H__
+#define __InstancedEntity_H__
+
+#include "OgreMovableObject.h"
+#include "OgreNode.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Scene
+	*  @{
+	*/
+
+	/** @see InstanceBatch to understand how instancing works.
+
+		Instanced entities work in a very similar way as how an Entity works, as this interface
+		tries to mimic it as most as possible to make the transition between Entity and InstancedEntity
+		as straightforward and simple as possible.
+		There are a couple inherent limitations, for example setRenderQueueGroup only works on
+		the InstanceBatch level, not the individual instance. This limits Z sorting for alpha blending
+		quite significantly
+		An InstancedEntity won't appear in scene until a SceneNode is attached to them. Once the
+		InstancedEntity is no longer needed, call InstanceBatch::removeInstancedEntity to put them
+		back into a queue so the batch can return it back again when a new instance is requested.
+		@par
+		Internally, instanced entities that are not visible (i.e. by setting setVisible(false) or
+		when they don't have a SceneNode attached to them) a Zero world matrix is sent to the vertex shader
+		which in turn causes a zero area triangle.
+		This obviously means no Vertex shader benefit, but saves a bit of pixel shader processing power.
+		Also this means this object won't be considered when sizing the InstanceBatch's bounding box.
+		@par
+		Each instance has an instance ID unique within the batch, which matches the ID sent to the vertex
+		shader by some techniques (like InstanceBatchShader).
+		@par
+		Differences between Entity and InstancedEntity:
+		* Setting RenderQueueGroup and other Renderable stuff works at InstanceBatch level, not
+		InstancedEntity. This is obviously a limitation from instancing in general, not this particular
+		implementation
+
+        @remarks
+			Design discussion webpage
+        @author
+            Matias N. Goldberg ("dark_sylinc")
+        @version
+            1.0
+     */
+	class _OgreExport InstancedEntity : public Ogre::MovableObject
+	{
+		friend class InstanceBatch;
+		friend class InstanceBatchShader;
+		friend class InstanceBatchHW;
+		friend class InstanceBatchHW_VTF;
+		friend class BaseInstanceBatchVTF;
+	protected:
+		uint16 mInstanceId; //Note it may change after defragmenting!
+		bool mInUse;
+		InstanceBatch *mBatchOwner;
+
+		AnimationStateSet *mAnimationState;
+		SkeletonInstance *mSkeletonInstance;
+		Matrix4 *mBoneMatrices;	 //Local space
+		Matrix4 *mBoneWorldMatrices; //World space
+		unsigned long mFrameAnimationLastUpdated;
+
+		InstancedEntity* mSharedTransformEntity;	//When not null, another InstancedEntity controls the skeleton
+												
+		/** Used in conjunction with bone matrix lookup. Tells the number of the transform for
+            as arranged in the vertex texture */
+		uint16 mTransformLookupNumber;
+
+		/// Stores the master when we're the slave, store our slaves when we're the master
+		typedef vector<InstancedEntity*>::type InstancedEntityVec;
+		InstancedEntityVec mSharingPartners;
+
+		//////////////////////////////////////////////////////////////////////////
+		// Parameters used for local transformation offset information
+		// The 
+		//////////////////////////////////////////////////////////////////////////
+
+		/// Object position
+		Vector3 mPosition;
+		Vector3 mDerivedLocalPosition;
+		/// Object orientation
+		Quaternion mOrientation;
+		/// Object scale
+		Vector3 mScale;
+		/// The maximum absolute scale for all dimension
+		Real mMaxScaleLocal;
+		/// Full world transform
+		Matrix4 mFullLocalTransform;
+		/// Tells if mFullTransform needs an updated
+		bool mNeedTransformUpdate;
+		/// Tells if the animation world transform needs an update
+		bool mNeedAnimTransformUpdate;
+		/// Tells whether to use the local transform parameters
+		bool mUseLocalTransform;
+
+
+		/// Returns number of matrices written to transform, assumes transform has enough space
+		size_t getTransforms( Matrix4 *xform ) const;
+		/// Returns number of 32-bit values written
+		size_t getTransforms3x4( float *xform ) const;
+
+		/// Returns true if this InstancedObject is visible to the current camera
+		bool findVisible( Camera *camera ) const;
+
+		/// Creates/destroys our own skeleton, also tells slaves to unlink if we're destroying
+		void createSkeletonInstance();
+		void destroySkeletonInstance();
+
+		/// When this entity is a slave, stopSharingTransform delegates to this function.
+		///	nofityMaster = false is used to prevent iterator invalidation in specific cases.
+		void stopSharingTransformAsSlave( bool notifyMaster );
+
+		/// Just unlinks, and tells our master we're no longer sharing
+		void unlinkTransform( bool notifyMaster=true );
+
+		/// Called when a slave has unlinked from us
+		void notifyUnlink( const InstancedEntity *slave );
+
+		/// Mark the transformation matrixes as dirty
+		inline void markTransformDirty();
+
+		/// Incremented count for next name extension
+        static NameGenerator msNameGenerator;
+
+	public:
+		InstancedEntity( InstanceBatch *batchOwner, uint32 instanceID, InstancedEntity* sharedTransformEntity = NULL);
+		virtual ~InstancedEntity();
+
+		/** Shares the entire transformation with another InstancedEntity. This is useful when a mesh
+			has more than one submeshes, therefore creating multiple InstanceManagers (one for each
+			submesh). With this function, sharing makes the skeleton to be shared (less memory) and
+			updated once (performance optimization).
+			Note that one InstancedEntity (i.e. submesh 0) must be chosen as "master" which will share
+			with the other instanced entities (i.e. submeshes 1-N) which are called "slaves"
+			@par
+			Requirements to share trasnformations:
+				* Both InstancedEntities must have use the same skeleton
+				* An InstancedEntity can't be both "master" and "slave" at the same time
+			@remarks
+			Sharing does nothing if the original mesh doesn't have a skeleton
+			When an InstancedEntity is removed (@see InstanceBatch::removeInstancedEntity), it stops
+			sharing the transform. If the instanced entity was the master one, all it's slaves stop
+			sharing and start having their own transform too.
+			@param slave The InstancedEntity that should share with us and become our slave
+			@return true if successfully shared (may fail if they aren't skeletally animated)
+		*/
+		bool shareTransformWith( InstancedEntity *slave );
+
+		/** @see shareTransformWith
+			Stops sharing the transform if this is a slave, and notifies the master we're no longer
+			a slave.
+			If this is a master, tells all it's slave to stop sharing
+			@remarks
+			This function is automatically called in InstanceBatch::removeInstancedEntity
+		*/
+		void stopSharingTransform();
+
+		InstanceBatch* _getOwner() const { return mBatchOwner; }
+
+		const String& getMovableType(void) const;
+
+		const AxisAlignedBox& getBoundingBox(void) const;
+		Real getBoundingRadius(void) const;
+
+		/** This is used by our batch owner to get the closest entity's depth, returns infinity
+            when not attached to a scene node */
+		Real getSquaredViewDepth( const Camera* cam ) const;
+
+		/// Overridden so we can tell the InstanceBatch it needs to update it's bounds
+		void _notifyMoved(void);
+		void _notifyAttached( Node* parent, bool isTagPoint = false );
+
+		/// Do nothing, InstanceBatch takes care of this.
+		void _updateRenderQueue( RenderQueue* queue )	{}
+		void visitRenderables( Renderable::Visitor* visitor, bool debugRenderables = false ) {}
+
+		/** @see Entity::hasSkeleton */
+		bool hasSkeleton(void) const { return mSkeletonInstance != 0; }
+		/** @see Entity::getSkeleton */
+		SkeletonInstance* getSkeleton(void) const { return mSkeletonInstance; }
+
+		/** @see Entity::getAnimationState */
+		AnimationState* getAnimationState(const String& name) const;
+		/** @see Entity::getAllAnimationStates */
+		AnimationStateSet* getAllAnimationStates(void) const;
+
+		/** Called by InstanceBatch in <i>his</i> _updateRenderQueue to tell us we need
+			to calculate our bone matrices.
+			@remarks Assumes it has a skeleton (mSkeletonInstance != 0)
+			@return true if something was actually updated
+		*/
+		virtual bool _updateAnimation(void);
+
+		/** Sets the transformation look up number */
+		void setTransformLookupNumber(uint16 num) { mTransformLookupNumber = num;}
+
+		/** Retrieve the position */
+		const Vector3& getPosition() const { return mPosition; }
+		/** Set the position or the offset from the parent node if a parent node exists */ 
+		void setPosition(const Vector3& position, bool doUpdate = true);
+
+		/** Retrieve the orientation */
+		const Quaternion& getOrientation() const { return mOrientation; }
+		/** Set the orientation or the offset from the parent node if a parent node exists */
+		void setOrientation(const Quaternion& orientation, bool doUpdate = true);
+
+		/** Retrieve the local scale */ 
+		const Vector3& getScale() const { return mScale; }
+		/** Set the  scale or the offset from the parent node if a parent node exists  */ 
+		void setScale(const Vector3& scale, bool doUpdate = true);
+
+		/** Returns the maximum derived scale coefficient among the xyz values */
+		Real getMaxScaleCoef() const;
+
+		/** Update the world transform and derived values */
+		void updateTransforms();
+
+		/** Tells if the entity is in use. */
+		bool isInUse() const { return mInUse; }
+		/** Sets whether the entity is in use. */
+		void setInUse(bool used);
+
+		/** Returns the world transform of the instanced entity including local transform */
+		virtual const Matrix4& _getParentNodeFullTransform(void) const { 
+			assert((!mNeedTransformUpdate || !mUseLocalTransform) && "Transform data should be updated at this point");
+			return mUseLocalTransform ? mFullLocalTransform :
+				mParentNode ? mParentNode->_getFullTransform() : Matrix4::IDENTITY;
+		}
+
+		/** Returns the derived position of the instanced entity including local transform */
+		const Vector3& _getDerivedPosition() const {
+			assert((!mNeedTransformUpdate || !mUseLocalTransform) && "Transform data should be updated at this point");
+			return mUseLocalTransform ? mDerivedLocalPosition :
+				mParentNode ? mParentNode->_getDerivedPosition() : Vector3::ZERO;
+		}
+
+		/** @copydoc MovableObject::isInScene. */
+		virtual bool isInScene(void) const
+		{
+			//We assume that the instanced entity is in the scene if it is in use
+			//It is in the scene whether it has a parent node or not
+			return mInUse;
+		}
+
+		/** Sets the custom parameter for this instance @see InstanceManager::setNumCustomParams
+			Because not all techniques support custom params, and some users may not need it while
+			using millions of InstancedEntities, the params have been detached from InstancedEntity
+			and stored in it's InstanceBatch instead, to reduce memory overhead.
+		@remarks
+			If this function is never called, all instances default to Vector4::ZERO. Watch out!
+			If you destroy an instanced entity and then create it again (remember! Instanced entities
+			are pre-allocated) it's custom param will contain the old value when it was destroyed.
+		@param idx of the param. In the range [0; InstanceManager::getNumCustomParams())
+		@param newParam New parameter
+		*/
+		void setCustomParam( unsigned char idx, const Vector4 &newParam );
+		const Vector4& getCustomParam( unsigned char idx );
+	};
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreInstancedGeometry.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreInstancedGeometry.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreInstancedGeometry.h	(revision 148)
@@ -0,0 +1,893 @@
+/*
+-----------------------------------------------------------------------------
+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 __InstancedGeometry_H__
+#define __InstancedGeometry_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreMovableObject.h"
+#include "OgreSimpleRenderable.h"
+#include "OgreSkeleton.h"
+#include "OgreSkeletonInstance.h"
+#include "OgreAnimationTrack.h"
+#include "OgreBone.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreMesh.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Scene
+	*  @{
+	*/
+	/** Pre-transforms and batches up meshes for efficient use as instanced geometry
+		in a scene
+	@remarks
+		Shader instancing allows to save both memory and draw calls. While 
+		StaticGeometry stores 500 times the same object in a batch to display 500 
+		objects, this shader instancing implementation stores only 80 times the object, 
+		and then re-uses the vertex data with different shader parameter.
+		Although you save memory, you make more draw call. However, you still 
+		make less draw calls than if you were rendering each object independently.
+		Plus, you can move the batched objects independently of one another which 
+		you cannot do with StaticGeometry.
+	@par
+		Therefore it is important when you are rendering a lot of geometry to 
+		batch things up into as few rendering calls as possible. This
+		class allows you to build a batched object from a series of entities 
+		in order to benefit from this behaviour.
+		Batching has implications of it's own though:
+		@li Batched geometry cannot be subdivided; that means that the whole
+			group will be displayed, or none of it will. This obivously has
+			culling issues.
+		@li A single material must apply for each batch. In fact this class 
+			allows you to use multiple materials, but you should be aware that 
+			internally this means that there is one batch per material. 
+			Therefore you won't gain as much benefit from the batching if you 
+			use many different materials; try to keep the number down.
+	@par
+		The bounding box information is computed with object position only. 
+		It doesn't take account of the object orientation. 
+	@par
+		The LOD settings of both the Mesh and the Materials used in 
+		constructing this instanced geometry will be respected. This means that 
+		if you use meshes/materials which have LOD, batches in the distance 
+		will have a lower polygon count or material detail to those in the 
+		foreground. Since each mesh might have different LOD distances, during 
+		build the furthest distance at each LOD level from all meshes  
+		in that BatchInstance is used. This means all the LOD levels change at the 
+		same time, but at the furthest distance of any of them (so quality is 
+		not degraded). Be aware that using Mesh LOD in this class will 
+		further increase the memory required. Only generated LOD
+		is supported for meshes.
+	@par
+		There are 2 ways you can add geometry to this class; you can add
+		Entity objects directly with predetermined positions, scales and 
+		orientations, or you can add an entire SceneNode and it's subtree, 
+		including all the objects attached to it. Once you've added everything
+		you need to, you have to call build() the fix the geometry in place. 
+	@par
+		You should not construct instances of this class directly; instead, call 
+		SceneManager::createInstancedGeometry, which gives the SceneManager the 
+		option of providing you with a specialised version of this class if it
+		wishes, and also handles the memory management for you like other 
+		classes.
+    @note
+		Warning: this class only works with indexed triangle lists at the moment,		do not pass it triangle strips, fans or lines / points, or unindexed geometry.
+	*/
+	class _OgreExport  InstancedGeometry : public BatchedGeometryAlloc
+	{
+	public:
+		/** Struct holding geometry optimised per SubMesh / LOD level, ready
+			for copying to instances. 
+		@remarks
+			Since we're going to be duplicating geometry lots of times, it's
+			far more important that we don't have redundant vertex data. If a 
+			SubMesh uses shared geometry, or we're looking at a lower LOD, not
+			all the vertices are being referenced by faces on that submesh.
+			Therefore to duplicate them, potentially hundreds or even thousands
+			of times, would be extremely wasteful. Therefore, if a SubMesh at
+			a given LOD has wastage, we create an optimised version of it's
+			geometry which is ready for copying with no wastage.
+		*/
+		class _OgrePrivate OptimisedSubMeshGeometry : public BatchedGeometryAlloc
+		{
+		public:
+			OptimisedSubMeshGeometry() :vertexData(0), indexData(0) {}
+			~OptimisedSubMeshGeometry() 
+			{
+				delete vertexData;
+				delete indexData;
+			}
+			VertexData *vertexData;
+			IndexData *indexData;
+		};
+		typedef list<OptimisedSubMeshGeometry*>::type OptimisedSubMeshGeometryList;
+		/// Saved link between SubMesh at a LOD and vertex/index data
+		/// May point to original or optimised geometry
+		struct SubMeshLodGeometryLink
+		{
+			VertexData* vertexData;
+			IndexData* indexData;
+		};
+		typedef vector<SubMeshLodGeometryLink>::type SubMeshLodGeometryLinkList;
+		typedef map<SubMesh*, SubMeshLodGeometryLinkList*>::type SubMeshGeometryLookup;
+		/// Structure recording a queued submesh for the build
+		struct QueuedSubMesh : public BatchedGeometryAlloc
+		{
+			SubMesh* submesh;
+			/// Link to LOD list of geometry, potentially optimised
+			SubMeshLodGeometryLinkList* geometryLodList;
+			String materialName;
+			Vector3 position;
+			Quaternion orientation;
+			Vector3 scale;
+			/// Pre-transformed world AABB 
+			AxisAlignedBox worldBounds;
+			unsigned int ID;
+		};
+		typedef vector<QueuedSubMesh*>::type QueuedSubMeshList;
+		typedef vector<String>::type QueuedSubMeshOriginList;
+		/// Structure recording a queued geometry for low level builds
+		struct QueuedGeometry : public BatchedGeometryAlloc
+		{
+			SubMeshLodGeometryLink* geometry;
+			Vector3 position;
+			Quaternion orientation;
+			Vector3 scale;
+			unsigned int ID;
+		};
+		typedef vector<QueuedGeometry*>::type QueuedGeometryList;
+		
+		// forward declarations
+		class LODBucket;
+		class MaterialBucket;
+		class BatchInstance;
+		class InstancedObject;
+
+		/** A GeometryBucket is a the lowest level bucket where geometry with 
+			the same vertex & index format is stored. It also acts as the 
+			renderable.
+		*/
+		class _OgreExport  GeometryBucket :	public SimpleRenderable
+		{
+		protected:
+			
+			/// Geometry which has been queued up pre-build (not for deallocation)
+			QueuedGeometryList mQueuedGeometry;
+			/// Pointer to the Batch
+			InstancedGeometry*mBatch;
+			/// Pointer to parent bucket
+			MaterialBucket* mParent;
+			/// String identifying the vertex / index format
+			String mFormatString;
+			/// Vertex information, includes current number of vertices
+			/// committed to be a part of this bucket
+			VertexData* mVertexData;
+			/// Index information, includes index type which limits the max
+			/// number of vertices which are allowed in one bucket
+			IndexData* mIndexData;
+			/// Size of indexes
+			HardwareIndexBuffer::IndexType mIndexType;
+			/// Maximum vertex indexable
+			size_t mMaxVertexIndex;
+			///	Index of the Texcoord where the index is stored
+			unsigned short mTexCoordIndex;
+			AxisAlignedBox mAABB;
+
+			template<typename T>
+			void copyIndexes(const T* src, T* dst, size_t count, size_t indexOffset)
+			{
+				if (indexOffset == 0)
+				{
+					memcpy(dst, src, sizeof(T) * count);
+				}
+				else
+				{
+					while(count--)
+					{
+						*dst++ = static_cast<T>(*src++ + indexOffset);
+					}
+				}
+			}
+
+			void _initGeometryBucket(const VertexData* vData, const IndexData* iData);
+			void _initGeometryBucket(GeometryBucket* bucket);
+
+		public:
+			GeometryBucket(MaterialBucket* parent, const String& formatString, 
+				const VertexData* vData, const IndexData* iData);
+			GeometryBucket(const String& name, MaterialBucket* parent, const String& formatString, 
+				const VertexData* vData, const IndexData* iData);
+			GeometryBucket(MaterialBucket* parent,const String& formatString,GeometryBucket*bucket);
+			GeometryBucket(const String& name, MaterialBucket* parent,const String& formatString,GeometryBucket*bucket);
+			virtual ~GeometryBucket();
+			MaterialBucket* getParent(void) { return mParent; }
+			Real getBoundingRadius(void) const;
+			/// Get the vertex data for this geometry 
+			const VertexData* getVertexData(void) const { return mVertexData; }
+			/// Get the index data for this geometry 
+			const IndexData* getIndexData(void) const { return mIndexData; }
+			/// @copydoc Renderable::getMaterial
+			const MaterialPtr& getMaterial(void) const;
+			Technique* getTechnique(void) const;
+	        void getWorldTransforms(Matrix4* xform) const;
+			virtual unsigned short getNumWorldTransforms(void) const ;
+			Real getSquaredViewDepth(const Camera* cam) const;
+	        const LightList& getLights(void) const;
+			bool getCastsShadows(void) const;
+			String getFormatString(void) const;
+			/** Try to assign geometry to this bucket.
+			@return false if there is no room left in this bucket
+			*/
+			bool assign(QueuedGeometry* qsm);
+			/// Build
+			void build();
+			/// Dump contents for diagnostics
+			void dump(std::ofstream& of) const;
+			/// Return the BoundingBox information. Useful when cloning the batch instance.
+			AxisAlignedBox & getAABB(void){return mAABB;}
+			/// @copydoc MovableObject::visitRenderables
+			void visitRenderables(Renderable::Visitor* visitor, bool debugRenderables);
+
+		};
+		class _OgreExport  InstancedObject : public BatchedGeometryAlloc
+		{
+			friend class GeometryBucket;
+		public:
+			 enum TransformSpace
+        {
+            /// Transform is relative to the local space
+            TS_LOCAL,
+            /// Transform is relative to the space of the parent node
+            TS_PARENT,
+            /// Transform is relative to world space
+            TS_WORLD
+        };
+			/// list of Geometry Buckets that contains the instanced object
+			typedef vector<GeometryBucket*>::type GeometryBucketList;
+		protected:
+			GeometryBucketList mGeometryBucketList;
+			unsigned short mIndex;
+			Matrix4  mTransformation;
+			Quaternion mOrientation;
+			Vector3	mScale;
+			Vector3 mPosition;
+			SkeletonInstance* mSkeletonInstance;
+			/// Cached bone matrices, including any world transform
+			Matrix4 *mBoneWorldMatrices;
+			/// Cached bone matrices in skeleton local space
+			Matrix4 *mBoneMatrices;
+			/// State of animation for animable meshes
+			AnimationStateSet* mAnimationState;
+			unsigned short mNumBoneMatrices;
+			/// Records the last frame in which animation was updated
+			unsigned long mFrameAnimationLastUpdated;
+		public:
+			InstancedObject(unsigned short index);
+			InstancedObject(unsigned short index,SkeletonInstance *skeleton,AnimationStateSet*animations);
+			~InstancedObject();
+			void setPosition( Vector3  position);
+			const Vector3& getPosition(void) const;
+			void yaw(const Radian& angle);
+			void pitch(const Radian& angle);
+			void roll(const Radian& angle);
+			void rotate(const Quaternion& q);
+			void setScale(const Vector3& scale);
+			const Vector3& getScale() const;
+	        void setOrientation(const Quaternion& q);
+	        void setPositionAndOrientation(Vector3 p, const Quaternion& q);
+            Quaternion & getOrientation(void);
+			void addBucketToList(GeometryBucket* bucket);
+			void needUpdate();
+			GeometryBucketList&getGeometryBucketList(void){return mGeometryBucketList;}
+			void translate(const Matrix3& axes, const Vector3& move);
+			void translate(const Vector3& d);
+			Matrix3 getLocalAxes(void) const;
+			void updateAnimation(void);
+			AnimationState* getAnimationState(const String& name) const;
+			SkeletonInstance*getSkeletonInstance(void){return mSkeletonInstance;}
+
+		};
+		/** A MaterialBucket is a collection of smaller buckets with the same 
+			Material (and implicitly the same LOD). */
+		class _OgreExport  MaterialBucket : public BatchedGeometryAlloc
+		{
+		public:
+			/// list of Geometry Buckets in this BatchInstance
+			typedef vector<GeometryBucket*>::type GeometryBucketList;
+		protected:
+			/// Pointer to parent LODBucket
+			LODBucket* mParent;
+			/// Material being used
+			String mMaterialName;
+			/// Pointer to material being used
+			MaterialPtr mMaterial;
+			/// Active technique
+			Technique* mTechnique;
+			int mLastIndex;
+			/// list of Geometry Buckets in this BatchInstance
+			GeometryBucketList mGeometryBucketList;
+			// index to current Geometry Buckets for a given geometry format
+			typedef map<String, GeometryBucket*>::type CurrentGeometryMap;
+			CurrentGeometryMap mCurrentGeometryMap;
+			/// Get a packed string identifying the geometry format
+			String getGeometryFormatString(SubMeshLodGeometryLink* geom);
+			
+		public:
+			MaterialBucket(LODBucket* parent, const String& materialName);
+			virtual ~MaterialBucket();
+			LODBucket* getParent(void) { return mParent; }
+			/// Get the material name
+			const String& getMaterialName(void) const { return mMaterialName; }
+			/// Assign geometry to this bucket
+			void assign(QueuedGeometry* qsm);
+			/// Build
+			void build();
+			/// Add children to the render queue
+			void addRenderables(RenderQueue* queue, uint8 group, 
+				Real lodValue);
+			/// Get the material for this bucket
+			const MaterialPtr& getMaterial(void) const { return mMaterial; }
+			/// Iterator over geometry
+			typedef VectorIterator<GeometryBucketList> GeometryIterator;
+			/// Get an iterator over the contained geometry
+			GeometryIterator getGeometryIterator(void);
+			/// Get the current Technique
+			Technique* getCurrentTechnique(void) const { return mTechnique; }
+			/// Dump contents for diagnostics
+			void dump(std::ofstream& of) const;
+			/// Return the geometry map
+			MaterialBucket::CurrentGeometryMap* getMaterialBucketMap(void) const;
+			/// Return the geometry list
+			MaterialBucket::GeometryBucketList*getGeometryBucketList(void) const;
+			/// fill in the map and the list
+			void updateContainers(GeometryBucket* bucket, const String &format);
+			void setLastIndex(int index){mLastIndex=index;}
+			int getLastIndex(){return mLastIndex;}
+			void setMaterial(const String & name);
+			void visitRenderables(Renderable::Visitor* visitor, bool debugRenderables);
+		
+		};
+		/** A LODBucket is a collection of smaller buckets with the same LOD. 
+		@remarks
+			LOD refers to Mesh LOD here. Material LOD can change separately
+			at the next bucket down from this.
+		*/
+		class _OgreExport  LODBucket : public BatchedGeometryAlloc
+		{
+		public:
+			/// Lookup of Material Buckets in this BatchInstance
+			typedef map<String, MaterialBucket*>::type MaterialBucketMap;
+		protected:
+			/// Pointer to parent BatchInstance
+			BatchInstance* mParent;
+			/// LOD level (0 == full LOD)
+			unsigned short mLod;
+			/// LOD value at which this LOD starts to apply (squared)
+			Real mLodValue;
+			/// Lookup of Material Buckets in this BatchInstance
+			MaterialBucketMap mMaterialBucketMap;
+			/// Geometry queued for a single LOD (deallocated here)
+			QueuedGeometryList mQueuedGeometryList;
+		public:
+			LODBucket(BatchInstance* parent, unsigned short lod, Real lodValue);
+			virtual ~LODBucket();
+			BatchInstance* getParent(void) { return mParent; }
+			/// Get the LOD index
+			ushort getLod(void) const { return mLod; }
+			/// Get the LOD value
+			Real getLodValue(void) const { return mLodValue; }
+			/// Assign a queued submesh to this bucket, using specified mesh LOD
+			void assign(QueuedSubMesh* qsm, ushort atLod);
+			/// Build
+			void build();
+			/// Add children to the render queue
+			void addRenderables(RenderQueue* queue, uint8 group, 
+				Real lodValue);
+			/// Iterator over the materials in this LOD
+			typedef MapIterator<MaterialBucketMap> MaterialIterator;
+			/// Get an iterator over the materials in this LOD
+			MaterialIterator getMaterialIterator(void);
+			/// Dump contents for diagnostics
+			void dump(std::ofstream& of) const;
+			/// fill the map
+			void updateContainers(MaterialBucket* bucket, String& name );
+			void visitRenderables(Renderable::Visitor* visitor, bool debugRenderables);
+			
+		};
+		/** The details of a topological BatchInstance which is the highest level of
+			partitioning for this class.
+		@remarks
+			The size & shape of BatchInstances entirely depends on the SceneManager
+			specific implementation. It is a MovableObject since it will be
+			attached to a node based on the local centre - in practice it
+			won't actually move (although in theory it could).
+		*/
+		class _OgreExport  BatchInstance : public MovableObject
+		{
+            friend class MaterialBucket;
+			public:
+		
+
+			/// list of LOD Buckets in this BatchInstance
+			typedef vector<LODBucket*>::type LODBucketList;
+			typedef map<unsigned short, InstancedObject*>::type ObjectsMap;
+			typedef MapIterator<ObjectsMap> InstancedObjectIterator;
+		protected:
+			
+			/// Parent static geometry
+			InstancedGeometry* mParent;
+			/// Scene manager link
+			SceneManager* mSceneMgr;
+			/// Scene node
+			SceneNode* mNode;
+			/// Local list of queued meshes (not used for deallocation)
+			QueuedSubMeshList mQueuedSubMeshes;
+			/// Unique identifier for the BatchInstance
+			uint32 mBatchInstanceID;
+
+			ObjectsMap mInstancesMap;
+		public:
+			/// LOD values as built up - use the max at each level
+			Mesh::LodValueList mLodValues;
+			/// Local AABB relative to BatchInstance centre
+			AxisAlignedBox mAABB;
+			/// Local bounding radius
+			Real mBoundingRadius;
+			/// The current LOD level, as determined from the last camera
+			ushort mCurrentLod;
+			/// Current LOD value, passed on to do material LOD later
+			Real mLodValue;
+            /// Current camera, passed on to do material LOD later
+            Camera *mCamera;
+            /// Cached squared view depth value to avoid recalculation by GeometryBucket
+            Real mSquaredViewDepth;
+		protected:
+			/// List of LOD buckets			
+			LODBucketList mLodBucketList;
+            /// LOD strategy reference
+            const LodStrategy *mLodStrategy;
+
+		public:
+			BatchInstance(InstancedGeometry* parent, const String& name, SceneManager* mgr, 
+				uint32 BatchInstanceID);
+			virtual ~BatchInstance();
+			// more fields can be added in subclasses
+			InstancedGeometry* getParent(void) const { return mParent;}
+			/// Assign a queued mesh to this BatchInstance, read for final build
+			void assign(QueuedSubMesh* qmesh);
+			/// Build this BatchInstance
+			void build();
+			/// Get the BatchInstance ID of this BatchInstance
+			uint32 getID(void) const { return mBatchInstanceID; }
+			/// Get the centre point of the BatchInstance
+//			const Vector3& getCentre(void) const { return mCentre; }
+			const String& getMovableType(void) const;
+			void _notifyCurrentCamera(Camera* cam);
+			const AxisAlignedBox& getBoundingBox(void) const;
+			void  setBoundingBox(AxisAlignedBox& box);
+			Real getBoundingRadius(void) const;
+			void _updateRenderQueue(RenderQueue* queue);
+			bool isVisible(void) const;
+			/// @copydoc MovableObject::visitRenderables
+			void visitRenderables(Renderable::Visitor* visitor, 
+				bool debugRenderables = false);
+
+		//	uint32 getTypeFlags(void) const;
+
+			typedef VectorIterator<LODBucketList> LODIterator;
+			/// Get an iterator over the LODs in this BatchInstance
+			LODIterator getLODIterator(void);
+			/// Shared set of lights for all GeometryBuckets
+			const LightList& getLights(void) const;
+
+			/// update the bounding box of the BatchInstance according to the positions of the objects
+			void updateBoundingBox();
+
+			/// Dump contents for diagnostics
+			void dump(std::ofstream& of) const;
+			/// fill in the list 
+			void updateContainers(LODBucket* bucket );
+			/// attach the BatchInstance to the scene
+			void attachToScene();
+			void addInstancedObject(unsigned short index, InstancedObject* object);
+			InstancedObject*  isInstancedObjectPresent(unsigned short index);
+			InstancedObjectIterator getObjectIterator();
+			SceneNode*getSceneNode(void){return mNode;}
+			ObjectsMap& getInstancesMap(void){return  mInstancesMap;}
+			/// change the shader used to render the batch instance
+			
+		};
+		/** Indexed BatchInstance map based on packed x/y/z BatchInstance index, 10 bits for
+			each axis.
+		*/
+		typedef map<uint32, BatchInstance*>::type BatchInstanceMap;
+		/** Simple vectors where are stored all the render operations of the Batch.
+			This vector is used when we want to delete the batch, in order to delete only one time each
+			render operation.
+
+		*/
+		typedef vector<RenderOperation*>::type RenderOperationVector;
+	protected:
+		// General state & settings
+		SceneManager* mOwner;
+		String mName;
+		bool mBuilt;
+		Real mUpperDistance;
+		Real mSquaredUpperDistance;
+		bool mCastShadows;
+		Vector3 mBatchInstanceDimensions;
+		Vector3 mHalfBatchInstanceDimensions;
+		Vector3 mOrigin;
+		bool mVisible;
+        /// Flags to indicate whether the World Transform Inverse matrices are passed to the shaders
+        bool mProvideWorldInverses;
+        /// The render queue to use when rendering this object
+        uint8 mRenderQueueID;
+		/// Flags whether the RenderQueue's default should be used.
+		bool mRenderQueueIDSet;
+		/// number of objects in the batch
+		unsigned int mObjectCount;
+		QueuedSubMeshList mQueuedSubMeshes;
+		BatchInstance*mInstancedGeometryInstance;
+		/**this is just a pointer to the base skeleton that will be used for each animated object in the batches
+		This pointer has a value only during the creation of the InstancedGeometry
+		*/
+		SkeletonPtr mBaseSkeleton;
+		SkeletonInstance *mSkeletonInstance;
+		/**This is the main animation state. All "objects" in the batch will use an instance of this animation
+		state
+		*/
+		AnimationStateSet* mAnimationState;
+		/// List of geometry which has been optimised for SubMesh use
+		/// This is the primary storage used for cleaning up later
+		OptimisedSubMeshGeometryList mOptimisedSubMeshGeometryList;
+
+		/** Cached links from SubMeshes to (potentially optimised) geometry
+			This is not used for deletion since the lookup may reference
+			original vertex data
+		*/
+		SubMeshGeometryLookup mSubMeshGeometryLookup;
+			
+		/// Map of BatchInstances
+		BatchInstanceMap mBatchInstanceMap;
+		/** This vector stores all the renderOperation used in the batch. 
+		See the type definition for more details.
+		*/
+		RenderOperationVector mRenderOps;
+		/** Virtual method for getting a BatchInstance most suitable for the
+			passed in bounds. Can be overridden by subclasses.
+		*/
+		virtual BatchInstance* getBatchInstance(const AxisAlignedBox& bounds, bool autoCreate);
+		/** Get the BatchInstance within which a point lies */
+		virtual BatchInstance* getBatchInstance(const Vector3& point, bool autoCreate);
+		/** Get the BatchInstance using indexes */
+		virtual BatchInstance* getBatchInstance(ushort x, ushort y, ushort z, bool autoCreate);
+		/** Get the BatchInstance using a packed index, returns null if it doesn't exist. */
+		virtual BatchInstance* getBatchInstance(uint32 index);
+		/** Get the BatchInstance indexes for a point.
+		*/
+		virtual void getBatchInstanceIndexes(const Vector3& point, 
+			ushort& x, ushort& y, ushort& z);
+		/** get the first BatchInstance or create on if it does not exists.
+		*/
+		virtual BatchInstance* getInstancedGeometryInstance(void);
+		/** Pack 3 indexes into a single index value
+		*/
+		virtual uint32 packIndex(ushort x, ushort y, ushort z);
+		/** Get the volume intersection for an indexed BatchInstance with some bounds.
+		*/
+		virtual Real getVolumeIntersection(const AxisAlignedBox& box,  
+			ushort x, ushort y, ushort z);
+		/** Get the bounds of an indexed BatchInstance.
+		*/
+		virtual AxisAlignedBox getBatchInstanceBounds(ushort x, ushort y, ushort z);
+		/** Get the centre of an indexed BatchInstance.
+		*/
+		virtual Vector3 getBatchInstanceCentre(ushort x, ushort y, ushort z);
+		/** Calculate world bounds from a set of vertex data. */
+		virtual AxisAlignedBox calculateBounds(VertexData* vertexData, 
+			const Vector3& position, const Quaternion& orientation, 
+			const Vector3& scale);
+		/** Look up or calculate the geometry data to use for this SubMesh */
+		SubMeshLodGeometryLinkList* determineGeometry(SubMesh* sm);
+		/** Split some shared geometry into dedicated geometry. */
+		void splitGeometry(VertexData* vd, IndexData* id, 
+			SubMeshLodGeometryLink* targetGeomLink);
+
+		typedef map<size_t, size_t>::type IndexRemap;
+		/** Method for figuring out which vertices are used by an index buffer
+			and calculating a remap lookup for a vertex buffer just containing
+			those vertices. 
+		*/
+		template <typename T>
+		void buildIndexRemap(T* pBuffer, size_t numIndexes, IndexRemap& remap)
+		{
+			remap.clear();
+			for (size_t i = 0; i < numIndexes; ++i)
+			{
+				// use insert since duplicates are silently discarded
+				remap.insert(IndexRemap::value_type(*pBuffer++, remap.size()));
+				// this will have mapped oldindex -> new index IF oldindex
+				// wasn't already there
+			}
+		}
+		/** Method for altering indexes based on a remap. */
+		template <typename T>
+		void remapIndexes(T* src, T* dst, const IndexRemap& remap, 
+				size_t numIndexes)
+		{
+			for (size_t i = 0; i < numIndexes; ++i)
+			{
+				// look up original and map to target
+				IndexRemap::const_iterator ix = remap.find(*src++);
+				assert(ix != remap.end());
+				*dst++ = static_cast<T>(ix->second);
+			}
+		}
+		
+	public:
+		/// Constructor; do not use directly (@see SceneManager::createInstancedGeometry)
+		InstancedGeometry(SceneManager* owner, const String& name);
+		/// Destructor
+		virtual ~InstancedGeometry();
+
+		/// Get the name of this object
+		const String& getName(void) const { return mName; }
+		/** Adds an Entity to the static geometry.
+		@remarks
+			This method takes an existing Entity and adds its details to the 
+			list of	elements to include when building. Note that the Entity
+			itself is not copied or referenced in this method; an Entity is 
+			passed simply so that you can change the materials of attached 
+			SubEntity objects if you want. You can add the same Entity 
+			instance multiple times with different material settings 
+			completely safely, and destroy the Entity before destroying 
+			this InstancedGeometry if you like. The Entity passed in is simply 
+			used as a definition.
+		@note Must be called before 'build'.
+        @note All added entities must use the same LOD strategy.
+		@param ent The Entity to use as a definition (the Mesh and Materials 
+			referenced will be recorded for the build call).
+		@param position The world position at which to add this Entity
+		@param orientation The world orientation at which to add this Entity
+		@param scale The scale at which to add this entity
+		*/
+		virtual void addEntity(Entity* ent, const Vector3& position,
+			const Quaternion& orientation = Quaternion::IDENTITY, 
+			const Vector3& scale = Vector3::UNIT_SCALE);
+
+		/** Adds all the Entity objects attached to a SceneNode and all it's
+			children to the static geometry.
+		@remarks
+			This method performs just like addEntity, except it adds all the 
+			entities attached to an entire sub-tree to the geometry. 
+			The position / orientation / scale parameters are taken from the
+			node structure instead of being specified manually. 
+		@note
+			The SceneNode you pass in will not be automatically detached from 
+			it's parent, so if you have this node already attached to the scene
+			graph, you will need to remove it if you wish to avoid the overhead
+			of rendering <i>both</i> the original objects and their new static
+			versions! We don't do this for you incase you are preparing this 
+			in advance and so don't want the originals detached yet. 
+		@note Must be called before 'build'.
+        @note All added entities must use the same LOD strategy.
+		@param node Pointer to the node to use to provide a set of Entity 
+			templates
+		*/
+		virtual void addSceneNode(const SceneNode* node);
+
+		/** Build the geometry. 
+		@remarks
+			Based on all the entities which have been added, and the batching 
+			options which have been set, this method constructs	the batched 
+			geometry structures required. The batches are added to the scene 
+			and will be rendered unless you specifically hide them.
+		@note
+			Once you have called this method, you can no longer add any more 
+			entities.
+		*/
+		virtual void build(void);
+			/** Add a new batch instance
+		@remarks
+				This method add a new instance of the whole batch, by creating a new 
+				BatchInstance, containing new LOD buckets, material buckets and geometry buckets.
+				The new geometry buckets will use the same buffers as the base bucket.
+		@note
+			no note
+		*/
+		void addBatchInstance(void);
+		/** Destroys all the built geometry state (reverse of build). 
+		@remarks
+			You can call build() again after this and it will pick up all the
+			same entities / nodes you queued last time.
+		*/
+		virtual void destroy(void);
+
+		/** Clears any of the entities / nodes added to this geometry and 
+			destroys anything which has already been built.
+		*/
+		virtual void reset(void);
+
+		/** Sets the distance at which batches are no longer rendered.
+		@remarks
+			This lets you turn off batches at a given distance. This can be 
+			useful for things like detail meshes (grass, foliage etc) and could
+			be combined with a shader which fades the geometry out beforehand 
+			to lessen the effect.
+		@param dist Distance beyond which the batches will not be rendered 
+			(the default is 0, which means batches are always rendered).
+		*/
+		virtual void setRenderingDistance(Real dist) { 
+			mUpperDistance = dist; 
+			mSquaredUpperDistance = mUpperDistance * mUpperDistance;
+		}
+
+		/** Gets the distance at which batches are no longer rendered. */
+		virtual Real getRenderingDistance(void) const { return mUpperDistance; }
+
+		/** Gets the squared distance at which batches are no longer rendered. */
+		virtual Real getSquaredRenderingDistance(void) const 
+		{ return mSquaredUpperDistance; }
+
+		/** Hides or shows all the batches. */
+		virtual void setVisible(bool visible);
+
+		/** Are the batches visible? */
+		virtual bool isVisible(void) const { return mVisible; }
+
+		/** Sets whether this geometry should cast shadows.
+		@remarks
+			No matter what the settings on the original entities,
+			the InstancedGeometry class defaults to not casting shadows. 
+			This is because, being static, unless you have moving lights
+			you'd be better to use precalculated shadows of some sort.
+			However, if you need them, you can enable them using this
+			method. If the SceneManager is set up to use stencil shadows,
+			edge lists will be copied from the underlying meshes on build.
+			It is essential that all meshes support stencil shadows in this
+			case.
+		@note If you intend to use stencil shadows, you must set this to 
+			true before calling 'build' as well as making sure you set the
+			scene's shadow type (that should always be the first thing you do
+			anyway). You can turn shadows off temporarily but they can never 
+			be turned on if they were not at the time of the build. 
+		*/
+		virtual void setCastShadows(bool castShadows);
+		/// Will the geometry from this object cast shadows?
+		virtual bool getCastShadows(void) { return mCastShadows; }
+
+		/** Sets the size of a single BatchInstance of geometry.
+		@remarks
+			This method allows you to configure the physical world size of 
+			each BatchInstance, so you can balance culling against batch size. Entities
+			will be fitted within the batch they most closely fit, and the 
+			eventual bounds of each batch may well be slightly larger than this
+			if they overlap a little. The default is Vector3(1000, 1000, 1000).
+		@note Must be called before 'build'.
+		@param size Vector3 expressing the 3D size of each BatchInstance.
+		*/
+		virtual void setBatchInstanceDimensions(const Vector3& size) { 
+			mBatchInstanceDimensions = size; 
+			mHalfBatchInstanceDimensions = size * 0.5;
+		}
+		/** Gets the size of a single batch of geometry. */
+		virtual const Vector3& getBatchInstanceDimensions(void) const { return mBatchInstanceDimensions; }
+		/** Sets the origin of the geometry.
+		@remarks
+			This method allows you to configure the world centre of the geometry,
+			thus the place which all BatchInstances surround. You probably don't need 
+			to mess with this unless you have a seriously large world, since the
+			default set up can handle an area 1024 * mBatchInstanceDimensions, and 
+			the sparseness of population is no issue when it comes to rendering.
+			The default is Vector3(0,0,0).
+		@note Must be called before 'build'.
+		@param origin Vector3 expressing the 3D origin of the geometry.
+		*/
+		virtual void setOrigin(const Vector3& origin) { mOrigin = origin; }
+		/** Gets the origin of this geometry. */
+		virtual const Vector3& getOrigin(void) const { return mOrigin; }
+
+        /** Sets the render queue group this object will be rendered through.
+        @remarks
+            Render queues are grouped to allow you to more tightly control the ordering
+            of rendered objects. If you do not call this method, all  objects default
+            to the default queue (RenderQueue::getDefaultQueueGroup), which is fine for 
+			most objects. You may want to alter this if you want to perform more complex
+			rendering.
+        @par
+            See RenderQueue for more details.
+        @param queueID Enumerated value of the queue group to use.
+        */
+        virtual void setRenderQueueGroup(uint8 queueID);
+
+        /** Gets the queue group for this entity, see setRenderQueueGroup for full details. */
+        virtual uint8 getRenderQueueGroup(void) const;
+		/// Iterator for iterating over contained BatchInstances
+		typedef MapIterator<BatchInstanceMap> BatchInstanceIterator;
+		/// Get an iterator over the BatchInstances in this geometry
+		BatchInstanceIterator getBatchInstanceIterator(void);
+		/// get the mRenderOps vector.
+		RenderOperationVector& getRenderOperationVector(){return mRenderOps;}
+		/// @copydoc MovableObject::visitRenderables
+		void visitRenderables(Renderable::Visitor* visitor, 
+			bool debugRenderables = false);
+
+		/** Dump the contents of this InstancedGeometry to a file for diagnostic
+		 	purposes.
+		*/
+		virtual void dump(const String& filename) const;
+		/**
+		@remarks
+		Return the skeletonInstance that will be used 
+		*/
+		SkeletonInstance *getBaseSkeletonInstance(void){return mSkeletonInstance;}
+		/**
+		@remarks
+		Return the skeleton that is shared by all instanced objects.
+		*/
+		SkeletonPtr getBaseSkeleton(void){return mBaseSkeleton;}
+		/**
+		@remarks
+		Return the animation state that will be cloned each time an InstancedObject is made
+		*/
+		AnimationStateSet* getBaseAnimationState(void){return mAnimationState;}
+		/**
+		@remarks
+		return the total number of object that are in all the batches
+		*/
+		unsigned int getObjectCount(void){return mObjectCount;}
+
+        /**
+        @remarks
+        Allows World Transform Inverse matrices to be passed as shader constants along with the world
+        transform matrix list. Reduces the number of usable geometries in an instance to 40 instead of 80.
+		The inverse matrices are interleaved with the world matrices at n+1.
+        */
+        virtual void setProvideWorldInverses(bool flag);
+
+        /**
+        @remarks
+        Returns the toggle state indicating whether the World Transform INVERSE matrices would
+        be passed to the shaders.
+        */
+        virtual bool getProvideWorldInverses(void) const { return mProvideWorldInverses; }
+	};
+
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreIteratorRange.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreIteratorRange.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreIteratorRange.h	(revision 148)
@@ -0,0 +1,339 @@
+/*
+-----------------------------------------------------------------------------
+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 __Ogre_Iterator_Range_H__
+#define __Ogre_Iterator_Range_H__
+
+#include "OgreHeaderPrefix.h"
+
+#if OGRE_USE_BOOST
+#   if OGRE_COMPILER == OGRE_COMPILER_CLANG || OGRE_COMPILER == OGRE_COMPILER_GNUC
+#       pragma GCC diagnostic push
+#if OGRE_COMPILER == OGRE_COMPILER_GNUC
+#       pragma GCC diagnostic ignored "-Wpragmas"
+#elif OGRE_COMPILER == OGRE_COMPILER_CLANG
+#       pragma GCC diagnostic ignored "-Wdocumentation"
+#endif
+#       pragma GCC diagnostic ignored "-Wshadow"
+#       pragma GCC diagnostic ignored "-Wpadded"
+#       pragma GCC diagnostic ignored "-Wweak-vtables"
+#       pragma GCC diagnostic ignored "-Wall"
+#       pragma GCC diagnostic ignored "-Wundef"
+#   endif
+
+#   include <boost/range.hpp>
+
+#   if OGRE_COMPILER == OGRE_COMPILER_CLANG || OGRE_COMPILER == OGRE_COMPILER_GNUC
+#       pragma GCC diagnostic pop
+#   endif
+#endif
+
+namespace Ogre {
+
+/** 
+ * 
+ * @brief Base for an iterator_range
+ * 
+ * @tparam T iterator type
+ * 
+ * This class implements the minimal interface of the (boost::iterator_)range concept
+ *\n Also it prepairs for direct usage of boost::iterator_range by providing the real used type via iterator_range::type
+ *   so that client code does not have to change when boost::iterator_range will be implemented some day.
+ *\n see VectorRange MapRange or corresponding Const variants for a sample of concrete usage of the iterator_range::type
+*/
+template <typename T>
+class iterator_range{
+
+#if !OGRE_USE_BOOST
+	
+	T mBegin, mEnd;
+	
+	public : 
+	
+        /** Constructor.
+        @remarks
+        Provide a start and end iterator to initialise.
+        */
+		iterator_range( T b , T e ) : mBegin(b) , mEnd(e){}
+
+		///access to the begin of the range
+		T begin() const { return mBegin; }
+		
+		///access to the end of the range
+		T end() const 	{ return mEnd;  } 	
+
+		///informs if there are any elements in the range
+		bool empty() const { return mBegin = mEnd ; }
+
+		///comparison for equality
+		bool equal( const iterator_range& other ) const  
+		{return mBegin == other.mBegin && mEnd == other.mEnd;}
+
+		///comparison operator for equality
+		bool operator==( const iterator_range& rhs ) const
+		{return equal( rhs ) ;}
+	
+		///comparison operator for inequality
+		bool operator!=( const iterator_range& rhs ) const { return !operator==(rhs); }
+
+		/**
+		@brief typedef to fulfill container interface
+		
+		@note there is no distinction between const_iterator and iterator.
+		
+		*/				
+		typedef T iterator;
+		
+		/**
+		@brief typedef to fulfill container interface
+		
+		@note there is no distinction between const_iterator and iterator.
+		
+		*/						
+		typedef T const_iterator;
+		
+		/// defines the real used type
+		/**
+			type will be defined as Ogre::iterator_range if not used with boost
+			\n otherwise the type will be boost::iterator_range
+		*/
+		typedef iterator_range<T> type;
+#else
+		/// defines (this) type as boost::iterator_range
+		public: typedef boost::iterator_range<T> type ;
+
+#endif
+}; 
+
+
+/** 
+ * 
+ * @brief Predefined type
+ * 
+ * @tparam T iterator type
+ *
+ * compatility class for VectorIterator
+*/
+template<typename T>
+struct VectorRange : public iterator_range<typename T::iterator>::type
+{
+
+	/** Constructor.
+	@remarks
+		Provide a container to initialise.
+	*/
+	VectorRange( T& c )
+	: iterator_range<typename T::iterator>::type( c.begin(), c.end() )
+	{}
+
+	/** Constructor.
+	@remarks
+	Provide a start and end iterator to initialise.
+	*/
+	VectorRange( typename T::iterator b, typename T::iterator e )
+	: iterator_range<typename T::iterator>::type( b, e )
+	{}
+
+	///comparison operator for equality
+	bool operator==( const VectorRange& rhs ) const { return equal( rhs) ; }
+	///comparison operator for inequality
+	bool operator!=( const VectorRange& rhs ) const { return !equal( rhs) ; }
+
+
+#ifdef __Ogre_Iterator_Wrapper_H__
+	///cast operator to a VectorIterator
+	operator VectorIterator<T>(){return VectorIterator<T>( this->begin(), this->end());}
+	///cast operator to a ConstVectorIterator
+	operator ConstVectorIterator<T>(){return ConstVectorIterator<T>( this->begin(), this->end());}
+#endif
+	
+};
+
+/** 
+ * 
+ * @brief Predefined type
+ * 
+ * @tparam T iterator type
+ *
+ * compatility class for ConstVectorIterator
+*/
+template<typename T>
+struct ConstVectorRange : public iterator_range<typename T::const_iterator>::type
+{
+
+	/** Constructor.
+	@remarks
+		Provide a container to initialise.
+	*/
+	ConstVectorRange( const T& c )
+	: iterator_range<typename T::const_iterator>::type( c.begin(), c.end() )
+	{}
+
+	/** Constructor.
+	@remarks
+	Provide a start and end iterator to initialise.
+	*/
+	ConstVectorRange( typename T::iterator b, typename T::iterator e )
+	: iterator_range<typename T::const_iterator>::type( b, e )
+	{}
+
+	/** Constructor.
+	@remarks
+	Provide a start and end const_iterator to initialise.
+	*/
+	ConstVectorRange( typename T::const_iterator b, typename T::const_iterator e )
+	: iterator_range<typename T::const_iterator>::type( b, e )
+	{}
+
+	/** Constructor.
+	@remarks
+	Provide a VectorRange to initialise.
+	*/
+	ConstVectorRange( const VectorRange<T>& rhs  )
+	: iterator_range<typename T::const_iterator>::type( rhs.begin(), rhs.end() )
+	{}
+
+	///comparison operator for equality
+	bool operator==( const ConstVectorRange& rhs ) const { return equal( rhs) ; }
+	///comparison operator for inequality
+	bool operator!=( const ConstVectorRange& rhs ) const { return !equal( rhs) ; }
+	
+	
+
+
+#ifdef __Ogre_Iterator_Wrapper_H__
+	///cast operator to a ConstVectorIterator
+	operator ConstVectorIterator<T>(){return  ConstVectorIterator<T>( this->begin(),this->end());}
+#endif
+	
+};
+
+
+
+/** 
+ * 
+ * @brief Predefined type
+ * 
+ * @tparam T iterator type
+ *
+ * compatility class for MapIterator
+*/
+template<typename T>
+struct MapRange : public iterator_range<typename T::iterator>::type
+{
+	/** Constructor.
+	@remarks
+		Provide a container to initialise.
+	*/
+	MapRange( T& c )
+	: iterator_range<typename T::iterator>::type( c.begin(), c.end() )
+	{}
+
+	/** Constructor.
+	@remarks
+	Provide a start and end iterator to initialise.
+	*/
+	MapRange( typename T::iterator b, typename T::iterator e )
+	: iterator_range<typename T::iterator>::type( b, e )
+	{}
+
+	///comparison operator for equality
+	bool operator==( const MapRange& rhs ) const { return equal( rhs) ; }
+	///comparison operator for inequality
+	bool operator!=( const MapRange& rhs ) const { return !equal( rhs) ; }
+
+
+#ifdef __Ogre_Iterator_Wrapper_H__
+	///cast operator to a MapIterator
+	operator MapIterator<T>(){return MapIterator<T>( this->begin(), this->end());}
+	///cast operator to a ConstMapIterator
+	operator ConstMapIterator<T>(){return ConstMapIterator<T>( this->begin(), this->end());}
+#endif
+	
+};
+
+/** 
+ * 
+ * @brief Predefined type
+ * 
+ * @tparam T iterator type   
+ *
+ * compatility class for ConstMapIterator
+*/
+template<typename T>
+struct ConstMapRange : public iterator_range<typename T::const_iterator>::type
+{
+
+	/** Constructor.
+	@remarks
+		Provide a container to initialise.
+	*/
+	ConstMapRange( const T& c )
+	: iterator_range<typename T::const_iterator>::type( c.begin(), c.end() )
+	{}
+
+	/** Constructor.
+	@remarks
+	Provide a start and end iterator to initialise.
+	*/
+	ConstMapRange( typename T::iterator b, typename T::iterator e )
+	: iterator_range<typename T::const_iterator>::type( b, e )
+	{}
+	
+	/** Constructor.
+	@remarks
+	Provide a start and end const_iterator to initialise.
+	*/
+	ConstMapRange( typename T::const_iterator b, typename T::const_iterator e )
+	: iterator_range<typename T::const_iterator>::type( b, e )
+	{}
+
+	/** Constructor.
+	@remarks
+	Provide a MapRange to initialise.
+	*/
+	ConstMapRange( const MapRange<T>& rhs  )
+	: iterator_range<typename T::const_iterator>::type( rhs.begin(), rhs.end() )
+	{}
+	
+	///comparison operator for equality
+	bool operator==( const ConstMapRange& rhs ) const { return equal( rhs) ; }
+	///comparison operator for inequality
+	bool operator!=( const ConstMapRange& rhs ) const { return !equal( rhs) ; }
+
+
+#ifdef __Ogre_Iterator_Wrapper_H__
+	///cast operator to a ConstMapIterator
+	operator ConstMapIterator<T>(){return  ConstMapIterator<T>( this->begin(),this->end());}
+#endif
+	
+};
+
+#include "OgreHeaderSuffix.h"
+
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreIteratorWrapper.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreIteratorWrapper.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreIteratorWrapper.h	(revision 148)
@@ -0,0 +1,381 @@
+/*
+-----------------------------------------------------------------------------
+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 __Ogre_Iterator_Wrapper_H__
+#define __Ogre_Iterator_Wrapper_H__
+
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre{
+
+/** 
+ * 
+ * @brief Basefunctionality for IteratorWrappers
+ *
+ * 
+ * @tparam T a Container like vector list map ...
+ * @tparam IteratorType  T::iterator or T::const_iterator
+ * @tparam ValType  T::mapped_type in case of a map, T::value_type for vector, list,...
+ * 
+ * Have a look at VectorIteratorWrapper and MapIteratorWrapper for a concrete usage
+*/
+template <typename T, typename IteratorType, typename ValType>
+class IteratorWrapper
+{
+
+	private:
+		/// Private constructor since only the parameterised constructor should be used
+		IteratorWrapper();
+
+	protected:
+		IteratorType mBegin;
+		IteratorType mCurrent;
+		IteratorType mEnd;
+	
+
+	public:
+	
+		/// Type you expect to get by funktions like peekNext(Value)
+		typedef ValType ValueType;
+		/// Type you expect to get by funktions like peekNext(Value)Ptr
+		typedef ValType* PointerType;
+
+		/**
+		@brief Typedef to fulfill container interface
+		
+		Useful if you want to use BOOST_FOREACH
+		@note there is no distinction between const_iterator and iterator.
+		\n keep this in mind if you want to derivate from this class. 
+		*/
+		typedef IteratorType iterator;
+		
+		/**
+		@brief Typedef to fulfill container interface
+		
+		Useful if you want to use BOOST_FOREACH
+		@note there is no distinction between const_iterator and iterator.
+		\n keep this in mind if you want to derivate from this class. 
+		*/
+		typedef IteratorType const_iterator;
+
+		
+        /** Constructor.
+        @remarks
+        Provide a start and end iterator to initialise.
+        */
+		IteratorWrapper ( IteratorType start, IteratorType last )
+		: mBegin( start ), mCurrent ( start ), mEnd ( last )
+		{
+		}
+
+
+		/** Returns true if there are more items in the collection. */
+		bool hasMoreElements ( ) const
+		{
+			return mCurrent != mEnd;
+		}
+
+
+		/** Moves the iterator on one element. */
+		void moveNext (  )
+		{
+			++mCurrent;
+		}
+
+		/** Bookmark to the begin of the underlying collection */
+		const IteratorType& begin() {return mBegin;}
+		
+		
+		/** Full access to the current  iterator */
+		IteratorType& current(){return mCurrent;}
+		
+		/** Bookmark to the end (one behind the last element) of the underlying collection */
+		const IteratorType& end() {return mEnd;}
+		
+
+};
+
+
+
+/** 
+ * 
+ * @brief Prepared IteratorWrapper for container like std::vector 
+ *
+ * 
+ * @tparam T = Container eg vector
+ * @tparam IteratorType  T::iterator or T::const_iterator
+ * 
+ * Have a look at VectorIterator and ConstVectorIterator for a more concrete usage
+*/
+template <typename T, typename IteratorType>
+class VectorIteratorWrapper : public IteratorWrapper<T, IteratorType, typename  T::value_type>
+{
+
+	public:
+		typedef typename IteratorWrapper<T, IteratorType, typename  T::value_type>::ValueType ValueType ; 
+		typedef typename IteratorWrapper<T, IteratorType, typename  T::value_type>::PointerType PointerType ;
+	
+
+		/**
+		 * @brief c'tor
+		 * 
+		 * Constructor that provide a start and end iterator to initialise.
+		 * 
+		 * @param start Start iterator 
+		 * @param last End iterator 
+		 */
+		VectorIteratorWrapper ( IteratorType start, IteratorType last )
+		: IteratorWrapper<T, IteratorType, typename T::value_type>( start, last ) 
+		{
+		}
+
+
+		/** Returns the next(=current) element in the collection, without advancing to the next. */
+		ValueType peekNext (  ) const
+		{
+			return *(this->mCurrent);
+		}
+
+		/** Returns a pointer to the next(=current) element in the collection, without advancing to the next afterwards. */
+		PointerType peekNextPtr (  )  const
+		{
+			return &(*(this->mCurrent) );
+		}
+
+		/** Returns the next(=current) value element in the collection, and advances to the next. */
+		ValueType getNext (  ) 
+		{
+			return *(this->mCurrent++);
+		}	
+
+};
+
+
+/** 
+ * 
+ * @brief Concrete IteratorWrapper for nonconst access to the underlying container
+ * 
+ * @tparam T  Container
+ * 
+*/
+template <typename T>
+class VectorIterator : public VectorIteratorWrapper<T,  typename T::iterator>{
+	public:
+        /** Constructor.
+        @remarks
+            Provide a start and end iterator to initialise.
+        */	
+		VectorIterator( typename T::iterator start, typename T::iterator last )
+		: VectorIteratorWrapper<T,  typename T::iterator>(start , last )
+		{
+		}
+
+        /** Constructor.
+        @remarks
+            Provide a container to initialise.
+        */
+		explicit VectorIterator( T& c )
+		: VectorIteratorWrapper<T,  typename T::iterator> ( c.begin(), c.end() )
+		{
+		}
+		
+};
+
+/** 
+ * 
+ * @brief Concrete IteratorWrapper for const access to the underlying container
+ *
+ * 
+ * @tparam T = Container
+ * 
+*/
+template <typename T>
+class ConstVectorIterator : public VectorIteratorWrapper<T,  typename T::const_iterator>{
+	public:
+        /** Constructor.
+        @remarks
+            Provide a start and end iterator to initialise.
+        */	
+		ConstVectorIterator( typename T::const_iterator start, typename T::const_iterator last )
+		: VectorIteratorWrapper<T,  typename T::const_iterator> (start , last )
+		{
+		}
+
+        /** Constructor.
+        @remarks
+            Provide a container to initialise.
+        */
+		explicit ConstVectorIterator ( const T& c )
+		 : VectorIteratorWrapper<T,  typename T::const_iterator> (c.begin() , c.end() )
+		{
+		}
+};
+
+
+
+
+
+/** 
+ * 
+ * @brief Prepared IteratorWrapper for key-value container
+ *
+ * 
+ * @tparam T  Container  (map - or also set )
+ * @tparam  IteratorType T::iterator or T::const_iterator
+ * 
+ * Have a look at MapIterator and ConstMapIterator for a concrete usage
+*/
+template <typename T, typename IteratorType>
+class MapIteratorWrapper  : public IteratorWrapper<T, IteratorType, typename T::mapped_type>
+{
+
+	public:
+		/// Redefined ValueType for a map/set
+		typedef typename IteratorWrapper<T, IteratorType, typename  T::mapped_type>::ValueType ValueType ; 
+		/// Redefined PointerType for a map/set
+		typedef typename IteratorWrapper<T, IteratorType, typename  T::mapped_type>::PointerType PointerType ;	
+		
+		/// Unused, just to make it clear that map/set::value_type is not a ValueType
+		typedef typename T::value_type PairType ; 
+		/// Type you expect to get by funktions like peekNextKey
+		typedef typename T::key_type KeyType;
+        
+        /** Constructor.
+        @remarks
+            Provide a start and end iterator to initialise.
+        */
+		MapIteratorWrapper ( IteratorType start, IteratorType last )
+		: IteratorWrapper<T, IteratorType, typename T::mapped_type>( start, last ) 
+		{
+		}
+
+        /** Returns the next(=current) key element in the collection, without advancing to the next. */
+        KeyType peekNextKey(void) const
+        {
+            return this->mCurrent->first;
+        }
+
+
+		/** Returns the next(=current) value element in the collection, without advancing to the next. */
+		ValueType peekNextValue (  ) const
+		{
+			return this->mCurrent->second;
+		}
+
+
+        /** Returns a pointer to the next/current value element in the collection, without 
+        advancing to the next afterwards. */
+		const PointerType peekNextValuePtr (  )  const
+		{
+			return &(this->mCurrent->second);
+		}
+
+
+        /** Returns the next(=current) value element in the collection, and advances to the next. */
+        ValueType getNext()
+        {
+            return ((this->mCurrent++)->second) ;
+        }	
+	
+
+};
+
+
+
+
+/** 
+ * 
+ * @brief Concrete IteratorWrapper for nonconst access to the underlying key-value container
+ *
+ * 
+ * @remarks Template key-value container
+ * 
+*/
+template <typename T>
+class MapIterator : public MapIteratorWrapper<T,  typename T::iterator>{
+	public:
+	
+        /** Constructor.
+        @remarks
+            Provide a start and end iterator to initialise.
+        */	
+		MapIterator( typename T::iterator start, typename T::iterator last )
+		: MapIteratorWrapper<T,  typename T::iterator>(start , last )
+		{
+		}
+		
+        /** Constructor.
+        @remarks
+            Provide a container to initialise.
+        */
+		explicit MapIterator( T& c )
+		: MapIteratorWrapper<T,  typename T::iterator> ( c.begin(), c.end() )
+		{
+		}
+		
+};
+
+
+/** 
+ * 
+ * @brief Concrete IteratorWrapper for const access to the underlying key-value container
+ *
+ * 
+ * @tparam T key-value container
+ * 
+*/
+template <typename T>
+class ConstMapIterator : public MapIteratorWrapper<T,  typename T::const_iterator>{
+	public:
+	
+        /** Constructor.
+        @remarks
+            Provide a start and end iterator to initialise.
+        */	
+		ConstMapIterator( typename T::const_iterator start, typename T::const_iterator last )
+		: MapIteratorWrapper<T,  typename T::const_iterator> (start , last )
+		{
+		}
+
+        /** Constructor.
+        @remarks
+            Provide a container to initialise.
+        */
+		explicit ConstMapIterator ( const T& c )
+		 : MapIteratorWrapper<T,  typename T::const_iterator> (c.begin() , c.end() )
+		{
+		}
+};
+
+
+
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreIteratorWrappers.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreIteratorWrappers.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreIteratorWrappers.h	(revision 148)
@@ -0,0 +1,35 @@
+/*
+-----------------------------------------------------------------------------
+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 __Ogre_IteratorWrappers_H__
+#define __Ogre_IteratorWrappers_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreIteratorWrapper.h"
+#include "OgreIteratorRange.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreKeyFrame.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreKeyFrame.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreKeyFrame.h	(revision 148)
@@ -0,0 +1,259 @@
+/*
+-----------------------------------------------------------------------------
+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 __KeyFrame_H__
+#define __KeyFrame_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreVector3.h"
+#include "OgreQuaternion.h"
+#include "OgreAny.h"
+#include "OgreHardwareVertexBuffer.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre 
+{
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Animation
+	*  @{
+	*/
+	/** A key frame in an animation sequence defined by an AnimationTrack.
+    @remarks
+        This class can be used as a basis for all kinds of key frames. 
+        The unifying principle is that multiple KeyFrames define an 
+        animation sequence, with the exact state of the animation being an 
+        interpolation between these key frames. 
+    */
+	class _OgreExport KeyFrame : public AnimationAlloc
+    {
+    public:
+
+        /** Default constructor, you should not call this but use AnimationTrack::createKeyFrame instead. */
+        KeyFrame(const AnimationTrack* parent, Real time);
+
+		virtual ~KeyFrame() {}
+
+        /** Gets the time of this keyframe in the animation sequence. */
+        Real getTime(void) const { return mTime; }
+
+		/** Clone a keyframe (internal use only) */
+		virtual KeyFrame* _clone(AnimationTrack* newParent) const;
+
+
+    protected:
+        Real mTime;
+        const AnimationTrack* mParentTrack;
+    };
+
+
+	/** Specialised KeyFrame which stores any numeric value.
+	*/
+	class _OgreExport NumericKeyFrame : public KeyFrame
+	{
+	public:
+		/** Default constructor, you should not call this but use AnimationTrack::createKeyFrame instead. */
+		NumericKeyFrame(const AnimationTrack* parent, Real time);
+		~NumericKeyFrame() {}
+
+		/** Get the value at this keyframe. */
+		virtual const AnyNumeric& getValue(void) const;
+		/** Set the value at this keyframe.
+		@remarks
+			All keyframe values must have a consistent type. 
+		*/
+		virtual void setValue(const AnyNumeric& val);
+
+		/** Clone a keyframe (internal use only) */
+		KeyFrame* _clone(AnimationTrack* newParent) const;
+	protected:
+		AnyNumeric mValue;
+	};
+
+
+	/** Specialised KeyFrame which stores a full transform. */
+	class _OgreExport TransformKeyFrame : public KeyFrame
+	{
+	public:
+		/** Default constructor, you should not call this but use AnimationTrack::createKeyFrame instead. */
+		TransformKeyFrame(const AnimationTrack* parent, Real time);
+		~TransformKeyFrame() {}
+		/** Sets the translation associated with this keyframe. 
+		@remarks    
+		The translation factor affects how much the keyframe translates (moves) it's animable
+		object at it's time index.
+		@param trans The vector to translate by
+		*/
+		virtual void setTranslate(const Vector3& trans);
+
+		/** Gets the translation applied by this keyframe. */
+		const Vector3& getTranslate(void) const;
+
+		/** Sets the scaling factor applied by this keyframe to the animable
+		object at it's time index.
+		@param scale The vector to scale by (beware of supplying zero values for any component of this
+		vector, it will scale the object to zero dimensions)
+		*/
+		virtual void setScale(const Vector3& scale);
+
+		/** Gets the scaling factor applied by this keyframe. */
+		virtual const Vector3& getScale(void) const;
+
+		/** Sets the rotation applied by this keyframe.
+		@param rot The rotation applied; use Quaternion methods to convert from angle/axis or Matrix3 if
+		you don't like using Quaternions directly.
+		*/
+		virtual void setRotation(const Quaternion& rot);
+
+		/** Gets the rotation applied by this keyframe. */
+		virtual const Quaternion& getRotation(void) const;
+
+		/** Clone a keyframe (internal use only) */
+		KeyFrame* _clone(AnimationTrack* newParent) const;
+	protected:
+		Vector3 mTranslate;
+		Vector3 mScale;
+		Quaternion mRotate;
+
+
+	};
+
+
+
+	/** Specialised KeyFrame which stores absolute vertex positions for a complete
+		buffer, designed to be interpolated with other keys in the same track. 
+	*/
+	class _OgreExport VertexMorphKeyFrame : public KeyFrame
+	{
+	public:
+		/** Default constructor, you should not call this but use AnimationTrack::createKeyFrame instead. */
+		VertexMorphKeyFrame(const AnimationTrack* parent, Real time);
+		~VertexMorphKeyFrame() {}
+		/** Sets the vertex buffer containing the source positions for this keyframe. 
+		@remarks    
+			We assume that positions are the first 3 float elements in this buffer,
+			although we don't necessarily assume they're the only ones in there.
+		@param buf Vertex buffer link; will not be modified so can be shared
+			read-only data
+		*/
+		void setVertexBuffer(const HardwareVertexBufferSharedPtr& buf);
+
+		/** Gets the vertex buffer containing positions for this keyframe. */
+		const HardwareVertexBufferSharedPtr& getVertexBuffer(void) const;
+
+		/** Clone a keyframe (internal use only) */
+		KeyFrame* _clone(AnimationTrack* newParent) const;		
+
+	protected:
+		HardwareVertexBufferSharedPtr mBuffer;
+
+	};
+
+	/** Specialised KeyFrame which references a Mesh::Pose at a certain influence
+		level, which stores offsets for a subset of the vertices 
+		in a buffer to provide a blendable pose.
+	*/
+	class _OgreExport VertexPoseKeyFrame : public KeyFrame
+	{
+	public:
+		/** Default constructor, you should not call this but use AnimationTrack::createKeyFrame instead. */
+		VertexPoseKeyFrame(const AnimationTrack* parent, Real time);
+		~VertexPoseKeyFrame() {}
+
+		/** Reference to a pose at a given influence level 
+		@remarks
+			Each keyframe can refer to many poses each at a given influence level.
+		**/
+		struct PoseRef
+		{
+			/** The linked pose index.
+			@remarks
+				The Mesh contains all poses for all vertex data in one list, both 
+				for the shared vertex data and the dedicated vertex data on submeshes.
+				The 'target' on the parent track must match the 'target' on the 
+				linked pose.
+			*/
+			ushort poseIndex;
+			/** Influence level of the linked pose. 
+				1.0 for full influence (full offset), 0.0 for no influence.
+			*/
+			Real influence;
+
+			PoseRef(ushort p, Real i) : poseIndex(p), influence(i) {}
+		};
+		typedef vector<PoseRef>::type PoseRefList;
+
+		/** Add a new pose reference. 
+		@see PoseRef
+		*/
+		void addPoseReference(ushort poseIndex, Real influence);
+		/** Update the influence of a pose reference. 
+		@see PoseRef
+		*/
+		void updatePoseReference(ushort poseIndex, Real influence);
+		/** Remove reference to a given pose. 
+		@param poseIndex The pose index (not the index of the reference)
+		*/
+		void removePoseReference(ushort poseIndex);
+		/** Remove all pose references. */
+		void removeAllPoseReferences(void);
+
+
+		/** Get a const reference to the list of pose references. */
+		const PoseRefList& getPoseReferences(void) const;
+
+		typedef VectorIterator<PoseRefList> PoseRefIterator;
+		typedef ConstVectorIterator<PoseRefList> ConstPoseRefIterator;
+
+		/** Get an iterator over the pose references. */
+		PoseRefIterator getPoseReferenceIterator(void);
+
+		/** Get a const iterator over the pose references. */
+		ConstPoseRefIterator getPoseReferenceIterator(void) const;
+
+		/** Clone a keyframe (internal use only) */
+		KeyFrame* _clone(AnimationTrack* newParent) const;
+		
+		void _applyBaseKeyFrame(const VertexPoseKeyFrame* base);
+		
+	protected:
+		PoseRefList mPoseRefs;
+
+	};
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreLight.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreLight.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreLight.h	(revision 148)
@@ -0,0 +1,632 @@
+/*
+-----------------------------------------------------------------------------
+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 _LIGHT_H__
+#define _LIGHT_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreColourValue.h"
+#include "OgreVector3.h"
+#include "OgreVector4.h"
+#include "OgreString.h"
+#include "OgreMovableObject.h"
+#include "OgrePlaneBoundedVolume.h"
+#include "OgreShadowCameraSetup.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+
+    /** \addtogroup Core
+    *  @{
+    */
+    /** \addtogroup Scene
+    *  @{
+    */
+    /** Representation of a dynamic light source in the scene.
+    @remarks
+        Lights are added to the scene like any other object. They contain various
+        parameters like type, position, attenuation (how light intensity fades with
+        distance), colour etc.
+    @par
+        The defaults when a light is created is pure white diffuse light, with no
+        attenuation (does not decrease with distance) and a range of 1000 world units.
+    @par
+        Lights are created by using the SceneManager::createLight method. They can subsequently be
+        added to a SceneNode if required to allow them to move relative to a node in the scene. A light attached
+        to a SceneNode is assumed to have a base position of (0,0,0) and a direction of (0,0,1) before modification
+        by the SceneNode's own orientation. If not attached to a SceneNode,
+        the light's position and direction is as set using setPosition and setDirection.
+    @par
+        Remember also that dynamic lights rely on modifying the colour of vertices based on the position of
+        the light compared to an object's vertex normals. Dynamic lighting will only look good if the
+        object being lit has a fair level of tessellation and the normals are properly set. This is particularly
+        true for the spotlight which will only look right on highly tessellated models. In the future OGRE may be
+        extended for certain scene types so an alternative to the standard dynamic lighting may be used, such
+            as dynamic lightmaps.
+    */
+    class _OgreExport Light : public MovableObject
+    {
+    public:
+        /// Temp tag used for sorting
+        Real tempSquareDist;
+        /// internal method for calculating current squared distance from some world position
+        void _calcTempSquareDist(const Vector3& worldPos);
+
+        /// Defines the type of light
+        enum LightTypes
+        {
+            /// Point light sources give off light equally in all directions, so require only position not direction
+            LT_POINT = 0,
+            /// Directional lights simulate parallel light beams from a distant source, hence have direction but no position
+            LT_DIRECTIONAL = 1,
+            /// Spotlights simulate a cone of light from a source so require position and direction, plus extra values for falloff
+            LT_SPOTLIGHT = 2
+        };
+
+        /** Default constructor (for Python mainly).
+        */
+        Light();
+
+        /** Normal constructor. Should not be called directly, but rather the SceneManager::createLight method should be used.
+        */
+        Light(const String& name);
+
+        /** Standard destructor.
+        */
+        ~Light();
+
+        /** Sets the type of light - see LightTypes for more info.
+        */
+        void setType(LightTypes type);
+
+        /** Returns the light type.
+        */
+        LightTypes getType(void) const;
+
+        /** Sets the colour of the diffuse light given off by this source.
+        @remarks
+            Material objects have ambient, diffuse and specular values which indicate how much of each type of
+            light an object reflects. This value denotes the amount and colour of this type of light the light
+            exudes into the scene. The actual appearance of objects is a combination of the two.
+        @par
+            Diffuse light simulates the typical light emanating from light sources and affects the base colour
+            of objects together with ambient light.
+        */
+        void setDiffuseColour(Real red, Real green, Real blue);
+
+        /** Sets the colour of the diffuse light given off by this source.
+        @remarks
+            Material objects have ambient, diffuse and specular values which indicate how much of each type of
+            light an object reflects. This value denotes the amount and colour of this type of light the light
+            exudes into the scene. The actual appearance of objects is a combination of the two.
+        @par
+            Diffuse light simulates the typical light emanating from light sources and affects the base colour
+            of objects together with ambient light.
+        */
+        void setDiffuseColour(const ColourValue& colour);
+
+        /** Returns the colour of the diffuse light given off by this light source (see setDiffuseColour for more info).
+        */
+        const ColourValue& getDiffuseColour(void) const;
+
+        /** Sets the colour of the specular light given off by this source.
+        @remarks
+            Material objects have ambient, diffuse and specular values which indicate how much of each type of
+            light an object reflects. This value denotes the amount and colour of this type of light the light
+            exudes into the scene. The actual appearance of objects is a combination of the two.
+        @par
+            Specular light affects the appearance of shiny highlights on objects, and is also dependent on the
+            'shininess' Material value.
+        */
+        void setSpecularColour(Real red, Real green, Real blue);
+
+        /** Sets the colour of the specular light given off by this source.
+        @remarks
+            Material objects have ambient, diffuse and specular values which indicate how much of each type of
+            light an object reflects. This value denotes the amount and colour of this type of light the light
+            exudes into the scene. The actual appearance of objects is a combination of the two.
+        @par
+            Specular light affects the appearance of shiny highlights on objects, and is also dependent on the
+            'shininess' Material value.
+        */
+        void setSpecularColour(const ColourValue& colour);
+
+        /** Returns the colour of specular light given off by this light source.
+        */
+        const ColourValue& getSpecularColour(void) const;
+
+        /** Sets the attenuation parameters of the light source i.e. how it diminishes with distance.
+        @remarks
+            Lights normally get fainter the further they are away. Also, each light is given a maximum range
+            beyond which it cannot affect any objects.
+        @par
+            Light attenuation is not applicable to directional lights since they have an infinite range and
+            constant intensity.
+        @par
+            This follows a standard attenuation approach - see any good 3D text for the details of what they mean
+            since i don't have room here!
+        @param range
+            The absolute upper range of the light in world units.
+        @param constant
+            The constant factor in the attenuation formula: 1.0 means never attenuate, 0.0 is complete attenuation.
+        @param linear
+            The linear factor in the attenuation formula: 1 means attenuate evenly over the distance.
+        @param quadratic
+            The quadratic factor in the attenuation formula: adds a curvature to the attenuation formula.
+        */
+        void setAttenuation(Real range, Real constant, Real linear, Real quadratic);
+
+        /** Returns the absolute upper range of the light.
+        */
+        Real getAttenuationRange(void) const;
+
+        /** Returns the constant factor in the attenuation formula.
+        */
+        Real getAttenuationConstant(void) const;
+
+        /** Returns the linear factor in the attenuation formula.
+        */
+        Real getAttenuationLinear(void) const;
+
+        /** Returns the quadric factor in the attenuation formula.
+        */
+        Real getAttenuationQuadric(void) const;
+
+        /** Sets the position of the light.
+        @remarks
+            Applicable to point lights and spotlights only.
+        @note
+            This will be overridden if the light is attached to a SceneNode.
+        */
+        void setPosition(Real x, Real y, Real z);
+
+        /** Sets the position of the light.
+        @remarks
+            Applicable to point lights and spotlights only.
+        @note
+            This will be overridden if the light is attached to a SceneNode.
+        */
+        void setPosition(const Vector3& vec);
+
+        /** Returns the position of the light.
+        @note
+            Applicable to point lights and spotlights only.
+        */
+        const Vector3& getPosition(void) const;
+
+        /** Sets the direction in which a light points.
+        @remarks
+            Applicable only to the spotlight and directional light types.
+        @note
+            This will be overridden if the light is attached to a SceneNode.
+        */
+        void setDirection(Real x, Real y, Real z);
+
+        /** Sets the direction in which a light points.
+        @remarks
+            Applicable only to the spotlight and directional light types.
+        @note
+            This will be overridden if the light is attached to a SceneNode.
+        */
+        void setDirection(const Vector3& vec);
+
+        /** Returns the light's direction.
+        @remarks
+            Applicable only to the spotlight and directional light types.
+        */
+        const Vector3& getDirection(void) const;
+
+        /** Sets the range of a spotlight, i.e. the angle of the inner and outer cones
+            and the rate of falloff between them.
+        @param innerAngle
+            Angle covered by the bright inner cone
+            @note
+                The inner cone applicable only to Direct3D, it'll always treat as zero in OpenGL.
+        @param outerAngle
+            Angle covered by the outer cone
+        @param falloff
+            The rate of falloff between the inner and outer cones. 1.0 means a linear falloff,
+            less means slower falloff, higher means faster falloff.
+        */
+        void setSpotlightRange(const Radian& innerAngle, const Radian& outerAngle, Real falloff = 1.0);
+
+        /** Returns the angle covered by the spotlights inner cone.
+        */
+        const Radian& getSpotlightInnerAngle(void) const;
+
+        /** Returns the angle covered by the spotlights outer cone.
+        */
+        const Radian& getSpotlightOuterAngle(void) const;
+
+        /** Returns the falloff between the inner and outer cones of the spotlight.
+        */
+        Real getSpotlightFalloff(void) const;
+
+        /** Sets the angle covered by the spotlights inner cone.
+        */
+        void setSpotlightInnerAngle(const Radian& val);
+
+        /** Sets the angle covered by the spotlights outer cone.
+        */
+        void setSpotlightOuterAngle(const Radian& val);
+
+        /** Sets the falloff between the inner and outer cones of the spotlight.
+        */
+        void setSpotlightFalloff(Real val);
+
+        /** Set the near clip plane distance to be used by spotlights that use light
+            clipping, allowing you to render spots as if they start from further
+            down their frustum. 
+        @param nearClip
+            The near distance.
+        */
+        void setSpotlightNearClipDistance(Real nearClip) { mSpotNearClip = nearClip; }
+        
+        /** Get the near clip plane distance to be used by spotlights that use light
+            clipping.
+        */
+        Real getSpotlightNearClipDistance() const { return mSpotNearClip; }
+        
+        /** Set a scaling factor to indicate the relative power of a light.
+        @remarks
+            This factor is only useful in High Dynamic Range (HDR) rendering.
+            You can bind it to a shader variable to take it into account,
+            @see GpuProgramParameters
+        @param power
+            The power rating of this light, default is 1.0.
+        */
+        void setPowerScale(Real power);
+
+        /** Set the scaling factor which indicates the relative power of a 
+            light.
+        */
+        Real getPowerScale(void) const;
+
+        /** @copydoc MovableObject::_notifyAttached */
+        void _notifyAttached(Node* parent, bool isTagPoint = false);
+
+        /** @copydoc MovableObject::_notifyMoved */
+        void _notifyMoved(void);
+
+        /** @copydoc MovableObject::getBoundingBox */
+        const AxisAlignedBox& getBoundingBox(void) const;
+
+        /** @copydoc MovableObject::_updateRenderQueue */
+        void _updateRenderQueue(RenderQueue* queue);
+
+        /** @copydoc MovableObject::getMovableType */
+        const String& getMovableType(void) const;
+
+        /** Retrieves the position of the light including any transform from nodes it is attached to. 
+        @param cameraRelativeIfSet If set to true, returns data in camera-relative units if that's been set up (render use)
+        */
+        const Vector3& getDerivedPosition(bool cameraRelativeIfSet = false) const;
+
+        /** Retrieves the direction of the light including any transform from nodes it is attached to. */
+        const Vector3& getDerivedDirection(void) const;
+
+        /** @copydoc MovableObject::setVisible.
+        @remarks
+            Although lights themselves are not 'visible', setting a light to invisible
+            means it no longer affects the scene.
+        */
+        void setVisible(bool visible);
+
+        /** @copydoc MovableObject::getBoundingRadius */
+        Real getBoundingRadius(void) const { return 0; /* not visible */ }
+
+        /** Gets the details of this light as a 4D vector.
+        @remarks
+            Getting details of a light as a 4D vector can be useful for
+            doing general calculations between different light types; for
+            example the vector can represent both position lights (w=1.0f)
+            and directional lights (w=0.0f) and be used in the same 
+            calculations.
+        @param cameraRelativeIfSet
+            If set to @c true, returns data in camera-relative units if that's been set up (render use).
+        */
+        Vector4 getAs4DVector(bool cameraRelativeIfSet = false) const;
+
+        /** Internal method for calculating the 'near clip volume', which is
+            the volume formed between the near clip rectangle of the 
+            camera and the light.
+        @remarks
+            This volume is a pyramid for a point/spot light and
+            a cuboid for a directional light. It can used to detect whether
+            an object could be casting a shadow on the viewport. Note that
+            the reference returned is to a shared volume which will be 
+            reused across calls to this method.
+        */
+        virtual const PlaneBoundedVolume& _getNearClipVolume(const Camera* const cam) const;
+
+        /** Internal method for calculating the clip volumes outside of the 
+            frustum which can be used to determine which objects are casting
+            shadow on the frustum as a whole. 
+        @remarks
+            Each of the volumes is a pyramid for a point/spot light and
+            a cuboid for a directional light. 
+        */
+        virtual const PlaneBoundedVolumeList& _getFrustumClipVolumes(const Camera* const cam) const;
+
+        /// Override to return specific type flag
+        uint32 getTypeFlags(void) const;
+
+        /// @copydoc AnimableObject::createAnimableValue
+        AnimableValuePtr createAnimableValue(const String& valueName);
+
+        /** Set this light to use a custom shadow camera when rendering texture shadows.
+        @remarks
+            This changes the shadow camera setup for just this light,  you can set
+            the shadow camera setup globally using SceneManager::setShadowCameraSetup
+        @see ShadowCameraSetup
+        */
+        void setCustomShadowCameraSetup(const ShadowCameraSetupPtr& customShadowSetup);
+
+        /** Reset the shadow camera setup to the default. 
+        @see ShadowCameraSetup
+        */
+        void resetCustomShadowCameraSetup(void);
+
+        /** Return a pointer to the custom shadow camera setup (null means use SceneManager global version). */
+        const ShadowCameraSetupPtr& getCustomShadowCameraSetup(void) const;
+
+        /// @copydoc MovableObject::visitRenderables
+        void visitRenderables(Renderable::Visitor* visitor, 
+            bool debugRenderables = false);
+
+        /** Gets the index at which this light is in the current render. 
+        @remarks
+            Lights will be present in the in a list for every renderable,
+            detected and sorted appropriately, and sometimes it's useful to know 
+            what position in that list a given light occupies. This can vary 
+            from frame to frame (and object to object) so you should not use this
+            value unless you're sure the context is correct.
+        */
+        size_t _getIndexInFrame() const { return mIndexInFrame; }
+        void _notifyIndexInFrame(size_t i) { mIndexInFrame = i; }
+        
+        /** Sets the maximum distance away from the camera that shadows
+            by this light will be visible.
+        @remarks
+            Shadow techniques can be expensive, therefore it is a good idea
+            to limit them to being rendered close to the camera if possible,
+            and to skip the expense of rendering shadows for distance objects.
+            This method allows you to set the distance at which shadows will no
+            longer be rendered.
+        @note
+            Each shadow technique can interpret this subtely differently.
+            For example, one technique may use this to eliminate casters,
+            another might use it to attenuate the shadows themselves.
+            You should tweak this value to suit your chosen shadow technique
+            and scene setup.
+        */
+        void setShadowFarDistance(Real distance);
+        /** Tells the light to use the shadow far distance of the SceneManager
+        */
+        void resetShadowFarDistance(void);
+        /** Gets the maximum distance away from the camera that shadows
+            by this light will be visible.
+        */
+        Real getShadowFarDistance(void) const;
+        Real getShadowFarDistanceSquared(void) const;
+
+        /** Set the near clip plane distance to be used by the shadow camera, if
+            this light casts texture shadows.
+        @param nearClip
+            The distance, or -1 to use the main camera setting.
+        */
+        void setShadowNearClipDistance(Real nearClip) { mShadowNearClipDist = nearClip; }
+
+        /** Get the near clip plane distance to be used by the shadow camera, if
+            this light casts texture shadows.
+        @remarks
+            May be zero if the light doesn't have it's own near distance set;
+            use _deriveShadowNearDistance for a version guaranteed to give a result.
+        */
+        Real getShadowNearClipDistance() const { return mShadowNearClipDist; }
+
+        /** Derive a shadow camera near distance from either the light, or
+            from the main camera if the light doesn't have its own setting.
+        */
+        Real _deriveShadowNearClipDistance(const Camera* maincam) const;
+
+        /** Set the far clip plane distance to be used by the shadow camera, if
+            this light casts texture shadows.
+        @remarks
+            This is different from the 'shadow far distance', which is
+            always measured from the main camera. This distance is the far clip plane
+            of the light camera.
+        @param farClip
+            The distance, or -1 to use the main camera setting.
+        */
+        void setShadowFarClipDistance(Real farClip) { mShadowFarClipDist = farClip; }
+
+        /** Get the far clip plane distance to be used by the shadow camera, if
+            this light casts texture shadows.
+        @remarks
+            May be zero if the light doesn't have it's own far distance set;
+            use _deriveShadowfarDistance for a version guaranteed to give a result.
+        */
+        Real getShadowFarClipDistance() const { return mShadowFarClipDist; }
+
+        /** Derive a shadow camera far distance from either the light, or
+            from the main camera if the light doesn't have its own setting.
+        */
+        Real _deriveShadowFarClipDistance(const Camera* maincam) const;
+
+        /// Set the camera which this light should be relative to, for camera-relative rendering
+        void _setCameraRelative(Camera* cam);
+
+        /** Sets a custom parameter for this Light, which may be used to 
+            drive calculations for this specific Renderable, like GPU program parameters.
+        @remarks
+            Calling this method simply associates a numeric index with a 4-dimensional
+            value for this specific Light. This is most useful if the material
+            which this Renderable uses a vertex or fragment program, and has an 
+            ACT_LIGHT_CUSTOM parameter entry. This parameter entry can refer to the
+            index you specify as part of this call, thereby mapping a custom
+            parameter for this renderable to a program parameter.
+        @param index
+            The index with which to associate the value. Note that this
+            does not have to start at 0, and can include gaps. It also has no direct
+            correlation with a GPU program parameter index - the mapping between the
+            two is performed by the ACT_LIGHT_CUSTOM entry, if that is used.
+        @param value
+            The value to associate.
+        */
+        void setCustomParameter(uint16 index, const Vector4& value);
+
+        /** Gets the custom value associated with this Light at the given index.
+        @param index Index of the parameter to retrieve
+        @see setCustomParameter for full details.
+        */
+        const Vector4& getCustomParameter(uint16 index) const;
+
+        /** Update a custom GpuProgramParameters constant which is derived from 
+            information only this Light knows.
+        @remarks
+            This method allows a Light to map in a custom GPU program parameter
+            based on it's own data. This is represented by a GPU auto parameter
+            of ACT_LIGHT_CUSTOM, and to allow there to be more than one of these per
+            Light, the 'data' field on the auto parameter will identify
+            which parameter is being updated and on which light. The implementation 
+            of this method must identify the parameter being updated, and call a 'setConstant' 
+            method on the passed in GpuProgramParameters object.
+        @par
+            You do not need to override this method if you're using the standard
+            sets of data associated with the Renderable as provided by setCustomParameter
+            and getCustomParameter. By default, the implementation will map from the
+            value indexed by the 'constantEntry.data' parameter to a value previously
+            set by setCustomParameter. But custom Renderables are free to override
+            this if they want, in any case.
+        @param paramIndex
+            The index of the constant being updated
+        @param constantEntry
+            The auto constant entry from the program parameters
+        @param params
+            The parameters object which this method should call to 
+            set the updated parameters.
+        */
+        virtual void _updateCustomGpuParameter(uint16 paramIndex, 
+            const GpuProgramParameters::AutoConstantEntry& constantEntry, 
+            GpuProgramParameters* params) const;
+                
+        /** Check whether a sphere is included in the lighted area of the light 
+        @note 
+            The function trades accuracy for efficiency. As a result you may get
+            false-positives (The function should not return any false-negatives).
+        */
+        bool isInLightRange(const Ogre::Sphere& sphere) const;
+        
+        /** Check whether a bounding box is included in the lighted	area of the light
+        @note 
+            The function trades accuracy for efficiency. As a result you may get
+            false-positives (The function should not return any false-negatives).
+        */
+        bool isInLightRange(const Ogre::AxisAlignedBox& container) const;
+    
+    protected:
+        /// Internal method for synchronising with parent node (if any)
+        virtual void update(void) const;
+
+        /// @copydoc AnimableObject::getAnimableDictionaryName
+        const String& getAnimableDictionaryName(void) const;
+        /// @copydoc AnimableObject::initialiseAnimableDictionary
+        void initialiseAnimableDictionary(StringVector& vec) const;
+
+        LightTypes mLightType;
+        Vector3 mPosition;
+        ColourValue mDiffuse;
+        ColourValue mSpecular;
+
+        Vector3 mDirection;
+
+        Radian mSpotOuter;
+        Radian mSpotInner;
+        Real mSpotFalloff;
+        Real mSpotNearClip;
+        Real mRange;
+        Real mAttenuationConst;
+        Real mAttenuationLinear;
+        Real mAttenuationQuad;
+        Real mPowerScale;
+        size_t mIndexInFrame;
+        bool mOwnShadowFarDist;
+        Real mShadowFarDist;
+        Real mShadowFarDistSquared;
+        
+        Real mShadowNearClipDist;
+        Real mShadowFarClipDist;
+
+
+        mutable Vector3 mDerivedPosition;
+        mutable Vector3 mDerivedDirection;
+        // Slightly hacky but unless we separate observed light render state from main Light...
+        mutable Vector3 mDerivedCamRelativePosition;
+        mutable bool mDerivedCamRelativeDirty;
+        Camera* mCameraToBeRelativeTo;
+
+        /// Shared class-level name for Movable type.
+        static String msMovableType;
+
+        mutable PlaneBoundedVolume mNearClipVolume;
+        mutable PlaneBoundedVolumeList mFrustumClipVolumes;
+        /// Is the derived transform dirty?
+        mutable bool mDerivedTransformDirty;
+
+        /// Pointer to a custom shadow camera setup.
+        mutable ShadowCameraSetupPtr mCustomShadowCameraSetup;
+
+        typedef map<uint16, Vector4>::type CustomParameterMap;
+        /// Stores the custom parameters for the light.
+        CustomParameterMap mCustomParameters;
+    };
+
+    /** Factory object for creating Light instances. */
+    class _OgreExport LightFactory : public MovableObjectFactory
+    {
+    protected:
+        MovableObject* createInstanceImpl( const String& name, const NameValuePairList* params);
+    public:
+        LightFactory() {}
+        ~LightFactory() {}
+
+        static String FACTORY_TYPE_NAME;
+
+        const String& getType(void) const;
+        void destroyInstance(MovableObject* obj);  
+
+    };
+    /** @} */
+    /** @} */
+
+#include "OgreHeaderPrefix.h"
+
+} // namespace Ogre
+#endif // _LIGHT_H__
Index: /ogre_src_v1-9-0/OgreMain/include/OgreLodConfig.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreLodConfig.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreLodConfig.h	(revision 148)
@@ -0,0 +1,111 @@
+/*
+ * -----------------------------------------------------------------------------
+ * 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 __LogConfig_H_
+#define __LogConfig_H_
+
+#include "OgrePrerequisites.h"
+#include "OgreMesh.h"
+#include "OgreLodStrategy.h"
+
+namespace Ogre
+{
+/**
+ * @brief Structure for automatic LOD configuration.
+ */
+struct LodLevel {
+	/**
+	 * @brief Type of the reduction.
+	 *
+	 * Note: The vertex count is determined by unique vertices per submesh.
+	 * A mesh may have duplicate vertices with same position.
+	 */
+	enum VertexReductionMethod {
+		/**
+		 * @brief Percentage of vertexes to be removed from each submesh.
+		 *
+		 * Valid range is a number between 0.0 and 1.0
+		 */
+		VRM_PROPORTIONAL,
+
+		/**
+		 * @brief Exact vertex count to be removed from each submesh.
+		 *
+		 * Pass only integers or it will be rounded.
+		 */
+		VRM_CONSTANT,
+
+		/**
+		 * @brief Reduces the vertices, until the cost is bigger then the given value.
+		 *
+		 * Collapse cost is equal to the amount of artifact the reduction causes.
+		 * This generates the best LOD output, but the collapse cost depends on implementation.
+		 */
+		VRM_COLLAPSE_COST
+	};
+
+	/**
+	 * @brief Distance to swap the LOD.
+	 *
+	 * This depends on LodStrategy.
+	 */
+	Real distance;
+
+	/**
+	 * @brief Reduction method to use.
+	 *
+	 * @see ProgressiveMeshGenerator::VertexReductionMethod
+	 */
+	VertexReductionMethod reductionMethod;
+
+	/**
+	 * @brief The value, which depends on reductionMethod.
+	 */
+	Real reductionValue;
+
+	/**
+	 * @brief This is set by ProgressiveMeshGenerator::build() function.
+	 *
+	 * Use Mesh::getNumLodLevels() for generated LOD count.
+	 */
+	size_t outUniqueVertexCount;
+
+	/**
+	 * @brief Whether the LOD level generation was skipped, because it has same vertex count as the previous LOD level.
+	 */
+	bool outSkipped;
+};
+
+struct LodConfig {
+	MeshPtr mesh;
+	LodStrategy* strategy;
+	typedef vector<LodLevel>::type LodLevelList;
+	LodLevelList levels;
+};
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreLodListener.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreLodListener.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreLodListener.h	(revision 148)
@@ -0,0 +1,207 @@
+/*
+-----------------------------------------------------------------------------
+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 __LodListener_H__
+#define __LodListener_H__
+
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup LOD
+	*  @{
+	*/
+	/// Struct containing information about a LOD change event for movable objects.
+    struct MovableObjectLodChangedEvent
+    {
+        /// The movable object whose level of detail has changed.
+        MovableObject *movableObject;
+
+        /// The camera with respect to which the level of detail has changed.
+        Camera *camera;
+    };
+
+    /// Struct containing information about a mesh LOD change event for entities.
+    struct EntityMeshLodChangedEvent
+    {
+        /// The entity whose level of detail has changed.
+        Entity *entity;
+
+        /// The camera with respect to which the level of detail has changed.
+        Camera *camera;
+
+        /// LOD value as determined by LOD strategy.
+        Real lodValue;
+
+        /// Previous level of detail index.
+        ushort previousLodIndex;
+
+        /// New level of detail index.
+        ushort newLodIndex;
+    };
+
+    /// Struct containing information about a material LOD change event for entities.
+    struct EntityMaterialLodChangedEvent
+    {
+        /// The sub-entity whose material's level of detail has changed.
+        SubEntity *subEntity;
+
+        /// The camera with respect to which the level of detail has changed.
+        Camera *camera;
+
+        /// LOD value as determined by LOD strategy.
+        Real lodValue;
+
+        /// Previous level of detail index.
+        ushort previousLodIndex;
+
+        /// New level of detail index.
+        ushort newLodIndex;
+    };
+
+
+    /** A interface class defining a listener which can be used to receive
+        notifications of LOD events.
+        @remarks
+            A 'listener' is an interface designed to be called back when
+            particular events are called. This class defines the
+            interface relating to LOD events. In order to receive
+            notifications of LOD events, you should create a subclass of
+            LodListener and override the methods for which you would like
+            to customise the resulting processing. You should then call
+            SceneManager::addLodListener passing an instance of this class.
+            There is no limit to the number of LOD listeners you can register,
+            allowing you to register multiple listeners for different purposes.
+
+            For some uses, it may be advantageous to also subclass
+            RenderQueueListener as this interface makes available information
+            regarding render queue invocations.
+
+            It is important not to modify the scene graph during rendering, so,
+            for each event, there are two methods, a prequeue method and a
+            postqueue method.  The prequeue method is invoked during rendering,
+            and as such should not perform any changes, but if the event is
+            relevant, it may return true indicating the postqueue method should
+            also be called.  The postqueue method is invoked at an appropriate
+            time after rendering and scene changes may be safely made there.
+    */
+    class _OgreExport LodListener
+    {
+    public:
+
+        virtual ~LodListener() {}
+
+        /**
+        Called before a movable object's LOD has changed.
+        @remarks
+            Do not change the Ogre state from this method, 
+            instead return true and perform changes in 
+            postqueueMovableObjectLodChanged.
+        @return
+            True to indicate the event should be queued and
+            postqueueMovableObjectLodChanged called after
+            rendering is complete.
+        */
+        virtual bool prequeueMovableObjectLodChanged(const MovableObjectLodChangedEvent& evt)
+        { (void)evt; return false; }
+
+        /**
+        Called after a movable object's LOD has changed.
+        @remarks
+            May be called even if not requested from prequeueMovableObjectLodChanged
+            as only one event queue is maintained per SceneManger instance.
+        */
+        virtual void postqueueMovableObjectLodChanged(const MovableObjectLodChangedEvent& evt)
+        { (void)evt; }
+
+        /**
+        Called before an entity's mesh LOD has changed.
+        @remarks
+            Do not change the Ogre state from this method, 
+            instead return true and perform changes in 
+            postqueueEntityMeshLodChanged.
+
+            It is possible to change the event notification 
+            and even alter the newLodIndex field (possibly to 
+            prevent the LOD from changing, or to skip an 
+            index).
+        @return
+            True to indicate the event should be queued and
+            postqueueEntityMeshLodChanged called after
+            rendering is complete.
+        */
+        virtual bool prequeueEntityMeshLodChanged(EntityMeshLodChangedEvent& evt)
+        { (void)evt; return false; }
+
+        /**
+        Called after an entity's mesh LOD has changed.
+        @remarks
+            May be called even if not requested from prequeueEntityMeshLodChanged
+            as only one event queue is maintained per SceneManger instance.
+        */
+        virtual void postqueueEntityMeshLodChanged(const EntityMeshLodChangedEvent& evt)
+        { (void)evt; }
+
+        /**
+        Called before an entity's material LOD has changed.
+        @remarks
+            Do not change the Ogre state from this method, 
+            instead return true and perform changes in 
+            postqueueMaterialLodChanged.
+
+            It is possible to change the event notification 
+            and even alter the newLodIndex field (possibly to 
+            prevent the LOD from changing, or to skip an 
+            index).
+        @return
+            True to indicate the event should be queued and
+            postqueueMaterialLodChanged called after
+            rendering is complete.
+        */
+        virtual bool prequeueEntityMaterialLodChanged(EntityMaterialLodChangedEvent& evt)
+        { (void)evt; return false; }
+
+        /**
+        Called after an entity's material LOD has changed.
+        @remarks
+            May be called even if not requested from prequeueEntityMaterialLodChanged
+            as only one event queue is maintained per SceneManger instance.
+        */
+        virtual void postqueueEntityMaterialLodChanged(const EntityMaterialLodChangedEvent& evt)
+        { (void)evt; }
+
+    };
+	/** @} */
+	/** @} */
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreLodStrategy.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreLodStrategy.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreLodStrategy.h	(revision 148)
@@ -0,0 +1,135 @@
+/*
+-----------------------------------------------------------------------------
+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 __Lod_Strategy_H__
+#define __Lod_Strategy_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreMesh.h"
+
+#include "OgreMovableObject.h"
+#include "OgreCamera.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup LOD
+	*  @{
+	*/
+	/** Strategy for determining level of detail.
+    @remarks
+        Generally, to create a new LOD strategy, all of the following will
+        need to be implemented: getValueImpl, getBaseValue, transformBias,
+        getIndex, sort, and isSorted.
+        In addition, transformUserValue may be overridden.
+    */
+	class _OgreExport LodStrategy : public LodAlloc
+    {
+    protected:
+        /** Name of this strategy. */
+        String mName;
+
+        /** Compute the LOD value for a given movable object relative to a given camera. */
+        virtual Real getValueImpl(const MovableObject *movableObject, const Camera *camera) const = 0;
+
+    public:
+        /** Constructor accepting name. */
+        LodStrategy(const String& name);
+
+        /** Virtual destructor. */
+        virtual ~LodStrategy();
+
+        /** Get the value of the first (highest) level of detail. */
+        virtual Real getBaseValue() const = 0;
+
+        /** Transform LOD bias so it only needs to be multiplied by the LOD value. */
+        virtual Real transformBias(Real factor) const = 0;
+
+        /** Transform user supplied value to internal value.
+        @remarks
+            By default, performs no transformation.
+        @remarks
+            Do not throw exceptions for invalid values here, as the LOD strategy
+            may be changed such that the values become valid.
+        */
+        virtual Real transformUserValue(Real userValue) const;
+
+        /** Compute the LOD value for a given movable object relative to a given camera. */
+        Real getValue(const MovableObject *movableObject, const Camera *camera) const;
+
+        /** Get the index of the LOD usage which applies to a given value. */
+        virtual ushort getIndex(Real value, const Mesh::MeshLodUsageList& meshLodUsageList) const = 0;
+
+        /** Get the index of the LOD usage which applies to a given value. */
+        virtual ushort getIndex(Real value, const Material::LodValueList& materialLodValueList) const = 0;
+
+        /** Sort mesh LOD usage list from greatest to least detail */
+        virtual void sort(Mesh::MeshLodUsageList& meshLodUsageList) const = 0;
+
+        /** Determine if the LOD values are sorted from greatest detail to least detail. */
+        virtual bool isSorted(const Mesh::LodValueList& values) const = 0;
+
+        /** Assert that the LOD values are sorted from greatest detail to least detail. */
+        void assertSorted(const Mesh::LodValueList& values) const;
+
+        /** Get the name of this strategy. */
+        const String& getName() const { return mName; }
+
+    protected:
+        /** Implementation of isSorted suitable for ascending values. */
+        static bool isSortedAscending(const Mesh::LodValueList& values);
+        /** Implementation of isSorted suitable for descending values. */
+        static bool isSortedDescending(const Mesh::LodValueList& values);
+
+        /** Implementation of sort suitable for ascending values. */
+        static void sortAscending(Mesh::MeshLodUsageList& meshLodUsageList);
+        /** Implementation of sort suitable for descending values. */
+        static void sortDescending(Mesh::MeshLodUsageList& meshLodUsageList);
+
+        /** Implementation of getIndex suitable for ascending values. */
+        static ushort getIndexAscending(Real value, const Mesh::MeshLodUsageList& meshLodUsageList);
+        /** Implementation of getIndex suitable for descending values. */
+        static ushort getIndexDescending(Real value, const Mesh::MeshLodUsageList& meshLodUsageList);
+
+        /** Implementation of getIndex suitable for ascending values. */
+        static ushort getIndexAscending(Real value, const Material::LodValueList& materialLodValueList);
+        /** Implementation of getIndex suitable for descending values. */
+        static ushort getIndexDescending(Real value, const Material::LodValueList& materialLodValueList);
+
+    };
+	/** @} */
+	/** @} */
+
+} // namespace
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreLodStrategyManager.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreLodStrategyManager.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreLodStrategyManager.h	(revision 148)
@@ -0,0 +1,136 @@
+/*
+-----------------------------------------------------------------------------
+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 __Lod_Strategy_Manager_H__
+#define __Lod_Strategy_Manager_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreLodStrategy.h"
+#include "OgreSingleton.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup LOD
+	*  @{
+	*/
+	/** Manager for LOD strategies. */
+    class _OgreExport LodStrategyManager : public Singleton<LodStrategyManager>, public LodAlloc
+    {
+        /** Map of strategies. */
+        typedef map<String, LodStrategy *>::type StrategyMap;
+
+        /** Internal map of strategies. */
+        StrategyMap mStrategies;
+
+        /** Default strategy. */
+        LodStrategy *mDefaultStrategy;
+
+    public:
+        /** Default constructor. */
+        LodStrategyManager();
+
+        /** Destructor. */
+        ~LodStrategyManager();
+
+        /** Add a strategy to the manager. */
+        void addStrategy(LodStrategy *strategy);
+
+        /** Remove a strategy from the manager with a specified name.
+        @remarks
+            The removed strategy is returned so the user can control
+            how it is destroyed.
+        */
+        LodStrategy *removeStrategy(const String& name);
+
+        /** Remove and delete all strategies from the manager.
+        @remarks
+            All strategies are deleted.  If finer control is required
+            over strategy destruction, use removeStrategy.
+        */
+        void removeAllStrategies();
+
+        /** Get the strategy with the specified name. */
+        LodStrategy *getStrategy(const String& name);
+
+        /** Set the default strategy. */
+        void setDefaultStrategy(LodStrategy *strategy);
+
+        /** Set the default strategy by name. */
+        void setDefaultStrategy(const String& name);
+
+        /** Get the current default strategy. */
+        LodStrategy *getDefaultStrategy();
+
+        /** Get an iterator for all contained strategies. */
+        MapIterator<StrategyMap> getIterator();
+
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static LodStrategyManager& getSingleton(void);
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static LodStrategyManager* getSingletonPtr(void);
+    };
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreLog.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreLog.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreLog.h	(revision 148)
@@ -0,0 +1,267 @@
+/*
+-----------------------------------------------------------------------------
+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 __Log_H__
+#define __Log_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreString.h"
+#include "OgreHeaderPrefix.h"
+#include "Threading/OgreThreadHeaders.h"
+
+#if OGRE_PLATFORM == OGRE_PLATFORM_NACL
+namespace pp
+{
+    class Instance;
+}
+#endif
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+	// LogMessageLevel + LoggingLevel > OGRE_LOG_THRESHOLD = message logged
+    #define OGRE_LOG_THRESHOLD 4
+
+    /** The level of detail to which the log will go into.
+    */
+    enum LoggingLevel
+    {
+        LL_LOW = 1,
+        LL_NORMAL = 2,
+        LL_BOREME = 3
+    };
+
+    /** The importance of a logged message.
+    */
+    enum LogMessageLevel
+    {
+        LML_TRIVIAL = 1,
+        LML_NORMAL = 2,
+        LML_CRITICAL = 3
+    };
+
+    /** @remarks Pure Abstract class, derive this class and register to the Log to listen to log messages */
+    class LogListener
+    {
+	public:
+        virtual ~LogListener() {}
+
+        /**
+        @remarks
+            This is called whenever the log receives a message and is about to write it out
+        @param message
+            The message to be logged
+        @param lml
+            The message level the log is using
+        @param maskDebug
+            If we are printing to the console or not
+        @param logName
+            The name of this log (so you can have several listeners for different logs, and identify them)
+		@param skipThisMessage
+			If set to true by the messageLogged() implementation message will not be logged
+        */
+        virtual void messageLogged( const String& message, LogMessageLevel lml, bool maskDebug, const String &logName, bool& skipThisMessage ) = 0;
+    };
+
+
+    /**
+    @remarks
+         Log class for writing debug/log data to files.
+    @note
+        <br>Should not be used directly, but trough the LogManager class.
+    */
+	class _OgreExport Log : public LogAlloc
+    {
+    protected:
+        std::ofstream	mLog;
+        LoggingLevel	mLogLevel;
+        bool			mDebugOut;
+        bool			mSuppressFile;
+        bool			mTimeStamp;
+        String			mLogName;
+
+        typedef vector<LogListener*>::type mtLogListener;
+        mtLogListener mListeners;
+    public:
+
+		class Stream;
+
+		OGRE_AUTO_MUTEX; // public to allow external locking
+        /**
+        @remarks
+            Usual constructor - called by LogManager.
+        */
+        Log( const String& name, bool debugOutput = true, bool suppressFileOutput = false);
+
+        /**
+        @remarks
+        Default destructor.
+        */
+        ~Log();
+
+		/// Return the name of the log
+		const String& getName() const { return mLogName; }
+		/// Get whether debug output is enabled for this log
+		bool isDebugOutputEnabled() const { return mDebugOut; }
+		/// Get whether file output is suppressed for this log
+		bool isFileOutputSuppressed() const { return mSuppressFile; }
+ 		/// Get whether time stamps are printed for this log
+		bool isTimeStampEnabled() const { return mTimeStamp; }
+
+        /** Log a message to the debugger and to log file (the default is
+            "<code>OGRE.log</code>"),
+        */
+        void logMessage( const String& message, LogMessageLevel lml = LML_NORMAL, bool maskDebug = false );
+
+		/** Get a stream object targeting this log. */
+		Stream stream(LogMessageLevel lml = LML_NORMAL, bool maskDebug = false);
+
+        /**
+        @remarks
+            Enable or disable outputting log messages to the debugger.
+        */
+        void setDebugOutputEnabled(bool debugOutput);
+		/**
+        @remarks
+            Sets the level of the log detail.
+        */
+        void setLogDetail(LoggingLevel ll);
+        /**
+        @remarks
+            Enable or disable time stamps.
+        */
+        void setTimeStampEnabled(bool timeStamp);
+		/** Gets the level of the log detail.
+		*/
+		LoggingLevel getLogDetail() const { return mLogLevel; }
+        /**
+        @remarks
+            Register a listener to this log
+        @param listener
+            A valid listener derived class
+        */
+        void addListener(LogListener* listener);
+
+        /**
+        @remarks
+            Unregister a listener from this log
+        @param listener
+            A valid listener derived class
+        */
+        void removeListener(LogListener* listener);
+
+		/** Stream object which targets a log.
+		@remarks
+			A stream logger object makes it simpler to send various things to 
+			a log. You can just use the operator<< implementation to stream 
+			anything to the log, which is cached until a Stream::Flush is
+			encountered, or the stream itself is destroyed, at which point the 
+			cached contents are sent to the underlying log. You can use Log::stream()
+			directly without assigning it to a local variable and as soon as the
+			streaming is finished, the object will be destroyed and the message
+			logged.
+		@par
+			You can stream control operations to this object too, such as 
+			std::setw() and std::setfill() to control formatting.
+		@note
+			Each Stream object is not thread safe, so do not pass it between
+			threads. Multiple threads can hold their own Stream instances pointing
+			at the same Log though and that is threadsafe.
+		*/
+		class _OgrePrivate Stream
+		{
+		protected:
+			Log* mTarget;
+			LogMessageLevel mLevel;
+			bool mMaskDebug;
+			typedef StringUtil::StrStreamType BaseStream;
+			BaseStream mCache;
+
+		public:
+
+			/// Simple type to indicate a flush of the stream to the log
+			struct Flush {};
+
+			Stream(Log* target, LogMessageLevel lml, bool maskDebug)
+				:mTarget(target), mLevel(lml), mMaskDebug(maskDebug)
+			{
+
+			}
+			// copy constructor
+			Stream(const Stream& rhs) 
+				: mTarget(rhs.mTarget), mLevel(rhs.mLevel),	mMaskDebug(rhs.mMaskDebug)
+			{
+				// explicit copy of stream required, gcc doesn't like implicit
+				mCache.str(rhs.mCache.str());
+			} 
+			~Stream()
+			{
+				// flush on destroy
+				if (mCache.tellp() > 0)
+				{
+					mTarget->logMessage(mCache.str(), mLevel, mMaskDebug);
+				}
+			}
+
+			template <typename T>
+			Stream& operator<< (const T& v)
+			{
+				mCache << v;
+				return *this;
+			}
+
+			Stream& operator<< (const Flush& v)
+			{
+                                (void)v;
+				mTarget->logMessage(mCache.str(), mLevel, mMaskDebug);
+				mCache.str(StringUtil::BLANK);
+				return *this;
+			}
+
+
+		};
+#if OGRE_PLATFORM == OGRE_PLATFORM_NACL
+    protected:
+        static pp::Instance* mInstance;
+    public:
+        static void setInstance(pp::Instance* instance) {mInstance = instance;};
+#endif
+
+    };
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreLogManager.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreLogManager.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreLogManager.h	(revision 148)
@@ -0,0 +1,178 @@
+/*
+-----------------------------------------------------------------------------
+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 __LogManager_H__
+#define __LogManager_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreLog.h"
+#include "OgreSingleton.h"
+#include "OgreString.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+	/** The log manager handles the creation and retrieval of logs for the
+        application.
+        @remarks
+            This class will create new log files and will retrieve instances
+            of existing ones. Other classes wishing to log output can either
+            create a fresh log or retrieve an existing one to output to.
+            One log is the default log, and is the one written to when the
+            logging methods of this class are called.
+		@par
+			By default, Root will instantiate a LogManager (which becomes the 
+			Singleton instance) on construction, and will create a default log
+			based on the Root construction parameters. If you want more control,
+			for example redirecting log output right from the start or suppressing
+			debug output, you need to create a LogManager yourself before creating
+			a Root instance, then create a default log. Root will detect that 
+			you've created one yourself and won't create one of its own, thus
+			using all your logging preferences from the first instance.
+    */
+    class _OgreExport LogManager : public Singleton<LogManager>, public LogAlloc
+    {
+	protected:
+		typedef map<String, Log*>::type	LogList;
+
+        /// A list of all the logs the manager can access
+        LogList mLogs;
+
+        /// The default log to which output is done
+        Log* mDefaultLog;
+
+    public:
+        OGRE_AUTO_MUTEX; // public to allow external locking
+
+        LogManager();
+        ~LogManager();
+
+        /** Creates a new log with the given name.
+            @param
+                name The name to give the log e.g. 'Ogre.log'
+            @param
+                defaultLog If true, this is the default log output will be
+                sent to if the generic logging methods on this class are
+                used. The first log created is always the default log unless
+                this parameter is set.
+            @param
+                debuggerOutput If true, output to this log will also be
+                routed to the debugger's output window.
+            @param
+                suppressFileOutput If true, this is a logical rather than a physical
+				log and no file output will be written. If you do this you should
+				register a LogListener so log output is not lost.
+        */
+        Log* createLog( const String& name, bool defaultLog = false, bool debuggerOutput = true, 
+			bool suppressFileOutput = false);
+
+        /** Retrieves a log managed by this class.
+        */
+        Log* getLog( const String& name);
+
+        /** Returns a pointer to the default log.
+        */
+        Log* getDefaultLog();
+
+		/** Closes and removes a named log. */
+		void destroyLog(const String& name);
+		/** Closes and removes a log. */
+		void destroyLog(Log* log);
+
+		/** Sets the passed in log as the default log.
+        @return The previous default log.
+        */
+        Log* setDefaultLog(Log* newLog);
+
+        /** Log a message to the default log.
+        */
+        void logMessage( const String& message, LogMessageLevel lml = LML_NORMAL, 
+            bool maskDebug = false);
+
+        /** Log a message to the default log (signature for backward compatibility).
+        */
+        void logMessage( LogMessageLevel lml, const String& message,  
+			bool maskDebug = false) { logMessage(message, lml, maskDebug); }
+
+		/** Get a stream on the default log. */
+		Log::Stream stream(LogMessageLevel lml = LML_NORMAL, 
+			bool maskDebug = false);
+
+		/** Sets the level of detail of the default log.
+        */
+        void setLogDetail(LoggingLevel ll);
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static LogManager& getSingleton(void);
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static LogManager* getSingletonPtr(void);
+
+    };
+
+
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreManualObject.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreManualObject.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreManualObject.h	(revision 148)
@@ -0,0 +1,574 @@
+/*
+-----------------------------------------------------------------------------
+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 __OgreManualObject_H__
+#define __OgreManualObject_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreMovableObject.h"
+#include "OgreRenderable.h"
+#include "OgreResourceGroupManager.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Scene
+	*  @{
+	*/
+	/** Class providing a much simplified interface to generating manual
+	 	objects with custom geometry.
+	@remarks
+		Building one-off geometry objects manually usually requires getting
+		down and dirty with the vertex buffer and vertex declaration API, 
+		which some people find a steep learning curve. This class gives you 
+		a simpler interface specifically for the purpose of building a 
+		3D object simply and quickly. Note that if you intend to instance your
+		object you will still need to become familiar with the Mesh class. 
+	@par
+		This class draws heavily on the interface for OpenGL 
+		immediate-mode (glBegin, glVertex, glNormal etc), since this
+		is generally well-liked by people. There are a couple of differences
+		in the results though - internally this class still builds hardware 
+		buffers which can be re-used, so you can render the resulting object
+		multiple times without re-issuing all the same commands again. 
+		Secondly, the rendering is not immediate, it is still queued just like
+		all OGRE objects. This makes this object more efficient than the 
+		equivalent GL immediate-mode commands, so it's feasible to use it for
+		large objects if you really want to.
+	@par
+		To construct some geometry with this object:
+		  -# If you know roughly how many vertices (and indices, if you use them)
+		     you're going to submit, call estimateVertexCount and estimateIndexCount.
+			 This is not essential but will make the process more efficient by saving
+			 memory reallocations.
+		  -# Call begin() to begin entering data
+		  -# For each vertex, call position(), normal(), textureCoord(), colour()
+		     to define your vertex data. Note that each time you call position()
+			 you start a new vertex. Note that the first vertex defines the 
+			 components of the vertex - you can't add more after that. For example
+			 if you didn't call normal() in the first vertex, you cannot call it
+			 in any others. You ought to call the same combination of methods per
+			 vertex.
+		  -# If you want to define triangles (or lines/points) by indexing into the vertex list, 
+			 you can call index() as many times as you need to define them.
+			 If you don't do this, the class will assume you want triangles drawn
+			 directly as defined by the vertex list, i.e. non-indexed geometry. Note
+			 that stencil shadows are only supported on indexed geometry, and that
+			 indexed geometry is a little faster; so you should try to use it.
+		  -# Call end() to finish entering data.
+		  -# Optionally repeat the begin-end cycle if you want more geometry 
+		  	using different rendering operation types, or different materials
+	    After calling end(), the class will organise the data for that section
+		internally and make it ready to render with. Like any other 
+		MovableObject you should attach the object to a SceneNode to make it 
+		visible. Other aspects like the relative render order can be controlled
+		using standard MovableObject methods like setRenderQueueGroup.
+	@par
+		You can also use beginUpdate() to alter the geometry later on if you wish.
+		If you do this, you should call setDynamic(true) before your first call 
+		to begin(), and also consider using estimateVertexCount / estimateIndexCount
+		if your geometry is going to be growing, to avoid buffer recreation during
+		growth.
+	@par
+		Note that like all OGRE geometry, triangles should be specified in 
+		anti-clockwise winding order (whether you're doing it with just
+		vertices, or using indexes too). That is to say that the front of the
+		face is the one where the vertices are listed in anti-clockwise order.
+	*/
+	class _OgreExport ManualObject : public MovableObject
+	{
+	public:
+		ManualObject(const String& name);
+		virtual ~ManualObject();
+
+		//pre-declare ManualObjectSection
+		class ManualObjectSection;
+
+		/** Completely clear the contents of the object.
+		@remarks
+			Clearing the contents of this object and rebuilding from scratch
+			is not the optimal way to manage dynamic vertex data, since the 
+			buffers are recreated. If you want to keep the same structure but
+			update the content within that structure, use beginUpdate() instead 
+			of clear() begin(). However if you do want to modify the structure 
+			from time to time you can do so by clearing and re-specifying the data.
+		*/
+		virtual void clear(void);
+		
+		/** Estimate the number of vertices ahead of time.
+		@remarks
+			Calling this helps to avoid memory reallocation when you define
+			vertices. Also very handy when using beginUpdate() to manage dynamic
+			data - you can make the vertex buffers a little larger than their
+			initial needs to allow for growth later with this method.
+		*/
+		virtual void estimateVertexCount(size_t vcount);
+
+		/** Estimate the number of indices ahead of time.
+		@remarks
+			Calling this helps to avoid memory reallocation when you define
+			indices. Also very handy when using beginUpdate() to manage dynamic
+			data - you can make the index buffer a little larger than the
+			initial need to allow for growth later with this method.
+		*/
+		virtual void estimateIndexCount(size_t icount);
+
+		/** Start defining a part of the object.
+		@remarks
+			Each time you call this method, you start a new section of the
+			object with its own material and potentially its own type of
+			rendering operation (triangles, points or lines for example).
+		@param materialName The name of the material to render this part of the
+			object with.
+		@param opType The type of operation to use to render. 
+		*/
+		virtual void begin(const String& materialName,
+			RenderOperation::OperationType opType = RenderOperation::OT_TRIANGLE_LIST, const String & groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+
+		/** Use before defining geometry to indicate that you intend to update the
+			geometry regularly and want the internal structure to reflect that.
+		*/
+		virtual void setDynamic(bool dyn) { mDynamic = dyn; }
+		/** Gets whether this object is marked as dynamic */
+		virtual bool getDynamic() const { return mDynamic; }
+
+		/** Start the definition of an update to a part of the object.
+		@remarks
+			Using this method, you can update an existing section of the object
+			efficiently. You do not have the option of changing the operation type
+			obviously, since it must match the one that was used before. 
+		@note If your sections are changing size, particularly growing, use
+			estimateVertexCount and estimateIndexCount to pre-size the buffers a little
+			larger than the initial needs to avoid buffer reconstruction.
+		@param sectionIndex The index of the section you want to update. The first
+			call to begin() would have created section 0, the second section 1, etc.
+		*/
+		virtual void beginUpdate(size_t sectionIndex);
+		/** Add a vertex position, starting a new vertex at the same time. 
+		@remarks A vertex position is slightly special among the other vertex data
+			methods like normal() and textureCoord(), since calling it indicates
+			the start of a new vertex. All other vertex data methods you call 
+			after this are assumed to be adding more information (like normals or
+			texture coordinates) to the last vertex started with position().
+		*/
+		virtual void position(const Vector3& pos);
+		/// @copydoc ManualObject::position(const Vector3&)
+		virtual void position(Real x, Real y, Real z);
+
+		/** Add a vertex normal to the current vertex.
+		@remarks
+			Vertex normals are most often used for dynamic lighting, and 
+			their components should be normalised.
+		*/
+		virtual void normal(const Vector3& norm);
+		/// @copydoc ManualObject::normal(const Vector3&)
+		virtual void normal(Real x, Real y, Real z);
+
+		/** Add a vertex tangent to the current vertex.
+		@remarks
+			Vertex tangents are most often used for dynamic lighting, and 
+			their components should be normalised. 
+			Also, using tangent() you enable VES_TANGENT vertex semantic, which is not
+			supported on old non-SM2 cards.
+		*/
+		virtual void tangent(const Vector3& tan);
+		/// @copydoc ManualObject::tangent(const Vector3&)
+		virtual void tangent(Real x, Real y, Real z);
+
+		/** Add a texture coordinate to the current vertex.
+		@remarks
+			You can call this method multiple times between position() calls
+			to add multiple texture coordinates to a vertex. Each one can have
+			between 1 and 3 dimensions, depending on your needs, although 2 is
+			most common. There are several versions of this method for the 
+			variations in number of dimensions.
+		*/
+		virtual void textureCoord(Real u);
+		/// @copydoc ManualObject::textureCoord(Real)
+		virtual void textureCoord(Real u, Real v);
+		/// @copydoc ManualObject::textureCoord(Real)
+		virtual void textureCoord(Real u, Real v, Real w);
+		/// @copydoc ManualObject::textureCoord(Real)
+		virtual void textureCoord(Real x, Real y, Real z, Real w);
+		/// @copydoc ManualObject::textureCoord(Real)
+		virtual void textureCoord(const Vector2& uv);
+		/// @copydoc ManualObject::textureCoord(Real)
+		virtual void textureCoord(const Vector3& uvw);
+		/// @copydoc ManualObject::textureCoord(Real)
+		virtual void textureCoord(const Vector4& xyzw);
+
+		/** Add a vertex colour to a vertex.
+		*/
+		virtual void colour(const ColourValue& col);
+		/** Add a vertex colour to a vertex.
+		@param r,g,b,a Colour components expressed as floating point numbers from 0-1
+		*/
+		virtual void colour(Real r, Real g, Real b, Real a = 1.0f);
+
+		/** Add a vertex index to construct faces / lines / points via indexing
+			rather than just by a simple list of vertices. 
+		@remarks
+			You will have to call this 3 times for each face for a triangle list, 
+			or use the alternative 3-parameter version. Other operation types
+			require different numbers of indexes, @see RenderOperation::OperationType.
+		@note
+			32-bit indexes are not supported on all cards and will only be used
+            when required, if an index is > 65535.
+		@param idx A vertex index from 0 to 4294967295. 
+		*/
+		virtual void index(uint32 idx);
+		/** Add a set of 3 vertex indices to construct a triangle; this is a
+			shortcut to calling index() 3 times. It is only valid for triangle 
+			lists.
+		@note
+			32-bit indexes are not supported on all cards and will only be used
+            when required, if an index is > 65535.
+		@param i1, i2, i3 3 vertex indices from 0 to 4294967295 defining a face.
+		*/
+		virtual void triangle(uint32 i1, uint32 i2, uint32 i3);
+		/** Add a set of 4 vertex indices to construct a quad (out of 2 
+			triangles); this is a shortcut to calling index() 6 times, 
+			or triangle() twice. It's only valid for triangle list operations.
+		@note
+			32-bit indexes are not supported on all cards and will only be used
+            when required, if an index is > 65535.
+		@param i1, i2, i3, i4 4 vertex indices from 0 to 4294967295 defining a quad. 
+		*/
+		virtual void quad(uint32 i1, uint32 i2, uint32 i3, uint32 i4);
+
+		/// Get the number of vertices in the section currently being defined (returns 0 if no section is in progress).
+		virtual size_t getCurrentVertexCount() const;
+
+		/// Get the number of indices in the section currently being defined (returns 0 if no section is in progress).
+		virtual size_t getCurrentIndexCount() const;
+		
+		/** Finish defining the object and compile the final renderable version. 
+		@note
+			Will return a pointer to the finished section or NULL if the section was discarded (i.e. has zero vertices/indices).
+		*/
+		virtual ManualObjectSection* end(void);
+
+		/** Alter the material for a subsection of this object after it has been
+			specified.
+		@remarks
+			You specify the material to use on a section of this object during the
+			call to begin(), however if you want to change the material afterwards
+			you can do so by calling this method.
+		@param subIndex The index of the subsection to alter
+		@param name The name of the new material to use
+		*/
+		virtual void setMaterialName(size_t subIndex, const String& name, const String & group = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+
+		/** Convert this object to a Mesh. 
+		@remarks
+			After you've finished building this object, you may convert it to 
+			a Mesh if you want in order to be able to create many instances of
+			it in the world (via Entity). This is optional, since this instance
+			can be directly attached to a SceneNode itself, but of course only
+			one instance of it can exist that way. 
+		@note Only objects which use indexed geometry may be converted to a mesh.
+		@param meshName The name to give the mesh
+		@param groupName The resource group to create the mesh in
+		*/
+		virtual MeshPtr convertToMesh(const String& meshName, 
+			const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+
+		/** Sets whether or not to use an 'identity' projection.
+		@remarks
+			Usually ManualObjects will use a projection matrix as determined
+			by the active camera. However, if they want they can cancel this out
+			and use an identity projection, which effectively projects in 2D using
+			a {-1, 1} view space. Useful for overlay rendering. Normally you don't
+			need to change this. The default is false.
+		@see ManualObject::getUseIdentityProjection
+		*/
+		void setUseIdentityProjection(bool useIdentityProjection);
+
+		/** Returns whether or not to use an 'identity' projection.
+		@remarks
+			Usually ManualObjects will use a projection matrix as determined
+			by the active camera. However, if they want they can cancel this out
+			and use an identity projection, which effectively projects in 2D using
+			a {-1, 1} view space. Useful for overlay rendering. Normally you don't
+			need to change this.
+		@see ManualObject::setUseIdentityProjection
+		*/
+		bool getUseIdentityProjection(void) const { return mUseIdentityProjection; }
+
+		/** Sets whether or not to use an 'identity' view.
+		@remarks
+			Usually ManualObjects will use a view matrix as determined
+			by the active camera. However, if they want they can cancel this out
+			and use an identity matrix, which means all geometry is assumed
+			to be relative to camera space already. Useful for overlay rendering. 
+			Normally you don't need to change this. The default is false.
+		@see ManualObject::getUseIdentityView
+		*/
+		void setUseIdentityView(bool useIdentityView);
+
+		/** Returns whether or not to use an 'identity' view.
+		@remarks
+			Usually ManualObjects will use a view matrix as determined
+			by the active camera. However, if they want they can cancel this out
+			and use an identity matrix, which means all geometry is assumed
+			to be relative to camera space already. Useful for overlay rendering. 
+			Normally you don't need to change this.
+		@see ManualObject::setUseIdentityView
+		*/
+		bool getUseIdentityView(void) const { return mUseIdentityView; }
+
+		/** Sets the bounding box.
+			@remarks Call this after having finished creating sections to modify the
+				bounding box. E.g. if you're using ManualObject to create 2D overlays
+				you can call things function to set an infinite bounding box so that
+				the object always stays visible when attached.
+			@see ManualObject::setUseIdentityProjection, ManualObject::setUseIdentityView,
+				AxisAlignedBox::setInfinite */
+		void setBoundingBox(const AxisAlignedBox& box) { mAABB = box; }
+
+		/** Gets a pointer to a ManualObjectSection, i.e. a part of a ManualObject.
+		*/
+		ManualObjectSection* getSection(unsigned int index) const;
+
+		/** Retrieves the number of ManualObjectSection objects making up this ManualObject.
+		*/
+		unsigned int getNumSections(void) const;
+		/** Sets whether or not to keep the original declaration order when 
+			queuing the renderables.
+		@remarks
+			This overrides the default behavior of the rendering queue, 
+			specifically stating the desired order of rendering. Might result in a 
+			performance loss, but lets the user to have more direct control when 
+			creating geometry through this class.
+		@param keepOrder Whether to keep the declaration order or not.
+		*/
+		void setKeepDeclarationOrder(bool keepOrder) { mKeepDeclarationOrder = keepOrder; }
+
+		/** Gets whether or not the declaration order is to be kept or not.
+		@return A flag indication if the declaration order will be kept when 
+			queuing the renderables.
+		*/
+		bool getKeepDeclarationOrder() const { return mKeepDeclarationOrder; }
+		// MovableObject overrides
+
+		/** @copydoc MovableObject::getMovableType. */
+		const String& getMovableType(void) const;
+		/** @copydoc MovableObject::getBoundingBox. */
+		const AxisAlignedBox& getBoundingBox(void) const;
+		/** @copydoc MovableObject::getBoundingRadius. */
+		Real getBoundingRadius(void) const;
+		/** @copydoc MovableObject::_updateRenderQueue. */
+		void _updateRenderQueue(RenderQueue* queue);
+		/** Implement this method to enable stencil shadows. */
+		EdgeData* getEdgeList(void);
+		/** Overridden member from ShadowCaster. */
+		bool hasEdgeList(void);
+		/** Implement this method to enable stencil shadows. */
+		ShadowRenderableListIterator getShadowVolumeRenderableIterator(
+			ShadowTechnique shadowTechnique, const Light* light, 
+			HardwareIndexBufferSharedPtr* indexBuffer, size_t* indexBufferUsedSize,
+			bool extrudeVertices, Real extrusionDist, unsigned long flags = 0);
+
+
+		/// Built, renderable section of geometry
+		class _OgreExport ManualObjectSection : public Renderable, public MovableAlloc
+		{
+		protected:
+			ManualObject* mParent;
+			String mMaterialName;
+			String mGroupName;
+			mutable MaterialPtr mMaterial;
+			RenderOperation mRenderOperation;
+			bool m32BitIndices;
+
+			
+		public:
+			ManualObjectSection(ManualObject* parent, const String& materialName,
+				RenderOperation::OperationType opType, const String & groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+			virtual ~ManualObjectSection();
+			
+			/// Retrieve render operation for manipulation
+			RenderOperation* getRenderOperation(void);
+			/// Retrieve the material name in use
+			const String& getMaterialName(void) const { return mMaterialName; }
+			/// Retrieve the material group in use
+			const String& getMaterialGroup(void) const { return mGroupName; }
+			/// update the material name in use
+			void setMaterialName(const String& name, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME );
+			/// Set whether we need 32-bit indices
+			void set32BitIndices(bool n32) { m32BitIndices = n32; }
+			/// Get whether we need 32-bit indices
+			bool get32BitIndices() const { return m32BitIndices; }
+			
+			// Renderable overrides
+			/** @copydoc Renderable::getMaterial. */
+			const MaterialPtr& getMaterial(void) const;
+			/** @copydoc Renderable::getRenderOperation. */
+			void getRenderOperation(RenderOperation& op);
+			/** @copydoc Renderable::getWorldTransforms. */
+			void getWorldTransforms(Matrix4* xform) const;
+			/** @copydoc Renderable::getSquaredViewDepth. */
+			Real getSquaredViewDepth(const Ogre::Camera *) const;
+			/** @copydoc Renderable::getLights. */
+			const LightList &getLights(void) const;
+
+
+					
+		};
+		/** Nested class to allow shadows. */
+		class _OgreExport ManualObjectSectionShadowRenderable : public ShadowRenderable
+		{
+		protected:
+			ManualObject* mParent;
+			// Shared link to position buffer
+			HardwareVertexBufferSharedPtr mPositionBuffer;
+			// Shared link to w-coord buffer (optional)
+			HardwareVertexBufferSharedPtr mWBuffer;
+
+		public:
+			ManualObjectSectionShadowRenderable(ManualObject* parent, 
+				HardwareIndexBufferSharedPtr* indexBuffer, const VertexData* vertexData, 
+				bool createSeparateLightCap, bool isLightCap = false);
+			~ManualObjectSectionShadowRenderable();
+			/// Overridden from ShadowRenderable
+			void getWorldTransforms(Matrix4* xform) const;
+			HardwareVertexBufferSharedPtr getPositionBuffer(void) { return mPositionBuffer; }
+			HardwareVertexBufferSharedPtr getWBuffer(void) { return mWBuffer; }
+			/// Overridden from ShadowRenderable
+			virtual void rebindIndexBuffer(const HardwareIndexBufferSharedPtr& indexBuffer);
+
+			
+
+		};
+
+		typedef vector<ManualObjectSection*>::type SectionList;
+
+		/// @copydoc MovableObject::visitRenderables
+		void visitRenderables(Renderable::Visitor* visitor, 
+			bool debugRenderables = false);
+		
+		
+	protected:
+		/// Dynamic?
+		bool mDynamic;
+		/// List of subsections
+		SectionList mSectionList;
+		/// Current section
+		ManualObjectSection* mCurrentSection;
+		/// Are we updating?
+		bool mCurrentUpdating;
+		/// Temporary vertex structure
+		struct TempVertex
+		{
+			Vector3 position;
+			Vector3 normal;
+			Vector3 tangent;
+			Vector4 texCoord[OGRE_MAX_TEXTURE_COORD_SETS];
+			ushort texCoordDims[OGRE_MAX_TEXTURE_COORD_SETS];
+			ColourValue colour;
+		};
+		/// Temp storage
+		TempVertex mTempVertex;
+		/// First vertex indicator
+		bool mFirstVertex;
+		/// Temp vertex data to copy?
+		bool mTempVertexPending;
+		/// System-memory buffer whilst we establish the size required
+		char* mTempVertexBuffer;
+		/// System memory allocation size, in bytes
+		size_t mTempVertexSize;
+		/// System-memory buffer whilst we establish the size required
+		uint32* mTempIndexBuffer;
+		/// System memory allocation size, in bytes
+		size_t mTempIndexSize;
+		/// Current declaration vertex size
+		size_t mDeclSize;
+		/// Estimated vertex count
+		size_t mEstVertexCount;
+		/// Estimated index count
+		size_t mEstIndexCount;
+		/// Current texture coordinate
+		ushort mTexCoordIndex;
+		/// Bounding box
+		AxisAlignedBox mAABB;
+		/// Bounding sphere
+		Real mRadius;
+		/// Any indexed geometry on any sections?
+		bool mAnyIndexed;
+		/// Edge list, used if stencil shadow casting is enabled 
+		EdgeData* mEdgeList;
+		/// List of shadow renderables
+		ShadowRenderableList mShadowRenderables;
+		/// Whether to use identity projection for sections
+		bool mUseIdentityProjection;
+		/// Whether to use identity view for sections
+		bool mUseIdentityView;
+		/// Keep declaration order or let the queue optimize it
+		bool mKeepDeclarationOrder;
+
+
+		/// Delete temp buffers and reset init counts
+		virtual void resetTempAreas(void);
+		/// Resize the temp vertex buffer?
+		virtual void resizeTempVertexBufferIfNeeded(size_t numVerts);
+		/// Resize the temp index buffer?
+		virtual void resizeTempIndexBufferIfNeeded(size_t numInds);
+
+		/// Copy current temp vertex into buffer
+		virtual void copyTempVertexToBuffer(void);
+
+	};
+
+
+	/** Factory object for creating ManualObject instances */
+	class _OgreExport ManualObjectFactory : public MovableObjectFactory
+	{
+	protected:
+		MovableObject* createInstanceImpl( const String& name, const NameValuePairList* params);
+	public:
+		ManualObjectFactory() {}
+		~ManualObjectFactory() {}
+
+		static String FACTORY_TYPE_NAME;
+
+		const String& getType(void) const;
+		void destroyInstance( MovableObject* obj);  
+
+	};
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreMaterial.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreMaterial.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreMaterial.h	(revision 148)
@@ -0,0 +1,687 @@
+/*
+-----------------------------------------------------------------------------
+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 _Material_H__
+#define _Material_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreResource.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreCommon.h"
+#include "OgreColourValue.h"
+#include "OgreBlendMode.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	// Forward declaration
+    class LodStrategy;
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Materials
+	*  @{
+	*/
+	/** Class encapsulates rendering properties of an object.
+    @remarks
+    Ogre's material class encapsulates ALL aspects of the visual appearance,
+    of an object. It also includes other flags which 
+    might not be traditionally thought of as material properties such as 
+    culling modes and depth buffer settings, but these affect the 
+    appearance of the rendered object and are convenient to attach to the 
+    material since it keeps all the settings in one place. This is 
+    different to Direct3D which treats a material as just the colour 
+    components (diffuse, specular) and not texture maps etc. An Ogre 
+    Material can be thought of as equivalent to a 'Shader'.
+    @par
+    A Material can be rendered in multiple different ways depending on the
+    hardware available. You may configure a Material to use high-complexity
+    fragment shaders, but these won't work on every card; therefore a Technique
+    is an approach to creating the visual effect you are looking for. You are advised
+    to create fallback techniques with lower hardware requirements if you decide to
+    use advanced features. In addition, you also might want lower-detail techniques
+    for distant geometry.
+    @par
+    Each technique can be made up of multiple passes. A fixed-function pass
+    may combine multiple texture layers using multitexturing, but Ogre can 
+    break that into multiple passes automatically if the active card cannot
+    handle that many simultaneous textures. Programmable passes, however, cannot
+    be split down automatically, so if the active graphics card cannot handle the
+    technique which contains these passes, OGRE will try to find another technique
+    which the card can do. If, at the end of the day, the card cannot handle any of the
+    techniques which are listed for the material, the engine will render the 
+    geometry plain white, which should alert you to the problem.
+    @par
+    Ogre comes configured with a number of default settings for a newly 
+    created material. These can be changed if you wish by retrieving the 
+    default material settings through 
+    SceneManager::getDefaultMaterialSettings. Any changes you make to the 
+    Material returned from this method will apply to any materials created 
+    from this point onward.
+    */
+    class _OgreExport Material : public Resource
+    {
+        friend class SceneManager;
+        friend class MaterialManager;
+
+    public:
+        /// distance list used to specify LOD
+		typedef vector<Real>::type LodValueList;
+        typedef ConstVectorIterator<LodValueList> LodValueIterator;
+    protected:
+
+
+        /** Internal method which sets the material up from the default settings.
+        */
+        void applyDefaults(void);
+
+        typedef vector<Technique*>::type Techniques;
+		/// All techniques, supported and unsupported
+        Techniques mTechniques;
+		/// Supported techniques of any sort
+        Techniques mSupportedTechniques;
+		typedef map<unsigned short, Technique*>::type LodTechniques;
+        typedef map<unsigned short, LodTechniques*>::type BestTechniquesBySchemeList;
+		/** Map of scheme -> list of LOD techniques. 
+			Current scheme is set on MaterialManager,
+			and can be set per Viewport for auto activation.
+		*/
+        BestTechniquesBySchemeList mBestTechniquesBySchemeList;
+
+        LodValueList mUserLodValues;
+        LodValueList mLodValues;
+        const LodStrategy *mLodStrategy;
+        bool mReceiveShadows;
+		bool mTransparencyCastsShadows;
+        /// Does this material require compilation?
+        bool mCompilationRequired;
+		/// Text description of why any techniques are not supported
+		String mUnsupportedReasons;
+
+		/** Insert a supported technique into the local collections. */
+		void insertSupportedTechnique(Technique* t);
+
+		/** Clear the best technique list.
+		*/
+		void clearBestTechniqueList(void);
+
+		/** Overridden from Resource.
+		*/
+		void prepareImpl(void);
+
+		/** Overridden from Resource.
+		*/
+		void unprepareImpl(void);
+
+		/** Overridden from Resource.
+		*/
+		void loadImpl(void);
+
+		/** Unloads the material, frees resources etc.
+		@see
+		Resource
+		*/
+		void unloadImpl(void);
+		/// @copydoc Resource::calculateSize
+		size_t calculateSize(void) const;
+    public:
+
+        /** Constructor - use resource manager's create method rather than this.
+        */
+		Material(ResourceManager* creator, const String& name, ResourceHandle handle,
+			const String& group, bool isManual = false, ManualResourceLoader* loader = 0);
+
+        ~Material();
+        /** Assignment operator to allow easy copying between materials.
+        */
+        Material& operator=( const Material& rhs );
+
+        /** Determines if the material has any transparency with the rest of the scene (derived from 
+            whether any Techniques say they involve transparency).
+        */
+        bool isTransparent(void) const;
+
+        /** Sets whether objects using this material will receive shadows.
+        @remarks
+            This method allows a material to opt out of receiving shadows, if
+            it would otherwise do so. Shadows will not be cast on any objects
+            unless the scene is set up to support shadows 
+            (@see SceneManager::setShadowTechnique), and not all techniques cast
+            shadows on all objects. In any case, if you have a need to prevent
+            shadows being received by material, this is the method you call to
+            do it.
+        @note 
+            Transparent materials never receive shadows despite this setting. 
+            The default is to receive shadows.
+        */
+        void setReceiveShadows(bool enabled) { mReceiveShadows = enabled; }
+        /** Returns whether or not objects using this material will receive shadows. */
+        bool getReceiveShadows(void) const { return mReceiveShadows; }
+
+		/** Sets whether objects using this material be classified as opaque to	the shadow caster system.
+		@remarks
+		This method allows a material to cast a shadow, even if it is transparent.
+		By default, transparent materials neither cast nor receive shadows. Shadows
+		will not be cast on any objects unless the scene is set up to support shadows 
+		(@see SceneManager::setShadowTechnique), and not all techniques cast
+		shadows on all objects.
+		*/
+		void setTransparencyCastsShadows(bool enabled) { mTransparencyCastsShadows = enabled; }
+		/** Returns whether or not objects using this material be classified as opaque to the shadow caster system. */
+		bool getTransparencyCastsShadows(void) const { return mTransparencyCastsShadows; }
+
+        /** Creates a new Technique for this Material.
+        @remarks
+            A Technique is a single way of rendering geometry in order to achieve the effect
+            you are intending in a material. There are many reason why you would want more than
+            one - the main one being to handle variable graphics card abilities; you might have
+            one technique which is impressive but only runs on 4th-generation graphics cards, 
+            for example. In this case you will want to create at least one fallback Technique.
+            OGRE will work out which Techniques a card can support and pick the best one.
+        @par
+            If multiple Techniques are available, the order in which they are created is 
+            important - the engine will consider lower-indexed Techniques to be preferable
+            to higher-indexed Techniques, ie when asked for the 'best' technique it will
+            return the first one in the technique list which is supported by the hardware.
+        */
+        Technique* createTechnique(void);
+        /** Gets the indexed technique. */
+        Technique* getTechnique(unsigned short index);
+        /** searches for the named technique.
+            Return 0 if technique with name is not found
+        */
+        Technique* getTechnique(const String& name);
+		/** Retrieves the number of techniques. */
+        unsigned short getNumTechniques(void) const;
+        /** Removes the technique at the given index. */		
+        void removeTechnique(unsigned short index);		
+        /** Removes all the techniques in this Material. */
+        void removeAllTechniques(void);
+        typedef VectorIterator<Techniques> TechniqueIterator;
+        /** Get an iterator over the Techniques in this Material. */
+        TechniqueIterator getTechniqueIterator(void);
+        /** Gets an iterator over all the Techniques which are supported by the current card. 
+        @remarks
+            The supported technique list is only available after this material has been compiled,
+            which typically happens on loading the material. Therefore, if this method returns
+            an empty list, try calling Material::load.
+        */
+        TechniqueIterator getSupportedTechniqueIterator(void);
+		
+		/** Gets the indexed supported technique. */
+        Technique* getSupportedTechnique(unsigned short index);
+		/** Retrieves the number of supported techniques. */
+        unsigned short getNumSupportedTechniques(void) const;
+		/** Gets a string explaining why any techniques are not supported. */
+		const String& getUnsupportedTechniquesExplanation() const { return mUnsupportedReasons; }
+
+        /** Gets the number of levels-of-detail this material has in the 
+			given scheme, based on Technique::setLodIndex. 
+        @remarks
+            Note that this will not be up to date until the material has been compiled.
+        */
+        unsigned short getNumLodLevels(unsigned short schemeIndex) const;
+        /** Gets the number of levels-of-detail this material has in the 
+			given scheme, based on Technique::setLodIndex. 
+        @remarks
+            Note that this will not be up to date until the material has been compiled.
+        */
+        unsigned short getNumLodLevels(const String& schemeName) const;
+
+        /** Gets the best supported technique. 
+        @remarks
+            This method returns the lowest-index supported Technique in this material
+            (since lower-indexed Techniques are considered to be better than higher-indexed
+            ones).
+        @par
+            The best supported technique is only available after this material has been compiled,
+            which typically happens on loading the material. Therefore, if this method returns
+            NULL, try calling Material::load.
+		@param lodIndex The material LOD index to use
+		@param rend Optional parameter specifying the Renderable that is requesting
+			this technique. Only used if no valid technique for the active material 
+			scheme is found, at which point it is passed to 
+			MaterialManager::Listener::handleSchemeNotFound as information.
+        */
+        Technique* getBestTechnique(unsigned short lodIndex = 0, const Renderable* rend = 0);
+
+
+        /** Creates a new copy of this material with the same settings but a new name.
+		@param newName The name for the cloned material
+		@param changeGroup If true, the resource group of the clone is changed
+		@param newGroup Only required if changeGroup is true; the new group to assign
+        */
+        MaterialPtr clone(const String& newName, bool changeGroup = false, 
+			const String& newGroup = StringUtil::BLANK) const;
+
+        /** Copies the details of this material into another, preserving the target's handle and name
+        (unlike operator=) but copying everything else.
+        @param mat Weak reference to material which will receive this material's settings.
+        */
+        void copyDetailsTo(MaterialPtr& mat) const;
+
+        /** 'Compiles' this Material.
+        @remarks
+            Compiling a material involves determining which Techniques are supported on the
+            card on which OGRE is currently running, and for fixed-function Passes within those
+            Techniques, splitting the passes down where they contain more TextureUnitState 
+            instances than the current card has texture units.
+        @par
+            This process is automatically done when the Material is loaded, but may be
+            repeated if you make some procedural changes.
+        @param
+            autoManageTextureUnits If true, when a fixed function pass has too many TextureUnitState
+                entries than the card has texture units, the Pass in question will be split into
+                more than one Pass in order to emulate the Pass. If you set this to false and
+                this situation arises, an Exception will be thrown.
+        */
+        void compile(bool autoManageTextureUnits = true);
+
+        // -------------------------------------------------------------------------------
+        // The following methods are to make migration from previous versions simpler
+        // and to make code easier to write when dealing with simple materials
+        // They set the properties which have been moved to Pass for all Techniques and all Passes
+
+        /** Sets the point size properties for every Pass in every Technique.
+        @note
+            This property has been moved to the Pass class, which is accessible via the 
+            Technique. For simplicity, this method allows you to set these properties for 
+            every current Technique, and for every current Pass within those Techniques. If 
+            you need more precision, retrieve the Technique and Pass instances and set the
+            property there.
+        @see Pass::setPointSize
+        */
+        void setPointSize(Real ps);
+
+        /** Sets the ambient colour reflectance properties for every Pass in every Technique.
+        @note
+            This property has been moved to the Pass class, which is accessible via the 
+            Technique. For simplicity, this method allows you to set these properties for 
+            every current Technique, and for every current Pass within those Techniques. If 
+            you need more precision, retrieve the Technique and Pass instances and set the
+            property there.
+        @see Pass::setAmbient
+        */
+        void setAmbient(Real red, Real green, Real blue);
+
+        /** Sets the ambient colour reflectance properties for every Pass in every Technique.
+        @note
+            This property has been moved to the Pass class, which is accessible via the 
+            Technique. For simplicity, this method allows you to set these properties for 
+            every current Technique, and for every current Pass within those Techniques. If 
+            you need more precision, retrieve the Technique and Pass instances and set the
+            property there.
+        @see Pass::setAmbient
+        */
+        void setAmbient(const ColourValue& ambient);
+
+        /** Sets the diffuse colour reflectance properties of every Pass in every Technique.
+        @note
+            This property has been moved to the Pass class, which is accessible via the 
+            Technique. For simplicity, this method allows you to set these properties for 
+            every current Technique, and for every current Pass within those Techniques. If 
+            you need more precision, retrieve the Technique and Pass instances and set the
+            property there.
+        @see Pass::setDiffuse
+        */
+        void setDiffuse(Real red, Real green, Real blue, Real alpha);
+
+        /** Sets the diffuse colour reflectance properties of every Pass in every Technique.
+        @note
+            This property has been moved to the Pass class, which is accessible via the 
+            Technique. For simplicity, this method allows you to set these properties for 
+            every current Technique, and for every current Pass within those Techniques. If 
+            you need more precision, retrieve the Technique and Pass instances and set the
+            property there.
+        @see Pass::setDiffuse
+        */
+        void setDiffuse(const ColourValue& diffuse);
+
+        /** Sets the specular colour reflectance properties of every Pass in every Technique.
+        @note
+            This property has been moved to the Pass class, which is accessible via the 
+            Technique. For simplicity, this method allows you to set these properties for 
+            every current Technique, and for every current Pass within those Techniques. If 
+            you need more precision, retrieve the Technique and Pass instances and set the
+            property there.
+        @see Pass::setSpecular
+        */
+        void setSpecular(Real red, Real green, Real blue, Real alpha);
+
+        /** Sets the specular colour reflectance properties of every Pass in every Technique.
+        @note
+            This property has been moved to the Pass class, which is accessible via the 
+            Technique. For simplicity, this method allows you to set these properties for 
+            every current Technique, and for every current Pass within those Techniques. If 
+            you need more precision, retrieve the Technique and Pass instances and set the
+            property there.
+        @see Pass::setSpecular
+        */
+        void setSpecular(const ColourValue& specular);
+
+        /** Sets the shininess properties of every Pass in every Technique.
+        @note
+            This property has been moved to the Pass class, which is accessible via the 
+            Technique. For simplicity, this method allows you to set these properties for 
+            every current Technique, and for every current Pass within those Techniques. If 
+            you need more precision, retrieve the Technique and Pass instances and set the
+            property there.
+        @see Pass::setShininess
+        */
+        void setShininess(Real val);
+
+        /** Sets the amount of self-illumination of every Pass in every Technique.
+        @note
+            This property has been moved to the Pass class, which is accessible via the 
+            Technique. For simplicity, this method allows you to set these properties for 
+            every current Technique, and for every current Pass within those Techniques. If 
+            you need more precision, retrieve the Technique and Pass instances and set the
+            property there.
+        @see Pass::setSelfIllumination
+        */
+        void setSelfIllumination(Real red, Real green, Real blue);
+
+        /** Sets the amount of self-illumination of every Pass in every Technique.
+        @note
+            This property has been moved to the Pass class, which is accessible via the 
+            Technique. For simplicity, this method allows you to set these properties for 
+            every current Technique, and for every current Pass within those Techniques. If 
+            you need more precision, retrieve the Technique and Pass instances and set the
+            property there.
+        @see Pass::setSelfIllumination
+        */
+        void setSelfIllumination(const ColourValue& selfIllum);
+
+		/** Sets whether or not each Pass renders with depth-buffer checking on or not.
+        @note
+            This property has been moved to the Pass class, which is accessible via the 
+            Technique. For simplicity, this method allows you to set these properties for 
+            every current Technique, and for every current Pass within those Techniques. If 
+            you need more precision, retrieve the Technique and Pass instances and set the
+            property there.
+        @see Pass::setDepthCheckEnabled
+        */
+        void setDepthCheckEnabled(bool enabled);
+
+        /** Sets whether or not each Pass renders with depth-buffer writing on or not.
+        @note
+            This property has been moved to the Pass class, which is accessible via the 
+            Technique. For simplicity, this method allows you to set these properties for 
+            every current Technique, and for every current Pass within those Techniques. If 
+            you need more precision, retrieve the Technique and Pass instances and set the
+            property there.
+        @see Pass::setDepthWriteEnabled
+        */
+        void setDepthWriteEnabled(bool enabled);
+
+        /** Sets the function used to compare depth values when depth checking is on.
+        @note
+            This property has been moved to the Pass class, which is accessible via the 
+            Technique. For simplicity, this method allows you to set these properties for 
+            every current Technique, and for every current Pass within those Techniques. If 
+            you need more precision, retrieve the Technique and Pass instances and set the
+            property there.
+        @see Pass::setDepthFunction
+        */
+        void setDepthFunction( CompareFunction func );
+
+		/** Sets whether or not colour buffer writing is enabled for each Pass.
+        @note
+            This property has been moved to the Pass class, which is accessible via the 
+            Technique. For simplicity, this method allows you to set these properties for 
+            every current Technique, and for every current Pass within those Techniques. If 
+            you need more precision, retrieve the Technique and Pass instances and set the
+            property there.
+        @see Pass::setColourWriteEnabled
+		*/
+		void setColourWriteEnabled(bool enabled);
+
+        /** Sets the culling mode for each pass  based on the 'vertex winding'.
+        @note
+            This property has been moved to the Pass class, which is accessible via the 
+            Technique. For simplicity, this method allows you to set these properties for 
+            every current Technique, and for every current Pass within those Techniques. If 
+            you need more precision, retrieve the Technique and Pass instances and set the
+            property there.
+        @see Pass::setCullingMode
+        */
+        void setCullingMode( CullingMode mode );
+
+        /** Sets the manual culling mode, performed by CPU rather than hardware.
+        @note
+            This property has been moved to the Pass class, which is accessible via the 
+            Technique. For simplicity, this method allows you to set these properties for 
+            every current Technique, and for every current Pass within those Techniques. If 
+            you need more precision, retrieve the Technique and Pass instances and set the
+            property there.
+        @see Pass::setManualCullingMode
+        */
+        void setManualCullingMode( ManualCullingMode mode );
+
+        /** Sets whether or not dynamic lighting is enabled for every Pass.
+        @note
+            This property has been moved to the Pass class, which is accessible via the 
+            Technique. For simplicity, this method allows you to set these properties for 
+            every current Technique, and for every current Pass within those Techniques. If 
+            you need more precision, retrieve the Technique and Pass instances and set the
+            property there.
+        @see Pass::setLightingEnabled
+        */
+        void setLightingEnabled(bool enabled);
+
+        /** Sets the type of light shading required
+        @note
+            This property has been moved to the Pass class, which is accessible via the 
+            Technique. For simplicity, this method allows you to set these properties for 
+            every current Technique, and for every current Pass within those Techniques. If 
+            you need more precision, retrieve the Technique and Pass instances and set the
+            property there.
+        @see Pass::setShadingMode
+        */
+        void setShadingMode( ShadeOptions mode );
+
+        /** Sets the fogging mode applied to each pass.
+        @note
+            This property has been moved to the Pass class, which is accessible via the 
+            Technique. For simplicity, this method allows you to set these properties for 
+            every current Technique, and for every current Pass within those Techniques. If 
+            you need more precision, retrieve the Technique and Pass instances and set the
+            property there.
+        @see Pass::setFog
+        */
+        void setFog(
+            bool overrideScene,
+            FogMode mode = FOG_NONE,
+            const ColourValue& colour = ColourValue::White,
+            Real expDensity = 0.001, Real linearStart = 0.0, Real linearEnd = 1.0 );
+
+        /** Sets the depth bias to be used for each Pass.
+        @note
+            This property has been moved to the Pass class, which is accessible via the 
+            Technique. For simplicity, this method allows you to set these properties for 
+            every current Technique, and for every current Pass within those Techniques. If 
+            you need more precision, retrieve the Technique and Pass instances and set the
+            property there.
+        @see Pass::setDepthBias
+        */
+        void setDepthBias(float constantBias, float slopeScaleBias);
+
+        /** Set texture filtering for every texture unit in every Technique and Pass
+        @note
+            This property has been moved to the TextureUnitState class, which is accessible via the 
+            Technique and Pass. For simplicity, this method allows you to set these properties for 
+            every current TeextureUnitState, If you need more precision, retrieve the Technique, 
+            Pass and TextureUnitState instances and set the property there.
+        @see TextureUnitState::setTextureFiltering
+        */
+        void setTextureFiltering(TextureFilterOptions filterType);
+        /** Sets the anisotropy level to be used for all textures.
+        @note
+            This property has been moved to the TextureUnitState class, which is accessible via the 
+            Technique and Pass. For simplicity, this method allows you to set these properties for 
+            every current TeextureUnitState, If you need more precision, retrieve the Technique, 
+            Pass and TextureUnitState instances and set the property there.
+        @see TextureUnitState::setTextureAnisotropy
+        */
+        void setTextureAnisotropy(int maxAniso);
+
+        /** Sets the kind of blending every pass has with the existing contents of the scene.
+        @note
+            This property has been moved to the Pass class, which is accessible via the 
+            Technique. For simplicity, this method allows you to set these properties for 
+            every current Technique, and for every current Pass within those Techniques. If 
+            you need more precision, retrieve the Technique and Pass instances and set the
+            property there.
+        @see Pass::setSceneBlending
+        */
+        void setSceneBlending( const SceneBlendType sbt );
+
+        /** Sets the kind of blending every pass has with the existing contents of the scene, using individual factors for color and alpha channels
+        @note
+            This property has been moved to the Pass class, which is accessible via the 
+            Technique. For simplicity, this method allows you to set these properties for 
+            every current Technique, and for every current Pass within those Techniques. If 
+            you need more precision, retrieve the Technique and Pass instances and set the
+            property there.
+        @see Pass::setSeparateSceneBlending
+        */
+        void setSeparateSceneBlending( const SceneBlendType sbt, const SceneBlendType sbta );
+
+        /** Allows very fine control of blending every Pass with the existing contents of the scene.
+        @note
+            This property has been moved to the Pass class, which is accessible via the 
+            Technique. For simplicity, this method allows you to set these properties for 
+            every current Technique, and for every current Pass within those Techniques. If 
+            you need more precision, retrieve the Technique and Pass instances and set the
+            property there.
+        @see Pass::setSceneBlending
+        */
+        void setSceneBlending( const SceneBlendFactor sourceFactor, const SceneBlendFactor destFactor);
+
+        /** Allows very fine control of blending every Pass with the existing contents of the scene, using individual factors for color and alpha channels
+        @note
+            This property has been moved to the Pass class, which is accessible via the 
+            Technique. For simplicity, this method allows you to set these properties for 
+            every current Technique, and for every current Pass within those Techniques. If 
+            you need more precision, retrieve the Technique and Pass instances and set the
+            property there.
+        @see Pass::setSeparateSceneBlending
+        */
+        void setSeparateSceneBlending( const SceneBlendFactor sourceFactor, const SceneBlendFactor destFactor, const SceneBlendFactor sourceFactorAlpha, const SceneBlendFactor destFactorAlpha);
+
+        /** Tells the material that it needs recompilation. */
+        void _notifyNeedsRecompile(void);
+
+        /** Sets the distance at which level-of-detail (LOD) levels come into effect.
+        @remarks
+            You should only use this if you have assigned LOD indexes to the Technique
+            instances attached to this Material. If you have done so, you should call this
+            method to determine the distance at which the lowe levels of detail kick in.
+            The decision about what distance is actually used is a combination of this
+            and the LOD bias applied to both the current Camera and the current Entity.
+        @param lodValues A vector of Reals which indicate the LOD value at which to 
+            switch to lower details. They are listed in LOD index order, starting at index
+            1 (ie the first level down from the highest level 0, which automatically applies
+            from a value of 0). These are 'user values', before being potentially 
+			transformed by the strategy, so for the distance strategy this is an
+			unsquared distance for example.
+        */
+        void setLodLevels(const LodValueList& lodValues);
+
+        /** Gets an iterator over the list of values transformed by the LodStrategy at which each LOD comes into effect. 
+        @remarks
+            Note that the iterator returned from this method is not totally analogous to 
+            the one passed in by calling setLodLevels - the list includes a zero
+            entry at the start (since the highest LOD starts at value 0). Also, the
+			values returned are after being transformed by LodStrategy::transformUserValue.
+        */
+        LodValueIterator getLodValueIterator(void) const;
+
+        /** Gets an iterator over the user-defined list of values which are internally transfomed by the LodStrategy. 
+        @remarks
+            Note that the iterator returned from this method is not totally analogous to 
+            the one passed in by calling setLodLevels - the list includes a zero
+            entry at the start (since the highest LOD starts at value 0). Also, the
+			values returned are after being transformed by LodStrategy::transformUserValue.
+        */
+        LodValueIterator getUserLodValueIterator(void) const;
+
+        /** Gets the LOD index to use at the given value. 
+		@note The value passed in is the 'transformed' value. If you are dealing with
+		an original source value (e.g. distance), use LodStrategy::transformUserValue
+		to turn this into a lookup value.
+		*/
+        ushort getLodIndex(Real value) const;
+
+        /** Get LOD strategy used by this material. */
+        const LodStrategy *getLodStrategy() const;
+        /** Set the LOD strategy used by this material. */
+        void setLodStrategy(LodStrategy *lodStrategy);
+
+        /** @copydoc Resource::touch
+        */
+        void touch(void) 
+        { 
+            if (mCompilationRequired) 
+                compile();
+            // call superclass
+            Resource::touch();
+        }
+        
+        /** Applies texture names to Texture Unit State with matching texture name aliases.
+            All techniques, passes, and Texture Unit States within the material are checked.
+            If matching texture aliases are found then true is returned.
+
+        @param
+            aliasList is a map container of texture alias, texture name pairs
+        @param
+            apply set true to apply the texture aliases else just test to see if texture alias matches are found.
+        @return
+            True if matching texture aliases were found in the material.
+        */
+        bool applyTextureAliases(const AliasTextureNamePairList& aliasList, const bool apply = true) const;
+
+	    /** Gets the compilation status of the material.
+        @return True if the material needs recompilation.
+        */
+	    bool getCompilationRequired() const
+	    {
+		    return mCompilationRequired;
+	    }
+
+
+    };
+	/** @} */
+	/** @} */
+
+} //namespace 
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreMaterialManager.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreMaterialManager.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreMaterialManager.h	(revision 148)
@@ -0,0 +1,324 @@
+/*
+-----------------------------------------------------------------------------
+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 __MATERIALMANAGER_H__
+#define __MATERIALMANAGER_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreSingleton.h"
+#include "OgreResourceManager.h"
+#include "OgreMaterial.h"
+#include "OgreStringVector.h"
+#include "OgreMaterialSerializer.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Materials
+	*  @{
+	*/
+	/** Class for managing Material settings for Ogre.
+        @remarks
+            Materials control the eventual surface rendering properties of geometry. This class
+            manages the library of materials, dealing with programmatic registrations and lookups,
+            as well as loading predefined Material settings from scripts.
+        @par
+            When loaded from a script, a Material is in an 'unloaded' state and only stores the settings
+            required. It does not at that stage load any textures. This is because the material settings may be
+            loaded 'en masse' from bulk material script files, but only a subset will actually be required.
+        @par
+            Because this is a subclass of ResourceManager, any files loaded will be searched for in any path or
+            archive added to the resource paths/archives. See ResourceManager for details.
+        @par
+            For a definition of the material script format, see the Tutorials/MaterialScript.html file.
+    */
+    class _OgreExport MaterialManager : public ResourceManager, public Singleton<MaterialManager>
+    {
+	public:
+		/** Listener on any general material events.
+		@see MaterialManager::addListener
+		*/
+		class Listener
+		{
+		public:
+            /** Virtual destructor needed as class has virtual methods. */
+            virtual ~Listener() { }
+			/** Called if a technique for a given scheme is not found within a material,
+				allows the application to specify a Technique instance manually.
+			@remarks
+				Material schemes allow you to switch wholesale between families of 
+				techniques on a material. However they require you to define those
+				schemes on the materials up-front, which might not be possible or
+				desirable for all materials, particular if, for example, you wanted
+				a simple way to replace all materials with another using a scheme.
+			@par
+				This callback allows you to handle the case where a scheme is requested
+				but the material doesn't have an entry for it. You can return a
+				Technique pointer from this method to specify the material technique
+				you'd like to be applied instead, which can be from another material
+				entirely (and probably will be). Note that it is critical that you
+				only return a Technique that is supported on this hardware; there are
+				utility methods like Material::getBestTechnique to help you with this.
+			@param schemeIndex The index of the scheme that was requested - all 
+				schemes have a unique index when created that does not alter. 
+			@param schemeName The friendly name of the scheme being requested
+			@param originalMaterial The material that is being processed, that 
+				didn't have a specific technique for this scheme
+			@param lodIndex The material level-of-detail that was being asked for, 
+				in case you need to use it to determine a technique.
+			@param rend Pointer to the Renderable that is requesting this technique
+				to be used, so this may influence your choice of Technique. May be
+				null if the technique isn't being requested in that context.
+			@return A pointer to the technique to be used, or NULL if you wish to
+				use the default technique for this material
+			*/
+			virtual Technique* handleSchemeNotFound(unsigned short schemeIndex, 
+				const String& schemeName, Material* originalMaterial, unsigned short lodIndex, 
+				const Renderable* rend) = 0;
+
+		};
+
+    protected:
+
+        /// Default Texture filtering - minification
+        FilterOptions mDefaultMinFilter;
+        /// Default Texture filtering - magnification
+        FilterOptions mDefaultMagFilter;
+        /// Default Texture filtering - mipmapping
+        FilterOptions mDefaultMipFilter;
+		/// Default Texture filtering - comparison
+		FilterOptions mDefaultCompare;
+
+		bool			mDefaultCompareEnabled;
+		CompareFunction	mDefaultCompareFunction;
+
+        /// Default Texture anisotropy
+        unsigned int mDefaultMaxAniso;
+        /// Serializer - Hold instance per thread if necessary
+        OGRE_THREAD_POINTER(MaterialSerializer, mSerializer);
+		/// Default settings
+		MaterialPtr mDefaultSettings;
+
+		/// Overridden from ResourceManager
+		Resource* createImpl(const String& name, ResourceHandle handle, 
+			const String& group, bool isManual, ManualResourceLoader* loader,
+            const NameValuePairList* params);
+
+		/// Scheme name -> index. Never shrinks! Should be pretty static anyway
+		typedef map<String, unsigned short>::type SchemeMap;
+		/// List of material schemes
+		SchemeMap mSchemes;
+		/// Current material scheme
+		String mActiveSchemeName;
+		/// Current material scheme
+		unsigned short mActiveSchemeIndex;
+
+		/// The list of per-scheme (and general) material listeners
+		typedef list<Listener*>::type ListenerList;
+		typedef map<String, ListenerList>::type ListenerMap;
+		ListenerMap mListenerMap;
+
+    public:
+		/// Default material scheme
+		static String DEFAULT_SCHEME_NAME;
+
+		/// Create a new material
+		/// @see ResourceManager::createResource
+		MaterialPtr create (const String& name, const String& group,
+							bool isManual = false, ManualResourceLoader* loader = 0,
+							const NameValuePairList* createParams = 0);
+		
+		/// Get a resource by name
+		/// @see ResourceManager::getResourceByName
+		MaterialPtr getByName(const String& name, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME);
+
+        /** Default constructor.
+        */
+        MaterialManager();
+
+        /** Default destructor.
+        */
+        virtual ~MaterialManager();
+
+		/** Initialises the material manager, which also triggers it to 
+		 * parse all available .program and .material scripts. */
+		void initialise(void);
+        
+		/** @see ScriptLoader::parseScript
+        */
+        void parseScript(DataStreamPtr& stream, const String& groupName);
+
+
+        /** Sets the default texture filtering to be used for loaded textures, for when textures are
+            loaded automatically (e.g. by Material class) or when 'load' is called with the default
+            parameters by the application.
+            @note
+                The default value is TFO_BILINEAR.
+        */
+        virtual void setDefaultTextureFiltering(TextureFilterOptions fo);
+        /** Sets the default texture filtering to be used for loaded textures, for when textures are
+            loaded automatically (e.g. by Material class) or when 'load' is called with the default
+            parameters by the application.
+        */
+        virtual void setDefaultTextureFiltering(FilterType ftype, FilterOptions opts);
+        /** Sets the default texture filtering to be used for loaded textures, for when textures are
+            loaded automatically (e.g. by Material class) or when 'load' is called with the default
+            parameters by the application.
+        */
+        virtual void setDefaultTextureFiltering(FilterOptions minFilter, FilterOptions magFilter, FilterOptions mipFilter);
+
+		/// Get the default texture filtering
+        virtual FilterOptions getDefaultTextureFiltering(FilterType ftype) const;
+
+        /** Sets the default anisotropy level to be used for loaded textures, for when textures are
+            loaded automatically (e.g. by Material class) or when 'load' is called with the default
+            parameters by the application.
+            @note
+                The default value is 1 (no anisotropy).
+        */
+		void setDefaultAnisotropy(unsigned int maxAniso);
+		/// Get the default maxAnisotropy
+		unsigned int getDefaultAnisotropy() const;
+
+        /** Returns a pointer to the default Material settings.
+            @remarks
+                Ogre comes configured with a set of defaults for newly created
+                materials. If you wish to have a different set of defaults,
+                simply call this method and change the returned Material's
+                settings. All materials created from then on will be configured
+                with the new defaults you have specified.
+            @par
+                The default settings begin as a single Technique with a single, non-programmable Pass:
+                <ul>
+                <li>ambient = ColourValue::White</li>
+                <li>diffuse = ColourValue::White</li>
+                <li>specular = ColourValue::Black</li>
+                <li>emmissive = ColourValue::Black</li>
+                <li>shininess = 0</li>
+                <li>No texture unit settings (& hence no textures)</li>
+                <li>SourceBlendFactor = SBF_ONE</li>
+                <li>DestBlendFactor = SBF_ZERO (no blend, replace with new
+                  colour)</li>
+                <li>Depth buffer checking on</li>
+                <li>Depth buffer writing on</li>
+                <li>Depth buffer comparison function = CMPF_LESS_EQUAL</li>
+                <li>Colour buffer writing on for all channels</li>
+                <li>Culling mode = CULL_CLOCKWISE</li>
+                <li>Ambient lighting = ColourValue(0.5, 0.5, 0.5) (mid-grey)</li>
+                <li>Dynamic lighting enabled</li>
+                <li>Gourad shading mode</li>
+                <li>Bilinear texture filtering</li>
+                </ul>
+        */
+		virtual MaterialPtr getDefaultSettings(void) const { return mDefaultSettings; }
+
+		/** Internal method - returns index for a given material scheme name.
+		@see Technique::setSchemeName
+		*/
+		virtual unsigned short _getSchemeIndex(const String& name);
+		/** Internal method - returns name for a given material scheme index.
+		@see Technique::setSchemeName
+		*/
+		virtual const String& _getSchemeName(unsigned short index);
+		/** Internal method - returns the active scheme index.
+		@see Technique::setSchemeName
+		*/
+		virtual unsigned short _getActiveSchemeIndex(void) const;
+
+		/** Returns the name of the active material scheme. 
+		@see Technique::setSchemeName
+		*/
+		virtual const String& getActiveScheme(void) const;
+		
+		/** Sets the name of the active material scheme. 
+		@see Technique::setSchemeName
+		*/
+		virtual void setActiveScheme(const String& schemeName);
+
+		/** 
+		Add a listener to handle material events. 
+		If schemeName is supplied, the listener will only receive events for that certain scheme.
+		*/
+		virtual void addListener(Listener* l, const Ogre::String& schemeName = StringUtil::BLANK);
+
+		/** 
+		Remove a listener handling material events. 
+		If the listener was added with a custom scheme name, it needs to be supplied here as well.
+		*/
+		virtual void removeListener(Listener* l, const Ogre::String& schemeName = StringUtil::BLANK);
+
+		/// Internal method for sorting out missing technique for a scheme
+		virtual Technique* _arbitrateMissingTechniqueForActiveScheme(
+			Material* mat, unsigned short lodIndex, const Renderable* rend);
+
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static MaterialManager& getSingleton(void);
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static MaterialManager* getSingletonPtr(void);
+
+    };
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreMaterialSerializer.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreMaterialSerializer.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreMaterialSerializer.h	(revision 148)
@@ -0,0 +1,451 @@
+/*
+-----------------------------------------------------------------------------
+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 __MaterialSerializer_H__
+#define __MaterialSerializer_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreMaterial.h"
+#include "OgreBlendMode.h"
+#include "OgreTextureUnitState.h"
+#include "OgreGpuProgram.h"
+#include "OgreStringVector.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Materials
+	*  @{
+	*/
+	/** Enum to identify material sections. */
+    enum MaterialScriptSection
+    {
+        MSS_NONE,
+        MSS_MATERIAL,
+        MSS_TECHNIQUE,
+        MSS_PASS,
+        MSS_TEXTUREUNIT,
+        MSS_PROGRAM_REF,
+		MSS_PROGRAM,
+        MSS_DEFAULT_PARAMETERS,
+		MSS_TEXTURESOURCE
+    };
+	/** Struct for holding a program definition which is in progress. */
+	struct MaterialScriptProgramDefinition
+	{
+		String name;
+		GpuProgramType progType;
+        String language;
+		String source;
+		String syntax;
+        bool supportsSkeletalAnimation;
+		bool supportsMorphAnimation;
+		ushort supportsPoseAnimation; // number of simultaneous poses supported
+		bool usesVertexTextureFetch;
+		vector<std::pair<String, String> >::type customParameters;
+	};
+    /** Struct for holding the script context while parsing. */
+    struct MaterialScriptContext 
+    {
+        MaterialScriptSection section;
+		String groupName;
+        MaterialPtr material;
+        Technique* technique;
+        Pass* pass;
+        TextureUnitState* textureUnit;
+        GpuProgramPtr program; /// Used when referencing a program, not when defining it
+        bool isVertexProgramShadowCaster; /// When referencing, are we in context of shadow caster
+        bool isFragmentProgramShadowCaster; /// When referencing, are we in context of shadow caster
+        bool isVertexProgramShadowReceiver; /// When referencing, are we in context of shadow caster
+		bool isFragmentProgramShadowReceiver; /// When referencing, are we in context of shadow caster
+        GpuProgramParametersSharedPtr programParams;
+		ushort numAnimationParametrics;
+		MaterialScriptProgramDefinition* programDef; /// This is used while defining a program
+
+		int techLev,	//Keep track of what tech, pass, and state level we are in
+			passLev,
+			stateLev;
+        StringVector defaultParamLines;
+
+		/// Error reporting state
+        size_t lineNo;
+        String filename;
+        AliasTextureNamePairList textureAliases;
+    };
+    /// Function def for material attribute parser; return value determines if the next line should be {
+    typedef bool (*ATTRIBUTE_PARSER)(String& params, MaterialScriptContext& context);
+
+    /** Class for serializing Materials to / from a .material script.*/
+	class _OgreExport MaterialSerializer : public SerializerAlloc
+    {	
+	public:
+
+		// Material serialize event.
+		enum SerializeEvent
+		{
+			MSE_PRE_WRITE,
+			MSE_WRITE_BEGIN,
+			MSE_WRITE_END,
+			MSE_POST_WRITE
+		};
+
+		/** Class that allows listening in on the various stages of material serialization process.
+		Sub-classing it enable extending the attribute set of any part in the material.
+		*/
+		class Listener
+		{
+		public:
+			virtual ~Listener() {}
+			
+			/** Called when material section event raised.					
+			@param ser The MaterialSerializer instance that writes the given material.
+			@param event The current section writing stage.
+			@param skip May set to true by sub-class instances in order to skip the following section write.
+			This parameter relevant only when stage equals MSE_PRE_WRITE. 
+			@param mat The material that is being written.			
+			*/
+			virtual void materialEventRaised(MaterialSerializer* ser, 
+				SerializeEvent event, bool& skip, const Material* mat)
+                        { (void)ser; (void)event; (void)skip; (void)mat; }
+			
+			/** Called when technique section event raised.				
+			@param ser The MaterialSerializer instance that writes the given material.
+			@param event The current section writing stage.
+			@param skip May set to true by sub-class instances in order to skip the following section write.
+			This parameter relevant only when stage equals MSE_PRE_WRITE. 
+			@param tech The technique that is being written.		
+			*/
+			virtual void techniqueEventRaised(MaterialSerializer* ser, 
+				SerializeEvent event, bool& skip, const Technique* tech)
+                        { (void)ser; (void)event; (void)skip; (void)tech; }
+		
+			/** Called when pass section event raised.					
+			@param ser The MaterialSerializer instance that writes the given material.
+			@param event The current section writing stage.
+			@param skip May set to true by sub-class instances in order to skip the following section write.
+			This parameter relevant only when stage equals MSE_PRE_WRITE. 
+			@param pass The pass that is being written.		
+			*/
+			virtual void passEventRaised(MaterialSerializer* ser, 
+				SerializeEvent event, bool& skip, const Pass* pass)
+                        { (void)ser; (void)event; (void)skip; (void)pass; }
+
+			/** Called when GPU program reference section event raised.				
+			@param ser The MaterialSerializer instance that writes the given material.
+			@param event The current section writing stage.
+			@param skip May set to true by sub-class instances in order to skip the following section write.
+			This parameter relevant only when stage equals MSE_PRE_WRITE. 
+			@param attrib The GPU program reference description (vertex_program_ref, fragment_program_ref, etc).		
+			@param program The program being written.
+			@param params The program parameters.
+			@param defaultParams The default program parameters.
+			*/
+			void gpuProgramRefEventRaised(MaterialSerializer* ser, 
+				SerializeEvent event, bool& skip,
+				const String& attrib, 
+				const GpuProgramPtr& program, 
+				const GpuProgramParametersSharedPtr& params,
+				GpuProgramParameters* defaultParams)
+                        {
+                            (void)ser;
+                            (void)event;
+                            (void)skip;
+                            (void)attrib;
+                            (void)program;
+                            (void)params;
+                            (void)defaultParams;
+                        }
+
+			/** Called when texture unit state section event raised.					
+			@param ser The MaterialSerializer instance that writes the given material.
+			@param event The current section writing stage.
+			@param skip May set to true by sub-class instances in order to skip the following section write.
+			This parameter relevant only when stage equals MSE_PRE_WRITE. 
+			@param textureUnit The texture unit state that is being written.		
+			*/
+			virtual void textureUnitStateEventRaised(MaterialSerializer* ser, 
+				SerializeEvent event, bool& skip, const TextureUnitState* textureUnit)
+                        {
+                            (void)ser;
+                            (void)event;
+                            (void)skip;
+                            (void)textureUnit;
+                        }			
+		};
+
+    protected:
+        /// Keyword-mapped attribute parsers.
+        typedef map<String, ATTRIBUTE_PARSER>::type AttribParserList;
+
+        MaterialScriptContext mScriptContext;
+
+        /** internal method for parsing a material
+        @return true if it expects the next line to be a {
+        */
+        bool parseScriptLine(String& line);
+        /** internal method for finding & invoking an attribute parser. */
+        bool invokeParser(String& line, AttribParserList& parsers);
+		/** Internal method for saving a program definition which has been
+		    built up.
+		*/
+		void finishProgramDefinition(void);
+        /// Parsers for the root of the material script
+        AttribParserList mRootAttribParsers;
+        /// Parsers for the material section of a script
+        AttribParserList mMaterialAttribParsers;
+        /// Parsers for the technique section of a script
+        AttribParserList mTechniqueAttribParsers;
+        /// Parsers for the pass section of a script
+        AttribParserList mPassAttribParsers;
+        /// Parsers for the texture unit section of a script
+        AttribParserList mTextureUnitAttribParsers;
+        /// Parsers for the program reference section of a script
+        AttribParserList mProgramRefAttribParsers;
+        /// Parsers for the program definition section of a script
+        AttribParserList mProgramAttribParsers;
+        /// Parsers for the program definition section of a script
+        AttribParserList mProgramDefaultParamAttribParsers;
+
+		/// Listeners list of this Serializer.
+		typedef vector<Listener*>::type			ListenerList;
+		typedef ListenerList::iterator			ListenerListIterator;
+		typedef ListenerList::const_iterator	ListenerListConstIterator;
+		ListenerList mListeners;
+
+
+        void writeMaterial(const MaterialPtr& pMat, const String& materialName = "");
+        void writeTechnique(const Technique* pTech);
+        void writePass(const Pass* pPass);
+        void writeVertexProgramRef(const Pass* pPass);
+        void writeShadowCasterVertexProgramRef(const Pass* pPass);
+        void writeShadowCasterFragmentProgramRef(const Pass* pPass);
+        void writeShadowReceiverVertexProgramRef(const Pass* pPass);
+        void writeShadowReceiverFragmentProgramRef(const Pass* pPass);
+        void writeFragmentProgramRef(const Pass* pPass);
+        void writeGpuProgramRef(const String& attrib, const GpuProgramPtr& program, const GpuProgramParametersSharedPtr& params);
+        void writeGpuPrograms(void);
+        void writeGPUProgramParameters(const GpuProgramParametersSharedPtr& params, GpuProgramParameters* defaultParams,
+            const unsigned short level = 4, const bool useMainBuffer = true);
+		void writeNamedGpuProgramParameters(const GpuProgramParametersSharedPtr& params, GpuProgramParameters* defaultParams,
+			const unsigned short level = 4, const bool useMainBuffer = true);
+		void writeLowLevelGpuProgramParameters(const GpuProgramParametersSharedPtr& params, GpuProgramParameters* defaultParams,
+			const unsigned short level = 4, const bool useMainBuffer = true);
+		void writeGpuProgramParameter(
+			const String& commandName, const String& identifier, 
+			const GpuProgramParameters::AutoConstantEntry* autoEntry, 
+			const GpuProgramParameters::AutoConstantEntry* defaultAutoEntry, 
+			bool isFloat, bool isDouble, size_t physicalIndex, size_t physicalSize,
+			const GpuProgramParametersSharedPtr& params, GpuProgramParameters* defaultParams,
+			const unsigned short level, const bool useMainBuffer);
+		void writeTextureUnit(const TextureUnitState *pTex);
+		void writeSceneBlendFactor(const SceneBlendFactor c_src, const SceneBlendFactor c_dest, 
+			const SceneBlendFactor a_src, const SceneBlendFactor a_dest);
+		void writeSceneBlendFactor(const SceneBlendFactor sbf_src, const SceneBlendFactor sbf_dest);
+		void writeSceneBlendFactor(const SceneBlendFactor sbf);
+		void writeCompareFunction(const CompareFunction cf);
+		void writeColourValue(const ColourValue &colour, bool writeAlpha = false);
+		void writeLayerBlendOperationEx(const LayerBlendOperationEx op);
+		void writeLayerBlendSource(const LayerBlendSource lbs);
+		
+		typedef multimap<TextureUnitState::TextureEffectType, TextureUnitState::TextureEffect>::type EffectMap;
+
+		void writeRotationEffect(const TextureUnitState::TextureEffect& effect, const TextureUnitState *pTex);
+		void writeTransformEffect(const TextureUnitState::TextureEffect& effect, const TextureUnitState *pTex);
+		void writeScrollEffect(const TextureUnitState::TextureEffect& effect, const TextureUnitState *pTex);
+		void writeEnvironmentMapEffect(const TextureUnitState::TextureEffect& effect, const TextureUnitState *pTex);
+
+        String convertFiltering(FilterOptions fo);
+
+		
+		/** Internal methods that invokes registered listeners callback.
+		@see Listener::materialEventRaised.
+		*/
+		void fireMaterialEvent(SerializeEvent event, bool& skip, const Material* mat);
+
+		/** Internal methods that invokes registered listeners callback.
+		@see Listener::techniqueEventRaised.
+		*/
+		void fireTechniqueEvent(SerializeEvent event, bool& skip, const Technique* tech);
+		
+		/** Internal methods that invokes registered listeners callback.
+		@see Listener::passEventRaised.
+		*/
+		void firePassEvent(SerializeEvent event, bool& skip, const Pass* pass);
+		
+		/** Internal methods that invokes registered listeners callback.
+		@see Listener::gpuProgramRefEventRaised.
+		*/
+		void fireGpuProgramRefEvent(SerializeEvent event, bool& skip,
+			const String& attrib, 
+			const GpuProgramPtr& program, 
+			const GpuProgramParametersSharedPtr& params,
+			GpuProgramParameters* defaultParams);
+	
+
+		/** Internal methods that invokes registered listeners callback.
+		@see Listener::textureUnitStateEventRaised.
+		*/
+		void fireTextureUnitStateEvent(SerializeEvent event, bool& skip, const TextureUnitState* textureUnit);
+		
+   public:		
+		/** default constructor*/
+		MaterialSerializer();
+		/** default destructor*/
+		virtual ~MaterialSerializer() {}
+
+		/** Queue an in-memory Material to the internal buffer for export.
+		@param pMat Material pointer
+		@param clearQueued If true, any materials already queued will be removed
+		@param exportDefaults If true, attributes which are defaulted will be
+			included in the script exported, otherwise they will be omitted
+		@param materialName Allow exporting the given material under a different name.
+			In case of empty string the original material name will be used.
+		*/
+        void queueForExport(const MaterialPtr& pMat, bool clearQueued = false, 
+			bool exportDefaults = false, const String& materialName = "");
+        /** Exports queued material(s) to a named material script file.
+        @param filename the file name of the material script to be exported
+		@param includeProgDef If true, vertex program and fragment program 
+			definitions will be written at the top of the material script
+        @param programFilename the file name of the vertex / fragment program 
+			script to be exported. This is only used if there are program definitions
+            to be exported and includeProgDef is false 
+			when calling queueForExport.
+        */
+		void exportQueued(const String& filename, const bool includeProgDef = false, const String& programFilename = "");
+        /** Exports a single in-memory Material to the named material script file.
+        @param exportDefaults if true then exports all values including defaults
+        @param includeProgDef if true includes Gpu shader program definitions in the
+            export material script otherwise if false then program definitions will
+            be exported to a separate file with name programFilename if
+            programFilename is not empty
+        @param programFilename the file name of the vertex / fragment program 
+			script to be exported. This is only used if includeProgDef is false.
+		@param materialName Allow exporting the given material under a different name.
+			In case of empty string the original material name will be used.
+        */
+        void exportMaterial(const MaterialPtr& pMat, const String& filename, bool exportDefaults = false,
+            const bool includeProgDef = false, const String& programFilename = "", 
+			const String& materialName = "");
+		/** Returns a string representing the parsed material(s) */
+		const String &getQueuedAsString() const;
+		/** Clears the internal buffer */
+		void clearQueue();
+
+        /** Parses a Material script file passed as a stream.
+        */
+        void parseScript(DataStreamPtr& stream, const String& groupName);
+
+		/** Register a listener to this Serializer.
+		@see MaterialSerializer::Listener
+		*/
+		void addListener(Listener* listener);
+
+		/** Remove a listener from this Serializer.
+		@see MaterialSerializer::Listener
+		*/
+		void removeListener(Listener* listener);
+
+	private:
+		String mBuffer;
+        String mGpuProgramBuffer;
+        typedef set<String>::type GpuProgramDefinitionContainer;
+        typedef GpuProgramDefinitionContainer::iterator GpuProgramDefIterator;
+        GpuProgramDefinitionContainer mGpuProgramDefinitionContainer;
+		bool mDefaults;
+		
+	public:
+        void beginSection(unsigned short level, const bool useMainBuffer = true)
+		{
+            String& buffer = (useMainBuffer ? mBuffer : mGpuProgramBuffer);
+			buffer += "\n";
+            for (unsigned short i = 0; i < level; ++i)
+            {
+                buffer += "\t";
+            }
+            buffer += "{";
+		}
+		void endSection(unsigned short level, const bool useMainBuffer = true)
+		{
+            String& buffer = (useMainBuffer ? mBuffer : mGpuProgramBuffer);
+			buffer += "\n";
+            for (unsigned short i = 0; i < level; ++i)
+            {
+                buffer += "\t";
+            }
+            buffer += "}";
+		}
+
+		void writeAttribute(unsigned short level, const String& att, const bool useMainBuffer = true)
+		{
+            String& buffer = (useMainBuffer ? mBuffer : mGpuProgramBuffer);
+			buffer += "\n";
+            for (unsigned short i = 0; i < level; ++i)
+            {
+                buffer += "\t";
+            }
+            buffer += att;
+		}
+
+		void writeValue(const String& val, const bool useMainBuffer = true)
+		{
+            String& buffer = (useMainBuffer ? mBuffer : mGpuProgramBuffer);
+			buffer += (" " + val);
+		}
+
+		String quoteWord(const String& val)
+		{
+			if (val.find_first_of(" \t") != String::npos)
+				return ("\"" + val + "\"");
+			else return val;
+		}
+
+
+		void writeComment(unsigned short level, const String& comment, const bool useMainBuffer = true)
+		{
+            String& buffer = (useMainBuffer ? mBuffer : mGpuProgramBuffer);
+			buffer += "\n";
+            for (unsigned short i = 0; i < level; ++i)
+            {
+                buffer += "\t";
+            }
+            buffer += "// " + comment;
+		}
+
+
+
+    };
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreMath.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreMath.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreMath.h	(revision 148)
@@ -0,0 +1,773 @@
+/*
+-----------------------------------------------------------------------------
+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 __Math_H__
+#define __Math_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Math
+	*  @{
+	*/
+	/** Wrapper class which indicates a given angle value is in Radians.
+    @remarks
+        Radian values are interchangeable with Degree values, and conversions
+        will be done automatically between them.
+    */
+	class Radian
+	{
+		Real mRad;
+
+	public:
+		explicit Radian ( Real r=0 ) : mRad(r) {}
+		Radian ( const Degree& d );
+		Radian& operator = ( const Real& f ) { mRad = f; return *this; }
+		Radian& operator = ( const Radian& r ) { mRad = r.mRad; return *this; }
+		Radian& operator = ( const Degree& d );
+
+		Real valueDegrees() const; // see bottom of this file
+		Real valueRadians() const { return mRad; }
+		Real valueAngleUnits() const;
+
+        const Radian& operator + () const { return *this; }
+		Radian operator + ( const Radian& r ) const { return Radian ( mRad + r.mRad ); }
+		Radian operator + ( const Degree& d ) const;
+		Radian& operator += ( const Radian& r ) { mRad += r.mRad; return *this; }
+		Radian& operator += ( const Degree& d );
+		Radian operator - () const { return Radian(-mRad); }
+		Radian operator - ( const Radian& r ) const { return Radian ( mRad - r.mRad ); }
+		Radian operator - ( const Degree& d ) const;
+		Radian& operator -= ( const Radian& r ) { mRad -= r.mRad; return *this; }
+		Radian& operator -= ( const Degree& d );
+		Radian operator * ( Real f ) const { return Radian ( mRad * f ); }
+        Radian operator * ( const Radian& f ) const { return Radian ( mRad * f.mRad ); }
+		Radian& operator *= ( Real f ) { mRad *= f; return *this; }
+		Radian operator / ( Real f ) const { return Radian ( mRad / f ); }
+		Radian& operator /= ( Real f ) { mRad /= f; return *this; }
+
+		bool operator <  ( const Radian& r ) const { return mRad <  r.mRad; }
+		bool operator <= ( const Radian& r ) const { return mRad <= r.mRad; }
+		bool operator == ( const Radian& r ) const { return mRad == r.mRad; }
+		bool operator != ( const Radian& r ) const { return mRad != r.mRad; }
+		bool operator >= ( const Radian& r ) const { return mRad >= r.mRad; }
+		bool operator >  ( const Radian& r ) const { return mRad >  r.mRad; }
+
+		inline _OgreExport friend std::ostream& operator <<
+			( std::ostream& o, const Radian& v )
+		{
+			o << "Radian(" << v.valueRadians() << ")";
+			return o;
+		}
+	};
+
+    /** Wrapper class which indicates a given angle value is in Degrees.
+    @remarks
+        Degree values are interchangeable with Radian values, and conversions
+        will be done automatically between them.
+    */
+	class Degree
+	{
+		Real mDeg; // if you get an error here - make sure to define/typedef 'Real' first
+
+	public:
+		explicit Degree ( Real d=0 ) : mDeg(d) {}
+		Degree ( const Radian& r ) : mDeg(r.valueDegrees()) {}
+		Degree& operator = ( const Real& f ) { mDeg = f; return *this; }
+		Degree& operator = ( const Degree& d ) { mDeg = d.mDeg; return *this; }
+		Degree& operator = ( const Radian& r ) { mDeg = r.valueDegrees(); return *this; }
+
+		Real valueDegrees() const { return mDeg; }
+		Real valueRadians() const; // see bottom of this file
+		Real valueAngleUnits() const;
+
+		const Degree& operator + () const { return *this; }
+		Degree operator + ( const Degree& d ) const { return Degree ( mDeg + d.mDeg ); }
+		Degree operator + ( const Radian& r ) const { return Degree ( mDeg + r.valueDegrees() ); }
+		Degree& operator += ( const Degree& d ) { mDeg += d.mDeg; return *this; }
+		Degree& operator += ( const Radian& r ) { mDeg += r.valueDegrees(); return *this; }
+		Degree operator - () const { return Degree(-mDeg); }
+		Degree operator - ( const Degree& d ) const { return Degree ( mDeg - d.mDeg ); }
+		Degree operator - ( const Radian& r ) const { return Degree ( mDeg - r.valueDegrees() ); }
+		Degree& operator -= ( const Degree& d ) { mDeg -= d.mDeg; return *this; }
+		Degree& operator -= ( const Radian& r ) { mDeg -= r.valueDegrees(); return *this; }
+		Degree operator * ( Real f ) const { return Degree ( mDeg * f ); }
+        Degree operator * ( const Degree& f ) const { return Degree ( mDeg * f.mDeg ); }
+		Degree& operator *= ( Real f ) { mDeg *= f; return *this; }
+		Degree operator / ( Real f ) const { return Degree ( mDeg / f ); }
+		Degree& operator /= ( Real f ) { mDeg /= f; return *this; }
+
+		bool operator <  ( const Degree& d ) const { return mDeg <  d.mDeg; }
+		bool operator <= ( const Degree& d ) const { return mDeg <= d.mDeg; }
+		bool operator == ( const Degree& d ) const { return mDeg == d.mDeg; }
+		bool operator != ( const Degree& d ) const { return mDeg != d.mDeg; }
+		bool operator >= ( const Degree& d ) const { return mDeg >= d.mDeg; }
+		bool operator >  ( const Degree& d ) const { return mDeg >  d.mDeg; }
+
+		inline _OgreExport friend std::ostream& operator <<
+			( std::ostream& o, const Degree& v )
+		{
+			o << "Degree(" << v.valueDegrees() << ")";
+			return o;
+		}
+	};
+
+    /** Wrapper class which identifies a value as the currently default angle 
+        type, as defined by Math::setAngleUnit.
+    @remarks
+        Angle values will be automatically converted between radians and degrees,
+        as appropriate.
+    */
+	class Angle
+	{
+		Real mAngle;
+	public:
+		explicit Angle ( Real angle ) : mAngle(angle) {}
+		operator Radian() const;
+		operator Degree() const;
+	};
+
+	// these functions could not be defined within the class definition of class
+	// Radian because they required class Degree to be defined
+	inline Radian::Radian ( const Degree& d ) : mRad(d.valueRadians()) {
+	}
+	inline Radian& Radian::operator = ( const Degree& d ) {
+		mRad = d.valueRadians(); return *this;
+	}
+	inline Radian Radian::operator + ( const Degree& d ) const {
+		return Radian ( mRad + d.valueRadians() );
+	}
+	inline Radian& Radian::operator += ( const Degree& d ) {
+		mRad += d.valueRadians();
+		return *this;
+	}
+	inline Radian Radian::operator - ( const Degree& d ) const {
+		return Radian ( mRad - d.valueRadians() );
+	}
+	inline Radian& Radian::operator -= ( const Degree& d ) {
+		mRad -= d.valueRadians();
+		return *this;
+	}
+
+    /** Class to provide access to common mathematical functions.
+        @remarks
+            Most of the maths functions are aliased versions of the C runtime
+            library functions. They are aliased here to provide future
+            optimisation opportunities, either from faster RTLs or custom
+            math approximations.
+        @note
+            <br>This is based on MgcMath.h from
+            <a href="http://www.geometrictools.com/">Wild Magic</a>.
+    */
+    class _OgreExport Math 
+    {
+	public:
+       /** The angular units used by the API. This functionality is now deprecated in favor
+	       of discreet angular unit types ( see Degree and Radian above ). The only place
+		   this functionality is actually still used is when parsing files. Search for
+		   usage of the Angle class for those instances
+       */
+       enum AngleUnit
+       {
+           AU_DEGREE,
+           AU_RADIAN
+       };
+
+
+       /** This class is used to provide an external random value provider. 
+      */
+       class RandomValueProvider
+       {
+       public:
+            virtual ~RandomValueProvider() {}
+            /** When called should return a random values in the range of [0,1] */
+            virtual Real getRandomUnit() = 0;
+       };
+
+    protected:
+        /// Angle units used by the api
+        static AngleUnit msAngleUnit;
+
+        /// Size of the trig tables as determined by constructor.
+        static int mTrigTableSize;
+
+        /// Radian -> index factor value ( mTrigTableSize / 2 * PI )
+        static Real mTrigTableFactor;
+        static Real* mSinTable;
+        static Real* mTanTable;
+
+        /// A random value provider. overriding the default random number generator.
+        static RandomValueProvider* mRandProvider;
+
+        /** Private function to build trig tables.
+        */
+        void buildTrigTables();
+
+        static Real SinTable (Real fValue);
+        static Real TanTable (Real fValue);
+    public:
+        /** Default constructor.
+            @param
+                trigTableSize Optional parameter to set the size of the
+                tables used to implement Sin, Cos, Tan
+        */
+        Math(unsigned int trigTableSize = 4096);
+
+        /** Default destructor.
+        */
+        ~Math();
+
+		static inline int IAbs (int iValue) { return ( iValue >= 0 ? iValue : -iValue ); }
+		static inline int ICeil (float fValue) { return int(ceil(fValue)); }
+		static inline int IFloor (float fValue) { return int(floor(fValue)); }
+        static int ISign (int iValue);
+
+        /** Absolute value function
+            @param
+                fValue The value whose absolute value will be returned.
+        */
+		static inline Real Abs (Real fValue) { return Real(fabs(fValue)); }
+
+        /** Absolute value function
+            @param dValue
+                The value, in degrees, whose absolute value will be returned.
+         */
+		static inline Degree Abs (const Degree& dValue) { return Degree(fabs(dValue.valueDegrees())); }
+
+        /** Absolute value function
+            @param rValue
+                The value, in radians, whose absolute value will be returned.
+         */
+        static inline Radian Abs (const Radian& rValue) { return Radian(fabs(rValue.valueRadians())); }
+
+        /** Arc cosine function
+            @param fValue
+                The value whose arc cosine will be returned.
+         */
+		static Radian ACos (Real fValue);
+
+        /** Arc sine function
+            @param fValue
+                The value whose arc sine will be returned.
+         */
+		static Radian ASin (Real fValue);
+
+        /** Arc tangent function
+            @param fValue
+                The value whose arc tangent will be returned.
+         */
+		static inline Radian ATan (Real fValue) { return Radian(atan(fValue)); }
+
+        /** Arc tangent between two values function
+            @param fY
+                The first value to calculate the arc tangent with.
+            @param fX
+                The second value to calculate the arc tangent with.
+         */
+		static inline Radian ATan2 (Real fY, Real fX) { return Radian(atan2(fY,fX)); }
+
+        /** Ceiling function
+            Returns the smallest following integer. (example: Ceil(1.1) = 2)
+
+            @param fValue
+                The value to round up to the nearest integer.
+         */
+		static inline Real Ceil (Real fValue) { return Real(ceil(fValue)); }
+		static inline bool isNaN(Real f)
+		{
+			// std::isnan() is C99, not supported by all compilers
+			// However NaN always fails this next test, no other number does.
+			return f != f;
+		}
+
+        /** Cosine function.
+            @param fValue
+                Angle in radians
+            @param useTables
+                If true, uses lookup tables rather than
+                calculation - faster but less accurate.
+        */
+        static inline Real Cos (const Radian& fValue, bool useTables = false) {
+			return (!useTables) ? Real(cos(fValue.valueRadians())) : SinTable(fValue.valueRadians() + HALF_PI);
+		}
+        /** Cosine function.
+            @param fValue
+                Angle in radians
+            @param useTables
+                If true, uses lookup tables rather than
+                calculation - faster but less accurate.
+        */
+        static inline Real Cos (Real fValue, bool useTables = false) {
+			return (!useTables) ? Real(cos(fValue)) : SinTable(fValue + HALF_PI);
+		}
+
+		static inline Real Exp (Real fValue) { return Real(exp(fValue)); }
+
+        /** Floor function
+            Returns the largest previous integer. (example: Floor(1.9) = 1)
+         
+            @param fValue
+                The value to round down to the nearest integer.
+         */
+        static inline Real Floor (Real fValue) { return Real(floor(fValue)); }
+
+        static inline Real Log (Real fValue) { return Real(log(fValue)); }
+
+        /// Stored value of log(2) for frequent use
+        static const Real LOG2;
+
+        static inline Real Log2 (Real fValue) { return Real(log(fValue)/LOG2); }
+
+        static inline Real LogN (Real base, Real fValue) { return Real(log(fValue)/log(base)); }
+
+        static inline Real Pow (Real fBase, Real fExponent) { return Real(pow(fBase,fExponent)); }
+
+        static Real Sign (Real fValue);
+        static inline Radian Sign ( const Radian& rValue )
+        {
+            return Radian(Sign(rValue.valueRadians()));
+        }
+        static inline Degree Sign ( const Degree& dValue )
+        {
+            return Degree(Sign(dValue.valueDegrees()));
+        }
+
+        //Simulate the shader function saturate that clamps a parameter value between 0 and 1
+        static inline float saturate(float t) { return (t < 0) ? 0 : ((t > 1) ? 1 : t); }
+        static inline double saturate(double t) { return (t < 0) ? 0 : ((t > 1) ? 1 : t); }
+        
+        //Simulate the shader function lerp which performers linear interpolation
+        //given 3 parameters v0, v1 and t the function returns the value of (1  t)* v0 + t * v1. 
+        //where v0 and v1 are matching vector or scalar types and t can be either a scalar or a vector of the same type as a and b.
+        template<typename V, typename T> static V lerp(const V& v0, const V& v1, const T& t) { 
+            return v0 * (1 - t) + v1 * t; }
+
+        /** Sine function.
+            @param fValue
+                Angle in radians
+            @param useTables
+                If true, uses lookup tables rather than
+                calculation - faster but less accurate.
+        */
+        static inline Real Sin (const Radian& fValue, bool useTables = false) {
+			return (!useTables) ? Real(sin(fValue.valueRadians())) : SinTable(fValue.valueRadians());
+		}
+        /** Sine function.
+            @param fValue
+                Angle in radians
+            @param useTables
+                If true, uses lookup tables rather than
+                calculation - faster but less accurate.
+        */
+        static inline Real Sin (Real fValue, bool useTables = false) {
+			return (!useTables) ? Real(sin(fValue)) : SinTable(fValue);
+		}
+
+        /** Squared function.
+            @param fValue
+                The value to be squared (fValue^2)
+        */
+		static inline Real Sqr (Real fValue) { return fValue*fValue; }
+
+        /** Square root function.
+            @param fValue
+                The value whose square root will be calculated.
+         */
+		static inline Real Sqrt (Real fValue) { return Real(sqrt(fValue)); }
+
+        /** Square root function.
+            @param fValue
+                The value, in radians, whose square root will be calculated.
+            @return
+                The square root of the angle in radians.
+         */
+        static inline Radian Sqrt (const Radian& fValue) { return Radian(sqrt(fValue.valueRadians())); }
+
+        /** Square root function.
+            @param fValue
+                The value, in degrees, whose square root will be calculated.
+            @return
+                The square root of the angle in degrees.
+         */
+        static inline Degree Sqrt (const Degree& fValue) { return Degree(sqrt(fValue.valueDegrees())); }
+
+        /** Inverse square root i.e. 1 / Sqrt(x), good for vector
+            normalisation.
+            @param fValue
+                The value whose inverse square root will be calculated.
+        */
+		static Real InvSqrt (Real fValue);
+
+        /** Generate a random number of unit length.
+            @return
+                A random number in the range from [0,1].
+        */
+        static Real UnitRandom ();
+
+        /** Generate a random number within the range provided.
+            @param fLow
+                The lower bound of the range.
+            @param fHigh
+                The upper bound of the range.
+            @return
+                A random number in the range from [fLow,fHigh].
+         */
+        static Real RangeRandom (Real fLow, Real fHigh);
+
+        /** Generate a random number in the range [-1,1].
+            @return
+                A random number in the range from [-1,1].
+         */
+        static Real SymmetricRandom ();
+
+        static void SetRandomValueProvider(RandomValueProvider* provider);
+       
+        /** Tangent function.
+            @param fValue
+                Angle in radians
+            @param useTables
+                If true, uses lookup tables rather than
+                calculation - faster but less accurate.
+        */
+		static inline Real Tan (const Radian& fValue, bool useTables = false) {
+			return (!useTables) ? Real(tan(fValue.valueRadians())) : TanTable(fValue.valueRadians());
+		}
+        /** Tangent function.
+            @param fValue
+                Angle in radians
+            @param useTables
+                If true, uses lookup tables rather than
+                calculation - faster but less accurate.
+        */
+		static inline Real Tan (Real fValue, bool useTables = false) {
+			return (!useTables) ? Real(tan(fValue)) : TanTable(fValue);
+		}
+
+		static inline Real DegreesToRadians(Real degrees) { return degrees * fDeg2Rad; }
+        static inline Real RadiansToDegrees(Real radians) { return radians * fRad2Deg; }
+
+       /** These functions used to set the assumed angle units (radians or degrees) 
+            expected when using the Angle type.
+       @par
+            You can set this directly after creating a new Root, and also before/after resource creation,
+            depending on whether you want the change to affect resource files.
+       */
+       static void setAngleUnit(AngleUnit unit);
+       /** Get the unit being used for angles. */
+       static AngleUnit getAngleUnit(void);
+
+       /** Convert from the current AngleUnit to radians. */
+       static Real AngleUnitsToRadians(Real units);
+       /** Convert from radians to the current AngleUnit . */
+       static Real RadiansToAngleUnits(Real radians);
+       /** Convert from the current AngleUnit to degrees. */
+       static Real AngleUnitsToDegrees(Real units);
+       /** Convert from degrees to the current AngleUnit. */
+       static Real DegreesToAngleUnits(Real degrees);
+
+       /** Checks whether a given point is inside a triangle, in a
+            2-dimensional (Cartesian) space.
+            @remarks
+                The vertices of the triangle must be given in either
+                trigonometrical (anticlockwise) or inverse trigonometrical
+                (clockwise) order.
+            @param p
+                The point.
+            @param a
+                The triangle's first vertex.
+            @param b
+                The triangle's second vertex.
+            @param c
+                The triangle's third vertex.
+            @return
+                If the point resides in the triangle, <b>true</b> is
+                returned.
+            @par
+                If the point is outside the triangle, <b>false</b> is
+                returned.
+        */
+        static bool pointInTri2D(const Vector2& p, const Vector2& a, 
+			const Vector2& b, const Vector2& c);
+
+       /** Checks whether a given 3D point is inside a triangle.
+       @remarks
+            The vertices of the triangle must be given in either
+            trigonometrical (anticlockwise) or inverse trigonometrical
+            (clockwise) order, and the point must be guaranteed to be in the
+			same plane as the triangle
+        @param p
+            p The point.
+        @param a
+            The triangle's first vertex.
+        @param b
+            The triangle's second vertex.
+        @param c
+            The triangle's third vertex.
+		@param normal
+			The triangle plane's normal (passed in rather than calculated
+			on demand since the caller may already have it)
+        @return
+            If the point resides in the triangle, <b>true</b> is
+            returned.
+        @par
+            If the point is outside the triangle, <b>false</b> is
+            returned.
+        */
+        static bool pointInTri3D(const Vector3& p, const Vector3& a, 
+			const Vector3& b, const Vector3& c, const Vector3& normal);
+        /** Ray / plane intersection, returns boolean result and distance. */
+        static std::pair<bool, Real> intersects(const Ray& ray, const Plane& plane);
+
+        /** Ray / sphere intersection, returns boolean result and distance. */
+        static std::pair<bool, Real> intersects(const Ray& ray, const Sphere& sphere, 
+            bool discardInside = true);
+        
+        /** Ray / box intersection, returns boolean result and distance. */
+        static std::pair<bool, Real> intersects(const Ray& ray, const AxisAlignedBox& box);
+
+        /** Ray / box intersection, returns boolean result and two intersection distance.
+        @param ray
+            The ray.
+        @param box
+            The box.
+        @param d1
+            A real pointer to retrieve the near intersection distance
+            from the ray origin, maybe <b>null</b> which means don't care
+            about the near intersection distance.
+        @param d2
+            A real pointer to retrieve the far intersection distance
+            from the ray origin, maybe <b>null</b> which means don't care
+            about the far intersection distance.
+        @return
+            If the ray is intersects the box, <b>true</b> is returned, and
+            the near intersection distance is return by <i>d1</i>, the
+            far intersection distance is return by <i>d2</i>. Guarantee
+            <b>0</b> <= <i>d1</i> <= <i>d2</i>.
+        @par
+            If the ray isn't intersects the box, <b>false</b> is returned, and
+            <i>d1</i> and <i>d2</i> is unmodified.
+        */
+        static bool intersects(const Ray& ray, const AxisAlignedBox& box,
+            Real* d1, Real* d2);
+
+        /** Ray / triangle intersection, returns boolean result and distance.
+        @param ray
+            The ray.
+        @param a
+            The triangle's first vertex.
+        @param b
+            The triangle's second vertex.
+        @param c
+            The triangle's third vertex.
+		@param normal
+			The triangle plane's normal (passed in rather than calculated
+			on demand since the caller may already have it), doesn't need
+            normalised since we don't care.
+        @param positiveSide
+            Intersect with "positive side" of the triangle
+        @param negativeSide
+            Intersect with "negative side" of the triangle
+        @return
+            If the ray is intersects the triangle, a pair of <b>true</b> and the
+            distance between intersection point and ray origin returned.
+        @par
+            If the ray isn't intersects the triangle, a pair of <b>false</b> and
+            <b>0</b> returned.
+        */
+        static std::pair<bool, Real> intersects(const Ray& ray, const Vector3& a,
+            const Vector3& b, const Vector3& c, const Vector3& normal,
+            bool positiveSide = true, bool negativeSide = true);
+
+        /** Ray / triangle intersection, returns boolean result and distance.
+        @param ray
+            The ray.
+        @param a
+            The triangle's first vertex.
+        @param b
+            The triangle's second vertex.
+        @param c
+            The triangle's third vertex.
+        @param positiveSide
+            Intersect with "positive side" of the triangle
+        @param negativeSide
+            Intersect with "negative side" of the triangle
+        @return
+            If the ray is intersects the triangle, a pair of <b>true</b> and the
+            distance between intersection point and ray origin returned.
+        @par
+            If the ray isn't intersects the triangle, a pair of <b>false</b> and
+            <b>0</b> returned.
+        */
+        static std::pair<bool, Real> intersects(const Ray& ray, const Vector3& a,
+            const Vector3& b, const Vector3& c,
+            bool positiveSide = true, bool negativeSide = true);
+
+        /** Sphere / box intersection test. */
+        static bool intersects(const Sphere& sphere, const AxisAlignedBox& box);
+
+        /** Plane / box intersection test. */
+        static bool intersects(const Plane& plane, const AxisAlignedBox& box);
+
+        /** Ray / convex plane list intersection test. 
+        @param ray The ray to test with
+        @param planeList List of planes which form a convex volume
+        @param normalIsOutside Does the normal point outside the volume
+        */
+        static std::pair<bool, Real> intersects(
+            const Ray& ray, const vector<Plane>::type& planeList, 
+            bool normalIsOutside);
+        /** Ray / convex plane list intersection test. 
+        @param ray The ray to test with
+        @param planeList List of planes which form a convex volume
+        @param normalIsOutside Does the normal point outside the volume
+        */
+        static std::pair<bool, Real> intersects(
+            const Ray& ray, const list<Plane>::type& planeList, 
+            bool normalIsOutside);
+
+        /** Sphere / plane intersection test. 
+        @remarks NB just do a plane.getDistance(sphere.getCenter()) for more detail!
+        */
+        static bool intersects(const Sphere& sphere, const Plane& plane);
+
+        /** Compare 2 reals, using tolerance for inaccuracies.
+        */
+        static bool RealEqual(Real a, Real b,
+            Real tolerance = std::numeric_limits<Real>::epsilon());
+
+        /** Calculates the tangent space vector for a given set of positions / texture coords. */
+        static Vector3 calculateTangentSpaceVector(
+            const Vector3& position1, const Vector3& position2, const Vector3& position3,
+            Real u1, Real v1, Real u2, Real v2, Real u3, Real v3);
+
+        /** Build a reflection matrix for the passed in plane. */
+        static Matrix4 buildReflectionMatrix(const Plane& p);
+        /** Calculate a face normal, including the w component which is the offset from the origin. */
+        static Vector4 calculateFaceNormal(const Vector3& v1, const Vector3& v2, const Vector3& v3);
+        /** Calculate a face normal, no w-information. */
+        static Vector3 calculateBasicFaceNormal(const Vector3& v1, const Vector3& v2, const Vector3& v3);
+        /** Calculate a face normal without normalize, including the w component which is the offset from the origin. */
+        static Vector4 calculateFaceNormalWithoutNormalize(const Vector3& v1, const Vector3& v2, const Vector3& v3);
+        /** Calculate a face normal without normalize, no w-information. */
+        static Vector3 calculateBasicFaceNormalWithoutNormalize(const Vector3& v1, const Vector3& v2, const Vector3& v3);
+
+		/** Generates a value based on the Gaussian (normal) distribution function
+			with the given offset and scale parameters.
+		*/
+		static Real gaussianDistribution(Real x, Real offset = 0.0f, Real scale = 1.0f);
+
+		/** Clamp a value within an inclusive range. */
+		template <typename T>
+		static T Clamp(T val, T minval, T maxval)
+		{
+			assert (minval <= maxval && "Invalid clamp range");
+			return std::max(std::min(val, maxval), minval);
+		}
+
+		static Matrix4 makeViewMatrix(const Vector3& position, const Quaternion& orientation, 
+			const Matrix4* reflectMatrix = 0);
+
+		/** Get a bounding radius value from a bounding box. */
+		static Real boundingRadiusFromAABB(const AxisAlignedBox& aabb);
+
+
+
+        static const Real POS_INFINITY;
+        static const Real NEG_INFINITY;
+        static const Real PI;
+        static const Real TWO_PI;
+        static const Real HALF_PI;
+		static const Real fDeg2Rad;
+		static const Real fRad2Deg;
+
+    };
+
+	// these functions must be defined down here, because they rely on the
+	// angle unit conversion functions in class Math:
+
+	inline Real Radian::valueDegrees() const
+	{
+		return Math::RadiansToDegrees ( mRad );
+	}
+
+	inline Real Radian::valueAngleUnits() const
+	{
+		return Math::RadiansToAngleUnits ( mRad );
+	}
+
+	inline Real Degree::valueRadians() const
+	{
+		return Math::DegreesToRadians ( mDeg );
+	}
+
+	inline Real Degree::valueAngleUnits() const
+	{
+		return Math::DegreesToAngleUnits ( mDeg );
+	}
+
+	inline Angle::operator Radian() const
+	{
+		return Radian(Math::AngleUnitsToRadians(mAngle));
+	}
+
+	inline Angle::operator Degree() const
+	{
+		return Degree(Math::AngleUnitsToDegrees(mAngle));
+	}
+
+	inline Radian operator * ( Real a, const Radian& b )
+	{
+		return Radian ( a * b.valueRadians() );
+	}
+
+	inline Radian operator / ( Real a, const Radian& b )
+	{
+		return Radian ( a / b.valueRadians() );
+	}
+
+	inline Degree operator * ( Real a, const Degree& b )
+	{
+		return Degree ( a * b.valueDegrees() );
+	}
+
+	inline Degree operator / ( Real a, const Degree& b )
+	{
+		return Degree ( a / b.valueDegrees() );
+	}
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreMatrix3.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreMatrix3.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreMatrix3.h	(revision 148)
@@ -0,0 +1,294 @@
+/*
+-----------------------------------------------------------------------------
+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 __Matrix3_H__
+#define __Matrix3_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreVector3.h"
+
+// NB All code adapted from Wild Magic 0.2 Matrix math (free source code)
+// http://www.geometrictools.com/
+
+// NOTE.  The (x,y,z) coordinate system is assumed to be right-handed.
+// Coordinate axis rotation matrices are of the form
+//   RX =    1       0       0
+//           0     cos(t) -sin(t)
+//           0     sin(t)  cos(t)
+// where t > 0 indicates a counterclockwise rotation in the yz-plane
+//   RY =  cos(t)    0     sin(t)
+//           0       1       0
+//        -sin(t)    0     cos(t)
+// where t > 0 indicates a counterclockwise rotation in the zx-plane
+//   RZ =  cos(t) -sin(t)    0
+//         sin(t)  cos(t)    0
+//           0       0       1
+// where t > 0 indicates a counterclockwise rotation in the xy-plane.
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Math
+	*  @{
+	*/
+	/** A 3x3 matrix which can represent rotations around axes.
+        @note
+            <b>All the code is adapted from the Wild Magic 0.2 Matrix
+            library (http://www.geometrictools.com/).</b>
+        @par
+            The coordinate system is assumed to be <b>right-handed</b>.
+    */
+    class _OgreExport Matrix3
+    {
+    public:
+        /** Default constructor.
+            @note
+                It does <b>NOT</b> initialize the matrix for efficiency.
+        */
+		inline Matrix3 () {}
+        inline explicit Matrix3 (const Real arr[3][3])
+		{
+			memcpy(m,arr,9*sizeof(Real));
+		}
+        inline Matrix3 (const Matrix3& rkMatrix)
+		{
+			memcpy(m,rkMatrix.m,9*sizeof(Real));
+		}
+        Matrix3 (Real fEntry00, Real fEntry01, Real fEntry02,
+                    Real fEntry10, Real fEntry11, Real fEntry12,
+                    Real fEntry20, Real fEntry21, Real fEntry22)
+		{
+			m[0][0] = fEntry00;
+			m[0][1] = fEntry01;
+			m[0][2] = fEntry02;
+			m[1][0] = fEntry10;
+			m[1][1] = fEntry11;
+			m[1][2] = fEntry12;
+			m[2][0] = fEntry20;
+			m[2][1] = fEntry21;
+			m[2][2] = fEntry22;
+		}
+
+		/** Exchange the contents of this matrix with another. 
+		*/
+		inline void swap(Matrix3& other)
+		{
+			std::swap(m[0][0], other.m[0][0]);
+			std::swap(m[0][1], other.m[0][1]);
+			std::swap(m[0][2], other.m[0][2]);
+			std::swap(m[1][0], other.m[1][0]);
+			std::swap(m[1][1], other.m[1][1]);
+			std::swap(m[1][2], other.m[1][2]);
+			std::swap(m[2][0], other.m[2][0]);
+			std::swap(m[2][1], other.m[2][1]);
+			std::swap(m[2][2], other.m[2][2]);
+		}
+
+        /// Member access, allows use of construct mat[r][c]
+        inline const Real* operator[] (size_t iRow) const
+        {
+            return m[iRow];
+        }
+
+        inline Real* operator[] (size_t iRow)
+        {
+            return m[iRow];
+        }
+
+
+
+        /*inline operator Real* ()
+		{
+			return (Real*)m[0];
+		}*/
+        Vector3 GetColumn (size_t iCol) const;
+        void SetColumn(size_t iCol, const Vector3& vec);
+        void FromAxes(const Vector3& xAxis, const Vector3& yAxis, const Vector3& zAxis);
+
+        /// Assignment and comparison
+        inline Matrix3& operator= (const Matrix3& rkMatrix)
+		{
+			memcpy(m,rkMatrix.m,9*sizeof(Real));
+			return *this;
+		}
+
+        /** Tests 2 matrices for equality.
+         */
+        bool operator== (const Matrix3& rkMatrix) const;
+
+        /** Tests 2 matrices for inequality.
+         */
+        inline bool operator!= (const Matrix3& rkMatrix) const
+		{
+			return !operator==(rkMatrix);
+		}
+
+        // arithmetic operations
+        /** Matrix addition.
+         */
+        Matrix3 operator+ (const Matrix3& rkMatrix) const;
+
+        /** Matrix subtraction.
+         */
+        Matrix3 operator- (const Matrix3& rkMatrix) const;
+
+        /** Matrix concatenation using '*'.
+         */
+        Matrix3 operator* (const Matrix3& rkMatrix) const;
+        Matrix3 operator- () const;
+
+        /// Matrix * vector [3x3 * 3x1 = 3x1]
+        Vector3 operator* (const Vector3& rkVector) const;
+
+        /// Vector * matrix [1x3 * 3x3 = 1x3]
+        _OgreExport friend Vector3 operator* (const Vector3& rkVector,
+            const Matrix3& rkMatrix);
+
+        /// Matrix * scalar
+        Matrix3 operator* (Real fScalar) const;
+
+        /// Scalar * matrix
+        _OgreExport friend Matrix3 operator* (Real fScalar, const Matrix3& rkMatrix);
+
+        // utilities
+        Matrix3 Transpose () const;
+        bool Inverse (Matrix3& rkInverse, Real fTolerance = 1e-06) const;
+        Matrix3 Inverse (Real fTolerance = 1e-06) const;
+        Real Determinant () const;
+
+        /// Singular value decomposition
+        void SingularValueDecomposition (Matrix3& rkL, Vector3& rkS,
+            Matrix3& rkR) const;
+        void SingularValueComposition (const Matrix3& rkL,
+            const Vector3& rkS, const Matrix3& rkR);
+
+        /// Gram-Schmidt orthonormalization (applied to columns of rotation matrix)
+        void Orthonormalize ();
+
+        /// Orthogonal Q, diagonal D, upper triangular U stored as (u01,u02,u12)
+        void QDUDecomposition (Matrix3& rkQ, Vector3& rkD,
+            Vector3& rkU) const;
+
+        Real SpectralNorm () const;
+
+        /// Note: Matrix must be orthonormal
+        void ToAngleAxis (Vector3& rkAxis, Radian& rfAngle) const;
+		inline void ToAngleAxis (Vector3& rkAxis, Degree& rfAngle) const {
+			Radian r;
+			ToAngleAxis ( rkAxis, r );
+			rfAngle = r;
+		}
+        void FromAngleAxis (const Vector3& rkAxis, const Radian& fRadians);
+
+        /** The matrix must be orthonormal.  The decomposition is yaw*pitch*roll
+            where yaw is rotation about the Up vector, pitch is rotation about the
+            Right axis, and roll is rotation about the Direction axis. */
+        bool ToEulerAnglesXYZ (Radian& rfYAngle, Radian& rfPAngle,
+            Radian& rfRAngle) const;
+        bool ToEulerAnglesXZY (Radian& rfYAngle, Radian& rfPAngle,
+            Radian& rfRAngle) const;
+        bool ToEulerAnglesYXZ (Radian& rfYAngle, Radian& rfPAngle,
+            Radian& rfRAngle) const;
+        bool ToEulerAnglesYZX (Radian& rfYAngle, Radian& rfPAngle,
+            Radian& rfRAngle) const;
+        bool ToEulerAnglesZXY (Radian& rfYAngle, Radian& rfPAngle,
+            Radian& rfRAngle) const;
+        bool ToEulerAnglesZYX (Radian& rfYAngle, Radian& rfPAngle,
+            Radian& rfRAngle) const;
+        void FromEulerAnglesXYZ (const Radian& fYAngle, const Radian& fPAngle, const Radian& fRAngle);
+        void FromEulerAnglesXZY (const Radian& fYAngle, const Radian& fPAngle, const Radian& fRAngle);
+        void FromEulerAnglesYXZ (const Radian& fYAngle, const Radian& fPAngle, const Radian& fRAngle);
+        void FromEulerAnglesYZX (const Radian& fYAngle, const Radian& fPAngle, const Radian& fRAngle);
+        void FromEulerAnglesZXY (const Radian& fYAngle, const Radian& fPAngle, const Radian& fRAngle);
+        void FromEulerAnglesZYX (const Radian& fYAngle, const Radian& fPAngle, const Radian& fRAngle);
+        /// Eigensolver, matrix must be symmetric
+        void EigenSolveSymmetric (Real afEigenvalue[3],
+            Vector3 akEigenvector[3]) const;
+
+        static void TensorProduct (const Vector3& rkU, const Vector3& rkV,
+            Matrix3& rkProduct);
+
+		/** Determines if this matrix involves a scaling. */
+		inline bool hasScale() const
+		{
+			// check magnitude of column vectors (==local axes)
+			Real t = m[0][0] * m[0][0] + m[1][0] * m[1][0] + m[2][0] * m[2][0];
+			if (!Math::RealEqual(t, 1.0, (Real)1e-04))
+				return true;
+			t = m[0][1] * m[0][1] + m[1][1] * m[1][1] + m[2][1] * m[2][1];
+			if (!Math::RealEqual(t, 1.0, (Real)1e-04))
+				return true;
+			t = m[0][2] * m[0][2] + m[1][2] * m[1][2] + m[2][2] * m[2][2];
+			if (!Math::RealEqual(t, 1.0, (Real)1e-04))
+				return true;
+
+			return false;
+		}
+
+		/** Function for writing to a stream.
+		*/
+		inline _OgreExport friend std::ostream& operator <<
+			( std::ostream& o, const Matrix3& mat )
+		{
+			o << "Matrix3(" << mat[0][0] << ", " << mat[0][1] << ", " << mat[0][2] << ", " 
+                            << mat[1][0] << ", " << mat[1][1] << ", " << mat[1][2] << ", " 
+                            << mat[2][0] << ", " << mat[2][1] << ", " << mat[2][2] << ")";
+			return o;
+		}
+
+        static const Real EPSILON;
+        static const Matrix3 ZERO;
+        static const Matrix3 IDENTITY;
+
+    protected:
+        // support for eigensolver
+        void Tridiagonal (Real afDiag[3], Real afSubDiag[3]);
+        bool QLAlgorithm (Real afDiag[3], Real afSubDiag[3]);
+
+        // support for singular value decomposition
+        static const Real msSvdEpsilon;
+        static const unsigned int msSvdMaxIterations;
+        static void Bidiagonalize (Matrix3& kA, Matrix3& kL,
+            Matrix3& kR);
+        static void GolubKahanStep (Matrix3& kA, Matrix3& kL,
+            Matrix3& kR);
+
+        // support for spectral norm
+        static Real MaxCubicRoot (Real afCoeff[3]);
+
+        Real m[3][3];
+
+        // for faster access
+        friend class Matrix4;
+    };
+	/** @} */
+	/** @} */
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreMatrix4.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreMatrix4.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreMatrix4.h	(revision 148)
@@ -0,0 +1,660 @@
+/*
+-----------------------------------------------------------------------------
+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 __Matrix4__
+#define __Matrix4__
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+
+#include "OgreVector3.h"
+#include "OgreMatrix3.h"
+#include "OgreVector4.h"
+#include "OgrePlane.h"
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Math
+	*  @{
+	*/
+	/** Class encapsulating a standard 4x4 homogeneous matrix.
+        @remarks
+            OGRE uses column vectors when applying matrix multiplications,
+            This means a vector is represented as a single column, 4-row
+            matrix. This has the effect that the transformations implemented
+            by the matrices happens right-to-left e.g. if vector V is to be
+            transformed by M1 then M2 then M3, the calculation would be
+            M3 * M2 * M1 * V. The order that matrices are concatenated is
+            vital since matrix multiplication is not commutative, i.e. you
+            can get a different result if you concatenate in the wrong order.
+        @par
+            The use of column vectors and right-to-left ordering is the
+            standard in most mathematical texts, and is the same as used in
+            OpenGL. It is, however, the opposite of Direct3D, which has
+            inexplicably chosen to differ from the accepted standard and uses
+            row vectors and left-to-right matrix multiplication.
+        @par
+            OGRE deals with the differences between D3D and OpenGL etc.
+            internally when operating through different render systems. OGRE
+            users only need to conform to standard maths conventions, i.e.
+            right-to-left matrix multiplication, (OGRE transposes matrices it
+            passes to D3D to compensate).
+        @par
+            The generic form M * V which shows the layout of the matrix 
+            entries is shown below:
+            <pre>
+                [ m[0][0]  m[0][1]  m[0][2]  m[0][3] ]   {x}
+                | m[1][0]  m[1][1]  m[1][2]  m[1][3] | * {y}
+                | m[2][0]  m[2][1]  m[2][2]  m[2][3] |   {z}
+                [ m[3][0]  m[3][1]  m[3][2]  m[3][3] ]   {1}
+            </pre>
+    */
+    class _OgreExport Matrix4
+    {
+    protected:
+        /// The matrix entries, indexed by [row][col].
+        union {
+            Real m[4][4];
+            Real _m[16];
+        };
+    public:
+        /** Default constructor.
+            @note
+                It does <b>NOT</b> initialize the matrix for efficiency.
+        */
+        inline Matrix4()
+        {
+        }
+
+        inline Matrix4(
+            Real m00, Real m01, Real m02, Real m03,
+            Real m10, Real m11, Real m12, Real m13,
+            Real m20, Real m21, Real m22, Real m23,
+            Real m30, Real m31, Real m32, Real m33 )
+        {
+            m[0][0] = m00;
+            m[0][1] = m01;
+            m[0][2] = m02;
+            m[0][3] = m03;
+            m[1][0] = m10;
+            m[1][1] = m11;
+            m[1][2] = m12;
+            m[1][3] = m13;
+            m[2][0] = m20;
+            m[2][1] = m21;
+            m[2][2] = m22;
+            m[2][3] = m23;
+            m[3][0] = m30;
+            m[3][1] = m31;
+            m[3][2] = m32;
+            m[3][3] = m33;
+        }
+
+        /** Creates a standard 4x4 transformation matrix with a zero translation part from a rotation/scaling 3x3 matrix.
+         */
+
+        inline Matrix4(const Matrix3& m3x3)
+        {
+          operator=(IDENTITY);
+          operator=(m3x3);
+        }
+
+        /** Creates a standard 4x4 transformation matrix with a zero translation part from a rotation/scaling Quaternion.
+         */
+        
+        inline Matrix4(const Quaternion& rot)
+        {
+          Matrix3 m3x3;
+          rot.ToRotationMatrix(m3x3);
+          operator=(IDENTITY);
+          operator=(m3x3);
+        }
+        
+
+		/** Exchange the contents of this matrix with another. 
+		*/
+		inline void swap(Matrix4& other)
+		{
+			std::swap(m[0][0], other.m[0][0]);
+			std::swap(m[0][1], other.m[0][1]);
+			std::swap(m[0][2], other.m[0][2]);
+			std::swap(m[0][3], other.m[0][3]);
+			std::swap(m[1][0], other.m[1][0]);
+			std::swap(m[1][1], other.m[1][1]);
+			std::swap(m[1][2], other.m[1][2]);
+			std::swap(m[1][3], other.m[1][3]);
+			std::swap(m[2][0], other.m[2][0]);
+			std::swap(m[2][1], other.m[2][1]);
+			std::swap(m[2][2], other.m[2][2]);
+			std::swap(m[2][3], other.m[2][3]);
+			std::swap(m[3][0], other.m[3][0]);
+			std::swap(m[3][1], other.m[3][1]);
+			std::swap(m[3][2], other.m[3][2]);
+			std::swap(m[3][3], other.m[3][3]);
+		}
+
+		inline Real* operator [] ( size_t iRow )
+        {
+            assert( iRow < 4 );
+            return m[iRow];
+        }
+
+        inline const Real *operator [] ( size_t iRow ) const
+        {
+            assert( iRow < 4 );
+            return m[iRow];
+        }
+
+        inline Matrix4 concatenate(const Matrix4 &m2) const
+        {
+            Matrix4 r;
+            r.m[0][0] = m[0][0] * m2.m[0][0] + m[0][1] * m2.m[1][0] + m[0][2] * m2.m[2][0] + m[0][3] * m2.m[3][0];
+            r.m[0][1] = m[0][0] * m2.m[0][1] + m[0][1] * m2.m[1][1] + m[0][2] * m2.m[2][1] + m[0][3] * m2.m[3][1];
+            r.m[0][2] = m[0][0] * m2.m[0][2] + m[0][1] * m2.m[1][2] + m[0][2] * m2.m[2][2] + m[0][3] * m2.m[3][2];
+            r.m[0][3] = m[0][0] * m2.m[0][3] + m[0][1] * m2.m[1][3] + m[0][2] * m2.m[2][3] + m[0][3] * m2.m[3][3];
+
+            r.m[1][0] = m[1][0] * m2.m[0][0] + m[1][1] * m2.m[1][0] + m[1][2] * m2.m[2][0] + m[1][3] * m2.m[3][0];
+            r.m[1][1] = m[1][0] * m2.m[0][1] + m[1][1] * m2.m[1][1] + m[1][2] * m2.m[2][1] + m[1][3] * m2.m[3][1];
+            r.m[1][2] = m[1][0] * m2.m[0][2] + m[1][1] * m2.m[1][2] + m[1][2] * m2.m[2][2] + m[1][3] * m2.m[3][2];
+            r.m[1][3] = m[1][0] * m2.m[0][3] + m[1][1] * m2.m[1][3] + m[1][2] * m2.m[2][3] + m[1][3] * m2.m[3][3];
+
+            r.m[2][0] = m[2][0] * m2.m[0][0] + m[2][1] * m2.m[1][0] + m[2][2] * m2.m[2][0] + m[2][3] * m2.m[3][0];
+            r.m[2][1] = m[2][0] * m2.m[0][1] + m[2][1] * m2.m[1][1] + m[2][2] * m2.m[2][1] + m[2][3] * m2.m[3][1];
+            r.m[2][2] = m[2][0] * m2.m[0][2] + m[2][1] * m2.m[1][2] + m[2][2] * m2.m[2][2] + m[2][3] * m2.m[3][2];
+            r.m[2][3] = m[2][0] * m2.m[0][3] + m[2][1] * m2.m[1][3] + m[2][2] * m2.m[2][3] + m[2][3] * m2.m[3][3];
+
+            r.m[3][0] = m[3][0] * m2.m[0][0] + m[3][1] * m2.m[1][0] + m[3][2] * m2.m[2][0] + m[3][3] * m2.m[3][0];
+            r.m[3][1] = m[3][0] * m2.m[0][1] + m[3][1] * m2.m[1][1] + m[3][2] * m2.m[2][1] + m[3][3] * m2.m[3][1];
+            r.m[3][2] = m[3][0] * m2.m[0][2] + m[3][1] * m2.m[1][2] + m[3][2] * m2.m[2][2] + m[3][3] * m2.m[3][2];
+            r.m[3][3] = m[3][0] * m2.m[0][3] + m[3][1] * m2.m[1][3] + m[3][2] * m2.m[2][3] + m[3][3] * m2.m[3][3];
+
+            return r;
+        }
+
+        /** Matrix concatenation using '*'.
+        */
+        inline Matrix4 operator * ( const Matrix4 &m2 ) const
+        {
+            return concatenate( m2 );
+        }
+
+        /** Vector transformation using '*'.
+            @remarks
+                Transforms the given 3-D vector by the matrix, projecting the 
+                result back into <i>w</i> = 1.
+            @note
+                This means that the initial <i>w</i> is considered to be 1.0,
+                and then all the tree elements of the resulting 3-D vector are
+                divided by the resulting <i>w</i>.
+        */
+        inline Vector3 operator * ( const Vector3 &v ) const
+        {
+            Vector3 r;
+
+            Real fInvW = 1.0f / ( m[3][0] * v.x + m[3][1] * v.y + m[3][2] * v.z + m[3][3] );
+
+            r.x = ( m[0][0] * v.x + m[0][1] * v.y + m[0][2] * v.z + m[0][3] ) * fInvW;
+            r.y = ( m[1][0] * v.x + m[1][1] * v.y + m[1][2] * v.z + m[1][3] ) * fInvW;
+            r.z = ( m[2][0] * v.x + m[2][1] * v.y + m[2][2] * v.z + m[2][3] ) * fInvW;
+
+            return r;
+        }
+        inline Vector4 operator * (const Vector4& v) const
+        {
+            return Vector4(
+                m[0][0] * v.x + m[0][1] * v.y + m[0][2] * v.z + m[0][3] * v.w, 
+                m[1][0] * v.x + m[1][1] * v.y + m[1][2] * v.z + m[1][3] * v.w,
+                m[2][0] * v.x + m[2][1] * v.y + m[2][2] * v.z + m[2][3] * v.w,
+                m[3][0] * v.x + m[3][1] * v.y + m[3][2] * v.z + m[3][3] * v.w
+                );
+        }
+        inline Plane operator * (const Plane& p) const
+        {
+            Plane ret;
+			Matrix4 invTrans = inverse().transpose();
+			Vector4 v4( p.normal.x, p.normal.y, p.normal.z, p.d );
+			v4 = invTrans * v4;
+			ret.normal.x = v4.x; 
+			ret.normal.y = v4.y; 
+			ret.normal.z = v4.z;
+			ret.d = v4.w / ret.normal.normalise();
+
+            return ret;
+        }
+
+
+        /** Matrix addition.
+        */
+        inline Matrix4 operator + ( const Matrix4 &m2 ) const
+        {
+            Matrix4 r;
+
+            r.m[0][0] = m[0][0] + m2.m[0][0];
+            r.m[0][1] = m[0][1] + m2.m[0][1];
+            r.m[0][2] = m[0][2] + m2.m[0][2];
+            r.m[0][3] = m[0][3] + m2.m[0][3];
+
+            r.m[1][0] = m[1][0] + m2.m[1][0];
+            r.m[1][1] = m[1][1] + m2.m[1][1];
+            r.m[1][2] = m[1][2] + m2.m[1][2];
+            r.m[1][3] = m[1][3] + m2.m[1][3];
+
+            r.m[2][0] = m[2][0] + m2.m[2][0];
+            r.m[2][1] = m[2][1] + m2.m[2][1];
+            r.m[2][2] = m[2][2] + m2.m[2][2];
+            r.m[2][3] = m[2][3] + m2.m[2][3];
+
+            r.m[3][0] = m[3][0] + m2.m[3][0];
+            r.m[3][1] = m[3][1] + m2.m[3][1];
+            r.m[3][2] = m[3][2] + m2.m[3][2];
+            r.m[3][3] = m[3][3] + m2.m[3][3];
+
+            return r;
+        }
+
+        /** Matrix subtraction.
+        */
+        inline Matrix4 operator - ( const Matrix4 &m2 ) const
+        {
+            Matrix4 r;
+            r.m[0][0] = m[0][0] - m2.m[0][0];
+            r.m[0][1] = m[0][1] - m2.m[0][1];
+            r.m[0][2] = m[0][2] - m2.m[0][2];
+            r.m[0][3] = m[0][3] - m2.m[0][3];
+
+            r.m[1][0] = m[1][0] - m2.m[1][0];
+            r.m[1][1] = m[1][1] - m2.m[1][1];
+            r.m[1][2] = m[1][2] - m2.m[1][2];
+            r.m[1][3] = m[1][3] - m2.m[1][3];
+
+            r.m[2][0] = m[2][0] - m2.m[2][0];
+            r.m[2][1] = m[2][1] - m2.m[2][1];
+            r.m[2][2] = m[2][2] - m2.m[2][2];
+            r.m[2][3] = m[2][3] - m2.m[2][3];
+
+            r.m[3][0] = m[3][0] - m2.m[3][0];
+            r.m[3][1] = m[3][1] - m2.m[3][1];
+            r.m[3][2] = m[3][2] - m2.m[3][2];
+            r.m[3][3] = m[3][3] - m2.m[3][3];
+
+            return r;
+        }
+
+        /** Tests 2 matrices for equality.
+        */
+        inline bool operator == ( const Matrix4& m2 ) const
+        {
+            if( 
+                m[0][0] != m2.m[0][0] || m[0][1] != m2.m[0][1] || m[0][2] != m2.m[0][2] || m[0][3] != m2.m[0][3] ||
+                m[1][0] != m2.m[1][0] || m[1][1] != m2.m[1][1] || m[1][2] != m2.m[1][2] || m[1][3] != m2.m[1][3] ||
+                m[2][0] != m2.m[2][0] || m[2][1] != m2.m[2][1] || m[2][2] != m2.m[2][2] || m[2][3] != m2.m[2][3] ||
+                m[3][0] != m2.m[3][0] || m[3][1] != m2.m[3][1] || m[3][2] != m2.m[3][2] || m[3][3] != m2.m[3][3] )
+                return false;
+            return true;
+        }
+
+        /** Tests 2 matrices for inequality.
+        */
+        inline bool operator != ( const Matrix4& m2 ) const
+        {
+            if( 
+                m[0][0] != m2.m[0][0] || m[0][1] != m2.m[0][1] || m[0][2] != m2.m[0][2] || m[0][3] != m2.m[0][3] ||
+                m[1][0] != m2.m[1][0] || m[1][1] != m2.m[1][1] || m[1][2] != m2.m[1][2] || m[1][3] != m2.m[1][3] ||
+                m[2][0] != m2.m[2][0] || m[2][1] != m2.m[2][1] || m[2][2] != m2.m[2][2] || m[2][3] != m2.m[2][3] ||
+                m[3][0] != m2.m[3][0] || m[3][1] != m2.m[3][1] || m[3][2] != m2.m[3][2] || m[3][3] != m2.m[3][3] )
+                return true;
+            return false;
+        }
+
+        /** Assignment from 3x3 matrix.
+        */
+        inline void operator = ( const Matrix3& mat3 )
+        {
+            m[0][0] = mat3.m[0][0]; m[0][1] = mat3.m[0][1]; m[0][2] = mat3.m[0][2];
+            m[1][0] = mat3.m[1][0]; m[1][1] = mat3.m[1][1]; m[1][2] = mat3.m[1][2];
+            m[2][0] = mat3.m[2][0]; m[2][1] = mat3.m[2][1]; m[2][2] = mat3.m[2][2];
+        }
+
+        inline Matrix4 transpose(void) const
+        {
+            return Matrix4(m[0][0], m[1][0], m[2][0], m[3][0],
+                           m[0][1], m[1][1], m[2][1], m[3][1],
+                           m[0][2], m[1][2], m[2][2], m[3][2],
+                           m[0][3], m[1][3], m[2][3], m[3][3]);
+        }
+
+        /*
+        -----------------------------------------------------------------------
+        Translation Transformation
+        -----------------------------------------------------------------------
+        */
+        /** Sets the translation transformation part of the matrix.
+        */
+        inline void setTrans( const Vector3& v )
+        {
+            m[0][3] = v.x;
+            m[1][3] = v.y;
+            m[2][3] = v.z;
+        }
+
+        /** Extracts the translation transformation part of the matrix.
+         */
+        inline Vector3 getTrans() const
+        {
+          return Vector3(m[0][3], m[1][3], m[2][3]);
+        }
+        
+
+        /** Builds a translation matrix
+        */
+        inline void makeTrans( const Vector3& v )
+        {
+            m[0][0] = 1.0; m[0][1] = 0.0; m[0][2] = 0.0; m[0][3] = v.x;
+            m[1][0] = 0.0; m[1][1] = 1.0; m[1][2] = 0.0; m[1][3] = v.y;
+            m[2][0] = 0.0; m[2][1] = 0.0; m[2][2] = 1.0; m[2][3] = v.z;
+            m[3][0] = 0.0; m[3][1] = 0.0; m[3][2] = 0.0; m[3][3] = 1.0;
+        }
+
+        inline void makeTrans( Real tx, Real ty, Real tz )
+        {
+            m[0][0] = 1.0; m[0][1] = 0.0; m[0][2] = 0.0; m[0][3] = tx;
+            m[1][0] = 0.0; m[1][1] = 1.0; m[1][2] = 0.0; m[1][3] = ty;
+            m[2][0] = 0.0; m[2][1] = 0.0; m[2][2] = 1.0; m[2][3] = tz;
+            m[3][0] = 0.0; m[3][1] = 0.0; m[3][2] = 0.0; m[3][3] = 1.0;
+        }
+
+        /** Gets a translation matrix.
+        */
+        inline static Matrix4 getTrans( const Vector3& v )
+        {
+            Matrix4 r;
+
+            r.m[0][0] = 1.0; r.m[0][1] = 0.0; r.m[0][2] = 0.0; r.m[0][3] = v.x;
+            r.m[1][0] = 0.0; r.m[1][1] = 1.0; r.m[1][2] = 0.0; r.m[1][3] = v.y;
+            r.m[2][0] = 0.0; r.m[2][1] = 0.0; r.m[2][2] = 1.0; r.m[2][3] = v.z;
+            r.m[3][0] = 0.0; r.m[3][1] = 0.0; r.m[3][2] = 0.0; r.m[3][3] = 1.0;
+
+            return r;
+        }
+
+        /** Gets a translation matrix - variation for not using a vector.
+        */
+        inline static Matrix4 getTrans( Real t_x, Real t_y, Real t_z )
+        {
+            Matrix4 r;
+
+            r.m[0][0] = 1.0; r.m[0][1] = 0.0; r.m[0][2] = 0.0; r.m[0][3] = t_x;
+            r.m[1][0] = 0.0; r.m[1][1] = 1.0; r.m[1][2] = 0.0; r.m[1][3] = t_y;
+            r.m[2][0] = 0.0; r.m[2][1] = 0.0; r.m[2][2] = 1.0; r.m[2][3] = t_z;
+            r.m[3][0] = 0.0; r.m[3][1] = 0.0; r.m[3][2] = 0.0; r.m[3][3] = 1.0;
+
+            return r;
+        }
+
+        /*
+        -----------------------------------------------------------------------
+        Scale Transformation
+        -----------------------------------------------------------------------
+        */
+        /** Sets the scale part of the matrix.
+        */
+        inline void setScale( const Vector3& v )
+        {
+            m[0][0] = v.x;
+            m[1][1] = v.y;
+            m[2][2] = v.z;
+        }
+
+        /** Gets a scale matrix.
+        */
+        inline static Matrix4 getScale( const Vector3& v )
+        {
+            Matrix4 r;
+            r.m[0][0] = v.x; r.m[0][1] = 0.0; r.m[0][2] = 0.0; r.m[0][3] = 0.0;
+            r.m[1][0] = 0.0; r.m[1][1] = v.y; r.m[1][2] = 0.0; r.m[1][3] = 0.0;
+            r.m[2][0] = 0.0; r.m[2][1] = 0.0; r.m[2][2] = v.z; r.m[2][3] = 0.0;
+            r.m[3][0] = 0.0; r.m[3][1] = 0.0; r.m[3][2] = 0.0; r.m[3][3] = 1.0;
+
+            return r;
+        }
+
+        /** Gets a scale matrix - variation for not using a vector.
+        */
+        inline static Matrix4 getScale( Real s_x, Real s_y, Real s_z )
+        {
+            Matrix4 r;
+            r.m[0][0] = s_x; r.m[0][1] = 0.0; r.m[0][2] = 0.0; r.m[0][3] = 0.0;
+            r.m[1][0] = 0.0; r.m[1][1] = s_y; r.m[1][2] = 0.0; r.m[1][3] = 0.0;
+            r.m[2][0] = 0.0; r.m[2][1] = 0.0; r.m[2][2] = s_z; r.m[2][3] = 0.0;
+            r.m[3][0] = 0.0; r.m[3][1] = 0.0; r.m[3][2] = 0.0; r.m[3][3] = 1.0;
+
+            return r;
+        }
+
+        /** Extracts the rotation / scaling part of the Matrix as a 3x3 matrix. 
+        @param m3x3 Destination Matrix3
+        */
+        inline void extract3x3Matrix(Matrix3& m3x3) const
+        {
+            m3x3.m[0][0] = m[0][0];
+            m3x3.m[0][1] = m[0][1];
+            m3x3.m[0][2] = m[0][2];
+            m3x3.m[1][0] = m[1][0];
+            m3x3.m[1][1] = m[1][1];
+            m3x3.m[1][2] = m[1][2];
+            m3x3.m[2][0] = m[2][0];
+            m3x3.m[2][1] = m[2][1];
+            m3x3.m[2][2] = m[2][2];
+
+        }
+
+		/** Determines if this matrix involves a scaling. */
+		inline bool hasScale() const
+		{
+			// check magnitude of column vectors (==local axes)
+			Real t = m[0][0] * m[0][0] + m[1][0] * m[1][0] + m[2][0] * m[2][0];
+			if (!Math::RealEqual(t, 1.0, (Real)1e-04))
+				return true;
+			t = m[0][1] * m[0][1] + m[1][1] * m[1][1] + m[2][1] * m[2][1];
+			if (!Math::RealEqual(t, 1.0, (Real)1e-04))
+				return true;
+			t = m[0][2] * m[0][2] + m[1][2] * m[1][2] + m[2][2] * m[2][2];
+			if (!Math::RealEqual(t, 1.0, (Real)1e-04))
+				return true;
+
+			return false;
+		}
+
+		/** Determines if this matrix involves a negative scaling. */
+		inline bool hasNegativeScale() const
+		{
+			return determinant() < 0;
+		}
+
+		/** Extracts the rotation / scaling part as a quaternion from the Matrix.
+         */
+        inline Quaternion extractQuaternion() const
+        {
+          Matrix3 m3x3;
+          extract3x3Matrix(m3x3);
+          return Quaternion(m3x3);
+        }
+
+	static const Matrix4 ZERO;
+	static const Matrix4 ZEROAFFINE;
+	static const Matrix4 IDENTITY;
+        /** Useful little matrix which takes 2D clipspace {-1, 1} to {0,1}
+            and inverts the Y. */
+        static const Matrix4 CLIPSPACE2DTOIMAGESPACE;
+
+        inline Matrix4 operator*(Real scalar) const
+        {
+            return Matrix4(
+                scalar*m[0][0], scalar*m[0][1], scalar*m[0][2], scalar*m[0][3],
+                scalar*m[1][0], scalar*m[1][1], scalar*m[1][2], scalar*m[1][3],
+                scalar*m[2][0], scalar*m[2][1], scalar*m[2][2], scalar*m[2][3],
+                scalar*m[3][0], scalar*m[3][1], scalar*m[3][2], scalar*m[3][3]);
+        }
+
+        /** Function for writing to a stream.
+        */
+        inline _OgreExport friend std::ostream& operator <<
+            ( std::ostream& o, const Matrix4& mat )
+        {
+            o << "Matrix4(";
+			for (size_t i = 0; i < 4; ++i)
+            {
+                o << " row" << (unsigned)i << "{";
+                for(size_t j = 0; j < 4; ++j)
+                {
+                    o << mat[i][j] << " ";
+                }
+                o << "}";
+            }
+            o << ")";
+            return o;
+        }
+		
+		Matrix4 adjoint() const;
+		Real determinant() const;
+		Matrix4 inverse() const;
+
+        /** Building a Matrix4 from orientation / scale / position.
+        @remarks
+            Transform is performed in the order scale, rotate, translation, i.e. translation is independent
+            of orientation axes, scale does not affect size of translation, rotation and scaling are always
+            centered on the origin.
+        */
+        void makeTransform(const Vector3& position, const Vector3& scale, const Quaternion& orientation);
+
+        /** Building an inverse Matrix4 from orientation / scale / position.
+        @remarks
+            As makeTransform except it build the inverse given the same data as makeTransform, so
+            performing -translation, -rotate, 1/scale in that order.
+        */
+        void makeInverseTransform(const Vector3& position, const Vector3& scale, const Quaternion& orientation);
+
+        /** Decompose a Matrix4 to orientation / scale / position.
+        */
+        void decomposition(Vector3& position, Vector3& scale, Quaternion& orientation) const;
+
+        /** Check whether or not the matrix is affine matrix.
+            @remarks
+                An affine matrix is a 4x4 matrix with row 3 equal to (0, 0, 0, 1),
+                e.g. no projective coefficients.
+        */
+        inline bool isAffine(void) const
+        {
+            return m[3][0] == 0 && m[3][1] == 0 && m[3][2] == 0 && m[3][3] == 1;
+        }
+
+        /** Returns the inverse of the affine matrix.
+            @note
+                The matrix must be an affine matrix. @see Matrix4::isAffine.
+        */
+        Matrix4 inverseAffine(void) const;
+
+        /** Concatenate two affine matrices.
+            @note
+                The matrices must be affine matrix. @see Matrix4::isAffine.
+        */
+        inline Matrix4 concatenateAffine(const Matrix4 &m2) const
+        {
+            assert(isAffine() && m2.isAffine());
+
+            return Matrix4(
+                m[0][0] * m2.m[0][0] + m[0][1] * m2.m[1][0] + m[0][2] * m2.m[2][0],
+                m[0][0] * m2.m[0][1] + m[0][1] * m2.m[1][1] + m[0][2] * m2.m[2][1],
+                m[0][0] * m2.m[0][2] + m[0][1] * m2.m[1][2] + m[0][2] * m2.m[2][2],
+                m[0][0] * m2.m[0][3] + m[0][1] * m2.m[1][3] + m[0][2] * m2.m[2][3] + m[0][3],
+
+                m[1][0] * m2.m[0][0] + m[1][1] * m2.m[1][0] + m[1][2] * m2.m[2][0],
+                m[1][0] * m2.m[0][1] + m[1][1] * m2.m[1][1] + m[1][2] * m2.m[2][1],
+                m[1][0] * m2.m[0][2] + m[1][1] * m2.m[1][2] + m[1][2] * m2.m[2][2],
+                m[1][0] * m2.m[0][3] + m[1][1] * m2.m[1][3] + m[1][2] * m2.m[2][3] + m[1][3],
+
+                m[2][0] * m2.m[0][0] + m[2][1] * m2.m[1][0] + m[2][2] * m2.m[2][0],
+                m[2][0] * m2.m[0][1] + m[2][1] * m2.m[1][1] + m[2][2] * m2.m[2][1],
+                m[2][0] * m2.m[0][2] + m[2][1] * m2.m[1][2] + m[2][2] * m2.m[2][2],
+                m[2][0] * m2.m[0][3] + m[2][1] * m2.m[1][3] + m[2][2] * m2.m[2][3] + m[2][3],
+
+                0, 0, 0, 1);
+        }
+
+        /** 3-D Vector transformation specially for an affine matrix.
+            @remarks
+                Transforms the given 3-D vector by the matrix, projecting the 
+                result back into <i>w</i> = 1.
+            @note
+                The matrix must be an affine matrix. @see Matrix4::isAffine.
+        */
+        inline Vector3 transformAffine(const Vector3& v) const
+        {
+            assert(isAffine());
+
+            return Vector3(
+                    m[0][0] * v.x + m[0][1] * v.y + m[0][2] * v.z + m[0][3], 
+                    m[1][0] * v.x + m[1][1] * v.y + m[1][2] * v.z + m[1][3],
+                    m[2][0] * v.x + m[2][1] * v.y + m[2][2] * v.z + m[2][3]);
+        }
+
+        /** 4-D Vector transformation specially for an affine matrix.
+            @note
+                The matrix must be an affine matrix. @see Matrix4::isAffine.
+        */
+        inline Vector4 transformAffine(const Vector4& v) const
+        {
+            assert(isAffine());
+
+            return Vector4(
+                m[0][0] * v.x + m[0][1] * v.y + m[0][2] * v.z + m[0][3] * v.w, 
+                m[1][0] * v.x + m[1][1] * v.y + m[1][2] * v.z + m[1][3] * v.w,
+                m[2][0] * v.x + m[2][1] * v.y + m[2][2] * v.z + m[2][3] * v.w,
+                v.w);
+        }
+    };
+
+    /* Removed from Vector4 and made a non-member here because otherwise
+       OgreMatrix4.h and OgreVector4.h have to try to include and inline each 
+       other, which frankly doesn't work ;)
+   */
+    inline Vector4 operator * (const Vector4& v, const Matrix4& mat)
+    {
+        return Vector4(
+            v.x*mat[0][0] + v.y*mat[1][0] + v.z*mat[2][0] + v.w*mat[3][0],
+            v.x*mat[0][1] + v.y*mat[1][1] + v.z*mat[2][1] + v.w*mat[3][1],
+            v.x*mat[0][2] + v.y*mat[1][2] + v.z*mat[2][2] + v.w*mat[3][2],
+            v.x*mat[0][3] + v.y*mat[1][3] + v.z*mat[2][3] + v.w*mat[3][3]
+            );
+    }
+	/** @} */
+	/** @} */
+
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreMemoryAllocatedObject.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreMemoryAllocatedObject.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreMemoryAllocatedObject.h	(revision 148)
@@ -0,0 +1,133 @@
+/*
+-----------------------------------------------------------------------------
+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 __AllocatedObject_H__
+#define __AllocatedObject_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreHeaderPrefix.h"
+
+// Anything that has done a #define new <blah> will screw operator new definitions up
+// so undefine
+#ifdef new
+#  undef new
+#endif
+#ifdef delete
+#  undef delete
+#endif
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Memory
+	*  @{
+	*/
+	/** Superclass for all objects that wish to use custom memory allocators
+		when their new / delete operators are called.
+		Requires a template parameter identifying the memory allocator policy 
+		to use (e.g. see StdAllocPolicy). 
+	*/
+	template <class Alloc>
+	class _OgreExport AllocatedObject
+	{
+	public:
+		explicit AllocatedObject()
+		{ }
+
+		~AllocatedObject()
+		{ }
+
+		/// operator new, with debug line info
+		void* operator new(size_t sz, const char* file, int line, const char* func)
+		{
+			return Alloc::allocateBytes(sz, file, line, func);
+		}
+
+		void* operator new(size_t sz)
+		{
+			return Alloc::allocateBytes(sz);
+		}
+
+		/// placement operator new
+		void* operator new(size_t sz, void* ptr)
+		{
+			(void) sz;
+			return ptr;
+		}
+
+		/// array operator new, with debug line info
+		void* operator new[] ( size_t sz, const char* file, int line, const char* func )
+		{
+			return Alloc::allocateBytes(sz, file, line, func);
+		}
+
+		void* operator new[] ( size_t sz )
+		{
+			return Alloc::allocateBytes(sz);
+		}
+
+		void operator delete( void* ptr )
+		{
+			Alloc::deallocateBytes(ptr);
+		}
+
+		// Corresponding operator for placement delete (second param same as the first)
+		void operator delete( void* ptr, void* )
+		{
+			Alloc::deallocateBytes(ptr);
+		}
+
+		// only called if there is an exception in corresponding 'new'
+		void operator delete( void* ptr, const char* , int , const char*  )
+		{
+			Alloc::deallocateBytes(ptr);
+		}
+
+		void operator delete[] ( void* ptr )
+		{
+			Alloc::deallocateBytes(ptr);
+		}
+
+
+		void operator delete[] ( void* ptr, const char* , int , const char*  )
+		{
+			Alloc::deallocateBytes(ptr);
+		}
+	};
+
+
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreMemoryAllocatorConfig.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreMemoryAllocatorConfig.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreMemoryAllocatorConfig.h	(revision 148)
@@ -0,0 +1,498 @@
+/*
+-----------------------------------------------------------------------------
+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 __MemoryAllocatorConfig_H__
+#define __MemoryAllocatorConfig_H__
+
+#include "OgreMemoryAllocatedObject.h" 
+#include "OgreHeaderPrefix.h"
+
+/** \addtogroup Core
+*  @{
+*/
+/** \addtogroup Memory
+*  @{
+*/
+/** @file
+
+	This file configures Ogre's memory allocators. You can modify this
+	file to alter the allocation routines used for Ogre's main objects.
+
+	When customising memory allocation, all you need to do is provide one or
+	more custom allocation policy classes. These classes need to implement:
+
+	@code
+	// Allocate bytes - file/line/func information should be optional, 
+	// will be provided when available but not everywhere (e.g. release mode, STL allocations)
+	static inline void* allocateBytes(size_t count, const char* file = 0, int line = 0, const char* func = 0);
+	// Free bytes
+	static inline void deallocateBytes(void* ptr);
+	// Return the max number of bytes available to be allocated in a single allocation
+	static inline size_t getMaxAllocationSize();
+	@endcode
+
+	Policies are then used as implementations for the wrapper classes and macros 
+	which call them. AllocatedObject for example provides the hooks to override
+	the new and delete operators for a class and redirect the functionality to the
+	policy. STLAllocator is a class which is provided to STL containers in order
+	to hook up allocation of the containers members to the allocation policy.
+	@par
+	In addition to linking allocations to policies, this class also defines
+	a number of macros to allow debugging information to be passed along with
+	allocations, such as the file and line number they originate from. It's
+	important to realise that we do not redefine the 'new' and 'delete' symbols 
+	with macros, because that's very difficult to consistently do when other
+	libraries are also trying to do the same thing; instead we use dedicated
+	'OGRE_' prefixed macros. See OGRE_NEW and related items.
+	@par
+	The base macros you can use are listed below, in order of preference and 
+	with their conditions stated:
+	<ul>
+	<li>OGRE_NEW - use to allocate an object which have custom new/delete operators
+		to handle custom allocations, usually this means it's derived from Ogre::AllocatedObject. 
+		Free the memory using OGRE_DELETE. You can in fact use the regular new/delete
+		for these classes but you won't get any line number debugging if you do.
+		The memory category is automatically derived for these classes; for all other
+		allocations you have to specify it.
+	</li>
+	<li>OGRE_NEW_T - use to allocate a single class / struct that does not have custom
+		new/delete operators, either because it is non-virtual (Vector3, Quaternion),
+		or because it is from an external library (e.g. STL). You must
+		deallocate with OGRE_DELETE_T if you expect the destructor to be called. 
+		You may free the memory using OGRE_FREE if you are absolutely sure there
+		is no destructor to be called. 
+		These macros ensure that constructors and destructors are called correctly 
+		even though the memory originates externally (via placement new). Also note 
+		that you have to specify the type and memory category so that the correct 
+		allocator can be derived, when both allocating
+		and freeing.
+	</li>
+	<li>OGRE_NEW_ARRAY_T - as OGRE_NEW_T except with an extra parameter to construct
+		multiple instances in contiguous memory. Again constructors and destructors
+		are called. Free with OGRE_DELETE_ARRAY_T.
+	</li>
+	<li>OGRE_ALLOC_T - use to allocate a set of primitive types conveniently with type safety. 
+	This <i>can</i> also be used for classes and structs but it is <b>imperative</b> that
+	you understand that neither the constructor nor the destructor will be called. 
+	Sometimes you want this because it's more efficient just to grab/free a chunk of
+	memory without having to iterate over each element constructing / destructing.
+	Free the memory with OGRE_FREE. </li>
+	<li>OGRE_MALLOC - the most raw form of allocation, just a set of bytes. 
+		Use OGRE_FREE to release.</li>
+	<li>_SIMD and _ALIGN variants - all of the above have variations which allow
+		aligned memory allocations. The _SIMD versions align automatically to the
+		SIMD requirements of your platform, the _ALIGN variants allow user-defined
+		alignment to be specified. </li>
+	</ul>
+	Here are some examples:
+	@code
+	/// AllocatedObject subclass, with custom operator new / delete
+	AllocatedClass* obj = OGRE_NEW AllocatedClass();
+	OGRE_DELETE obj;
+	AllocatedClass* array = OGRE_NEW AllocatedClass[10];
+	OGRE_DELETE [] obj;
+	/// Non-virtual or external class, constructors / destructors called
+	ExternalClass* obj = OGRE_NEW_T(ExternalClass, MEMCATEGORY_GENERAL)(constructorArgs);
+	OGRE_DELETE_T(obj, ExternalClass, MEMCATEGORY_GENERAL);
+	ExternalClass* obj = OGRE_NEW_ARRAY_T(ExternalClass, 10, MEMCATEGORY_GENERAL);
+	OGRE_DELETE_ARRAY_T(obj, NonVirtualClass, 10, MEMCATEGORY_GENERAL);
+	/// Primitive types
+	long* pLong = OGRE_ALLOC_T(long, 10, MEMCATEGORY_GENERAL);
+	OGRE_FREE(pLong, MEMCATEGORY_GENERAL);
+	/// Primitive type with constructor (you can mismatch OGRE_NEW_T and OGRE_FREE because no destructor)
+	long* pLong = OGRE_NEW_T(long, MEMCATEGORY_GENERAL)(0);
+	OGRE_FREE(pLong, MEMCATEGORY_GENERAL);
+	/// Raw memory
+	void* pVoid = OGRE_MALLOC(1024, MEMCATEGORY_GENERAL);
+	OGRE_FREE(pVoid, MEMCATEGORY_GENERAL);
+	@endcode
+	OGRE_ALLOC_T is also the route to go for allocating real primitive types like 
+	int & float. You free the memory using OGRE_FREE, and both variants have SIMD
+	and custom alignment variants.
+*/
+/** @} */
+/** @} */
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Memory
+	*  @{
+	*/
+
+	/** A set of categories that indicate the purpose of a chunk of memory
+	being allocated. 
+	These categories will be provided at allocation time in order to allow
+	the allocation policy to vary its behaviour if it wishes. This allows you
+	to use a single policy but still have variant behaviour. The level of 
+	control it gives you is at a higher level than assigning different 
+	policies to different classes, but is the only control you have over
+	general allocations that are primitive types.
+	*/
+	enum MemoryCategory
+	{
+		/// General purpose
+		MEMCATEGORY_GENERAL = 0,
+		/// Geometry held in main memory
+		MEMCATEGORY_GEOMETRY = 1, 
+		/// Animation data like tracks, bone matrices
+		MEMCATEGORY_ANIMATION = 2, 
+		/// Nodes, control data
+		MEMCATEGORY_SCENE_CONTROL = 3,
+		/// Scene object instances
+		MEMCATEGORY_SCENE_OBJECTS = 4,
+		/// Other resources
+		MEMCATEGORY_RESOURCE = 5,
+		/// Scripting
+		MEMCATEGORY_SCRIPTING = 6,
+		/// Rendersystem structures
+		MEMCATEGORY_RENDERSYS = 7,
+
+		
+		// sentinel value, do not use 
+		MEMCATEGORY_COUNT = 8
+	};
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreMemoryAllocatedObject.h"
+#include "OgreMemorySTLAllocator.h"
+
+#if OGRE_MEMORY_ALLOCATOR == OGRE_MEMORY_ALLOCATOR_NEDPOOLING
+
+#  include "OgreMemoryNedPooling.h"
+namespace Ogre
+{
+	// configure default allocators based on the options above
+	// notice how we're not using the memory categories here but still roughing them out
+	// in your allocators you might choose to create different policies per category
+
+	// configurable category, for general malloc
+	// notice how we ignore the category here, you could specialise
+	template <MemoryCategory Cat> class CategorisedAllocPolicy : public NedPoolingPolicy{};
+	template <MemoryCategory Cat, size_t align = 0> class CategorisedAlignAllocPolicy : public NedPoolingAlignedPolicy<align>{};
+}
+
+#elif OGRE_MEMORY_ALLOCATOR == OGRE_MEMORY_ALLOCATOR_NED
+
+#  include "OgreMemoryNedAlloc.h"
+namespace Ogre
+{
+	// configure default allocators based on the options above
+	// notice how we're not using the memory categories here but still roughing them out
+	// in your allocators you might choose to create different policies per category
+
+	// configurable category, for general malloc
+	// notice how we ignore the category here, you could specialise
+	template <MemoryCategory Cat> class CategorisedAllocPolicy : public NedAllocPolicy{};
+	template <MemoryCategory Cat, size_t align = 0> class CategorisedAlignAllocPolicy : public NedAlignedAllocPolicy<align>{};
+}
+
+#elif OGRE_MEMORY_ALLOCATOR == OGRE_MEMORY_ALLOCATOR_STD
+
+#  include "OgreMemoryStdAlloc.h"
+namespace Ogre
+{
+	// configure default allocators based on the options above
+	// notice how we're not using the memory categories here but still roughing them out
+	// in your allocators you might choose to create different policies per category
+
+	// configurable category, for general malloc
+	// notice how we ignore the category here
+	template <MemoryCategory Cat> class CategorisedAllocPolicy : public StdAllocPolicy{};
+	template <MemoryCategory Cat, size_t align = 0> class CategorisedAlignAllocPolicy : public StdAlignedAllocPolicy<align>{};
+
+	// if you wanted to specialise the allocation per category, here's how it might work:
+	// template <> class CategorisedAllocPolicy<MEMCATEGORY_SCENE_OBJECTS> : public YourSceneObjectAllocPolicy{};
+	// template <size_t align> class CategorisedAlignAllocPolicy<MEMCATEGORY_SCENE_OBJECTS, align> : public YourSceneObjectAllocPolicy<align>{};
+	
+	
+}
+
+#else
+	
+// your allocators here?
+
+#endif
+
+namespace Ogre
+{
+	// Useful shortcuts
+	typedef CategorisedAllocPolicy<Ogre::MEMCATEGORY_GENERAL> GeneralAllocPolicy;
+	typedef CategorisedAllocPolicy<Ogre::MEMCATEGORY_GEOMETRY> GeometryAllocPolicy;
+	typedef CategorisedAllocPolicy<Ogre::MEMCATEGORY_ANIMATION> AnimationAllocPolicy;
+	typedef CategorisedAllocPolicy<Ogre::MEMCATEGORY_SCENE_CONTROL> SceneCtlAllocPolicy;
+	typedef CategorisedAllocPolicy<Ogre::MEMCATEGORY_SCENE_OBJECTS> SceneObjAllocPolicy;
+	typedef CategorisedAllocPolicy<Ogre::MEMCATEGORY_RESOURCE> ResourceAllocPolicy;
+	typedef CategorisedAllocPolicy<Ogre::MEMCATEGORY_SCRIPTING> ScriptingAllocPolicy;
+	typedef CategorisedAllocPolicy<Ogre::MEMCATEGORY_RENDERSYS> RenderSysAllocPolicy;
+
+	// Now define all the base classes for each allocation
+	typedef AllocatedObject<GeneralAllocPolicy> GeneralAllocatedObject;
+	typedef AllocatedObject<GeometryAllocPolicy> GeometryAllocatedObject;
+	typedef AllocatedObject<AnimationAllocPolicy> AnimationAllocatedObject;
+	typedef AllocatedObject<SceneCtlAllocPolicy> SceneCtlAllocatedObject;
+	typedef AllocatedObject<SceneObjAllocPolicy> SceneObjAllocatedObject;
+	typedef AllocatedObject<ResourceAllocPolicy> ResourceAllocatedObject;
+	typedef AllocatedObject<ScriptingAllocPolicy> ScriptingAllocatedObject;
+	typedef AllocatedObject<RenderSysAllocPolicy> RenderSysAllocatedObject;
+
+
+	// Per-class allocators defined here
+	// NOTE: small, non-virtual classes should not subclass an allocator
+	// the virtual function table could double their size and make them less efficient
+	// use primitive or STL allocators / deallocators for those
+	typedef ScriptingAllocatedObject	AbstractNodeAlloc;
+	typedef AnimationAllocatedObject	AnimableAlloc;
+	typedef AnimationAllocatedObject	AnimationAlloc;
+	typedef GeneralAllocatedObject		ArchiveAlloc;
+	typedef GeometryAllocatedObject		BatchedGeometryAlloc;
+	typedef RenderSysAllocatedObject	BufferAlloc;
+	typedef GeneralAllocatedObject		CodecAlloc;
+	typedef ResourceAllocatedObject		CompositorInstAlloc;
+	typedef GeneralAllocatedObject		ConfigAlloc;
+	typedef GeneralAllocatedObject		ControllerAlloc;
+	typedef GeometryAllocatedObject		DebugGeomAlloc;
+	typedef GeneralAllocatedObject		DynLibAlloc;
+	typedef GeometryAllocatedObject		EdgeDataAlloc;
+	typedef GeneralAllocatedObject		FactoryAlloc;
+	typedef SceneObjAllocatedObject		FXAlloc;
+	typedef GeneralAllocatedObject		ImageAlloc;
+	typedef GeometryAllocatedObject		IndexDataAlloc;
+	typedef GeneralAllocatedObject		LogAlloc;
+	typedef SceneObjAllocatedObject		MovableAlloc;
+	typedef SceneCtlAllocatedObject		NodeAlloc;
+	typedef SceneObjAllocatedObject		OverlayAlloc;
+	typedef RenderSysAllocatedObject	GpuParamsAlloc;
+	typedef ResourceAllocatedObject		PassAlloc;
+	typedef GeometryAllocatedObject		PatchAlloc;
+	typedef GeneralAllocatedObject		PluginAlloc;
+	typedef GeneralAllocatedObject		ProfilerAlloc;
+	typedef GeometryAllocatedObject		ProgMeshAlloc;
+	typedef SceneCtlAllocatedObject		RenderQueueAlloc;
+	typedef RenderSysAllocatedObject	RenderSysAlloc;
+	typedef GeneralAllocatedObject		RootAlloc;
+	typedef ResourceAllocatedObject		ResourceAlloc;
+	typedef GeneralAllocatedObject		SerializerAlloc;
+	typedef SceneCtlAllocatedObject		SceneMgtAlloc;
+	typedef ScriptingAllocatedObject    ScriptCompilerAlloc;
+	typedef ScriptingAllocatedObject    ScriptTranslatorAlloc;
+	typedef SceneCtlAllocatedObject		ShadowDataAlloc;
+	typedef GeneralAllocatedObject		StreamAlloc;
+	typedef SceneObjAllocatedObject		SubEntityAlloc;
+	typedef ResourceAllocatedObject		SubMeshAlloc;
+	typedef ResourceAllocatedObject		TechniqueAlloc;
+	typedef GeneralAllocatedObject		TimerAlloc;
+	typedef ResourceAllocatedObject		TextureUnitStateAlloc;
+	typedef GeneralAllocatedObject		UtilityAlloc;
+	typedef GeometryAllocatedObject		VertexDataAlloc;
+	typedef RenderSysAllocatedObject	ViewportAlloc;
+	typedef SceneCtlAllocatedObject		LodAlloc;
+    typedef GeneralAllocatedObject      FileSystemLayerAlloc;
+
+	// Containers (by-value only)
+	// Will  be of the form:
+	// typedef STLAllocator<T, DefaultAllocPolicy, Category> TAlloc;
+	// for use in vector<T, TAlloc>::type 
+	
+
+
+}
+
+// Util functions
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Memory
+	*  @{
+	*/
+
+	/** Utility function for constructing an array of objects with placement new,
+		without using new[] (which allocates an undocumented amount of extra memory
+		and so isn't appropriate for custom allocators).
+	*/
+	template<typename T>
+	T* constructN(T* basePtr, size_t count)
+	{
+		for (size_t i = 0; i < count; ++i)
+		{
+			new ((void*)(basePtr+i)) T();
+		}
+		return basePtr;
+	}
+	/** @} */
+	/** @} */
+
+}
+// define macros 
+
+/** \addtogroup Core
+*  @{
+*/
+/** \addtogroup Memory
+*  @{
+*/
+
+#if OGRE_DEBUG_MODE
+
+/// Allocate a block of raw memory, and indicate the category of usage
+#	define OGRE_MALLOC(bytes, category) ::Ogre::CategorisedAllocPolicy<category>::allocateBytes(bytes, __FILE__, __LINE__, __FUNCTION__)
+/// Allocate a block of memory for a primitive type, and indicate the category of usage
+#	define OGRE_ALLOC_T(T, count, category) static_cast<T*>(::Ogre::CategorisedAllocPolicy<category>::allocateBytes(sizeof(T)*(count), __FILE__, __LINE__, __FUNCTION__))
+/// Free the memory allocated with OGRE_MALLOC or OGRE_ALLOC_T. Category is required to be restated to ensure the matching policy is used
+#	define OGRE_FREE(ptr, category) ::Ogre::CategorisedAllocPolicy<category>::deallocateBytes((void*)ptr)
+
+/// Allocate space for one primitive type, external type or non-virtual type with constructor parameters
+#	define OGRE_NEW_T(T, category) new (::Ogre::CategorisedAllocPolicy<category>::allocateBytes(sizeof(T), __FILE__, __LINE__, __FUNCTION__)) T
+/// Allocate a block of memory for 'count' primitive types - do not use for classes that inherit from AllocatedObject
+#	define OGRE_NEW_ARRAY_T(T, count, category) ::Ogre::constructN(static_cast<T*>(::Ogre::CategorisedAllocPolicy<category>::allocateBytes(sizeof(T)*(count), __FILE__, __LINE__, __FUNCTION__)), count) 
+/// Free the memory allocated with OGRE_NEW_T. Category is required to be restated to ensure the matching policy is used
+#	define OGRE_DELETE_T(ptr, T, category) if(ptr){(ptr)->~T(); ::Ogre::CategorisedAllocPolicy<category>::deallocateBytes((void*)ptr);}
+/// Free the memory allocated with OGRE_NEW_ARRAY_T. Category is required to be restated to ensure the matching policy is used, count and type to call destructor
+#	define OGRE_DELETE_ARRAY_T(ptr, T, count, category) if(ptr){for (size_t b = 0; b < count; ++b) { (ptr)[b].~T();} ::Ogre::CategorisedAllocPolicy<category>::deallocateBytes((void*)ptr);}
+
+// aligned allocation
+/// Allocate a block of raw memory aligned to SIMD boundaries, and indicate the category of usage
+#	define OGRE_MALLOC_SIMD(bytes, category) ::Ogre::CategorisedAlignAllocPolicy<category>::allocateBytes(bytes, __FILE__, __LINE__, __FUNCTION__)
+/// Allocate a block of raw memory aligned to user defined boundaries, and indicate the category of usage
+#	define OGRE_MALLOC_ALIGN(bytes, category, align) ::Ogre::CategorisedAlignAllocPolicy<category, align>::allocateBytes(bytes, __FILE__, __LINE__, __FUNCTION__)
+/// Allocate a block of memory for a primitive type aligned to SIMD boundaries, and indicate the category of usage
+#	define OGRE_ALLOC_T_SIMD(T, count, category) static_cast<T*>(::Ogre::CategorisedAlignAllocPolicy<category>::allocateBytes(sizeof(T)*(count), __FILE__, __LINE__, __FUNCTION__))
+/// Allocate a block of memory for a primitive type aligned to user defined boundaries, and indicate the category of usage
+#	define OGRE_ALLOC_T_ALIGN(T, count, category, align) static_cast<T*>(::Ogre::CategorisedAlignAllocPolicy<category, align>::allocateBytes(sizeof(T)*(count), __FILE__, __LINE__, __FUNCTION__))
+/// Free the memory allocated with either OGRE_MALLOC_SIMD or OGRE_ALLOC_T_SIMD. Category is required to be restated to ensure the matching policy is used
+#	define OGRE_FREE_SIMD(ptr, category) ::Ogre::CategorisedAlignAllocPolicy<category>::deallocateBytes(ptr)
+/// Free the memory allocated with either OGRE_MALLOC_ALIGN or OGRE_ALLOC_T_ALIGN. Category is required to be restated to ensure the matching policy is used
+#	define OGRE_FREE_ALIGN(ptr, category, align) ::Ogre::CategorisedAlignAllocPolicy<category, align>::deallocateBytes(ptr)
+
+/// Allocate space for one primitive type, external type or non-virtual type aligned to SIMD boundaries
+#	define OGRE_NEW_T_SIMD(T, category) new (::Ogre::CategorisedAlignAllocPolicy<category>::allocateBytes(sizeof(T), __FILE__, __LINE__, __FUNCTION__)) T
+/// Allocate a block of memory for 'count' primitive types aligned to SIMD boundaries - do not use for classes that inherit from AllocatedObject
+#	define OGRE_NEW_ARRAY_T_SIMD(T, count, category) ::Ogre::constructN(static_cast<T*>(::Ogre::CategorisedAlignAllocPolicy<category>::allocateBytes(sizeof(T)*(count), __FILE__, __LINE__, __FUNCTION__)), count) 
+/// Free the memory allocated with OGRE_NEW_T_SIMD. Category is required to be restated to ensure the matching policy is used
+#	define OGRE_DELETE_T_SIMD(ptr, T, category) if(ptr){(ptr)->~T(); ::Ogre::CategorisedAlignAllocPolicy<category>::deallocateBytes(ptr);}
+/// Free the memory allocated with OGRE_NEW_ARRAY_T_SIMD. Category is required to be restated to ensure the matching policy is used, count and type to call destructor
+#	define OGRE_DELETE_ARRAY_T_SIMD(ptr, T, count, category) if(ptr){for (size_t b = 0; b < count; ++b) { (ptr)[b].~T();} ::Ogre::CategorisedAlignAllocPolicy<category>::deallocateBytes(ptr);}
+/// Allocate space for one primitive type, external type or non-virtual type aligned to user defined boundaries
+#	define OGRE_NEW_T_ALIGN(T, category, align) new (::Ogre::CategorisedAlignAllocPolicy<category, align>::allocateBytes(sizeof(T), __FILE__, __LINE__, __FUNCTION__)) T
+/// Allocate a block of memory for 'count' primitive types aligned to user defined boundaries - do not use for classes that inherit from AllocatedObject
+#	define OGRE_NEW_ARRAY_T_ALIGN(T, count, category, align) ::Ogre::constructN(static_cast<T*>(::Ogre::CategorisedAlignAllocPolicy<category, align>::allocateBytes(sizeof(T)*(count), __FILE__, __LINE__, __FUNCTION__)), count) 
+/// Free the memory allocated with OGRE_NEW_T_ALIGN. Category is required to be restated to ensure the matching policy is used
+#	define OGRE_DELETE_T_ALIGN(ptr, T, category, align) if(ptr){(ptr)->~T(); ::Ogre::CategorisedAlignAllocPolicy<category, align>::deallocateBytes(ptr);}
+/// Free the memory allocated with OGRE_NEW_ARRAY_T_ALIGN. Category is required to be restated to ensure the matching policy is used, count and type to call destructor
+#	define OGRE_DELETE_ARRAY_T_ALIGN(ptr, T, count, category, align) if(ptr){for (size_t _b = 0; _b < count; ++_b) { (ptr)[_b].~T();} ::Ogre::CategorisedAlignAllocPolicy<category, align>::deallocateBytes(ptr);}
+
+// new / delete for classes deriving from AllocatedObject (alignment determined by per-class policy)
+// Also hooks up the file/line/function params
+// Can only be used with classes that derive from AllocatedObject since customised new/delete needed
+#	define OGRE_NEW new (__FILE__, __LINE__, __FUNCTION__)
+#	define OGRE_DELETE delete
+
+
+#else // !OGRE_DEBUG_MODE
+
+/// Allocate a block of raw memory, and indicate the category of usage
+#	define OGRE_MALLOC(bytes, category) ::Ogre::CategorisedAllocPolicy<category>::allocateBytes(bytes)
+/// Allocate a block of memory for a primitive type, and indicate the category of usage
+#	define OGRE_ALLOC_T(T, count, category) static_cast<T*>(::Ogre::CategorisedAllocPolicy<category>::allocateBytes(sizeof(T)*(count)))
+/// Free the memory allocated with OGRE_MALLOC or OGRE_ALLOC_T. Category is required to be restated to ensure the matching policy is used
+#	define OGRE_FREE(ptr, category) ::Ogre::CategorisedAllocPolicy<category>::deallocateBytes((void*)ptr)
+
+/// Allocate space for one primitive type, external type or non-virtual type with constructor parameters
+#	define OGRE_NEW_T(T, category) new (::Ogre::CategorisedAllocPolicy<category>::allocateBytes(sizeof(T))) T
+/// Allocate a block of memory for 'count' primitive types - do not use for classes that inherit from AllocatedObject
+#	define OGRE_NEW_ARRAY_T(T, count, category) ::Ogre::constructN(static_cast<T*>(::Ogre::CategorisedAllocPolicy<category>::allocateBytes(sizeof(T)*(count))), count) 
+/// Free the memory allocated with OGRE_NEW_T. Category is required to be restated to ensure the matching policy is used
+#	define OGRE_DELETE_T(ptr, T, category) if(ptr){(ptr)->~T(); ::Ogre::CategorisedAllocPolicy<category>::deallocateBytes((void*)ptr);}
+/// Free the memory allocated with OGRE_NEW_ARRAY_T. Category is required to be restated to ensure the matching policy is used, count and type to call destructor
+#	define OGRE_DELETE_ARRAY_T(ptr, T, count, category) if(ptr){for (size_t b = 0; b < count; ++b) { (ptr)[b].~T();} ::Ogre::CategorisedAllocPolicy<category>::deallocateBytes((void*)ptr);}
+
+// aligned allocation
+/// Allocate a block of raw memory aligned to SIMD boundaries, and indicate the category of usage
+#	define OGRE_MALLOC_SIMD(bytes, category) ::Ogre::CategorisedAlignAllocPolicy<category>::allocateBytes(bytes)
+/// Allocate a block of raw memory aligned to user defined boundaries, and indicate the category of usage
+#	define OGRE_MALLOC_ALIGN(bytes, category, align) ::Ogre::CategorisedAlignAllocPolicy<category, align>::allocateBytes(bytes)
+/// Allocate a block of memory for a primitive type aligned to SIMD boundaries, and indicate the category of usage
+#	define OGRE_ALLOC_T_SIMD(T, count, category) static_cast<T*>(::Ogre::CategorisedAlignAllocPolicy<category>::allocateBytes(sizeof(T)*(count)))
+/// Allocate a block of memory for a primitive type aligned to user defined boundaries, and indicate the category of usage
+#	define OGRE_ALLOC_T_ALIGN(T, count, category, align) static_cast<T*>(::Ogre::CategorisedAlignAllocPolicy<category, align>::allocateBytes(sizeof(T)*(count)))
+/// Free the memory allocated with either OGRE_MALLOC_SIMD or OGRE_ALLOC_T_SIMD. Category is required to be restated to ensure the matching policy is used
+#	define OGRE_FREE_SIMD(ptr, category) ::Ogre::CategorisedAlignAllocPolicy<category>::deallocateBytes((void*)ptr)
+/// Free the memory allocated with either OGRE_MALLOC_ALIGN or OGRE_ALLOC_T_ALIGN. Category is required to be restated to ensure the matching policy is used
+#	define OGRE_FREE_ALIGN(ptr, category, align) ::Ogre::CategorisedAlignAllocPolicy<category, align>::deallocateBytes((void*)ptr)
+
+/// Allocate space for one primitive type, external type or non-virtual type aligned to SIMD boundaries
+#	define OGRE_NEW_T_SIMD(T, category) new (::Ogre::CategorisedAlignAllocPolicy<category>::allocateBytes(sizeof(T))) T
+/// Allocate a block of memory for 'count' primitive types aligned to SIMD boundaries - do not use for classes that inherit from AllocatedObject
+#	define OGRE_NEW_ARRAY_T_SIMD(T, count, category) ::Ogre::constructN(static_cast<T*>(::Ogre::CategorisedAlignAllocPolicy<category>::allocateBytes(sizeof(T)*(count))), count) 
+/// Free the memory allocated with OGRE_NEW_T_SIMD. Category is required to be restated to ensure the matching policy is used
+#	define OGRE_DELETE_T_SIMD(ptr, T, category) if(ptr){(ptr)->~T(); ::Ogre::CategorisedAlignAllocPolicy<category>::deallocateBytes((void*)ptr);}
+/// Free the memory allocated with OGRE_NEW_ARRAY_T_SIMD. Category is required to be restated to ensure the matching policy is used, count and type to call destructor
+#	define OGRE_DELETE_ARRAY_T_SIMD(ptr, T, count, category) if(ptr){for (size_t b = 0; b < count; ++b) { (ptr)[b].~T();} ::Ogre::CategorisedAlignAllocPolicy<category>::deallocateBytes((void*)ptr);}
+/// Allocate space for one primitive type, external type or non-virtual type aligned to user defined boundaries
+#	define OGRE_NEW_T_ALIGN(T, category, align) new (::Ogre::CategorisedAlignAllocPolicy<category, align>::allocateBytes(sizeof(T))) T
+/// Allocate a block of memory for 'count' primitive types aligned to user defined boundaries - do not use for classes that inherit from AllocatedObject
+#	define OGRE_NEW_ARRAY_T_ALIGN(T, count, category, align) ::Ogre::constructN(static_cast<T*>(::Ogre::CategorisedAlignAllocPolicy<category, align>::allocateBytes(sizeof(T)*(count))), count) 
+/// Free the memory allocated with OGRE_NEW_T_ALIGN. Category is required to be restated to ensure the matching policy is used
+#	define OGRE_DELETE_T_ALIGN(ptr, T, category, align) if(ptr){(ptr)->~T(); ::Ogre::CategorisedAlignAllocPolicy<category, align>::deallocateBytes((void*)ptr);}
+/// Free the memory allocated with OGRE_NEW_ARRAY_T_ALIGN. Category is required to be restated to ensure the matching policy is used, count and type to call destructor
+#	define OGRE_DELETE_ARRAY_T_ALIGN(ptr, T, count, category, align) if(ptr){for (size_t _b = 0; _b < count; ++_b) { (ptr)[_b].~T();} ::Ogre::CategorisedAlignAllocPolicy<category, align>::deallocateBytes((void*)ptr);}
+
+// new / delete for classes deriving from AllocatedObject (alignment determined by per-class policy)
+#	define OGRE_NEW new 
+#	define OGRE_DELETE delete
+
+#endif // OGRE_DEBUG_MODE
+
+
+namespace Ogre
+{
+	/** Function which invokes OGRE_DELETE on a given pointer. 
+	@remarks
+		Useful to pass custom deletion policies to external libraries (e. g. boost).
+	*/
+	template<typename T>
+	void deletePtr(T* ptr)
+	{
+		OGRE_DELETE ptr;
+	}
+}
+
+/** @} */
+/** @} */
+
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreMemoryNedAlloc.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreMemoryNedAlloc.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreMemoryNedAlloc.h	(revision 148)
@@ -0,0 +1,144 @@
+/*
+-----------------------------------------------------------------------------
+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 __MemoryNedAlloc_H__
+#define __MemoryNedAlloc_H__
+
+#if OGRE_MEMORY_ALLOCATOR == OGRE_MEMORY_ALLOCATOR_NED
+
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Memory
+	*  @{
+	*/
+	/** Non-templated utility class just to hide nedmalloc.
+	*/
+	class _OgreExport NedAllocImpl
+	{
+	public:
+		static void* allocBytes(size_t count, 
+			const char* file, int line, const char* func);
+		static void deallocBytes(void* ptr);
+		static void* allocBytesAligned(size_t align, size_t count, 
+			const char* file, int line, const char* func);
+		static void deallocBytesAligned(size_t align, void* ptr);
+
+	};
+
+	/**	An allocation policy for use with AllocatedObject and 
+	STLAllocator. This is the class that actually does the allocation
+	and deallocation of physical memory, and is what you will want to 
+	provide a custom version of if you wish to change how memory is allocated.
+	@par
+	This allocation policy uses nedmalloc 
+		(http://nedprod.com/programs/portable/nedmalloc/index.html). 
+	*/
+	class _OgreExport NedAllocPolicy
+	{
+	public:
+		static inline void* allocateBytes(size_t count, 
+			const char* file = 0, int line = 0, const char* func = 0)
+		{
+			return NedAllocImpl::allocBytes(count, file, line, func);
+		}
+		static inline void deallocateBytes(void* ptr)
+		{
+			NedAllocImpl::deallocBytes(ptr);
+		}
+		/// Get the maximum size of a single allocation
+		static inline size_t getMaxAllocationSize()
+		{
+			return std::numeric_limits<size_t>::max();
+		}
+	private:
+		// No instantiation
+		NedAllocPolicy()
+		{ }
+	};
+
+
+	/**	An allocation policy for use with AllocatedObject and 
+	STLAllocator, which aligns memory at a given boundary (which should be
+	a power of 2). This is the class that actually does the allocation
+	and deallocation of physical memory, and is what you will want to 
+	provide a custom version of if you wish to change how memory is allocated.
+	@par
+	This allocation policy uses nedmalloc 
+		(http://nedprod.com/programs/portable/nedmalloc/index.html). 
+	@note
+		template parameter Alignment equal to zero means use default
+		platform dependent alignment.
+	*/
+	template <size_t Alignment = 0>
+	class NedAlignedAllocPolicy
+	{
+	public:
+		// compile-time check alignment is available.
+		typedef int IsValidAlignment
+			[Alignment <= 128 && ((Alignment & (Alignment-1)) == 0) ? +1 : -1];
+
+		static inline void* allocateBytes(size_t count, 
+			const char* file = 0, int line = 0, const char* func = 0)
+		{
+			return NedAllocImpl::allocBytesAligned(Alignment, count, file, line, func);
+		}
+
+		static inline void deallocateBytes(void* ptr)
+		{
+			NedAllocImpl::deallocBytesAligned(Alignment, ptr);
+		}
+
+		/// Get the maximum size of a single allocation
+		static inline size_t getMaxAllocationSize()
+		{
+			return std::numeric_limits<size_t>::max();
+		}
+	private:
+		// no instantiation allowed
+		NedAlignedAllocPolicy()
+		{ }
+	};
+
+
+
+	/** @} */
+	/** @} */
+
+}// namespace Ogre
+
+#endif 
+
+#include "OgreHeaderSuffix.h"
+
+#endif // __MemoryNedAlloc_H__
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreMemoryNedPooling.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreMemoryNedPooling.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreMemoryNedPooling.h	(revision 148)
@@ -0,0 +1,147 @@
+/*
+-----------------------------------------------------------------------------
+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 __MemoryNedPooling_H__
+#define __MemoryNedPooling_H__
+
+#if OGRE_MEMORY_ALLOCATOR == OGRE_MEMORY_ALLOCATOR_NEDPOOLING
+
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Memory
+	*  @{
+	*/
+	/** Non-templated utility class just to hide nedmalloc.
+	*/
+	class _OgreExport NedPoolingImpl
+	{
+	public:
+		static void* allocBytes(size_t count, 
+			const char* file, int line, const char* func);
+		static void deallocBytes(void* ptr);
+		static void* allocBytesAligned(size_t align, size_t count, 
+			const char* file, int line, const char* func);
+		static void deallocBytesAligned(size_t align, void* ptr);
+
+	};
+
+	/**	An allocation policy for use with AllocatedObject and 
+	STLAllocator. This is the class that actually does the allocation
+	and deallocation of physical memory, and is what you will want to 
+	provide a custom version of if you wish to change how memory is allocated.
+	@par
+	This allocation policy uses nedmalloc 
+		(http://nedprod.com/programs/portable/nedmalloc/index.html). 
+	*/
+	class _OgreExport NedPoolingPolicy
+	{
+	public:
+		static inline void* allocateBytes(size_t count, 
+			const char* file = 0, int line = 0, const char* func = 0)
+		{
+			return NedPoolingImpl::allocBytes(count, file, line, func);
+		}
+		static inline void deallocateBytes(void* ptr)
+		{
+			NedPoolingImpl::deallocBytes(ptr);
+		}
+		/// Get the maximum size of a single allocation
+		static inline size_t getMaxAllocationSize()
+		{
+			return std::numeric_limits<size_t>::max();
+		}
+
+	private:
+		// No instantiation
+		NedPoolingPolicy()
+		{ }
+	};
+
+
+	/**	An allocation policy for use with AllocatedObject and 
+	STLAllocator, which aligns memory at a given boundary (which should be
+	a power of 2). This is the class that actually does the allocation
+	and deallocation of physical memory, and is what you will want to 
+	provide a custom version of if you wish to change how memory is allocated.
+	@par
+	This allocation policy uses nedmalloc 
+		(http://nedprod.com/programs/portable/nedmalloc/index.html). 
+	@note
+		template parameter Alignment equal to zero means use default
+		platform dependent alignment.
+	*/
+	template <size_t Alignment = 0>
+	class NedPoolingAlignedPolicy
+	{
+	public:
+		// compile-time check alignment is available.
+		typedef int IsValidAlignment
+			[Alignment <= 128 && ((Alignment & (Alignment-1)) == 0) ? +1 : -1];
+
+		static inline void* allocateBytes(size_t count, 
+			const char* file = 0, int line = 0, const char* func = 0)
+		{
+			return NedPoolingImpl::allocBytesAligned(Alignment, count, file, line, func);
+		}
+
+		static inline void deallocateBytes(void* ptr)
+		{
+			NedPoolingImpl::deallocBytesAligned(Alignment, ptr);
+		}
+
+		/// Get the maximum size of a single allocation
+		static inline size_t getMaxAllocationSize()
+		{
+			return std::numeric_limits<size_t>::max();
+		}
+	private:
+		// no instantiation allowed
+		NedPoolingAlignedPolicy()
+		{ }
+	};
+
+
+
+
+	/** @} */
+	/** @} */
+
+}// namespace Ogre
+
+#endif 
+
+#include "OgreHeaderSuffix.h"
+
+#endif // __MemoryNedPooling_H__
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreMemorySTLAllocator.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreMemorySTLAllocator.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreMemorySTLAllocator.h	(revision 148)
@@ -0,0 +1,228 @@
+/*
+-----------------------------------------------------------------------------
+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 _MemorySTLAllocator_H__
+#define _MemorySTLAllocator_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre
+{
+
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Memory
+	*  @{
+	*/
+	/**
+	Wrapper class for operating as an STL container allocator.
+	This class acts as the host for a configured allocation policy.
+
+	It takes the following template parameters:-
+	<ul>
+	<li>T			: the type we will be allocating (see rebind later)</li>
+	<li>AllocPolicy : a memory allocator policy </li>
+	</ul>
+
+	See StdAllocPolicy for an example of implementing a Policy. The reason for
+	implementing the allocation in a policy is that it makes implementing
+	a custom allocator easier -  you just have to provide an alternative
+	policy with just allocate/deallocate implementations; this class does all the
+	housekeeping associated with keeping the STL happy.
+	*/
+
+	// Base STL allocator class.
+	template<typename T>
+	struct STLAllocatorBase
+	{	// base class for generic allocators
+		typedef T value_type;
+	};
+
+	// Base STL allocator class. (const T version).
+	template<typename T>
+	struct STLAllocatorBase<const T>
+	{	// base class for generic allocators for const T
+		typedef T value_type;
+	};
+
+	template
+		<
+		typename T,
+		typename AllocPolicy
+		>
+	class STLAllocator : public STLAllocatorBase<T>
+	{
+	public :
+		/// define our types, as per ISO C++
+		typedef STLAllocatorBase<T>			Base;
+		typedef typename Base::value_type	value_type;
+		typedef value_type*					pointer;
+		typedef const value_type*			const_pointer;
+		typedef value_type&					reference;
+		typedef const value_type&			const_reference;
+		typedef std::size_t					size_type;
+		typedef std::ptrdiff_t				difference_type;
+
+
+		/// the standard rebind mechanism
+		template<typename U>
+		struct rebind
+		{
+			typedef STLAllocator<U, AllocPolicy> other;
+		};
+
+		/// ctor
+		inline explicit STLAllocator()
+		{ }
+
+		/// dtor
+		virtual ~STLAllocator()
+		{ }
+
+		/// copy ctor - done component wise
+		inline STLAllocator( STLAllocator const& )
+		{ }
+
+		/// cast
+		template <typename U>
+		inline STLAllocator( STLAllocator<U, AllocPolicy> const& )
+		{ }
+
+		/// cast
+		template <typename U, typename P>
+		inline STLAllocator( STLAllocator<U, P> const& )
+		{ }
+
+		/// memory allocation (elements, used by STL)
+		inline pointer allocate( size_type count,
+			typename std::allocator<void>::const_pointer ptr = 0 )
+		{
+                        (void)ptr;
+			// convert request to bytes
+			register size_type sz = count*sizeof( T );
+			pointer p  = static_cast<pointer>(AllocPolicy::allocateBytes(sz));
+			return p;
+		}
+
+		/// memory deallocation (elements, used by STL)
+		inline void deallocate( pointer ptr, size_type )
+		{
+			// convert request to bytes, but we can't use this?
+			// register size_type sz = count*sizeof( T );
+			AllocPolicy::deallocateBytes(ptr);
+		}
+
+		pointer address(reference x) const
+		{
+			return &x;
+		}
+
+		const_pointer address(const_reference x) const
+		{
+			return &x;
+		}
+
+		size_type max_size() const throw()
+		{
+			// maximum size this can handle, delegate
+			return AllocPolicy::getMaxAllocationSize();
+		}
+
+#if __cplusplus < 201103L
+		void construct(pointer p)
+		{
+			// call placement new
+			new(static_cast<void*>(p)) T();
+		}
+#endif
+
+		void construct(pointer p, const T& val)
+		{
+			// call placement new
+			new(static_cast<void*>(p)) T(val);
+		}
+
+		void destroy(pointer p)
+		{
+			// do we have to protect against non-classes here?
+			// some articles suggest yes, some no
+			p->~T();
+		}
+	};
+
+	/// determine equality, can memory from another allocator
+	/// be released by this allocator, (ISO C++)
+	template<typename T, typename T2, typename P>
+	inline bool operator==(STLAllocator<T,P> const&,
+		STLAllocator<T2,P> const&)
+	{
+		// same alloc policy (P), memory can be freed
+		return true;
+	}
+
+	/// determine equality, can memory from another allocator
+	/// be released by this allocator, (ISO C++)
+	template<typename T, typename P, typename OtherAllocator>
+	inline bool operator==(STLAllocator<T,P> const&,
+		OtherAllocator const&)
+	{
+		return false;
+	}
+	/// determine equality, can memory from another allocator
+	/// be released by this allocator, (ISO C++)
+	template<typename T, typename T2, typename P>
+	inline bool operator!=(STLAllocator<T,P> const&,
+		STLAllocator<T2,P> const&)
+	{
+		// same alloc policy (P), memory can be freed
+		return false;
+	}
+
+	/// determine equality, can memory from another allocator
+	/// be released by this allocator, (ISO C++)
+	template<typename T, typename P, typename OtherAllocator>
+	inline bool operator!=(STLAllocator<T,P> const&,
+		OtherAllocator const&)
+	{
+		return true;
+	}
+
+
+	/** @} */
+	/** @} */
+
+}// namespace Ogre
+
+
+#include "OgreHeaderSuffix.h"
+
+#endif // _MemorySTLAllocator_H__
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreMemoryStdAlloc.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreMemoryStdAlloc.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreMemoryStdAlloc.h	(revision 148)
@@ -0,0 +1,159 @@
+/*
+-----------------------------------------------------------------------------
+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 __MemoryStdAlloc_H__
+#define __MemoryStdAlloc_H__
+
+#include <memory>
+#include <limits>
+
+#include "OgreAlignedAllocator.h"
+#include "OgreMemoryTracker.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre
+{
+#if OGRE_MEMORY_ALLOCATOR == OGRE_MEMORY_ALLOCATOR_STD
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Memory
+	*  @{
+	*/
+	/**	A "standard" allocation policy for use with AllocatedObject and 
+		STLAllocator. This is the class that actually does the allocation
+		and deallocation of physical memory, and is what you will want to 
+		provide a custom version of if you wish to change how memory is allocated.
+		@par
+		This class just delegates to the global malloc/free.
+	*/
+	class _OgreExport StdAllocPolicy
+	{
+	public:
+		static inline void* allocateBytes(size_t count, 
+#if OGRE_MEMORY_TRACKER
+			const char* file = 0, int line = 0, const char* func = 0
+#else
+			const char*  = 0, int  = 0, const char* = 0
+#endif
+            )
+		{
+			void* ptr = malloc(count);
+#if OGRE_MEMORY_TRACKER
+			// this alloc policy doesn't do pools
+			MemoryTracker::get()._recordAlloc(ptr, count, 0, file, line, func);
+#endif
+			return ptr;
+		}
+
+		static inline void deallocateBytes(void* ptr)
+		{
+#if OGRE_MEMORY_TRACKER
+			MemoryTracker::get()._recordDealloc(ptr);
+#endif
+			free(ptr);
+		}
+
+		/// Get the maximum size of a single allocation
+		static inline size_t getMaxAllocationSize()
+		{
+			return std::numeric_limits<size_t>::max();
+		}
+	private:
+		// no instantiation
+		StdAllocPolicy()
+		{ }
+	};
+
+	/**	A "standard" allocation policy for use with AllocatedObject and 
+		STLAllocator, which aligns memory at a given boundary (which should be
+		a power of 2). This is the class that actually does the allocation
+		and deallocation of physical memory, and is what you will want to 
+		provide a custom version of if you wish to change how memory is allocated.
+		@par
+		This class just delegates to the global malloc/free, via AlignedMemory.
+		@note
+		template parameter Alignment equal to zero means use default
+		platform dependent alignment.
+
+	*/
+	template <size_t Alignment = 0>
+	class StdAlignedAllocPolicy
+	{
+	public:
+		// compile-time check alignment is available.
+		typedef int IsValidAlignment
+			[Alignment <= 128 && ((Alignment & (Alignment-1)) == 0) ? +1 : -1];
+
+		static inline void* allocateBytes(size_t count, 
+#if OGRE_MEMORY_TRACKER
+			const char* file = 0, int line = 0, const char* func = 0
+#else
+			const char*  = 0, int  = 0, const char* = 0
+#endif
+            )
+		{
+			void* ptr = Alignment ? AlignedMemory::allocate(count, Alignment)
+				: AlignedMemory::allocate(count);
+#if OGRE_MEMORY_TRACKER
+			// this alloc policy doesn't do pools
+			MemoryTracker::get()._recordAlloc(ptr, count, 0, file, line, func);
+#endif
+			return ptr;
+		}
+
+		static inline void deallocateBytes(void* ptr)
+		{
+#if OGRE_MEMORY_TRACKER
+			MemoryTracker::get()._recordDealloc(ptr);
+#endif
+			AlignedMemory::deallocate(ptr);
+		}
+
+		/// Get the maximum size of a single allocation
+		static inline size_t getMaxAllocationSize()
+		{
+			return std::numeric_limits<size_t>::max();
+		}
+	private:
+		// No instantiation
+		StdAlignedAllocPolicy()
+		{ }
+	};
+
+#endif
+	/** @} */
+	/** @} */
+
+}// namespace Ogre
+
+
+#include "OgreHeaderSuffix.h"
+
+#endif // __MemoryStdAlloc_H__
Index: /ogre_src_v1-9-0/OgreMain/include/OgreMemoryTracker.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreMemoryTracker.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreMemoryTracker.h	(revision 148)
@@ -0,0 +1,205 @@
+/*
+-----------------------------------------------------------------------------
+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 _MemoryTracker_H__
+#define _MemoryTracker_H__
+
+#include "OgreHeaderPrefix.h"
+
+// Don't include prerequisites, can cause a circular dependency
+// This file must be included within another file which already has the prerequisites in it
+//#include "OgrePrerequisites.h"
+#ifndef OGRE_COMPILER
+#	pragma message "MemoryTracker included somewhere OgrePrerequisites.h wasn't!"
+#endif
+
+// If we're using the GCC 3.1 C++ Std lib
+#if OGRE_COMPILER == OGRE_COMPILER_GNUC && OGRE_COMP_VER >= 310 && !defined(STLPORT)
+// We need to define a hash function for void*
+// For gcc 4.3 see http://gcc.gnu.org/gcc-4.3/changes.html
+#   if OGRE_COMP_VER >= 430
+#       include <tr1/unordered_map>
+#   else
+#       include <ext/hash_map>
+namespace __gnu_cxx
+{
+	template <> struct hash< void* >
+	{
+		size_t operator()( void* const & ptr ) const
+		{
+			return (size_t)ptr;
+		}
+	};
+}
+
+#   endif
+#endif
+
+#if OGRE_MEMORY_TRACKER
+#   include "Threading/OgreThreadHeaders.h"
+#endif
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Memory
+	*  @{
+	*/
+
+#if OGRE_MEMORY_TRACKER
+
+	/** This class tracks the allocations and deallocations made, and
+		is able to report memory statistics and leaks.
+	@note
+		This class is only available in debug builds.
+	*/
+	class _OgreExport MemoryTracker
+	{
+	protected:
+            OGRE_AUTO_MUTEX;
+
+		// Allocation record
+		struct Alloc
+		{
+			size_t bytes;
+			unsigned int pool;
+			std::string filename;
+			size_t line;
+			std::string function;
+
+			Alloc() :bytes(0), line(0) {}
+			Alloc(size_t sz, unsigned int p, const char* file, size_t ln, const char* func)
+				:bytes(sz), pool(p), line(ln)
+			{
+				if (file)
+					filename = file;
+				if (func)
+					function = func;
+			}
+		};
+
+		std::string mLeakFileName;
+		bool mDumpToStdOut;
+		typedef HashMap<void*, Alloc> AllocationMap;
+		AllocationMap mAllocations;
+
+		size_t mTotalAllocations;
+		typedef std::vector<size_t> AllocationsByPool;
+		AllocationsByPool mAllocationsByPool;
+		bool mRecordEnable;
+
+		void reportLeaks();
+
+		// protected ctor
+		MemoryTracker()
+			: mLeakFileName("OgreLeaks.log"), mDumpToStdOut(true),
+			mTotalAllocations(0), mRecordEnable(true)
+		{
+		}
+	public:
+
+		/** Set the name of the report file that will be produced on exit. */
+		void setReportFileName(const std::string& name)
+		{
+			mLeakFileName = name;
+		}
+		/// Return the name of the file which will contain the report at exit
+		const std::string& getReportFileName() const
+		{
+			return mLeakFileName;
+		}
+		/// Sets whether the memory report should be sent to stdout
+		void setReportToStdOut(bool rep)
+		{
+			mDumpToStdOut = rep;
+		}
+		/// Gets whether the memory report should be sent to stdout
+		bool getReportToStdOut() const
+		{
+			return mDumpToStdOut;
+		}
+
+		
+
+		/// Get the total amount of memory allocated currently.
+		size_t getTotalMemoryAllocated() const;
+		/// Get the amount of memory allocated in a given pool
+		size_t getMemoryAllocatedForPool(unsigned int pool) const;
+
+
+		/** Record an allocation that has been made. Only to be called by
+			the memory management subsystem.
+			@param ptr The pointer to the memory
+			@param sz The size of the memory in bytes
+			@param pool The memory pool this allocation is occurring from
+			@param file The file in which the allocation is being made
+			@param ln The line on which the allocation is being made
+			@param func The function in which the allocation is being made
+		*/
+		void _recordAlloc(void* ptr, size_t sz, unsigned int pool = 0,
+						  const char* file = 0, size_t ln = 0, const char* func = 0);
+		/** Record the deallocation of memory. */
+		void _recordDealloc(void* ptr);
+
+		/// Sets whether the record alloc/dealloc enabled.
+		void setRecordEnable(bool recordEnable)
+		{
+			mRecordEnable = recordEnable;
+		}
+
+		/// Gets whether the record alloc/dealloc enabled.
+		bool getRecordEnable() const
+		{
+			return mRecordEnable;
+		}
+
+		~MemoryTracker()
+		{
+			reportLeaks();
+		}
+
+		/// Static utility method to get the memory tracker instance
+		static MemoryTracker& get();
+
+
+	};
+
+
+
+#endif
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreMesh.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreMesh.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreMesh.h	(revision 148)
@@ -0,0 +1,981 @@
+/*
+-----------------------------------------------------------------------------
+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 __Mesh_H__
+#define __Mesh_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreResource.h"
+#include "OgreVertexIndexData.h"
+#include "OgreAxisAlignedBox.h"
+#include "OgreVertexBoneAssignment.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreHardwareVertexBuffer.h"
+#include "OgreSkeleton.h"
+#include "OgreAnimation.h"
+#include "OgreAnimationTrack.h"
+#include "OgrePose.h"
+#include "OgreDataStream.h"
+#include "OgreHeaderPrefix.h"
+
+
+namespace Ogre {
+
+
+    /** \addtogroup Core
+    *  @{
+    */
+    /** \addtogroup Resources
+    *  @{
+    */
+
+    struct MeshLodUsage;
+    struct LodConfig;
+    class LodStrategy;
+
+    /** Resource holding data about 3D mesh.
+    @remarks
+        This class holds the data used to represent a discrete
+        3-dimensional object. Mesh data usually contains more
+        than just vertices and triangle information; it also
+        includes references to materials (and the faces which use them),
+        level-of-detail reduction information, convex hull definition,
+        skeleton/bones information, keyframe animation etc.
+        However, it is important to note the emphasis on the word
+        'discrete' here. This class does not cover the large-scale
+        sprawling geometry found in level / landscape data.
+    @par
+        Multiple world objects can (indeed should) be created from a
+        single mesh object - see the Entity class for more info.
+        The mesh object will have it's own default
+        material properties, but potentially each world instance may
+        wish to customise the materials from the original. When the object
+        is instantiated into a scene node, the mesh material properties
+        will be taken by default but may be changed. These properties
+        are actually held at the SubMesh level since a single mesh may
+        have parts with different materials.
+    @par
+        As described above, because the mesh may have sections of differing
+        material properties, a mesh is inherently a compound construct,
+        consisting of one or more SubMesh objects.
+        However, it strongly 'owns' it's SubMeshes such that they
+        are loaded / unloaded at the same time. This is contrary to
+        the approach taken to hierarchically related (but loosely owned)
+        scene nodes, where data is loaded / unloaded separately. Note
+        also that mesh sub-sections (when used in an instantiated object)
+        share the same scene node as the parent.
+    */
+    class _OgreExport Mesh: public Resource, public AnimationContainer
+    {
+        friend class SubMesh;
+        friend class MeshSerializerImpl;
+        friend class MeshSerializerImpl_v1_4;
+        friend class MeshSerializerImpl_v1_2;
+        friend class MeshSerializerImpl_v1_1;
+
+    public:
+        typedef vector<Real>::type LodValueList;
+        typedef vector<MeshLodUsage>::type MeshLodUsageList;
+        /// Multimap of vertex bone assignments (orders by vertex index).
+        typedef multimap<size_t, VertexBoneAssignment>::type VertexBoneAssignmentList;
+        typedef MapIterator<VertexBoneAssignmentList> BoneAssignmentIterator;
+        typedef vector<SubMesh*>::type SubMeshList;
+        typedef vector<unsigned short>::type IndexMap;
+
+    protected:
+        /** A list of submeshes which make up this mesh.
+            Each mesh is made up of 1 or more submeshes, which
+            are each based on a single material and can have their
+            own vertex data (they may not - they can share vertex data
+            from the Mesh, depending on preference).
+        */
+        SubMeshList mSubMeshList;
+    
+        /** Internal method for making the space for a vertex element to hold tangents. */
+        void organiseTangentsBuffer(VertexData *vertexData, 
+            VertexElementSemantic targetSemantic, unsigned short index, 
+            unsigned short sourceTexCoordSet);
+
+    public:
+        /** A hashmap used to store optional SubMesh names.
+            Translates a name into SubMesh index.
+        */
+        typedef HashMap<String, ushort> SubMeshNameMap ;
+
+        
+    protected:
+
+        DataStreamPtr mFreshFromDisk;
+
+        SubMeshNameMap mSubMeshNameMap ;
+
+        /// Local bounding box volume.
+        AxisAlignedBox mAABB;
+        /// Local bounding sphere radius (centered on object).
+        Real mBoundRadius;
+
+        /// Optional linked skeleton.
+        String mSkeletonName;
+        SkeletonPtr mSkeleton;
+
+       
+        VertexBoneAssignmentList mBoneAssignments;
+
+        /// Flag indicating that bone assignments need to be recompiled.
+        bool mBoneAssignmentsOutOfDate;
+
+        /** Build the index map between bone index and blend index. */
+        void buildIndexMap(const VertexBoneAssignmentList& boneAssignments,
+            IndexMap& boneIndexToBlendIndexMap, IndexMap& blendIndexToBoneIndexMap);
+        /** Compile bone assignments into blend index and weight buffers. */
+        void compileBoneAssignments(const VertexBoneAssignmentList& boneAssignments,
+            unsigned short numBlendWeightsPerVertex, 
+            IndexMap& blendIndexToBoneIndexMap,
+            VertexData* targetVertexData);
+
+        const LodStrategy *mLodStrategy;
+        bool mIsLodManual;
+        ushort mNumLods;
+        MeshLodUsageList mMeshLodUsageList;
+
+        HardwareBuffer::Usage mVertexBufferUsage;
+        HardwareBuffer::Usage mIndexBufferUsage;
+        bool mVertexBufferShadowBuffer;
+        bool mIndexBufferShadowBuffer;
+
+
+        bool mPreparedForShadowVolumes;
+        bool mEdgeListsBuilt;
+        bool mAutoBuildEdgeLists;
+
+        /// Storage of morph animations, lookup by name
+        typedef map<String, Animation*>::type AnimationList;
+        AnimationList mAnimationsList;
+        /// The vertex animation type associated with the shared vertex data
+        mutable VertexAnimationType mSharedVertexDataAnimationType;
+        /// Whether vertex animation includes normals
+        mutable bool mSharedVertexDataAnimationIncludesNormals;
+        /// Do we need to scan animations for animation types?
+        mutable bool mAnimationTypesDirty;
+
+        /// List of available poses for shared and dedicated geometryPoseList
+        PoseList mPoseList;
+        mutable bool mPosesIncludeNormals;
+
+
+        /** Loads the mesh from disk.  This call only performs IO, it
+            does not parse the bytestream or check for any errors therein.
+            It also does not set up submeshes, etc.  You have to call load()
+            to do that.
+         */
+        void prepareImpl(void);
+        /** Destroys data cached by prepareImpl.
+         */
+        void unprepareImpl(void);
+        /// @copydoc Resource::loadImpl
+        void loadImpl(void);
+        /// @copydoc Resource::postLoadImpl
+        void postLoadImpl(void);
+        /// @copydoc Resource::unloadImpl
+        void unloadImpl(void);
+        /// @copydoc Resource::calculateSize
+        size_t calculateSize(void) const;
+
+		void mergeAdjacentTexcoords( unsigned short finalTexCoordSet,
+									 unsigned short texCoordSetToDestroy, VertexData *vertexData );
+
+
+    public:
+        /** Default constructor - used by MeshManager
+        @warning
+            Do not call this method directly.
+        */
+        Mesh(ResourceManager* creator, const String& name, ResourceHandle handle,
+            const String& group, bool isManual = false, ManualResourceLoader* loader = 0);
+        ~Mesh();
+
+        // NB All methods below are non-virtual since they will be
+        // called in the rendering loop - speed is of the essence.
+
+        /** Creates a new SubMesh.
+        @remarks
+            Method for manually creating geometry for the mesh.
+            Note - use with extreme caution - you must be sure that
+            you have set up the geometry properly.
+        */
+        SubMesh* createSubMesh(void);
+
+        /** Creates a new SubMesh and gives it a name
+        */
+        SubMesh* createSubMesh(const String& name);
+        
+        /** Gives a name to a SubMesh
+        */
+        void nameSubMesh(const String& name, ushort index);
+
+        /** Removes a name from a SubMesh
+        */
+        void unnameSubMesh(const String& name);
+        
+        /** Gets the index of a submesh with a given name.
+        @remarks
+            Useful if you identify the SubMeshes by name (using nameSubMesh)
+            but wish to have faster repeat access.
+        */
+        ushort _getSubMeshIndex(const String& name) const;
+
+        /** Gets the number of sub meshes which comprise this mesh.
+        */
+        unsigned short getNumSubMeshes(void) const;
+
+        /** Gets a pointer to the submesh indicated by the index.
+        */
+        SubMesh* getSubMesh(unsigned short index) const;
+
+        /** Gets a SubMesh by name
+        */
+        SubMesh* getSubMesh(const String& name) const ;
+        
+        /** Destroy a SubMesh with the given index. 
+        @note
+            This will invalidate the contents of any existing Entity, or
+            any other object that is referring to the SubMesh list. Entity will
+            detect this and reinitialise, but it is still a disruptive action.
+        */
+        void destroySubMesh(unsigned short index);
+
+        /** Destroy a SubMesh with the given name. 
+        @note
+            This will invalidate the contents of any existing Entity, or
+            any other object that is referring to the SubMesh list. Entity will
+            detect this and reinitialise, but it is still a disruptive action.
+        */
+        void destroySubMesh(const String& name);
+        
+        typedef VectorIterator<SubMeshList> SubMeshIterator;
+        /// Gets an iterator over the available submeshes
+        SubMeshIterator getSubMeshIterator(void)
+        { return SubMeshIterator(mSubMeshList.begin(), mSubMeshList.end()); }
+      
+        /** Shared vertex data.
+        @remarks
+            This vertex data can be shared among multiple submeshes. SubMeshes may not have
+            their own VertexData, they may share this one.
+        @par
+            The use of shared or non-shared buffers is determined when
+            model data is converted to the OGRE .mesh format.
+        */
+        VertexData *sharedVertexData;
+
+        /** Shared index map for translating blend index to bone index.
+        @remarks
+            This index map can be shared among multiple submeshes. SubMeshes might not have
+            their own IndexMap, they might share this one.
+        @par
+            We collect actually used bones of all bone assignments, and build the
+            blend index in 'packed' form, then the range of the blend index in vertex
+            data VES_BLEND_INDICES element is continuous, with no gaps. Thus, by
+            minimising the world matrix array constants passing to GPU, we can support
+            more bones for a mesh when hardware skinning is used. The hardware skinning
+            support limit is applied to each set of vertex data in the mesh, in other words, the
+            hardware skinning support limit is applied only to the actually used bones of each
+            SubMeshes, not all bones across the entire Mesh.
+        @par
+            Because the blend index is different to the bone index, therefore, we use
+            the index map to translate the blend index to bone index.
+        @par
+            The use of shared or non-shared index map is determined when
+            model data is converted to the OGRE .mesh format.
+        */
+        IndexMap sharedBlendIndexToBoneIndexMap;
+
+        /** Makes a copy of this mesh object and gives it a new name.
+        @remarks
+            This is useful if you want to tweak an existing mesh without affecting the original one. The
+            newly cloned mesh is registered with the MeshManager under the new name.
+        @param newName
+            The name to give the clone.
+        @param newGroup
+            Optional name of the new group to assign the clone to;
+            if you leave this blank, the clone will be assigned to the same
+            group as this Mesh.
+        */
+        MeshPtr clone(const String& newName, const String& newGroup = StringUtil::BLANK);
+
+        /** Get the axis-aligned bounding box for this mesh.
+        */
+        const AxisAlignedBox& getBounds(void) const;
+
+        /** Gets the radius of the bounding sphere surrounding this mesh. */
+        Real getBoundingSphereRadius(void) const;
+
+        /** Manually set the bounding box for this Mesh.
+        @remarks
+            Calling this method is required when building manual meshes now, because OGRE can no longer 
+            update the bounds for you, because it cannot necessarily read vertex data back from 
+            the vertex buffers which this mesh uses (they very well might be write-only, and even
+            if they are not, reading data from a hardware buffer is a bottleneck).
+            @param pad If true, a certain padding will be added to the bounding box to separate it from the mesh
+        */
+        void _setBounds(const AxisAlignedBox& bounds, bool pad = true);
+
+        /** Manually set the bounding radius. 
+        @remarks
+            Calling this method is required when building manual meshes now, because OGRE can no longer 
+            update the bounds for you, because it cannot necessarily read vertex data back from 
+            the vertex buffers which this mesh uses (they very well might be write-only, and even
+            if they are not, reading data from a hardware buffer is a bottleneck).
+        */
+        void _setBoundingSphereRadius(Real radius);
+
+        /** Sets the name of the skeleton this Mesh uses for animation.
+        @remarks
+            Meshes can optionally be assigned a skeleton which can be used to animate
+            the mesh through bone assignments. The default is for the Mesh to use no
+            skeleton. Calling this method with a valid skeleton filename will cause the
+            skeleton to be loaded if it is not already (a single skeleton can be shared
+            by many Mesh objects).
+        @param skelName
+            The name of the .skeleton file to use, or an empty string to use
+            no skeleton
+        */
+        void setSkeletonName(const String& skelName);
+
+        /** Returns true if this Mesh has a linked Skeleton. */
+        bool hasSkeleton(void) const;
+
+        /** Returns whether or not this mesh has some kind of vertex animation. 
+        */
+        bool hasVertexAnimation(void) const;
+        
+        /** Gets a pointer to any linked Skeleton. 
+        @return
+            Weak reference to the skeleton - copy this if you want to hold a strong pointer.
+        */
+        const SkeletonPtr& getSkeleton(void) const;
+
+        /** Gets the name of any linked Skeleton */
+        const String& getSkeletonName(void) const;
+        /** Initialise an animation set suitable for use with this mesh. 
+        @remarks
+            Only recommended for use inside the engine, not by applications.
+        */
+        void _initAnimationState(AnimationStateSet* animSet);
+
+        /** Refresh an animation set suitable for use with this mesh. 
+        @remarks
+            Only recommended for use inside the engine, not by applications.
+        */
+        void _refreshAnimationState(AnimationStateSet* animSet);
+        /** Assigns a vertex to a bone with a given weight, for skeletal animation. 
+        @remarks    
+            This method is only valid after calling setSkeletonName.
+            Since this is a one-off process there exists only 'addBoneAssignment' and
+            'clearBoneAssignments' methods, no 'editBoneAssignment'. You should not need
+            to modify bone assignments during rendering (only the positions of bones) and OGRE
+            reserves the right to do some internal data reformatting of this information, depending
+            on render system requirements.
+        @par
+            This method is for assigning weights to the shared geometry of the Mesh. To assign
+            weights to the per-SubMesh geometry, see the equivalent methods on SubMesh.
+        */
+        void addBoneAssignment(const VertexBoneAssignment& vertBoneAssign);
+
+        /** Removes all bone assignments for this mesh. 
+        @remarks
+            This method is for modifying weights to the shared geometry of the Mesh. To assign
+            weights to the per-SubMesh geometry, see the equivalent methods on SubMesh.
+        */
+        void clearBoneAssignments(void);
+
+        /** Internal notification, used to tell the Mesh which Skeleton to use without loading it. 
+        @remarks
+            This is only here for unusual situation where you want to manually set up a
+            Skeleton. Best to let OGRE deal with this, don't call it yourself unless you
+            really know what you're doing.
+        */
+        void _notifySkeleton(SkeletonPtr& pSkel);
+
+
+        /** Gets an iterator for access all bone assignments. 
+        */
+        BoneAssignmentIterator getBoneAssignmentIterator(void);
+
+        /** Gets a const reference to the list of bone assignments
+        */
+        const VertexBoneAssignmentList& getBoneAssignments() const { return mBoneAssignments; }
+
+
+        /** Returns the number of levels of detail that this mesh supports. 
+        @remarks
+            This number includes the original model.
+        */
+        ushort getNumLodLevels(void) const;
+        /** Gets details of the numbered level of detail entry. */
+        const MeshLodUsage& getLodLevel(ushort index) const;
+        /** Adds a new manual level-of-detail entry to this Mesh.
+        @remarks
+            As an alternative to generating lower level of detail versions of a mesh, you can
+            use your own manually modelled meshes as lower level versions. This lets you 
+            have complete control over the LOD, and in addition lets you scale down other
+            aspects of the model which cannot be done using the generated method; for example, 
+            you could use less detailed materials and / or use less bones in the skeleton if
+            this is an animated mesh. Therefore for complex models you are likely to be better off
+            modelling your LODs yourself and using this method, whilst for models with fairly
+            simple materials and no animation you can just use the generateLodLevels method.
+        @param value
+            The value from which this LOD will apply.
+        @param meshName
+            The name of the mesh which will be the lower level detail version.
+        */
+        void createManualLodLevel(Real value, const String& meshName, const String& groupName = Ogre::String());
+
+        /** Changes the alternate mesh to use as a manual LOD at the given index.
+        @remarks
+            Note that the index of a LOD may change if you insert other LODs. If in doubt,
+            use getLodIndex().
+        @param index
+            The index of the level to be changed.
+        @param meshName
+            The name of the mesh which will be the lower level detail version.
+        */
+        void updateManualLodLevel(ushort index, const String& meshName);
+
+        /** Retrieves the level of detail index for the given LOD value. 
+        @note
+            The value passed in is the 'transformed' value. If you are dealing with
+            an original source value (e.g. distance), use LodStrategy::transformUserValue
+            to turn this into a lookup value.
+        */
+        ushort getLodIndex(Real value) const;
+
+        /** Returns true if this mesh is using manual LOD.
+        @remarks
+            A mesh can either use automatically generated LOD, or it can use alternative
+            meshes as provided by an artist. A mesh can only use either all manual LODs 
+            or all generated LODs, not a mixture of both.
+        */
+        bool isLodManual(void) const { return mIsLodManual; }
+
+        /** Internal methods for loading LOD, do not use. */
+        void _setLodInfo(unsigned short numLevels, bool isManual);
+        /** Internal methods for loading LOD, do not use. */
+        void _setLodUsage(unsigned short level, MeshLodUsage& usage);
+        /** Internal methods for loading LOD, do not use. */
+        void _setSubMeshLodFaceList(unsigned short subIdx, unsigned short level, IndexData* facedata);
+
+        /** Removes all LOD data from this Mesh. */
+        void removeLodLevels(void);
+
+        /** Sets the policy for the vertex buffers to be used when loading
+            this Mesh.
+        @remarks
+            By default, when loading the Mesh, static, write-only vertex and index buffers 
+            will be used where possible in order to improve rendering performance. 
+            However, such buffers
+            cannot be manipulated on the fly by CPU code (although shader code can). If you
+            wish to use the CPU to modify these buffers, you should call this method. Note,
+            however, that it only takes effect after the Mesh has been reloaded. Note that you
+            still have the option of manually repacing the buffers in this mesh with your
+            own if you see fit too, in which case you don't need to call this method since it
+            only affects buffers created by the mesh itself.
+        @par
+            You can define the approach to a Mesh by changing the default parameters to 
+            MeshManager::load if you wish; this means the Mesh is loaded with those options
+            the first time instead of you having to reload the mesh after changing these options.
+        @param usage
+            The usage flags, which by default are 
+            HardwareBuffer::HBU_STATIC_WRITE_ONLY
+        @param shadowBuffer
+            If set to @c true, the vertex buffers will be created with a
+            system memory shadow buffer. You should set this if you want to be able to
+            read from the buffer, because reading from a hardware buffer is a no-no.
+        */
+        void setVertexBufferPolicy(HardwareBuffer::Usage usage, bool shadowBuffer = false);
+        /** Sets the policy for the index buffers to be used when loading
+            this Mesh.
+        @remarks
+            By default, when loading the Mesh, static, write-only vertex and index buffers 
+            will be used where possible in order to improve rendering performance. 
+            However, such buffers
+            cannot be manipulated on the fly by CPU code (although shader code can). If you
+            wish to use the CPU to modify these buffers, you should call this method. Note,
+            however, that it only takes effect after the Mesh has been reloaded. Note that you
+            still have the option of manually repacing the buffers in this mesh with your
+            own if you see fit too, in which case you don't need to call this method since it
+            only affects buffers created by the mesh itself.
+        @par
+            You can define the approach to a Mesh by changing the default parameters to 
+            MeshManager::load if you wish; this means the Mesh is loaded with those options
+            the first time instead of you having to reload the mesh after changing these options.
+        @param usage
+            The usage flags, which by default are 
+            HardwareBuffer::HBU_STATIC_WRITE_ONLY
+        @param shadowBuffer
+            If set to @c true, the index buffers will be created with a
+            system memory shadow buffer. You should set this if you want to be able to
+            read from the buffer, because reading from a hardware buffer is a no-no.
+        */
+        void setIndexBufferPolicy(HardwareBuffer::Usage usage, bool shadowBuffer = false);
+        /** Gets the usage setting for this meshes vertex buffers. */
+        HardwareBuffer::Usage getVertexBufferUsage(void) const { return mVertexBufferUsage; }
+        /** Gets the usage setting for this meshes index buffers. */
+        HardwareBuffer::Usage getIndexBufferUsage(void) const { return mIndexBufferUsage; }
+        /** Gets whether or not this meshes vertex buffers are shadowed. */
+        bool isVertexBufferShadowed(void) const { return mVertexBufferShadowBuffer; }
+        /** Gets whether or not this meshes index buffers are shadowed. */
+        bool isIndexBufferShadowed(void) const { return mIndexBufferShadowBuffer; }
+       
+
+        /** Rationalises the passed in bone assignment list.
+        @remarks
+            OGRE supports up to 4 bone assignments per vertex. The reason for this limit
+            is that this is the maximum number of assignments that can be passed into
+            a hardware-assisted blending algorithm. This method identifies where there are
+            more than 4 bone assignments for a given vertex, and eliminates the bone
+            assignments with the lowest weights to reduce to this limit. The remaining
+            weights are then re-balanced to ensure that they sum to 1.0.
+        @param vertexCount
+            The number of vertices.
+        @param assignments
+            The bone assignment list to rationalise. This list will be modified and
+            entries will be removed where the limits are exceeded.
+        @return
+            The maximum number of bone assignments per vertex found, clamped to [1-4]
+        */
+        unsigned short _rationaliseBoneAssignments(size_t vertexCount, VertexBoneAssignmentList& assignments);
+
+        /** Internal method, be called once to compile bone assignments into geometry buffer. 
+        @remarks
+            The OGRE engine calls this method automatically. It compiles the information 
+            submitted as bone assignments into a format usable in realtime. It also 
+            eliminates excessive bone assignments (max is OGRE_MAX_BLEND_WEIGHTS)
+            and re-normalises the remaining assignments.
+        */
+        void _compileBoneAssignments(void);
+
+        /** Internal method, be called once to update the compiled bone assignments.
+        @remarks
+            The OGRE engine calls this method automatically. It updates the compiled bone
+            assignments if requested.
+        */
+        void _updateCompiledBoneAssignments(void);
+
+		/** This method collapses two texcoords into one for all submeshes where this is possible.
+        @remarks
+			Often a submesh can have two tex. coords. (i.e. TEXCOORD0 & TEXCOORD1), being both
+			composed of two floats. There are many practical reasons why it would be more convenient
+			to merge both of them into one TEXCOORD0 of 4 floats. This function does exactly that
+			The finalTexCoordSet must have enough space for the merge, or else the submesh will be
+			skipped. (i.e. you can't merge a tex. coord with 3 floats with one having 2 floats)
+
+			finalTexCoordSet & texCoordSetToDestroy must be in the same buffer source, and must
+			be adjacent.
+		@param finalTexCoordSet The tex. coord index to merge to. Should have enough space to
+			actually work.
+        @param texCoordSetToDestroy The texture coordinate index that will disappear on
+			successful merges.
+        */
+		void mergeAdjacentTexcoords( unsigned short finalTexCoordSet, unsigned short texCoordSetToDestroy );
+
+		void _configureMeshLodUsage(const LodConfig& lodConfig);
+
+        /** This method builds a set of tangent vectors for a given mesh into a 3D texture coordinate buffer.
+        @remarks
+            Tangent vectors are vectors representing the local 'X' axis for a given vertex based
+            on the orientation of the 2D texture on the geometry. They are built from a combination
+            of existing normals, and from the 2D texture coordinates already baked into the model.
+            They can be used for a number of things, but most of all they are useful for 
+            vertex and fragment programs, when you wish to arrive at a common space for doing
+            per-pixel calculations.
+        @par
+            The prerequisites for calling this method include that the vertex data used by every
+            SubMesh has both vertex normals and 2D texture coordinates.
+        @param targetSemantic
+            The semantic to store the tangents in. Defaults to 
+            the explicit tangent binding, but note that this is only usable on more
+            modern hardware (Shader Model 2), so if you need portability with older
+            cards you should change this to a texture coordinate binding instead.
+        @param sourceTexCoordSet
+            The texture coordinate index which should be used as the source
+            of 2D texture coordinates, with which to calculate the tangents.
+        @param index
+            The element index, ie the texture coordinate set which should be used to store the 3D
+            coordinates representing a tangent vector per vertex, if targetSemantic is 
+            VES_TEXTURE_COORDINATES. If this already exists, it will be overwritten.
+        @param splitMirrored
+            Sets whether or not to split vertices when a mirrored tangent space
+            transition is detected (matrix parity differs). @see TangentSpaceCalc::setSplitMirrored
+        @param splitRotated
+            Sets whether or not to split vertices when a rotated tangent space
+            is detected. @see TangentSpaceCalc::setSplitRotated
+        @param storeParityInW
+            If @c true, store tangents as a 4-vector and include parity in w.
+        */
+        void buildTangentVectors(VertexElementSemantic targetSemantic = VES_TANGENT,
+            unsigned short sourceTexCoordSet = 0, unsigned short index = 0, 
+            bool splitMirrored = false, bool splitRotated = false, bool storeParityInW = false);
+
+        /** Ask the mesh to suggest parameters to a future buildTangentVectors call, 
+            should you wish to use texture coordinates to store the tangents. 
+        @remarks
+            This helper method will suggest source and destination texture coordinate sets
+            for a call to buildTangentVectors. It will detect when there are inappropriate
+            conditions (such as multiple geometry sets which don't agree). 
+            Moreover, it will return 'true' if it detects that there are aleady 3D 
+            coordinates in the mesh, and therefore tangents may have been prepared already.
+        @param targetSemantic
+            The semantic you intend to use to store the tangents
+            if they are not already present;
+            most likely options are VES_TEXTURE_COORDINATES or VES_TANGENT; you should
+            use texture coordinates if you want compatibility with older, pre-SM2
+            graphics cards, and the tangent binding otherwise.
+        @param outSourceCoordSet
+            Reference to a source texture coordinate set which 
+            will be populated.
+        @param outIndex
+            Reference to a destination element index (e.g. texture coord set)
+            which will be populated
+        */
+        bool suggestTangentVectorBuildParams(VertexElementSemantic targetSemantic,
+            unsigned short& outSourceCoordSet, unsigned short& outIndex);
+
+        /** Builds an edge list for this mesh, which can be used for generating a shadow volume
+            among other things.
+        */
+        void buildEdgeList(void);
+        /** Destroys and frees the edge lists this mesh has built. */
+        void freeEdgeList(void);
+
+        /** This method prepares the mesh for generating a renderable shadow volume. 
+        @remarks
+            Preparing a mesh to generate a shadow volume involves firstly ensuring that the 
+            vertex buffer containing the positions for the mesh is a standalone vertex buffer,
+            with no other components in it. This method will therefore break apart any existing
+            vertex buffers this mesh holds if position is sharing a vertex buffer. 
+            Secondly, it will double the size of this vertex buffer so that there are 2 copies of 
+            the position data for the mesh. The first half is used for the original, and the second 
+            half is used for the 'extruded' version of the mesh. The vertex count of the main 
+            VertexData used to render the mesh will remain the same though, so as not to add any 
+            overhead to regular rendering of the object.
+            Both copies of the position are required in one buffer because shadow volumes stretch 
+            from the original mesh to the extruded version. 
+        @par
+            Because shadow volumes are rendered in turn, no additional
+            index buffer space is allocated by this method, a shared index buffer allocated by the
+            shadow rendering algorithm is used for addressing this extended vertex buffer.
+        */
+        void prepareForShadowVolume(void);
+
+        /** Return the edge list for this mesh, building it if required. 
+        @remarks
+            You must ensure that the Mesh as been prepared for shadow volume 
+            rendering if you intend to use this information for that purpose.
+        @param lodIndex
+            The LOD at which to get the edge list, 0 being the highest.
+        */
+        EdgeData* getEdgeList(unsigned short lodIndex = 0);
+
+        /** Return the edge list for this mesh, building it if required. 
+        @remarks
+            You must ensure that the Mesh as been prepared for shadow volume 
+            rendering if you intend to use this information for that purpose.
+        @param lodIndex
+            The LOD at which to get the edge list, 0 being the highest.
+        */
+        const EdgeData* getEdgeList(unsigned short lodIndex = 0) const;
+
+        /** Returns whether this mesh has already had it's geometry prepared for use in 
+            rendering shadow volumes. */
+        bool isPreparedForShadowVolumes(void) const { return mPreparedForShadowVolumes; }
+
+        /** Returns whether this mesh has an attached edge list. */
+        bool isEdgeListBuilt(void) const { return mEdgeListsBuilt; }
+
+        /** Prepare matrices for software indexed vertex blend.
+        @remarks
+            This function organise bone indexed matrices to blend indexed matrices,
+            so software vertex blending can access to the matrix via blend index
+            directly.
+        @param blendMatrices
+            Pointer to an array of matrix pointers to store
+            prepared results, which indexed by blend index.
+        @param boneMatrices
+            Pointer to an array of matrices to be used to blend,
+            which indexed by bone index.
+        @param indexMap
+            The index map used to translate blend index to bone index.
+        */
+        static void prepareMatricesForVertexBlend(const Matrix4** blendMatrices,
+            const Matrix4* boneMatrices, const IndexMap& indexMap);
+
+        /** Performs a software indexed vertex blend, of the kind used for
+            skeletal animation although it can be used for other purposes. 
+        @remarks
+            This function is supplied to update vertex data with blends 
+            done in software, either because no hardware support is available, 
+            or that you need the results of the blend for some other CPU operations.
+        @param sourceVertexData
+            VertexData class containing positions, normals,
+            blend indices and blend weights.
+        @param targetVertexData
+            VertexData class containing target position
+            and normal buffers which will be updated with the blended versions.
+            Note that the layout of the source and target position / normal 
+            buffers must be identical, ie they must use the same buffer indexes
+        @param blendMatrices
+            Pointer to an array of matrix pointers to be used to blend,
+            indexed by blend indices in the sourceVertexData
+        @param numMatrices
+            Number of matrices in the blendMatrices, it might be used
+            as a hint for optimisation.
+        @param blendNormals
+            If @c true, normals are blended as well as positions.
+        */
+        static void softwareVertexBlend(const VertexData* sourceVertexData, 
+            const VertexData* targetVertexData,
+            const Matrix4* const* blendMatrices, size_t numMatrices,
+            bool blendNormals);
+
+        /** Performs a software vertex morph, of the kind used for
+            morph animation although it can be used for other purposes. 
+        @remarks
+            This function will linearly interpolate positions between two
+            source buffers, into a third buffer.
+        @param t
+            Parametric distance between the start and end buffer positions.
+        @param b1
+            Vertex buffer containing VET_FLOAT3 entries for the start positions.
+        @param b2
+            Vertex buffer containing VET_FLOAT3 entries for the end positions.
+        @param targetVertexData
+            VertexData destination; assumed to have a separate position
+            buffer already bound, and the number of vertices must agree with the
+            number in start and end
+        */
+        static void softwareVertexMorph(Real t, 
+            const HardwareVertexBufferSharedPtr& b1, 
+            const HardwareVertexBufferSharedPtr& b2, 
+            VertexData* targetVertexData);
+
+        /** Performs a software vertex pose blend, of the kind used for
+            morph animation although it can be used for other purposes. 
+        @remarks
+            This function will apply a weighted offset to the positions in the 
+            incoming vertex data (therefore this is a read/write operation, and 
+            if you expect to call it more than once with the same data, then
+            you would be best to suppress hardware uploads of the position buffer
+            for the duration).
+        @param weight
+            Parametric weight to scale the offsets by.
+        @param vertexOffsetMap
+            Potentially sparse map of vertex index -> offset.
+        @param normalsMap
+            Potentially sparse map of vertex index -> normal.
+        @param targetVertexData 
+            VertexData destination; assumed to have a separate position
+            buffer already bound, and the number of vertices must agree with the
+            number in start and end.
+        */
+        static void softwareVertexPoseBlend(Real weight, 
+            const map<size_t, Vector3>::type& vertexOffsetMap,
+            const map<size_t, Vector3>::type& normalsMap,
+            VertexData* targetVertexData);
+        /** Gets a reference to the optional name assignments of the SubMeshes. */
+        const SubMeshNameMap& getSubMeshNameMap(void) const { return mSubMeshNameMap; }
+
+        /** Sets whether or not this Mesh should automatically build edge lists
+            when asked for them, or whether it should never build them if
+            they are not already provided.
+        @remarks
+            This allows you to create meshes which do not have edge lists calculated, 
+            because you never want to use them. This value defaults to 'true'
+            for mesh formats which did not include edge data, and 'false' for 
+            newer formats, where edge lists are expected to have been generated
+            in advance.
+        */
+        void setAutoBuildEdgeLists(bool autobuild) { mAutoBuildEdgeLists = autobuild; }
+        /** Sets whether or not this Mesh should automatically build edge lists
+            when asked for them, or whether it should never build them if
+            they are not already provided.
+        */
+        bool getAutoBuildEdgeLists(void) const { return mAutoBuildEdgeLists; }
+
+        /** Gets the type of vertex animation the shared vertex data of this mesh supports.
+        */
+        virtual VertexAnimationType getSharedVertexDataAnimationType(void) const;
+
+        /// Returns whether animation on shared vertex data includes normals.
+        bool getSharedVertexDataAnimationIncludesNormals() const { return mSharedVertexDataAnimationIncludesNormals; }
+
+        /** Creates a new Animation object for vertex animating this mesh. 
+        @param name
+            The name of this animation.
+        @param length
+            The length of the animation in seconds.
+        */
+        virtual Animation* createAnimation(const String& name, Real length);
+
+        /** Returns the named vertex Animation object. 
+        @param name
+            The name of the animation.
+        */
+        virtual Animation* getAnimation(const String& name) const;
+
+        /** Internal access to the named vertex Animation object - returns null 
+            if it does not exist. 
+        @param name
+            The name of the animation.
+        */
+        virtual Animation* _getAnimationImpl(const String& name) const;
+
+        /** Returns whether this mesh contains the named vertex animation. */
+        virtual bool hasAnimation(const String& name) const;
+
+        /** Removes vertex Animation from this mesh. */
+        virtual void removeAnimation(const String& name);
+
+        /** Gets the number of morph animations in this mesh. */
+        virtual unsigned short getNumAnimations(void) const;
+
+        /** Gets a single morph animation by index. 
+        */
+        virtual Animation* getAnimation(unsigned short index) const;
+
+        /** Removes all morph Animations from this mesh. */
+        virtual void removeAllAnimations(void);
+        /** Gets a pointer to a vertex data element based on a morph animation 
+            track handle.
+        @remarks
+            0 means the shared vertex data, 1+ means a submesh vertex data (index+1)
+        */
+        VertexData* getVertexDataByTrackHandle(unsigned short handle);
+        /** Iterates through all submeshes and requests them 
+            to apply their texture aliases to the material they use.
+        @remarks
+            The submesh will only apply texture aliases to the material if matching
+            texture alias names are found in the material.  If a match is found, the
+            submesh will automatically clone the original material and then apply its
+            texture to the new material.
+        @par
+            This method is normally called by the protected method loadImpl when a 
+            mesh if first loaded.
+        */
+        void updateMaterialForAllSubMeshes(void);
+
+        /** Internal method which, if animation types have not been determined,
+            scans any vertex animations and determines the type for each set of
+            vertex data (cannot have 2 different types).
+        */
+        void _determineAnimationTypes(void) const;
+        /** Are the derived animation types out of date? */
+        bool _getAnimationTypesDirty(void) const { return mAnimationTypesDirty; }
+
+        /** Create a new Pose for this mesh or one of its submeshes.
+        @param target
+            The target geometry index; 0 is the shared Mesh geometry, 1+ is the
+            dedicated SubMesh geometry belonging to submesh index + 1.
+        @param name
+            Name to give the pose, which is optional.
+        @return
+            A new Pose ready for population.
+        */
+        Pose* createPose(ushort target, const String& name = StringUtil::BLANK);
+        /** Get the number of poses.*/
+        size_t getPoseCount(void) const { return mPoseList.size(); }
+        /** Retrieve an existing Pose by index.*/
+        Pose* getPose(ushort index);
+        /** Retrieve an existing Pose by name.*/
+        Pose* getPose(const String& name);
+        /** Destroy a pose by index.
+        @note
+            This will invalidate any animation tracks referring to this pose or those after it.
+        */
+        void removePose(ushort index);
+        /** Destroy a pose by name.
+        @note
+            This will invalidate any animation tracks referring to this pose or those after it.
+        */
+        void removePose(const String& name);
+        /** Destroy all poses. */
+        void removeAllPoses(void);
+
+        typedef VectorIterator<PoseList> PoseIterator;
+        typedef ConstVectorIterator<PoseList> ConstPoseIterator;
+
+        /** Get an iterator over all the poses defined. */
+        PoseIterator getPoseIterator(void);
+        /** Get an iterator over all the poses defined. */
+        ConstPoseIterator getPoseIterator(void) const;
+        /** Get pose list. */
+        const PoseList& getPoseList(void) const;
+
+        /** Get LOD strategy used by this mesh. */
+        const LodStrategy *getLodStrategy() const;
+        /** Set the LOD strategy used by this mesh. */
+        void setLodStrategy(LodStrategy *lodStrategy);
+
+    };
+
+    /** A way of recording the way each LODs is recorded this Mesh. */
+    struct MeshLodUsage
+    {
+        /** User-supplied values used to determine when th is LOD applies.
+        @remarks
+            This is required in case the LOD strategy changes.
+        */
+        Real userValue;
+
+        /** Value used by to determine when this LOD applies.
+        @remarks
+            May be interpretted differently by different strategies.
+            Transformed from user-supplied values with LodStrategy::transformUserValue.
+        */
+        Real value;
+        
+        /// Only relevant if mIsLodManual is true, the name of the alternative mesh to use.
+        String manualName;
+        /// Only relevant if mIsLodManual is true, the name of the group of the alternative mesh.
+        String manualGroup;
+        /// Hard link to mesh to avoid looking up each time.
+        mutable MeshPtr manualMesh;
+        /// Edge list for this LOD level (may be derived from manual mesh).
+        mutable EdgeData* edgeData;
+
+        MeshLodUsage() : userValue(0.0), value(0.0), edgeData(0) {}
+    };
+
+    /** @} */
+    /** @} */
+
+
+} // namespace Ogre
+
+#include "OgreHeaderSuffix.h"
+
+#endif // __Mesh_H__
Index: /ogre_src_v1-9-0/OgreMain/include/OgreMeshFileFormat.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreMeshFileFormat.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreMeshFileFormat.h	(revision 148)
@@ -0,0 +1,295 @@
+/*
+-----------------------------------------------------------------------------
+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 __MeshFileFormat_H__
+#define __MeshFileFormat_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Resources
+	*  @{
+	*/
+/** Definition of the OGRE .mesh file format 
+
+    .mesh files are binary files (for read efficiency at runtime) and are arranged into chunks 
+    of data, very like 3D Studio's format.
+    A chunk always consists of:
+        unsigned short CHUNK_ID        : one of the following chunk ids identifying the chunk
+        unsigned long  LENGTH          : length of the chunk in bytes, including this header
+        void*          DATA            : the data, which may contain other sub-chunks (various data types)
+    
+    A .mesh file can contain both the definition of the Mesh itself, and optionally the definitions
+    of the materials is uses (although these can be omitted, if so the Mesh assumes that at runtime the
+    Materials referred to by name in the Mesh are loaded/created from another source)
+
+    A .mesh file only contains a single mesh, which can itself have multiple submeshes.
+
+*/
+
+	enum MeshChunkID {
+        M_HEADER                = 0x1000,
+            // char*          version           : Version number check
+        M_MESH                = 0x3000,
+			// bool skeletallyAnimated   // important flag which affects h/w buffer policies
+            // Optional M_GEOMETRY chunk
+            M_SUBMESH             = 0x4000, 
+                // char* materialName
+                // bool useSharedVertices
+                // unsigned int indexCount
+                // bool indexes32Bit
+                // unsigned int* faceVertexIndices (indexCount)
+                // OR
+                // unsigned short* faceVertexIndices (indexCount)
+                // M_GEOMETRY chunk (Optional: present only if useSharedVertices = false)
+                M_SUBMESH_OPERATION = 0x4010, // optional, trilist assumed if missing
+                    // unsigned short operationType
+                M_SUBMESH_BONE_ASSIGNMENT = 0x4100,
+                    // Optional bone weights (repeating section)
+                    // unsigned int vertexIndex;
+                    // unsigned short boneIndex;
+                    // float weight;
+    			// Optional chunk that matches a texture name to an alias
+                // a texture alias is sent to the submesh material to use this texture name
+                // instead of the one in the texture unit with a matching alias name
+                M_SUBMESH_TEXTURE_ALIAS = 0x4200, // Repeating section
+                    // char* aliasName;
+                    // char* textureName;
+
+            M_GEOMETRY          = 0x5000, // NB this chunk is embedded within M_MESH and M_SUBMESH
+                // unsigned int vertexCount
+				M_GEOMETRY_VERTEX_DECLARATION = 0x5100,
+					M_GEOMETRY_VERTEX_ELEMENT = 0x5110, // Repeating section
+						// unsigned short source;  	// buffer bind source
+						// unsigned short type;    	// VertexElementType
+						// unsigned short semantic; // VertexElementSemantic
+						// unsigned short offset;	// start offset in buffer in bytes
+						// unsigned short index;	// index of the semantic (for colours and texture coords)
+				M_GEOMETRY_VERTEX_BUFFER = 0x5200, // Repeating section
+					// unsigned short bindIndex;	// Index to bind this buffer to
+					// unsigned short vertexSize;	// Per-vertex size, must agree with declaration at this index
+					M_GEOMETRY_VERTEX_BUFFER_DATA = 0x5210,
+						// raw buffer data
+            M_MESH_SKELETON_LINK = 0x6000,
+                // Optional link to skeleton
+                // char* skeletonName           : name of .skeleton to use
+            M_MESH_BONE_ASSIGNMENT = 0x7000,
+                // Optional bone weights (repeating section)
+                // unsigned int vertexIndex;
+                // unsigned short boneIndex;
+                // float weight;
+            M_MESH_LOD = 0x8000,
+                // Optional LOD information
+                // string strategyName;
+                // unsigned short numLevels;
+                // bool manual;  (true for manual alternate meshes, false for generated)
+                M_MESH_LOD_USAGE = 0x8100,
+                // Repeating section, ordered in increasing depth
+				// NB LOD 0 (full detail from 0 depth) is omitted
+				// LOD value - this is a distance, a pixel count etc, based on strategy
+                // float lodValue;
+                    M_MESH_LOD_MANUAL = 0x8110,
+                    // Required if M_MESH_LOD section manual = true
+                    // String manualMeshName;
+                    M_MESH_LOD_GENERATED = 0x8120,
+                    // Required if M_MESH_LOD section manual = false
+					// Repeating section (1 per submesh)
+                    // unsigned int indexCount;
+                    // bool indexes32Bit
+                    // unsigned short* faceIndexes;  (indexCount)
+                    // OR
+                    // unsigned int* faceIndexes;  (indexCount)
+            M_MESH_BOUNDS = 0x9000,
+                // float minx, miny, minz
+                // float maxx, maxy, maxz
+                // float radius
+                    
+			// Added By DrEvil
+			// optional chunk that contains a table of submesh indexes and the names of
+			// the sub-meshes.
+			M_SUBMESH_NAME_TABLE = 0xA000,
+				// Subchunks of the name table. Each chunk contains an index & string
+				M_SUBMESH_NAME_TABLE_ELEMENT = 0xA100,
+	                // short index
+                    // char* name
+			
+			// Optional chunk which stores precomputed edge data					 
+			M_EDGE_LISTS = 0xB000,
+				// Each LOD has a separate edge list
+				M_EDGE_LIST_LOD = 0xB100,
+					// unsigned short lodIndex
+					// bool isManual			// If manual, no edge data here, loaded from manual mesh
+                        // bool isClosed
+                        // unsigned long numTriangles
+                        // unsigned long numEdgeGroups
+						// Triangle* triangleList
+                            // unsigned long indexSet
+                            // unsigned long vertexSet
+                            // unsigned long vertIndex[3]
+                            // unsigned long sharedVertIndex[3] 
+                            // float normal[4] 
+
+                        M_EDGE_GROUP = 0xB110,
+                            // unsigned long vertexSet
+                            // unsigned long triStart
+                            // unsigned long triCount
+                            // unsigned long numEdges
+						    // Edge* edgeList
+                                // unsigned long  triIndex[2]
+                                // unsigned long  vertIndex[2]
+                                // unsigned long  sharedVertIndex[2]
+                                // bool degenerate
+
+			// Optional poses section, referred to by pose keyframes
+			M_POSES = 0xC000,
+				M_POSE = 0xC100,
+					// char* name (may be blank)
+					// unsigned short target	// 0 for shared geometry, 
+												// 1+ for submesh index + 1
+					// bool includesNormals [1.8+]
+					M_POSE_VERTEX = 0xC111,
+						// unsigned long vertexIndex
+						// float xoffset, yoffset, zoffset
+						// float xnormal, ynormal, znormal (optional, 1.8+)
+			// Optional vertex animation chunk
+			M_ANIMATIONS = 0xD000, 
+				M_ANIMATION = 0xD100,
+				// char* name
+				// float length
+				M_ANIMATION_BASEINFO = 0xD105,
+				// [Optional] base keyframe information (pose animation only)
+				// char* baseAnimationName (blank for self)
+				// float baseKeyFrameTime
+		
+				M_ANIMATION_TRACK = 0xD110,
+					// unsigned short type			// 1 == morph, 2 == pose
+					// unsigned short target		// 0 for shared geometry, 
+													// 1+ for submesh index + 1
+					M_ANIMATION_MORPH_KEYFRAME = 0xD111,
+						// float time
+						// bool includesNormals [1.8+]
+						// float x,y,z			// repeat by number of vertices in original geometry
+					M_ANIMATION_POSE_KEYFRAME = 0xD112,
+						// float time
+						M_ANIMATION_POSE_REF = 0xD113, // repeat for number of referenced poses
+							// unsigned short poseIndex 
+							// float influence
+
+			// Optional submesh extreme vertex list chink
+			M_TABLE_EXTREMES = 0xE000,
+			// unsigned short submesh_index;
+			// float extremes [n_extremes][3];
+
+	/* Version 1.2 of the .mesh format (deprecated)
+	enum MeshChunkID {
+        M_HEADER                = 0x1000,
+            // char*          version           : Version number check
+        M_MESH                = 0x3000,
+			// bool skeletallyAnimated   // important flag which affects h/w buffer policies
+            // Optional M_GEOMETRY chunk
+            M_SUBMESH             = 0x4000, 
+                // char* materialName
+                // bool useSharedVertices
+                // unsigned int indexCount
+                // bool indexes32Bit
+                // unsigned int* faceVertexIndices (indexCount)
+                // OR
+                // unsigned short* faceVertexIndices (indexCount)
+                // M_GEOMETRY chunk (Optional: present only if useSharedVertices = false)
+                M_SUBMESH_OPERATION = 0x4010, // optional, trilist assumed if missing
+                    // unsigned short operationType
+                M_SUBMESH_BONE_ASSIGNMENT = 0x4100,
+                    // Optional bone weights (repeating section)
+                    // unsigned int vertexIndex;
+                    // unsigned short boneIndex;
+                    // float weight;
+            M_GEOMETRY          = 0x5000, // NB this chunk is embedded within M_MESH and M_SUBMESH
+			*/
+                // unsigned int vertexCount
+                // float* pVertices (x, y, z order x numVertices)
+                M_GEOMETRY_NORMALS = 0x5100,    //(Optional)
+                    // float* pNormals (x, y, z order x numVertices)
+                M_GEOMETRY_COLOURS = 0x5200,    //(Optional)
+                    // unsigned long* pColours (RGBA 8888 format x numVertices)
+                M_GEOMETRY_TEXCOORDS = 0x5300    //(Optional, REPEATABLE, each one adds an extra set)
+                    // unsigned short dimensions    (1 for 1D, 2 for 2D, 3 for 3D)
+                    // float* pTexCoords  (u [v] [w] order, dimensions x numVertices)
+			/*
+            M_MESH_SKELETON_LINK = 0x6000,
+                // Optional link to skeleton
+                // char* skeletonName           : name of .skeleton to use
+            M_MESH_BONE_ASSIGNMENT = 0x7000,
+                // Optional bone weights (repeating section)
+                // unsigned int vertexIndex;
+                // unsigned short boneIndex;
+                // float weight;
+            M_MESH_LOD = 0x8000,
+                // Optional LOD information
+                // unsigned short numLevels;
+                // bool manual;  (true for manual alternate meshes, false for generated)
+                M_MESH_LOD_USAGE = 0x8100,
+                // Repeating section, ordered in increasing depth
+				// NB LOD 0 (full detail from 0 depth) is omitted
+                // float fromSquaredDepth;
+                    M_MESH_LOD_MANUAL = 0x8110,
+                    // Required if M_MESH_LOD section manual = true
+                    // String manualMeshName;
+                    M_MESH_LOD_GENERATED = 0x8120,
+                    // Required if M_MESH_LOD section manual = false
+					// Repeating section (1 per submesh)
+                    // unsigned int indexCount;
+                    // bool indexes32Bit
+                    // unsigned short* faceIndexes;  (indexCount)
+                    // OR
+                    // unsigned int* faceIndexes;  (indexCount)
+            M_MESH_BOUNDS = 0x9000
+                // float minx, miny, minz
+                // float maxx, maxy, maxz
+                // float radius
+
+			// Added By DrEvil
+			// optional chunk that contains a table of submesh indexes and the names of
+			// the sub-meshes.
+			M_SUBMESH_NAME_TABLE,
+				// Subchunks of the name table. Each chunk contains an index & string
+				M_SUBMESH_NAME_TABLE_ELEMENT,
+	                // short index
+                    // char* name
+
+	*/
+    };
+	/** @} */
+	/** @} */
+
+} // namespace
+
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreMeshManager.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreMeshManager.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreMeshManager.h	(revision 148)
@@ -0,0 +1,511 @@
+/*
+-----------------------------------------------------------------------------
+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 __MeshManager_H__
+#define __MeshManager_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreResourceManager.h"
+#include "OgreSingleton.h"
+#include "OgreVector3.h"
+#include "OgreHardwareBuffer.h"
+#include "OgreMesh.h"
+#include "OgrePatchMesh.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	class MeshSerializerListener;
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Resources
+	*  @{
+	*/
+	/** Handles the management of mesh resources.
+        @remarks
+            This class deals with the runtime management of
+            mesh data; like other resource managers it handles
+            the creation of resources (in this case mesh data),
+            working within a fixed memory budget.
+    */
+    class _OgreExport MeshManager: public ResourceManager, public Singleton<MeshManager>, 
+        public ManualResourceLoader
+    {
+    public:
+        MeshManager();
+        ~MeshManager();
+
+        /** Initialises the manager, only to be called by OGRE internally. */
+        void _initialise(void);
+
+		/// Get a resource by name
+		/// @see ResourceManager::getResourceByName
+		MeshPtr getByName(const String& name, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME);
+
+
+		/// Create a new mesh
+		/// @see ResourceManager::createResource
+		MeshPtr create (const String& name, const String& group,
+							bool isManual = false, ManualResourceLoader* loader = 0,
+							const NameValuePairList* createParams = 0);
+
+        /** Create a new mesh, or retrieve an existing one with the same
+            name if it already exists.
+            @param vertexBufferUsage The usage flags with which the vertex buffer(s)
+                will be created
+            @param indexBufferUsage The usage flags with which the index buffer(s) created for 
+                this mesh will be created with.
+            @param vertexBufferShadowed If true, the vertex buffers will be shadowed by system memory 
+                copies for faster read access
+            @param indexBufferShadowed If true, the index buffers will be shadowed by system memory 
+                copies for faster read access
+        @see ResourceManager::createOrRetrieve
+        */
+        ResourceCreateOrRetrieveResult createOrRetrieve(
+            const String& name,
+            const String& group,
+            bool isManual=false, ManualResourceLoader* loader=0,
+            const NameValuePairList* params=0,
+			HardwareBuffer::Usage vertexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY, 
+			HardwareBuffer::Usage indexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY, 
+			bool vertexBufferShadowed = true, bool indexBufferShadowed = true);
+
+        /** Prepares a mesh for loading from a file.  This does the IO in advance of the call to load().
+            @note
+                If the model has already been created (prepared or loaded), the existing instance
+                will be returned.
+            @remarks
+                Ogre loads model files from it's own proprietary
+                format called .mesh. This is because having a single file
+                format is better for runtime performance, and we also have
+                control over pre-processed data (such as
+                collision boxes, LOD reductions etc).
+			@param filename The name of the .mesh file
+            @param groupName The name of the resource group to assign the mesh to 
+			@param vertexBufferUsage The usage flags with which the vertex buffer(s)
+				will be created
+			@param indexBufferUsage The usage flags with which the index buffer(s) created for 
+				this mesh will be created with.
+			@param vertexBufferShadowed If true, the vertex buffers will be shadowed by system memory 
+                copies for faster read access
+			@param indexBufferShadowed If true, the index buffers will be shadowed by system memory 
+                copies for faster read access
+        */
+        MeshPtr prepare( const String& filename, const String& groupName,
+			HardwareBuffer::Usage vertexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY, 
+			HardwareBuffer::Usage indexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY, 
+			bool vertexBufferShadowed = true, bool indexBufferShadowed = true);
+
+        /** Loads a mesh from a file, making it immediately available for use.
+            @note
+                If the model has already been created (prepared or loaded), the existing instance
+                will be returned.
+            @remarks
+                Ogre loads model files from it's own proprietary
+                format called .mesh. This is because having a single file
+                format is better for runtime performance, and we also have
+                control over pre-processed data (such as
+                collision boxes, LOD reductions etc).
+			@param filename The name of the .mesh file
+            @param groupName The name of the resource group to assign the mesh to 
+			@param vertexBufferUsage The usage flags with which the vertex buffer(s)
+				will be created
+			@param indexBufferUsage The usage flags with which the index buffer(s) created for 
+				this mesh will be created with.
+			@param vertexBufferShadowed If true, the vertex buffers will be shadowed by system memory 
+                copies for faster read access
+			@param indexBufferShadowed If true, the index buffers will be shadowed by system memory 
+                copies for faster read access
+        */
+        MeshPtr load( const String& filename, const String& groupName,
+			HardwareBuffer::Usage vertexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY, 
+			HardwareBuffer::Usage indexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY, 
+			bool vertexBufferShadowed = true, bool indexBufferShadowed = true);
+
+
+        /** Creates a new Mesh specifically for manual definition rather
+            than loading from an object file. 
+		@remarks
+			Note that once you've defined your mesh, you must call Mesh::_setBounds and
+            Mesh::_setBoundingRadius in order to define the bounds of your mesh. In previous
+            versions of OGRE you could call Mesh::_updateBounds, but OGRE's support of 
+            write-only vertex buffers makes this no longer appropriate.
+        @param name The name to give the new mesh
+        @param groupName The name of the resource group to assign the mesh to 
+        @param loader ManualResourceLoader which will be called to load this mesh
+            when the time comes. It is recommended that you populate this field
+            in order that the mesh can be rebuilt should the need arise
+        */
+        MeshPtr createManual( const String& name, const String& groupName, 
+            ManualResourceLoader* loader = 0);
+
+        /** Creates a basic plane, by default majoring on the x/y axes facing positive Z.
+            @param
+                name The name to give the resulting mesh
+            @param 
+                groupName The name of the resource group to assign the mesh to 
+            @param
+                plane The orientation of the plane and distance from the origin
+            @param
+                width The width of the plane in world coordinates
+            @param
+                height The height of the plane in world coordinates
+            @param
+                xsegments The number of segments to the plane in the x direction
+            @param
+                ysegments The number of segments to the plane in the y direction
+            @param
+                normals If true, normals are created perpendicular to the plane
+            @param
+                numTexCoordSets The number of 2D texture coordinate sets created - by default the corners
+                are created to be the corner of the texture.
+            @param
+                uTile The number of times the texture should be repeated in the u direction
+            @param
+                vTile The number of times the texture should be repeated in the v direction
+            @param
+                upVector The 'Up' direction of the plane texture coordinates.
+			@param
+				vertexBufferUsage The usage flag with which the vertex buffer for this plane will be created
+			@param
+				indexBufferUsage The usage flag with which the index buffer for this plane will be created
+			@param
+				vertexShadowBuffer If this flag is set to true, the vertex buffer will be created 
+				with a system memory shadow buffer,
+				allowing you to read it back more efficiently than if it is in hardware
+			@param
+				indexShadowBuffer If this flag is set to true, the index buffer will be 
+				created with a system memory shadow buffer,
+				allowing you to read it back more efficiently than if it is in hardware
+        */
+        MeshPtr createPlane(
+            const String& name, const String& groupName, const Plane& plane,
+            Real width, Real height,
+            int xsegments = 1, int ysegments = 1,
+            bool normals = true, unsigned short numTexCoordSets = 1,
+            Real uTile = 1.0f, Real vTile = 1.0f, const Vector3& upVector = Vector3::UNIT_Y,
+			HardwareBuffer::Usage vertexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY, 
+			HardwareBuffer::Usage indexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY,
+			bool vertexShadowBuffer = true, bool indexShadowBuffer = true);
+
+        
+        /** Creates a plane, which because of it's texture coordinates looks like a curved
+			surface, useful for skies in a skybox. 
+            @param name
+                The name to give the resulting mesh
+            @param groupName
+                The name of the resource group to assign the mesh to 
+            @param plane
+                The orientation of the plane and distance from the origin
+            @param width
+                The width of the plane in world coordinates
+            @param height
+                The height of the plane in world coordinates
+            @param curvature
+				The curvature of the plane. Good values are
+                between 2 and 65. Higher values are more curved leading to
+                a smoother effect, lower values are less curved meaning
+                more distortion at the horizons but a better distance effect.
+			@param xsegments
+                The number of segments to the plane in the x direction
+            @param ysegments
+                The number of segments to the plane in the y direction
+            @param normals
+                If true, normals are created perpendicular to the plane
+            @param numTexCoordSets
+                The number of 2D texture coordinate sets created - by default the corners
+                are created to be the corner of the texture.
+            @param uTile
+                The number of times the texture should be repeated in the u direction
+            @param vTile
+                The number of times the texture should be repeated in the v direction
+            @param upVector
+                The 'Up' direction of the plane.
+            @param orientation
+                The orientation of the overall sphere that's used to create the illusion
+			@param vertexBufferUsage
+				The usage flag with which the vertex buffer for this plane will be created
+			@param indexBufferUsage
+				The usage flag with which the index buffer for this plane will be created
+			@param vertexShadowBuffer
+				If this flag is set to true, the vertex buffer will be created 
+				with a system memory shadow buffer,
+				allowing you to read it back more efficiently than if it is in hardware
+			@param indexShadowBuffer
+				If this flag is set to true, the index buffer will be 
+				created with a system memory shadow buffer,
+				allowing you to read it back more efficiently than if it is in hardware
+            @param ySegmentsToKeep The number of segments from the top of the dome
+                downwards to keep. -1 keeps all of them. This can save fillrate if
+                you cannot see much of the sky lower down.
+        */
+		MeshPtr createCurvedIllusionPlane(
+            const String& name, const String& groupName, const Plane& plane,
+            Real width, Real height, Real curvature,
+            int xsegments = 1, int ysegments = 1,
+            bool normals = true, unsigned short numTexCoordSets = 1,
+            Real uTile = 1.0f, Real vTile = 1.0f, const Vector3& upVector = Vector3::UNIT_Y,
+            const Quaternion& orientation = Quaternion::IDENTITY,
+			HardwareBuffer::Usage vertexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY, 
+			HardwareBuffer::Usage indexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY,
+			bool vertexShadowBuffer = true, bool indexShadowBuffer = true, 
+            int ySegmentsToKeep = -1);
+
+		/** Creates a genuinely curved plane, by default majoring on the x/y axes facing positive Z.
+            @param name
+                The name to give the resulting mesh
+            @param groupName
+                The name of the resource group to assign the mesh to 
+            @param plane
+                The orientation of the plane and distance from the origin
+            @param width
+                The width of the plane in world coordinates
+            @param height
+                The height of the plane in world coordinates
+			@param bow
+				The amount of 'bow' in the curved plane.  (Could also be considered the depth.)
+            @param xsegments
+                The number of segments to the plane in the x direction
+            @param ysegments
+                The number of segments to the plane in the y direction
+            @param normals
+                If true, normals are created perpendicular to the plane
+            @param numTexCoordSets
+                The number of 2D texture coordinate sets created - by default the corners
+                are created to be the corner of the texture.
+            @param uTile
+                The number of times the texture should be repeated in the u direction
+            @param vTile
+                The number of times the texture should be repeated in the v direction
+            @param upVector
+                The 'Up' direction of the plane.
+			@param vertexBufferUsage
+				The usage flag with which the vertex buffer for this plane will be created
+			@param indexBufferUsage
+				The usage flag with which the index buffer for this plane will be created
+			@param vertexShadowBuffer
+				If this flag is set to true, the vertex buffer will be created 
+				with a system memory shadow buffer,
+				allowing you to read it back more efficiently than if it is in hardware
+			@param indexShadowBuffer
+				If this flag is set to true, the index buffer will be 
+				created with a system memory shadow buffer,
+				allowing you to read it back more efficiently than if it is in hardware
+        */
+		MeshPtr createCurvedPlane( 
+			const String& name, const String& groupName, const Plane& plane, 
+			Real width, Real height, Real bow = 0.5f, 
+			int xsegments = 1, int ysegments = 1,
+			bool normals = false, unsigned short numTexCoordSets = 1, 
+			Real uTile = 1.0f, Real vTile = 1.0f, const Vector3& upVector = Vector3::UNIT_Y,
+			HardwareBuffer::Usage vertexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY, 
+			HardwareBuffer::Usage indexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY,
+			bool vertexShadowBuffer = true, bool indexShadowBuffer = true);
+
+        /** Creates a Bezier patch based on an array of control vertices.
+            @param name
+                The name to give the newly created mesh. 
+            @param groupName
+                The name of the resource group to assign the mesh to 
+            @param controlPointBuffer
+                A pointer to a buffer containing the vertex data which defines control points 
+                of the curves rather than actual vertices. Note that you are expected to provide not
+                just position information, but potentially normals and texture coordinates too. The
+                format of the buffer is defined in the VertexDeclaration parameter
+            @param declaration
+                VertexDeclaration describing the contents of the buffer. 
+                Note this declaration must _only_ draw on buffer source 0!
+            @param width
+                Specifies the width of the patch in control points.
+                Note this parameter must greater than or equal to 3.
+            @param height
+                Specifies the height of the patch in control points. 
+                Note this parameter must greater than or equal to 3.
+            @param uMaxSubdivisionLevel, vMaxSubdivisionLevel
+                If you want to manually set the top level of subdivision, 
+                do it here, otherwise let the system decide.
+            @param visibleSide 
+                Determines which side of the patch (or both) triangles are generated for.
+            @param vbUsage
+                Vertex buffer usage flags. Recommend the default since vertex buffer should be static.
+            @param ibUsage
+                Index buffer usage flags. Recommend the default since index buffer should 
+                be dynamic to change levels but not readable.
+            @param vbUseShadow
+                Flag to determine if a shadow buffer is generated for the vertex buffer. See
+                HardwareBuffer for full details.
+            @param ibUseShadow
+                Flag to determine if a shadow buffer is generated for the index buffer. See
+                HardwareBuffer for full details.
+        */
+        PatchMeshPtr createBezierPatch(
+            const String& name, const String& groupName, void* controlPointBuffer, 
+            VertexDeclaration *declaration, size_t width, size_t height,
+            size_t uMaxSubdivisionLevel = PatchSurface::AUTO_LEVEL, 
+            size_t vMaxSubdivisionLevel = PatchSurface::AUTO_LEVEL,
+            PatchSurface::VisibleSide visibleSide = PatchSurface::VS_FRONT,
+            HardwareBuffer::Usage vbUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY, 
+            HardwareBuffer::Usage ibUsage = HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY,
+            bool vbUseShadow = true, bool ibUseShadow = true);
+        
+        /** Tells the mesh manager that all future meshes should prepare themselves for
+            shadow volumes on loading.
+        */
+        void setPrepareAllMeshesForShadowVolumes(bool enable);
+        /** Retrieves whether all Meshes should prepare themselves for shadow volumes. */
+        bool getPrepareAllMeshesForShadowVolumes(void);
+
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static MeshManager& getSingleton(void);
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static MeshManager* getSingletonPtr(void);
+
+	    /** Gets the factor by which the bounding box of an entity is padded.
+	        Default is 0.01
+	    */
+        Real getBoundsPaddingFactor(void);
+	
+	    /** Sets the factor by which the bounding box of an entity is padded
+	    */
+        void setBoundsPaddingFactor(Real paddingFactor);
+
+		/** Sets the listener used to control mesh loading through the serializer.
+		*/
+		void setListener(MeshSerializerListener *listener);
+		
+		/** Gets the listener used to control mesh loading through the serializer.
+		*/
+		MeshSerializerListener *getListener();
+
+        /** @see ManualResourceLoader::loadResource */
+        void loadResource(Resource* res);
+
+    protected:
+        /// @copydoc ResourceManager::createImpl
+        Resource* createImpl(const String& name, ResourceHandle handle, 
+            const String& group, bool isManual, ManualResourceLoader* loader, 
+            const NameValuePairList* createParams);
+        
+        /** Utility method for tessellating 2D meshes.
+        */
+        void tesselate2DMesh(SubMesh* pSub, unsigned short meshWidth, unsigned short meshHeight, 
+			bool doubleSided = false, 
+			HardwareBuffer::Usage indexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY,
+			bool indexSysMem = false);
+
+        void createPrefabPlane(void);
+		void createPrefabCube(void);
+		void createPrefabSphere(void);
+    
+        /** Enum identifying the types of manual mesh built by this manager */
+        enum MeshBuildType
+        {
+            MBT_PLANE,
+            MBT_CURVED_ILLUSION_PLANE,
+            MBT_CURVED_PLANE
+        };
+        /** Saved parameters used to (re)build a manual mesh built by this class */
+        struct MeshBuildParams
+        {
+            MeshBuildType type;
+            Plane plane;
+            Real width;
+            Real height;
+            Real curvature;
+            int xsegments;
+            int ysegments;
+            bool normals;
+            unsigned short numTexCoordSets;
+            Real xTile;
+            Real yTile;
+            Vector3 upVector;
+            Quaternion orientation;
+            HardwareBuffer::Usage vertexBufferUsage;
+            HardwareBuffer::Usage indexBufferUsage;
+            bool vertexShadowBuffer;
+            bool indexShadowBuffer;
+            int ySegmentsToKeep;
+        };
+        /** Map from resource pointer to parameter set */
+        typedef map<Resource*, MeshBuildParams>::type MeshBuildParamsMap;
+        MeshBuildParamsMap mMeshBuildParams;
+
+        /** Utility method for manual loading a plane */
+        void loadManualPlane(Mesh* pMesh, MeshBuildParams& params);
+        /** Utility method for manual loading a curved plane */
+        void loadManualCurvedPlane(Mesh* pMesh, MeshBuildParams& params);
+        /** Utility method for manual loading a curved illusion plane */
+        void loadManualCurvedIllusionPlane(Mesh* pMesh, MeshBuildParams& params);
+
+        bool mPrepAllMeshesForShadowVolumes;
+	
+		//the factor by which the bounding box of an entity is padded	
+		Real mBoundsPaddingFactor;
+
+		// The listener to pass to serializers
+		MeshSerializerListener *mListener;
+    };
+
+	/** @} */
+	/** @} */
+
+} //namespace
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreMeshSerializer.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreMeshSerializer.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreMeshSerializer.h	(revision 148)
@@ -0,0 +1,209 @@
+/*
+-----------------------------------------------------------------------------
+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 __MeshSerializer_H__
+#define __MeshSerializer_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreSerializer.h"
+#include "OgreMeshSerializerImpl.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+	
+	class MeshSerializerListener;
+	
+	/// Mesh compatibility versions
+	enum MeshVersion 
+	{
+		/// Latest version available
+		MESH_VERSION_LATEST,
+		
+		/// OGRE version v1.8+
+		MESH_VERSION_1_8,
+		/// OGRE version v1.7+
+		MESH_VERSION_1_7,
+		/// OGRE version v1.4+
+		MESH_VERSION_1_4,
+		/// OGRE version v1.0+
+		MESH_VERSION_1_0,
+		
+		/// Legacy versions, DO NOT USE for writing
+		MESH_VERSION_LEGACY
+	};
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Resources
+	*  @{
+	*/
+	/** Class for serialising mesh data to/from an OGRE .mesh file.
+    @remarks
+        This class allows exporters to write OGRE .mesh files easily, and allows the
+        OGRE engine to import .mesh files into instantiated OGRE Meshes.
+        Note that a .mesh file can include not only the Mesh, but also definitions of
+        any Materials it uses (although this is optional, the .mesh can rely on the
+        Material being loaded from another source, especially useful if you want to
+        take advantage of OGRE's advanced Material properties which may not be available
+        in your modeller).
+    @par
+        To export a Mesh:<OL>
+        <LI>Use the MaterialManager methods to create any dependent Material objects, if you want
+            to export them with the Mesh.</LI>
+        <LI>Create a Mesh object and populate it using it's methods.</LI>
+        <LI>Call the exportMesh method</LI>
+        </OL>
+    @par
+        It's important to realise that this exporter uses OGRE terminology. In this context,
+        'Mesh' means a top-level mesh structure which can actually contain many SubMeshes, each
+        of which has only one Material. Modelling packages may refer to these differently, for
+        example in Milkshape, it says 'Model' instead of 'Mesh' and 'Mesh' instead of 'SubMesh', 
+        but the theory is the same.
+    */
+    class _OgreExport MeshSerializer : public Serializer
+    {
+    public:
+        MeshSerializer();
+        virtual ~MeshSerializer();
+
+
+        /** Exports a mesh to the file specified, in the latest format
+        @remarks
+            This method takes an externally created Mesh object, and exports it
+            to a .mesh file in the latest format version available.
+        @param pMesh Pointer to the Mesh to export
+        @param filename The destination filename
+		@param endianMode The endian mode of the written file
+        */
+        void exportMesh(const Mesh* pMesh, const String& filename,
+			Endian endianMode = ENDIAN_NATIVE);
+
+        /** Exports a mesh to the file specified, in a specific version format. 
+		 @remarks
+		 This method takes an externally created Mesh object, and exports it
+		 to a .mesh file in the specified format version. Note that picking a
+		 format version other that the latest will cause some information to be
+		 lost.
+		 @param pMesh Pointer to the Mesh to export
+		 @param filename The destination filename
+		 @param version Mesh version to write
+		 @param endianMode The endian mode of the written file
+		 */
+        void exportMesh(const Mesh* pMesh, const String& filename,
+						MeshVersion version,
+						Endian endianMode = ENDIAN_NATIVE);
+
+        /** Exports a mesh to the stream specified, in the latest format. 
+        @remarks
+		 This method takes an externally created Mesh object, and exports it
+		 to a .mesh file in the latest format version. 
+        @param pMesh Pointer to the Mesh to export
+        @param stream Writeable stream
+		@param endianMode The endian mode of the written file
+        */
+        void exportMesh(const Mesh* pMesh, DataStreamPtr stream,
+			Endian endianMode = ENDIAN_NATIVE);
+
+        /** Exports a mesh to the stream specified, in a specific version format. 
+		 @remarks
+		 This method takes an externally created Mesh object, and exports it
+		 to a .mesh file in the specified format version. Note that picking a
+		 format version other that the latest will cause some information to be
+		 lost.
+		 @param pMesh Pointer to the Mesh to export
+		 @param stream Writeable stream
+		 @param version Mesh version to write
+		 @param endianMode The endian mode of the written file
+		 */
+        void exportMesh(const Mesh* pMesh, DataStreamPtr stream,
+						MeshVersion version,
+						Endian endianMode = ENDIAN_NATIVE);
+        
+		/** Imports Mesh and (optionally) Material data from a .mesh file DataStream.
+        @remarks
+            This method imports data from a DataStream opened from a .mesh file and places it's
+            contents into the Mesh object which is passed in. 
+        @param stream The DataStream holding the .mesh data. Must be initialised (pos at the start of the buffer).
+        @param pDest Pointer to the Mesh object which will receive the data. Should be blank already.
+        */
+        void importMesh(DataStreamPtr& stream, Mesh* pDest);
+
+		/// Sets the listener for this serializer
+		void setListener(MeshSerializerListener *listener);
+		/// Returns the current listener
+		MeshSerializerListener *getListener();
+		
+    protected:
+		
+		class MeshVersionData : public SerializerAlloc
+		{
+		public:
+			MeshVersion version;
+			String versionString;
+			MeshSerializerImpl* impl;
+			
+			MeshVersionData(MeshVersion _ver, const String& _string, MeshSerializerImpl* _impl)
+			: version(_ver), versionString(_string), impl(_impl) {}
+			
+			~MeshVersionData() { OGRE_DELETE impl; }
+			
+		};
+
+        typedef vector<MeshVersionData*>::type MeshVersionDataList;
+        MeshVersionDataList mVersionData;
+
+		MeshSerializerListener *mListener;
+
+    };
+
+	/** 
+	 @remarks
+		This class allows users to hook into the mesh loading process and
+		modify references within the mesh as they are loading. Material and
+		skeletal references can be processed using this interface which allows
+		finer control over resources.
+	*/
+	class MeshSerializerListener
+	{
+	public:
+		virtual ~MeshSerializerListener() {}
+		/// Called to override the loading of the given named material
+		virtual void processMaterialName(Mesh *mesh, String *name) = 0;
+		/// Called to override the reference to a skeleton
+		virtual void processSkeletonName(Mesh *mesh, String *name) = 0;
+		/// Allows to do changes on mesh after it's completely loaded. For example you can generate LOD levels here.
+		virtual void processMeshCompleted(Mesh *mesh) = 0;
+	};
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreMeshSerializerImpl.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreMeshSerializerImpl.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreMeshSerializerImpl.h	(revision 148)
@@ -0,0 +1,274 @@
+/*
+-----------------------------------------------------------------------------
+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 __MeshSerializerImpl_H__
+#define __MeshSerializerImpl_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreString.h"
+#include "OgreSerializer.h"
+#include "OgreMaterial.h"
+#include "OgreMesh.h"
+#include "OgreEdgeListBuilder.h"
+
+namespace Ogre {
+	
+	class MeshSerializerListener;
+    class LodStrategy;
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Resources
+	*  @{
+	*/
+	/** Internal implementation of Mesh reading / writing for the latest version of the
+    .mesh format.
+    @remarks
+    In order to maintain compatibility with older versions of the .mesh format, there
+    will be alternative subclasses of this class to load older versions, whilst this class
+    will remain to load the latest version.
+
+	 @note
+		This mesh format was used from Ogre v1.8.
+
+    */
+    class _OgrePrivate MeshSerializerImpl : public Serializer
+    {
+    public:
+        MeshSerializerImpl();
+        virtual ~MeshSerializerImpl();
+        /** Exports a mesh to the file specified. 
+        @remarks
+        This method takes an externally created Mesh object, and exports both it
+        and optionally the Materials it uses to a .mesh file.
+        @param pMesh Pointer to the Mesh to export
+        @param stream The destination stream
+		@param endianMode The endian mode for the written file
+        */
+        void exportMesh(const Mesh* pMesh, DataStreamPtr stream,
+			Endian endianMode = ENDIAN_NATIVE);
+
+        /** Imports Mesh and (optionally) Material data from a .mesh file DataStream.
+        @remarks
+        This method imports data from a DataStream opened from a .mesh file and places it's
+        contents into the Mesh object which is passed in. 
+        @param stream The DataStream holding the .mesh data. Must be initialised (pos at the start of the buffer).
+        @param pDest Pointer to the Mesh object which will receive the data. Should be blank already.
+        */
+        void importMesh(DataStreamPtr& stream, Mesh* pDest, MeshSerializerListener *listener);
+
+    protected:
+
+        // Internal methods
+        virtual void writeSubMeshNameTable(const Mesh* pMesh);
+        virtual void writeMesh(const Mesh* pMesh);
+        virtual void writeSubMesh(const SubMesh* s);
+        virtual void writeSubMeshOperation(const SubMesh* s);
+        virtual void writeSubMeshTextureAliases(const SubMesh* s);
+        virtual void writeGeometry(const VertexData* pGeom);
+        virtual void writeSkeletonLink(const String& skelName);
+        virtual void writeMeshBoneAssignment(const VertexBoneAssignment& assign);
+        virtual void writeSubMeshBoneAssignment(const VertexBoneAssignment& assign);
+        virtual void writeLodInfo(const Mesh* pMesh);
+        virtual void writeLodSummary(unsigned short numLevels, bool manual, const LodStrategy *strategy);
+        virtual void writeLodUsageManual(const MeshLodUsage& usage);
+        virtual void writeLodUsageGenerated(const Mesh* pMesh, const MeshLodUsage& usage, unsigned short lodNum);
+        virtual void writeBoundsInfo(const Mesh* pMesh);
+        virtual void writeEdgeList(const Mesh* pMesh);
+		virtual void writeAnimations(const Mesh* pMesh);
+		virtual void writeAnimation(const Animation* anim);
+		virtual void writePoses(const Mesh* pMesh);
+		virtual void writePose(const Pose* pose);
+		virtual void writeAnimationTrack(const VertexAnimationTrack* track);
+		virtual void writeMorphKeyframe(const VertexMorphKeyFrame* kf, size_t vertexCount);
+		virtual void writePoseKeyframe(const VertexPoseKeyFrame* kf);
+		virtual void writePoseKeyframePoseRef(const VertexPoseKeyFrame::PoseRef& poseRef);
+        virtual void writeExtremes(const Mesh *pMesh);
+        virtual void writeSubMeshExtremes(unsigned short idx, const SubMesh* s);
+
+        virtual size_t calcMeshSize(const Mesh* pMesh);
+        virtual size_t calcSubMeshSize(const SubMesh* pSub);
+        virtual size_t calcGeometrySize(const VertexData* pGeom);
+        virtual size_t calcSkeletonLinkSize(const String& skelName);
+        virtual size_t calcBoneAssignmentSize(void);
+        virtual size_t calcSubMeshOperationSize(const SubMesh* pSub);
+        virtual size_t calcSubMeshNameTableSize(const Mesh* pMesh);
+        virtual size_t calcEdgeListSize(const Mesh* pMesh);
+        virtual size_t calcEdgeListLodSize(const EdgeData* data, bool isManual);
+        virtual size_t calcEdgeGroupSize(const EdgeData::EdgeGroup& group);
+		virtual size_t calcPosesSize(const Mesh* pMesh);
+		virtual size_t calcPoseSize(const Pose* pose);
+		virtual size_t calcAnimationsSize(const Mesh* pMesh);
+		virtual size_t calcAnimationSize(const Animation* anim);
+		virtual size_t calcAnimationTrackSize(const VertexAnimationTrack* track);
+		virtual size_t calcMorphKeyframeSize(const VertexMorphKeyFrame* kf, size_t vertexCount);
+		virtual size_t calcPoseKeyframeSize(const VertexPoseKeyFrame* kf);
+		virtual size_t calcPoseKeyframePoseRefSize(void);
+		virtual size_t calcPoseVertexSize(const Pose* pose);
+        virtual size_t calcSubMeshTextureAliasesSize(const SubMesh* pSub);
+
+
+        virtual void readTextureLayer(DataStreamPtr& stream, Mesh* pMesh, MaterialPtr& pMat);
+        virtual void readSubMeshNameTable(DataStreamPtr& stream, Mesh* pMesh);
+        virtual void readMesh(DataStreamPtr& stream, Mesh* pMesh, MeshSerializerListener *listener);
+        virtual void readSubMesh(DataStreamPtr& stream, Mesh* pMesh, MeshSerializerListener *listener);
+        virtual void readSubMeshOperation(DataStreamPtr& stream, Mesh* pMesh, SubMesh* sub);
+        virtual void readSubMeshTextureAlias(DataStreamPtr& stream, Mesh* pMesh, SubMesh* sub);
+        virtual void readGeometry(DataStreamPtr& stream, Mesh* pMesh, VertexData* dest);
+        virtual void readGeometryVertexDeclaration(DataStreamPtr& stream, Mesh* pMesh, VertexData* dest);
+        virtual void readGeometryVertexElement(DataStreamPtr& stream, Mesh* pMesh, VertexData* dest);
+        virtual void readGeometryVertexBuffer(DataStreamPtr& stream, Mesh* pMesh, VertexData* dest);
+
+        virtual void readSkeletonLink(DataStreamPtr& stream, Mesh* pMesh, MeshSerializerListener *listener);
+        virtual void readMeshBoneAssignment(DataStreamPtr& stream, Mesh* pMesh);
+        virtual void readSubMeshBoneAssignment(DataStreamPtr& stream, Mesh* pMesh, 
+            SubMesh* sub);
+        virtual void readMeshLodInfo(DataStreamPtr& stream, Mesh* pMesh);
+        virtual void readMeshLodUsageManual(DataStreamPtr& stream, Mesh* pMesh, 
+            unsigned short lodNum, MeshLodUsage& usage);
+        virtual void readMeshLodUsageGenerated(DataStreamPtr& stream, Mesh* pMesh, 
+            unsigned short lodNum, MeshLodUsage& usage);
+        virtual void readBoundsInfo(DataStreamPtr& stream, Mesh* pMesh);
+        virtual void readEdgeList(DataStreamPtr& stream, Mesh* pMesh);
+        virtual void readEdgeListLodInfo(DataStreamPtr& stream, EdgeData* edgeData);
+		virtual void readPoses(DataStreamPtr& stream, Mesh* pMesh);
+		virtual void readPose(DataStreamPtr& stream, Mesh* pMesh);
+		virtual void readAnimations(DataStreamPtr& stream, Mesh* pMesh);
+		virtual void readAnimation(DataStreamPtr& stream, Mesh* pMesh);
+		virtual void readAnimationTrack(DataStreamPtr& stream, Animation* anim, 
+			Mesh* pMesh);
+		virtual void readMorphKeyFrame(DataStreamPtr& stream, VertexAnimationTrack* track);
+		virtual void readPoseKeyFrame(DataStreamPtr& stream, VertexAnimationTrack* track);
+		virtual void readExtremes(DataStreamPtr& stream, Mesh *pMesh);
+
+
+        /// Flip an entire vertex buffer from little endian
+        virtual void flipFromLittleEndian(void* pData, size_t vertexCount, size_t vertexSize, const VertexDeclaration::VertexElementList& elems);
+        /// Flip an entire vertex buffer to little endian
+        virtual void flipToLittleEndian(void* pData, size_t vertexCount, size_t vertexSize, const VertexDeclaration::VertexElementList& elems);
+        /// Flip the endianness of an entire vertex buffer, passed in as a 
+        /// pointer to locked or temporary memory 
+        virtual void flipEndian(void* pData, size_t vertexCount, size_t vertexSize, const VertexDeclaration::VertexElementList& elems);
+
+
+
+    };
+
+    /** Class for providing backwards-compatibility for loading version 1.41 of the .mesh format. 
+	 This mesh format was used from Ogre v1.7.
+	 */
+    class _OgrePrivate MeshSerializerImpl_v1_41 : public MeshSerializerImpl
+    {
+    public:
+        MeshSerializerImpl_v1_41();
+        ~MeshSerializerImpl_v1_41();
+    protected:
+		void writeMorphKeyframe(const VertexMorphKeyFrame* kf, size_t vertexCount);
+		void readMorphKeyFrame(DataStreamPtr& stream, VertexAnimationTrack* track);
+		void writePose(const Pose* pose);
+		void readPose(DataStreamPtr& stream, Mesh* pMesh);
+		size_t calcMorphKeyframeSize(const VertexMorphKeyFrame* kf, size_t vertexCount);
+		size_t calcPoseSize(const Pose* pose);
+		size_t calcPoseVertexSize(void);
+    };
+
+    /** Class for providing backwards-compatibility for loading version 1.4 of the .mesh format. 
+	 This mesh format was used from Ogre v1.4.
+	 */
+    class _OgrePrivate MeshSerializerImpl_v1_4 : public MeshSerializerImpl_v1_41
+    {
+    public:
+        MeshSerializerImpl_v1_4();
+        ~MeshSerializerImpl_v1_4();
+    protected:
+        virtual void writeLodSummary(unsigned short numLevels, bool manual, const LodStrategy *strategy);
+		virtual void writeLodUsageManual(const MeshLodUsage& usage);
+		virtual void writeLodUsageGenerated(const Mesh* pMesh, const MeshLodUsage& usage,
+									unsigned short lodNum);
+
+        virtual void readMeshLodInfo(DataStreamPtr& stream, Mesh* pMesh);
+    };
+
+    /** Class for providing backwards-compatibility for loading version 1.3 of the .mesh format. 
+	 This mesh format was used from Ogre v1.0 (and some pre-releases)
+	 */
+    class _OgrePrivate MeshSerializerImpl_v1_3 : public MeshSerializerImpl_v1_4
+    {
+    public:
+        MeshSerializerImpl_v1_3();
+        ~MeshSerializerImpl_v1_3();
+    protected:
+        virtual void readEdgeListLodInfo(DataStreamPtr& stream, EdgeData* edgeData);
+
+        /// Reorganise triangles of the edge list to group by vertex set
+        virtual void reorganiseTriangles(EdgeData* edgeData);
+		
+		virtual void writeEdgeList(const Mesh* pMesh);
+    };
+
+    /** Class for providing backwards-compatibility for loading version 1.2 of the .mesh format. 
+	 This is a LEGACY FORMAT that pre-dates version Ogre 1.0
+	 */
+    class _OgrePrivate MeshSerializerImpl_v1_2 : public MeshSerializerImpl_v1_3
+    {
+    public:
+        MeshSerializerImpl_v1_2();
+        ~MeshSerializerImpl_v1_2();
+    protected:
+        virtual void readMesh(DataStreamPtr& stream, Mesh* pMesh, MeshSerializerListener *listener);
+        virtual void readGeometry(DataStreamPtr& stream, Mesh* pMesh, VertexData* dest);
+        virtual void readGeometryPositions(unsigned short bindIdx, DataStreamPtr& stream, 
+            Mesh* pMesh, VertexData* dest);
+        virtual void readGeometryNormals(unsigned short bindIdx, DataStreamPtr& stream, 
+            Mesh* pMesh, VertexData* dest);
+        virtual void readGeometryColours(unsigned short bindIdx, DataStreamPtr& stream, 
+            Mesh* pMesh, VertexData* dest);
+        virtual void readGeometryTexCoords(unsigned short bindIdx, DataStreamPtr& stream, 
+            Mesh* pMesh, VertexData* dest, unsigned short set);
+    };
+
+    /** Class for providing backwards-compatibility for loading version 1.1 of the .mesh format. 
+	 This is a LEGACY FORMAT that pre-dates version Ogre 1.0
+	 */
+    class _OgrePrivate MeshSerializerImpl_v1_1 : public MeshSerializerImpl_v1_2
+    {
+    public:
+        MeshSerializerImpl_v1_1();
+        ~MeshSerializerImpl_v1_1();
+    protected:
+        void readGeometryTexCoords(unsigned short bindIdx, DataStreamPtr& stream, 
+            Mesh* pMesh, VertexData* dest, unsigned short set);
+    };
+
+	/** @} */
+	/** @} */
+
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreMovableObject.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreMovableObject.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreMovableObject.h	(revision 148)
@@ -0,0 +1,645 @@
+/*
+-----------------------------------------------------------------------------
+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 __MovableObject_H__
+#define __MovableObject_H__
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+#include "OgreRenderQueue.h"
+#include "OgreAxisAlignedBox.h"
+#include "OgreSphere.h"
+#include "OgreShadowCaster.h"
+#include "OgreFactoryObj.h"
+#include "OgreAnimable.h"
+#include "OgreAny.h"
+#include "OgreUserObjectBindings.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	// Forward declaration
+	class MovableObjectFactory;
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Scene
+	*  @{
+	*/
+	/** Abstract class defining a movable object in a scene.
+        @remarks
+            Instances of this class are discrete, relatively small, movable objects
+            which are attached to SceneNode objects to define their position.
+    */
+    class _OgreExport MovableObject : public ShadowCaster, public AnimableObject, public MovableAlloc
+    {
+    public:
+        /** Listener which gets called back on MovableObject events.
+        */
+        class _OgreExport Listener
+        {
+        public:
+            Listener(void) {}
+            virtual ~Listener() {}
+            /** MovableObject is being destroyed */
+            virtual void objectDestroyed(MovableObject*) {}
+            /** MovableObject has been attached to a node */
+            virtual void objectAttached(MovableObject*) {}
+            /** MovableObject has been detached from a node */
+            virtual void objectDetached(MovableObject*) {}
+            /** MovableObject has been moved */
+            virtual void objectMoved(MovableObject*) {}
+            /** Called when the movable object of the camera to be used for rendering.
+            @return
+                true if allows queue for rendering, false otherwise.
+            */
+            virtual bool objectRendering(const MovableObject*, const Camera*) { return true; }
+            /** Called when the movable object needs to query a light list.
+            @remarks
+                If you want to customize light finding for this object, you should override 
+				this method and hook into MovableObject via MovableObject::setListener.
+				Be aware that the default method caches results within a frame to 
+				prevent unnecessary recalculation, so if you override this you 
+				should provide your own caching to maintain performance.
+			@note
+				If you use texture shadows, there is an additional restriction - 
+				since the lights which should have shadow textures rendered for
+				them are determined based on the entire frustum, and not per-object,
+				it is important that the lights returned at the start of this 
+				list (up to the number of shadow textures available) are the same 
+				lights that were used to generate the shadow textures, 
+				and they are in the same order (particularly for additive effects).
+			@note
+				This method will not be called for additive stencil shadows since the
+				light list cannot be varied per object with this technique.
+            @return
+                A pointer to a light list if you populated the light list yourself, or
+                NULL to fall back on the default finding process.
+            */
+            virtual const LightList* objectQueryLights(const MovableObject*) { return 0; }
+        };
+
+    protected:
+		/// Name of this object
+		String mName;
+		/// Creator of this object (if created by a factory)
+		MovableObjectFactory* mCreator;
+		/// SceneManager holding this object (if applicable)
+		SceneManager* mManager;
+        /// node to which this object is attached
+        Node* mParentNode;
+        bool mParentIsTagPoint;
+        /// Is this object visible?
+        bool mVisible;
+		/// Is debug display enabled?
+		bool mDebugDisplay;
+		/// Upper distance to still render
+		Real mUpperDistance;
+		Real mSquaredUpperDistance;
+		// Minimum pixel size to still render
+		Real mMinPixelSize;
+		/// Hidden because of distance?
+		bool mBeyondFarDistance;	
+		/// User objects binding.
+		UserObjectBindings mUserObjectBindings;
+        /// The render queue to use when rendering this object
+        uint8 mRenderQueueID;
+		/// Flags whether the RenderQueue's default should be used.
+		bool mRenderQueueIDSet;
+		/// The render queue group to use when rendering this object
+		ushort mRenderQueuePriority;
+		/// Flags whether the RenderQueue's default should be used.
+		bool mRenderQueuePrioritySet;
+        /// Flags determining whether this object is included / excluded from scene queries
+        uint32 mQueryFlags;
+        /// Flags determining whether this object is visible (compared to SceneManager mask)
+        uint32 mVisibilityFlags;
+        /// Cached world AABB of this object
+        mutable AxisAlignedBox mWorldAABB;
+		// Cached world bounding sphere
+		mutable Sphere mWorldBoundingSphere;
+        /// World space AABB of this object's dark cap
+        mutable AxisAlignedBox mWorldDarkCapBounds;
+        /// Does this object cast shadows?
+        bool mCastShadows;
+
+        /// Does rendering this object disabled by listener?
+        bool mRenderingDisabled;
+        /// MovableObject listener - only one allowed (no list) for size & performance reasons. */
+        Listener* mListener;
+
+        /// List of lights for this object
+        mutable LightList mLightList;
+        /// The last frame that this light list was updated in
+        mutable ulong mLightListUpdated;
+
+		/// the light mask defined for this movable. This will be taken into consideration when deciding which light should affect this movable
+		uint32 mLightMask;
+
+		// Static members
+		/// Default query flags
+		static uint32 msDefaultQueryFlags;
+		/// Default visibility flags
+		static uint32 msDefaultVisibilityFlags;
+
+
+
+    public:
+        /// Constructor
+        MovableObject();
+
+		/// Named constructor
+		MovableObject(const String& name);
+        /** Virtual destructor - read Scott Meyers if you don't know why this is needed.
+        */
+        virtual ~MovableObject();
+
+		/** Notify the object of it's creator (internal use only) */
+		virtual void _notifyCreator(MovableObjectFactory* fact) { mCreator = fact; }
+		/** Get the creator of this object, if any (internal use only) */
+		virtual MovableObjectFactory*  _getCreator(void) const { return mCreator; }
+		/** Notify the object of it's manager (internal use only) */
+		virtual void _notifyManager(SceneManager* man) { mManager = man; }
+		/** Get the manager of this object, if any (internal use only) */
+		virtual SceneManager* _getManager(void) const { return mManager; }
+
+        /** Returns the name of this object. */
+		virtual const String& getName(void) const { return mName; }
+
+        /** Returns the type name of this object. */
+        virtual const String& getMovableType(void) const = 0;
+
+        /** Returns the node to which this object is attached.
+        @remarks
+            A MovableObject may be attached to either a SceneNode or to a TagPoint, 
+            the latter case if it's attached to a bone on an animated entity. 
+            Both are Node subclasses so this method will return either.
+        */
+        virtual Node* getParentNode(void) const;
+
+        /** Returns the scene node to which this object is attached.
+        @remarks
+            A MovableObject may be attached to either a SceneNode or to a TagPoint, 
+            the latter case if it's attached to a bone on an animated entity. 
+            This method will return the scene node of the parent entity 
+            if the latter is true.
+        */
+        virtual SceneNode* getParentSceneNode(void) const;
+
+		/// Gets whether the parent node is a TagPoint (or a SceneNode)
+		virtual bool isParentTagPoint() const { return mParentIsTagPoint; }
+
+        /** Internal method called to notify the object that it has been attached to a node.
+        */
+        virtual void _notifyAttached(Node* parent, bool isTagPoint = false);
+
+        /** Returns true if this object is attached to a SceneNode or TagPoint. */
+        virtual bool isAttached(void) const;
+
+		/** Detaches an object from a parent SceneNode or TagPoint, if attached. */
+		virtual void detachFromParent(void);
+
+        /** Returns true if this object is attached to a SceneNode or TagPoint, 
+			and this SceneNode / TagPoint is currently in an active part of the
+			scene graph. */
+        virtual bool isInScene(void) const;
+
+        /** Internal method called to notify the object that it has been moved.
+        */
+        virtual void _notifyMoved(void);
+
+		/** Internal method to notify the object of the camera to be used for the next rendering operation.
+            @remarks
+                Certain objects may want to do specific processing based on the camera position. This method notifies
+                them in case they wish to do this.
+        */
+        virtual void _notifyCurrentCamera(Camera* cam);
+
+        /** Retrieves the local axis-aligned bounding box for this object.
+            @remarks
+                This bounding box is in local coordinates.
+        */
+        virtual const AxisAlignedBox& getBoundingBox(void) const = 0;
+
+		/** Retrieves the radius of the origin-centered bounding sphere 
+		 	 for this object.
+		*/
+		virtual Real getBoundingRadius(void) const = 0;
+
+        /** Retrieves the axis-aligned bounding box for this object in world coordinates. */
+        virtual const AxisAlignedBox& getWorldBoundingBox(bool derive = false) const;
+		/** Retrieves the worldspace bounding sphere for this object. */
+        virtual const Sphere& getWorldBoundingSphere(bool derive = false) const;
+        /** Internal method by which the movable object must add Renderable subclass instances to the rendering queue.
+            @remarks
+                The engine will call this method when this object is to be rendered. The object must then create one or more
+                Renderable subclass instances which it places on the passed in Queue for rendering.
+        */
+        virtual void _updateRenderQueue(RenderQueue* queue) = 0;
+
+        /** Tells this object whether to be visible or not, if it has a renderable component. 
+		@note An alternative approach of making an object invisible is to detach it
+			from it's SceneNode, or to remove the SceneNode entirely. 
+			Detaching a node means that structurally the scene graph changes. 
+			Once this change has taken place, the objects / nodes that have been 
+			removed have less overhead to the visibility detection pass than simply
+			making the object invisible, so if you do this and leave the objects 
+			out of the tree for a long time, it's faster. However, the act of 
+			detaching / reattaching nodes is in itself more expensive than 
+			setting an object visibility flag, since in the latter case 
+			structural changes are not made. Therefore, small or frequent visibility
+			changes are best done using this method; large or more longer term
+			changes are best done by detaching.
+		*/
+        virtual void setVisible(bool visible);
+
+        /** Gets this object whether to be visible or not, if it has a renderable component. 
+        @remarks
+            Returns the value set by MovableObject::setVisible only.
+        */
+        virtual bool getVisible(void) const;
+
+        /** Returns whether or not this object is supposed to be visible or not. 
+		@remarks
+			Takes into account both upper rendering distance and visible flag.
+		*/
+        virtual bool isVisible(void) const;
+
+		/** Sets the distance at which the object is no longer rendered.
+		@note Camera::setUseRenderingDistance() needs to be called for this parameter to be used.
+		@param dist Distance beyond which the object will not be rendered 
+			(the default is 0, which means objects are always rendered).
+		*/
+		virtual void setRenderingDistance(Real dist) { 
+			mUpperDistance = dist; 
+			mSquaredUpperDistance = mUpperDistance * mUpperDistance;
+		}
+
+		/** Gets the distance at which batches are no longer rendered. */
+		virtual Real getRenderingDistance(void) const { return mUpperDistance; }		
+
+		/** Sets the minimum pixel size an object needs to be in both screen axes in order to be rendered
+		@note Camera::setUseMinPixelSize() needs to be called for this parameter to be used.
+		@param pixelSize Number of minimum pixels
+			(the default is 0, which means objects are always rendered).
+		*/
+		virtual void setRenderingMinPixelSize(Real pixelSize) { 
+			mMinPixelSize = pixelSize; 
+		}
+
+		/** Returns the minimum pixel size an object needs to be in both screen axes in order to be rendered
+		*/
+		virtual Real getRenderingMinPixelSize() const { 
+			return mMinPixelSize; 
+		}
+
+		/** @deprecated use UserObjectBindings::setUserAny via getUserObjectBindings() instead.
+			Sets any kind of user value on this object.
+		@remarks
+			This method allows you to associate any user value you like with 
+			this MovableObject. This can be a pointer back to one of your own
+			classes for instance.		
+		*/
+		OGRE_DEPRECATED virtual void setUserAny(const Any& anything) { getUserObjectBindings().setUserAny(anything); }
+
+		/** @deprecated use UserObjectBindings::getUserAny via getUserObjectBindings() instead.
+			Retrieves the custom user value associated with this object.
+		*/
+		OGRE_DEPRECATED virtual const Any& getUserAny(void) const { return getUserObjectBindings().getUserAny(); }
+
+		/** Return an instance of user objects binding associated with this class.
+		You can use it to associate one or more custom objects with this class instance.
+		@see UserObjectBindings::setUserAny.		
+		*/
+		UserObjectBindings&	getUserObjectBindings() { return mUserObjectBindings; }
+
+		/** Return an instance of user objects binding associated with this class.
+		You can use it to associate one or more custom objects with this class instance.
+		@see UserObjectBindings::setUserAny.		
+		*/
+		const UserObjectBindings& getUserObjectBindings() const { return mUserObjectBindings; }
+
+        /** Sets the render queue group this entity will be rendered through.
+        @remarks
+            Render queues are grouped to allow you to more tightly control the ordering
+            of rendered objects. If you do not call this method, all Entity objects default
+            to the default queue (RenderQueue::getDefaultQueueGroup), which is fine for most objects. You may want to alter this
+            if you want this entity to always appear in front of other objects, e.g. for
+            a 3D menu system or such.
+        @par
+            See RenderQueue for more details.
+        @param queueID Enumerated value of the queue group to use. See the
+			enum RenderQueueGroupID for what kind of values can be used here.
+        */
+        virtual void setRenderQueueGroup(uint8 queueID);
+
+		/** Sets the render queue group and group priority this entity will be rendered through.
+		@remarks
+			Render queues are grouped to allow you to more tightly control the ordering
+			of rendered objects. Within a single render group there another type of grouping
+			called priority which allows further control.  If you do not call this method, 
+			all Entity objects default to the default queue and priority 
+			(RenderQueue::getDefaultQueueGroup, RenderQueue::getDefaultRenderablePriority), 
+			which is fine for most objects. You may want to alter this if you want this entity 
+			to always appear in front of other objects, e.g. for a 3D menu system or such.
+		@par
+			See RenderQueue for more details.
+		@param queueID Enumerated value of the queue group to use. See the
+			enum RenderQueueGroupID for what kind of values can be used here.
+		@param priority The priority within a group to use.
+		*/
+		virtual void setRenderQueueGroupAndPriority(uint8 queueID, ushort priority);
+
+        /** Gets the queue group for this entity, see setRenderQueueGroup for full details. */
+        virtual uint8 getRenderQueueGroup(void) const;
+
+		/// return the full transformation of the parent sceneNode or the attachingPoint node
+		virtual const Matrix4& _getParentNodeFullTransform(void) const;
+
+        /** Sets the query flags for this object.
+        @remarks
+            When performing a scene query, this object will be included or excluded according
+            to flags on the object and flags on the query. This is a bitwise value, so only when
+            a bit on these flags is set, will it be included in a query asking for that flag. The
+            meaning of the bits is application-specific.
+        */
+        virtual void setQueryFlags(uint32 flags) { mQueryFlags = flags; }
+
+        /** As setQueryFlags, except the flags passed as parameters are appended to the
+        existing flags on this object. */
+        virtual void addQueryFlags(uint32 flags) { mQueryFlags |= flags; }
+            
+        /** As setQueryFlags, except the flags passed as parameters are removed from the
+        existing flags on this object. */
+        virtual void removeQueryFlags(uint32 flags) { mQueryFlags &= ~flags; }
+        
+        /// Returns the query flags relevant for this object
+        virtual uint32 getQueryFlags(void) const { return mQueryFlags; }
+
+		/** Set the default query flags for all future MovableObject instances.
+		*/
+		static void setDefaultQueryFlags(uint32 flags) { msDefaultQueryFlags = flags; }
+
+		/** Get the default query flags for all future MovableObject instances.
+		*/
+		static uint32 getDefaultQueryFlags() { return msDefaultQueryFlags; }
+
+		
+        /** Sets the visibility flags for this object.
+        @remarks
+			As well as a simple true/false value for visibility (as seen in setVisible), 
+			you can also set visibility flags which when 'and'ed with the SceneManager's
+			visibility mask can also make an object invisible.
+        */
+        virtual void setVisibilityFlags(uint32 flags) { mVisibilityFlags = flags; }
+
+        /** As setVisibilityFlags, except the flags passed as parameters are appended to the
+        existing flags on this object. */
+        virtual void addVisibilityFlags(uint32 flags) { mVisibilityFlags |= flags; }
+            
+        /** As setVisibilityFlags, except the flags passed as parameters are removed from the
+        existing flags on this object. */
+        virtual void removeVisibilityFlags(uint32 flags) { mVisibilityFlags &= ~flags; }
+        
+        /// Returns the visibility flags relevant for this object
+        virtual uint32 getVisibilityFlags(void) const { return mVisibilityFlags; }
+
+		/** Set the default visibility flags for all future MovableObject instances.
+		*/
+		static void setDefaultVisibilityFlags(uint32 flags) { msDefaultVisibilityFlags = flags; }
+		
+		/** Get the default visibility flags for all future MovableObject instances.
+		*/
+		static uint32 getDefaultVisibilityFlags() { return msDefaultVisibilityFlags; }
+
+        /** Sets a listener for this object.
+        @remarks
+            Note for size and performance reasons only one listener per object
+            is allowed.
+        */
+        virtual void setListener(Listener* listener) { mListener = listener; }
+
+        /** Gets the current listener for this object.
+        */
+        virtual Listener* getListener(void) const { return mListener; }
+
+        /** Gets a list of lights, ordered relative to how close they are to this movable object.
+        @remarks
+            By default, this method gives the listener a chance to populate light list first,
+            if there is no listener or Listener::objectQueryLights returns NULL, it'll
+            query the light list from parent entity if it is present, or returns
+            SceneNode::findLights if it has parent scene node, otherwise it just returns
+            an empty list.
+        @par
+            The object internally caches the light list, so it will recalculate
+			it only when object is moved, or lights that affect the frustum have
+			been changed (@see SceneManager::_getLightsDirtyCounter),
+            but if listener exists, it will be called each time, so the listener 
+			should implement their own cache mechanism to optimise performance.
+        @par
+            This method can be useful when implementing Renderable::getLights in case
+            the renderable is a part of the movable.
+        @return The list of lights use to lighting this object.
+        */
+        virtual const LightList& queryLights(void) const;
+
+		/** Get a bitwise mask which will filter the lights affecting this object
+		@remarks
+		By default, this mask is fully set meaning all lights will affect this object
+		*/
+		virtual uint32 getLightMask()const { return mLightMask; }
+		/** Set a bitwise mask which will filter the lights affecting this object
+		@remarks
+		This mask will be compared against the mask held against Light to determine
+		if a light should affect a given object. 
+		By default, this mask is fully set meaning all lights will affect this object
+		*/
+		virtual void setLightMask(uint32 lightMask);
+
+		/** Returns a pointer to the current list of lights for this object.
+		@remarks
+			You should not modify this list outside of MovableObject::Listener::objectQueryLights
+			(say if you want to use it to implement this method, and use the pointer
+			as a return value) and for reading it's only accurate as at the last frame.
+		*/
+		virtual LightList* _getLightList() { return &mLightList; }
+
+		/// Define a default implementation of method from ShadowCaster which implements no shadows
+        EdgeData* getEdgeList(void) { return NULL; }
+		/// Define a default implementation of method from ShadowCaster which implements no shadows
+		bool hasEdgeList(void) { return false; }
+        /// Define a default implementation of method from ShadowCaster which implements no shadows
+        ShadowRenderableListIterator getShadowVolumeRenderableIterator(
+            ShadowTechnique shadowTechnique, const Light* light, 
+            HardwareIndexBufferSharedPtr* indexBuffer, size_t* indexBufferUsedSize,
+            bool extrudeVertices, Real extrusionDist, unsigned long flags = 0);
+		
+        /** Overridden member from ShadowCaster. */
+        const AxisAlignedBox& getLightCapBounds(void) const;
+        /** Overridden member from ShadowCaster. */
+        const AxisAlignedBox& getDarkCapBounds(const Light& light, Real dirLightExtrusionDist) const;
+        /** Sets whether or not this object will cast shadows.
+        @remarks
+        This setting simply allows you to turn on/off shadows for a given object.
+        An object will not cast shadows unless the scene supports it in any case
+        (see SceneManager::setShadowTechnique), and also the material which is
+        in use must also have shadow casting enabled. By default all entities cast
+        shadows. If, however, for some reason you wish to disable this for a single 
+        object then you can do so using this method.
+        @note This method normally refers to objects which block the light, but
+        since Light is also a subclass of MovableObject, in that context it means
+        whether the light causes shadows itself.
+        */
+        void setCastShadows(bool enabled) { mCastShadows = enabled; }
+        /** Returns whether shadow casting is enabled for this object. */
+        bool getCastShadows(void) const { return mCastShadows; }
+		/** Returns whether the Material of any Renderable that this MovableObject will add to 
+			the render queue will receive shadows. 
+		*/
+		bool getReceivesShadows();
+			
+        /** Get the distance to extrude for a point/spot light */
+        Real getPointExtrusionDistance(const Light* l) const;
+		/** Get the 'type flags' for this MovableObject.
+		@remarks
+			A type flag identifies the type of the MovableObject as a bitpattern. 
+			This is used for categorical inclusion / exclusion in SceneQuery
+			objects. By default, this method returns all ones for objects not 
+			created by a MovableObjectFactory (hence always including them); 
+			otherwise it returns the value assigned to the MovableObjectFactory.
+			Custom objects which don't use MovableObjectFactory will need to 
+			override this if they want to be included in queries.
+		*/
+		virtual uint32 getTypeFlags(void) const;
+
+		/** Method to allow a caller to abstractly iterate over the Renderable
+			instances that this MovableObject will add to the render queue when
+			asked, if any. 
+		@param visitor Pointer to a class implementing the Renderable::Visitor 
+			interface which will be called back for each Renderable which will
+			be queued. Bear in mind that the state of the Renderable instances
+			may not be finalised depending on when you call this.
+		@param debugRenderables If false, only regular renderables will be visited
+			(those for normal display). If true, debug renderables will be
+			included too.
+		*/
+		virtual void visitRenderables(Renderable::Visitor* visitor, 
+			bool debugRenderables = false) = 0;
+
+		/** Sets whether or not the debug display of this object is enabled.
+		@remarks
+			Some objects aren't visible themselves but it can be useful to display
+			a debug representation of them. Or, objects may have an additional 
+			debug display on top of their regular display. This option enables / 
+			disables that debug display. Objects that are not visible never display
+			debug geometry regardless of this setting.
+		*/
+		virtual void setDebugDisplayEnabled(bool enabled) { mDebugDisplay = enabled; }
+		/// Gets whether debug display of this object is enabled. 
+		virtual bool isDebugDisplayEnabled(void) const { return mDebugDisplay; }
+
+
+
+
+
+    };
+
+	/** Interface definition for a factory class which produces a certain
+		kind of MovableObject, and can be registered with Root in order
+		to allow all clients to produce new instances of this object, integrated
+		with the standard Ogre processing.
+	*/
+	class _OgreExport MovableObjectFactory : public MovableAlloc
+	{
+	protected:
+		/// Type flag, allocated if requested
+		uint32 mTypeFlag;
+
+		/// Internal implementation of create method - must be overridden
+		virtual MovableObject* createInstanceImpl(
+			const String& name, const NameValuePairList* params = 0) = 0;
+	public:
+		MovableObjectFactory() : mTypeFlag(0xFFFFFFFF) {}
+		virtual ~MovableObjectFactory() {}
+		/// Get the type of the object to be created
+		virtual const String& getType(void) const = 0;
+
+		/** Create a new instance of the object.
+		@param name The name of the new object
+		@param manager The SceneManager instance that will be holding the
+			instance once created.
+		@param params Name/value pair list of additional parameters required to 
+			construct the object (defined per subtype). Optional.
+		*/
+		virtual MovableObject* createInstance(
+			const String& name, SceneManager* manager, 
+			const NameValuePairList* params = 0);
+		/** Destroy an instance of the object */
+		virtual void destroyInstance(MovableObject* obj) = 0;
+
+		/** Does this factory require the allocation of a 'type flag', used to 
+			selectively include / exclude this type from scene queries?
+		@remarks
+			The default implementation here is to return 'false', ie not to 
+			request a unique type mask from Root. For objects that
+			never need to be excluded in SceneQuery results, that's fine, since
+			the default implementation of MovableObject::getTypeFlags is to return
+			all ones, hence matching any query type mask. However, if you want the
+			objects created by this factory to be filterable by queries using a 
+			broad type, you have to give them a (preferably unique) type mask - 
+			and given that you don't know what other MovableObject types are 
+			registered, Root will allocate you one. 
+		*/
+		virtual bool requestTypeFlags(void) const { return false; }
+		/** Notify this factory of the type mask to apply. 
+		@remarks
+			This should normally only be called by Root in response to
+			a 'true' result from requestTypeMask. However, you can actually use
+			it yourself if you're careful; for example to assign the same mask
+			to a number of different types of object, should you always wish them
+			to be treated the same in queries.
+		*/
+		void _notifyTypeFlags(uint32 flag) { mTypeFlag = flag; }
+
+		/** Gets the type flag for this factory.
+		@remarks
+			A type flag is like a query flag, except that it applies to all instances
+			of a certain type of object.
+		*/
+		uint32 getTypeFlags(void) const { return mTypeFlag; }
+
+	};
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreMovablePlane.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreMovablePlane.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreMovablePlane.h	(revision 148)
@@ -0,0 +1,101 @@
+/*
+-----------------------------------------------------------------------------
+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 __MovablePlane_H__
+#define __MovablePlane_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgrePlane.h"
+#include "OgreMovableObject.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Scene
+	*  @{
+	*/
+	/** Definition of a Plane that may be attached to a node, and the derived
+        details of it retrieved simply.
+    @remarks
+        This plane is not here for rendering purposes, it's to allow you to attach
+        planes to the scene in order to have them move and follow nodes on their
+        own, which is useful if you're using the plane for some kind of calculation,
+        e.g. reflection.
+    */
+    class _OgreExport MovablePlane : public Plane, public MovableObject
+    {
+    protected:
+        mutable Plane mDerivedPlane;
+        mutable Vector3 mLastTranslate;
+        mutable Quaternion mLastRotate;
+        AxisAlignedBox mNullBB;
+        mutable bool mDirty;
+        static String msMovableType;
+    public:
+
+        MovablePlane(const String& name);
+        MovablePlane (const Plane& rhs);
+        /** Construct a plane through a normal, and a distance to move the plane along the normal.*/
+        MovablePlane (const Vector3& rkNormal, Real fConstant);
+        MovablePlane (const Vector3& rkNormal, const Vector3& rkPoint);
+        MovablePlane (const Vector3& rkPoint0, const Vector3& rkPoint1,
+            const Vector3& rkPoint2);
+        ~MovablePlane() {}
+        /// Overridden from MovableObject
+        void _notifyCurrentCamera(Camera*) { /* don't care */ }
+        /// Overridden from MovableObject
+        const AxisAlignedBox& getBoundingBox(void) const { return mNullBB; }
+        /// Overridden from MovableObject
+        Real getBoundingRadius(void) const { return 0.0f; }
+        /// Overridden from MovableObject
+        void _updateRenderQueue(RenderQueue*) { /* do nothing */}
+        /// Overridden from MovableObject
+        const String& getMovableType(void) const;
+        /// Get the derived plane as transformed by its parent node. 
+        const Plane& _getDerivedPlane(void) const;
+		/// @copydoc MovableObject::visitRenderables
+		void visitRenderables(Renderable::Visitor* visitor, 
+			bool debugRenderables = false)
+                {
+                    /* do nothing */
+                    (void)visitor;
+                    (void)debugRenderables;
+                }
+
+    };
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreNameGenerator.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreNameGenerator.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreNameGenerator.h	(revision 148)
@@ -0,0 +1,106 @@
+/*
+-----------------------------------------------------------------------------
+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 __NameGenerator_H__
+#define __NameGenerator_H__
+
+#include "OgreString.h"
+
+#if defined ( OGRE_GCC_VISIBILITY )
+#   pragma GCC visibility push(default)
+#endif
+
+#include <sstream>
+
+#if defined ( OGRE_GCC_VISIBILITY )
+#   pragma GCC visibility pop
+#endif
+
+#include "OgreHeaderPrefix.h"
+
+#include "Threading/OgreThreadHeaders.h"
+
+namespace Ogre {
+    /** \addtogroup Core
+    *  @{
+    */
+    /** \addtogroup General
+    *  @{
+    */
+
+    /// Utility class to generate a sequentially numbered series of names
+    class _OgreExport NameGenerator
+    {
+    protected:
+        String mPrefix;
+        unsigned long long int mNext;
+        OGRE_AUTO_MUTEX;
+    public:
+        NameGenerator(const NameGenerator& rhs)
+            : mPrefix(rhs.mPrefix), mNext(rhs.mNext) {}
+        
+        NameGenerator(const String& prefix) : mPrefix(prefix), mNext(1) {}
+
+        /// Generate a new name
+        String generate()
+        {
+            OGRE_LOCK_AUTO_MUTEX;
+            StringStream s;
+            s << mPrefix << mNext++;
+            return s.str();
+        }
+
+        /// Reset the internal counter
+        void reset()
+        {
+            OGRE_LOCK_AUTO_MUTEX;
+            mNext = 1ULL;
+        }
+
+        /// Manually set the internal counter (use caution)
+        void setNext(unsigned long long int val)
+        {
+            OGRE_LOCK_AUTO_MUTEX;
+            mNext = val;
+        }
+
+        /// Get the internal counter
+        unsigned long long int getNext() const
+        {
+            // lock even on get because 64-bit may not be atomic read
+            OGRE_LOCK_AUTO_MUTEX;
+            return mNext;
+        }
+    };
+
+    /** @} */
+    /** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreNode.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreNode.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreNode.h	(revision 148)
@@ -0,0 +1,782 @@
+/*
+-----------------------------------------------------------------------------
+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 _Node_H__
+#define _Node_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreCommon.h"
+#include "OgreMatrix3.h"
+#include "OgreMatrix4.h"
+#include "OgreQuaternion.h"
+#include "OgreString.h"
+#include "OgreRenderable.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreMesh.h"
+#include "OgreUserObjectBindings.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+    class NameGenerator;
+
+    /** \addtogroup Core
+    *  @{
+    */
+    /** \addtogroup Scene
+    *  @{
+    */
+    /** Class representing a general-purpose node an articulated scene graph.
+    @remarks
+        A node in the scene graph is a node in a structured tree. A node contains
+        information about the transformation which will apply to
+        it and all of it's children. Child nodes can have transforms of their own, which
+        are combined with their parent's transformations.
+    @par
+        This is an abstract class - concrete classes are based on this for specific purposes,
+        e.g. SceneNode, Bone
+    */
+    class _OgreExport Node : public NodeAlloc
+    {
+    public:
+        /** Enumeration denoting the spaces which a transform can be relative to.
+        */
+        enum TransformSpace
+        {
+            /// Transform is relative to the local space
+            TS_LOCAL,
+            /// Transform is relative to the space of the parent node
+            TS_PARENT,
+            /// Transform is relative to world space
+            TS_WORLD
+        };
+        typedef HashMap<String, Node*> ChildNodeMap;
+        typedef MapIterator<ChildNodeMap> ChildNodeIterator;
+        typedef ConstMapIterator<ChildNodeMap> ConstChildNodeIterator;
+
+        /** Listener which gets called back on Node events.
+        */
+        class _OgreExport Listener
+        {
+        public:
+            Listener() {}
+            virtual ~Listener() {}
+            /** Called when a node gets updated.
+            @remarks
+                Note that this happens when the node's derived update happens,
+                not every time a method altering it's state occurs. There may 
+                be several state-changing calls but only one of these calls, 
+                when the node graph is fully updated.
+            */
+            virtual void nodeUpdated(const Node*) {}
+            /** Node is being destroyed */
+            virtual void nodeDestroyed(const Node*) {}
+            /** Node has been attached to a parent */
+            virtual void nodeAttached(const Node*) {}
+            /** Node has been detached from a parent */
+            virtual void nodeDetached(const Node*) {}
+        };
+
+        /** Inner class for displaying debug renderable for Node. */
+        class DebugRenderable : public Renderable, public NodeAlloc
+        {
+        protected:
+            Node* mParent;
+            MeshPtr mMeshPtr;
+            MaterialPtr mMat;
+            Real mScaling;
+        public:
+            DebugRenderable(Node* parent);
+            ~DebugRenderable();
+            const MaterialPtr& getMaterial(void) const;
+            void getRenderOperation(RenderOperation& op);
+            void getWorldTransforms(Matrix4* xform) const;
+            Real getSquaredViewDepth(const Camera* cam) const;
+            const LightList& getLights(void) const;
+            void setScaling(Real s) { mScaling = s; }
+
+        };
+
+    protected:
+        /// Pointer to parent node
+        Node* mParent;
+        /// Collection of pointers to direct children; hashmap for efficiency
+        ChildNodeMap mChildren;
+
+        typedef set<Node*>::type ChildUpdateSet;
+        /// List of children which need updating, used if self is not out of date but children are
+        mutable ChildUpdateSet mChildrenToUpdate;
+        /// Flag to indicate own transform from parent is out of date
+        mutable bool mNeedParentUpdate;
+        /// Flag indicating that all children need to be updated
+        mutable bool mNeedChildUpdate;
+        /// Flag indicating that parent has been notified about update request
+        mutable bool mParentNotified ;
+        /// Flag indicating that the node has been queued for update
+        mutable bool mQueuedForUpdate;
+
+        /// Friendly name of this node, can be automatically generated if you don't care
+        String mName;
+
+        /// Incremented count for next name extension
+        static NameGenerator msNameGenerator;
+
+        /// Stores the orientation of the node relative to it's parent.
+        Quaternion mOrientation;
+
+        /// Stores the position/translation of the node relative to its parent.
+        Vector3 mPosition;
+
+        /// Stores the scaling factor applied to this node
+        Vector3 mScale;
+
+        /// Stores whether this node inherits orientation from it's parent
+        bool mInheritOrientation;
+
+        /// Stores whether this node inherits scale from it's parent
+        bool mInheritScale;
+
+        /// Only available internally - notification of parent.
+        virtual void setParent(Node* parent);
+
+        /** Cached combined orientation.
+        @par
+            This member is the orientation derived by combining the
+            local transformations and those of it's parents.
+            This is updated when _updateFromParent is called by the
+            SceneManager or the nodes parent.
+        */
+        mutable Quaternion mDerivedOrientation;
+
+        /** Cached combined position.
+        @par
+            This member is the position derived by combining the
+            local transformations and those of it's parents.
+            This is updated when _updateFromParent is called by the
+            SceneManager or the nodes parent.
+        */
+        mutable Vector3 mDerivedPosition;
+
+        /** Cached combined scale.
+        @par
+            This member is the position derived by combining the
+            local transformations and those of it's parents.
+            This is updated when _updateFromParent is called by the
+            SceneManager or the nodes parent.
+        */
+        mutable Vector3 mDerivedScale;
+
+        /** Triggers the node to update it's combined transforms.
+        @par
+            This method is called internally by Ogre to ask the node
+            to update it's complete transformation based on it's parents
+            derived transform.
+        */
+        virtual void _updateFromParent(void) const;
+
+        /** Class-specific implementation of _updateFromParent.
+        @remarks
+            Splitting the implementation of the update away from the update call
+            itself allows the detail to be overridden without disrupting the 
+            general sequence of updateFromParent (e.g. raising events)
+        */
+        virtual void updateFromParentImpl(void) const;
+
+
+        /** Internal method for creating a new child node - must be overridden per subclass. */
+        virtual Node* createChildImpl(void) = 0;
+
+        /** Internal method for creating a new child node - must be overridden per subclass. */
+        virtual Node* createChildImpl(const String& name) = 0;
+
+        /// The position to use as a base for keyframe animation
+        Vector3 mInitialPosition;
+        /// The orientation to use as a base for keyframe animation
+        Quaternion mInitialOrientation;
+        /// The scale to use as a base for keyframe animation
+        Vector3 mInitialScale;
+
+        /// Cached derived transform as a 4x4 matrix
+        mutable Matrix4 mCachedTransform;
+        mutable bool mCachedTransformOutOfDate;
+
+        /** Node listener - only one allowed (no list) for size & performance reasons. */
+        Listener* mListener;
+
+        typedef vector<Node*>::type QueuedUpdates;
+        static QueuedUpdates msQueuedUpdates;
+
+        DebugRenderable* mDebug;
+
+        /// User objects binding.
+        UserObjectBindings mUserObjectBindings;
+
+    public:
+        /** Constructor, should only be called by parent, not directly.
+        @remarks
+            Generates a name.
+        */
+        Node();
+        /** Constructor, should only be called by parent, not directly.
+        @remarks
+            Assigned a name.
+        */
+        Node(const String& name);
+
+        virtual ~Node();  
+
+        /** Returns the name of the node. */
+        const String& getName(void) const;
+
+        /** Gets this node's parent (NULL if this is the root).
+        */
+        virtual Node* getParent(void) const;
+
+        /** Returns a quaternion representing the nodes orientation.
+        */
+        virtual const Quaternion & getOrientation() const;
+
+        /** Sets the orientation of this node via a quaternion.
+        @remarks
+            Orientations, unlike other transforms, are not always inherited by child nodes.
+            Whether or not orientations affect the orientation of the child nodes depends on
+            the setInheritOrientation option of the child. In some cases you want a orientating
+            of a parent node to apply to a child node (e.g. where the child node is a part of
+            the same object, so you want it to be the same relative orientation based on the
+            parent's orientation), but not in other cases (e.g. where the child node is just
+            for positioning another object, you want it to maintain it's own orientation).
+            The default is to inherit as with other transforms.
+        @par
+            Note that rotations are oriented around the node's origin.
+        */
+        virtual void setOrientation( const Quaternion& q );
+
+        /** Sets the orientation of this node via quaternion parameters.
+        @remarks
+            Orientations, unlike other transforms, are not always inherited by child nodes.
+            Whether or not orientations affect the orientation of the child nodes depends on
+            the setInheritOrientation option of the child. In some cases you want a orientating
+            of a parent node to apply to a child node (e.g. where the child node is a part of
+            the same object, so you want it to be the same relative orientation based on the
+            parent's orientation), but not in other cases (e.g. where the child node is just
+            for positioning another object, you want it to maintain it's own orientation).
+            The default is to inherit as with other transforms.
+        @par
+            Note that rotations are oriented around the node's origin.
+        */
+        virtual void setOrientation( Real w, Real x, Real y, Real z);
+
+        /** Resets the nodes orientation (local axes as world axes, no rotation).
+        @remarks
+            Orientations, unlike other transforms, are not always inherited by child nodes.
+            Whether or not orientations affect the orientation of the child nodes depends on
+            the setInheritOrientation option of the child. In some cases you want a orientating
+            of a parent node to apply to a child node (e.g. where the child node is a part of
+            the same object, so you want it to be the same relative orientation based on the
+            parent's orientation), but not in other cases (e.g. where the child node is just
+            for positioning another object, you want it to maintain it's own orientation).
+            The default is to inherit as with other transforms.
+        @par
+            Note that rotations are oriented around the node's origin.
+        */
+        virtual void resetOrientation(void);
+
+        /** Sets the position of the node relative to it's parent.
+        */
+        virtual void setPosition(const Vector3& pos);
+
+        /** Sets the position of the node relative to it's parent.
+        */
+        virtual void setPosition(Real x, Real y, Real z);
+
+        /** Gets the position of the node relative to it's parent.
+        */
+        virtual const Vector3 & getPosition(void) const;
+
+        /** Sets the scaling factor applied to this node.
+        @remarks
+            Scaling factors, unlike other transforms, are not always inherited by child nodes.
+            Whether or not scalings affect the size of the child nodes depends on the setInheritScale
+            option of the child. In some cases you want a scaling factor of a parent node to apply to
+            a child node (e.g. where the child node is a part of the same object, so you want it to be
+            the same relative size based on the parent's size), but not in other cases (e.g. where the
+            child node is just for positioning another object, you want it to maintain it's own size).
+            The default is to inherit as with other transforms.
+        @par
+            Note that like rotations, scalings are oriented around the node's origin.
+        */
+        virtual void setScale(const Vector3& scale);
+
+        /** Sets the scaling factor applied to this node.
+        @remarks
+            Scaling factors, unlike other transforms, are not always inherited by child nodes.
+            Whether or not scalings affect the size of the child nodes depends on the setInheritScale
+            option of the child. In some cases you want a scaling factor of a parent node to apply to
+            a child node (e.g. where the child node is a part of the same object, so you want it to be
+            the same relative size based on the parent's size), but not in other cases (e.g. where the
+            child node is just for positioning another object, you want it to maintain it's own size).
+            The default is to inherit as with other transforms.
+        @par
+            Note that like rotations, scalings are oriented around the node's origin.
+        */
+        virtual void setScale(Real x, Real y, Real z);
+
+        /** Gets the scaling factor of this node.
+        */
+        virtual const Vector3 & getScale(void) const;
+
+        /** Tells the node whether it should inherit orientation from it's parent node.
+        @remarks
+            Orientations, unlike other transforms, are not always inherited by child nodes.
+            Whether or not orientations affect the orientation of the child nodes depends on
+            the setInheritOrientation option of the child. In some cases you want a orientating
+            of a parent node to apply to a child node (e.g. where the child node is a part of
+            the same object, so you want it to be the same relative orientation based on the
+            parent's orientation), but not in other cases (e.g. where the child node is just
+            for positioning another object, you want it to maintain it's own orientation).
+            The default is to inherit as with other transforms.
+        @param inherit If true, this node's orientation will be affected by its parent's orientation.
+            If false, it will not be affected.
+        */
+        virtual void setInheritOrientation(bool inherit);
+
+        /** Returns true if this node is affected by orientation applied to the parent node. 
+        @remarks
+            Orientations, unlike other transforms, are not always inherited by child nodes.
+            Whether or not orientations affect the orientation of the child nodes depends on
+            the setInheritOrientation option of the child. In some cases you want a orientating
+            of a parent node to apply to a child node (e.g. where the child node is a part of
+            the same object, so you want it to be the same relative orientation based on the
+            parent's orientation), but not in other cases (e.g. where the child node is just
+            for positioning another object, you want it to maintain it's own orientation).
+            The default is to inherit as with other transforms.
+        @remarks
+            See setInheritOrientation for more info.
+        */
+        virtual bool getInheritOrientation(void) const;
+
+        /** Tells the node whether it should inherit scaling factors from it's parent node.
+        @remarks
+            Scaling factors, unlike other transforms, are not always inherited by child nodes.
+            Whether or not scalings affect the size of the child nodes depends on the setInheritScale
+            option of the child. In some cases you want a scaling factor of a parent node to apply to
+            a child node (e.g. where the child node is a part of the same object, so you want it to be
+            the same relative size based on the parent's size), but not in other cases (e.g. where the
+            child node is just for positioning another object, you want it to maintain it's own size).
+            The default is to inherit as with other transforms.
+        @param inherit If true, this node's scale will be affected by its parent's scale. If false,
+            it will not be affected.
+        */
+        virtual void setInheritScale(bool inherit);
+
+        /** Returns true if this node is affected by scaling factors applied to the parent node. 
+        @remarks
+            See setInheritScale for more info.
+        */
+        virtual bool getInheritScale(void) const;
+
+        /** Scales the node, combining it's current scale with the passed in scaling factor. 
+        @remarks
+            This method applies an extra scaling factor to the node's existing scale, (unlike setScale
+            which overwrites it) combining it's current scale with the new one. E.g. calling this 
+            method twice with Vector3(2,2,2) would have the same effect as setScale(Vector3(4,4,4)) if
+            the existing scale was 1.
+        @par
+            Note that like rotations, scalings are oriented around the node's origin.
+        */
+        virtual void scale(const Vector3& scale);
+
+        /** Scales the node, combining it's current scale with the passed in scaling factor. 
+        @remarks
+            This method applies an extra scaling factor to the node's existing scale, (unlike setScale
+            which overwrites it) combining it's current scale with the new one. E.g. calling this 
+            method twice with Vector3(2,2,2) would have the same effect as setScale(Vector3(4,4,4)) if
+            the existing scale was 1.
+        @par
+            Note that like rotations, scalings are oriented around the node's origin.
+        */
+        virtual void scale(Real x, Real y, Real z);
+
+        /** Moves the node along the Cartesian axes.
+        @par
+            This method moves the node by the supplied vector along the
+            world Cartesian axes, i.e. along world x,y,z
+        @param d
+            Vector with x,y,z values representing the translation.
+        @param relativeTo
+            The space which this transform is relative to.
+        */
+        virtual void translate(const Vector3& d, TransformSpace relativeTo = TS_PARENT);
+        /** Moves the node along the Cartesian axes.
+        @par
+            This method moves the node by the supplied vector along the
+            world Cartesian axes, i.e. along world x,y,z
+        @param x
+            Real @c x value representing the translation.
+        @param y
+            Real @c y value representing the translation.
+        @param z
+            Real @c z value representing the translation.
+        @param relativeTo
+            The space which this transform is relative to.
+        */
+        virtual void translate(Real x, Real y, Real z, TransformSpace relativeTo = TS_PARENT);
+        /** Moves the node along arbitrary axes.
+        @remarks
+            This method translates the node by a vector which is relative to
+            a custom set of axes.
+        @param axes
+            A 3x3 Matrix containing 3 column vectors each representing the
+            axes X, Y and Z respectively. In this format the standard cartesian
+            axes would be expressed as:
+            <pre>
+            1 0 0
+            0 1 0
+            0 0 1
+            </pre>
+            i.e. the identity matrix.
+        @param move
+            Vector relative to the axes above.
+        @param relativeTo
+            The space which this transform is relative to.
+        */
+        virtual void translate(const Matrix3& axes, const Vector3& move, TransformSpace relativeTo = TS_PARENT);
+        /** Moves the node along arbitrary axes.
+        @remarks
+            This method translates the node by a vector which is relative to
+            a custom set of axes.
+        @param axes
+            A 3x3 Matrix containing 3 column vectors each representing the
+            axes X, Y and Z respectively. In this format the standard cartesian
+            axes would be expressed as
+            <pre>
+            1 0 0
+            0 1 0
+            0 0 1
+            </pre>
+            i.e. the identity matrix.
+        @param x
+            The @c x translation component relative to the axes above.
+        @param y
+            The @c y translation component relative to the axes above.
+        @param z
+            The @c z translation component relative to the axes above.
+        @param relativeTo
+            The space which this transform is relative to.
+        */
+        virtual void translate(const Matrix3& axes, Real x, Real y, Real z, TransformSpace relativeTo = TS_PARENT);
+
+        /** Rotate the node around the Z-axis.
+        */
+        virtual void roll(const Radian& angle, TransformSpace relativeTo = TS_LOCAL);
+
+        /** Rotate the node around the X-axis.
+        */
+        virtual void pitch(const Radian& angle, TransformSpace relativeTo = TS_LOCAL);
+
+        /** Rotate the node around the Y-axis.
+        */
+        virtual void yaw(const Radian& angle, TransformSpace relativeTo = TS_LOCAL);
+
+        /** Rotate the node around an arbitrary axis.
+        */
+        virtual void rotate(const Vector3& axis, const Radian& angle, TransformSpace relativeTo = TS_LOCAL);
+
+        /** Rotate the node around an aritrary axis using a Quarternion.
+        */
+        virtual void rotate(const Quaternion& q, TransformSpace relativeTo = TS_LOCAL);
+
+        /** Gets a matrix whose columns are the local axes based on
+            the nodes orientation relative to it's parent. */
+        virtual Matrix3 getLocalAxes(void) const;
+
+        /** Creates an unnamed new Node as a child of this node.
+        @param translate
+            Initial translation offset of child relative to parent
+        @param rotate
+            Initial rotation relative to parent
+        */
+        virtual Node* createChild(
+            const Vector3& translate = Vector3::ZERO, 
+            const Quaternion& rotate = Quaternion::IDENTITY );
+
+        /** Creates a new named Node as a child of this node.
+        @remarks
+            This creates a child node with a given name, which allows you to look the node up from 
+            the parent which holds this collection of nodes.
+        @param translate
+            Initial translation offset of child relative to parent
+        @param rotate
+            Initial rotation relative to parent
+        */
+        virtual Node* createChild(const String& name, const Vector3& translate = Vector3::ZERO, const Quaternion& rotate = Quaternion::IDENTITY);
+
+        /** Adds a (precreated) child scene node to this node. If it is attached to another node,
+            it must be detached first.
+        @param child The Node which is to become a child node of this one
+        */
+        virtual void addChild(Node* child);
+
+        /** Reports the number of child nodes under this one.
+        */
+        virtual unsigned short numChildren(void) const;
+
+        /** Gets a pointer to a child node.
+        @remarks
+            There is an alternate getChild method which returns a named child.
+        */
+        virtual Node* getChild(unsigned short index) const;    
+
+        /** Gets a pointer to a named child node.
+        */
+        virtual Node* getChild(const String& name) const;
+
+        /** Retrieves an iterator for efficiently looping through all children of this node.
+        @remarks
+            Using this is faster than repeatedly calling getChild if you want to go through
+            all (or most of) the children of this node.
+            Note that the returned iterator is only valid whilst no children are added or
+            removed from this node. Thus you should not store this returned iterator for
+            later use, nor should you add / remove children whilst iterating through it;
+            store up changes for later. Note that calling methods on returned items in 
+            the iterator IS allowed and does not invalidate the iterator.
+        */
+        virtual ChildNodeIterator getChildIterator(void);
+
+        /** Retrieves an iterator for efficiently looping through all children of this node.
+        @remarks
+            Using this is faster than repeatedly calling getChild if you want to go through
+            all (or most of) the children of this node.
+            Note that the returned iterator is only valid whilst no children are added or
+            removed from this node. Thus you should not store this returned iterator for
+            later use, nor should you add / remove children whilst iterating through it;
+            store up changes for later. Note that calling methods on returned items in 
+            the iterator IS allowed and does not invalidate the iterator.
+        */
+        virtual ConstChildNodeIterator getChildIterator(void) const;
+
+        /** Drops the specified child from this node. 
+        @remarks
+            Does not delete the node, just detaches it from
+            this parent, potentially to be reattached elsewhere. 
+            There is also an alternate version which drops a named
+            child from this node.
+        */
+        virtual Node* removeChild(unsigned short index);
+        /** Drops the specified child from this node. 
+        @remarks
+            Does not delete the node, just detaches it from
+            this parent, potentially to be reattached elsewhere. 
+            There is also an alternate version which drops a named
+            child from this node.
+        */
+        virtual Node* removeChild(Node* child);
+
+        /** Drops the named child from this node. 
+        @remarks
+            Does not delete the node, just detaches it from
+            this parent, potentially to be reattached elsewhere.
+        */
+        virtual Node* removeChild(const String& name);
+        /** Removes all child Nodes attached to this node. Does not delete the nodes, just detaches them from
+            this parent, potentially to be reattached elsewhere.
+        */
+        virtual void removeAllChildren(void);
+        
+        /** Sets the final world position of the node directly.
+        @remarks 
+            It's advisable to use the local setPosition if possible
+        */
+        virtual void _setDerivedPosition(const Vector3& pos);
+
+        /** Sets the final world orientation of the node directly.
+        @remarks 
+            It's advisable to use the local setOrientation if possible, this simply does
+            the conversion for you.
+        */
+        virtual void _setDerivedOrientation(const Quaternion& q);
+
+        /** Gets the orientation of the node as derived from all parents.
+        */
+        virtual const Quaternion & _getDerivedOrientation(void) const;
+
+        /** Gets the position of the node as derived from all parents.
+        */
+        virtual const Vector3 & _getDerivedPosition(void) const;
+
+        /** Gets the scaling factor of the node as derived from all parents.
+        */
+        virtual const Vector3 & _getDerivedScale(void) const;
+
+        /** Gets the full transformation matrix for this node.
+        @remarks
+            This method returns the full transformation matrix
+            for this node, including the effect of any parent node
+            transformations, provided they have been updated using the Node::_update method.
+            This should only be called by a SceneManager which knows the
+            derived transforms have been updated before calling this method.
+            Applications using Ogre should just use the relative transforms.
+        */
+        virtual const Matrix4& _getFullTransform(void) const;
+
+        /** Internal method to update the Node.
+        @note
+            Updates this node and any relevant children to incorporate transforms etc.
+            Don't call this yourself unless you are writing a SceneManager implementation.
+        @param updateChildren
+            If @c true, the update cascades down to all children. Specify false if you wish to
+            update children separately, e.g. because of a more selective SceneManager implementation.
+        @param parentHasChanged
+            This flag indicates that the parent transform has changed,
+            so the child should retrieve the parent's transform and combine
+            it with its own even if it hasn't changed itself.
+        */
+        virtual void _update(bool updateChildren, bool parentHasChanged);
+
+        /** Sets a listener for this Node.
+        @remarks
+            Note for size and performance reasons only one listener per node is
+            allowed.
+        */
+        virtual void setListener(Listener* listener) { mListener = listener; }
+        
+        /** Gets the current listener for this Node.
+        */
+        virtual Listener* getListener(void) const { return mListener; }
+        
+
+        /** Sets the current transform of this node to be the 'initial state' ie that
+            position / orientation / scale to be used as a basis for delta values used
+            in keyframe animation.
+        @remarks
+            You never need to call this method unless you plan to animate this node. If you do
+            plan to animate it, call this method once you've loaded the node with it's base state,
+            ie the state on which all keyframes are based.
+        @par
+            If you never call this method, the initial state is the identity transform, ie do nothing.
+        */
+        virtual void setInitialState(void);
+
+        /** Resets the position / orientation / scale of this node to it's initial state, see setInitialState for more info. */
+        virtual void resetToInitialState(void);
+
+        /** Gets the initial position of this node, see setInitialState for more info. 
+        @remarks
+            Also resets the cumulative animation weight used for blending.
+        */
+        virtual const Vector3& getInitialPosition(void) const;
+        
+        /** Gets the local position, relative to this node, of the given world-space position */
+        virtual Vector3 convertWorldToLocalPosition( const Vector3 &worldPos );
+
+        /** Gets the world position of a point in the node local space
+            useful for simple transforms that don't require a child node.*/
+        virtual Vector3 convertLocalToWorldPosition( const Vector3 &localPos );
+
+        /** Gets the local orientation, relative to this node, of the given world-space orientation */
+        virtual Quaternion convertWorldToLocalOrientation( const Quaternion &worldOrientation );
+
+        /** Gets the world orientation of an orientation in the node local space
+            useful for simple transforms that don't require a child node.*/
+        virtual Quaternion convertLocalToWorldOrientation( const Quaternion &localOrientation );
+
+        /** Gets the initial orientation of this node, see setInitialState for more info. */
+        virtual const Quaternion& getInitialOrientation(void) const;
+
+        /** Gets the initial position of this node, see setInitialState for more info. */
+        virtual const Vector3& getInitialScale(void) const;
+
+        /** Helper function, get the squared view depth.  */
+        virtual Real getSquaredViewDepth(const Camera* cam) const;
+
+        /** To be called in the event of transform changes to this node that require it's recalculation.
+        @remarks
+            This not only tags the node state as being 'dirty', it also requests it's parent to 
+            know about it's dirtiness so it will get an update next time.
+        @param forceParentUpdate Even if the node thinks it has already told it's
+            parent, tell it anyway
+        */
+        virtual void needUpdate(bool forceParentUpdate = false);
+        /** Called by children to notify their parent that they need an update. 
+        @param forceParentUpdate Even if the node thinks it has already told it's
+            parent, tell it anyway
+        */
+        virtual void requestUpdate(Node* child, bool forceParentUpdate = false);
+        /** Called by children to notify their parent that they no longer need an update. */
+        virtual void cancelUpdate(Node* child);
+
+        /** Get a debug renderable for rendering the Node.  */
+        virtual DebugRenderable* getDebugRenderable(Real scaling);
+
+        /** Queue a 'needUpdate' call to a node safely.
+        @remarks
+            You can't call needUpdate() during the scene graph update, e.g. in
+            response to a Node::Listener hook, because the graph is already being 
+            updated, and update flag changes cannot be made reliably in that context. 
+            Call this method if you need to queue a needUpdate call in this case.
+        */
+        static void queueNeedUpdate(Node* n);
+        /** Process queued 'needUpdate' calls. */
+        static void processQueuedUpdates(void);
+
+
+        /** @deprecated use UserObjectBindings::setUserAny via getUserObjectBindings() instead.
+            Sets any kind of user value on this object.
+        @remarks
+            This method allows you to associate any user value you like with 
+            this Node. This can be a pointer back to one of your own
+            classes for instance.
+        */
+        OGRE_DEPRECATED virtual void setUserAny(const Any& anything) { getUserObjectBindings().setUserAny(anything); }
+
+        /** @deprecated use UserObjectBindings::getUserAny via getUserObjectBindings() instead.
+            Retrieves the custom user value associated with this object.
+        */
+        OGRE_DEPRECATED virtual const Any& getUserAny(void) const { return getUserObjectBindings().getUserAny(); }
+
+        /** Return an instance of user objects binding associated with this class.
+            You can use it to associate one or more custom objects with this class instance.
+        @see UserObjectBindings::setUserAny.
+        */
+        UserObjectBindings&	getUserObjectBindings() { return mUserObjectBindings; }
+
+        /** Return an instance of user objects binding associated with this class.
+            You can use it to associate one or more custom objects with this class instance.
+        @see UserObjectBindings::setUserAny.
+        */
+        const UserObjectBindings& getUserObjectBindings() const { return mUserObjectBindings; }
+
+    };
+    /** @} */
+    /** @} */
+
+} // namespace Ogre
+
+#include "OgreHeaderSuffix.h"
+
+#endif // _Node_H__
Index: /ogre_src_v1-9-0/OgreMain/include/OgreNumerics.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreNumerics.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreNumerics.h	(revision 148)
@@ -0,0 +1,66 @@
+/*
+-----------------------------------------------------------------------------
+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 __NumericSolvers_H__
+#define __NumericSolvers_H__
+
+#include "OgrePrerequisites.h"
+
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Math
+	*  @{
+	*/
+	/** Real type for numeric solvers */
+	typedef double PreciseReal;
+
+
+    /** Provides numeric solvers for Ogre
+        @remarks
+            Handles linear algebra numerics.
+    */
+	class _OgreExport NumericSolver
+	{
+	public:
+		/** Solves a full rank NxN linear system of equations 
+		    @remarks
+			   This implements a naive Gaussian elimination algorithm.
+			   The algorithm is destructive, so there are side effects in coeff and col.
+	    */
+		static bool solveNxNLinearSysDestr(int n, PreciseReal **coeff, PreciseReal *col);
+	};
+	/** @} */
+	/** @} */
+
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreOptimisedUtil.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreOptimisedUtil.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreOptimisedUtil.h	(revision 148)
@@ -0,0 +1,244 @@
+/*
+-----------------------------------------------------------------------------
+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 __OptimisedUtil_H__
+#define __OptimisedUtil_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreEdgeListBuilder.h"
+#include <cstddef>
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Math
+	*  @{
+	*/
+	/** Utility class for provides optimised functions.
+    @note
+        This class are supposed used by internal engine only.
+    */
+    class _OgreExport OptimisedUtil
+    {
+    private:
+        /// Privated copy constructor, to prevent misuse
+        OptimisedUtil(const OptimisedUtil& rhs); /* do nothing, should not use */
+        /// Privated operator=, to prevent misuse
+        OptimisedUtil& operator=(const OptimisedUtil& rhs); /* do not use */
+
+    protected:
+        /// Store a pointer to the implementation
+        static OptimisedUtil* msImplementation;
+
+        /// Detect best implementation based on run-time environment
+        static OptimisedUtil* _detectImplementation(void);
+
+    public:
+        // Default constructor
+        OptimisedUtil(void) {}
+        // Destructor
+        virtual ~OptimisedUtil() {}
+
+        /** Gets the implementation of this class.
+        @note
+            Don't cache the pointer returned by this function, it'll change due
+            run-time environment detection to pick up the best implementation.
+        */
+        static OptimisedUtil* getImplementation(void) { return msImplementation; }
+
+        /** Performs software vertex skinning.
+        @param srcPosPtr Pointer to source position buffer.
+        @param destPosPtr Pointer to destination position buffer.
+        @param srcNormPtr Pointer to source normal buffer, if NULL,
+            means blend position only.
+        @param destNormPtr Pointer to destination normal buffer, it's
+            ignored if srcNormPtr is NULL.
+        @param blendWeightPtr Pointer to blend weight buffer.
+        @param blendIndexPtr Pointer to blend index buffer.
+        @param blendMatrices An array of pointer of blend matrix, the matrix
+            must be aligned to SIMD alignment, but not necessary for the array
+            itself.
+        @param srcPosStride The stride of source position in bytes.
+        @param destPosStride The stride of destination position in bytes.
+        @param srcNormStride The stride of source normal in bytes,
+            it's ignored if srcNormPtr is NULL.
+        @param destNormStride The stride of destination normal in bytes,
+            it's ignored if srcNormPtr is NULL.
+        @param blendWeightStride The stride of blend weight buffer in bytes.
+        @param blendIndexStride The stride of blend index buffer in bytes.
+        @param numWeightsPerVertex Number of blend weights per-vertex, as well
+            as for blend indices.
+        @param numVertices Number of vertices to blend.
+        */
+        virtual void softwareVertexSkinning(
+            const float *srcPosPtr, float *destPosPtr,
+            const float *srcNormPtr, float *destNormPtr,
+            const float *blendWeightPtr, const unsigned char* blendIndexPtr,
+            const Matrix4* const* blendMatrices,
+            size_t srcPosStride, size_t destPosStride,
+            size_t srcNormStride, size_t destNormStride,
+            size_t blendWeightStride, size_t blendIndexStride,
+            size_t numWeightsPerVertex,
+            size_t numVertices) = 0;
+
+        /** Performs a software vertex morph, of the kind used for
+            morph animation although it can be used for other purposes. 
+        @remarks
+            This function will linearly interpolate positions between two
+            source buffers, into a third buffer.
+        @param t Parametric distance between the start and end positions
+        @param srcPos1 Pointer to buffer for the start positions
+        @param srcPos2 Pointer to buffer for the end positions
+        @param dstPos Pointer to buffer for the destination positions
+		@param pos1VSize, pos2VSize, dstVSize Vertex sizes in bytes of each of the 3 buffers referenced
+        @param numVertices Number of vertices to morph, which agree with
+            the number in start, end and destination buffer. Bear in mind
+            three floating-point values per vertex
+        */
+        virtual void softwareVertexMorph(
+            Real t,
+            const float *srcPos1, const float *srcPos2,
+            float *dstPos,
+			size_t pos1VSize, size_t pos2VSize, size_t dstVSize, 
+            size_t numVertices,
+			bool morphNormals) = 0;
+
+        /** Concatenate an affine matrix to an array of affine matrices.
+        @note
+            An affine matrix is a 4x4 matrix with row 3 equal to (0, 0, 0, 1),
+            e.g. no projective coefficients.
+        @param baseMatrix The matrix used as first operand.
+        @param srcMatrices An array of matrix used as second operand.
+        @param dstMatrices An array of matrix to store matrix concatenate results.
+        @param numMatrices Number of matrices in the array.
+        */
+        virtual void concatenateAffineMatrices(
+            const Matrix4& baseMatrix,
+            const Matrix4* srcMatrices,
+            Matrix4* dstMatrices,
+            size_t numMatrices) = 0;
+
+        /** Calculate the face normals for the triangles based on position
+            information.
+        @param positions Pointer to position information, which packed in
+            (x, y, z) format, indexing by vertex index in the triangle. No
+            alignment requests.
+        @param triangles The triangles need to calculate face normal, the vertex
+            positions is indexed by vertex index to position information.
+        @param faceNormals The array of Vector4 used to store triangles face normal,
+            Must be aligned to SIMD alignment.
+        @param numTriangles Number of triangles to calculate face normal.
+        */
+        virtual void calculateFaceNormals(
+            const float *positions,
+            const EdgeData::Triangle *triangles,
+            Vector4 *faceNormals,
+            size_t numTriangles) = 0;
+
+        /** Calculate the light facing state of the triangle's face normals
+        @remarks
+            This is normally the first stage of calculating a silhouette, i.e.
+            establishing which tris are facing the light and which are facing
+            away.
+        @param lightPos 4D position of the light in object space, note that
+            for directional lights (which have no position), the w component
+            is 0 and the x/y/z position are the direction.
+        @param faceNormals An array of face normals for the triangles, the face
+            normal are unit vector orthogonal to the triangles, plus distance
+            from origin. This array must be aligned to SIMD alignment.
+        @param lightFacings An array of flags for store light facing state
+            results, the result flag is true if corresponding face normal facing
+            the light, false otherwise. This array no alignment requires.
+        @param numFaces Number of face normals to calculate.
+        */
+        virtual void calculateLightFacing(
+            const Vector4& lightPos,
+            const Vector4* faceNormals,
+            char* lightFacings,
+            size_t numFaces) = 0;
+
+        /** Extruding vertices by a fixed distance based on light position.
+        @param lightPos 4D light position, when w=0.0f this represents a
+            directional light, otherwise, w must be equal to 1.0f, which
+            represents a point light.
+        @param extrudeDist The distance to extrude.
+        @param srcPositions Pointer to source vertex's position buffer, which
+            the position is a 3D vector packed in xyz format. No SIMD alignment
+            requirement but loss performance for unaligned data.
+        @param destPositions Pointer to destination vertex's position buffer,
+            which the position is a 3D vector packed in xyz format. No SIMD
+            alignment requirement but loss performance for unaligned data.
+        @param numVertices Number of vertices need to extruding, which agree
+            with source and destination buffers.
+        */
+        virtual void extrudeVertices(
+            const Vector4& lightPos,
+            Real extrudeDist,
+            const float* srcPositions,
+            float* destPositions,
+            size_t numVertices) = 0;
+    };
+
+    /** Returns raw offseted of the given pointer.
+    @note
+        The offset are in bytes, no matter what type of the pointer.
+    */
+    template <class T>
+    static FORCEINLINE const T* rawOffsetPointer(const T* ptr, ptrdiff_t offset)
+    {
+        return (const T*)((const char*)(ptr) + offset);
+    }
+
+    template <class T>
+    static FORCEINLINE T* rawOffsetPointer(T* ptr, ptrdiff_t offset)
+    {
+        return (T*)((char*)(ptr) + offset);
+    }
+
+    /** Advance the pointer with raw offset.
+    @note
+        The offset are in bytes, no matter what type of the pointer.
+    */
+    template <class T>
+    static FORCEINLINE void advanceRawPointer(const T*& ptr, ptrdiff_t offset)
+    {
+        ptr = rawOffsetPointer(ptr, offset);
+    }
+
+    template <class T>
+    static FORCEINLINE void advanceRawPointer(T*& ptr, ptrdiff_t offset)
+    {
+        ptr = rawOffsetPointer(ptr, offset);
+    }
+	/** @} */
+	/** @} */
+
+}
+
+#endif  // __OptimisedUtil_H__
Index: /ogre_src_v1-9-0/OgreMain/include/OgrePVRTCCodec.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgrePVRTCCodec.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgrePVRTCCodec.h	(revision 148)
@@ -0,0 +1,90 @@
+/*
+-----------------------------------------------------------------------------
+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 __OgrePVRTCCodec_H__
+#define __OgrePVRTCCodec_H__
+
+#include "OgreImageCodec.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Image
+	*  @{
+	*/
+
+    /** Codec specialized in loading PVRTC (PowerVR) images.
+	@remarks
+		We implement our own codec here since we need to be able to keep PVRTC
+		data compressed if the card supports it.
+    */
+    class _OgreExport PVRTCCodec : public ImageCodec
+    {
+    protected:
+        String mType;
+
+    	void flipEndian(void * pData, size_t size, size_t count) const;
+	    void flipEndian(void * pData, size_t size) const;
+
+		/// Single registered codec instance
+		static PVRTCCodec* msInstance;
+
+	public:
+        PVRTCCodec();
+        virtual ~PVRTCCodec() { }
+
+        /// @copydoc Codec::encode
+        DataStreamPtr encode(MemoryDataStreamPtr& input, CodecDataPtr& pData) const;
+        /// @copydoc Codec::encodeToFile
+        void encodeToFile(MemoryDataStreamPtr& input, const String& outFileName, CodecDataPtr& pData) const;
+        /// @copydoc Codec::decode
+        DecodeResult decode(DataStreamPtr& input) const;
+		/// @copydoc Codec::magicNumberToFileExt
+		String magicNumberToFileExt(const char *magicNumberPtr, size_t maxbytes) const;
+        
+        virtual String getType() const;        
+
+		/// Static method to startup and register the PVRTC codec
+		static void startup(void);
+		/// Static method to shutdown and unregister the PVRTC codec
+		static void shutdown(void);
+
+	private:
+		/// Decode PVRTCV2 image format
+		DecodeResult decodeV2(DataStreamPtr& stream) const;
+
+		/// Decode PVRTCV3 image format
+		DecodeResult decodeV3(DataStreamPtr& stream) const;
+    };
+	/** @} */
+	/** @} */
+
+} // namespace
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreParticle.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreParticle.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreParticle.h	(revision 148)
@@ -0,0 +1,157 @@
+/*
+-----------------------------------------------------------------------------
+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 __Particle_H__
+#define __Particle_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreBillboard.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Effects
+	*  @{
+	*/
+	/** Abstract class containing any additional data required to be associated
+		with a particle to perform the required rendering. 
+	@remarks
+		Because you can specialise the way that particles are rendered by supplying
+		custom ParticleSystemRenderer classes, you might well need some additional 
+		data for your custom rendering routine which is not held on the default particle
+		class. If that's the case, then you should define a subclass of this class, 
+		and construct it when asked in your custom ParticleSystemRenderer class.
+	*/
+	class _OgreExport ParticleVisualData : public FXAlloc
+	{
+	public:
+		ParticleVisualData() {}
+		virtual ~ParticleVisualData() {}
+
+	};
+
+	/** Class representing a single particle instance. */
+	class _OgreExport Particle : public FXAlloc
+    {
+    protected:
+        /// Parent ParticleSystem
+        ParticleSystem* mParentSystem;
+        /// Additional visual data you might want to associate with the Particle
+        ParticleVisualData* mVisual;
+    public:
+        /// Type of particle
+        enum ParticleType
+        {
+            Visual,
+            Emitter
+        };
+
+        /// Does this particle have it's own dimensions?
+        bool mOwnDimensions;
+        /// Personal width if mOwnDimensions == true
+        Real mWidth;
+        /// Personal height if mOwnDimensions == true
+        Real mHeight;
+        /// Current rotation value
+        Radian rotation;
+        // Note the intentional public access to internal variables
+        // Accessing via get/set would be too costly for 000's of particles
+        /// World position
+        Vector3 position;
+        /// Direction (and speed) 
+        Vector3 direction;
+        /// Current colour
+        ColourValue colour;
+        /// Time to live, number of seconds left of particles natural life
+        Real timeToLive;
+        /// Total Time to live, number of seconds of particles natural life
+        Real totalTimeToLive;
+        /// Speed of rotation in radians/sec
+        Radian rotationSpeed;
+        /// Determines the type of particle.
+        ParticleType particleType;
+
+        Particle()
+            : mParentSystem(0), mVisual(0), mOwnDimensions(false), rotation(0), 
+            position(Vector3::ZERO), direction(Vector3::ZERO), 
+            colour(ColourValue::White), timeToLive(10), totalTimeToLive(10), 
+            rotationSpeed(0), particleType(Visual)
+        {
+        }
+
+        /** Sets the width and height for this particle.
+        @remarks
+        Note that it is most efficient for every particle in a ParticleSystem to have the same dimensions. If you
+        choose to alter the dimensions of an individual particle the set will be less efficient. Do not call
+        this method unless you really need to have different particle dimensions within the same set. Otherwise
+        just call the ParticleSystem::setDefaultDimensions method instead.
+        */
+        void setDimensions(Real width, Real height); 
+
+        /** Returns true if this particle deviates from the ParticleSystem's default dimensions (i.e. if the
+        particle::setDimensions method has been called for this instance).
+        @see
+        particle::setDimensions
+        */
+        bool hasOwnDimensions(void) const { return mOwnDimensions; }
+
+        /** Retrieves the particle's personal width, if hasOwnDimensions is true. */
+        Real getOwnWidth(void) const { return mWidth; }
+
+        /** Retrieves the particle's personal width, if hasOwnDimensions is true. */
+        Real getOwnHeight(void) const { return mHeight; }
+        
+        /** Sets the current rotation */
+        void setRotation(const Radian& rad);
+
+        const Radian& getRotation(void) const { return rotation; }
+
+        /** Internal method for notifying the particle of it's owner.
+        */
+        void _notifyOwner(ParticleSystem* owner);
+
+        /** Internal method for notifying the particle of it's optional visual data.
+        */
+		void _notifyVisualData(ParticleVisualData* vis) { mVisual = vis; }
+
+		/// Get the optional visual data associated with the class
+		ParticleVisualData* getVisualData(void) const { return mVisual; }
+
+        /// Utility method to reset this particle
+        void resetDimensions(void);
+    };
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreParticleAffector.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreParticleAffector.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreParticleAffector.h	(revision 148)
@@ -0,0 +1,129 @@
+/*
+-----------------------------------------------------------------------------
+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 __ParticleAffector_H__
+#define __ParticleAffector_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreString.h"
+#include "OgreStringInterface.h"
+#include "OgreHeaderPrefix.h"
+
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Effects
+	*  @{
+	*/
+/** Abstract class defining the interface to be implemented by particle affectors.
+    @remarks
+        Particle affectors modify particles in a particle system over their lifetime. They can be
+        grouped into types, e.g. 'vector force' affectors, 'fader' affectors etc; each type will 
+        modify particles in a different way, using different parameters.
+    @par
+        Because there are so many types of affectors you could use, OGRE chooses not to dictate
+        the available types. It comes with some in-built, but allows plugins or applications to extend the affector types available.
+        This is done by subclassing ParticleAffector to have the appropriate emission behaviour you want,
+        and also creating a subclass of ParticleAffectorFactory which is responsible for creating instances 
+        of your new affector type. You register this factory with the ParticleSystemManager using
+        addAffectorFactory, and from then on affectors of this type can be created either from code or through
+        text particle scripts by naming the type.
+    @par
+        This same approach is used for ParticleEmitters (which are the source of particles in a system).
+        This means that OGRE is particularly flexible when it comes to creating particle system effects,
+        with literally infinite combinations of affector and affector types, and parameters within those
+        types.
+    */
+    class _OgreExport ParticleAffector : public StringInterface, public FXAlloc
+    {
+    protected:
+        /// Name of the type of affector, MUST be initialised by subclasses
+        String mType;
+
+        /** Internal method for setting up the basic parameter definitions for a subclass. 
+        @remarks
+            Because StringInterface holds a dictionary of parameters per class, subclasses need to
+            call this to ask the base class to add it's parameters to their dictionary as well.
+            Can't do this in the constructor because that runs in a non-virtual context.
+        @par
+            The subclass must have called it's own createParamDictionary before calling this method.
+        */
+        void addBaseParameters(void) { /* actually do nothing - for future possible use */ }
+
+        ParticleSystem* mParent;
+    public:
+        ParticleAffector(ParticleSystem* parent): mParent(parent) {}
+
+        /** Virtual destructor essential. */
+        virtual ~ParticleAffector();
+
+        /** Method called to allow the affector to initialize all newly created particles in the system.
+        @remarks
+            This is where the affector gets the chance to initialize it's effects to the particles of a system.
+            The affector is expected to initialize some or all of the particles in the system
+            passed to it, depending on the affector's approach.
+        @param
+            pParticle Pointer to a Particle to initialize.
+        */
+		virtual void _initParticle(Particle* pParticle)
+                {
+                    /* by default do nothing */
+                    (void)pParticle;
+                }
+
+        /** Method called to allow the affector to 'do it's stuff' on all active particles in the system.
+        @remarks
+            This is where the affector gets the chance to apply it's effects to the particles of a system.
+            The affector is expected to apply it's effect to some or all of the particles in the system
+            passed to it, depending on the affector's approach.
+        @param
+            pSystem Pointer to a ParticleSystem to affect.
+        @param
+            timeElapsed The number of seconds which have elapsed since the last call.
+        */
+        virtual void _affectParticles(ParticleSystem* pSystem, Real timeElapsed) = 0;
+
+        /** Returns the name of the type of affector. 
+        @remarks
+            This property is useful for determining the type of affector procedurally so another
+            can be created.
+        */
+        const String &getType(void) const { return mType; }
+
+    };
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreParticleAffectorFactory.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreParticleAffectorFactory.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreParticleAffectorFactory.h	(revision 148)
@@ -0,0 +1,83 @@
+/*
+-----------------------------------------------------------------------------
+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 __ParticleAffectorFactory_H__
+#define __ParticleAffectorFactory_H__
+
+
+#include "OgrePrerequisites.h"
+#include "OgreParticleAffector.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Effects
+	*  @{
+	*/
+	/** Abstract class defining the interface to be implemented by creators of ParticleAffector subclasses.
+    @remarks
+        Plugins or 3rd party applications can add new types of particle affectors to Ogre by creating
+        subclasses of the ParticleAffector class. Because multiple instances of these affectors may be
+        required, a factory class to manage the instances is also required. 
+    @par
+        ParticleAffectorFactory subclasses must allow the creation and destruction of ParticleAffector
+        subclasses. They must also be registered with the ParticleSystemManager. All factories have
+        a name which identifies them, examples might be 'force_vector', 'attractor', or 'fader', and these can be 
+        also be used from particle system scripts.
+    */
+	class _OgreExport ParticleAffectorFactory : public FXAlloc
+    {
+    protected:
+        vector<ParticleAffector*>::type mAffectors;
+    public:
+        ParticleAffectorFactory() {}
+        virtual ~ParticleAffectorFactory();
+        /** Returns the name of the factory, the name which identifies the particle affector type this factory creates. */
+        virtual String getName() const = 0;
+
+        /** Creates a new affector instance.
+        @remarks
+            The subclass MUST add a pointer to the created instance to mAffectors.
+        */
+        virtual ParticleAffector* createAffector(ParticleSystem* psys) = 0;
+
+        /** Destroys the affector pointed to by the parameter (for early clean up if required). */
+        virtual void destroyAffector(ParticleAffector* e);
+    };
+
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreParticleEmitter.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreParticleEmitter.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreParticleEmitter.h	(revision 148)
@@ -0,0 +1,553 @@
+/*
+-----------------------------------------------------------------------------
+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 __ParticleEmitter_H__
+#define __ParticleEmitter_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreString.h"
+#include "OgreVector3.h"
+#include "OgreColourValue.h"
+#include "OgreStringInterface.h"
+#include "OgreParticleEmitterCommands.h"
+#include "OgreParticle.h"
+#include "OgreHeaderPrefix.h"
+
+
+namespace Ogre {
+
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Effects
+	*  @{
+	*/
+	/** Abstract class defining the interface to be implemented by particle emitters.
+    @remarks
+        Particle emitters are the sources of particles in a particle system. 
+        This class defines the ParticleEmitter interface, and provides a basic implementation 
+        for tasks which most emitters will do (these are of course overridable).
+        Particle emitters can be  grouped into types, e.g. 'point' emitters, 'box' emitters etc; each type will 
+        create particles with a different starting point, direction and velocity (although
+        within the types you can configure the ranges of these parameters). 
+    @par
+        Because there are so many types of emitters you could use, OGRE chooses not to dictate
+        the available types. It comes with some in-built, but allows plugins or applications to extend the emitter types available.
+        This is done by subclassing ParticleEmitter to have the appropriate emission behaviour you want,
+        and also creating a subclass of ParticleEmitterFactory which is responsible for creating instances 
+        of your new emitter type. You register this factory with the ParticleSystemManager using
+        addEmitterFactory, and from then on emitters of this type can be created either from code or through
+        text particle scripts by naming the type.
+    @par
+        This same approach is used for ParticleAffectors (which modify existing particles per frame).
+        This means that OGRE is particularly flexible when it comes to creating particle system effects,
+        with literally infinite combinations of emitter and affector types, and parameters within those
+        types.
+    */
+    class _OgreExport ParticleEmitter : public StringInterface, public Particle
+    {
+    protected:
+
+        // Command object for setting / getting parameters
+        static EmitterCommands::CmdAngle msAngleCmd;
+        static EmitterCommands::CmdColour msColourCmd;
+        static EmitterCommands::CmdColourRangeStart msColourRangeStartCmd;
+        static EmitterCommands::CmdColourRangeEnd msColourRangeEndCmd;
+        static EmitterCommands::CmdDirection msDirectionCmd;
+        static EmitterCommands::CmdUp msUpCmd;
+		static EmitterCommands::CmdDirPositionRef msDirPositionRefCmd;
+        static EmitterCommands::CmdEmissionRate msEmissionRateCmd;
+        static EmitterCommands::CmdMaxTTL msMaxTTLCmd;
+        static EmitterCommands::CmdMaxVelocity msMaxVelocityCmd;
+        static EmitterCommands::CmdMinTTL msMinTTLCmd;
+        static EmitterCommands::CmdMinVelocity msMinVelocityCmd;
+        static EmitterCommands::CmdPosition msPositionCmd;
+        static EmitterCommands::CmdTTL msTTLCmd;
+        static EmitterCommands::CmdVelocity msVelocityCmd;
+        static EmitterCommands::CmdDuration msDurationCmd;
+        static EmitterCommands::CmdMinDuration msMinDurationCmd;
+        static EmitterCommands::CmdMaxDuration msMaxDurationCmd;
+        static EmitterCommands::CmdRepeatDelay msRepeatDelayCmd;
+        static EmitterCommands::CmdMinRepeatDelay msMinRepeatDelayCmd;
+        static EmitterCommands::CmdMaxRepeatDelay msMaxRepeatDelayCmd;
+		static EmitterCommands::CmdName msNameCmd;
+		static EmitterCommands::CmdEmittedEmitter msEmittedEmitterCmd;
+
+
+        /// Parent particle system
+        ParticleSystem* mParent;
+        /// Position relative to the center of the ParticleSystem
+        Vector3 mPosition;
+        /// Rate in particles per second at which this emitter wishes to emit particles
+        Real mEmissionRate;
+        /// Name of the type of emitter, MUST be initialised by subclasses
+        String mType;
+        /// Base direction of the emitter, may not be used by some emitters
+        Vector3 mDirection;
+        /// Notional up vector, used to speed up generation of variant directions, and also to orient some emitters.
+        Vector3 mUp;
+		/// When true, mDirPositionRef is used instead of mDirection to generate particles
+		bool mUseDirPositionRef;
+		/* Center position to tell in which direction will particles be emitted according to their position,
+            useful for explosions & implosions, some emitters (i.e. point emitter) may not need it. */
+        Vector3 mDirPositionRef;
+        /// Angle around direction which particles may be emitted, internally radians but angleunits for interface
+        Radian mAngle;
+        /// Min speed of particles
+        Real mMinSpeed;
+        /// Max speed of particles
+        Real mMaxSpeed;
+        /// Initial time-to-live of particles (min)
+        Real mMinTTL;
+        /// Initial time-to-live of particles (max)
+        Real mMaxTTL;
+        /// Initial colour of particles (range start)
+        ColourValue mColourRangeStart;
+        /// Initial colour of particles (range end)
+        ColourValue mColourRangeEnd;
+
+        /// Whether this emitter is currently enabled (defaults to true)
+        bool mEnabled;
+
+        /// Start time (in seconds from start of first call to ParticleSystem to update)
+        Real mStartTime;
+        /// Minimum length of time emitter will run for (0 = forever)
+        Real mDurationMin;
+        /// Maximum length of time the emitter will run for (0 = forever)
+        Real mDurationMax;
+        /// Current duration remainder
+        Real mDurationRemain;
+
+        /// Time between each repeat
+        Real mRepeatDelayMin;
+        Real mRepeatDelayMax;
+        /// Repeat delay left
+        Real mRepeatDelayRemain;
+
+		// Fractions of particles wanted to be emitted last time
+		Real mRemainder;
+
+        /// The name of the emitter. The name is optional unless it is used as an emitter that is emitted itself.
+        String mName;
+
+		/// The name of the emitter to be emitted (optional)
+        String mEmittedEmitter;
+
+		// If 'true', this emitter is emitted by another emitter.
+		// NB. That doesn't imply that the emitter itself emits other emitters (that could or could not be the case)
+		bool mEmitted;
+
+		// NB Method below here are to help out people implementing emitters by providing the
+        // most commonly used approaches as piecemeal methods
+
+        /** Internal utility method for generating particle exit direction
+        @param destVector Reference to vector to complete with new direction (normalised)
+        */
+        virtual void genEmissionDirection( const Vector3 &particlePos, Vector3& destVector );
+
+        /** Internal utility method to apply velocity to a particle direction.
+        @param destVector The vector to scale by a randomly generated scale between min and max speed.
+            Assumed normalised already, and likely already oriented in the right direction.
+        */
+        virtual void genEmissionVelocity(Vector3& destVector);
+
+        /** Internal utility method for generating a time-to-live for a particle. */
+        virtual Real genEmissionTTL(void);
+
+        /** Internal utility method for generating a colour for a particle. */
+        virtual void genEmissionColour(ColourValue& destColour);
+
+        /** Internal utility method for generating an emission count based on a constant emission rate. */
+        virtual unsigned short genConstantEmissionCount(Real timeElapsed);
+
+        /** Internal method for setting up the basic parameter definitions for a subclass. 
+        @remarks
+            Because StringInterface holds a dictionary of parameters per class, subclasses need to
+            call this to ask the base class to add it's parameters to their dictionary as well.
+            Can't do this in the constructor because that runs in a non-virtual context.
+        @par
+            The subclass must have called it's own createParamDictionary before calling this method.
+        */
+        void addBaseParameters(void);
+
+        /** Internal method for initialising the duration & repeat of an emitter. */
+        void initDurationRepeat(void);
+
+
+    public:
+        ParticleEmitter(ParticleSystem* psys);
+        /** Virtual destructor essential. */
+        virtual ~ParticleEmitter();
+
+		/** Sets the position of this emitter relative to the particle system center. */
+        virtual void setPosition(const Vector3& pos);
+
+        /** Returns the position of this emitter relative to the center of the particle system. */
+        virtual const Vector3& getPosition(void) const;
+
+        /** Sets the direction of the emitter.
+        @remarks
+            Most emitters will have a base direction in which they emit particles (those which
+            emit in all directions will ignore this parameter). They may not emit exactly along this
+            vector for every particle, many will introduce a random scatter around this vector using 
+            the angle property.
+        @note 
+			This resets the up vector.
+        @param direction
+            The base direction for particles emitted.
+        */
+        virtual void setDirection(const Vector3& direction);
+
+        /** Returns the base direction of the emitter. */
+        virtual const Vector3& getDirection(void) const;
+
+        /** Sets the notional up vector of the emitter
+        @remarks
+			Many emitters emit particles from within a region, and for some that region is not
+			circularly symmetric about the emitter direction. The up vector allows such emitters
+			to be orientated about the direction vector.
+        @param up
+            The base direction for particles emitted. It must be perpendicular to the direction vector.
+        */
+        virtual void setUp(const Vector3& up);
+
+        /** Returns the up vector of the emitter. */
+        virtual const Vector3& getUp(void) const;
+
+		/** Sets the direction of the emitter.
+			Some particle effects need to emit particles in many random directions, but still
+			following some rules; like not having them collide against each other. Very useful
+			for explosions and implosions (when velocity is negative)
+		@note
+			Although once enabled mDirPositionRef will supersede mDirection; calling setDirection()
+			may still be needed to setup a custom up vector.
+		@param position
+            The reference position in which the direction of the particles will be calculated from,
+			also taking into account the particle's position at the time of emission.
+		@param enable
+            True to use mDirPositionRef, false to use the default behaviour with mDirection
+		*/
+		virtual void setDirPositionReference( const Vector3& position, bool enable );
+
+		/** Returns the position reference to generate direction of emitted particles */
+		virtual const Vector3& getDirPositionReference() const;
+
+		/** Returns whether direction or position reference is used */
+		virtual bool getDirPositionReferenceEnabled() const;
+
+        /** Sets the maximum angle away from the emitter direction which particle will be emitted.
+        @remarks
+            Whilst the direction property defines the general direction of emission for particles, 
+            this property defines how far the emission angle can deviate away from this base direction.
+            This allows you to create a scatter effect - if set to 0, all particles will be emitted
+            exactly along the emitters direction vector, whereas if you set it to 180 degrees or more,
+            particles will be emitted in a sphere, i.e. in all directions.
+        @param angle
+            Maximum angle which initial particle direction can deviate from the emitter base direction vector.
+        */
+        virtual void setAngle(const Radian& angle);
+
+        /** Returns the maximum angle which the initial particle direction can deviate from the emitters base direction. */
+        virtual const Radian& getAngle(void) const;
+
+        /** Sets the initial velocity of particles emitted.
+        @remarks
+            This method sets a constant speed for emitted particles. See the alternate version
+            of this method which takes 2 parameters if you want a variable speed. 
+        @param
+            speed The initial speed in world units per second which every particle emitted starts with.
+        */
+        virtual void setParticleVelocity(Real speed);
+
+
+        /** Sets the initial velocity range of particles emitted.
+        @remarks
+            This method sets the range of starting speeds for emitted particles. 
+            See the alternate version of this method which takes 1 parameter if you want a 
+            constant speed. This emitter will randomly choose a speed between the minimum and 
+            maximum for each particle.
+        @param max The maximum speed in world units per second for the initial particle speed on emission.
+        @param min The minimum speed in world units per second for the initial particle speed on emission.
+        */
+        virtual void setParticleVelocity(Real min, Real max);
+        /** Returns the minimum particle velocity. */
+        virtual void setMinParticleVelocity(Real min);
+        /** Returns the maximum particle velocity. */
+        virtual void setMaxParticleVelocity(Real max);
+
+        /** Returns the initial velocity of particles emitted. */
+        virtual Real getParticleVelocity(void) const;
+
+        /** Returns the minimum particle velocity. */
+        virtual Real getMinParticleVelocity(void) const;
+
+        /** Returns the maximum particle velocity. */
+        virtual Real getMaxParticleVelocity(void) const;
+
+        /** Sets the emission rate for this emitter.
+        @remarks
+            This method tells the emitter how many particles per second should be emitted. The emitter
+            subclass does not have to emit these in a continuous burst - this is a relative parameter
+            and the emitter may choose to emit all of the second's worth of particles every half-second
+            for example. This is controlled by the emitter's getEmissionCount method.
+        @par
+            Also, if the ParticleSystem's particle quota is exceeded, not all the particles requested
+            may be actually emitted.
+        @param
+            particlesPerSecond The number of particles to be emitted every second.
+        */
+        virtual void setEmissionRate(Real particlesPerSecond);
+
+        /** Returns the emission rate set for this emitter. */
+        virtual Real getEmissionRate(void) const;
+
+        /** Sets the lifetime of all particles emitted.
+        @remarks
+            The emitter initialises particles with a time-to-live (TTL), the number of seconds a particle
+            will exist before being destroyed. This method sets a constant TTL for all particles emitted.
+            Note that affectors are able to modify the TTL of particles later.
+        @par
+            Also see the alternate version of this method which takes a min and max TTL in order to 
+            have the TTL vary per particle.
+        @param ttl The number of seconds each particle will live for.
+        */
+        virtual void setTimeToLive(Real ttl);
+        /** Sets the range of lifetime for particles emitted.
+        @remarks
+            The emitter initialises particles with a time-to-live (TTL), the number of seconds a particle
+            will exist before being destroyed. This method sets a range for the TTL for all particles emitted;
+            the ttl may be randomised between these 2 extremes or will vary some other way depending on the
+            emitter.
+            Note that affectors are able to modify the TTL of particles later.
+        @par
+            Also see the alternate version of this method which takes a single TTL in order to 
+            set a constant TTL for all particles.
+        @param minTtl The minimum number of seconds each particle will live for.
+        @param maxTtl The maximum number of seconds each particle will live for.
+        */
+        virtual void setTimeToLive(Real minTtl, Real maxTtl);
+
+        /** Sets the minimum time each particle will live for. */
+        virtual void setMinTimeToLive(Real min);
+        /** Sets the maximum time each particle will live for. */
+        virtual void setMaxTimeToLive(Real max);
+        
+        /** Gets the time each particle will live for. */
+        virtual Real getTimeToLive(void) const;
+
+        /** Gets the minimum time each particle will live for. */
+        virtual Real getMinTimeToLive(void) const;
+        /** Gets the maximum time each particle will live for. */
+        virtual Real getMaxTimeToLive(void) const;
+
+        /** Sets the initial colour of particles emitted.
+        @remarks
+            Particles have an initial colour on emission which the emitter sets. This method sets
+            this colour. See the alternate version of this method which takes 2 colours in order to establish 
+            a range of colours to be assigned to particles.
+        @param colour The colour which all particles will be given on emission.
+        */
+        virtual void setColour(const ColourValue& colour);
+        /** Sets the range of colours for emitted particles.
+        @remarks
+            Particles have an initial colour on emission which the emitter sets. This method sets
+            the range of this colour. See the alternate version of this method which takes a single colour
+            in order to set a constant colour for all particles. Emitters may choose to randomly assign
+            a colour in this range, or may use some other method to vary the colour.
+        @param colourStart The start of the colour range
+        @param colourEnd The end of the colour range
+        */
+        virtual void setColour(const ColourValue& colourStart, const ColourValue& colourEnd);
+        /** Sets the minimum colour of particles to be emitted. */
+        virtual void setColourRangeStart(const ColourValue& colour);
+        /** Sets the maximum colour of particles to be emitted. */
+        virtual void setColourRangeEnd(const ColourValue& colour);
+        /** Gets the colour of particles to be emitted. */
+        virtual const ColourValue& getColour(void) const;
+        /** Gets the minimum colour of particles to be emitted. */
+        virtual const ColourValue& getColourRangeStart(void) const;
+        /** Gets the maximum colour of particles to be emitted. */
+        virtual const ColourValue& getColourRangeEnd(void) const;
+
+        /** Gets the number of particles which this emitter would like to emit based on the time elapsed.
+        @remarks
+            For efficiency the emitter does not actually create new Particle instances (these are reused
+            by the ParticleSystem as existing particles 'die'). The implementation for this method must
+            return the number of particles the emitter would like to emit given the number of seconds which
+            have elapsed (passed in as a parameter).
+        @par
+            Based on the return value from this method, the ParticleSystem class will call 
+            _initParticle once for each particle it chooses to allow to be emitted by this emitter.
+            The emitter should not track these _initParticle calls, it should assume all emissions
+            requested were made (even if they could not be because of particle quotas).
+        */
+        virtual unsigned short _getEmissionCount(Real timeElapsed) = 0;
+
+        /** Initialises a particle based on the emitter's approach and parameters.
+        @remarks
+            See the _getEmissionCount method for details of why there is a separation between
+            'requested' emissions and actual initialised particles.
+        @param
+            pParticle Pointer to a particle which must be initialised based on how this emitter
+            starts particles. This is passed as a pointer rather than being created by the emitter so the
+            ParticleSystem can reuse Particle instances, and can also set defaults itself.
+        */
+        virtual void _initParticle(Particle* pParticle) {
+            // Initialise size in case it's been altered
+            pParticle->resetDimensions();
+        }
+
+
+        /** Returns the name of the type of emitter. 
+        @remarks
+            This property is useful for determining the type of emitter procedurally so another
+            can be created.
+        */
+        const String &getType(void) const { return mType; }
+
+        /** Sets whether or not the emitter is enabled.
+        @remarks
+            You can turn an emitter off completely by setting this parameter to false.
+        */
+        virtual void setEnabled(bool enabled);
+
+        /** Gets the flag indicating if this emitter is enabled or not. */
+        virtual bool getEnabled(void) const;
+
+        /** Sets the 'start time' of this emitter.
+        @remarks
+            By default an emitter starts straight away as soon as a ParticleSystem is first created,
+            or also just after it is re-enabled. This parameter allows you to set a time delay so
+            that the emitter does not 'kick in' until later.
+        @param startTime The time in seconds from the creation or enabling of the emitter.
+        */
+        virtual void setStartTime(Real startTime);
+        /** Gets the start time of the emitter. */
+        virtual Real getStartTime(void) const;
+
+        /** Sets the duration of the emitter.
+        @remarks
+            By default emitters run indefinitely (unless you manually disable them). By setting this
+            parameter, you can make an emitter turn off on it's own after a set number of seconds. It
+            will then remain disabled until either setEnabled(true) is called, or if the 'repeatAfter' parameter
+            has been set it will also repeat after a number of seconds.
+        @par
+            Also see the alternative version of this method which allows you to set a min and max duration for
+            a random variable duration.
+        @param duration The duration in seconds.
+        */
+        virtual void setDuration(Real duration);
+
+        /** Gets the duration of the emitter from when it is created or re-enabled. */
+        virtual Real getDuration(void) const;
+
+        /** Sets the range of random duration for this emitter. 
+        @remarks
+            By default emitters run indefinitely (unless you manually disable them). By setting this
+            parameter, you can make an emitter turn off on it's own after a random number of seconds. It
+            will then remain disabled until either setEnabled(true) is called, or if the 'repeatAfter' parameter
+            has been set it will also repeat after a number of seconds.
+        @par
+            Also see the alternative version of this method which allows you to set a constant duration.
+        @param min The minimum duration in seconds.
+        @param max The minimum duration in seconds.
+        */
+        virtual void setDuration(Real min, Real max);
+        /** Sets the minimum duration of this emitter in seconds (see setDuration for more details) */
+        virtual void setMinDuration(Real min);
+        /** Sets the maximum duration of this emitter in seconds (see setDuration for more details) */
+        virtual void setMaxDuration(Real max);
+        /** Gets the minimum duration of this emitter in seconds (see setDuration for more details) */
+        virtual Real getMinDuration(void) const;
+        /** Gets the maximum duration of this emitter in seconds (see setDuration for more details) */
+        virtual Real getMaxDuration(void) const;
+
+        /** Sets the time between repeats of the emitter.
+        @remarks
+            By default emitters run indefinitely (unless you manually disable them). However, if you manually
+            disable the emitter (by calling setEnabled(false), or it's duration runs out, it will cease to emit
+        @par
+            Also see the alternative version of this method which allows you to set a min and max duration for
+            a random variable duration.
+        @param duration The duration in seconds.
+        */
+        virtual void setRepeatDelay(Real duration);
+
+        /** Gets the duration of the emitter from when it is created or re-enabled. */
+        virtual Real getRepeatDelay(void) const;
+
+        /** Sets the range of random duration for this emitter. 
+        @remarks
+            By default emitters run indefinitely (unless you manually disable them). By setting this
+            parameter, you can make an emitter turn off on it's own after a random number of seconds. It
+            will then remain disabled until either setEnabled(true) is called, or if the 'repeatAfter' parameter
+            has been set it will also repeat after a number of seconds.
+        @par
+            Also see the alternative version of this method which allows you to set a constant duration.
+        @param min The minimum duration in seconds.
+        @param max The minimum duration in seconds.
+        */
+        virtual void setRepeatDelay(Real min, Real max);
+        /** Sets the minimum duration of this emitter in seconds (see setRepeatDelay for more details) */
+        virtual void setMinRepeatDelay(Real min);
+        /** Sets the maximum duration of this emitter in seconds (see setRepeatDelay for more details) */
+        virtual void setMaxRepeatDelay(Real max);
+        /** Gets the minimum duration of this emitter in seconds (see setRepeatDelay for more details) */
+        virtual Real getMinRepeatDelay(void) const;
+        /** Gets the maximum duration of this emitter in seconds (see setRepeatDelay for more details) */
+        virtual Real getMaxRepeatDelay(void) const;
+
+		/** Returns the name of the emitter */
+		const String &getName(void) const;
+
+		/** Sets the name of the emitter */
+		virtual void setName(const String& newName);
+
+		/** Returns the name of the emitter to be emitted */
+		const String &getEmittedEmitter(void) const;
+
+		/** Sets the name of the emitter to be emitted*/
+		virtual void setEmittedEmitter(const String& emittedEmitter);
+
+		/** Return true if the emitter is emitted by another emitter */
+		virtual bool isEmitted(void) const;
+
+		/** Set the indication (true/false) to indicate that the emitter is emitted by another emitter */
+		virtual void setEmitted(bool emitted);
+
+
+    };
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreParticleEmitterCommands.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreParticleEmitterCommands.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreParticleEmitterCommands.h	(revision 148)
@@ -0,0 +1,223 @@
+/*
+-----------------------------------------------------------------------------
+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 __ParticleEmitterCommands_H__
+#define __ParticleEmitterCommands_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreStringInterface.h"
+
+namespace Ogre  {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Effects
+	*  @{
+	*/
+
+    namespace EmitterCommands {
+        /// Command object for ParticleEmitter  - see ParamCommand 
+        class _OgreExport CmdAngle : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for particle emitter  - see ParamCommand 
+        class _OgreExport CmdColour : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+
+        /// Command object for particle emitter  - see ParamCommand 
+        class _OgreExport CmdColourRangeStart : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for particle emitter  - see ParamCommand 
+        class _OgreExport CmdColourRangeEnd : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+
+        /// Command object for particle emitter  - see ParamCommand 
+        class _OgreExport CmdDirection : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        
+        /// Command object for particle emitter  - see ParamCommand 
+        class _OgreExport CmdUp : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+
+		/// Command object for particle emitter  - see ParamCommand 
+        class _OgreExport CmdDirPositionRef : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+
+        /// Command object for particle emitter  - see ParamCommand 
+        class _OgreExport CmdEmissionRate : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for particle emitter  - see ParamCommand 
+        class _OgreExport CmdVelocity : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for particle emitter  - see ParamCommand 
+        class _OgreExport CmdMinVelocity : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for particle emitter  - see ParamCommand 
+        class _OgreExport CmdMaxVelocity : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for particle emitter  - see ParamCommand 
+        class _OgreExport CmdTTL : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for particle emitter  - see ParamCommand 
+        class _OgreExport CmdMinTTL : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for particle emitter  - see ParamCommand 
+        class _OgreExport CmdMaxTTL : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for particle emitter  - see ParamCommand 
+        class _OgreExport CmdPosition : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for particle emitter  - see ParamCommand 
+        class _OgreExport CmdDuration : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for particle emitter  - see ParamCommand 
+        class _OgreExport CmdMinDuration : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for particle emitter  - see ParamCommand 
+        class _OgreExport CmdMaxDuration : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for particle emitter  - see ParamCommand 
+        class _OgreExport CmdRepeatDelay : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for particle emitter  - see ParamCommand 
+        class _OgreExport CmdMinRepeatDelay : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for particle emitter  - see ParamCommand 
+        class _OgreExport CmdMaxRepeatDelay : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+		/// Command object for particle emitter  - see ParamCommand
+        class _OgreExport CmdName : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+
+		/// Command object for particle emitter  - see ParamCommand 
+        class _OgreExport CmdEmittedEmitter : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+
+    }
+	/** @} */
+	/** @} */
+
+}
+
+
+
+
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreParticleEmitterFactory.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreParticleEmitterFactory.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreParticleEmitterFactory.h	(revision 148)
@@ -0,0 +1,86 @@
+/*
+-----------------------------------------------------------------------------
+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 __ParticleEmitterFactory_H__
+#define __ParticleEmitterFactory_H__
+
+
+#include "OgrePrerequisites.h"
+#include "OgreParticleEmitter.h"
+#include "OgreString.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Effects
+	*  @{
+	*/
+	/** Abstract class defining the interface to be implemented by creators of ParticleEmitter subclasses.
+    @remarks
+        Plugins or 3rd party applications can add new types of particle emitters to Ogre by creating
+        subclasses of the ParticleEmitter class. Because multiple instances of these emitters may be
+        required, a factory class to manage the instances is also required. 
+    @par
+        ParticleEmitterFactory subclasses must allow the creation and destruction of ParticleEmitter
+        subclasses. They must also be registered with the ParticleSystemManager. All factories have
+        a name which identifies them, examples might be 'point', 'cone', or 'box', and these can be 
+        also be used from particle system scripts.
+    */
+	class _OgreExport ParticleEmitterFactory : public FXAlloc
+    {
+    protected:
+        vector<ParticleEmitter*>::type mEmitters;
+    public:
+        ParticleEmitterFactory() {}
+        virtual ~ParticleEmitterFactory();
+
+        /** Returns the name of the factory, the name which identifies the particle emitter type this factory creates. */
+        virtual String getName() const = 0;
+
+        /** Creates a new emitter instance.
+        @remarks
+            The subclass MUST add a pointer to the created instance to mEmitters.
+        */
+        virtual ParticleEmitter* createEmitter(ParticleSystem* psys) = 0;
+
+        /** Destroys the emitter pointed to by the parameter (for early clean up if required). */
+        virtual void destroyEmitter(ParticleEmitter* e);
+
+    };
+
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreParticleIterator.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreParticleIterator.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreParticleIterator.h	(revision 148)
@@ -0,0 +1,70 @@
+/*
+-----------------------------------------------------------------------------
+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 __ParticleIterator_H__
+#define __ParticleIterator_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Effects
+	*  @{
+	*/
+	/** Convenience class to make it easy to step through all particles in a ParticleSystem.
+    */
+    class _OgreExport ParticleIterator
+    {
+        friend class ParticleSystem;
+    protected:
+        list<Particle*>::type::iterator mPos;
+        list<Particle*>::type::iterator mStart;
+        list<Particle*>::type::iterator mEnd;
+
+        /// Protected constructor, only available from ParticleSystem::getIterator
+        ParticleIterator(list<Particle*>::type::iterator start, list<Particle*>::type::iterator end);
+
+    public:
+        /// Returns true when at the end of the particle list
+        bool end(void);
+
+        /** Returns a pointer to the next particle, and moves the iterator on by 1 element. */
+        Particle* getNext(void);
+    };
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreParticleSystem.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreParticleSystem.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreParticleSystem.h	(revision 148)
@@ -0,0 +1,916 @@
+/*
+-----------------------------------------------------------------------------
+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 __ParticleSystem_H__
+#define __ParticleSystem_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreVector3.h"
+#include "OgreString.h"
+#include "OgreParticleIterator.h"
+#include "OgreStringInterface.h"
+#include "OgreMovableObject.h"
+#include "OgreRadixSort.h"
+#include "OgreController.h"
+#include "OgreResourceGroupManager.h"
+#include "OgreHeaderPrefix.h"
+
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Effects
+	*  @{
+	*/
+	/** Class defining particle system based special effects.
+    @remarks
+        Particle systems are special effects generators which are based on a 
+        number of moving points to create the impression of things like like 
+        sparkles, smoke, blood spurts, dust etc.
+    @par
+        This class simply manages a single collection of particles in world space
+        with a shared local origin for emission. The visual aspect of the 
+        particles is handled by a ParticleSystemRenderer instance.
+    @par
+        Particle systems are created using the SceneManager, never directly.
+        In addition, like all subclasses of MovableObject, the ParticleSystem 
+		will only be considered for rendering once it has been attached to a 
+		SceneNode. 
+    */
+    class _OgreExport ParticleSystem : public StringInterface, public MovableObject
+    {
+    public:
+
+        /** Command object for quota (see ParamCommand).*/
+        class _OgrePrivate CmdQuota : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /** Command object for emittedEmitterQuota (see ParamCommand).*/
+        class _OgrePrivate CmdEmittedEmitterQuota : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /** Command object for material (see ParamCommand).*/
+        class _OgrePrivate CmdMaterial : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /** Command object for cull_each (see ParamCommand).*/
+        class _OgrePrivate CmdCull : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /** Command object for particle_width (see ParamCommand).*/
+        class _OgrePrivate CmdWidth : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /** Command object for particle_height (see ParamCommand).*/
+        class _OgrePrivate CmdHeight : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /** Command object for renderer (see ParamCommand).*/
+        class _OgrePrivate CmdRenderer : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+		/** Command object for sorting (see ParamCommand).*/
+		class CmdSorted : public ParamCommand
+		{
+		public:
+			String doGet(const void* target) const;
+			void doSet(void* target, const String& val);
+		};
+		/** Command object for local space (see ParamCommand).*/
+		class CmdLocalSpace : public ParamCommand
+		{
+		public:
+			String doGet(const void* target) const;
+			void doSet(void* target, const String& val);
+		};
+		/** Command object for iteration interval(see ParamCommand).*/
+		class CmdIterationInterval : public ParamCommand
+		{
+		public:
+			String doGet(const void* target) const;
+			void doSet(void* target, const String& val);
+		};
+		/** Command object for nonvisible timeout (see ParamCommand).*/
+		class CmdNonvisibleTimeout : public ParamCommand
+		{
+		public:
+			String doGet(const void* target) const;
+			void doSet(void* target, const String& val);
+		};
+
+        /// Default constructor required for STL creation in manager
+        ParticleSystem();
+        /** Creates a particle system with no emitters or affectors.
+        @remarks
+            You should use the ParticleSystemManager to create particle systems rather than creating
+            them directly.
+        */
+        ParticleSystem(const String& name, const String& resourceGroupName);
+
+        virtual ~ParticleSystem();
+
+        /** Sets the ParticleRenderer to be used to render this particle system.
+        @remarks
+            The main ParticleSystem just manages the creation and movement of 
+            particles; they are rendered using functions in ParticleRenderer
+            and the ParticleVisual instances they create.
+		@param typeName String identifying the type of renderer to use; a new 
+			instance of this type will be created; a factory must have been registered
+			with ParticleSystemManager.
+        */
+        void setRenderer(const String& typeName);
+
+        /** Gets the ParticleRenderer to be used to render this particle system. */
+        ParticleSystemRenderer* getRenderer(void) const;
+        /** Gets the name of the ParticleRenderer to be used to render this particle system. */
+        const String& getRendererName(void) const;
+
+        /** Adds an emitter to this particle system.
+        @remarks
+            Particles are created in a particle system by emitters - see the ParticleEmitter
+            class for more details.
+        @param 
+            emitterType String identifying the emitter type to create. Emitter types are defined
+            by registering new factories with the manager - see ParticleEmitterFactory for more details.
+            Emitter types can be extended by OGRE, plugin authors or application developers.
+        */
+        ParticleEmitter* addEmitter(const String& emitterType);
+
+        /** Retrieves an emitter by it's index (zero-based).
+        @remarks
+            Used to retrieve a pointer to an emitter for a particle system to procedurally change
+            emission parameters etc.
+            You should check how many emitters are registered against this system before calling
+            this method with an arbitrary index using getNumEmitters.
+        @param
+            index Zero-based index of the emitter to retrieve.
+        */
+        ParticleEmitter* getEmitter(unsigned short index) const;
+
+        /** Returns the number of emitters for this particle system. */
+        unsigned short getNumEmitters(void) const;
+
+        /** Removes an emitter from the system.
+        @remarks
+            Drops the emitter with the index specified from this system.
+            You should check how many emitters are registered against this system before calling
+            this method with an arbitrary index using getNumEmitters.
+        @param
+            index Zero-based index of the emitter to retrieve.
+        */
+        void removeEmitter(unsigned short index);
+
+        /** Removes all the emitters from this system. */
+        void removeAllEmitters(void);
+
+
+        /** Adds an affector to this particle system.
+        @remarks
+            Particles are modified over time in a particle system by affectors - see the ParticleAffector
+            class for more details.
+        @param 
+            affectorType String identifying the affector type to create. Affector types are defined
+            by registering new factories with the manager - see ParticleAffectorFactory for more details.
+            Affector types can be extended by OGRE, plugin authors or application developers.
+        */
+        ParticleAffector* addAffector(const String& affectorType);
+
+        /** Retrieves an affector by it's index (zero-based).
+        @remarks
+            Used to retrieve a pointer to an affector for a particle system to procedurally change
+            affector parameters etc.
+            You should check how many affectors are registered against this system before calling
+            this method with an arbitrary index using getNumAffectors.
+        @param
+            index Zero-based index of the affector to retrieve.
+        */
+        ParticleAffector* getAffector(unsigned short index) const;
+
+        /** Returns the number of affectors for this particle system. */
+        unsigned short getNumAffectors(void) const;
+
+        /** Removes an affector from the system.
+        @remarks
+            Drops the affector with the index specified from this system.
+            You should check how many affectors are registered against this system before calling
+            this method with an arbitrary index using getNumAffectors.
+        @param
+            index Zero-based index of the affector to retrieve.
+        */
+        void removeAffector(unsigned short index);
+
+        /** Removes all the affectors from this system. */
+        void removeAllAffectors(void);
+
+        /** Empties this set of all particles.
+        */
+        void clear();
+
+        /** Gets the number of individual particles in the system right now.
+        @remarks
+            The number of particles active in a system at a point in time depends on 
+            the number of emitters, their emission rates, the time-to-live (TTL) each particle is
+            given on emission (and whether any affectors modify that TTL) and the maximum
+            number of particles allowed in this system at once (particle quota).
+        */
+        size_t getNumParticles(void) const;
+
+		/** Manually add a particle to the system. 
+		@remarks
+			Instead of using an emitter, you can manually add a particle to the system.
+			You must initialise the returned particle instance immediately with the
+			'emission' state.
+		@note
+			There is no corresponding 'destroyParticle' method - if you want to dispose of a
+			particle manually (say, if you've used setSpeedFactor(0) to make particles live forever)
+			you should use getParticle() and modify it's timeToLive to zero, meaning that it will
+			get cleaned up in the next update.
+		*/
+		Particle* createParticle(void);
+
+		/** Manually add an emitter particle to the system. 
+		@remarks
+			The purpose of a particle emitter is to emit particles. Besides visual particles, also other other
+			particle types can be emitted, other emitters for example. The emitted emitters have a double role;
+			they behave as particles and can be influenced by affectors, but they are still emitters and capable 
+			to emit other particles (or emitters). It is possible to create a chain of emitters - emitters 
+			emitting other emitters, which also emit emitters.
+		@param emitterName The name of a particle emitter that must be emitted.
+		*/
+		Particle* createEmitterParticle(const String& emitterName);
+
+		/** Retrieve a particle from the system for manual tweaking.
+		@remarks
+			Normally you use an affector to alter particles in flight, but
+			for small manually controlled particle systems you might want to use
+			this method.
+		*/
+		Particle* getParticle(size_t index);
+
+        /** Returns the maximum number of particles this system is allowed to have active at once.
+        @remarks
+            See ParticleSystem::setParticleQuota for more info.
+        */
+        size_t getParticleQuota(void) const;
+
+        /** Sets the maximum number of particles this system is allowed to have active at once.
+        @remarks
+            Particle systems all have a particle quota, i.e. a maximum number of particles they are 
+            allowed to have active at a time. This allows the application to set a keep particle systems
+            under control should they be affected by complex parameters which alter their emission rates
+            etc. If a particle system reaches it's particle quota, none of the emitters will be able to 
+            emit any more particles. As existing particles die, the spare capacity will be allocated
+            equally across all emitters to be as consistent to the original particle system style as possible.
+            The quota can be increased but not decreased after the system has been created.
+        @param quota The maximum number of particles this system is allowed to have.
+        */
+        void setParticleQuota(size_t quota);
+
+        /** Returns the maximum number of emitted emitters this system is allowed to have active at once.
+        @remarks
+            See ParticleSystem::setEmittedEmitterQuota for more info.
+        */
+        size_t getEmittedEmitterQuota(void) const;
+
+        /** Sets the maximum number of emitted emitters this system is allowed to have active at once.
+        @remarks
+            Particle systems can have - besides a particle quota - also an emitted emitter quota.
+        @param quota The maximum number of emitted emitters this system is allowed to have.
+        */
+        void setEmittedEmitterQuota(size_t quota);
+
+		/** Assignment operator for copying.
+        @remarks
+            This operator deep copies all particle emitters and effectors, but not particles. The
+            system's name is also not copied.
+        */
+        ParticleSystem& operator=(const ParticleSystem& rhs);
+
+        /** Updates the particles in the system based on time elapsed.
+        @remarks
+            This is called automatically every frame by OGRE.
+        @param
+            timeElapsed The amount of time, in seconds, since the last frame.
+        */
+        void _update(Real timeElapsed);
+
+        /** Returns an iterator for stepping through all particles in this system.
+        @remarks
+            This method is designed to be used by people providing new ParticleAffector subclasses,
+            this is the easiest way to step through all the particles in a system and apply the
+            changes the affector wants to make.
+        */
+        ParticleIterator _getIterator(void);
+
+        /** Sets the name of the material to be used for this billboard set.
+            @param
+                name The new name of the material to use for this set.
+        */
+        virtual void setMaterialName( const String& name, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME );
+
+        /** Sets the name of the material to be used for this billboard set.
+            @return The name of the material that is used for this set.
+        */
+        virtual const String& getMaterialName(void) const;
+
+        /** Overridden from MovableObject
+            @see
+                MovableObject
+        */
+        virtual void _notifyCurrentCamera(Camera* cam);
+
+        /** Overridden from MovableObject
+        @see
+        MovableObject
+        */
+        void _notifyAttached(Node* parent, bool isTagPoint = false);
+
+        /** Overridden from MovableObject
+            @see
+                MovableObject
+        */
+        virtual const AxisAlignedBox& getBoundingBox(void) const { return mAABB; }
+
+        /** Overridden from MovableObject
+            @see
+                MovableObject
+        */
+        virtual Real getBoundingRadius(void) const { return mBoundingRadius; }
+
+        /** Overridden from MovableObject
+            @see
+                MovableObject
+        */
+        virtual void _updateRenderQueue(RenderQueue* queue);
+
+		/// @copydoc MovableObject::visitRenderables
+		void visitRenderables(Renderable::Visitor* visitor, 
+			bool debugRenderables = false);
+
+        /** Fast-forwards this system by the required number of seconds.
+        @remarks
+            This method allows you to fast-forward a system so that it effectively looks like
+            it has already been running for the time you specify. This is useful to avoid the
+            'startup sequence' of a system, when you want the system to be fully populated right
+            from the start.
+        @param
+            time The number of seconds to fast-forward by.
+        @param
+            interval The sampling interval used to generate particles, apply affectors etc. The lower this
+            is the more realistic the fast-forward, but it takes more iterations to do it.
+        */
+        void fastForward(Real time, Real interval = 0.1);
+
+		/** Sets a 'speed factor' on this particle system, which means it scales the elapsed
+			real time which has passed by this factor before passing it to the emitters, affectors,
+			and the particle life calculation.
+		@remarks
+			An interesting side effect - if you want to create a completely manual particle system
+			where you control the emission and life of particles yourself, you can set the speed
+			factor to 0.0f, thus disabling normal particle emission, alteration, and death.
+		*/
+		void setSpeedFactor(Real speedFactor) { mSpeedFactor = speedFactor; }
+
+		/** Gets the 'speed factor' on this particle system.
+		*/
+		Real getSpeedFactor(void) const { return mSpeedFactor; }
+
+        /** Sets a 'iteration interval' on this particle system.
+        @remarks
+            The default Particle system update interval, based on elapsed frame time,
+			will cause different behavior between low frame-rate and high frame-rate. 
+			By using this option, you can make the particle system update at
+			a fixed interval, keeping the behavior the same no matter what frame-rate 
+			is.
+        @par
+            When iteration interval is set to zero, it means the update occurs based 
+			on an elapsed frame time, otherwise each iteration will take place 
+			at the given interval, repeating until it has used up all the elapsed 
+			frame time.
+        @param
+            iterationInterval The iteration interval, default to zero.
+        */
+        void setIterationInterval(Real iterationInterval);
+
+        /** Gets a 'iteration interval' on this particle system.
+        */
+        Real getIterationInterval(void) const { return mIterationInterval; }
+
+		/** Set the default iteration interval for all ParticleSystem instances.
+		*/
+        static void setDefaultIterationInterval(Real iterationInterval) { msDefaultIterationInterval = iterationInterval; }
+
+		/** Get the default iteration interval for all ParticleSystem instances.
+		*/
+        static Real getDefaultIterationInterval(void) { return msDefaultIterationInterval; }
+
+		/** Sets when the particle system should stop updating after it hasn't been
+			visible for a while.
+		@remarks
+			By default, visible particle systems update all the time, even when 
+			not in view. This means that they are guaranteed to be consistent when 
+			they do enter view. However, this comes at a cost, updating particle
+			systems can be expensive, especially if they are perpetual.
+		@par
+			This option lets you set a 'timeout' on the particle system, so that
+			if it isn't visible for this amount of time, it will stop updating
+			until it is next visible.
+		@param timeout The time after which the particle system will be disabled
+			if it is no longer visible. 0 to disable the timeout and always update.
+		*/
+		void setNonVisibleUpdateTimeout(Real timeout);
+		/** Gets when the particle system should stop updating after it hasn't been
+			visible for a while.
+		*/
+		Real getNonVisibleUpdateTimeout(void) const { return mNonvisibleTimeout; }
+
+		/** Set the default nonvisible timeout for all ParticleSystem instances.
+		*/
+		static void setDefaultNonVisibleUpdateTimeout(Real timeout) 
+		{ msDefaultNonvisibleTimeout = timeout; }
+
+		/** Get the default nonvisible timeout for all ParticleSystem instances.
+		*/
+		static Real getDefaultNonVisibleUpdateTimeout(void) { return msDefaultNonvisibleTimeout; }
+
+		/** Overridden from MovableObject */
+        const String& getMovableType(void) const;
+
+        /** Internal callback used by Particles to notify their parent that they have been resized.
+        */
+        virtual void _notifyParticleResized(void);
+
+        /** Internal callback used by Particles to notify their parent that they have been rotated.
+        */
+        virtual void _notifyParticleRotated(void);
+
+        /** Sets the default dimensions of the particles in this set.
+            @remarks
+                All particles in a set are created with these default dimensions. The set will render most efficiently if
+                all the particles in the set are the default size. It is possible to alter the size of individual
+                particles at the expense of extra calculation. See the Particle class for more info.
+            @param width
+                The new default width for the particles in this set.
+            @param height
+                The new default height for the particles in this set.
+        */
+        virtual void setDefaultDimensions(Real width, Real height);
+
+        /** See setDefaultDimensions - this sets 1 component individually. */
+        virtual void setDefaultWidth(Real width);
+        /** See setDefaultDimensions - this gets 1 component individually. */
+        virtual Real getDefaultWidth(void) const;
+        /** See setDefaultDimensions - this sets 1 component individually. */
+        virtual void setDefaultHeight(Real height);
+        /** See setDefaultDimensions - this gets 1 component individually. */
+        virtual Real getDefaultHeight(void) const;
+        /** Returns whether or not particles in this are tested individually for culling. */
+        virtual bool getCullIndividually(void) const;
+        /** Sets whether culling tests particles in this individually as well as in a group.
+        @remarks
+            Particle sets are always culled as a whole group, based on a bounding box which 
+            encloses all particles in the set. For fairly localised sets, this is enough. However, you
+            can optionally tell the set to also cull individual particles in the set, i.e. to test
+            each individual particle before rendering. The default is not to do this.
+        @par
+            This is useful when you have a large, fairly distributed set of particles, like maybe 
+            trees on a landscape. You probably still want to group them into more than one
+            set (maybe one set per section of landscape), which will be culled coarsely, but you also
+            want to cull the particles individually because they are spread out. Whilst you could have
+            lots of single-tree sets which are culled separately, this would be inefficient to render
+            because each tree would be issued as it's own rendering operation.
+        @par
+            By calling this method with a parameter of true, you can have large particle sets which 
+            are spaced out and so get the benefit of batch rendering and coarse culling, but also have
+            fine-grained culling so unnecessary rendering is avoided.
+        @param cullIndividual If true, each particle is tested before being sent to the pipeline as well 
+            as the whole set having to pass the coarse group bounding test.
+        */
+        virtual void setCullIndividually(bool cullIndividual);
+        /// Return the resource group to be used to load dependent resources
+        virtual const String& getResourceGroupName(void) const { return mResourceGroupName; }
+		/** Get the origin of this particle system, e.g. a script file name.
+		@remarks
+			This property will only contain something if the creator of
+			this particle system chose to populate it. Script loaders are advised
+			to populate it.
+		*/
+		const String& getOrigin(void) const { return mOrigin; }
+		/// Notify this particle system of it's origin
+		void _notifyOrigin(const String& origin) { mOrigin = origin; }
+
+		/** @copydoc MovableObject::setRenderQueueGroup */
+		void setRenderQueueGroup(uint8 queueID);
+		/** @copydoc MovableObject::setRenderQueueGroupAndPriority */
+		void setRenderQueueGroupAndPriority(uint8 queueID, ushort priority);
+
+		/** Set whether or not particles are sorted according to the camera.
+		@remarks
+			Enabling sorting alters the order particles are sent to the renderer.
+			When enabled, particles are sent to the renderer in order of 
+			furthest distance from the camera.
+		*/
+		void setSortingEnabled(bool enabled) { mSorted = enabled; }
+		/// Gets whether particles are sorted relative to the camera.
+		bool getSortingEnabled(void) const { return mSorted; }
+
+        /** Set the (initial) bounds of the particle system manually. 
+        @remarks
+            If you can, set the bounds of a particle system up-front and 
+            call setBoundsAutoUpdated(false); this is the most efficient way to
+            organise it. Otherwise, set an initial bounds and let the bounds increase
+            for a little while (the default is 5 seconds), after which time the 
+            AABB is fixed to save time.
+        @param aabb Bounds in local space.
+        */
+        void setBounds(const AxisAlignedBox& aabb);
+
+        /** Sets whether the bounds will be automatically updated
+            for the life of the particle system
+        @remarks
+            If you have a stationary particle system, it would be a good idea to
+            call this method and set the value to 'false', since the maximum
+            bounds of the particle system will eventually be static. If you do
+            this, you can either set the bounds manually using the setBounds()
+            method, or set the second parameter of this method to a positive
+            number of seconds, so that the bounds are calculated for a few
+            seconds and then frozen.
+        @param autoUpdate If true (the default), the particle system will
+            update it's bounds every frame. If false, the bounds update will 
+            cease after the 'stopIn' number of seconds have passed.
+        @param stopIn Only applicable if the first parameter is true, this is the
+            number of seconds after which the automatic update will cease.
+        */
+        void setBoundsAutoUpdated(bool autoUpdate, Real stopIn = 0.0f);
+
+		/** Sets whether particles (and any affector effects) remain relative 
+			to the node the particle system is attached to.
+		@remarks
+			By default particles are in world space once emitted, so they are not
+			affected by movement in the parent node of the particle system. This
+			makes the most sense when dealing with completely independent particles, 
+			but if you want to constrain them to follow local motion too, you
+			can set this to true.
+		*/
+		void setKeepParticlesInLocalSpace(bool keepLocal);
+
+		/** Gets whether particles (and any affector effects) remain relative 
+			to the node the particle system is attached to.
+		*/
+		bool getKeepParticlesInLocalSpace(void) const { return mLocalSpace; }
+
+        /** Internal method for updating the bounds of the particle system.
+        @remarks
+            This is called automatically for a period of time after the system's
+            creation (10 seconds by default, settable by setBoundsAutoUpdated) 
+            to increase (and only increase) the bounds of the system according 
+            to the emitted and affected particles. After this period, the 
+            system is assumed to achieved its maximum size, and the bounds are
+            no longer computed for efficiency. You can tweak the behaviour by 
+            either setting the bounds manually (setBounds, preferred), or 
+            changing the time over which the bounds are updated (performance cost).
+            You can also call this method manually if you need to update the 
+            bounds on an ad-hoc basis.
+        */
+        void _updateBounds(void);
+
+		/** This is used to turn on or off particle emission for this system.
+		@remarks
+			By default particle system is always emitting particles (if a emitters exists)
+			and this can be used to stop the emission for all emitters. To turn it on again, 
+			call it passing true.
+
+			Note that this does not detach the particle system from the scene node, it will 
+			still use some CPU.
+		*/
+		void setEmitting(bool v);
+
+		/** Returns true if the particle system emitting flag is turned on.
+		@remarks
+			This function will not actually return whether the particles are being emitted.
+			It only returns the value of emitting flag.
+		*/
+		bool getEmitting() const;
+
+		/// Override to return specific type flag
+		uint32 getTypeFlags(void) const;
+    protected:
+
+        /// Command objects
+        static CmdCull msCullCmd;
+        static CmdHeight msHeightCmd;
+        static CmdMaterial msMaterialCmd;
+        static CmdQuota msQuotaCmd;
+		static CmdEmittedEmitterQuota msEmittedEmitterQuotaCmd;
+        static CmdWidth msWidthCmd;
+        static CmdRenderer msRendererCmd;
+		static CmdSorted msSortedCmd;
+		static CmdLocalSpace msLocalSpaceCmd;
+		static CmdIterationInterval msIterationIntervalCmd;
+		static CmdNonvisibleTimeout msNonvisibleTimeoutCmd;
+
+
+        AxisAlignedBox mAABB;
+        Real mBoundingRadius;
+        bool mBoundsAutoUpdate;
+        Real mBoundsUpdateTime;
+        Real mUpdateRemainTime;
+
+        /// World AABB, only used to compare world-space positions to calc bounds
+        AxisAlignedBox mWorldAABB;
+
+        /// Name of the resource group to use to load materials
+        String mResourceGroupName;
+        /// Name of the material to use
+        String mMaterialName;
+        /// Have we set the material etc on the renderer?
+        bool mIsRendererConfigured;
+        /// Pointer to the material to use
+        MaterialPtr mMaterial;
+        /// Default width of each particle
+        Real mDefaultWidth;
+        /// Default height of each particle
+        Real mDefaultHeight;
+		/// Speed factor
+		Real mSpeedFactor;
+        /// Iteration interval
+        Real mIterationInterval;
+        /// Iteration interval set? Otherwise track default
+        bool mIterationIntervalSet;
+		/// Particles sorted according to camera?
+		bool mSorted;
+		/// Particles in local space?
+		bool mLocalSpace;
+		/// Update timeout when nonvisible (0 for no timeout)
+		Real mNonvisibleTimeout;
+		/// Update timeout when nonvisible set? Otherwise track default
+		bool mNonvisibleTimeoutSet;
+		/// Amount of time non-visible so far
+		Real mTimeSinceLastVisible;
+		/// Last frame in which known to be visible
+		unsigned long mLastVisibleFrame;
+		/// Controller for time update
+		Controller<Real>* mTimeController;
+        /// Indication whether the emitted emitter pool (= pool with particle emitters that are emitted) is initialised
+		bool mEmittedEmitterPoolInitialised;
+		/// Used to control if the particle system should emit particles or not.
+		bool mIsEmitting;
+
+        typedef list<Particle*>::type ActiveParticleList;
+        typedef list<Particle*>::type FreeParticleList;
+        typedef vector<Particle*>::type ParticlePool;
+
+        /** Sort by direction functor */
+        struct SortByDirectionFunctor
+        {
+            /// Direction to sort in
+            Vector3 sortDir;
+
+            SortByDirectionFunctor(const Vector3& dir);
+            float operator()(Particle* p) const;
+        };
+
+        /** Sort by distance functor */
+        struct SortByDistanceFunctor
+        {
+            /// Position to sort in
+            Vector3 sortPos;
+
+            SortByDistanceFunctor(const Vector3& pos);
+            float operator()(Particle* p) const;
+        };
+
+		static RadixSort<ActiveParticleList, Particle*, float> mRadixSorter;
+
+		/** Active particle list.
+            @remarks
+                This is a linked list of pointers to particles in the particle pool.
+            @par
+                This allows very fast insertions and deletions from anywhere in 
+                the list to activate / deactivate particles as well as reuse of 
+                Particle instances in the pool without construction & destruction 
+                which avoids memory thrashing.
+        */
+        ActiveParticleList mActiveParticles;
+
+        /** Free particle queue.
+            @remarks
+                This contains a list of the particles free for use as new instances
+                as required by the set. Particle instances are preconstructed up 
+                to the estimated size in the mParticlePool vector and are 
+                referenced on this deque at startup. As they get used this list
+                reduces, as they get released back to to the set they get added
+				back to the list.
+        */
+        FreeParticleList mFreeParticles;
+
+        /** Pool of particle instances for use and reuse in the active particle list.
+            @remarks
+                This vector will be preallocated with the estimated size of the set,and will extend as required.
+        */
+        ParticlePool mParticlePool;
+
+		typedef list<ParticleEmitter*>::type FreeEmittedEmitterList;
+		typedef list<ParticleEmitter*>::type ActiveEmittedEmitterList;
+		typedef vector<ParticleEmitter*>::type EmittedEmitterList;
+		typedef map<String, FreeEmittedEmitterList>::type FreeEmittedEmitterMap;
+		typedef map<String, EmittedEmitterList>::type EmittedEmitterPool;
+
+		/** Pool of emitted emitters for use and reuse in the active emitted emitter list.
+        @remarks
+			The emitters in this pool act as particles and as emitters. The pool is a map containing lists 
+			of emitters, identified by their name.
+        @par
+            The emitters in this pool are cloned using emitters that are kept in the main emitter list
+			of the ParticleSystem.
+        */
+		EmittedEmitterPool mEmittedEmitterPool;
+
+        /** Free emitted emitter list.
+            @remarks
+                This contains a list of the emitters free for use as new instances as required by the set.
+        */
+        FreeEmittedEmitterMap mFreeEmittedEmitters;
+
+		/** Active emitted emitter list.
+            @remarks
+                This is a linked list of pointers to emitters in the emitted emitter pool.
+				Emitters that are used are stored (their pointers) in both the list with active particles and in 
+				the list with active emitted emitters.        */
+        ActiveEmittedEmitterList mActiveEmittedEmitters;
+
+		typedef vector<ParticleEmitter*>::type ParticleEmitterList;
+        typedef vector<ParticleAffector*>::type ParticleAffectorList;
+        
+        /// List of particle emitters, ie sources of particles
+        ParticleEmitterList mEmitters;
+        /// List of particle affectors, ie modifiers of particles
+        ParticleAffectorList mAffectors;
+
+        /// The renderer used to render this particle system
+        ParticleSystemRenderer* mRenderer;
+
+        /// Do we cull each particle individually?
+        bool mCullIndividual;
+
+        /// The name of the type of renderer used to render this system
+        String mRendererType;
+        
+        /// The number of particles in the pool.
+        size_t mPoolSize;
+
+        /// The number of emitted emitters in the pool.
+        size_t mEmittedEmitterPoolSize;
+
+		/// Optional origin of this particle system (eg script name)
+		String mOrigin;
+
+        /// Default iteration interval
+        static Real msDefaultIterationInterval;
+        /// Default nonvisible update timeout
+        static Real msDefaultNonvisibleTimeout;
+
+        /** Internal method used to expire dead particles. */
+        void _expire(Real timeElapsed);
+
+        /** Spawn new particles based on free quota and emitter requirements. */
+        void _triggerEmitters(Real timeElapsed);
+
+		/** Helper function that actually performs the emission of particles
+        */
+		void _executeTriggerEmitters(ParticleEmitter* emitter, unsigned requested, Real timeElapsed);
+
+		/** Updates existing particle based on their momentum. */
+        void _applyMotion(Real timeElapsed);
+
+        /** Applies the effects of affectors. */
+        void _triggerAffectors(Real timeElapsed);
+
+		/** Sort the particles in the system **/
+		void _sortParticles(Camera* cam);
+
+        /** Resize the internal pool of particles. */
+        void increasePool(size_t size);
+
+		/** Resize the internal pool of emitted emitters.
+            @remarks
+                The pool consists of multiple vectors containing pointers to particle emitters. Increasing the 
+				pool with size implies that the vectors are equally increased. The quota of emitted emitters is 
+				defined on a particle system level and not on a particle emitter level. This is to prevent that
+				the number of created emitters becomes too high; the quota is shared amongst the emitted emitters.
+		*/
+		void increaseEmittedEmitterPool(size_t size);
+
+		/** Internal method for initialising string interface. */
+        void initParameters(void);
+
+        /** Internal method to configure the renderer. */
+        void configureRenderer(void);
+
+		/// Internal method for creating ParticleVisualData instances for the pool
+		void createVisualParticles(size_t poolstart, size_t poolend);
+		/// Internal method for destroying ParticleVisualData instances for the pool
+		void destroyVisualParticles(size_t poolstart, size_t poolend);
+
+		/** Create a pool of emitted emitters and assign them to the free emitter list.
+            @remarks
+                The emitters in the pool are grouped by name. This name is the name of the base emitter in the
+				main list with particle emitters, which forms the template of the created emitted emitters.
+        */
+		void initialiseEmittedEmitters(void);
+
+		/** Determine which emitters in the Particle Systems main emitter become a template for creating an
+			pool of emitters that can be emitted.
+        */
+		void initialiseEmittedEmitterPool(void);
+
+		/** Add  emitters from the pool to the free emitted emitter queue. */
+		void addFreeEmittedEmitters(void);
+
+		/** Removes all emitted emitters from this system.	*/
+		void removeAllEmittedEmitters(void);
+
+		/** Find the list with free emitted emitters.
+            @param name The name that identifies the list with free emitted emitters.
+        */
+		FreeEmittedEmitterList* findFreeEmittedEmitter (const String& name);
+
+		/** Removes an emitter from the active emitted emitter list.
+            @remarks
+                The emitter will not be destroyed!
+            @param emitter Pointer to a particle emitter.
+        */
+		void removeFromActiveEmittedEmitters (ParticleEmitter* emitter);
+
+		/** Moves all emitted emitters from the active list to the free list
+            @remarks
+                The active emitted emitter list will not be cleared and still keeps references to the emitters!
+        */
+		void addActiveEmittedEmittersToFreeList (void);
+
+		/** This function clears all data structures that are used in combination with emitted emitters and
+		    sets the flag to indicate that the emitted emitter pool must be initialised again.
+            @remarks
+                This function should be called if new emitters are added to a ParticleSystem or deleted from a
+				ParticleSystem. The emitted emitter data structures become out of sync and need to be build up
+				again. The data structures are not reorganised in this function, but by setting a flag, 
+				they are rebuild in the regular process flow.
+        */
+		void _notifyReorganiseEmittedEmitterData (void);
+    };
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreParticleSystemManager.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreParticleSystemManager.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreParticleSystemManager.h	(revision 148)
@@ -0,0 +1,409 @@
+/*
+-----------------------------------------------------------------------------
+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 __ParticleSystemManager_H__
+#define __ParticleSystemManager_H__
+
+
+#include "OgrePrerequisites.h"
+#include "OgreParticleSystem.h"
+#include "OgreFrameListener.h"
+#include "OgreSingleton.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreScriptLoader.h"
+#include "OgreResourceGroupManager.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	// Forward decl
+	class ParticleSystemFactory;
+	
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Effects
+	*  @{
+	*/
+	/** Manages particle systems, particle system scripts (templates) and the 
+		available emitter & affector factories.
+    @remarks
+        This singleton class is responsible for creating and managing particle 
+		systems. All particle systems must be created and destroyed using this 
+		object, although the user interface to creating them is via
+		SceneManager. Remember that like all other MovableObject
+        subclasses, ParticleSystems do not get rendered until they are 
+		attached to a SceneNode object.
+    @par
+        This class also manages factories for ParticleEmitter and 
+		ParticleAffector classes. To enable easy extensions to the types of 
+		emitters (particle sources) and affectors (particle modifiers), the
+        ParticleSystemManager lets plugins or applications register factory 
+		classes which submit new subclasses to ParticleEmitter and 
+		ParticleAffector. Ogre comes with a number of them already provided,
+        such as cone, sphere and box-shaped emitters, and simple affectors such
+	   	as constant directional force and colour faders. However using this 
+		registration process, a plugin can create any behaviour required.
+    @par
+        This class also manages the loading and parsing of particle system 
+		scripts, which are text files describing named particle system 
+		templates. Instances of particle systems using these templates can
+        then be created easily through the createParticleSystem method.
+    */
+    class _OgreExport ParticleSystemManager: 
+		public Singleton<ParticleSystemManager>, public ScriptLoader, public FXAlloc
+    {
+		friend class ParticleSystemFactory;
+	public:
+        typedef map<String, ParticleSystem*>::type ParticleTemplateMap;
+		typedef map<String, ParticleAffectorFactory*>::type ParticleAffectorFactoryMap;
+		typedef map<String, ParticleEmitterFactory*>::type ParticleEmitterFactoryMap;
+		typedef map<String, ParticleSystemRendererFactory*>::type ParticleSystemRendererFactoryMap;
+    protected:
+		OGRE_AUTO_MUTEX;
+			
+        /// Templates based on scripts
+        ParticleTemplateMap mSystemTemplates;
+        
+        /// Factories for named emitter types (can be extended using plugins)
+        ParticleEmitterFactoryMap mEmitterFactories;
+
+        /// Factories for named affector types (can be extended using plugins)
+        ParticleAffectorFactoryMap mAffectorFactories;
+
+		/// Map of renderer types to factories
+		ParticleSystemRendererFactoryMap mRendererFactories;
+
+        StringVector mScriptPatterns;
+
+		// Factory instance
+		ParticleSystemFactory* mFactory;
+
+        /** Internal script parsing method. */
+        void parseNewEmitter(const String& type, DataStreamPtr& chunk, ParticleSystem* sys);
+        /** Internal script parsing method. */
+        void parseNewAffector(const String& type, DataStreamPtr& chunk, ParticleSystem* sys);
+        /** Internal script parsing method. */
+        void parseAttrib(const String& line, ParticleSystem* sys);
+        /** Internal script parsing method. */
+        void parseEmitterAttrib(const String& line, ParticleEmitter* sys);
+        /** Internal script parsing method. */
+        void parseAffectorAttrib(const String& line, ParticleAffector* sys);
+        /** Internal script parsing method. */
+        void skipToNextCloseBrace(DataStreamPtr& chunk);
+        /** Internal script parsing method. */
+        void skipToNextOpenBrace(DataStreamPtr& chunk);
+
+		/// Internal implementation of createSystem
+        ParticleSystem* createSystemImpl(const String& name, size_t quota, 
+			const String& resourceGroup);
+		/// Internal implementation of createSystem
+        ParticleSystem* createSystemImpl(const String& name, const String& templateName);
+		/// Internal implementation of destroySystem
+        void destroySystemImpl(ParticleSystem* sys);
+		
+		
+    public:
+
+        ParticleSystemManager();
+        virtual ~ParticleSystemManager();
+
+        /** Adds a new 'factory' object for emitters to the list of available emitter types.
+        @remarks
+            This method allows plugins etc to add new particle emitter types to Ogre. Particle emitters
+            are sources of particles, and generate new particles with their start positions, colours and
+            momentums appropriately. Plugins would create new subclasses of ParticleEmitter which 
+            emit particles a certain way, and register a subclass of ParticleEmitterFactory to create them (since multiple 
+            emitters can be created for different particle systems).
+        @par
+            All particle emitter factories have an assigned name which is used to identify the emitter
+            type. This must be unique.
+        @par
+            Note that the object passed to this function will not be destroyed by the ParticleSystemManager,
+            since it may have been allocated on a different heap in the case of plugins. The caller must
+            destroy the object later on, probably on plugin shutdown.
+        @param factory
+            Pointer to a ParticleEmitterFactory subclass created by the plugin or application code.
+        */
+        void addEmitterFactory(ParticleEmitterFactory* factory);
+
+        /** Adds a new 'factory' object for affectors to the list of available affector types.
+        @remarks
+            This method allows plugins etc to add new particle affector types to Ogre. Particle
+            affectors modify the particles in a system a certain way such as affecting their direction
+            or changing their colour, lifespan etc. Plugins would
+            create new subclasses of ParticleAffector which affect particles a certain way, and register
+            a subclass of ParticleAffectorFactory to create them.
+        @par
+            All particle affector factories have an assigned name which is used to identify the affector
+            type. This must be unique.
+        @par
+            Note that the object passed to this function will not be destroyed by the ParticleSystemManager,
+            since it may have been allocated on a different heap in the case of plugins. The caller must
+            destroy the object later on, probably on plugin shutdown.
+        @param factory
+            Pointer to a ParticleAffectorFactory subclass created by the plugin or application code.
+        */
+        void addAffectorFactory(ParticleAffectorFactory* factory);
+
+		/** Registers a factory class for creating ParticleSystemRenderer instances. 
+        @par
+            Note that the object passed to this function will not be destroyed by the ParticleSystemManager,
+            since it may have been allocated on a different heap in the case of plugins. The caller must
+            destroy the object later on, probably on plugin shutdown.
+        @param factory
+            Pointer to a ParticleSystemRendererFactory subclass created by the plugin or application code.
+		*/
+		void addRendererFactory(ParticleSystemRendererFactory* factory);
+
+        /** Adds a new particle system template to the list of available templates. 
+        @remarks
+            Instances of particle systems in a scene are not normally unique - often you want to place the
+            same effect in many places. This method allows you to register a ParticleSystem as a named template,
+            which can subsequently be used to create instances using the createSystem method.
+        @par
+            Note that particle system templates can either be created programmatically by an application 
+            and registered using this method, or they can be defined in a script file (*.particle) which is
+            loaded by the engine at startup, very much like Material scripts.
+        @param name
+            The name of the template. Must be unique across all templates.
+        @param sysTemplate
+            A pointer to a particle system to be used as a template. The manager
+            will take over ownership of this pointer.
+            
+        */
+        void addTemplate(const String& name, ParticleSystem* sysTemplate);
+
+        /** Removes a specified template from the ParticleSystemManager.
+        @remarks
+            This method removes a given template from the particle system manager, optionally deleting
+            the template if the deleteTemplate method is called.  Throws an exception if the template
+            could not be found.
+        @param name
+            The name of the template to remove.
+        @param deleteTemplate
+            Whether or not to delete the template before removing it.
+        */
+        void removeTemplate(const String& name, bool deleteTemplate = true);
+
+        /** Removes a specified template from the ParticleSystemManager.
+        @remarks
+            This method removes all templates from the ParticleSystemManager.
+        @param deleteTemplate
+            Whether or not to delete the templates before removing them.
+        */
+        void removeAllTemplates(bool deleteTemplate = true);
+
+
+        /** Removes all templates that belong to a secific Resource Group from the ParticleSystemManager.
+        @remarks
+            This method removes all templates that belong in a particular resource group from the ParticleSystemManager.
+        @param resourceGroup
+            Resource group to delete templates for
+        */
+        void removeTemplatesByResourceGroup(const String& resourceGroup);
+
+        /** Create a new particle system template. 
+        @remarks
+            This method is similar to the addTemplate method, except this just creates a new template
+            and returns a pointer to it to be populated. Use this when you don't already have a system
+            to add as a template and just want to create a new template which you will build up in-place.
+        @param name
+            The name of the template. Must be unique across all templates.
+        @param resourceGroup
+            The name of the resource group which will be used to 
+            load any dependent resources.
+            
+        */
+        ParticleSystem* createTemplate(const String& name, const String& resourceGroup);
+
+        /** Retrieves a particle system template for possible modification. 
+        @remarks
+            Modifying a template does not affect the settings on any ParticleSystems already created
+            from this template.
+        */
+        ParticleSystem* getTemplate(const String& name);
+
+        /** Internal method for creating a new emitter from a factory.
+        @remarks
+            Used internally by the engine to create new ParticleEmitter instances from named
+            factories. Applications should use the ParticleSystem::addEmitter method instead, 
+            which calls this method to create an instance.
+        @param emitterType
+            String name of the emitter type to be created. A factory of this type must have been registered.
+        @param psys
+            The particle system this is being created for
+        */
+        ParticleEmitter* _createEmitter(const String& emitterType, ParticleSystem* psys);
+
+        /** Internal method for destroying an emitter.
+        @remarks
+            Because emitters are created by factories which may allocate memory from separate heaps,
+            the memory allocated must be freed from the same place. This method is used to ask the factory
+            to destroy the instance passed in as a pointer.
+        @param emitter
+            Pointer to emitter to be destroyed. On return this pointer will point to invalid (freed) memory.
+        */
+        void _destroyEmitter(ParticleEmitter* emitter);
+
+        /** Internal method for creating a new affector from a factory.
+        @remarks
+            Used internally by the engine to create new ParticleAffector instances from named
+            factories. Applications should use the ParticleSystem::addAffector method instead, 
+            which calls this method to create an instance.
+        @param affectorType
+            String name of the affector type to be created. A factory of this type must have been registered.
+        @param psys
+            The particle system it is being created for
+        */
+        ParticleAffector* _createAffector(const String& affectorType, ParticleSystem* psys);
+
+        /** Internal method for destroying an affector.
+        @remarks
+            Because affectors are created by factories which may allocate memory from separate heaps,
+            the memory allocated must be freed from the same place. This method is used to ask the factory
+            to destroy the instance passed in as a pointer.
+        @param affector
+            Pointer to affector to be destroyed. On return this pointer will point to invalid (freed) memory.
+        */
+        void _destroyAffector(ParticleAffector* affector);
+
+        /** Internal method for creating a new renderer from a factory.
+        @remarks
+            Used internally by the engine to create new ParticleSystemRenderer instances from named
+            factories. Applications should use the ParticleSystem::setRenderer method instead, 
+            which calls this method to create an instance.
+        @param rendererType
+            String name of the renderer type to be created. A factory of this type must have been registered.
+        */
+        ParticleSystemRenderer* _createRenderer(const String& rendererType);
+
+        /** Internal method for destroying a renderer.
+        @remarks
+            Because renderer are created by factories which may allocate memory from separate heaps,
+            the memory allocated must be freed from the same place. This method is used to ask the factory
+            to destroy the instance passed in as a pointer.
+        @param renderer
+            Pointer to renderer to be destroyed. On return this pointer will point to invalid (freed) memory.
+        */
+        void _destroyRenderer(ParticleSystemRenderer* renderer);
+
+        /** Init method to be called by OGRE system.
+        @remarks
+            Due to dependencies between various objects certain initialisation tasks cannot be done
+            on construction. OGRE will call this method when the rendering subsystem is initialised.
+        */
+        void _initialise(void);
+
+        /// @copydoc ScriptLoader::getScriptPatterns
+        const StringVector& getScriptPatterns(void) const;
+        /// @copydoc ScriptLoader::parseScript
+        void parseScript(DataStreamPtr& stream, const String& groupName);
+        /// @copydoc ScriptLoader::getLoadingOrder
+        Real getLoadingOrder(void) const;
+
+		typedef MapIterator<ParticleAffectorFactoryMap> ParticleAffectorFactoryIterator;
+		typedef MapIterator<ParticleEmitterFactoryMap> ParticleEmitterFactoryIterator;
+		typedef MapIterator<ParticleSystemRendererFactoryMap> ParticleRendererFactoryIterator;
+		/** Return an iterator over the affector factories currently registered */
+		ParticleAffectorFactoryIterator getAffectorFactoryIterator(void);
+		/** Return an iterator over the emitter factories currently registered */
+		ParticleEmitterFactoryIterator getEmitterFactoryIterator(void);
+		/** Return an iterator over the renderer factories currently registered */
+		ParticleRendererFactoryIterator getRendererFactoryIterator(void);
+
+
+        typedef MapIterator<ParticleTemplateMap> ParticleSystemTemplateIterator;
+        /** Gets an iterator over the list of particle system templates. */
+        ParticleSystemTemplateIterator getTemplateIterator(void)
+        {
+            return ParticleSystemTemplateIterator(
+                mSystemTemplates.begin(), mSystemTemplates.end());
+        } 
+
+        /** Get an instance of ParticleSystemFactory (internal use). */
+		ParticleSystemFactory* _getFactory(void) { return mFactory; }
+		
+		/** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static ParticleSystemManager& getSingleton(void);
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static ParticleSystemManager* getSingletonPtr(void);
+
+    };
+
+	/** Factory object for creating ParticleSystem instances */
+	class _OgreExport ParticleSystemFactory : public MovableObjectFactory
+	{
+	protected:
+		MovableObject* createInstanceImpl(const String& name, const NameValuePairList* params);
+	public:
+		ParticleSystemFactory() {}
+		~ParticleSystemFactory() {}
+		
+		static String FACTORY_TYPE_NAME;
+
+		const String& getType(void) const;
+		void destroyInstance( MovableObject* obj);  
+
+	};
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreParticleSystemRenderer.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreParticleSystemRenderer.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreParticleSystemRenderer.h	(revision 148)
@@ -0,0 +1,143 @@
+/*
+-----------------------------------------------------------------------------
+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 __ParticleSystemRenderer_H__
+#define __ParticleSystemRenderer_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreStringInterface.h"
+#include "OgreFactoryObj.h"
+#include "OgreRenderQueue.h"
+#include "OgreCommon.h"
+#include "OgreRenderable.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Effects
+	*  @{
+	*/
+	/** Abstract class defining the interface required to be implemented
+        by classes which provide rendering capability to ParticleSystem instances.
+    */
+    class _OgreExport ParticleSystemRenderer : public StringInterface, public FXAlloc
+    {
+    public:
+        /// Constructor
+        ParticleSystemRenderer() {}
+        /// Destructor
+        virtual ~ParticleSystemRenderer() {}
+
+        /** Gets the type of this renderer - must be implemented by subclasses */
+		virtual const String& getType(void) const = 0;
+
+		/** Delegated to by ParticleSystem::_updateRenderQueue
+        @remarks
+            The subclass must update the render queue using whichever Renderable
+            instance(s) it wishes.
+        */
+        virtual void _updateRenderQueue(RenderQueue* queue, 
+            list<Particle*>::type& currentParticles, bool cullIndividually) = 0;
+
+        /** Sets the material this renderer must use; called by ParticleSystem. */
+        virtual void _setMaterial(MaterialPtr& mat) = 0;
+        /** Delegated to by ParticleSystem::_notifyCurrentCamera */
+        virtual void _notifyCurrentCamera(Camera* cam) = 0;
+        /** Delegated to by ParticleSystem::_notifyAttached */
+        virtual void _notifyAttached(Node* parent, bool isTagPoint = false) = 0;
+        /** Optional callback notified when particles are rotated */
+        virtual void _notifyParticleRotated(void) {}
+        /** Optional callback notified when particles are resized individually */
+        virtual void _notifyParticleResized(void) {}
+        /** Tells the renderer that the particle quota has changed */
+        virtual void _notifyParticleQuota(size_t quota) = 0;
+        /** Tells the renderer that the particle default size has changed */
+        virtual void _notifyDefaultDimensions(Real width, Real height) = 0;
+        /** Optional callback notified when particle emitted */
+        virtual void _notifyParticleEmitted(Particle* particle) {}
+        /** Optional callback notified when particle expired */
+        virtual void _notifyParticleExpired(Particle* particle) {}
+        /** Optional callback notified when particles moved */
+        virtual void _notifyParticleMoved(list<Particle*>::type& currentParticles) {}
+        /** Optional callback notified when particles cleared */
+        virtual void _notifyParticleCleared(list<Particle*>::type& currentParticles) {}
+		/** Create a new ParticleVisualData instance for attachment to a particle.
+		@remarks
+			If this renderer needs additional data in each particle, then this should
+			be held in an instance of a subclass of ParticleVisualData, and this method
+			should be overridden to return a new instance of it. The default
+			behaviour is to return null.
+		*/
+		virtual ParticleVisualData* _createVisualData(void) { return 0; }
+		/** Destroy a ParticleVisualData instance.
+		@remarks
+			If this renderer needs additional data in each particle, then this should
+			be held in an instance of a subclass of ParticleVisualData, and this method
+			should be overridden to destroy an instance of it. The default
+			behaviour is to do nothing.
+		*/
+		virtual void _destroyVisualData(ParticleVisualData* vis) { assert (vis == 0); }
+
+		/** Sets which render queue group this renderer should target with it's
+			output.
+		*/
+		virtual void setRenderQueueGroup(uint8 queueID) = 0;
+		/** Sets which render queue group and priority this renderer should target with it's
+			output.
+		*/
+		virtual void setRenderQueueGroupAndPriority(uint8 queueID, ushort priority) = 0;
+
+		/** Setting carried over from ParticleSystem.
+		*/
+		virtual void setKeepParticlesInLocalSpace(bool keepLocal) = 0;
+
+        /** Gets the desired particles sort mode of this renderer */
+        virtual SortMode _getSortMode(void) const = 0;
+
+		/** Required method to allow the renderer to communicate the Renderables
+			it will be using to render the system to a visitor.
+		@see MovableObject::visitRenderables
+		*/
+		virtual void visitRenderables(Renderable::Visitor* visitor, 
+			bool debugRenderables = false) = 0;
+
+    };
+
+    /** Abstract class definition of a factory object for ParticleSystemRenderer. */
+    class _OgreExport ParticleSystemRendererFactory : public FactoryObj<ParticleSystemRenderer>, public FXAlloc
+    {
+    public:
+        // No methods, must just override all methods inherited from FactoryObj
+    };
+	/** @} */
+	/** @} */
+
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgrePass.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgrePass.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgrePass.h	(revision 148)
@@ -0,0 +1,1879 @@
+/*
+-----------------------------------------------------------------------------
+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 __Pass_H__
+#define __Pass_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreGpuProgram.h"
+#include "OgreColourValue.h"
+#include "OgreBlendMode.h"
+#include "OgreCommon.h"
+#include "OgreLight.h"
+#include "OgreTextureUnitState.h"
+#include "OgreUserObjectBindings.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Materials
+	*  @{
+	*/
+	/// Categorisation of passes for the purpose of additive lighting
+	enum IlluminationStage
+	{
+		/// Part of the rendering which occurs without any kind of direct lighting
+		IS_AMBIENT,
+		/// Part of the rendering which occurs per light
+		IS_PER_LIGHT,
+		/// Post-lighting rendering
+		IS_DECAL, 
+		/// Not determined
+		IS_UNKNOWN
+	};
+
+    /** Class defining a single pass of a Technique (of a Material), i.e.
+        a single rendering call.
+    @remarks
+        Rendering can be repeated with many passes for more complex effects.
+        Each pass is either a fixed-function pass (meaning it does not use
+        a vertex or fragment program) or a programmable pass (meaning it does
+        use either a vertex and fragment program, or both).
+    @par
+        Programmable passes are complex to define, because they require custom
+        programs and you have to set all constant inputs to the programs (like
+        the position of lights, any base material colours you wish to use etc), but
+        they do give you much total flexibility over the algorithms used to render your
+        pass, and you can create some effects which are impossible with a fixed-function pass.
+        On the other hand, you can define a fixed-function pass in very little time, and
+        you can use a range of fixed-function effects like environment mapping very
+        easily, plus your pass will be more likely to be compatible with older hardware.
+        There are pros and cons to both, just remember that if you use a programmable
+        pass to create some great effects, allow more time for definition and testing.
+    */
+	class _OgreExport Pass : public PassAlloc
+    {
+	public:
+		/** Definition of a functor for calculating the hashcode of a Pass.
+		@remarks
+			The hashcode of a Pass is used to sort Passes for rendering, in order
+			to reduce the number of render state changes. Each Pass represents a
+			single unique set of states, but by ordering them, state changes can
+			be minimised between passes. An implementation of this functor should
+			order passes so that the elements that you want to keep constant are
+			sorted next to each other.
+		@see Pass::setHashFunc
+		*/
+		struct HashFunc
+		{
+			virtual uint32 operator()(const Pass* p) const = 0;
+			/// Need virtual destructor in case subclasses use it
+			virtual ~HashFunc() {}
+		};
+    protected:
+        Technique* mParent;
+        unsigned short mIndex; /// Pass index
+        String mName; /// Optional name for the pass
+        uint32 mHash; /// Pass hash
+		bool mHashDirtyQueued; /// Needs to be dirtied when next loaded
+        //-------------------------------------------------------------------------
+        // Colour properties, only applicable in fixed-function passes
+        ColourValue mAmbient;
+        ColourValue mDiffuse;
+        ColourValue mSpecular;
+        ColourValue mEmissive;
+        Real mShininess;
+        TrackVertexColourType mTracking;
+        //-------------------------------------------------------------------------
+
+        //-------------------------------------------------------------------------
+        // Blending factors
+        SceneBlendFactor mSourceBlendFactor;
+        SceneBlendFactor mDestBlendFactor;
+		SceneBlendFactor mSourceBlendFactorAlpha;
+		SceneBlendFactor mDestBlendFactorAlpha;
+
+		// Used to determine if separate alpha blending should be used for color and alpha channels
+		bool mSeparateBlend;
+
+		//-------------------------------------------------------------------------
+		// Blending operations
+		SceneBlendOperation mBlendOperation;
+		SceneBlendOperation mAlphaBlendOperation;
+
+		/// Determines if we should use separate blending operations for color and alpha channels
+		bool mSeparateBlendOperation;
+
+        //-------------------------------------------------------------------------
+
+        //-------------------------------------------------------------------------
+        // Depth buffer settings
+        bool mDepthCheck;
+        bool mDepthWrite;
+        CompareFunction mDepthFunc;
+        float mDepthBiasConstant;
+		float mDepthBiasSlopeScale;
+		float mDepthBiasPerIteration;
+
+        /// Colour buffer settings
+        bool mColourWrite;
+
+		// Alpha reject settings
+		CompareFunction mAlphaRejectFunc;
+		unsigned char mAlphaRejectVal;
+		bool mAlphaToCoverageEnabled;
+
+		/// Transparent depth sorting
+		bool mTransparentSorting;
+		/// Transparent depth sorting forced
+		bool mTransparentSortingForced;
+        //-------------------------------------------------------------------------
+
+        //-------------------------------------------------------------------------
+        // Culling mode
+        CullingMode mCullMode;
+        ManualCullingMode mManualCullMode;
+        //-------------------------------------------------------------------------
+
+        /// Lighting enabled?
+        bool mLightingEnabled;
+        /// Max simultaneous lights
+        unsigned short mMaxSimultaneousLights;
+		/// Starting light index
+		unsigned short mStartLight;
+		/// Run this pass once per light?
+		bool mIteratePerLight;
+		/// Iterate per how many lights?
+		unsigned short mLightsPerIteration;
+        /// Should it only be run for a certain light type?
+        bool mRunOnlyForOneLightType;
+        Light::LightTypes mOnlyLightType;
+		/// With a specific light mask?
+		uint32 mLightMask;
+
+        /// Shading options
+        ShadeOptions mShadeOptions;
+		/// Polygon mode
+		PolygonMode mPolygonMode;
+		/// Normalisation
+		bool mNormaliseNormals;
+		bool mPolygonModeOverrideable;
+        //-------------------------------------------------------------------------
+        // Fog
+        bool mFogOverride;
+        FogMode mFogMode;
+        ColourValue mFogColour;
+        Real mFogStart;
+        Real mFogEnd;
+        Real mFogDensity;
+        //-------------------------------------------------------------------------
+
+        /// Storage of texture unit states
+        typedef vector<TextureUnitState*>::type TextureUnitStates;
+        TextureUnitStates mTextureUnitStates;
+
+		/// Vertex program details
+		GpuProgramUsage *mVertexProgramUsage;
+        /// Vertex program details
+        GpuProgramUsage *mShadowCasterVertexProgramUsage;
+        /// Fragment program details
+        GpuProgramUsage *mShadowCasterFragmentProgramUsage;
+        /// Vertex program details
+        GpuProgramUsage *mShadowReceiverVertexProgramUsage;
+		/// Fragment program details
+		GpuProgramUsage *mFragmentProgramUsage;
+		/// Fragment program details
+		GpuProgramUsage *mShadowReceiverFragmentProgramUsage;
+		/// Geometry program details
+		GpuProgramUsage *mGeometryProgramUsage;
+		/// Tesselation hull program details
+		GpuProgramUsage *mTesselationHullProgramUsage;
+		/// Tesselation domain program details
+		GpuProgramUsage *mTesselationDomainProgramUsage;
+		/// Compute program details
+		GpuProgramUsage *mComputeProgramUsage;
+        /// Is this pass queued for deletion?
+        bool mQueuedForDeletion;
+        /// Number of pass iterations to perform
+        size_t mPassIterationCount;
+		/// Point size, applies when not using per-vertex point size
+		Real mPointSize;
+		Real mPointMinSize;
+		Real mPointMaxSize;
+		bool mPointSpritesEnabled;
+		bool mPointAttenuationEnabled;
+		/// Constant, linear, quadratic coeffs
+		Real mPointAttenuationCoeffs[3];
+		// TU Content type lookups
+		typedef vector<unsigned short>::type ContentTypeLookup;
+		mutable ContentTypeLookup mShadowContentTypeLookup;
+		mutable bool mContentTypeLookupBuilt;
+		/// Scissoring for the light?
+		bool mLightScissoring;
+		/// User clip planes for light?
+		bool mLightClipPlanes;
+		/// Illumination stage?
+		IlluminationStage mIlluminationStage;
+		/// User objects binding.
+		UserObjectBindings	mUserObjectBindings;
+		
+
+		/// Used to get scene blending flags from a blending type
+		void _getBlendFlags(SceneBlendType type, SceneBlendFactor& source, SceneBlendFactor& dest);
+
+	public:
+		typedef set<Pass*>::type PassSet;
+    protected:
+		/// List of Passes whose hashes need recalculating
+		static PassSet msDirtyHashList;
+        /// The place where passes go to die
+        static PassSet msPassGraveyard;
+		/// The Pass hash functor
+		static HashFunc* msHashFunc;
+    public:
+		OGRE_STATIC_MUTEX(msDirtyHashListMutex);
+		OGRE_STATIC_MUTEX(msPassGraveyardMutex);
+		OGRE_MUTEX(mTexUnitChangeMutex);
+		OGRE_MUTEX(mGpuProgramChangeMutex);
+        /// Default constructor
+		Pass(Technique* parent, unsigned short index);
+        /// Copy constructor
+        Pass(Technique* parent, unsigned short index, const Pass& oth );
+        /// Operator = overload
+        Pass& operator=(const Pass& oth);
+        virtual ~Pass();
+
+        /// Returns true if this pass is programmable i.e. includes either a vertex or fragment program.
+        bool isProgrammable(void) const { return mVertexProgramUsage || mFragmentProgramUsage || mGeometryProgramUsage ||
+												 mTesselationHullProgramUsage || mTesselationDomainProgramUsage || mComputeProgramUsage; }
+        
+        /// Returns true if this pass uses a programmable vertex pipeline
+        bool hasVertexProgram(void) const { return mVertexProgramUsage != NULL; }
+        /// Returns true if this pass uses a programmable fragment pipeline
+        bool hasFragmentProgram(void) const { return mFragmentProgramUsage != NULL; }
+        /// Returns true if this pass uses a programmable geometry pipeline
+        bool hasGeometryProgram(void) const { return mGeometryProgramUsage != NULL; }
+    	/// Returns true if this pass uses a programmable tesselation control pipeline
+        bool hasTesselationHullProgram(void) const { return mTesselationHullProgramUsage != NULL; }
+		/// Returns true if this pass uses a programmable tesselation control pipeline
+        bool hasTesselationDomainProgram(void) const { return mTesselationDomainProgramUsage != NULL; }
+		/// Returns true if this pass uses a programmable compute pipeline
+        bool hasComputeProgram(void) const { return mComputeProgramUsage != NULL; }
+		/// Returns true if this pass uses a shadow caster vertex program
+	    bool hasShadowCasterVertexProgram(void) const { return mShadowCasterVertexProgramUsage != NULL; }
+        /// Returns true if this pass uses a shadow caster fragment program
+        bool hasShadowCasterFragmentProgram(void) const { return mShadowCasterFragmentProgramUsage != NULL; }
+        /// Returns true if this pass uses a shadow receiver vertex program
+        bool hasShadowReceiverVertexProgram(void) const { return mShadowReceiverVertexProgramUsage != NULL; }
+        /// Returns true if this pass uses a shadow receiver fragment program
+        bool hasShadowReceiverFragmentProgram(void) const { return mShadowReceiverFragmentProgramUsage != NULL; }
+
+        size_t calculateSize(void) const;
+
+        /// Gets the index of this Pass in the parent Technique
+        unsigned short getIndex(void) const { return mIndex; }
+        /* Set the name of the pass
+        @remarks
+        The name of the pass is optional.  Its useful in material scripts where a material could inherit
+        from another material and only want to modify a particular pass.
+        */
+        void setName(const String& name);
+        /// Get the name of the pass
+        const String& getName(void) const { return mName; }
+
+        /** Sets the ambient colour reflectance properties of this pass.
+        @remarks
+        The base colour of a pass is determined by how much red, green and blue light is reflects
+        (provided texture layer #0 has a blend mode other than LBO_REPLACE). This property determines how
+        much ambient light (directionless global light) is reflected. The default is full white, meaning
+        objects are completely globally illuminated. Reduce this if you want to see diffuse or specular light
+        effects, or change the blend of colours to make the object have a base colour other than white.
+        @note
+        This setting has no effect if dynamic lighting is disabled (see Pass::setLightingEnabled),
+        or if this is a programmable pass.
+        */
+        void setAmbient(Real red, Real green, Real blue);
+
+        /** Sets the ambient colour reflectance properties of this pass.
+        @remarks
+        The base colour of a pass is determined by how much red, green and blue light is reflects
+        (provided texture layer #0 has a blend mode other than LBO_REPLACE). This property determines how
+        much ambient light (directionless global light) is reflected. The default is full white, meaning
+        objects are completely globally illuminated. Reduce this if you want to see diffuse or specular light
+        effects, or change the blend of colours to make the object have a base colour other than white.
+        @note
+        This setting has no effect if dynamic lighting is disabled (see Pass::setLightingEnabled),
+        or if this is a programmable pass.
+        */
+
+        void setAmbient(const ColourValue& ambient);
+
+        /** Sets the diffuse colour reflectance properties of this pass.
+        @remarks
+        The base colour of a pass is determined by how much red, green and blue light is reflects
+        (provided texture layer #0 has a blend mode other than LBO_REPLACE). This property determines how
+        much diffuse light (light from instances of the Light class in the scene) is reflected. The default
+        is full white, meaning objects reflect the maximum white light they can from Light objects.
+        @note
+        This setting has no effect if dynamic lighting is disabled (see Pass::setLightingEnabled),
+        or if this is a programmable pass.
+        */
+        void setDiffuse(Real red, Real green, Real blue, Real alpha);
+
+        /** Sets the diffuse colour reflectance properties of this pass.
+        @remarks
+        The base colour of a pass is determined by how much red, green and blue light is reflects
+        (provided texture layer #0 has a blend mode other than LBO_REPLACE). This property determines how
+        much diffuse light (light from instances of the Light class in the scene) is reflected. The default
+        is full white, meaning objects reflect the maximum white light they can from Light objects.
+        @note
+        This setting has no effect if dynamic lighting is disabled (see Pass::setLightingEnabled),
+        or if this is a programmable pass.
+        */
+        void setDiffuse(const ColourValue& diffuse);
+
+        /** Sets the specular colour reflectance properties of this pass.
+        @remarks
+        The base colour of a pass is determined by how much red, green and blue light is reflects
+        (provided texture layer #0 has a blend mode other than LBO_REPLACE). This property determines how
+        much specular light (highlights from instances of the Light class in the scene) is reflected.
+        The default is to reflect no specular light.
+        @note
+        The size of the specular highlights is determined by the separate 'shininess' property.
+        @note
+        This setting has no effect if dynamic lighting is disabled (see Pass::setLightingEnabled),
+        or if this is a programmable pass.
+        */
+        void setSpecular(Real red, Real green, Real blue, Real alpha);
+
+        /** Sets the specular colour reflectance properties of this pass.
+        @remarks
+        The base colour of a pass is determined by how much red, green and blue light is reflects
+        (provided texture layer #0 has a blend mode other than LBO_REPLACE). This property determines how
+        much specular light (highlights from instances of the Light class in the scene) is reflected.
+        The default is to reflect no specular light.
+        @note
+        The size of the specular highlights is determined by the separate 'shininess' property.
+        @note
+        This setting has no effect if dynamic lighting is disabled (see Pass::setLightingEnabled),
+        or if this is a programmable pass.
+        */
+        void setSpecular(const ColourValue& specular);
+
+        /** Sets the shininess of the pass, affecting the size of specular highlights.
+        @note
+        This setting has no effect if dynamic lighting is disabled (see Pass::setLightingEnabled),
+        or if this is a programmable pass.
+        */
+        void setShininess(Real val);
+
+        /** Sets the amount of self-illumination an object has.
+        @remarks
+        If an object is self-illuminating, it does not need external sources to light it, ambient or
+        otherwise. It's like the object has it's own personal ambient light. This property is rarely useful since
+        you can already specify per-pass ambient light, but is here for completeness.
+        @note
+        This setting has no effect if dynamic lighting is disabled (see Pass::setLightingEnabled),
+        or if this is a programmable pass.
+        */
+        void setSelfIllumination(Real red, Real green, Real blue);
+
+        /** Sets the amount of self-illumination an object has.
+        @see
+            setSelfIllumination
+        */
+        void setEmissive(Real red, Real green, Real blue)
+        {
+            setSelfIllumination(red, green, blue);
+        }
+
+        /** Sets the amount of self-illumination an object has.
+        @remarks
+        If an object is self-illuminating, it does not need external sources to light it, ambient or
+        otherwise. It's like the object has it's own personal ambient light. This property is rarely useful since
+        you can already specify per-pass ambient light, but is here for completeness.
+        @note
+        This setting has no effect if dynamic lighting is disabled (see Pass::setLightingEnabled),
+        or if this is a programmable pass.
+        */
+        void setSelfIllumination(const ColourValue& selfIllum);
+
+        /** Sets the amount of self-illumination an object has.
+        @see
+            setSelfIllumination
+        */
+        void setEmissive(const ColourValue& emissive)
+        {
+            setSelfIllumination(emissive);
+        }
+
+        /** Sets which material properties follow the vertex colour
+         */
+        void setVertexColourTracking(TrackVertexColourType tracking);
+
+        /** Gets the point size of the pass.
+		@remarks
+			This property determines what point size is used to render a point
+			list.
+        */
+        Real getPointSize(void) const;
+
+		/** Sets the point size of this pass.
+		@remarks
+			This setting allows you to change the size of points when rendering
+			a point list, or a list of point sprites. The interpretation of this
+			command depends on the Pass::setPointSizeAttenuation option - if it
+			is off (the default), the point size is in screen pixels, if it is on,
+			it expressed as normalised screen coordinates (1.0 is the height of
+			the screen) when the point is at the origin.
+		@note
+			Some drivers have an upper limit on the size of points they support
+			- this can even vary between APIs on the same card! Don't rely on
+			point sizes that cause the point sprites to get very large on screen,
+			since they may get clamped on some cards. Upper sizes can range from
+			64 to 256 pixels.
+		*/
+		void setPointSize(Real ps);
+
+		/** Sets whether or not rendering points using OT_POINT_LIST will
+			render point sprites (textured quads) or plain points (dots).
+		@param enabled True enables point sprites, false returns to normal
+			point rendering.
+		*/
+		void setPointSpritesEnabled(bool enabled);
+
+		/** Returns whether point sprites are enabled when rendering a
+			point list.
+		*/
+		bool getPointSpritesEnabled(void) const;
+
+		/** Sets how points are attenuated with distance.
+		@remarks
+			When performing point rendering or point sprite rendering,
+			point size can be attenuated with distance. The equation for
+			doing this is attenuation = 1 / (constant + linear * dist + quadratic * d^2).
+		@par
+			For example, to disable distance attenuation (constant screensize)
+			you would set constant to 1, and linear and quadratic to 0. A
+			standard perspective attenuation would be 0, 1, 0 respectively.
+		@note
+			The resulting size is clamped to the minimum and maximum point
+			size.
+		@param enabled Whether point attenuation is enabled
+		@param constant Parameters to the attenuation function defined above
+        @param linear Parameters to the attenuation function defined above
+        @param quadratic Parameters to the attenuation function defined above
+		*/
+		void setPointAttenuation(bool enabled,
+			Real constant = 0.0f, Real linear = 1.0f, Real quadratic = 0.0f);
+
+		/** Returns whether points are attenuated with distance. */
+		bool isPointAttenuationEnabled(void) const;
+
+		/** Returns the constant coefficient of point attenuation. */
+		Real getPointAttenuationConstant(void) const;
+		/** Returns the linear coefficient of point attenuation. */
+		Real getPointAttenuationLinear(void) const;
+		/** Returns the quadratic coefficient of point attenuation. */
+		Real getPointAttenuationQuadratic(void) const;
+
+		/** Set the minimum point size, when point attenuation is in use. */
+		void setPointMinSize(Real min);
+		/** Get the minimum point size, when point attenuation is in use. */
+		Real getPointMinSize(void) const;
+		/** Set the maximum point size, when point attenuation is in use.
+		@remarks Setting this to 0 indicates the max size supported by the card.
+		*/
+		void setPointMaxSize(Real max);
+		/** Get the maximum point size, when point attenuation is in use.
+		@remarks 0 indicates the max size supported by the card.
+		*/
+		Real getPointMaxSize(void) const;
+
+		/** Gets the ambient colour reflectance of the pass.
+        */
+        const ColourValue& getAmbient(void) const;
+
+        /** Gets the diffuse colour reflectance of the pass.
+        */
+        const ColourValue& getDiffuse(void) const;
+
+        /** Gets the specular colour reflectance of the pass.
+        */
+        const ColourValue& getSpecular(void) const;
+
+        /** Gets the self illumination colour of the pass.
+        */
+        const ColourValue& getSelfIllumination(void) const;
+
+        /** Gets the self illumination colour of the pass.
+        @see
+                getSelfIllumination
+        */
+        const ColourValue& getEmissive(void) const
+        {
+            return getSelfIllumination();
+        }
+
+        /** Gets the 'shininess' property of the pass (affects specular highlights).
+        */
+        Real getShininess(void) const;
+
+        /** Gets which material properties follow the vertex colour
+         */
+        TrackVertexColourType getVertexColourTracking(void) const;
+
+        /** Inserts a new TextureUnitState object into the Pass.
+        @remarks
+        This unit is is added on top of all previous units.
+        */
+        TextureUnitState* createTextureUnitState(void);
+        /** Inserts a new TextureUnitState object into the Pass.
+        @remarks
+        This unit is is added on top of all previous units.
+        @param textureName
+            The basic name of the texture e.g. brickwall.jpg, stonefloor.png
+        @param texCoordSet
+            The index of the texture coordinate set to use.
+        @note
+        Applies to both fixed-function and programmable passes.
+        */
+        TextureUnitState* createTextureUnitState( const String& textureName, unsigned short texCoordSet = 0);
+		/** Adds the passed in TextureUnitState, to the existing Pass.
+        @param
+        state The Texture Unit State to be attached to this pass.  It must not be attached to another pass.
+        @note
+            Throws an exception if the TextureUnitState is attached to another Pass.*/
+		void addTextureUnitState(TextureUnitState* state);
+        /** Retrieves a pointer to a texture unit state so it may be modified.
+        */
+        TextureUnitState* getTextureUnitState(unsigned short index);
+        /** Retrieves the Texture Unit State matching name.
+            Returns 0 if name match is not found.
+        */
+        TextureUnitState* getTextureUnitState(const String& name);
+		/** Retrieves a const pointer to a texture unit state.
+		*/
+		const TextureUnitState* getTextureUnitState(unsigned short index) const;
+		/** Retrieves the Texture Unit State matching name.
+		Returns 0 if name match is not found.
+		*/
+		const TextureUnitState* getTextureUnitState(const String& name) const;
+
+        /**  Retrieve the index of the Texture Unit State in the pass.
+        @param
+        state The Texture Unit State this is attached to this pass.
+        @note
+            Throws an exception if the state is not attached to the pass.
+        */
+        unsigned short getTextureUnitStateIndex(const TextureUnitState* state) const;
+
+        typedef VectorIterator<TextureUnitStates> TextureUnitStateIterator;
+        /** Get an iterator over the TextureUnitStates contained in this Pass. */
+        TextureUnitStateIterator getTextureUnitStateIterator(void);
+
+		typedef ConstVectorIterator<TextureUnitStates> ConstTextureUnitStateIterator;
+		/** Get an iterator over the TextureUnitStates contained in this Pass. */
+		ConstTextureUnitStateIterator getTextureUnitStateIterator(void) const;
+
+		/** Removes the indexed texture unit state from this pass.
+        @remarks
+            Note that removing a texture which is not the topmost will have a larger performance impact.
+        */
+        void removeTextureUnitState(unsigned short index);
+
+        /** Removes all texture unit settings.
+        */
+        void removeAllTextureUnitStates(void);
+
+        /** Returns the number of texture unit settings.
+        */
+        unsigned short getNumTextureUnitStates(void) const
+        {
+            return static_cast<unsigned short>(mTextureUnitStates.size());
+        }
+
+        /** Sets the kind of blending this pass has with the existing contents of the scene.
+        @remarks
+        Whereas the texture blending operations seen in the TextureUnitState class are concerned with
+        blending between texture layers, this blending is about combining the output of the Pass
+        as a whole with the existing contents of the rendering target. This blending therefore allows
+        object transparency and other special effects. If all passes in a technique have a scene
+        blend, then the whole technique is considered to be transparent.
+        @par
+        This method allows you to select one of a number of predefined blending types. If you require more
+        control than this, use the alternative version of this method which allows you to specify source and
+        destination blend factors.
+        @note
+        This method is applicable for both the fixed-function and programmable pipelines.
+        @param
+        sbt One of the predefined SceneBlendType blending types
+        */
+        void setSceneBlending( const SceneBlendType sbt );
+
+       /** Sets the kind of blending this pass has with the existing contents of the scene, separately for color and alpha channels
+        @remarks
+        Whereas the texture blending operations seen in the TextureUnitState class are concerned with
+        blending between texture layers, this blending is about combining the output of the Pass
+        as a whole with the existing contents of the rendering target. This blending therefore allows
+        object transparency and other special effects. If all passes in a technique have a scene
+        blend, then the whole technique is considered to be transparent.
+        @par
+        This method allows you to select one of a number of predefined blending types. If you require more
+        control than this, use the alternative version of this method which allows you to specify source and
+        destination blend factors.
+        @note
+        This method is applicable for both the fixed-function and programmable pipelines.
+        @param
+        sbt One of the predefined SceneBlendType blending types for the color channel
+        @param
+        sbta One of the predefined SceneBlendType blending types for the alpha channel
+        */
+        void setSeparateSceneBlending( const SceneBlendType sbt, const SceneBlendType sbta );
+
+        /** Allows very fine control of blending this Pass with the existing contents of the scene.
+        @remarks
+        Whereas the texture blending operations seen in the TextureUnitState class are concerned with
+        blending between texture layers, this blending is about combining the output of the material
+        as a whole with the existing contents of the rendering target. This blending therefore allows
+        object transparency and other special effects.
+        @par
+        This version of the method allows complete control over the blending operation, by specifying the
+        source and destination blending factors. The result of the blending operation is:
+        <span align="center">
+        final = (texture * sourceFactor) + (pixel * destFactor)
+        </span>
+        @par
+        Each of the factors is specified as one of a number of options, as specified in the SceneBlendFactor
+        enumerated type.
+        @param
+        sourceFactor The source factor in the above calculation, i.e. multiplied by the texture colour components.
+        @param
+        destFactor The destination factor in the above calculation, i.e. multiplied by the pixel colour components.
+        @note
+        This method is applicable for both the fixed-function and programmable pipelines.
+        */
+        void setSceneBlending( const SceneBlendFactor sourceFactor, const SceneBlendFactor destFactor);
+
+        /** Allows very fine control of blending this Pass with the existing contents of the scene.
+        @remarks
+        Whereas the texture blending operations seen in the TextureUnitState class are concerned with
+        blending between texture layers, this blending is about combining the output of the material
+        as a whole with the existing contents of the rendering target. This blending therefore allows
+        object transparency and other special effects.
+        @par
+        This version of the method allows complete control over the blending operation, by specifying the
+        source and destination blending factors. The result of the blending operation is:
+        <span align="center">
+        final = (texture * sourceFactor) + (pixel * destFactor)
+        </span>
+        @par
+        Each of the factors is specified as one of a number of options, as specified in the SceneBlendFactor
+        enumerated type.
+        @param
+        sourceFactor The source factor in the above calculation, i.e. multiplied by the texture colour components.
+        @param
+        destFactor The destination factor in the above calculation, i.e. multiplied by the pixel colour components.
+        @param
+        sourceFactorAlpha The alpha source factor in the above calculation, i.e. multiplied by the texture alpha component.
+        @param
+        destFactorAlpha The alpha destination factor in the above calculation, i.e. multiplied by the pixel alpha component.
+		@note
+        This method is applicable for both the fixed-function and programmable pipelines.
+        */
+		void setSeparateSceneBlending( const SceneBlendFactor sourceFactor, const SceneBlendFactor destFactor, const SceneBlendFactor sourceFactorAlpha, const SceneBlendFactor destFactorAlpha );
+
+		/** Return true if this pass uses separate scene blending */
+		bool hasSeparateSceneBlending() const;
+
+        /** Retrieves the source blending factor for the material (as set using Materiall::setSceneBlending).
+        */
+        SceneBlendFactor getSourceBlendFactor() const;
+
+        /** Retrieves the destination blending factor for the material (as set using Materiall::setSceneBlending).
+        */
+        SceneBlendFactor getDestBlendFactor() const;
+
+	    /** Retrieves the alpha source blending factor for the material (as set using Materiall::setSeparateSceneBlending).
+        */
+		SceneBlendFactor getSourceBlendFactorAlpha() const;
+
+	    /** Retrieves the alpha destination blending factor for the material (as set using Materiall::setSeparateSceneBlending).
+        */
+		SceneBlendFactor getDestBlendFactorAlpha() const;
+
+		/** Sets the specific operation used to blend source and destination pixels together.
+			@remarks 
+			By default this operation is +, which creates this equation
+			<span align="center">
+			final = (texture * sourceFactor) + (pixel * destFactor)
+			</span>
+			By setting this to something other than SBO_ADD you can change the operation to achieve
+			a different effect.
+			@param op The blending operation mode to use for this pass
+		*/
+		void setSceneBlendingOperation(SceneBlendOperation op);
+
+		/** Sets the specific operation used to blend source and destination pixels together.
+			@remarks 
+			By default this operation is +, which creates this equation
+			<span align="center">
+			final = (texture * sourceFactor) + (pixel * destFactor)
+			</span>
+			By setting this to something other than SBO_ADD you can change the operation to achieve
+			a different effect.
+			This function allows more control over blending since it allows you to select different blending
+			modes for the color and alpha channels
+			@param op The blending operation mode to use for color channels in this pass
+			@param alphaOp The blending operation mode to use for alpha channels in this pass
+		*/
+		void setSeparateSceneBlendingOperation(SceneBlendOperation op, SceneBlendOperation alphaOp);
+
+		/** Returns true if this pass uses separate scene blending operations. */
+		bool hasSeparateSceneBlendingOperations() const;
+
+		/** Returns the current blending operation */
+		SceneBlendOperation getSceneBlendingOperation() const;
+
+		/** Returns the current alpha blending operation */
+		SceneBlendOperation getSceneBlendingOperationAlpha() const;
+
+		/** Returns true if this pass has some element of transparency. */
+		bool isTransparent(void) const;
+
+		/** Sets whether or not this pass renders with depth-buffer checking on or not.
+        @remarks
+        If depth-buffer checking is on, whenever a pixel is about to be written to the frame buffer
+        the depth buffer is checked to see if the pixel is in front of all other pixels written at that
+        point. If not, the pixel is not written.
+        @par
+        If depth checking is off, pixels are written no matter what has been rendered before.
+        Also see setDepthFunction for more advanced depth check configuration.
+        @see
+        setDepthFunction
+        */
+        void setDepthCheckEnabled(bool enabled);
+
+        /** Returns whether or not this pass renders with depth-buffer checking on or not.
+        @see
+        setDepthCheckEnabled
+        */
+        bool getDepthCheckEnabled(void) const;
+
+        /** Sets whether or not this pass renders with depth-buffer writing on or not.
+        @remarks
+        If depth-buffer writing is on, whenever a pixel is written to the frame buffer
+        the depth buffer is updated with the depth value of that new pixel, thus affecting future
+        rendering operations if future pixels are behind this one.
+        @par
+        If depth writing is off, pixels are written without updating the depth buffer Depth writing should
+        normally be on but can be turned off when rendering static backgrounds or when rendering a collection
+        of transparent objects at the end of a scene so that they overlap each other correctly.
+        */
+        void setDepthWriteEnabled(bool enabled);
+
+        /** Returns whether or not this pass renders with depth-buffer writing on or not.
+        @see
+        setDepthWriteEnabled
+        */
+        bool getDepthWriteEnabled(void) const;
+
+        /** Sets the function used to compare depth values when depth checking is on.
+        @remarks
+        If depth checking is enabled (see setDepthCheckEnabled) a comparison occurs between the depth
+        value of the pixel to be written and the current contents of the buffer. This comparison is
+        normally CMPF_LESS_EQUAL, i.e. the pixel is written if it is closer (or at the same distance)
+        than the current contents. If you wish you can change this comparison using this method.
+        */
+        void setDepthFunction( CompareFunction func );
+        /** Returns the function used to compare depth values when depth checking is on.
+        @see
+        setDepthFunction
+        */
+        CompareFunction getDepthFunction(void) const;
+
+		/** Sets whether or not colour buffer writing is enabled for this Pass.
+		@remarks
+			For some effects, you might wish to turn off the colour write operation
+			when rendering geometry; this means that only the depth buffer will be
+			updated (provided you have depth buffer writing enabled, which you
+			probably will do, although you may wish to only update the stencil
+			buffer for example - stencil buffer state is managed at the RenderSystem
+			level only, not the Material since you are likely to want to manage it
+			at a higher level).
+		*/
+		void setColourWriteEnabled(bool enabled);
+		/** Determines if colour buffer writing is enabled for this pass. */
+		bool getColourWriteEnabled(void) const;
+
+        /** Sets the culling mode for this pass  based on the 'vertex winding'.
+        @remarks
+        A typical way for the rendering engine to cull triangles is based on the 'vertex winding' of
+        triangles. Vertex winding refers to the direction in which the vertices are passed or indexed
+        to in the rendering operation as viewed from the camera, and will wither be clockwise or
+        anticlockwise (that's 'counterclockwise' for you Americans out there ;) The default is
+        CULL_CLOCKWISE i.e. that only triangles whose vertices are passed/indexed in anticlockwise order
+        are rendered - this is a common approach and is used in 3D studio models for example. You can
+        alter this culling mode if you wish but it is not advised unless you know what you are doing.
+        @par
+        You may wish to use the CULL_NONE option for mesh data that you cull yourself where the vertex
+        winding is uncertain.
+        */
+        void setCullingMode( CullingMode mode );
+
+        /** Returns the culling mode for geometry rendered with this pass. See setCullingMode for more information.
+        */
+        CullingMode getCullingMode(void) const;
+
+        /** Sets the manual culling mode, performed by CPU rather than hardware.
+        @remarks
+        In some situations you want to use manual culling of triangles rather than sending the
+        triangles to the hardware and letting it cull them. This setting only takes effect on SceneManager's
+        that use it (since it is best used on large groups of planar world geometry rather than on movable
+        geometry since this would be expensive), but if used can cull geometry before it is sent to the
+        hardware.
+        @note
+        The default for this setting is MANUAL_CULL_BACK.
+        @param
+        mode The mode to use - see enum ManualCullingMode for details
+
+        */
+        void setManualCullingMode( ManualCullingMode mode );
+
+        /** Retrieves the manual culling mode for this pass
+        @see
+        setManualCullingMode
+        */
+        ManualCullingMode getManualCullingMode(void) const;
+
+        /** Sets whether or not dynamic lighting is enabled.
+        @param
+        enabled
+        If true, dynamic lighting is performed on geometry with normals supplied, geometry without
+        normals will not be displayed.
+        @par
+        If false, no lighting is applied and all geometry will be full brightness.
+        */
+        void setLightingEnabled(bool enabled);
+
+        /** Returns whether or not dynamic lighting is enabled.
+        */
+        bool getLightingEnabled(void) const;
+
+        /** Sets the maximum number of lights to be used by this pass.
+        @remarks
+            During rendering, if lighting is enabled (or if the pass uses an automatic
+            program parameter based on a light) the engine will request the nearest lights
+            to the object being rendered in order to work out which ones to use. This
+            parameter sets the limit on the number of lights which should apply to objects
+            rendered with this pass.
+        */
+        void setMaxSimultaneousLights(unsigned short maxLights);
+        /** Gets the maximum number of lights to be used by this pass. */
+        unsigned short getMaxSimultaneousLights(void) const;
+
+		/** Sets the light index that this pass will start at in the light list.
+		@remarks
+			Normally the lights passed to a pass will start from the beginning
+			of the light list for this object. This option allows you to make this
+			pass start from a higher light index, for example if one of your earlier
+			passes could deal with lights 0-3, and this pass dealt with lights 4+. 
+			This option also has an interaction with pass iteration, in that
+			if you choose to iterate this pass per light too, the iteration will
+			only begin from light 4.
+		*/
+		void setStartLight(unsigned short startLight);
+		/** Gets the light index that this pass will start at in the light list. */
+		unsigned short getStartLight(void) const;
+
+		/** Sets the light mask which can be matched to specific light flags to be handled by this pass */
+		void setLightMask(uint32 mask);
+		/** Gets the light mask controlling which lights are used for this pass */
+		uint32 getLightMask() const;
+
+        /** Sets the type of light shading required
+        @note
+        The default shading method is Gouraud shading.
+        */
+        void setShadingMode( ShadeOptions mode );
+
+        /** Returns the type of light shading to be used.
+        */
+        ShadeOptions getShadingMode(void) const;
+
+		/** Sets the type of polygon rendering required
+		@note
+		The default shading method is Solid
+		*/
+		void setPolygonMode( PolygonMode mode );
+
+		/** Returns the type of light shading to be used.
+		*/
+		PolygonMode getPolygonMode(void) const;
+
+		/** Sets whether this pass's chosen detail level can be
+			overridden (downgraded) by the camera setting. 
+		@param override true means that a lower camera detail will override this
+			pass's detail level, false means it won't (default true).
+		*/
+		virtual void setPolygonModeOverrideable(bool override)
+		{
+			mPolygonModeOverrideable = override;
+		}
+
+		/** Gets whether this renderable's chosen detail level can be
+			overridden (downgraded) by the camera setting. 
+		*/
+		virtual bool getPolygonModeOverrideable(void) const
+		{
+			return mPolygonModeOverrideable;
+		}
+        /** Sets the fogging mode applied to this pass.
+        @remarks
+        Fogging is an effect that is applied as polys are rendered. Sometimes, you want
+        fog to be applied to an entire scene. Other times, you want it to be applied to a few
+        polygons only. This pass-level specification of fog parameters lets you easily manage
+        both.
+        @par
+        The SceneManager class also has a setFog method which applies scene-level fog. This method
+        lets you change the fog behaviour for this pass compared to the standard scene-level fog.
+        @param
+        overrideScene If true, you authorise this pass to override the scene's fog params with it's own settings.
+        If you specify false, so other parameters are necessary, and this is the default behaviour for passes.
+        @param
+        mode Only applicable if overrideScene is true. You can disable fog which is turned on for the
+        rest of the scene by specifying FOG_NONE. Otherwise, set a pass-specific fog mode as
+        defined in the enum FogMode.
+        @param
+        colour The colour of the fog. Either set this to the same as your viewport background colour,
+        or to blend in with a skydome or skybox.
+        @param
+        expDensity The density of the fog in FOG_EXP or FOG_EXP2 mode, as a value between 0 and 1.
+        The default is 0.001.
+        @param
+        linearStart Distance in world units at which linear fog starts to encroach.
+        Only applicable if mode is FOG_LINEAR.
+        @param
+        linearEnd Distance in world units at which linear fog becomes completely opaque.
+        Only applicable if mode is FOG_LINEAR.
+        */
+        void setFog(
+            bool overrideScene,
+            FogMode mode = FOG_NONE,
+            const ColourValue& colour = ColourValue::White,
+            Real expDensity = 0.001, Real linearStart = 0.0, Real linearEnd = 1.0 );
+
+        /** Returns true if this pass is to override the scene fog settings.
+        */
+        bool getFogOverride(void) const;
+
+        /** Returns the fog mode for this pass.
+        @note
+        Only valid if getFogOverride is true.
+        */
+        FogMode getFogMode(void) const;
+
+        /** Returns the fog colour for the scene.
+        */
+        const ColourValue& getFogColour(void) const;
+
+        /** Returns the fog start distance for this pass.
+        @note
+        Only valid if getFogOverride is true.
+        */
+        Real getFogStart(void) const;
+
+        /** Returns the fog end distance for this pass.
+        @note
+        Only valid if getFogOverride is true.
+        */
+        Real getFogEnd(void) const;
+
+        /** Returns the fog density for this pass.
+        @note
+        Only valid if getFogOverride is true.
+        */
+        Real getFogDensity(void) const;
+
+        /** Sets the depth bias to be used for this material.
+        @remarks
+        When polygons are coplanar, you can get problems with 'depth fighting' where
+        the pixels from the two polys compete for the same screen pixel. This is particularly
+        a problem for decals (polys attached to another surface to represent details such as
+        bulletholes etc.).
+        @par
+        A way to combat this problem is to use a depth bias to adjust the depth buffer value
+        used for the decal such that it is slightly higher than the true value, ensuring that
+        the decal appears on top. There are two aspects to the biasing, a constant
+		bias value and a slope-relative biasing value, which varies according to the
+		maximum depth slope relative to the camera, ie:
+		<pre>finalBias = maxSlope * slopeScaleBias + constantBias</pre>
+		Note that slope scale bias, whilst more accurate, may be ignored by old hardware.
+        @param constantBias The constant bias value, expressed as a factor of the
+			minimum observable depth
+		@param slopeScaleBias The slope-relative bias value, expressed as a factor
+			of the depth slope
+		*/
+        void setDepthBias(float constantBias, float slopeScaleBias = 0.0f);
+
+        /** Retrieves the const depth bias value as set by setDepthBias. */
+        float getDepthBiasConstant(void) const;
+		/** Retrieves the slope-scale depth bias value as set by setDepthBias. */
+		float getDepthBiasSlopeScale(void) const;
+		/** Sets a factor which derives an additional depth bias from the number 
+			of times a pass is iterated.
+		@remarks
+			The Final depth bias will be the constant depth bias as set through
+			setDepthBias, plus this value times the iteration number. 
+		*/
+		void setIterationDepthBias(float biasPerIteration);
+		/** Gets a factor which derives an additional depth bias from the number 
+			of times a pass is iterated.
+		*/
+		float getIterationDepthBias() const;
+
+        /** Sets the way the pass will have use alpha to totally reject pixels from the pipeline.
+        @remarks
+			The default is CMPF_ALWAYS_PASS i.e. alpha is not used to reject pixels.
+        @param func The comparison which must pass for the pixel to be written.
+        @param value 1 byte value against which alpha values will be tested(0-255)
+		@param alphaToCoverageEnabled Whether to enable alpha to coverage support
+        @note
+			This option applies in both the fixed function and the programmable pipeline.
+        */
+        void setAlphaRejectSettings(CompareFunction func, unsigned char value, bool alphaToCoverageEnabled = false);
+
+		/** Sets the alpha reject function. See setAlphaRejectSettings for more information.
+		*/
+		void setAlphaRejectFunction(CompareFunction func);
+
+		/** Gets the alpha reject value. See setAlphaRejectSettings for more information.
+		*/
+		void setAlphaRejectValue(unsigned char val);
+
+		/** Gets the alpha reject function. See setAlphaRejectSettings for more information.
+        */
+		CompareFunction getAlphaRejectFunction(void) const { return mAlphaRejectFunc; }
+
+        /** Gets the alpha reject value. See setAlphaRejectSettings for more information.
+        */
+		unsigned char getAlphaRejectValue(void) const { return mAlphaRejectVal; }
+
+		/** Sets whether to use alpha to coverage (A2C) when blending alpha rejected values. 
+		@remarks
+			Alpha to coverage performs multisampling on the edges of alpha-rejected
+			textures to produce a smoother result. It is only supported when multisampling
+			is already enabled on the render target, and when the hardware supports
+			alpha to coverage (see RenderSystemCapabilities). 
+		*/
+		void setAlphaToCoverageEnabled(bool enabled);
+
+		/** Gets whether to use alpha to coverage (A2C) when blending alpha rejected values. 
+		*/
+		bool isAlphaToCoverageEnabled() const { return mAlphaToCoverageEnabled; }
+
+        /** Sets whether or not transparent sorting is enabled.
+        @param enabled
+			If false depth sorting of this material will be disabled.
+        @remarks
+			By default all transparent materials are sorted such that renderables furthest
+			away from the camera are rendered first. This is usually the desired behaviour
+			but in certain cases this depth sorting may be unnecessary and undesirable. If
+			for example it is necessary to ensure the rendering order does not change from
+			one frame to the next.
+		@note
+			This will have no effect on non-transparent materials.
+        */
+        void setTransparentSortingEnabled(bool enabled);
+
+        /** Returns whether or not transparent sorting is enabled.
+        */
+		bool getTransparentSortingEnabled(void) const;
+
+        /** Sets whether or not transparent sorting is forced.
+        @param enabled
+			If true depth sorting of this material will be depend only on the value of
+            getTransparentSortingEnabled().
+        @remarks
+			By default even if transparent sorting is enabled, depth sorting will only be
+            performed when the material is transparent and depth write/check are disabled.
+            This function disables these extra conditions.
+        */
+        void setTransparentSortingForced(bool enabled);
+
+        /** Returns whether or not transparent sorting is forced.
+        */
+		bool getTransparentSortingForced(void) const;
+
+		/** Sets whether or not this pass should iterate per light or number of
+			lights which can affect the object being rendered.
+		@remarks
+			The default behaviour for a pass (when this option is 'false'), is
+			for a pass to be rendered only once (or the number of times set in
+			setPassIterationCount), with all the lights which could
+			affect this object set at the same time (up to the maximum lights
+			allowed in the render system, which is typically 8).
+		@par
+			Setting this option to 'true' changes this behaviour, such that
+			instead of trying to issue render this pass once per object, it
+			is run <b>per light</b>, or for a group of 'n' lights each time
+			which can affect this object, the number of
+			times set in setPassIterationCount (default is once). In
+			this case, only light index 0 is ever used, and is a different light
+			every time the pass is issued, up to the total number of lights
+			which is affecting this object. This has 2 advantages:
+			<ul><li>There is no limit on the number of lights which can be
+			supported</li>
+			<li>It's easier to write vertex / fragment programs for this because
+			a single program can be used for any number of lights</li>
+			</ul>
+			However, this technique is more expensive, and typically you
+			will want an additional ambient pass, because if no lights are 
+			affecting the object it will not be rendered at all, which will look
+			odd even if ambient light is zero (imagine if there are lit objects
+			behind it - the objects silhouette would not show up). Therefore,
+			use this option with care, and you would be well advised to provide
+			a less expensive fallback technique for use in the distance.
+		@note
+			The number of times this pass runs is still limited by the maximum
+			number of lights allowed as set in setMaxSimultaneousLights, so
+			you will never get more passes than this. Also, the iteration is
+			started from the 'start light' as set in Pass::setStartLight, and
+			the number of passes is the number of lights to iterate over divided
+			by the number of lights per iteration (default 1, set by 
+			setLightCountPerIteration).
+        @param enabled Whether this feature is enabled
+        @param onlyForOneLightType If true, the pass will only be run for a single type
+            of light, other light types will be ignored.
+        @param lightType The single light type which will be considered for this pass
+		*/
+        void setIteratePerLight(bool enabled,
+            bool onlyForOneLightType = true, Light::LightTypes lightType = Light::LT_POINT);
+
+        /** Does this pass run once for every light in range? */
+		bool getIteratePerLight(void) const { return mIteratePerLight; }
+        /** Does this pass run only for a single light type (if getIteratePerLight is true). */
+        bool getRunOnlyForOneLightType(void) const { return mRunOnlyForOneLightType; }
+        /** Gets the single light type this pass runs for if  getIteratePerLight and
+            getRunOnlyForOneLightType are both true. */
+        Light::LightTypes getOnlyLightType() const { return mOnlyLightType; }
+
+		/** If light iteration is enabled, determine the number of lights per
+			iteration.
+		@remarks
+			The default for this setting is 1, so if you enable light iteration
+			(Pass::setIteratePerLight), the pass is rendered once per light. If
+			you set this value higher, the passes will occur once per 'n' lights.
+			The start of the iteration is set by Pass::setStartLight and the end
+			by Pass::setMaxSimultaneousLights.
+		*/
+		void setLightCountPerIteration(unsigned short c);
+		/** If light iteration is enabled, determine the number of lights per
+		iteration.
+		*/
+		unsigned short getLightCountPerIteration(void) const;
+		
+		/// Gets the parent Technique
+        Technique* getParent(void) const { return mParent; }
+
+		/// Gets the resource group of the ultimate parent Material
+		const String& getResourceGroup(void) const;
+
+		/** Sets the details of the vertex program to use.
+		@remarks
+			Only applicable to programmable passes, this sets the details of
+			the vertex program to use in this pass. The program will not be
+			loaded until the parent Material is loaded.
+		@param name The name of the program - this must have been
+			created using GpuProgramManager by the time that this Pass
+			is loaded. If this parameter is blank, any vertex program in this pass is disabled.
+        @param resetParams
+            If true, this will create a fresh set of parameters from the
+            new program being linked, so if you had previously set parameters
+            you will have to set them again. If you set this to false, you must
+            be absolutely sure that the parameters match perfectly, and in the
+            case of named parameters refers to the indexes underlying them,
+            not just the names.
+		*/
+		void setVertexProgram(const String& name, bool resetParams = true);
+		/** Sets the vertex program parameters.
+		@remarks
+			Only applicable to programmable passes, and this particular call is
+			designed for low-level programs; use the named parameter methods
+			for setting high-level program parameters.
+		*/
+		void setVertexProgramParameters(GpuProgramParametersSharedPtr params);
+		/** Gets the name of the vertex program used by this pass. */
+		const String& getVertexProgramName(void) const;
+        /** Gets the vertex program parameters used by this pass. */
+        GpuProgramParametersSharedPtr getVertexProgramParameters(void) const;
+		/** Gets the vertex program used by this pass, only available after _load(). */
+		const GpuProgramPtr& getVertexProgram(void) const;
+
+
+        /** Sets the details of the vertex program to use when rendering as a
+        shadow caster.
+        @remarks
+        Texture-based shadows require that the caster is rendered to a texture
+        in a solid colour (the shadow colour in the case of modulative texture
+        shadows). Whilst Ogre can arrange this for the fixed function
+        pipeline, passes which use vertex programs might need the vertex
+        programs still to run in order to preserve any deformation etc
+        that it does. However, lighting calculations must be a lot simpler,
+        with only the ambient colour being used (which the engine will ensure
+        is bound to the shadow colour).
+        @par
+        Therefore, it is up to implementors of vertex programs to provide an
+        alternative vertex program which can be used to render the object
+        to a shadow texture. Do all the same vertex transforms, but set the
+        colour of the vertex to the ambient colour, as bound using the
+        standard auto parameter binding mechanism.
+        @note
+        Some vertex programs will work without doing this, because Ogre ensures
+        that all lights except for ambient are set black. However, the chances
+        are that your vertex program is doing a lot of unnecessary work in this
+        case, since the other lights are having no effect, and it is good practice
+        to supply an alternative.
+        @note
+        This is only applicable to programmable passes.
+        @par
+        The default behaviour is for Ogre to switch to fixed-function
+        rendering if an explicit vertex program alternative is not set.
+        */
+        void setShadowCasterVertexProgram(const String& name);
+        /** Sets the vertex program parameters for rendering as a shadow caster.
+        @remarks
+        Only applicable to programmable passes, and this particular call is
+        designed for low-level programs; use the named parameter methods
+        for setting high-level program parameters.
+        */
+        void setShadowCasterVertexProgramParameters(GpuProgramParametersSharedPtr params);
+        /** Gets the name of the vertex program used by this pass when rendering shadow casters. */
+        const String& getShadowCasterVertexProgramName(void) const;
+        /** Gets the vertex program parameters used by this pass when rendering shadow casters. */
+        GpuProgramParametersSharedPtr getShadowCasterVertexProgramParameters(void) const;
+        /** Gets the vertex program used by this pass when rendering shadow casters,
+            only available after _load(). */
+        const GpuProgramPtr& getShadowCasterVertexProgram(void) const;
+
+        /** Sets the details of the fragment program to use when rendering as a
+        shadow caster.
+        @remarks
+        Texture-based shadows require that the caster is rendered to a texture
+        in a solid colour (the shadow colour in the case of modulative texture
+        shadows). Whilst Ogre can arrange this for the fixed function
+        pipeline, passes which use vertex programs might need the vertex
+        programs still to run in order to preserve any deformation etc
+        that it does. However, lighting calculations must be a lot simpler,
+        with only the ambient colour being used (which the engine will ensure
+        is bound to the shadow colour).
+        @par
+        Therefore, it is up to implementors of vertex programs to provide an
+        alternative vertex program which can be used to render the object
+        to a shadow texture. Do all the same vertex transforms, but set the
+        colour of the vertex to the ambient colour, as bound using the
+        standard auto parameter binding mechanism.
+        @note
+        Some vertex programs will work without doing this, because Ogre ensures
+        that all lights except for ambient are set black. However, the chances
+        are that your vertex program is doing a lot of unnecessary work in this
+        case, since the other lights are having no effect, and it is good practice
+        to supply an alternative.
+        @note
+        This is only applicable to programmable passes.
+        @par
+        The default behaviour is for Ogre to switch to fixed-function
+        rendering if an explicit fragment program alternative is not set.
+        */
+        void setShadowCasterFragmentProgram(const String& name);
+        /** Sets the fragment program parameters for rendering as a shadow caster.
+        @remarks
+        Only applicable to programmable passes, and this particular call is
+        designed for low-level programs; use the named parameter methods
+        for setting high-level program parameters.
+        */
+        void setShadowCasterFragmentProgramParameters(GpuProgramParametersSharedPtr params);
+        /** Gets the name of the fragment program used by this pass when rendering shadow casters. */
+        const String& getShadowCasterFragmentProgramName(void) const;
+        /** Gets the fragment program parameters used by this pass when rendering shadow casters. */
+        GpuProgramParametersSharedPtr getShadowCasterFragmentProgramParameters(void) const;
+        /** Gets the fragment program used by this pass when rendering shadow casters,
+            only available after _load(). */
+        const GpuProgramPtr& getShadowCasterFragmentProgram(void) const;
+
+        /** Sets the details of the vertex program to use when rendering as a
+            shadow receiver.
+        @remarks
+            Texture-based shadows require that the shadow receiver is rendered using
+            a projective texture. Whilst Ogre can arrange this for the fixed function
+            pipeline, passes which use vertex programs might need the vertex
+            programs still to run in order to preserve any deformation etc
+            that it does. So in this case, we need a vertex program which does the
+            appropriate vertex transformation, but generates projective texture
+            coordinates.
+        @par
+            Therefore, it is up to implementors of vertex programs to provide an
+            alternative vertex program which can be used to render the object
+            as a shadow receiver. Do all the same vertex transforms, but generate
+            <strong>2 sets</strong> of texture coordinates using the auto parameter
+            ACT_TEXTURE_VIEWPROJ_MATRIX, which Ogre will bind to the parameter name /
+            index you supply as the second parameter to this method. 2 texture
+            sets are needed because Ogre needs to use 2 texture units for some
+            shadow effects.
+        @note
+            This is only applicable to programmable passes.
+        @par
+            The default behaviour is for Ogre to switch to fixed-function
+            rendering if an explict vertex program alternative is not set.
+        */
+        void setShadowReceiverVertexProgram(const String& name);
+        /** Sets the vertex program parameters for rendering as a shadow receiver.
+        @remarks
+        Only applicable to programmable passes, and this particular call is
+        designed for low-level programs; use the named parameter methods
+        for setting high-level program parameters.
+        */
+        void setShadowReceiverVertexProgramParameters(GpuProgramParametersSharedPtr params);
+
+		/** This method allows you to specify a fragment program for use when
+			rendering a texture shadow receiver.
+		@remarks
+			Texture shadows are applied by rendering the receiver. Modulative texture
+			shadows are performed as a post-render darkening pass, and as such
+			fragment programs are generally not required per-object. Additive
+			texture shadows, however, are applied by accumulating light masked
+			out using a texture shadow (black & white by default, unless you
+			customise this using SceneManager::setCustomShadowCasterMaterial).
+			OGRE can do this for you for most materials, but if you use a custom
+			lighting program (e.g. per pixel lighting) then you'll need to provide
+			a custom version for receiving shadows. You don't need to provide
+			this for shadow casters if you don't use self-shadowing since they
+			will never be shadow receivers too.
+		@par
+			The shadow texture is always bound to texture unit 0 when rendering
+			texture shadow passes. Therefore your custom shadow receiver program
+			may well just need to shift it's texture unit usage up by one unit,
+			and take the shadow texture into account in its calculations.
+		*/
+		void setShadowReceiverFragmentProgram(const String& name);
+        /** Sets the fragment program parameters for rendering as a shadow receiver.
+        @remarks
+        Only applicable to programmable passes, and this particular call is
+        designed for low-level programs; use the named parameter methods
+        for setting high-level program parameters.
+        */
+        void setShadowReceiverFragmentProgramParameters(GpuProgramParametersSharedPtr params);
+
+        /** Gets the name of the vertex program used by this pass when rendering shadow receivers. */
+        const String& getShadowReceiverVertexProgramName(void) const;
+        /** Gets the vertex program parameters used by this pass when rendering shadow receivers. */
+        GpuProgramParametersSharedPtr getShadowReceiverVertexProgramParameters(void) const;
+        /** Gets the vertex program used by this pass when rendering shadow receivers,
+        only available after _load(). */
+        const GpuProgramPtr& getShadowReceiverVertexProgram(void) const;
+
+		/** Gets the name of the fragment program used by this pass when rendering shadow receivers. */
+		const String& getShadowReceiverFragmentProgramName(void) const;
+		/** Gets the fragment program parameters used by this pass when rendering shadow receivers. */
+		GpuProgramParametersSharedPtr getShadowReceiverFragmentProgramParameters(void) const;
+		/** Gets the fragment program used by this pass when rendering shadow receivers,
+		only available after _load(). */
+		const GpuProgramPtr& getShadowReceiverFragmentProgram(void) const;
+
+		/** Sets the details of the fragment program to use.
+		@remarks
+			Only applicable to programmable passes, this sets the details of
+			the fragment program to use in this pass. The program will not be
+			loaded until the parent Material is loaded.
+		@param name The name of the program - this must have been
+			created using GpuProgramManager by the time that this Pass
+			is loaded. If this parameter is blank, any fragment program in this pass is disabled.
+        @param resetParams
+            If true, this will create a fresh set of parameters from the
+            new program being linked, so if you had previously set parameters
+            you will have to set them again. If you set this to false, you must
+            be absolutely sure that the parameters match perfectly, and in the
+            case of named parameters refers to the indexes underlying them,
+            not just the names.
+		*/
+		void setFragmentProgram(const String& name, bool resetParams = true);
+		/** Sets the fragment program parameters.
+		@remarks
+			Only applicable to programmable passes.
+		*/
+		void setFragmentProgramParameters(GpuProgramParametersSharedPtr params);
+		/** Gets the name of the fragment program used by this pass. */
+		const String& getFragmentProgramName(void) const;
+		/** Gets the fragment program parameters used by this pass. */
+		GpuProgramParametersSharedPtr getFragmentProgramParameters(void) const;
+		/** Gets the fragment program used by this pass, only available after _load(). */
+		const GpuProgramPtr& getFragmentProgram(void) const;
+
+		/** Sets the details of the geometry program to use.
+		@remarks
+			Only applicable to programmable passes, this sets the details of
+			the geometry program to use in this pass. The program will not be
+			loaded until the parent Material is loaded.
+		@param name The name of the program - this must have been
+			created using GpuProgramManager by the time that this Pass
+			is loaded. If this parameter is blank, any geometry program in this pass is disabled.
+        @param resetParams
+            If true, this will create a fresh set of parameters from the
+            new program being linked, so if you had previously set parameters
+            you will have to set them again. If you set this to false, you must
+            be absolutely sure that the parameters match perfectly, and in the
+            case of named parameters refers to the indexes underlying them,
+            not just the names.
+		*/
+		void setGeometryProgram(const String& name, bool resetParams = true);
+		/** Sets the geometry program parameters.
+		@remarks
+			Only applicable to programmable passes.
+		*/
+		void setGeometryProgramParameters(GpuProgramParametersSharedPtr params);
+		/** Gets the name of the geometry program used by this pass. */
+		const String& getGeometryProgramName(void) const;
+		/** Gets the geometry program parameters used by this pass. */
+		GpuProgramParametersSharedPtr getGeometryProgramParameters(void) const;
+		/** Gets the geometry program used by this pass, only available after _load(). */
+		const GpuProgramPtr& getGeometryProgram(void) const;
+
+		/** Splits this Pass to one which can be handled in the number of
+			texture units specified.
+		@remarks
+			Only works on non-programmable passes, programmable passes cannot be
+			split, it's up to the author to ensure that there is a fallback Technique
+			for less capable cards.
+		@param numUnits The target number of texture units
+		@return A new Pass which contains the remaining units, and a scene_blend
+				setting appropriate to approximate the multitexture. This Pass will be
+				attached to the parent Technique of this Pass.
+		*/
+		Pass* _split(unsigned short numUnits);
+
+		/** Internal method to adjust pass index. */
+		void _notifyIndex(unsigned short index);
+
+		/** Internal method for preparing to load this pass. */
+		void _prepare(void);
+		/** Internal method for undoing the load preparartion for this pass. */
+		void _unprepare(void);
+		/** Internal method for loading this pass. */
+		void _load(void);
+		/** Internal method for unloading this pass. */
+		void _unload(void);
+        /// Is this loaded?
+        bool isLoaded(void) const;
+
+        /** Gets the 'hash' of this pass, ie a precomputed number to use for sorting
+        @remarks
+            This hash is used to sort passes, and for this reason the pass is hashed
+            using firstly its index (so that all passes are rendered in order), then
+            by the textures which it's TextureUnitState instances are using.
+        */
+        uint32 getHash(void) const { return mHash; }
+		/// Mark the hash as dirty
+		void _dirtyHash(void);
+        /** Internal method for recalculating the hash.
+		@remarks
+			Do not call this unless you are sure the old hash is not still being
+			used by anything. If in doubt, call _dirtyHash if you want to force
+			recalculation of the has next time.
+		*/
+        void _recalculateHash(void);
+        /** Tells the pass that it needs recompilation. */
+        void _notifyNeedsRecompile(void);
+
+		/** Update automatic parameters.
+		@param source The source of the parameters
+		@param variabilityMask A mask of GpuParamVariability which identifies which autos will need updating
+		*/
+		void _updateAutoParams(const AutoParamDataSource* source, uint16 variabilityMask) const;
+
+		/** Gets the 'nth' texture which references the given content type.
+		@remarks
+			If the 'nth' texture unit which references the content type doesn't
+			exist, then this method returns an arbitrary high-value outside the
+			valid range to index texture units.
+		*/
+		unsigned short _getTextureUnitWithContentTypeIndex(
+			TextureUnitState::ContentType contentType, unsigned short index) const;
+
+        /** Set texture filtering for every texture unit 
+        @note
+            This property actually exists on the TextureUnitState class
+            For simplicity, this method allows you to set these properties for
+            every current TeextureUnitState, If you need more precision, retrieve the
+            TextureUnitState instance and set the property there.
+        @see TextureUnitState::setTextureFiltering
+        */
+        void setTextureFiltering(TextureFilterOptions filterType);
+        /** Sets the anisotropy level to be used for all textures.
+        @note
+            This property has been moved to the TextureUnitState class, which is accessible via the
+            Technique and Pass. For simplicity, this method allows you to set these properties for
+            every current TeextureUnitState, If you need more precision, retrieve the Technique,
+            Pass and TextureUnitState instances and set the property there.
+        @see TextureUnitState::setTextureAnisotropy
+        */
+        void setTextureAnisotropy(unsigned int maxAniso);
+		/** If set to true, this forces normals to be normalised dynamically 
+			by the hardware for this pass.
+		@remarks
+			This option can be used to prevent lighting variations when scaling an
+			object - normally because this scaling is hardware based, the normals 
+			get scaled too which causes lighting to become inconsistent. By default the
+			SceneManager detects scaled objects and does this for you, but 
+			this has an overhead so you might want to turn that off through
+			SceneManager::setNormaliseNormalsOnScale(false) and only do it per-Pass
+			when you need to.
+		*/
+		void setNormaliseNormals(bool normalise) { mNormaliseNormals = normalise; }
+
+		/** Returns true if this pass has auto-normalisation of normals set. */
+		bool getNormaliseNormals(void) const {return mNormaliseNormals; }
+
+		/** Static method to retrieve all the Passes which need their
+		    hash values recalculated.
+		*/
+		static const PassSet& getDirtyHashList(void)
+		{ return msDirtyHashList; }
+        /** Static method to retrieve all the Passes which are pending deletion.
+        */
+        static const PassSet& getPassGraveyard(void)
+        { return msPassGraveyard; }
+		/** Static method to reset the list of passes which need their hash
+		    values recalculated.
+		@remarks
+			For performance, the dirty list is not updated progressively as
+			the hashes are recalculated, instead we expect the processor of the
+			dirty hash list to clear the list when they are done.
+		*/
+		static void clearDirtyHashList(void);
+
+        /** Process all dirty and pending deletion passes. */
+        static void processPendingPassUpdates(void);
+
+        /** Queue this pass for deletion when appropriate. */
+        void queueForDeletion(void);
+
+        /** Returns whether this pass is ambient only.
+        */
+        bool isAmbientOnly(void) const;
+
+        /** set the number of iterations that this pass
+        should perform when doing fast multi pass operation.
+        @remarks
+            Only applicable for programmable passes.
+        @param count number of iterations to perform fast multi pass operations.
+            A value greater than 1 will cause the pass to be executed count number of
+            times without changing the render state.  This is very useful for passes
+            that use programmable shaders that have to iterate more than once but don't
+            need a render state change.  Using multi pass can dramatically speed up rendering
+            for materials that do things like fur, blur.
+            A value of 1 turns off multi pass operation and the pass does
+            the normal pass operation.
+        */
+        void setPassIterationCount(const size_t count) { mPassIterationCount = count; }
+
+        /** Gets the pass iteration count value.
+        */
+        size_t getPassIterationCount(void) const { return mPassIterationCount; }
+
+        /** Applies texture names to Texture Unit State with matching texture name aliases.
+            All Texture Unit States within the pass are checked.
+            If matching texture aliases are found then true is returned.
+
+        @param
+            aliasList is a map container of texture alias, texture name pairs
+        @param
+            apply set true to apply the texture aliases else just test to see if texture alias matches are found.
+        @return
+            True if matching texture aliases were found in the pass.
+        */
+        bool applyTextureAliases(const AliasTextureNamePairList& aliasList, const bool apply = true) const;
+
+		/** Sets whether or not this pass will be clipped by a scissor rectangle
+			encompassing the lights that are being used in it.
+		@remarks
+			In order to cut down on fillrate when you have a number of fixed-range
+			lights in the scene, you can enable this option to request that
+			during rendering, only the region of the screen which is covered by
+			the lights is rendered. This region is the screen-space rectangle 
+			covering the union of the spheres making up the light ranges. Directional
+			lights are ignored for this.
+		@par
+			This is only likely to be useful for multipass additive lighting 
+			algorithms, where the scene has already been 'seeded' with an ambient 
+			pass and this pass is just adding light in affected areas.
+		@note
+			When using SHADOWTYPE_STENCIL_ADDITIVE or SHADOWTYPE_TEXTURE_ADDITIVE,
+			this option is implicitly used for all per-light passes and does
+			not need to be specified. If you are not using shadows or are using
+			a modulative or an integrated shadow technique then this could be useful.
+
+		*/
+		void setLightScissoringEnabled(bool enabled) { mLightScissoring = enabled; }
+		/** Gets whether or not this pass will be clipped by a scissor rectangle
+			encompassing the lights that are being used in it.
+		*/
+		bool getLightScissoringEnabled() const { return mLightScissoring; }
+
+		/** Gets whether or not this pass will be clipped by user clips planes
+			bounding the area covered by the light.
+		@remarks
+			In order to cut down on the geometry set up to render this pass 
+			when you have a single fixed-range light being rendered through it, 
+			you can enable this option to request that during triangle setup, 
+			clip planes are defined to bound the range of the light. In the case
+			of a point light these planes form a cube, and in the case of 
+			a spotlight they form a pyramid. Directional lights are never clipped.
+		@par
+			This option is only likely to be useful for multipass additive lighting 
+			algorithms, where the scene has already been 'seeded' with an ambient 
+			pass and this pass is just adding light in affected areas. In addition,
+			it will only be honoured if there is exactly one non-directional light
+			being used in this pass. Also, these clip planes override any user clip
+			planes set on Camera.
+		@note
+			When using SHADOWTYPE_STENCIL_ADDITIVE or SHADOWTYPE_TEXTURE_ADDITIVE,
+			this option is automatically used for all per-light passes if you 
+			enable SceneManager::setShadowUseLightClipPlanes and does
+			not need to be specified. It is disabled by default since clip planes have
+			a cost of their own which may not always exceed the benefits they give you.
+		*/
+		void setLightClipPlanesEnabled(bool enabled) { mLightClipPlanes = enabled; }
+		/** Gets whether or not this pass will be clipped by user clips planes
+			bounding the area covered by the light.
+		*/
+		bool getLightClipPlanesEnabled() const { return mLightClipPlanes; }
+
+		/** Manually set which illumination stage this pass is a member of.
+		@remarks
+			When using an additive lighting mode (SHADOWTYPE_STENCIL_ADDITIVE or
+			SHADOWTYPE_TEXTURE_ADDITIVE), the scene is rendered in 3 discrete
+			stages, ambient (or pre-lighting), per-light (once per light, with 
+			shadowing) and decal (or post-lighting). Usually OGRE figures out how
+			to categorise your passes automatically, but there are some effects you
+			cannot achieve without manually controlling the illumination. For example
+			specular effects are muted by the typical sequence because all textures
+			are saved until the IS_DECAL stage which mutes the specular effect. 
+			Instead, you could do texturing within the per-light stage if it's
+			possible for your material and thus add the specular on after the
+			decal texturing, and have no post-light rendering. 
+		@par
+			If you assign an illumination stage to a pass you have to assign it
+			to all passes in the technique otherwise it will be ignored. Also note
+			that whilst you can have more than one pass in each group, they cannot
+			alternate, ie all ambient passes will be before all per-light passes, 
+			which will also be before all decal passes. Within their categories
+			the passes will retain their ordering though.
+		*/
+		void setIlluminationStage(IlluminationStage is) { mIlluminationStage = is; }
+		/// Get the manually assigned illumination stage, if any
+		IlluminationStage getIlluminationStage() const { return mIlluminationStage; }
+		/** There are some default hash functions used to order passes so that
+			render state changes are minimised, this enumerates them.
+		*/
+		enum BuiltinHashFunction
+		{
+			/** Try to minimise the number of texture changes. */
+			MIN_TEXTURE_CHANGE,
+			/** Try to minimise the number of GPU program changes.
+			@note Only really useful if you use GPU programs for all of your
+				materials. 
+			*/
+			MIN_GPU_PROGRAM_CHANGE
+		};
+		/** Sets one of the default hash functions to be used.
+		@remarks
+			You absolutely must not change the hash function whilst any Pass instances
+			exist in the render queue. The only time you can do this is either
+			before you render anything, or directly after you manuall call
+			RenderQueue::clear(true) to completely destroy the queue structures.
+			The default is MIN_TEXTURE_CHANGE.
+		@note
+			You can also implement your own hash function, see the alternate version
+			of this method.
+		@see HashFunc
+		*/
+		static void setHashFunction(BuiltinHashFunction builtin);
+
+		/** Set the hash function used for all passes.
+		@remarks
+			You absolutely must not change the hash function whilst any Pass instances
+			exist in the render queue. The only time you can do this is either
+			before you render anything, or directly after you manuall call
+			RenderQueue::clear(true) to completely destroy the queue structures.
+		@note
+			You can also use one of the built-in hash functions, see the alternate version
+			of this method. The default is MIN_TEXTURE_CHANGE.
+		@see HashFunc
+		*/
+		static void setHashFunction(HashFunc* hashFunc) { msHashFunc = hashFunc; }
+
+		/** Get the hash function used for all passes.
+		*/
+		static HashFunc* getHashFunction(void) { return msHashFunc; }
+
+		/** Get the builtin hash function.
+		*/
+		static HashFunc* getBuiltinHashFunction(BuiltinHashFunction builtin);
+
+		/** Return an instance of user objects binding associated with this class.
+		You can use it to associate one or more custom objects with this class instance.
+		@see UserObjectBindings::setUserAny.
+		*/
+		UserObjectBindings&	getUserObjectBindings() { return mUserObjectBindings; }
+
+		/** Return an instance of user objects binding associated with this class.
+		You can use it to associate one or more custom objects with this class instance.
+		@see UserObjectBindings::setUserAny.		
+		*/
+		const UserObjectBindings& getUserObjectBindings() const { return mUserObjectBindings; }
+
+		/// Support for shader model 5.0, hull and domain shaders
+		/** Sets the details of the tesselation control program to use.
+		@remarks
+			Only applicable to programmable passes, this sets the details of
+			the Tesselation Hull program to use in this pass. The program will not be
+			loaded until the parent Material is loaded.
+		@param name The name of the program - this must have been
+			created using GpuProgramManager by the time that this Pass
+			is loaded. If this parameter is blank, any Tesselation Hull program in this pass is disabled.
+        @param resetParams
+            If true, this will create a fresh set of parameters from the
+            new program being linked, so if you had previously set parameters
+            you will have to set them again. If you set this to false, you must
+            be absolutely sure that the parameters match perfectly, and in the
+            case of named parameters refers to the indexes underlying them,
+            not just the names.
+		*/
+		void setTesselationHullProgram(const String& name, bool resetParams = true);
+		/** Sets the Tesselation Hull program parameters.
+		@remarks
+			Only applicable to programmable passes.
+		*/
+		void setTesselationHullProgramParameters(GpuProgramParametersSharedPtr params);
+		/** Gets the name of the Tesselation Hull program used by this pass. */
+		const String& getTesselationHullProgramName(void) const;
+		/** Gets the Tesselation Hull program parameters used by this pass. */
+		GpuProgramParametersSharedPtr getTesselationHullProgramParameters(void) const;
+		/** Gets the Tesselation Hull program used by this pass, only available after _load(). */
+		const GpuProgramPtr& getTesselationHullProgram(void) const;
+
+		/** Sets the details of the tesselation domain program to use.
+		@remarks
+			Only applicable to programmable passes, this sets the details of
+			the Tesselation domain program to use in this pass. The program will not be
+			loaded until the parent Material is loaded.
+		@param name The name of the program - this must have been
+			created using GpuProgramManager by the time that this Pass
+			is loaded. If this parameter is blank, any Tesselation domain program in this pass is disabled.
+        @param resetParams
+            If true, this will create a fresh set of parameters from the
+            new program being linked, so if you had previously set parameters
+            you will have to set them again. If you set this to false, you must
+            be absolutely sure that the parameters match perfectly, and in the
+            case of named parameters refers to the indexes underlying them,
+            not just the names.
+		*/
+		void setTesselationDomainProgram(const String& name, bool resetParams = true);
+		/** Sets the Tesselation Domain program parameters.
+		@remarks
+			Only applicable to programmable passes.
+		*/
+		void setTesselationDomainProgramParameters(GpuProgramParametersSharedPtr params);
+		/** Gets the name of the Domain Evaluation program used by this pass. */
+		const String& getTesselationDomainProgramName(void) const;
+		/** Gets the Tesselation Domain program parameters used by this pass. */
+		GpuProgramParametersSharedPtr getTesselationDomainProgramParameters(void) const;
+		/** Gets the Tesselation Domain program used by this pass, only available after _load(). */
+		const GpuProgramPtr& getTesselationDomainProgram(void) const;
+
+		/** Sets the details of the compute program to use.
+		@remarks
+			Only applicable to programmable passes, this sets the details of
+			the compute program to use in this pass. The program will not be
+			loaded until the parent Material is loaded.
+		@param name The name of the program - this must have been
+			created using GpuProgramManager by the time that this Pass
+			is loaded. If this parameter is blank, any compute program in this pass is disabled.
+        @param resetParams
+            If true, this will create a fresh set of parameters from the
+            new program being linked, so if you had previously set parameters
+            you will have to set them again. If you set this to false, you must
+            be absolutely sure that the parameters match perfectly, and in the
+            case of named parameters refers to the indexes underlying them,
+            not just the names.
+		*/
+		void setComputeProgram(const String& name, bool resetParams = true);
+		/** Sets the Tesselation Evaluation program parameters.
+		@remarks
+			Only applicable to programmable passes.
+		*/
+		void setComputeProgramParameters(GpuProgramParametersSharedPtr params);
+		/** Gets the name of the Tesselation Hull program used by this pass. */
+		const String& getComputeProgramName(void) const;
+		/** Gets the Tesselation Hull program parameters used by this pass. */
+		GpuProgramParametersSharedPtr getComputeProgramParameters(void) const;
+		/** Gets the Tesselation EHull program used by this pass, only available after _load(). */
+		const GpuProgramPtr& getComputeProgram(void) const;
+    };
+
+    /** Struct recording a pass which can be used for a specific illumination stage.
+    @remarks
+        This structure is used to record categorised passes which fit into a
+        number of distinct illumination phases - ambient, diffuse / specular
+        (per-light) and decal (post-lighting texturing).
+        An original pass may fit into one of these categories already, or it
+        may require splitting into its component parts in order to be categorised
+        properly.
+    */
+	struct IlluminationPass : public PassAlloc
+    {
+        IlluminationStage stage;
+        /// The pass to use in this stage
+        Pass* pass;
+        /// Whether this pass is one which should be deleted itself
+        bool destroyOnShutdown;
+        /// The original pass which spawned this one
+        Pass* originalPass;
+
+		IlluminationPass() {}
+    };
+
+    typedef vector<IlluminationPass*>::type IlluminationPassList;
+
+	/** @} */
+	/** @} */
+
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgrePatchMesh.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgrePatchMesh.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgrePatchMesh.h	(revision 148)
@@ -0,0 +1,88 @@
+/*
+-----------------------------------------------------------------------------
+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 __PatchMesh_H__
+#define __PatchMesh_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreMesh.h"
+#include "OgrePatchSurface.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup LOD
+	*  @{
+	*/
+	/** Patch specialisation of Mesh. 
+    @remarks
+        Instances of this class should be created by calling MeshManager::createBezierPatch.
+    */
+    class _OgreExport PatchMesh : public Mesh
+    {
+    protected:
+        /// Internal surface definition
+        PatchSurface mSurface;
+        /// Vertex declaration, cloned from the input
+        VertexDeclaration* mDeclaration;
+    public:
+        /// Constructor
+        PatchMesh(ResourceManager* creator, const String& name, ResourceHandle handle,
+            const String& group);
+        /// Update the mesh with new control points positions.
+		void update(void* controlPointBuffer, size_t width, size_t height, 
+                    size_t uMaxSubdivisionLevel, size_t vMaxSubdivisionLevel, 
+                    PatchSurface::VisibleSide visibleSide);
+        /// Define the patch, as defined in MeshManager::createBezierPatch
+        void define(void* controlPointBuffer, 
+            VertexDeclaration *declaration, size_t width, size_t height,
+            size_t uMaxSubdivisionLevel = PatchSurface::AUTO_LEVEL, 
+            size_t vMaxSubdivisionLevel = PatchSurface::AUTO_LEVEL,
+            PatchSurface::VisibleSide visibleSide = PatchSurface::VS_FRONT,
+            HardwareBuffer::Usage vbUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY, 
+            HardwareBuffer::Usage ibUsage = HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY,
+            bool vbUseShadow = false, bool ibUseShadow = false);
+
+        /* Sets the current subdivision level as a proportion of full detail.
+        @param factor Subdivision factor as a value from 0 (control points only) to 1 (maximum
+            subdivision). */
+        void setSubdivision(Real factor);
+    protected:
+        /// Overridden from Resource
+        void loadImpl(void);
+		/// Overridden from Resource - do nothing (no disk caching)
+		void prepareImpl(void) {}
+
+    };
+	/** @} */
+	/** @} */
+
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgrePatchSurface.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgrePatchSurface.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgrePatchSurface.h	(revision 148)
@@ -0,0 +1,243 @@
+/*
+-----------------------------------------------------------------------------
+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 __PatchSurface_H__
+#define __PatchSurface_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreVector3.h"
+#include "OgreString.h"
+#include "OgreRenderOperation.h"
+#include "OgreAxisAlignedBox.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup LOD
+	*  @{
+	*/
+	/** A surface which is defined by curves of some kind to form a patch, e.g. a Bezier patch.
+        @remarks
+            This object will take a list of control points with various assorted data, and will
+            subdivide it into a patch mesh. Currently only Bezier curves are supported for defining
+            the surface, but other techniques such as NURBS would follow the same basic approach.
+    */
+	class _OgreExport PatchSurface : public PatchAlloc
+    {
+    public:
+        PatchSurface();
+        ~PatchSurface();
+
+        enum PatchSurfaceType
+        {
+            /// A patch defined by a set of bezier curves
+            PST_BEZIER
+        };
+
+        /// Constant for indicating automatic determination of subdivision level for patches
+        enum
+        {
+            AUTO_LEVEL = -1
+        };
+
+        enum VisibleSide {
+            /// The side from which u goes right and v goes up (as in texture coords)
+            VS_FRONT,
+            /// The side from which u goes right and v goes down (reverse of texture coords)
+            VS_BACK,
+            /// Both sides are visible - warning this creates 2x the number of triangles and adds extra overhead for calculating normals
+            VS_BOTH
+        };
+        /** Sets up the surface by defining it's control points, type and initial subdivision level.
+            @remarks
+                This method initialises the surface by passing it a set of control points. The type of curves to be used
+                are also defined here, although the only supported option currently is a bezier patch. You can also
+                specify a global subdivision level here if you like, although it is recommended that the parameter
+                is left as AUTO_LEVEL, which means the system decides how much subdivision is required (based on the
+                curvature of the surface)
+            @param
+                controlPointBuffer A pointer to a buffer containing the vertex data which defines control points 
+                of the curves rather than actual vertices. Note that you are expected to provide not
+                just position information, but potentially normals and texture coordinates too. The
+                format of the buffer is defined in the VertexDeclaration parameter
+            @param
+                declaration VertexDeclaration describing the contents of the buffer. 
+                Note this declaration must _only_ draw on buffer source 0!
+            @param
+                width Specifies the width of the patch in control points.
+            @param
+                height Specifies the height of the patch in control points. 
+            @param
+                pType The type of surface - currently only PST_BEZIER is supported
+            @param
+                uMaxSubdivisionLevel,vMaxSubdivisionLevel If you want to manually set the top level of subdivision, 
+                do it here, otherwise let the system decide.
+            @param
+                visibleSide Determines which side of the patch (or both) triangles are generated for.
+        */
+        void defineSurface(void* controlPointBuffer, 
+            VertexDeclaration *declaration, size_t width, size_t height,
+            PatchSurfaceType pType = PST_BEZIER, 
+            size_t uMaxSubdivisionLevel = AUTO_LEVEL, size_t vMaxSubdivisionLevel = AUTO_LEVEL,
+            VisibleSide visibleSide = VS_FRONT);
+
+        /** Based on a previous call to defineSurface, establishes the number of vertices required
+            to hold this patch at the maximum detail level. 
+            @remarks This is useful when you wish to build the patch into external vertex / index buffers.
+
+        */
+        size_t getRequiredVertexCount(void) const;
+        /** Based on a previous call to defineSurface, establishes the number of indexes required
+            to hold this patch at the maximum detail level. 
+            @remarks This is useful when you wish to build the patch into external vertex / index buffers.
+
+        */
+        size_t getRequiredIndexCount(void) const;
+
+        /** Gets the current index count based on the current subdivision level. */
+        size_t getCurrentIndexCount(void) const;
+        /// Returns the index offset used by this buffer to write data into the buffer
+        size_t getIndexOffset(void) const { return mIndexOffset; }
+        /// Returns the vertex offset used by this buffer to write data into the buffer
+        size_t getVertexOffset(void) const { return mVertexOffset; }
+
+
+        /** Gets the bounds of this patch, only valid after calling defineSurface. */
+        const AxisAlignedBox& getBounds(void) const;
+        /** Gets the radius of the bounding sphere for this patch, only valid after defineSurface 
+        has been called. */
+        Real getBoundingSphereRadius(void) const;
+        /** Tells the system to build the mesh relating to the surface into externally created
+            buffers.
+            @remarks
+                The VertexDeclaration of the vertex buffer must be identical to the one passed into
+                defineSurface.  In addition, there must be enough space in the buffer to 
+                accommodate the patch at full detail level; you should call getRequiredVertexCount
+                and getRequiredIndexCount to determine this. This method does not create an internal
+                mesh for this patch and so getMesh will return null if you call it after building the
+                patch this way.
+            @param destVertexBuffer The destination vertex buffer in which to build the patch.
+            @param vertexStart The offset at which to start writing vertices for this patch
+            @param destIndexBuffer The destination index buffer in which to build the patch.
+            @param indexStart The offset at which to start writing indexes for this patch
+
+        */
+        void build(HardwareVertexBufferSharedPtr destVertexBuffer, size_t vertexStart,
+            HardwareIndexBufferSharedPtr destIndexBuffer, size_t indexStart);
+
+        /** Alters the level of subdivision for this surface.
+            @remarks
+                This method changes the proportionate detail level of the patch; since
+                the U and V directions can have different subdivision levels, this method
+                takes a single Real value where 0 is the minimum detail (the control points)
+                and 1 is the maximum detail level as supplied to the original call to 
+                defineSurface.
+        */
+        void setSubdivisionFactor(Real factor);
+
+        /** Gets the current level of subdivision. */
+        Real getSubdivisionFactor(void) const;
+
+        void* getControlPointBuffer(void) const
+        {
+            return mControlPointBuffer;
+        }
+        /** Convenience method for telling the patch that the control points have been 
+            deleted, since once the patch has been built they are not required. */
+        void notifyControlPointBufferDeallocated(void) { 
+            mControlPointBuffer = 0;
+        }
+    protected:
+        /// Vertex declaration describing the control point buffer
+        VertexDeclaration* mDeclaration;
+        /// Buffer containing the system-memory control points
+        void* mControlPointBuffer;
+        /// Type of surface
+        PatchSurfaceType mType;
+        /// Width in control points
+        size_t mCtlWidth;
+        /// Height in control points
+        size_t mCtlHeight;
+        /// TotalNumber of control points
+        size_t mCtlCount;
+        /// U-direction subdivision level
+        size_t mULevel;
+        /// V-direction subdivision level
+        size_t mVLevel;
+        /// Max subdivision level
+        size_t mMaxULevel;
+        size_t mMaxVLevel;
+        /// Width of the subdivided mesh (big enough for max level)
+        size_t mMeshWidth;
+        /// Height of the subdivided mesh (big enough for max level)
+        size_t mMeshHeight;
+        /// Which side is visible
+        VisibleSide mVSide;
+
+        Real mSubdivisionFactor;
+
+        vector<Vector3>::type mVecCtlPoints;
+
+        /** Internal method for finding the subdivision level given 3 control points.
+        */
+        size_t findLevel( Vector3& a, Vector3& b, Vector3& c);
+
+        void distributeControlPoints(void* lockedBuffer);
+        void subdivideCurve(void* lockedBuffer, size_t startIdx, size_t stepSize, size_t numSteps, size_t iterations);
+        void interpolateVertexData(void* lockedBuffer, size_t leftIndex, size_t rightIndex, size_t destIndex);
+        void makeTriangles(void);
+
+        size_t getAutoULevel(bool forMax = false);
+        size_t getAutoVLevel(bool forMax = false);
+
+        HardwareVertexBufferSharedPtr mVertexBuffer;
+        HardwareIndexBufferSharedPtr mIndexBuffer;
+        size_t mVertexOffset;
+        size_t mIndexOffset;
+        size_t mRequiredVertexCount;
+        size_t mRequiredIndexCount;
+        size_t mCurrIndexCount;
+
+        AxisAlignedBox mAABB;
+        Real mBoundingSphere;
+
+
+
+    };
+
+	/** @} */
+	/** @} */
+
+} // namespace
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgrePixelCountLodStrategy.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgrePixelCountLodStrategy.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgrePixelCountLodStrategy.h	(revision 148)
@@ -0,0 +1,169 @@
+/*
+-----------------------------------------------------------------------------
+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 __Pixel_Count_Lod_Strategy_H__
+#define __Pixel_Count_Lod_Strategy_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreLodStrategy.h"
+#include "OgreSingleton.h"
+#include "OgreNode.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup LOD
+	*  @{
+	*/
+	/** Abstract base class for level of detail strategy based on pixel count approximations from bounding sphere projection. */
+    class _OgreExport PixelCountLodStrategy : public LodStrategy
+    {
+    protected:
+        /// @copydoc LodStrategy::getValueImpl
+        virtual Real getValueImpl(const MovableObject *movableObject, const Camera *camera) const = 0;
+
+    public:
+        /** Default constructor. */
+        PixelCountLodStrategy(const String& name);
+
+        /// @copydoc LodStrategy::getBaseValue
+        virtual Real getBaseValue() const;
+
+        /// @copydoc LodStrategy::transformBias
+        virtual Real transformBias(Real factor) const;
+
+        /// @copydoc LodStrategy::getIndex
+        virtual ushort getIndex(Real value, const Mesh::MeshLodUsageList& meshLodUsageList) const;
+
+        /// @copydoc LodStrategy::getIndex
+        virtual ushort getIndex(Real value, const Material::LodValueList& materialLodValueList) const;
+
+        /// @copydoc LodStrategy::sort
+        virtual void sort(Mesh::MeshLodUsageList& meshLodUsageList) const;
+
+        /// @copydoc LodStrategy::isSorted
+        virtual bool isSorted(const Mesh::LodValueList& values) const;
+    };
+	/** @} */
+	/** @} */
+
+    class _OgreExport AbsolutePixelCountLodStrategy : public PixelCountLodStrategy, public Singleton<AbsolutePixelCountLodStrategy>
+    {
+    public:
+        /** Default constructor. */
+        AbsolutePixelCountLodStrategy();
+
+        /// @copydoc LodStrategy::getValueImpl
+        Real getValueImpl(const MovableObject *movableObject, const Camera *camera) const;
+
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static AbsolutePixelCountLodStrategy& getSingleton(void);
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static AbsolutePixelCountLodStrategy* getSingletonPtr(void);
+    };
+    /** @} */
+    /** @} */
+
+    class _OgreExport ScreenRatioPixelCountLodStrategy : public PixelCountLodStrategy, public Singleton<ScreenRatioPixelCountLodStrategy>
+    {
+    public:
+        /** Default constructor. */
+        ScreenRatioPixelCountLodStrategy();
+
+        /// @copydoc LodStrategy::getValueImpl
+        Real getValueImpl(const MovableObject *movableObject, const Camera *camera) const;
+
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static ScreenRatioPixelCountLodStrategy& getSingleton(void);
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static ScreenRatioPixelCountLodStrategy* getSingletonPtr(void);
+    };
+    /** @} */
+    /** @} */
+
+} // namespace
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgrePixelFormat.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgrePixelFormat.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgrePixelFormat.h	(revision 148)
@@ -0,0 +1,643 @@
+/*
+-----------------------------------------------------------------------------
+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 _PixelFormat_H__
+#define _PixelFormat_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreCommon.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Image
+	*  @{
+	*/
+	/** The pixel format used for images, textures, and render surfaces */
+    enum PixelFormat
+    {
+        /// Unknown pixel format.
+        PF_UNKNOWN = 0,
+        /// 8-bit pixel format, all bits luminance.
+        PF_L8 = 1,
+		PF_BYTE_L = PF_L8,
+        /// 16-bit pixel format, all bits luminance.
+        PF_L16 = 2,
+		PF_SHORT_L = PF_L16,
+        /// 8-bit pixel format, all bits alpha.
+        PF_A8 = 3,
+		PF_BYTE_A = PF_A8,
+        /// 8-bit pixel format, 4 bits alpha, 4 bits luminance.
+        PF_A4L4 = 4,
+		/// 2 byte pixel format, 1 byte luminance, 1 byte alpha
+		PF_BYTE_LA = 5,
+        /// 16-bit pixel format, 5 bits red, 6 bits green, 5 bits blue.
+        PF_R5G6B5 = 6,
+		/// 16-bit pixel format, 5 bits red, 6 bits green, 5 bits blue.
+        PF_B5G6R5 = 7,
+        /// 8-bit pixel format, 2 bits blue, 3 bits green, 3 bits red.
+        PF_R3G3B2 = 31,
+        /// 16-bit pixel format, 4 bits for alpha, red, green and blue.
+        PF_A4R4G4B4 = 8,
+        /// 16-bit pixel format, 5 bits for blue, green, red and 1 for alpha.
+        PF_A1R5G5B5 = 9,
+        /// 24-bit pixel format, 8 bits for red, green and blue.
+        PF_R8G8B8 = 10,
+        /// 24-bit pixel format, 8 bits for blue, green and red.
+        PF_B8G8R8 = 11,
+        /// 32-bit pixel format, 8 bits for alpha, red, green and blue.
+        PF_A8R8G8B8 = 12,
+        /// 32-bit pixel format, 8 bits for blue, green, red and alpha.
+        PF_A8B8G8R8 = 13,
+        /// 32-bit pixel format, 8 bits for blue, green, red and alpha.
+        PF_B8G8R8A8 = 14,
+		/// 32-bit pixel format, 8 bits for red, green, blue and alpha.
+		PF_R8G8B8A8 = 28,
+        /// 32-bit pixel format, 8 bits for red, 8 bits for green, 8 bits for blue
+        /// like PF_A8R8G8B8, but alpha will get discarded
+        PF_X8R8G8B8 = 26,
+        /// 32-bit pixel format, 8 bits for blue, 8 bits for green, 8 bits for red
+        /// like PF_A8B8G8R8, but alpha will get discarded
+        PF_X8B8G8R8 = 27,
+#if OGRE_ENDIAN == OGRE_ENDIAN_BIG
+		/// 3 byte pixel format, 1 byte for red, 1 byte for green, 1 byte for blue
+		PF_BYTE_RGB = PF_R8G8B8,
+		/// 3 byte pixel format, 1 byte for blue, 1 byte for green, 1 byte for red
+		PF_BYTE_BGR = PF_B8G8R8,
+		/// 4 byte pixel format, 1 byte for blue, 1 byte for green, 1 byte for red and one byte for alpha
+		PF_BYTE_BGRA = PF_B8G8R8A8,
+		/// 4 byte pixel format, 1 byte for red, 1 byte for green, 1 byte for blue, and one byte for alpha
+		PF_BYTE_RGBA = PF_R8G8B8A8,
+#else
+		/// 3 byte pixel format, 1 byte for red, 1 byte for green, 1 byte for blue
+		PF_BYTE_RGB = PF_B8G8R8,
+		/// 3 byte pixel format, 1 byte for blue, 1 byte for green, 1 byte for red
+		PF_BYTE_BGR = PF_R8G8B8,
+		/// 4 byte pixel format, 1 byte for blue, 1 byte for green, 1 byte for red and one byte for alpha
+		PF_BYTE_BGRA = PF_A8R8G8B8,
+		/// 4 byte pixel format, 1 byte for red, 1 byte for green, 1 byte for blue, and one byte for alpha
+		PF_BYTE_RGBA = PF_A8B8G8R8,
+#endif        
+        /// 32-bit pixel format, 2 bits for alpha, 10 bits for red, green and blue.
+        PF_A2R10G10B10 = 15,
+        /// 32-bit pixel format, 10 bits for blue, green and red, 2 bits for alpha.
+        PF_A2B10G10R10 = 16,
+        /// DDS (DirectDraw Surface) DXT1 format
+        PF_DXT1 = 17,
+        /// DDS (DirectDraw Surface) DXT2 format
+        PF_DXT2 = 18,
+        /// DDS (DirectDraw Surface) DXT3 format
+        PF_DXT3 = 19,
+        /// DDS (DirectDraw Surface) DXT4 format
+        PF_DXT4 = 20,
+        /// DDS (DirectDraw Surface) DXT5 format
+        PF_DXT5 = 21,
+		/// 16-bit pixel format, 16 bits (float) for red
+        PF_FLOAT16_R = 32,
+        /// 48-bit pixel format, 16 bits (float) for red, 16 bits (float) for green, 16 bits (float) for blue
+        PF_FLOAT16_RGB = 22,
+        /// 64-bit pixel format, 16 bits (float) for red, 16 bits (float) for green, 16 bits (float) for blue, 16 bits (float) for alpha
+        PF_FLOAT16_RGBA = 23,
+		// 32-bit pixel format, 32 bits (float) for red
+        PF_FLOAT32_R = 33,
+        /// 96-bit pixel format, 32 bits (float) for red, 32 bits (float) for green, 32 bits (float) for blue
+        PF_FLOAT32_RGB = 24,
+        /// 128-bit pixel format, 32 bits (float) for red, 32 bits (float) for green, 32 bits (float) for blue, 32 bits (float) for alpha
+        PF_FLOAT32_RGBA = 25,
+		/// 32-bit, 2-channel s10e5 floating point pixel format, 16-bit green, 16-bit red
+		PF_FLOAT16_GR = 35,
+		/// 64-bit, 2-channel floating point pixel format, 32-bit green, 32-bit red
+		PF_FLOAT32_GR = 36,
+		/// Depth texture format
+		PF_DEPTH = 29,
+		/// 64-bit pixel format, 16 bits for red, green, blue and alpha
+		PF_SHORT_RGBA = 30,
+		/// 32-bit pixel format, 16-bit green, 16-bit red
+		PF_SHORT_GR = 34,
+		/// 48-bit pixel format, 16 bits for red, green and blue
+		PF_SHORT_RGB = 37,
+        /// PVRTC (PowerVR) RGB 2 bpp
+        PF_PVRTC_RGB2 = 38,
+        /// PVRTC (PowerVR) RGBA 2 bpp
+        PF_PVRTC_RGBA2 = 39,
+        /// PVRTC (PowerVR) RGB 4 bpp
+        PF_PVRTC_RGB4 = 40,
+        /// PVRTC (PowerVR) RGBA 4 bpp
+        PF_PVRTC_RGBA4 = 41,
+        /// PVRTC (PowerVR) Version 2, 2 bpp
+        PF_PVRTC2_2BPP = 42,
+        /// PVRTC (PowerVR) Version 2, 4 bpp
+        PF_PVRTC2_4BPP = 43,
+		/// 32-bit pixel format, 11 bits (float) for red, 11 bits (float) for green, 10 bits (float) for blue
+        PF_R11G11B10_FLOAT = 44,
+        /// 8-bit pixel format, 8 bits red (unsigned int).
+        PF_R8_UINT = 45,
+        /// 16-bit pixel format, 8 bits red (unsigned int), 8 bits blue (unsigned int).
+        PF_R8G8_UINT = 46,
+        /// 24-bit pixel format, 8 bits red (unsigned int), 8 bits blue (unsigned int), 8 bits green (unsigned int).
+        PF_R8G8B8_UINT = 47,
+        /// 32-bit pixel format, 8 bits red (unsigned int), 8 bits blue (unsigned int), 8 bits green (unsigned int), 8 bits alpha (unsigned int).
+        PF_R8G8B8A8_UINT = 48,
+        /// 16-bit pixel format, 16 bits red (unsigned int).
+        PF_R16_UINT = 49,
+        /// 32-bit pixel format, 16 bits red (unsigned int), 16 bits blue (unsigned int).
+        PF_R16G16_UINT = 50,
+        /// 48-bit pixel format, 16 bits red (unsigned int), 16 bits blue (unsigned int), 16 bits green (unsigned int).
+        PF_R16G16B16_UINT = 51,
+        /// 64-bit pixel format, 16 bits red (unsigned int), 16 bits blue (unsigned int), 16 bits green (unsigned int), 16 bits alpha (unsigned int).
+        PF_R16G16B16A16_UINT = 52,
+        /// 32-bit pixel format, 32 bits red (unsigned int).
+        PF_R32_UINT = 53,
+        /// 64-bit pixel format, 32 bits red (unsigned int), 32 bits blue (unsigned int).
+        PF_R32G32_UINT = 54,
+        /// 96-bit pixel format, 32 bits red (unsigned int), 32 bits blue (unsigned int), 32 bits green (unsigned int).
+        PF_R32G32B32_UINT = 55,
+        /// 128-bit pixel format, 32 bits red (unsigned int), 32 bits blue (unsigned int), 32 bits green (unsigned int), 32 bits alpha (unsigned int).
+        PF_R32G32B32A32_UINT = 56,
+        /// 8-bit pixel format, 8 bits red (signed int).
+        PF_R8_SINT = 57,
+        /// 16-bit pixel format, 8 bits red (signed int), 8 bits blue (signed int).
+        PF_R8G8_SINT = 58,
+        /// 24-bit pixel format, 8 bits red (signed int), 8 bits blue (signed int), 8 bits green (signed int).
+        PF_R8G8B8_SINT = 59,
+        /// 32-bit pixel format, 8 bits red (signed int), 8 bits blue (signed int), 8 bits green (signed int), 8 bits alpha (signed int).
+        PF_R8G8B8A8_SINT = 60,
+        /// 16-bit pixel format, 16 bits red (signed int).
+        PF_R16_SINT = 61,
+        /// 32-bit pixel format, 16 bits red (signed int), 16 bits blue (signed int).
+        PF_R16G16_SINT = 62,
+        /// 48-bit pixel format, 16 bits red (signed int), 16 bits blue (signed int), 16 bits green (signed int).
+        PF_R16G16B16_SINT = 63,
+        /// 64-bit pixel format, 16 bits red (signed int), 16 bits blue (signed int), 16 bits green (signed int), 16 bits alpha (signed int).
+        PF_R16G16B16A16_SINT = 64,
+        /// 32-bit pixel format, 32 bits red (signed int).
+        PF_R32_SINT = 65,
+        /// 64-bit pixel format, 32 bits red (signed int), 32 bits blue (signed int).
+        PF_R32G32_SINT = 66,
+        /// 96-bit pixel format, 32 bits red (signed int), 32 bits blue (signed int), 32 bits green (signed int).
+        PF_R32G32B32_SINT = 67,
+        /// 128-bit pixel format, 32 bits red (signed int), 32 bits blue (signed int), 32 bits green (signed int), 32 bits alpha (signed int).
+        PF_R32G32B32A32_SINT = 68,
+        /// 32-bit pixel format, 9 bits for blue, green, red plus a 5 bit exponent.
+        PF_R9G9B9E5_SHAREDEXP = 69,
+        /// DDS (DirectDraw Surface) BC4 format (unsigned normalised)
+        PF_BC4_UNORM = 70,
+        /// DDS (DirectDraw Surface) BC4 format (signed normalised)
+        PF_BC4_SNORM = 71,
+        /// DDS (DirectDraw Surface) BC5 format (unsigned normalised)
+        PF_BC5_UNORM = 72,
+        /// DDS (DirectDraw Surface) BC5 format (signed normalised)
+        PF_BC5_SNORM = 73,
+        /// DDS (DirectDraw Surface) BC6H format (unsigned 16 bit float)
+        PF_BC6H_UF16 = 74,
+        /// DDS (DirectDraw Surface) BC6H format (signed 16 bit float)
+        PF_BC6H_SF16 = 75,
+        /// DDS (DirectDraw Surface) BC7 format (unsigned normalised)
+        PF_BC7_UNORM = 76,
+        /// DDS (DirectDraw Surface) BC7 format (unsigned normalised sRGB)
+        PF_BC7_UNORM_SRGB = 77,
+        /// 8-bit pixel format, all bits red.
+        PF_R8 = 78,
+        /// 16-bit pixel format, 8 bits red, 8 bits green.
+        PF_RG8 = 79,
+        /// 8-bit pixel format, 8 bits red (signed normalised int).
+        PF_R8_SNORM = 80,
+        /// 16-bit pixel format, 8 bits red (signed normalised int), 8 bits blue (signed normalised int).
+        PF_R8G8_SNORM = 81,
+        /// 24-bit pixel format, 8 bits red (signed normalised int), 8 bits blue (signed normalised int), 8 bits green (signed normalised int).
+        PF_R8G8B8_SNORM = 82,
+        /// 32-bit pixel format, 8 bits red (signed normalised int), 8 bits blue (signed normalised int), 8 bits green (signed normalised int), 8 bits alpha (signed normalised int).
+        PF_R8G8B8A8_SNORM = 83,
+        /// 16-bit pixel format, 16 bits red (signed normalised int).
+        PF_R16_SNORM = 84,
+        /// 32-bit pixel format, 16 bits red (signed normalised int), 16 bits blue (signed normalised int).
+        PF_R16G16_SNORM = 85,
+        /// 48-bit pixel format, 16 bits red (signed normalised int), 16 bits blue (signed normalised int), 16 bits green (signed normalised int).
+        PF_R16G16B16_SNORM = 86,
+        /// 64-bit pixel format, 16 bits red (signed normalised int), 16 bits blue (signed normalised int), 16 bits green (signed normalised int), 16 bits alpha (signed normalised int).
+        PF_R16G16B16A16_SNORM = 87,
+        /// ETC1 (Ericsson Texture Compression)
+        PF_ETC1_RGB8 = 88,
+        /// ETC2 (Ericsson Texture Compression)
+        PF_ETC2_RGB8 = 89,
+        /// ETC2 (Ericsson Texture Compression)
+        PF_ETC2_RGBA8 = 90,
+        /// ETC2 (Ericsson Texture Compression)
+        PF_ETC2_RGB8A1 = 91,
+		/// ATC (AMD_compressed_ATC_texture)
+		PF_ATC_RGB = 92,
+		/// ATC (AMD_compressed_ATC_texture)
+		PF_ATC_RGBA_EXPLICIT_ALPHA = 93,
+		/// ATC (AMD_compressed_ATC_texture)
+		PF_ATC_RGBA_INTERPOLATED_ALPHA = 94,
+		// Number of pixel formats currently defined
+        PF_COUNT = 95
+    };
+	typedef vector<PixelFormat>::type PixelFormatList;
+
+    /**
+     * Flags defining some on/off properties of pixel formats
+     */
+    enum PixelFormatFlags {
+        /// This format has an alpha channel
+        PFF_HASALPHA        = 0x00000001,      
+        /** This format is compressed. This invalidates the values in elemBytes,
+            elemBits and the bit counts as these might not be fixed in a compressed format. */
+        PFF_COMPRESSED    = 0x00000002,
+        /// This is a floating point format
+        PFF_FLOAT           = 0x00000004,         
+        /// This is a depth format (for depth textures)
+        PFF_DEPTH           = 0x00000008,
+        /** Format is in native endian. Generally true for the 16, 24 and 32 bits
+            formats which can be represented as machine integers. */
+        PFF_NATIVEENDIAN    = 0x00000010,
+        /** This is an intensity format instead of a RGB one. The luminance
+            replaces R,G and B. (but not A) */
+        PFF_LUMINANCE       = 0x00000020,
+        /// This is an integer format
+        PFF_INTEGER         = 0x00000040
+    };
+    
+    /** Pixel component format */
+    enum PixelComponentType
+    {
+        PCT_BYTE = 0,    /// Byte per component (8 bit fixed 0.0..1.0)
+        PCT_SHORT = 1,   /// Short per component (16 bit fixed 0.0..1.0))
+        PCT_FLOAT16 = 2, /// 16 bit float per component
+        PCT_FLOAT32 = 3, /// 32 bit float per component
+        PCT_SINT = 4,   /// Signed integer per component
+        PCT_UINT = 5,   /// Unsigned integer per component
+        PCT_COUNT = 6    /// Number of pixel types
+    };
+    
+	/** A primitive describing a volume (3D), image (2D) or line (1D) of pixels in memory.
+     	In case of a rectangle, depth must be 1. 
+     	Pixels are stored as a succession of "depth" slices, each containing "height" rows of 
+     	"width" pixels.
+    */
+    class _OgreExport PixelBox: public Box, public ImageAlloc {
+    public:
+    	/// Parameter constructor for setting the members manually
+    	PixelBox() {}
+		~PixelBox() {}
+		/** Constructor providing extents in the form of a Box object. This constructor
+    		assumes the pixel data is laid out consecutively in memory. (this
+    		means row after row, slice after slice, with no space in between)
+    		@param extents	    Extents of the region defined by data
+    		@param pixelFormat	Format of this buffer
+    		@param pixelData	Pointer to the actual data
+    	*/
+		PixelBox(const Box &extents, PixelFormat pixelFormat, void *pixelData=0):
+			Box(extents), data(pixelData), format(pixelFormat)
+		{
+			setConsecutive();
+		}
+    	/** Constructor providing width, height and depth. This constructor
+    		assumes the pixel data is laid out consecutively in memory. (this
+    		means row after row, slice after slice, with no space in between)
+    		@param width	    Width of the region
+    		@param height	    Height of the region
+    		@param depth	    Depth of the region
+    		@param pixelFormat	Format of this buffer
+    		@param pixelData    Pointer to the actual data
+    	*/
+    	PixelBox(uint32 width, uint32 height, uint32 depth, PixelFormat pixelFormat, void *pixelData=0):
+    		Box(0, 0, 0, width, height, depth),
+    		data(pixelData), format(pixelFormat)
+    	{
+    		setConsecutive();
+    	}
+    	
+        /// The data pointer 
+        void *data;
+        /// The pixel format 
+        PixelFormat format;
+        /** Number of elements between the leftmost pixel of one row and the left
+         	pixel of the next. This value must always be equal to getWidth() (consecutive) 
+			for compressed formats.
+        */
+        size_t rowPitch;
+        /** Number of elements between the top left pixel of one (depth) slice and 
+         	the top left pixel of the next. This can be a negative value. Must be a multiple of
+         	rowPitch. This value must always be equal to getWidth()*getHeight() (consecutive) 
+			for compressed formats.
+        */
+        size_t slicePitch;
+        
+        /** Set the rowPitch and slicePitch so that the buffer is laid out consecutive 
+         	in memory.
+        */        
+        void setConsecutive()
+        {
+            rowPitch = getWidth();
+            slicePitch = getWidth()*getHeight();
+        }
+        /**	Get the number of elements between one past the rightmost pixel of 
+         	one row and the leftmost pixel of the next row. (IE this is zero if rows
+         	are consecutive).
+        */
+        size_t getRowSkip() const { return rowPitch - getWidth(); }
+        /** Get the number of elements between one past the right bottom pixel of
+         	one slice and the left top pixel of the next slice. (IE this is zero if slices
+         	are consecutive).
+        */
+        size_t getSliceSkip() const { return slicePitch - (getHeight() * rowPitch); }
+
+        /** Return whether this buffer is laid out consecutive in memory (ie the pitches
+         	are equal to the dimensions)
+        */        
+        bool isConsecutive() const 
+		{ 
+			return rowPitch == getWidth() && slicePitch == getWidth()*getHeight(); 
+		}
+        /** Return the size (in bytes) this image would take if it was
+        	laid out consecutive in memory
+      	*/
+      	size_t getConsecutiveSize() const;
+      	/** Return a subvolume of this PixelBox.
+      		@param def	Defines the bounds of the subregion to return
+      		@return	A pixel box describing the region and the data in it
+      		@remarks	This function does not copy any data, it just returns
+      			a PixelBox object with a data pointer pointing somewhere inside 
+      			the data of object.
+      		@throws	Exception(ERR_INVALIDPARAMS) if def is not fully contained
+      	*/
+      	PixelBox getSubVolume(const Box &def) const;
+        
+      	/** Return a data pointer pointing to top left front pixel of the pixel box.
+            @remarks Non consecutive pixel boxes are supported.
+         */
+        void* getTopLeftFrontPixelPtr() const;
+        
+        /**
+         * Get colour value from a certain location in the PixelBox. The z coordinate
+         * is only valid for cubemaps and volume textures. This uses the first (largest)
+         * mipmap.
+         */
+        ColourValue getColourAt(size_t x, size_t y, size_t z);
+
+        /**
+         * Set colour value at a certain location in the PixelBox. The z coordinate
+         * is only valid for cubemaps and volume textures. This uses the first (largest)
+         * mipmap.
+         */
+        void setColourAt(ColourValue const &cv, size_t x, size_t y, size_t z);
+    };
+    
+
+    /**
+     * Some utility functions for packing and unpacking pixel data
+     */
+    class _OgreExport PixelUtil {
+    public:
+        /** Returns the size in bytes of an element of the given pixel format.
+         @return
+               The size in bytes of an element. See Remarks.
+         @remarks
+               Passing PF_UNKNOWN will result in returning a size of 0 bytes.
+        */
+        static size_t getNumElemBytes( PixelFormat format );
+
+        /** Returns the size in bits of an element of the given pixel format.
+          @return
+               The size in bits of an element. See Remarks.
+           @remarks
+               Passing PF_UNKNOWN will result in returning a size of 0 bits.
+        */
+        static size_t getNumElemBits( PixelFormat format );
+
+		/** Returns the size in memory of a region with the given extents and pixel
+			format with consecutive memory layout.
+			@param width
+				The width of the area
+			@param height
+				The height of the area
+			@param depth
+				The depth of the area
+			@param format
+				The format of the area
+		  	@return
+		  		The size in bytes
+			@remarks
+				In case that the format is non-compressed, this simply returns
+				width*height*depth*PixelUtil::getNumElemBytes(format). In the compressed
+				case, this does serious magic.
+		*/
+		static size_t getMemorySize(uint32 width, uint32 height, uint32 depth, PixelFormat format);
+		
+        /** Returns the property flags for this pixel format
+          @return
+               A bitfield combination of PFF_HASALPHA, PFF_ISCOMPRESSED,
+               PFF_FLOAT, PFF_DEPTH, PFF_NATIVEENDIAN, PFF_LUMINANCE
+          @remarks
+               This replaces the separate functions for formatHasAlpha, formatIsFloat, ...
+        */
+        static unsigned int getFlags( PixelFormat format );
+
+        /** Shortcut method to determine if the format has an alpha component */
+        static bool hasAlpha(PixelFormat format);
+        /** Shortcut method to determine if the format is floating point */
+        static bool isFloatingPoint(PixelFormat format);
+        /** Shortcut method to determine if the format is integer */
+        static bool isInteger(PixelFormat format);
+        /** Shortcut method to determine if the format is compressed */
+        static bool isCompressed(PixelFormat format);
+        /** Shortcut method to determine if the format is a depth format. */
+        static bool isDepth(PixelFormat format);
+        /** Shortcut method to determine if the format is in native endian format. */
+        static bool isNativeEndian(PixelFormat format);
+        /** Shortcut method to determine if the format is a luminance format. */
+        static bool isLuminance(PixelFormat format);
+		
+		/** Return whether a certain image extent is valid for this image format.
+			@param width
+				The width of the area
+			@param height
+				The height of the area
+			@param depth
+				The depth of the area
+			@param format
+				The format of the area
+			@remarks For non-compressed formats, this is always true. For DXT formats,
+			only sizes with a width and height multiple of 4 and depth 1 are allowed.
+		*/
+		static bool isValidExtent(size_t width, size_t height, size_t depth, PixelFormat format);
+
+        /** Gives the number of bits (RGBA) for a format. See remarks.          
+          @remarks      For non-colour formats (dxt, depth) this returns [0,0,0,0].
+        */
+        static void getBitDepths(PixelFormat format, int rgba[4]);
+
+		/** Gives the masks for the R, G, B and A component
+		  @note			Only valid for native endian formats
+        */
+        static void getBitMasks(PixelFormat format, uint64 rgba[4]);
+
+		/** Gives the bit shifts for R, G, B and A component
+		@note			Only valid for native endian formats
+		*/
+		static void getBitShifts(PixelFormat format, unsigned char rgba[4]);
+
+        /** Gets the name of an image format
+        */
+        static String getFormatName(PixelFormat srcformat);
+
+        /** Returns whether the format can be packed or unpacked with the packColour()
+        and unpackColour() functions. This is generally not true for compressed and
+        depth formats as they are special. It can only be true for formats with a
+        fixed element size.
+          @return 
+               true if yes, otherwise false
+        */
+        static bool isAccessible(PixelFormat srcformat);
+        
+        /** Returns the component type for a certain pixel format. Returns PCT_BYTE
+            in case there is no clear component type like with compressed formats.
+            This is one of PCT_BYTE, PCT_SHORT, PCT_FLOAT16, PCT_FLOAT32.
+        */
+        static PixelComponentType getComponentType(PixelFormat fmt);
+        
+        /** Returns the component count for a certain pixel format. Returns 3(no alpha) or 
+            4 (has alpha) in case there is no clear component type like with compressed formats.
+         */
+        static size_t getComponentCount(PixelFormat fmt);
+
+        /** Gets the format from given name.
+            @param  name            The string of format name
+            @param  accessibleOnly  If true, non-accessible format will treat as invalid format,
+                                    otherwise, all supported format are valid.
+            @param  caseSensitive   Should be set true if string match should use case sensitivity.
+            @return                The format match the format name, or PF_UNKNOWN if is invalid name.
+        */
+        static PixelFormat getFormatFromName(const String& name, bool accessibleOnly = false, bool caseSensitive = false);
+
+        /** Gets the BNF expression of the pixel-formats.
+            @note                   The string returned by this function is intended to be used as a BNF expression
+                                    to work with Compiler2Pass.
+            @param  accessibleOnly  If true, only accessible pixel format will take into account, otherwise all
+                                    pixel formats list in PixelFormat enumeration will being returned.
+            @return                A string contains the BNF expression.
+        */
+        static String getBNFExpressionOfPixelFormats(bool accessibleOnly = false);
+
+        /** Returns the similar format but acoording with given bit depths.
+            @param fmt      The original foamt.
+            @param integerBits Preferred bit depth (pixel bits) for integer pixel format.
+                            Available values: 0, 16 and 32, where 0 (the default) means as it is.
+            @param floatBits Preferred bit depth (channel bits) for float pixel format.
+                            Available values: 0, 16 and 32, where 0 (the default) means as it is.
+            @return        The format that similar original format with bit depth according
+                            with preferred bit depth, or original format if no conversion occurring.
+        */
+        static PixelFormat getFormatForBitDepths(PixelFormat fmt, ushort integerBits, ushort floatBits);
+
+        /** Pack a colour value to memory
+        	@param colour	The colour
+        	@param pf		Pixelformat in which to write the colour
+        	@param dest		Destination memory location
+        */
+        static void packColour(const ColourValue &colour, const PixelFormat pf,  void* dest);
+        /** Pack a colour value to memory
+            @param r,g,b,a	The four colour components, range 0.0f to 1.0f
+                            (an exception to this case exists for floating point pixel
+                            formats, which don't clamp to 0.0f..1.0f)
+        	@param pf		Pixelformat in which to write the colour
+        	@param dest		Destination memory location
+        */
+        static void packColour(const uint8 r, const uint8 g, const uint8 b, const uint8 a, const PixelFormat pf,  void* dest);
+         /** Pack a colour value to memory
+        	@param r,g,b,a	The four colour components, range 0.0f to 1.0f
+        					(an exception to this case exists for floating point pixel
+        					formats, which don't clamp to 0.0f..1.0f)
+        	@param pf		Pixelformat in which to write the colour
+        	@param dest		Destination memory location
+        */
+        static void packColour(const float r, const float g, const float b, const float a, const PixelFormat pf,  void* dest);
+
+        /** Unpack a colour value from memory
+        	@param colour	The colour is returned here
+        	@param pf		Pixelformat in which to read the colour
+        	@param src		Source memory location
+        */
+        static void unpackColour(ColourValue *colour, PixelFormat pf,  const void* src);
+        /** Unpack a colour value from memory
+        	@param r        The red channel is returned here (as byte)
+            @param g        The blue channel is returned here (as byte)
+            @param b        The green channel is returned here (as byte)
+            @param a        The alpha channel is returned here (as byte)
+        	@param pf		Pixelformat in which to read the colour
+        	@param src		Source memory location
+        	@remarks 	This function returns the colour components in 8 bit precision,
+        		this will lose precision when coming from PF_A2R10G10B10 or floating
+        		point formats.  
+        */
+        static void unpackColour(uint8 *r, uint8 *g, uint8 *b, uint8 *a, PixelFormat pf,  const void* src);
+        /** Unpack a colour value from memory
+            @param r        The red channel is returned here (as float)
+            @param g        The blue channel is returned here (as float)
+            @param b        The green channel is returned here (as float)
+            @param a        The alpha channel is returned here (as float)
+        	@param pf		Pixelformat in which to read the colour
+        	@param src		Source memory location
+        */
+        static void unpackColour(float *r, float *g, float *b, float *a, PixelFormat pf,  const void* src); 
+        
+        /** Convert consecutive pixels from one format to another. No dithering or filtering is being done. 
+         	Converting from RGB to luminance takes the R channel.  In case the source and destination format match,
+         	just a copy is done.
+         	@param	src			Pointer to source region
+         	@param	srcFormat	Pixel format of source region
+         	@param  dst			Pointer to destination region
+         	@param	dstFormat	Pixel format of destination region
+         */
+        static void bulkPixelConversion(void *src, PixelFormat srcFormat, void *dst, PixelFormat dstFormat, unsigned int count);
+
+      	/** Convert pixels from one format to another. No dithering or filtering is being done. Converting
+          	from RGB to luminance takes the R channel. 
+		 	@param	src			PixelBox containing the source pixels, pitches and format
+		 	@param	dst			PixelBox containing the destination pixels, pitches and format
+		 	@remarks The source and destination boxes must have the same
+         	dimensions. In case the source and destination format match, a plain copy is done.
+        */
+        static void bulkPixelConversion(const PixelBox &src, const PixelBox &dst);
+
+      	/** Flips pixels inplace in vertical direction.
+            @param	box			PixelBox containing pixels, pitches and format
+            @remarks Non consecutive pixel boxes are supported.
+         */
+        static void bulkPixelVerticalFlip(const PixelBox &box);
+    };
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgrePixelFormatDescriptions.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgrePixelFormatDescriptions.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgrePixelFormatDescriptions.h	(revision 148)
@@ -0,0 +1,1362 @@
+/*
+-----------------------------------------------------------------------------
+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 __PixelFormatDescriptions_H__
+#define __PixelFormatDescriptions_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreCommon.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+    //-----------------------------------------------------------------------
+    /**
+     * A record that describes a pixel format in detail.
+     */
+    struct PixelFormatDescription {
+        /* Name of the format, as in the enum */
+        const char *name;
+        /* Number of bytes one element (colour value) takes. */
+        unsigned char elemBytes;
+        /* Pixel format flags, see enum PixelFormatFlags for the bit field
+         * definitions
+         */
+        uint32 flags;
+        /** Component type
+         */
+        PixelComponentType componentType;
+        /** Component count
+         */
+        unsigned char componentCount;
+        /* Number of bits for red(or luminance), green, blue, alpha
+         */
+        unsigned char rbits, gbits, bbits, abits; /*, ibits, dbits, ... */
+
+        /* Masks and shifts as used by packers/unpackers */
+        uint64 rmask, gmask, bmask, amask;
+        unsigned char rshift, gshift, bshift, ashift;
+    };
+    //-----------------------------------------------------------------------
+    /** Pixel format database */
+    PixelFormatDescription _pixelFormats[PF_COUNT] = {
+        //-----------------------------------------------------------------------
+        {"PF_UNKNOWN",
+            /* Bytes per element */
+            0,
+            /* Flags */
+            0,
+            /* Component type and count */
+            PCT_BYTE, 0,
+            /* rbits, gbits, bbits, abits */
+            0, 0, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_L8",
+            /* Bytes per element */
+            1,
+            /* Flags */
+            PFF_LUMINANCE | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_BYTE, 1,
+            /* rbits, gbits, bbits, abits */
+            8, 0, 0, 0,
+            /* Masks and shifts */
+            0xFF, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_L16",
+            /* Bytes per element */
+            2,
+            /* Flags */
+            PFF_LUMINANCE | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_SHORT, 1,
+            /* rbits, gbits, bbits, abits */
+            16, 0, 0, 0,
+            /* Masks and shifts */
+            0xFFFF, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_A8",
+            /* Bytes per element */
+            1,
+            /* Flags */
+            PFF_HASALPHA | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_BYTE, 1,
+            /* rbits, gbits, bbits, abits */
+            0, 0, 0, 8,
+            /* Masks and shifts */
+            0, 0, 0, 0xFF, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_A4L4",
+            /* Bytes per element */
+            1,
+            /* Flags */
+            PFF_HASALPHA | PFF_LUMINANCE | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_BYTE, 2,
+            /* rbits, gbits, bbits, abits */
+            4, 0, 0, 4,
+            /* Masks and shifts */
+            0x0F, 0, 0, 0xF0, 0, 0, 0, 4
+        },
+        //-----------------------------------------------------------------------
+        {"PF_BYTE_LA",
+            /* Bytes per element */
+            2,
+            /* Flags */
+            PFF_HASALPHA | PFF_LUMINANCE,
+            /* Component type and count */
+            PCT_BYTE, 2,
+            /* rbits, gbits, bbits, abits */
+            8, 0, 0, 8,
+            /* Masks and shifts */
+            0,0,0,0,0,0,0,0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R5G6B5",
+            /* Bytes per element */
+            2,
+            /* Flags */
+            PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_BYTE, 3,
+            /* rbits, gbits, bbits, abits */
+            5, 6, 5, 0,
+            /* Masks and shifts */
+            0xF800, 0x07E0, 0x001F, 0,
+            11, 5, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_B5G6R5",
+            /* Bytes per element */
+            2,
+            /* Flags */
+            PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_BYTE, 3,
+            /* rbits, gbits, bbits, abits */
+            5, 6, 5, 0,
+            /* Masks and shifts */
+            0x001F, 0x07E0, 0xF800, 0,
+            0, 5, 11, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_A4R4G4B4",
+            /* Bytes per element */
+            2,
+            /* Flags */
+            PFF_HASALPHA | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_BYTE, 4,
+            /* rbits, gbits, bbits, abits */
+            4, 4, 4, 4,
+            /* Masks and shifts */
+            0x0F00, 0x00F0, 0x000F, 0xF000,
+            8, 4, 0, 12
+        },
+        //-----------------------------------------------------------------------
+        {"PF_A1R5G5B5",
+            /* Bytes per element */
+            2,
+            /* Flags */
+            PFF_HASALPHA | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_BYTE, 4,
+            /* rbits, gbits, bbits, abits */
+            5, 5, 5, 1,
+            /* Masks and shifts */
+            0x7C00, 0x03E0, 0x001F, 0x8000,
+            10, 5, 0, 15,
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R8G8B8",
+            /* Bytes per element */
+            3,  // 24 bit integer -- special
+            /* Flags */
+            PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_BYTE, 3,
+            /* rbits, gbits, bbits, abits */
+            8, 8, 8, 0,
+            /* Masks and shifts */
+            0xFF0000, 0x00FF00, 0x0000FF, 0,
+            16, 8, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_B8G8R8",
+            /* Bytes per element */
+            3,  // 24 bit integer -- special
+            /* Flags */
+            PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_BYTE, 3,
+            /* rbits, gbits, bbits, abits */
+            8, 8, 8, 0,
+            /* Masks and shifts */
+            0x0000FF, 0x00FF00, 0xFF0000, 0,
+            0, 8, 16, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_A8R8G8B8",
+            /* Bytes per element */
+            4,
+            /* Flags */
+            PFF_HASALPHA | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_BYTE, 4,
+            /* rbits, gbits, bbits, abits */
+            8, 8, 8, 8,
+            /* Masks and shifts */
+            0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000,
+            16, 8, 0, 24
+        },
+        //-----------------------------------------------------------------------
+        {"PF_A8B8G8R8",
+            /* Bytes per element */
+            4,
+            /* Flags */
+            PFF_HASALPHA | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_BYTE, 4,
+            /* rbits, gbits, bbits, abits */
+            8, 8, 8, 8,
+            /* Masks and shifts */
+            0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000,
+            0, 8, 16, 24,
+        },
+        //-----------------------------------------------------------------------
+        {"PF_B8G8R8A8",
+            /* Bytes per element */
+            4,
+            /* Flags */
+            PFF_HASALPHA | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_BYTE, 4,
+            /* rbits, gbits, bbits, abits */
+            8, 8, 8, 8,
+            /* Masks and shifts */
+            0x0000FF00, 0x00FF0000, 0xFF000000, 0x000000FF,
+            8, 16, 24, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_A2R10G10B10",
+            /* Bytes per element */
+            4,
+            /* Flags */
+            PFF_HASALPHA | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_BYTE, 4,
+            /* rbits, gbits, bbits, abits */
+            10, 10, 10, 2,
+            /* Masks and shifts */
+            0x3FF00000, 0x000FFC00, 0x000003FF, 0xC0000000,
+            20, 10, 0, 30
+        },
+        //-----------------------------------------------------------------------
+        {"PF_A2B10G10R10",
+            /* Bytes per element */
+            4,
+            /* Flags */
+            PFF_HASALPHA | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_BYTE, 4,
+            /* rbits, gbits, bbits, abits */
+            10, 10, 10, 2,
+            /* Masks and shifts */
+            0x000003FF, 0x000FFC00, 0x3FF00000, 0xC0000000,
+            0, 10, 20, 30
+        },
+        //-----------------------------------------------------------------------
+        {"PF_DXT1",
+            /* Bytes per element */
+            0,
+            /* Flags */
+            PFF_COMPRESSED | PFF_HASALPHA,
+            /* Component type and count */
+            PCT_BYTE, 3, // No alpha
+            /* rbits, gbits, bbits, abits */
+            0, 0, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_DXT2",
+            /* Bytes per element */
+            0,
+            /* Flags */
+            PFF_COMPRESSED | PFF_HASALPHA,
+            /* Component type and count */
+            PCT_BYTE, 4,
+            /* rbits, gbits, bbits, abits */
+            0, 0, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_DXT3",
+            /* Bytes per element */
+            0,
+            /* Flags */
+            PFF_COMPRESSED | PFF_HASALPHA,
+            /* Component type and count */
+            PCT_BYTE, 4,
+            /* rbits, gbits, bbits, abits */
+            0, 0, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_DXT4",
+            /* Bytes per element */
+            0,
+            /* Flags */
+            PFF_COMPRESSED | PFF_HASALPHA,
+            /* Component type and count */
+            PCT_BYTE, 4,
+            /* rbits, gbits, bbits, abits */
+            0, 0, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_DXT5",
+            /* Bytes per element */
+            0,
+            /* Flags */
+            PFF_COMPRESSED | PFF_HASALPHA,
+            /* Component type and count */
+            PCT_BYTE, 4,
+            /* rbits, gbits, bbits, abits */
+            0, 0, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_FLOAT16_RGB",
+            /* Bytes per element */
+            6,
+            /* Flags */
+            PFF_FLOAT,
+            /* Component type and count */
+            PCT_FLOAT16, 3,
+            /* rbits, gbits, bbits, abits */
+            16, 16, 16, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_FLOAT16_RGBA",
+            /* Bytes per element */
+            8,
+            /* Flags */
+            PFF_FLOAT | PFF_HASALPHA,
+            /* Component type and count */
+            PCT_FLOAT16, 4,
+            /* rbits, gbits, bbits, abits */
+            16, 16, 16, 16,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_FLOAT32_RGB",
+            /* Bytes per element */
+            12,
+            /* Flags */
+            PFF_FLOAT,
+            /* Component type and count */
+            PCT_FLOAT32, 3,
+            /* rbits, gbits, bbits, abits */
+            32, 32, 32, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_FLOAT32_RGBA",
+            /* Bytes per element */
+            16,
+            /* Flags */
+            PFF_FLOAT | PFF_HASALPHA,
+            /* Component type and count */
+            PCT_FLOAT32, 4,
+            /* rbits, gbits, bbits, abits */
+            32, 32, 32, 32,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_X8R8G8B8",
+            /* Bytes per element */
+            4,
+            /* Flags */
+            PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_BYTE, 3,
+            /* rbits, gbits, bbits, abits */
+            8, 8, 8, 0,
+            /* Masks and shifts */
+            0x00FF0000, 0x0000FF00, 0x000000FF, 0xFF000000,
+            16, 8, 0, 24
+        },
+        //-----------------------------------------------------------------------
+        {"PF_X8B8G8R8",
+            /* Bytes per element */
+            4,
+            /* Flags */
+            PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_BYTE, 3,
+            /* rbits, gbits, bbits, abits */
+            8, 8, 8, 0,
+            /* Masks and shifts */
+            0x000000FF, 0x0000FF00, 0x00FF0000, 0xFF000000,
+            0, 8, 16, 24
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R8G8B8A8",
+            /* Bytes per element */
+            4,
+            /* Flags */
+            PFF_HASALPHA | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_BYTE, 4,
+            /* rbits, gbits, bbits, abits */
+            8, 8, 8, 8,
+            /* Masks and shifts */
+            0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF,
+            24, 16, 8, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_DEPTH",
+            /* Bytes per element */
+            4,
+            /* Flags */
+            PFF_DEPTH,
+            /* Component type and count */
+            PCT_FLOAT16, 1, // ?
+            /* rbits, gbits, bbits, abits */
+            16, 0, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_SHORT_RGBA",
+            /* Bytes per element */
+            8,
+            /* Flags */
+            PFF_HASALPHA,
+            /* Component type and count */
+            PCT_SHORT, 4,
+            /* rbits, gbits, bbits, abits */
+            16, 16, 16, 16,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R3G3B2",
+            /* Bytes per element */
+            1,
+            /* Flags */
+            PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_BYTE, 3,
+            /* rbits, gbits, bbits, abits */
+            3, 3, 2, 0,
+            /* Masks and shifts */
+            0xE0, 0x1C, 0x03, 0,
+            5, 2, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_FLOAT16_R",
+            /* Bytes per element */
+            2,
+            /* Flags */
+            PFF_FLOAT,
+            /* Component type and count */
+            PCT_FLOAT16, 1,
+            /* rbits, gbits, bbits, abits */
+            16, 0, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_FLOAT32_R",
+            /* Bytes per element */
+            4,
+            /* Flags */
+            PFF_FLOAT,
+            /* Component type and count */
+            PCT_FLOAT32, 1,
+            /* rbits, gbits, bbits, abits */
+            32, 0, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_SHORT_GR",
+            /* Bytes per element */
+            4,
+            /* Flags */
+            PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_SHORT, 2,
+            /* rbits, gbits, bbits, abits */
+            16, 16, 0, 0,
+            /* Masks and shifts */
+            0x0000FFFF, 0xFFFF0000, 0, 0,
+            0, 16, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_FLOAT16_GR",
+            /* Bytes per element */
+            4,
+            /* Flags */
+            PFF_FLOAT,
+            /* Component type and count */
+            PCT_FLOAT16, 2,
+            /* rbits, gbits, bbits, abits */
+            16, 16, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_FLOAT32_GR",
+            /* Bytes per element */
+            8,
+            /* Flags */
+            PFF_FLOAT,
+            /* Component type and count */
+            PCT_FLOAT32, 2,
+            /* rbits, gbits, bbits, abits */
+            32, 32, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_SHORT_RGB",
+            /* Bytes per element */
+            6,
+            /* Flags */
+            0,
+            /* Component type and count */
+            PCT_SHORT, 3,
+            /* rbits, gbits, bbits, abits */
+            16, 16, 16, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_PVRTC_RGB2",
+            /* Bytes per element */
+            0,
+            /* Flags */
+            PFF_COMPRESSED,
+            /* Component type and count */
+            PCT_BYTE, 3,
+            /* rbits, gbits, bbits, abits */
+            0, 0, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_PVRTC_RGBA2",
+            /* Bytes per element */
+            0,
+            /* Flags */
+            PFF_COMPRESSED | PFF_HASALPHA,
+            /* Component type and count */
+            PCT_BYTE, 4,
+            /* rbits, gbits, bbits, abits */
+            0, 0, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_PVRTC_RGB4",
+            /* Bytes per element */
+            0,
+            /* Flags */
+            PFF_COMPRESSED,
+            /* Component type and count */
+            PCT_BYTE, 3,
+            /* rbits, gbits, bbits, abits */
+            0, 0, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_PVRTC_RGBA4",
+            /* Bytes per element */
+            0,
+            /* Flags */
+            PFF_COMPRESSED | PFF_HASALPHA,
+            /* Component type and count */
+            PCT_BYTE, 4,
+            /* rbits, gbits, bbits, abits */
+            0, 0, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_PVRTC2_2BPP",
+            /* Bytes per element */
+            0,
+            /* Flags */
+            PFF_COMPRESSED | PFF_HASALPHA,
+            /* Component type and count */
+            PCT_BYTE, 4,
+            /* rbits, gbits, bbits, abits */
+            0, 0, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_PVRTC2_4BPP",
+            /* Bytes per element */
+            0,
+            /* Flags */
+            PFF_COMPRESSED | PFF_HASALPHA,
+            /* Component type and count */
+            PCT_BYTE, 4,
+            /* rbits, gbits, bbits, abits */
+            0, 0, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R11G11B10_FLOAT",
+            /* Bytes per element */
+            4,
+            /* Flags */
+            PFF_FLOAT | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_FLOAT32, 1,
+            /* rbits, gbits, bbits, abits */
+            11, 11, 10, 0,
+            /* Masks and shifts */
+            0xFFC00000, 0x03FF800, 0x000007FF, 0,
+            24, 16, 8, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R8_UINT",
+            /* Bytes per element */
+            1,
+            /* Flags */
+            PFF_INTEGER | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_UINT, 1,
+            /* rbits, gbits, bbits, abits */
+            8, 0, 0, 0,
+            /* Masks and shifts */
+            0xFF, 0, 0, 0,
+            0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R8G8_UINT",
+            /* Bytes per element */
+            2,
+            /* Flags */
+            PFF_INTEGER | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_UINT, 2,
+            /* rbits, gbits, bbits, abits */
+            8, 8, 0, 0,
+            /* Masks and shifts */
+            0xFF00, 0x00FF, 0, 0,
+            8, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R8G8B8_UINT",
+            /* Bytes per element */
+            3,
+            /* Flags */
+            PFF_INTEGER | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_UINT, 3,
+            /* rbits, gbits, bbits, abits */
+            8, 8, 8, 0,
+            /* Masks and shifts */
+            0xFF0000, 0x00FF00, 0x0000FF, 0,
+            16, 8, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R8G8B8A8_UINT",
+            /* Bytes per element */
+            4,
+            /* Flags */
+            PFF_INTEGER | PFF_HASALPHA | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_UINT, 4,
+            /* rbits, gbits, bbits, abits */
+            8, 8, 8, 8,
+            /* Masks and shifts */
+            0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF,
+            24, 16, 8, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R16_UINT",
+            /* Bytes per element */
+            2,
+            /* Flags */
+            PFF_INTEGER | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_UINT, 1,
+            /* rbits, gbits, bbits, abits */
+            16, 0, 0, 0,
+            /* Masks and shifts */
+            0xFFFF, 0, 0, 0,
+            0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R16G16_UINT",
+            /* Bytes per element */
+            4,
+            /* Flags */
+            PFF_INTEGER | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_UINT, 2,
+            /* rbits, gbits, bbits, abits */
+            16, 16, 0, 0,
+            /* Masks and shifts */
+            0xFFFF0000, 0x0000FFFF, 0, 0,
+            16, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R16G16B16_UINT",
+            /* Bytes per element */
+            6,
+            /* Flags */
+            PFF_INTEGER | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_UINT, 3,
+            /* rbits, gbits, bbits, abits */
+            16, 16, 16, 0,
+            /* Masks and shifts */
+            0xFFFF00000000, 0x0000FFFF0000, 0x00000000FFFF, 0,
+            32, 16, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R16G16B16A16_UINT",
+            /* Bytes per element */
+            8,
+            /* Flags */
+            PFF_INTEGER | PFF_HASALPHA | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_UINT, 4,
+            /* rbits, gbits, bbits, abits */
+            16, 16, 16, 16,
+            /* Masks and shifts */
+            0xFFFF000000000000, 0x0000FFFF00000000, 0x00000000FFFF0000, 0x000000000000FFFF,
+            48, 32, 16, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R32_UINT",
+            /* Bytes per element */
+            4,
+            /* Flags */
+            PFF_INTEGER | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_UINT, 1,
+            /* rbits, gbits, bbits, abits */
+            32, 0, 0, 0,
+            /* Masks and shifts */
+            0xFFFFFFFF, 0, 0, 0,
+            0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R32G32_UINT",
+            /* Bytes per element */
+            8,
+            /* Flags */
+            PFF_INTEGER | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_UINT, 2,
+            /* rbits, gbits, bbits, abits */
+            32, 32, 0, 0,
+            /* Masks and shifts */
+            0xFFFFFFFF00000000, 0xFFFFFFFF, 0, 0,
+            32, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R32G32B32_UINT",
+            /* Bytes per element */
+            12,
+            /* Flags */
+            PFF_INTEGER | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_UINT, 3,
+            /* rbits, gbits, bbits, abits */
+            32, 32, 32, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0,
+            64, 32, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R32G32B32A32_UINT",
+            /* Bytes per element */
+            16,
+            /* Flags */
+            PFF_INTEGER | PFF_HASALPHA | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_UINT, 4,
+            /* rbits, gbits, bbits, abits */
+            32, 32, 32, 32,
+            /* Masks and shifts */
+            0, 0, 0, 0,
+            96, 64, 32, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R8_SINT",
+            /* Bytes per element */
+            1,
+            /* Flags */
+            PFF_INTEGER | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_SINT, 1,
+            /* rbits, gbits, bbits, abits */
+            8, 0, 0, 0,
+            /* Masks and shifts */
+            0xFF, 0, 0, 0,
+            0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R8G8_SINT",
+            /* Bytes per element */
+            2,
+            /* Flags */
+            PFF_INTEGER | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_SINT, 2,
+            /* rbits, gbits, bbits, abits */
+            8, 8, 0, 0,
+            /* Masks and shifts */
+            0xFF00, 0x00FF, 0, 0,
+            8, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R8G8B8_SINT",
+            /* Bytes per element */
+            3,
+            /* Flags */
+            PFF_INTEGER | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_SINT, 3,
+            /* rbits, gbits, bbits, abits */
+            8, 8, 8, 0,
+            /* Masks and shifts */
+            0xFF0000, 0x00FF00, 0x0000FF, 0,
+            16, 8, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R8G8B8A8_SINT",
+            /* Bytes per element */
+            4,
+            /* Flags */
+            PFF_INTEGER | PFF_HASALPHA | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_SINT, 4,
+            /* rbits, gbits, bbits, abits */
+            8, 8, 8, 8,
+            /* Masks and shifts */
+            0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF,
+            24, 16, 8, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R16_SINT",
+            /* Bytes per element */
+            2,
+            /* Flags */
+            PFF_INTEGER | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_SINT, 1,
+            /* rbits, gbits, bbits, abits */
+            16, 0, 0, 0,
+            /* Masks and shifts */
+            0xFFFF, 0, 0, 0,
+            0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R16G16_SINT",
+            /* Bytes per element */
+            4,
+            /* Flags */
+            PFF_INTEGER | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_SINT, 2,
+            /* rbits, gbits, bbits, abits */
+            16, 16, 0, 0,
+            /* Masks and shifts */
+            0xFFFF0000, 0x0000FFFF, 0, 0,
+            16, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R16G16B16_SINT",
+            /* Bytes per element */
+            6,
+            /* Flags */
+            PFF_INTEGER | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_SINT, 3,
+            /* rbits, gbits, bbits, abits */
+            16, 16, 16, 0,
+            /* Masks and shifts */
+            0xFFFF00000000, 0x0000FFFF0000, 0x00000000FFFF, 0,
+            32, 16, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R16G16B16A16_SINT",
+            /* Bytes per element */
+            8,
+            /* Flags */
+            PFF_INTEGER | PFF_HASALPHA | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_SINT, 4,
+            /* rbits, gbits, bbits, abits */
+            16, 16, 16, 16,
+            /* Masks and shifts */
+            0xFFFF000000000000, 0x0000FFFF00000000, 0x00000000FFFF0000, 0x000000000000FFFF,
+            48, 32, 16, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R32_SINT",
+            /* Bytes per element */
+            4,
+            /* Flags */
+            PFF_INTEGER | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_SINT, 1,
+            /* rbits, gbits, bbits, abits */
+            32, 0, 0, 0,
+            /* Masks and shifts */
+            0xFFFFFFFF, 0, 0, 0,
+            0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R32G32_SINT",
+            /* Bytes per element */
+            8,
+            /* Flags */
+            PFF_INTEGER | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_SINT, 2,
+            /* rbits, gbits, bbits, abits */
+            32, 32, 0, 0,
+            /* Masks and shifts */
+            0xFFFFFFFF00000000, 0xFFFFFFFF, 0, 0,
+            32, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R32G32B32_SINT",
+            /* Bytes per element */
+            12,
+            /* Flags */
+            PFF_INTEGER | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_SINT, 3,
+            /* rbits, gbits, bbits, abits */
+            32, 32, 32, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0,
+            64, 32, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R32G32B32A32_SINT",
+            /* Bytes per element */
+            16,
+            /* Flags */
+            PFF_INTEGER | PFF_HASALPHA | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_SINT, 4,
+            /* rbits, gbits, bbits, abits */
+            32, 32, 32, 32,
+            /* Masks and shifts */
+            0, 0, 0, 0,
+            96, 64, 32, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R9G9B9E5_SHAREDEXP",
+            /* Bytes per element */
+            4,
+            /* Flags */
+            PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_BYTE, 4,
+            /* rbits, gbits, bbits, abits */
+            9, 9, 9, 0,
+            /* Masks and shifts */
+            0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF,
+            24, 16, 8, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_BC4_UNORM",
+            /* Bytes per element */
+            0,
+            /* Flags */
+            PFF_COMPRESSED,
+            /* Component type and count */
+            PCT_BYTE, 1, // Red only
+            /* rbits, gbits, bbits, abits */
+            0, 0, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_BC4_SNORM",
+            /* Bytes per element */
+            0,
+            /* Flags */
+            PFF_COMPRESSED,
+            /* Component type and count */
+            PCT_BYTE, 1, // Red only
+            /* rbits, gbits, bbits, abits */
+            0, 0, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_BC5_UNORM",
+            /* Bytes per element */
+            0,
+            /* Flags */
+            PFF_COMPRESSED,
+            /* Component type and count */
+            PCT_BYTE, 2, // Red-Green only
+            /* rbits, gbits, bbits, abits */
+            0, 0, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_BC5_SNORM",
+            /* Bytes per element */
+            0,
+            /* Flags */
+            PFF_COMPRESSED,
+            /* Component type and count */
+            PCT_BYTE, 2, // Red-Green only
+            /* rbits, gbits, bbits, abits */
+            0, 0, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_BC6H_UF16",
+            /* Bytes per element */
+            0,
+            /* Flags */
+            PFF_COMPRESSED,
+            /* Component type and count */
+            PCT_BYTE, 3,
+            /* rbits, gbits, bbits, abits */
+            0, 0, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_BC6H_SF16",
+            /* Bytes per element */
+            0,
+            /* Flags */
+            PFF_COMPRESSED,
+            /* Component type and count */
+            PCT_BYTE, 3,
+            /* rbits, gbits, bbits, abits */
+            0, 0, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_BC7_UNORM",
+            /* Bytes per element */
+            0,
+            /* Flags */
+            PFF_COMPRESSED | PFF_HASALPHA,
+            /* Component type and count */
+            PCT_BYTE, 4,
+            /* rbits, gbits, bbits, abits */
+            0, 0, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_BC7_UNORM_SRGB",
+            /* Bytes per element */
+            0,
+            /* Flags */
+            PFF_COMPRESSED | PFF_HASALPHA,
+            /* Component type and count */
+            PCT_BYTE, 4,
+            /* rbits, gbits, bbits, abits */
+            0, 0, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R8",
+            /* Bytes per element */
+            1,
+            /* Flags */
+            PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_BYTE, 1,
+            /* rbits, gbits, bbits, abits */
+            8, 0, 0, 0,
+            /* Masks and shifts */
+            0xFF, 0, 0, 0,
+            0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_RG8",
+            /* Bytes per element */
+            2,
+            /* Flags */
+            PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_BYTE, 2,
+            /* rbits, gbits, bbits, abits */
+            8, 8, 0, 0,
+            /* Masks and shifts */
+            0xFF0000, 0x00FF00, 0, 0,
+            8, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R8_SNORM",
+            /* Bytes per element */
+            1,
+            /* Flags */
+            PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_BYTE, 1,
+            /* rbits, gbits, bbits, abits */
+            8, 0, 0, 0,
+            /* Masks and shifts */
+            0xFF, 0, 0, 0,
+            0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R8G8_SNORM",
+            /* Bytes per element */
+            2,
+            /* Flags */
+            PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_BYTE, 2,
+            /* rbits, gbits, bbits, abits */
+            8, 8, 0, 0,
+            /* Masks and shifts */
+            0xFF00, 0x00FF, 0, 0,
+            8, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R8G8B8_SNORM",
+            /* Bytes per element */
+            3,
+            /* Flags */
+            PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_BYTE, 3,
+            /* rbits, gbits, bbits, abits */
+            8, 8, 8, 0,
+            /* Masks and shifts */
+            0xFF0000, 0x00FF00, 0x0000FF, 0,
+            16, 8, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R8G8B8A8_SNORM",
+            /* Bytes per element */
+            4,
+            /* Flags */
+            PFF_HASALPHA | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_BYTE, 4,
+            /* rbits, gbits, bbits, abits */
+            8, 8, 8, 8,
+            /* Masks and shifts */
+            0xFF000000, 0x00FF0000, 0x0000FF00, 0x000000FF,
+            24, 16, 8, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R16_SNORM",
+            /* Bytes per element */
+            2,
+            /* Flags */
+            PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_BYTE, 1,
+            /* rbits, gbits, bbits, abits */
+            16, 0, 0, 0,
+            /* Masks and shifts */
+            0xFFFF, 0, 0, 0,
+            0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R16G16_SNORM",
+            /* Bytes per element */
+            4,
+            /* Flags */
+            PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_BYTE, 2,
+            /* rbits, gbits, bbits, abits */
+            16, 16, 0, 0,
+            /* Masks and shifts */
+            0xFFFF0000, 0x0000FFFF, 0, 0,
+            16, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R16G16B16_SNORM",
+            /* Bytes per element */
+            6,
+            /* Flags */
+            PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_BYTE, 3,
+            /* rbits, gbits, bbits, abits */
+            16, 16, 16, 0,
+            /* Masks and shifts */
+            0xFFFF00000000, 0x0000FFFF0000, 0x00000000FFFF, 0,
+            32, 16, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_R16G16B16A16_SNORM",
+            /* Bytes per element */
+            8,
+            /* Flags */
+            PFF_HASALPHA | PFF_NATIVEENDIAN,
+            /* Component type and count */
+            PCT_BYTE, 4,
+            /* rbits, gbits, bbits, abits */
+            16, 16, 16, 16,
+            /* Masks and shifts */
+            0xFFFF000000000000, 0x0000FFFF00000000, 0x00000000FFFF0000, 0x000000000000FFFF,
+            48, 32, 16, 0
+        },
+        
+        //-----------------------------------------------------------------------
+        {"PF_ETC1_RGB8",
+            /* Bytes per element */
+            0,
+            /* Flags */
+            PFF_COMPRESSED,
+            /* Component type and count */
+            PCT_BYTE, 3,
+            /* rbits, gbits, bbits, abits */
+            0, 0, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_ETC2_RGB8",
+            /* Bytes per element */
+            0,
+            /* Flags */
+            PFF_COMPRESSED,
+            /* Component type and count */
+            PCT_BYTE, 3,
+            /* rbits, gbits, bbits, abits */
+            0, 0, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_ETC2_RGBA8",
+            /* Bytes per element */
+            0,
+            /* Flags */
+            PFF_COMPRESSED | PFF_HASALPHA,
+            /* Component type and count */
+            PCT_BYTE, 4,
+            /* rbits, gbits, bbits, abits */
+            0, 0, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_ETC2_RGB8A1",
+            /* Bytes per element */
+            0,
+            /* Flags */
+            PFF_COMPRESSED | PFF_HASALPHA,
+            /* Component type and count */
+            PCT_BYTE, 4,
+            /* rbits, gbits, bbits, abits */
+            0, 0, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_ATC_RGB",
+            /* Bytes per element */
+            0,
+            /* Flags */
+            PFF_COMPRESSED,
+            /* Component type and count */
+            PCT_BYTE, 3,
+            /* rbits, gbits, bbits, abits */
+            0, 0, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_ATC_RGBA_EXPLICIT_ALPHA",
+            /* Bytes per element */
+            0,
+            /* Flags */
+            PFF_COMPRESSED | PFF_HASALPHA,
+            /* Component type and count */
+            PCT_BYTE, 4,
+            /* rbits, gbits, bbits, abits */
+            0, 0, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        },
+        //-----------------------------------------------------------------------
+        {"PF_ATC_RGBA_INTERPOLATED_ALPHA",
+            /* Bytes per element */
+            0,
+            /* Flags */
+            PFF_COMPRESSED | PFF_HASALPHA,
+            /* Component type and count */
+            PCT_BYTE, 4,
+            /* rbits, gbits, bbits, abits */
+            0, 0, 0, 0,
+            /* Masks and shifts */
+            0, 0, 0, 0, 0, 0, 0, 0
+        }
+    };
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgrePlane.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgrePlane.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgrePlane.h	(revision 148)
@@ -0,0 +1,166 @@
+/*
+-----------------------------------------------------------------------------
+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.
+-----------------------------------------------------------------------------
+*/
+// This file is based on material originally from:
+// Geometric Tools, LLC
+// Copyright (c) 1998-2010
+// Distributed under the Boost Software License, Version 1.0.
+// http://www.boost.org/LICENSE_1_0.txt
+// http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
+
+
+#ifndef __Plane_H__
+#define __Plane_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreVector3.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Math
+	*  @{
+	*/
+	/** Defines a plane in 3D space.
+        @remarks
+            A plane is defined in 3D space by the equation
+            Ax + By + Cz + D = 0
+        @par
+            This equates to a vector (the normal of the plane, whose x, y
+            and z components equate to the coefficients A, B and C
+            respectively), and a constant (D) which is the distance along
+            the normal you have to go to move the plane back to the origin.
+     */
+    class _OgreExport Plane
+    {
+    public:
+        /** Default constructor - sets everything to 0.
+        */
+        Plane ();
+        Plane (const Plane& rhs);
+        /** Construct a plane through a normal, and a distance to move the plane along the normal.*/
+        Plane (const Vector3& rkNormal, Real fConstant);
+		/** Construct a plane using the 4 constants directly **/
+		Plane (Real a, Real b, Real c, Real d);
+        Plane (const Vector3& rkNormal, const Vector3& rkPoint);
+        Plane (const Vector3& rkPoint0, const Vector3& rkPoint1,
+            const Vector3& rkPoint2);
+
+        /** The "positive side" of the plane is the half space to which the
+            plane normal points. The "negative side" is the other half
+            space. The flag "no side" indicates the plane itself.
+        */
+        enum Side
+        {
+            NO_SIDE,
+            POSITIVE_SIDE,
+            NEGATIVE_SIDE,
+            BOTH_SIDE
+        };
+
+        Side getSide (const Vector3& rkPoint) const;
+
+        /**
+        Returns the side where the alignedBox is. The flag BOTH_SIDE indicates an intersecting box.
+        One corner ON the plane is sufficient to consider the box and the plane intersecting.
+        */
+        Side getSide (const AxisAlignedBox& rkBox) const;
+
+        /** Returns which side of the plane that the given box lies on.
+            The box is defined as centre/half-size pairs for effectively.
+        @param centre The centre of the box.
+        @param halfSize The half-size of the box.
+        @return
+            POSITIVE_SIDE if the box complete lies on the "positive side" of the plane,
+            NEGATIVE_SIDE if the box complete lies on the "negative side" of the plane,
+            and BOTH_SIDE if the box intersects the plane.
+        */
+        Side getSide (const Vector3& centre, const Vector3& halfSize) const;
+
+        /** This is a pseudodistance. The sign of the return value is
+            positive if the point is on the positive side of the plane,
+            negative if the point is on the negative side, and zero if the
+            point is on the plane.
+            @par
+            The absolute value of the return value is the true distance only
+            when the plane normal is a unit length vector.
+        */
+        Real getDistance (const Vector3& rkPoint) const;
+
+        /** Redefine this plane based on 3 points. */
+        void redefine(const Vector3& rkPoint0, const Vector3& rkPoint1,
+            const Vector3& rkPoint2);
+
+		/** Redefine this plane based on a normal and a point. */
+		void redefine(const Vector3& rkNormal, const Vector3& rkPoint);
+
+		/** Project a vector onto the plane. 
+		@remarks This gives you the element of the input vector that is perpendicular 
+			to the normal of the plane. You can get the element which is parallel
+			to the normal of the plane by subtracting the result of this method
+			from the original vector, since parallel + perpendicular = original.
+		@param v The input vector
+		*/
+		Vector3 projectVector(const Vector3& v) const;
+
+        /** Normalises the plane.
+            @remarks
+                This method normalises the plane's normal and the length scale of d
+                is as well.
+            @note
+                This function will not crash for zero-sized vectors, but there
+                will be no changes made to their components.
+            @return The previous length of the plane's normal.
+        */
+        Real normalise(void);
+
+		Vector3 normal;
+        Real d;
+
+        /// Comparison operator
+        bool operator==(const Plane& rhs) const
+        {
+            return (rhs.d == d && rhs.normal == normal);
+        }
+        bool operator!=(const Plane& rhs) const
+        {
+            return (rhs.d != d || rhs.normal != normal);
+        }
+
+        _OgreExport friend std::ostream& operator<< (std::ostream& o, const Plane& p);
+    };
+
+    typedef vector<Plane>::type PlaneList;
+	/** @} */
+	/** @} */
+
+} // namespace Ogre
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgrePlaneBoundedVolume.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgrePlaneBoundedVolume.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgrePlaneBoundedVolume.h	(revision 148)
@@ -0,0 +1,138 @@
+/*
+-----------------------------------------------------------------------------
+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 __PlaneBoundedVolume_H_
+#define __PlaneBoundedVolume_H_
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+#include "OgreAxisAlignedBox.h"
+#include "OgreSphere.h"
+#include "OgreMath.h"
+#include "OgrePlane.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Math
+	*  @{
+	*/
+	/** Represents a convex volume bounded by planes.
+    */
+    class _OgreExport PlaneBoundedVolume
+    {
+    public:
+        typedef vector<Plane>::type PlaneList;
+        /// Publicly accessible plane list, you can modify this direct
+        PlaneList planes;
+        Plane::Side outside;
+
+        PlaneBoundedVolume() :outside(Plane::NEGATIVE_SIDE) {}
+        /** Constructor, determines which side is deemed to be 'outside' */
+        PlaneBoundedVolume(Plane::Side theOutside) 
+            : outside(theOutside) {}
+
+        /** Intersection test with AABB
+        @remarks May return false positives but will never miss an intersection.
+        */
+        inline bool intersects(const AxisAlignedBox& box) const
+        {
+            if (box.isNull()) return false;
+            if (box.isInfinite()) return true;
+
+            // Get centre of the box
+            Vector3 centre = box.getCenter();
+            // Get the half-size of the box
+            Vector3 halfSize = box.getHalfSize();
+            
+            PlaneList::const_iterator i, iend;
+            iend = planes.end();
+            for (i = planes.begin(); i != iend; ++i)
+            {
+                const Plane& plane = *i;
+
+                Plane::Side side = plane.getSide(centre, halfSize);
+                if (side == outside)
+                {
+                    // Found a splitting plane therefore return not intersecting
+                    return false;
+                }
+            }
+
+            // couldn't find a splitting plane, assume intersecting
+            return true;
+
+        }
+        /** Intersection test with Sphere
+        @remarks May return false positives but will never miss an intersection.
+        */
+        inline bool intersects(const Sphere& sphere) const
+        {
+            PlaneList::const_iterator i, iend;
+            iend = planes.end();
+            for (i = planes.begin(); i != iend; ++i)
+            {
+                const Plane& plane = *i;
+
+                // Test which side of the plane the sphere is
+                Real d = plane.getDistance(sphere.getCenter());
+                // Negate d if planes point inwards
+                if (outside == Plane::NEGATIVE_SIDE) d = -d;
+
+                if ( (d - sphere.getRadius()) > 0)
+                    return false;
+            }
+
+            return true;
+
+        }
+
+        /** Intersection test with a Ray
+        @return std::pair of hit (bool) and distance
+        @remarks May return false positives but will never miss an intersection.
+        */
+        inline std::pair<bool, Real> intersects(const Ray& ray)
+        {
+            return Math::intersects(ray, planes, outside == Plane::POSITIVE_SIDE);
+        }
+
+    };
+
+    typedef vector<PlaneBoundedVolume>::type PlaneBoundedVolumeList;
+
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgrePlatform.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgrePlatform.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgrePlatform.h	(revision 148)
@@ -0,0 +1,422 @@
+/*
+-----------------------------------------------------------------------------
+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 __Platform_H_
+#define __Platform_H_
+
+#include "OgreConfig.h"
+
+namespace Ogre {
+/* Initial platform/compiler-related stuff to set.
+*/
+#define OGRE_PLATFORM_WIN32 1
+#define OGRE_PLATFORM_LINUX 2
+#define OGRE_PLATFORM_APPLE 3
+#define OGRE_PLATFORM_APPLE_IOS 4
+#define OGRE_PLATFORM_ANDROID 5
+#define OGRE_PLATFORM_NACL 6
+#define OGRE_PLATFORM_WINRT 7
+#define OGRE_PLATFORM_FLASHCC 8
+
+#define OGRE_COMPILER_MSVC 1
+#define OGRE_COMPILER_GNUC 2
+#define OGRE_COMPILER_BORL 3
+#define OGRE_COMPILER_WINSCW 4
+#define OGRE_COMPILER_GCCE 5
+#define OGRE_COMPILER_CLANG 6
+
+#define OGRE_ENDIAN_LITTLE 1
+#define OGRE_ENDIAN_BIG 2
+
+#define OGRE_ARCHITECTURE_32 1
+#define OGRE_ARCHITECTURE_64 2
+
+/* Finds the compiler type and version.
+*/
+#if (defined( __WIN32__ ) || defined( _WIN32 )) && defined(__ANDROID__) // We are using NVTegra
+#   define OGRE_COMPILER OGRE_COMPILER_GNUC
+#   define OGRE_COMP_VER 470
+#elif defined( __GCCE__ )
+#   define OGRE_COMPILER OGRE_COMPILER_GCCE
+#   define OGRE_COMP_VER _MSC_VER
+//#	include <staticlibinit_gcce.h> // This is a GCCE toolchain workaround needed when compiling with GCCE 
+#elif defined( __WINSCW__ )
+#   define OGRE_COMPILER OGRE_COMPILER_WINSCW
+#   define OGRE_COMP_VER _MSC_VER
+#elif defined( _MSC_VER )
+#   define OGRE_COMPILER OGRE_COMPILER_MSVC
+#   define OGRE_COMP_VER _MSC_VER
+#elif defined( __clang__ )
+#   define OGRE_COMPILER OGRE_COMPILER_CLANG
+#   define OGRE_COMP_VER (((__clang_major__)*100) + \
+        (__clang_minor__*10) + \
+        __clang_patchlevel__)
+#elif defined( __GNUC__ )
+#   define OGRE_COMPILER OGRE_COMPILER_GNUC
+#   define OGRE_COMP_VER (((__GNUC__)*100) + \
+        (__GNUC_MINOR__*10) + \
+        __GNUC_PATCHLEVEL__)
+#elif defined( __BORLANDC__ )
+#   define OGRE_COMPILER OGRE_COMPILER_BORL
+#   define OGRE_COMP_VER __BCPLUSPLUS__
+#   define __FUNCTION__ __FUNC__ 
+#else
+#   pragma error "No known compiler. Abort! Abort!"
+
+#endif
+
+/* See if we can use __forceinline or if we need to use __inline instead */
+#if OGRE_COMPILER == OGRE_COMPILER_MSVC
+#   if OGRE_COMP_VER >= 1200
+#       define FORCEINLINE __forceinline
+#   endif
+#elif defined(__MINGW32__)
+#   if !defined(FORCEINLINE)
+#       define FORCEINLINE __inline
+#   endif
+#else
+#   define FORCEINLINE __inline
+#endif
+
+/* Finds the current platform */
+#if (defined( __WIN32__ ) || defined( _WIN32 )) && !defined(__ANDROID__)
+#	if defined(WINAPI_FAMILY)
+#		define __OGRE_HAVE_DIRECTXMATH 1
+#		include <winapifamily.h>
+#		if WINAPI_FAMILY == WINAPI_FAMILY_APP|| WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
+#			define DESKTOP_APP 1
+#			define PHONE 2
+#			define OGRE_PLATFORM OGRE_PLATFORM_WINRT
+#           ifndef _CRT_SECURE_NO_WARNINGS
+#               define _CRT_SECURE_NO_WARNINGS
+#           endif
+#           ifndef _SCL_SECURE_NO_WARNINGS
+#               define _SCL_SECURE_NO_WARNINGS
+#           endif
+#			if WINAPI_FAMILY == WINAPI_FAMILY_APP
+#				define OGRE_WINRT_TARGET_TYPE DESKTOP_APP
+#			endif
+#			if WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP
+#				define OGRE_WINRT_TARGET_TYPE PHONE
+#			endif
+#		else
+#			define OGRE_PLATFORM OGRE_PLATFORM_WIN32
+#		endif
+#	else
+#		define OGRE_PLATFORM OGRE_PLATFORM_WIN32
+#	endif
+#elif defined(__FLASHCC__)
+#	define OGRE_PLATFORM OGRE_PLATFORM_FLASHCC
+#elif defined( __APPLE_CC__)
+#   ifndef __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__
+#       define __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ 0
+#   endif
+#   ifndef __IPHONE_OS_VERSION_MIN_REQUIRED
+#       define __IPHONE_OS_VERSION_MIN_REQUIRED 0
+#   endif
+    // Device                                                     Simulator
+    // Both requiring OS version 6.0 or greater
+#   if __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 60000 || __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000
+#       define OGRE_PLATFORM OGRE_PLATFORM_APPLE_IOS
+#   else
+#       define OGRE_PLATFORM OGRE_PLATFORM_APPLE
+#   endif
+#elif defined(__ANDROID__)
+#	define OGRE_PLATFORM OGRE_PLATFORM_ANDROID
+#elif defined( __native_client__ ) 
+#   define OGRE_PLATFORM OGRE_PLATFORM_NACL
+#   ifndef OGRE_STATIC_LIB
+#       error OGRE must be built as static for NaCl (OGRE_STATIC=true in CMake)
+#   endif
+#   ifdef OGRE_BUILD_RENDERSYSTEM_D3D9
+#       error D3D9 is not supported on NaCl (OGRE_BUILD_RENDERSYSTEM_D3D9 false in CMake)
+#   endif
+#   ifdef OGRE_BUILD_RENDERSYSTEM_GL
+#       error OpenGL is not supported on NaCl (OGRE_BUILD_RENDERSYSTEM_GL=false in CMake)
+#   endif
+#   ifndef OGRE_BUILD_RENDERSYSTEM_GLES2
+#       error GLES2 render system is required for NaCl (OGRE_BUILD_RENDERSYSTEM_GLES2=false in CMake)
+#   endif
+#else
+#   define OGRE_PLATFORM OGRE_PLATFORM_LINUX
+#endif
+
+    /* Find the arch type */
+#if defined(__x86_64__) || defined(_M_X64) || defined(__powerpc64__) || defined(__alpha__) || defined(__ia64__) || defined(__s390__) || defined(__s390x__) || defined(__arm64__) || defined(_aarch64_) || defined(__mips64) || defined(__mips64_)
+#   define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_64
+#else
+#   define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_32
+#endif
+
+// For generating compiler warnings - should work on any compiler
+// As a side note, if you start your message with 'Warning: ', the MSVC
+// IDE actually does catch a warning :)
+#define OGRE_QUOTE_INPLACE(x) # x
+#define OGRE_QUOTE(x) OGRE_QUOTE_INPLACE(x)
+#define OGRE_WARN( x )  message( __FILE__ "(" QUOTE( __LINE__ ) ") : " x "\n" )
+
+// For marking functions as deprecated
+#if OGRE_COMPILER == OGRE_COMPILER_MSVC
+#   define OGRE_DEPRECATED __declspec(deprecated)
+#elif OGRE_COMPILER == OGRE_COMPILER_GNUC || OGRE_COMPILER == OGRE_COMPILER_CLANG
+#   define OGRE_DEPRECATED __attribute__ ((deprecated))
+#else
+#   pragma message("WARNING: You need to implement OGRE_DEPRECATED for this compiler")
+#   define OGRE_DEPRECATED
+#endif
+
+//----------------------------------------------------------------------------
+// Windows Settings
+#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WINRT
+
+// If we're not including this from a client build, specify that the stuff
+// should get exported. Otherwise, import it.
+#	if defined( OGRE_STATIC_LIB )
+		// Linux compilers don't have symbol import/export directives.
+#   	define _OgreExport
+#   	define _OgrePrivate
+#   else
+#   	if defined( OGRE_NONCLIENT_BUILD )
+#       	define _OgreExport __declspec( dllexport )
+#   	else
+#           if defined( __MINGW32__ )
+#               define _OgreExport
+#           else
+#       	    define _OgreExport __declspec( dllimport )
+#           endif
+#   	endif
+#   	define _OgrePrivate
+#	endif
+// Win32 compilers use _DEBUG for specifying debug builds.
+// for MinGW, we set DEBUG
+#   if defined(_DEBUG) || defined(DEBUG)
+#       define OGRE_DEBUG_MODE 1
+#   else
+#       define OGRE_DEBUG_MODE 0
+#   endif
+
+// Disable unicode support on MingW for GCC 3, poorly supported in stdlibc++
+// STLPORT fixes this though so allow if found
+// MinGW C++ Toolkit supports unicode and sets the define __MINGW32_TOOLBOX_UNICODE__ in _mingw.h
+// GCC 4 is also fine
+#if defined(__MINGW32__)
+# if OGRE_COMP_VER < 400
+#  if !defined(_STLPORT_VERSION)
+#   include<_mingw.h>
+#   if defined(__MINGW32_TOOLBOX_UNICODE__) || OGRE_COMP_VER > 345
+#    define OGRE_UNICODE_SUPPORT 1
+#   else
+#    define OGRE_UNICODE_SUPPORT 0
+#   endif
+#  else
+#   define OGRE_UNICODE_SUPPORT 1
+#  endif
+# else
+#  define OGRE_UNICODE_SUPPORT 1
+# endif
+#else
+#  define OGRE_UNICODE_SUPPORT 1
+#endif
+
+#endif // OGRE_PLATFORM == OGRE_PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WINRT
+
+//----------------------------------------------------------------------------
+// Linux/Apple/iOS/Android/NaCl Settings
+#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX || OGRE_PLATFORM == OGRE_PLATFORM_APPLE || OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS || \
+    OGRE_PLATFORM == OGRE_PLATFORM_ANDROID || OGRE_PLATFORM == OGRE_PLATFORM_NACL || OGRE_PLATFORM == OGRE_PLATFORM_FLASHCC
+
+// Enable GCC symbol visibility
+#   if defined( OGRE_GCC_VISIBILITY )
+#       define _OgreExport  __attribute__ ((visibility("default")))
+#       define _OgrePrivate __attribute__ ((visibility("hidden")))
+#   else
+#       define _OgreExport
+#       define _OgrePrivate
+#   endif
+
+// A quick define to overcome different names for the same function
+#   define stricmp strcasecmp
+
+#   ifdef DEBUG
+#       define OGRE_DEBUG_MODE 1
+#   else
+#       define OGRE_DEBUG_MODE 0
+#   endif
+
+// Always enable unicode support for the moment
+// Perhaps disable in old versions of gcc if necessary
+#define OGRE_UNICODE_SUPPORT 1
+
+#endif
+
+//----------------------------------------------------------------------------
+// Android Settings
+#if OGRE_PLATFORM == OGRE_PLATFORM_ANDROID
+#   ifdef OGRE_UNICODE_SUPPORT
+#       undef OGRE_UNICODE_SUPPORT
+#   endif
+#	define OGRE_UNICODE_SUPPORT 1
+    // A quick define to overcome different names for the same function
+#   define stricmp strcasecmp
+#   ifdef DEBUG
+#       define OGRE_DEBUG_MODE 1
+#   else
+#       define OGRE_DEBUG_MODE 0
+#   endif
+#   ifndef CLOCKS_PER_SEC
+#	    define CLOCKS_PER_SEC  1000
+#   endif
+#endif
+    
+//----------------------------------------------------------------------------
+// FlashCC Settings
+#if OGRE_PLATFORM == OGRE_PLATFORM_FLASHCC
+#   ifdef OGRE_UNICODE_SUPPORT
+#       undef OGRE_UNICODE_SUPPORT
+#   endif
+#	define OGRE_UNICODE_SUPPORT 0
+#   ifdef DEBUG
+#       define OGRE_DEBUG_MODE 1
+#   else
+#       define OGRE_DEBUG_MODE 0
+#   endif
+#endif
+
+#ifndef __OGRE_HAVE_DIRECTXMATH
+#   define __OGRE_HAVE_DIRECTXMATH 0
+#endif
+
+//----------------------------------------------------------------------------
+// Endian Settings
+// check for BIG_ENDIAN config flag, set OGRE_ENDIAN correctly
+#ifdef OGRE_CONFIG_BIG_ENDIAN
+#    define OGRE_ENDIAN OGRE_ENDIAN_BIG
+#else
+#    define OGRE_ENDIAN OGRE_ENDIAN_LITTLE
+#endif
+
+//----------------------------------------------------------------------------
+// Set the default locale for strings
+#if OGRE_PLATFORM == OGRE_PLATFORM_ANDROID
+//	Locales are not supported by the C lib you have to go through JNI.
+#	define OGRE_DEFAULT_LOCALE ""
+#elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS
+#	define OGRE_DEFAULT_LOCALE "C"
+#else
+#	if OGRE_COMPILER == OGRE_COMPILER_MSVC
+#		if _MSC_VER >= 1700
+#			define OGRE_DEFAULT_LOCALE "en-GB"
+#		else
+// 			http://msdn.microsoft.com/en-us/library/39cwe7zf%28v=vs.90%29.aspx
+#			define OGRE_DEFAULT_LOCALE "uk"
+#		endif
+#	elif OGRE_COMPILER == OGRE_COMPILER_GCCE
+//		http://gcc.gnu.org/onlinedocs/libstdc++/manual/localization.html
+#   	define OGRE_DEFAULT_LOCALE "en_GB.UTF8"
+#	else
+#       if OGRE_NO_LIBCPP_SUPPORT == 0
+#           define OGRE_DEFAULT_LOCALE "en_GB.UTF-8"
+#       else
+#   	    define OGRE_DEFAULT_LOCALE "C"
+#       endif
+#	endif
+#endif
+
+//----------------------------------------------------------------------------
+// Library suffixes
+// "_d" for debug builds, nothing otherwise
+#if OGRE_DEBUG_MODE
+#   define OGRE_BUILD_SUFFIX "_d"
+#else
+#   define OGRE_BUILD_SUFFIX ""
+#endif
+
+// Integer formats of fixed bit width
+typedef unsigned int uint32;
+typedef unsigned short uint16;
+typedef unsigned char uint8;
+typedef int int32;
+typedef short int16;
+typedef signed char int8;
+// define uint64 type
+#if OGRE_COMPILER == OGRE_COMPILER_MSVC
+	typedef unsigned __int64 uint64;
+	typedef __int64 int64;
+#else
+	typedef unsigned long long uint64;
+	typedef long long int64;
+#endif
+
+// Disable these warnings (too much noise)
+#if OGRE_COMPILER == OGRE_COMPILER_MSVC
+#ifndef _CRT_SECURE_NO_WARNINGS
+#   define _CRT_SECURE_NO_WARNINGS
+#endif
+#ifndef _SCL_SECURE_NO_WARNINGS
+#   define _SCL_SECURE_NO_WARNINGS
+#endif
+// Turn off warnings generated by long std templates
+// This warns about truncation to 255 characters in debug/browse info
+#   pragma warning (disable : 4786)
+// Turn off warnings generated by long std templates
+// This warns about truncation to 255 characters in debug/browse info
+#   pragma warning (disable : 4503)
+// disable: "<type> needs to have dll-interface to be used by clients'
+// Happens on STL member variables which are not public therefore is ok
+#   pragma warning (disable : 4251)
+// disable: "non dll-interface class used as base for dll-interface class"
+// Happens when deriving from Singleton because bug in compiler ignores
+// template export
+#   pragma warning (disable : 4275)
+// disable: "C++ Exception Specification ignored"
+// This is because MSVC 6 did not implement all the C++ exception
+// specifications in the ANSI C++ draft.
+#   pragma warning( disable : 4290 )
+// disable: "no suitable definition provided for explicit template
+// instantiation request" Occurs in VC7 for no justifiable reason on all
+// #includes of Singleton
+#   pragma warning( disable: 4661)
+// disable: deprecation warnings when using CRT calls in VC8
+// These show up on all C runtime lib code in VC8, disable since they clutter
+// the warnings with things we may not be able to do anything about (e.g.
+// generated code from nvparse etc). I doubt very much that these calls
+// will ever be actually removed from VC anyway, it would break too much code.
+#   pragma warning( disable: 4996)
+// disable: "conditional expression constant", always occurs on 
+// OGRE_MUTEX_CONDITIONAL when no threading enabled
+#   pragma warning (disable : 201)
+// disable: "unreferenced formal parameter"
+// Many versions of VC have bugs which generate this error in cases where they shouldn't
+#   pragma warning (disable : 4100)
+// disable: "behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized"
+// We have this issue in OgreMemorySTLAlloc.h - so we see it over and over
+#   pragma warning (disable : 4345)
+#endif
+
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgrePlatformInformation.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgrePlatformInformation.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgrePlatformInformation.h	(revision 148)
@@ -0,0 +1,217 @@
+/*
+-----------------------------------------------------------------------------
+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 __PlatformInformation_H__
+#define __PlatformInformation_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+//
+// TODO: Puts following macros into OgrePlatform.h?
+//
+
+/* Initial CPU stuff to set.
+*/
+#define OGRE_CPU_UNKNOWN    0
+#define OGRE_CPU_X86        1
+#define OGRE_CPU_PPC        2
+#define OGRE_CPU_ARM        3
+#define OGRE_CPU_MIPS       4
+
+/* Find CPU type
+*/
+#if (defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))) || \
+    (defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)))
+#   define OGRE_CPU OGRE_CPU_X86
+
+#elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE && defined(__BIG_ENDIAN__)
+#   define OGRE_CPU OGRE_CPU_PPC
+#elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+#	define OGRE_CPU OGRE_CPU_X86
+#elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS && (defined(__i386__) || defined(__x86_64__))
+#	define OGRE_CPU OGRE_CPU_X86
+#elif defined(__arm__) || defined(_M_ARM) || defined(__arm64__) || defined(_aarch64_)
+#	define OGRE_CPU OGRE_CPU_ARM
+#elif defined(__mips64) || defined(__mips64_)
+#	define OGRE_CPU OGRE_CPU_MIPS
+#else
+#   define OGRE_CPU OGRE_CPU_UNKNOWN
+#endif
+
+/* Find how to declare aligned variable.
+*/
+#if OGRE_COMPILER == OGRE_COMPILER_MSVC
+#   define OGRE_ALIGNED_DECL(type, var, alignment)  __declspec(align(alignment)) type var
+
+#elif (OGRE_COMPILER == OGRE_COMPILER_GNUC) || (OGRE_COMPILER == OGRE_COMPILER_CLANG)
+#   define OGRE_ALIGNED_DECL(type, var, alignment)  type var __attribute__((__aligned__(alignment)))
+
+#else
+#   define OGRE_ALIGNED_DECL(type, var, alignment)  type var
+#endif
+
+/** Find perfect alignment (should supports SIMD alignment if SIMD available)
+*/
+#if OGRE_CPU == OGRE_CPU_X86
+#   define OGRE_SIMD_ALIGNMENT  16
+
+#else
+#   define OGRE_SIMD_ALIGNMENT  16
+#endif
+
+/* Declare variable aligned to SIMD alignment.
+*/
+#define OGRE_SIMD_ALIGNED_DECL(type, var)   OGRE_ALIGNED_DECL(type, var, OGRE_SIMD_ALIGNMENT)
+
+/* Define whether or not Ogre compiled with SSE supports.
+*/
+#if   OGRE_DOUBLE_PRECISION == 0 && OGRE_CPU == OGRE_CPU_X86 && OGRE_COMPILER == OGRE_COMPILER_MSVC && \
+    OGRE_PLATFORM != OGRE_PLATFORM_NACL
+#   define __OGRE_HAVE_SSE  1
+#elif OGRE_DOUBLE_PRECISION == 0 && OGRE_CPU == OGRE_CPU_X86 && (OGRE_COMPILER == OGRE_COMPILER_GNUC || OGRE_COMPILER == OGRE_COMPILER_CLANG) && \
+      OGRE_PLATFORM != OGRE_PLATFORM_APPLE_IOS && OGRE_PLATFORM != OGRE_PLATFORM_NACL
+#   define __OGRE_HAVE_SSE  1
+#endif
+
+/* Define whether or not Ogre compiled with VFP support.
+ */
+#if OGRE_DOUBLE_PRECISION == 0 && OGRE_CPU == OGRE_CPU_ARM && (OGRE_COMPILER == OGRE_COMPILER_GNUC || OGRE_COMPILER == OGRE_COMPILER_CLANG) && defined(__ARM_ARCH_6K__) && defined(__VFP_FP__)
+#   define __OGRE_HAVE_VFP  1
+#endif
+
+/* Define whether or not Ogre compiled with NEON support.
+ */
+#if OGRE_DOUBLE_PRECISION == 0 && OGRE_CPU == OGRE_CPU_ARM && (OGRE_COMPILER == OGRE_COMPILER_GNUC || OGRE_COMPILER == OGRE_COMPILER_CLANG) && defined(__ARM_ARCH_7A__) && defined(__ARM_NEON__)
+#   define __OGRE_HAVE_NEON  1
+#endif
+
+/* Define whether or not Ogre compiled with MSA support.
+ */
+#if OGRE_DOUBLE_PRECISION == 0 && OGRE_CPU == OGRE_CPU_MIPS && (OGRE_COMPILER == OGRE_COMPILER_GNUC || OGRE_COMPILER == OGRE_COMPILER_CLANG) && defined(__mips_msa)
+#   define __OGRE_HAVE_MSA  1
+#endif
+
+#ifndef __OGRE_HAVE_SSE
+#   define __OGRE_HAVE_SSE  0
+#endif
+
+#ifndef __OGRE_HAVE_VFP
+#   define __OGRE_HAVE_VFP  0
+#endif
+
+#ifndef __OGRE_HAVE_NEON
+#   define __OGRE_HAVE_NEON  0
+#endif
+
+#ifndef __OGRE_HAVE_MSA
+#   define __OGRE_HAVE_MSA  0
+#endif
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+
+
+    /** Class which provides the run-time platform information Ogre runs on.
+        @remarks
+            Ogre is designed to be platform-independent, but some platform
+            and run-time environment specific optimised functions are built-in
+            to maximise performance, and those special optimised routines are
+            need to determine run-time environment for select variant executing
+            path.
+        @par
+            This class manages that provides a couple of functions to determine
+            platform information of the run-time environment.
+        @note
+            This class is supposed to use by advanced user only.
+    */
+    class _OgreExport PlatformInformation
+    {
+    public:
+
+        /// Enum describing the different CPU features we want to check for, platform-dependent
+        enum CpuFeatures
+        {
+#if OGRE_CPU == OGRE_CPU_X86
+            CPU_FEATURE_SSE         = 1 << 0,
+            CPU_FEATURE_SSE2        = 1 << 1,
+            CPU_FEATURE_SSE3        = 1 << 2,
+            CPU_FEATURE_MMX         = 1 << 3,
+            CPU_FEATURE_MMXEXT      = 1 << 4,
+            CPU_FEATURE_3DNOW       = 1 << 5,
+            CPU_FEATURE_3DNOWEXT    = 1 << 6,
+            CPU_FEATURE_CMOV        = 1 << 7,
+            CPU_FEATURE_TSC         = 1 << 8,
+            CPU_FEATURE_FPU         = 1 << 9,
+            CPU_FEATURE_PRO         = 1 << 10,
+            CPU_FEATURE_HTT         = 1 << 11,
+#elif OGRE_CPU == OGRE_CPU_ARM
+            CPU_FEATURE_VFP         = 1 << 12,
+            CPU_FEATURE_NEON        = 1 << 13,
+#elif OGRE_CPU == OGRE_CPU_MIPS
+            CPU_FEATURE_MSA         = 1 << 14,
+#endif
+
+            CPU_FEATURE_NONE        = 0
+        };
+
+        /** Gets a string of the CPU identifier.
+        @note
+            Actual detecting are performs in the first time call to this function,
+            and then all future calls with return internal cached value.
+        */
+        static const String& getCpuIdentifier(void);
+
+        /** Gets a or-masked of enum CpuFeatures that are supported by the CPU.
+        @note
+            Actual detecting are performs in the first time call to this function,
+            and then all future calls with return internal cached value.
+        */
+        static uint getCpuFeatures(void);
+
+		/** Gets whether a specific feature is supported by the CPU.
+		@note
+			Actual detecting are performs in the first time call to this function,
+			and then all future calls with return internal cached value.
+		*/
+		static bool hasCpuFeature(CpuFeatures feature);
+
+
+		/** Write the CPU information to the passed in Log */
+		static void log(Log* pLog);
+
+    };
+	/** @} */
+	/** @} */
+
+}
+
+#endif  // __PlatformInformation_H__
Index: /ogre_src_v1-9-0/OgreMain/include/OgrePlugin.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgrePlugin.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgrePlugin.h	(revision 148)
@@ -0,0 +1,139 @@
+/*
+-----------------------------------------------------------------------------
+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 __OGREPLUGIN_H__
+#define __OGREPLUGIN_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+	/** Class defining a generic OGRE plugin.
+	@remarks
+		OGRE is very plugin-oriented and you can customise much of its behaviour
+		by registering new plugins, dynamically if you are using dynamic linking.
+		This class abstracts the generic interface that all plugins must support.
+		Within the implementations of this interface, the plugin must call other
+		OGRE classes in order to register the detailed customisations it is
+		providing, e.g. registering a new SceneManagerFactory, a new
+		MovableObjectFactory, or a new RenderSystem.
+	@par
+		Plugins can be linked statically or dynamically. If they are linked
+		dynamically (ie the plugin is in a DLL or Shared Object file), then you
+		load the plugin by calling the Root::loadPlugin method (or some other
+		mechanism which leads to that call, e.g. plugins.cfg), passing the name of
+		the DLL. OGRE will then call a global init function on that DLL, and it
+		will be expected to register one or more Plugin implementations using
+		Root::installPlugin. The procedure is very similar if you use a static
+		linked plugin, except that you simply instantiate the Plugin implementation
+		yourself and pass it to Root::installPlugin.
+	@note
+		Lifecycle of a Plugin instance is very important. The Plugin instance must
+		remain valid until the Plugin is uninstalled. Here are the things you
+		must bear in  mind:
+		<ul><li>If your plugin is in a DLL:
+		<ul><li>Create the Plugin instance and call Root::installPlugin in dllStartPlugin</li>
+		<li>Call Root::uninstallPlugin, then delete it in dllStopPlugin</li></ul>
+		<li>If your plugin is statically linked in your app:
+		<ul><li>Create the Plugin anytime you like</li>
+		<li>Call Root::installPlugin any time whilst Root is valid</li>
+		<li>Call Root::uninstallPlugin if you like so long as Root is valid. However,
+			it will be done for you when Root is destroyed, so the Plugin instance must
+			still be valid at that point if you haven't manually uninstalled it.</li></ul>
+		</ul>
+		The install and uninstall methods will be called when the plugin is
+		installed or uninstalled. The initialise and shutdown will be called when
+		there is a system initialisation or shutdown, e.g. when Root::initialise 
+		or Root::shutdown are called.
+	*/
+	class _OgreExport Plugin : public PluginAlloc
+	{
+	public:
+		Plugin() {}
+		virtual ~Plugin() {}
+
+		/** Get the name of the plugin. 
+		@remarks An implementation must be supplied for this method to uniquely
+			identify the plugin.
+		*/
+		virtual const String& getName() const = 0;
+
+		/** Perform the plugin initial installation sequence. 
+		@remarks An implementation must be supplied for this method. It must perform
+		the startup tasks necessary to install any rendersystem customisations 
+		or anything else that is not dependent on system initialisation, ie
+		only dependent on the core of Ogre. It must not perform any
+		operations that would create rendersystem-specific objects at this stage,
+		that should be done in initialise().
+		*/
+		virtual void install() = 0;
+
+		/** Perform any tasks the plugin needs to perform on full system
+			initialisation.
+		@remarks An implementation must be supplied for this method. It is called 
+			just after the system is fully initialised (either after Root::initialise
+			if a window is created then, or after the first window is created)
+			and therefore all rendersystem functionality is available at this
+			time. You can use this hook to create any resources which are 
+			dependent on a rendersystem or have rendersystem-specific implementations.
+		*/
+		virtual void initialise() = 0;
+
+		/** Perform any tasks the plugin needs to perform when the system is shut down.
+		@remarks An implementation must be supplied for this method.
+		This method is called just before key parts of the system are unloaded, 
+		such as rendersystems being shut down. You should use this hook to free up 
+		resources and decouple custom objects from the OGRE system, whilst all the
+		instances of other plugins (e.g. rendersystems) still exist.
+		*/
+		virtual void shutdown() = 0;
+
+		/** Perform the final plugin uninstallation sequence. 
+		@remarks An implementation must be supplied for this method. It must perform
+		the cleanup tasks which haven't already been performed in shutdown()
+		(e.g. final deletion of custom instances, if you kept them around incase
+		the system was reinitialised). At this stage you cannot be sure what other
+		plugins are still loaded or active. It must therefore not perform any
+		operations that would reference any rendersystem-specific objects - those
+		should have been sorted out in the 'shutdown' method.
+		*/
+		virtual void uninstall() = 0;
+	};
+	/** @} */
+	/** @} */
+
+}
+
+#endif
+
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgrePolygon.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgrePolygon.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgrePolygon.h	(revision 148)
@@ -0,0 +1,148 @@
+/*
+-----------------------------------------------------------------------------
+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
+Copyright (c) 2006 Matthias Fink, netAllied GmbH <matthias.fink@web.de>								
+
+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 __Polygon_H__
+#define __Polygon_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreVector3.h"
+#include "OgreHeaderPrefix.h"
+
+
+namespace Ogre
+{
+
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Math
+	*  @{
+	*/
+	/** The class represents a polygon in 3D space.
+	@remarks
+		It is made up of 3 or more vertices in a single plane, listed in 
+		counter-clockwise order.
+	*/
+	class _OgreExport Polygon
+	{
+
+	public:
+		typedef vector<Vector3>::type				VertexList;
+
+		typedef multimap<Vector3, Vector3>::type		EdgeMap;
+		typedef std::pair< Vector3, Vector3>		Edge;
+
+	protected:
+		VertexList		mVertexList;
+		mutable Vector3	mNormal;
+		mutable bool	mIsNormalSet;
+		/** Updates the normal.
+		*/
+		void updateNormal(void) const;
+
+
+	public:
+		Polygon();
+		~Polygon();
+		Polygon( const Polygon& cpy );
+
+		/** Inserts a vertex at a specific position.
+		@note Vertices must be coplanar.
+		*/
+		void insertVertex(const Vector3& vdata, size_t vertexIndex);
+		/** Inserts a vertex at the end of the polygon.
+		@note Vertices must be coplanar.
+		*/
+		void insertVertex(const Vector3& vdata);
+
+		/** Returns a vertex.
+		*/
+		const Vector3& getVertex(size_t vertex) const;
+
+		/** Sets a specific vertex of a polygon.
+		@note Vertices must be coplanar.
+		*/
+		void setVertex(const Vector3& vdata, size_t vertexIndex);
+
+		/** Removes duplicate vertices from a polygon.
+		*/
+		void removeDuplicates(void);
+
+		/** Vertex count.
+		*/
+		size_t getVertexCount(void) const;
+
+		/** Returns the polygon normal.
+		*/
+		const Vector3& getNormal(void) const;
+
+		/** Deletes a specific vertex.
+		*/
+		void deleteVertex(size_t vertex);
+
+		/** Determines if a point is inside the polygon.
+		@remarks
+			A point is inside a polygon if it is both on the polygon's plane, 
+			and within the polygon's bounds. Polygons are assumed to be convex
+			and planar.
+		*/
+		bool isPointInside(const Vector3& point) const;
+
+		/** Stores the edges of the polygon in ccw order.
+			The vertices are copied so the user has to take the 
+			deletion into account.
+		*/
+		void storeEdges(EdgeMap *edgeMap) const;
+
+		/** Resets the object.
+		*/
+		void reset(void);
+
+		/** Determines if the current object is equal to the compared one.
+		*/
+		bool operator == (const Polygon& rhs) const;
+
+		/** Determines if the current object is not equal to the compared one.
+		*/
+		bool operator != (const Polygon& rhs) const
+		{ return !( *this == rhs ); }
+
+		/** Prints out the polygon data.
+		*/
+		_OgreExport friend std::ostream& operator<< ( std::ostream& strm, const Polygon& poly );
+
+	};
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgrePose.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgrePose.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgrePose.h	(revision 148)
@@ -0,0 +1,144 @@
+/*
+-----------------------------------------------------------------------------
+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 __OGRE_POSE_H
+#define __OGRE_POSE_H
+
+#include "OgrePrerequisites.h"
+#include "OgreString.h"
+#include "OgreHardwareVertexBuffer.h"
+#include "OgreVector3.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Animation
+	*  @{
+	*/
+	/** A pose is a linked set of vertex offsets applying to one set of vertex
+		data. 
+	@remarks
+		The target index referred to by the pose has a meaning set by the user
+		of this class; but for example when used by Mesh it refers to either the
+		Mesh shared geometry (0) or a SubMesh dedicated geometry (1+).
+		Pose instances can be referred to by keyframes in VertexAnimationTrack in
+		order to animate based on blending poses together.
+	*/
+	class _OgreExport Pose : public AnimationAlloc
+	{
+	public:
+		/** Constructor
+			@param target The target vertexdata index (0 for shared, 1+ for 
+				dedicated at the submesh index + 1)
+			@param name Optional name
+		*/
+		Pose(ushort target, const String& name = StringUtil::BLANK);
+		virtual ~Pose();
+		/// Return the name of the pose (may be blank)
+		const String& getName(void) const { return mName; }
+		/// Return the target geometry index of the pose
+		ushort getTarget(void) const { return mTarget; }
+		/// A collection of vertex offsets based on the vertex index
+		typedef map<size_t, Vector3>::type VertexOffsetMap;
+		/// An iterator over the vertex offsets
+		typedef MapIterator<VertexOffsetMap> VertexOffsetIterator;
+		/// An iterator over the vertex offsets
+		typedef ConstMapIterator<VertexOffsetMap> ConstVertexOffsetIterator;
+		/// A collection of normals based on the vertex index
+		typedef map<size_t, Vector3>::type NormalsMap;
+		/// An iterator over the vertex offsets
+		typedef MapIterator<NormalsMap> NormalsIterator;
+		/// An iterator over the vertex offsets
+		typedef ConstMapIterator<NormalsMap> ConstNormalsIterator;
+		/// Return whether the pose vertices include normals
+		bool getIncludesNormals() const { return !mNormalsMap.empty(); }
+
+		/** Adds an offset to a vertex for this pose. 
+		@param index The vertex index
+		@param offset The position offset for this pose
+		*/
+		void addVertex(size_t index, const Vector3& offset);
+
+		/** Adds an offset to a vertex and a new normal for this pose. 
+		@param index The vertex index
+		@param offset The position offset for this pose
+		*/
+		void addVertex(size_t index, const Vector3& offset, const Vector3& normal);
+
+		/** Remove a vertex offset. */
+		void removeVertex(size_t index);
+
+		/** Clear all vertices. */
+		void clearVertices(void);
+
+		/** Gets an iterator over all the vertex offsets. */
+		ConstVertexOffsetIterator getVertexOffsetIterator(void) const;
+		/** Gets an iterator over all the vertex offsets. */
+		VertexOffsetIterator getVertexOffsetIterator(void);
+		/** Gets a const reference to the vertex offsets. */
+		const VertexOffsetMap& getVertexOffsets(void) const { return mVertexOffsetMap; }
+
+		/** Gets an iterator over all the vertex offsets. */
+		ConstNormalsIterator getNormalsIterator(void) const;
+		/** Gets an iterator over all the vertex offsets. */
+		NormalsIterator getNormalsIterator(void);
+		/** Gets a const reference to the vertex offsets. */
+		const NormalsMap& getNormals(void) const { return mNormalsMap; }
+
+		/** Get a hardware vertex buffer version of the vertex offsets. */
+		const HardwareVertexBufferSharedPtr& _getHardwareVertexBuffer(const VertexData* origData) const;
+
+		/** Clone this pose and create another one configured exactly the same
+			way (only really useful for cloning holders of this class).
+		*/
+		Pose* clone(void) const;
+	protected:
+		/// Target geometry index
+		ushort mTarget;
+		/// Optional name
+		String mName;
+		/// Primary storage, sparse vertex use
+		VertexOffsetMap mVertexOffsetMap;
+		/// Primary storage, sparse vertex use
+		NormalsMap mNormalsMap;
+		/// Derived hardware buffer, covers all vertices
+		mutable HardwareVertexBufferSharedPtr mBuffer;
+	};
+	typedef vector<Pose*>::type PoseList;
+
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgrePredefinedControllers.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgrePredefinedControllers.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgrePredefinedControllers.h	(revision 148)
@@ -0,0 +1,294 @@
+/*
+-----------------------------------------------------------------------------
+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 __PredefinedControllers_H__
+#define __PredefinedControllers_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreCommon.h"
+#include "OgreController.h"
+#include "OgreFrameListener.h"
+#include "OgreGpuProgram.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+	//-----------------------------------------------------------------------
+    // Controller Values
+    //-----------------------------------------------------------------------
+    /** Predefined controller value for getting the latest frame time.
+    */
+    class _OgreExport FrameTimeControllerValue : public ControllerValue<Real>, public FrameListener
+    {
+    protected:
+        Real mFrameTime;
+		Real mTimeFactor;
+		Real mElapsedTime;
+		Real mFrameDelay;
+
+    public:
+        FrameTimeControllerValue();
+        bool frameEnded(const FrameEvent &evt);
+        bool frameStarted(const FrameEvent &evt);
+        Real getValue(void) const;
+        void setValue(Real value);
+		Real getTimeFactor(void) const;
+		void setTimeFactor(Real tf);
+		Real getFrameDelay(void) const;
+		void setFrameDelay(Real fd);
+		Real getElapsedTime(void) const;
+		void setElapsedTime(Real elapsedTime);
+    };
+
+    //-----------------------------------------------------------------------
+    /** Predefined controller value for getting / setting the frame number of a texture layer
+    */
+    class _OgreExport TextureFrameControllerValue : public ControllerValue<Real>
+    {
+    protected:
+        TextureUnitState* mTextureLayer;
+    public:
+        TextureFrameControllerValue(TextureUnitState* t);
+
+        /** Gets the frame number as a parametric value in the range [0,1]
+        */
+        Real getValue(void) const;
+        /** Sets the frame number as a parametric value in the range [0,1]; the actual frame number is (value * numFrames) % numFrames).
+        */
+        void setValue(Real value);
+
+    };
+    //-----------------------------------------------------------------------
+    /** Predefined controller value for getting / setting a texture coordinate modifications (scales and translates).
+        @remarks
+            Effects can be applied to the scale or the offset of the u or v coordinates, or both. If separate
+            modifications are required to u and v then 2 instances are required to control both independently, or 4
+            if you want separate u and v scales as well as separate u and v offsets.
+        @par
+            Because of the nature of this value, it can accept values outside the 0..1 parametric range.
+    */
+    class _OgreExport TexCoordModifierControllerValue : public ControllerValue<Real>
+    {
+    protected:
+        bool mTransU, mTransV;
+        bool mScaleU, mScaleV;
+        bool mRotate;
+        TextureUnitState* mTextureLayer;
+    public:
+        /** Constructor.
+            @param
+                t TextureUnitState to apply the modification to.
+            @param
+                translateU If true, the u coordinates will be translated by the modification.
+            @param
+                translateV If true, the v coordinates will be translated by the modification.
+            @param
+                scaleU If true, the u coordinates will be scaled by the modification.
+            @param
+                scaleV If true, the v coordinates will be scaled by the modification.
+            @param
+                rotate If true, the texture will be rotated by the modification.
+        */
+        TexCoordModifierControllerValue(TextureUnitState* t, bool translateU = false, bool translateV = false,
+            bool scaleU = false, bool scaleV = false, bool rotate = false );
+
+        Real getValue(void) const;
+        void setValue(Real value);
+
+    };
+
+    //-----------------------------------------------------------------------
+    /** Predefined controller value for setting a single floating-
+	    point value in a constant parameter of a vertex or fragment program.
+    @remarks
+		Any value is accepted, it is propagated into the 'x'
+		component of the constant register identified by the index. If you
+		need to use named parameters, retrieve the index from the param
+		object before setting this controller up.
+	@note
+		Retrieving a value from the program parameters is not currently 
+		supported, therefore do not use this controller value as a source,
+		only as a target.
+    */
+    class _OgreExport FloatGpuParameterControllerValue : public ControllerValue<Real>
+    {
+    protected:
+		/// The parameters to access
+		GpuProgramParametersSharedPtr mParams;
+		/// The index of the parameter to be read or set
+		size_t mParamIndex;
+    public:
+        /** Constructor.
+		    @param
+				params The parameters object to access
+            @param
+                index The index of the parameter to be set
+        */
+        FloatGpuParameterControllerValue(GpuProgramParametersSharedPtr params,
+				size_t index );
+
+        ~FloatGpuParameterControllerValue() {}
+
+        Real getValue(void) const;
+        void setValue(Real value);
+
+    };
+    //-----------------------------------------------------------------------
+    // Controller functions
+    //-----------------------------------------------------------------------
+
+	/** Predefined controller function which just passes through the original source
+	directly to dest.
+	*/
+	class _OgreExport PassthroughControllerFunction : public ControllerFunction<Real>
+	{
+	public:
+		/** Constructor.
+         @param
+             deltaInput If true, signifies that the input will be a delta value such that the function should
+             add it to an internal counter before calculating the output.
+		*/
+		PassthroughControllerFunction(bool deltaInput = false);
+
+		/** Overridden function.
+		*/
+		Real calculate(Real source);
+	};
+
+	/** Predefined controller function for dealing with animation.
+    */
+    class _OgreExport AnimationControllerFunction : public ControllerFunction<Real>
+    {
+    protected:
+        Real mSeqTime;
+        Real mTime;
+    public:
+        /** Constructor.
+            @param
+                sequenceTime The amount of time in seconds it takes to loop through the whole animation sequence.
+            @param
+                timeOffset The offset in seconds at which to start (default is start at 0)
+        */
+        AnimationControllerFunction(Real sequenceTime, Real timeOffset = 0.0f);
+
+        /** Overridden function.
+        */
+        Real calculate(Real source);
+
+		/** Set the time value manually. */
+		void setTime(Real timeVal);
+		/** Set the sequence duration value manually. */
+		void setSequenceTime(Real seqVal);
+    };
+
+	//-----------------------------------------------------------------------
+    /** Predefined controller function which simply scales an input to an output value.
+    */
+    class _OgreExport ScaleControllerFunction : public ControllerFunction<Real>
+    {
+    protected:
+        Real mScale;
+    public:
+        /** Constructor, requires a scale factor.
+            @param
+                scalefactor The multiplier applied to the input to produce the output.
+            @param
+                deltaInput If true, signifies that the input will be a delta value such that the function should
+                 add it to an internal counter before calculating the output.
+        */
+        ScaleControllerFunction(Real scalefactor, bool deltaInput);
+
+        /** Overridden method.
+        */
+        Real calculate(Real source);
+
+    };
+
+    //-----------------------------------------------------------------------
+    /** Predefined controller function based on a waveform.
+        @remarks
+            A waveform function translates parametric input to parametric output based on a wave. The factors
+            affecting the function are:
+            - wave type - the shape of the wave
+            - base - the base value of the output from the wave
+            - frequency - the speed of the wave in cycles per second
+            - phase - the offset of the start of the wave, e.g. 0.5 to start half-way through the wave
+            - amplitude - scales the output so that instead of lying within [0,1] it lies within [0,1] * amplitude
+			- duty cycle - the active width of a PWM signal
+        @par
+            Note that for simplicity of integration with the rest of the controller insfrastructure, the output of
+            the wave is parametric i.e. 0..1, rather than the typical wave output of [-1,1]. To compensate for this, the
+            traditional output of the wave is scaled by the following function before output:
+        @par
+            output = (waveoutput + 1) * 0.5
+        @par
+            Hence a wave output of -1 becomes 0, a wave output of 1 becomes 1, and a wave output of 0 becomes 0.5.
+    */
+    class _OgreExport WaveformControllerFunction : public ControllerFunction<Real>
+    {
+    protected:
+        WaveformType mWaveType;
+        Real mBase;
+        Real mFrequency;
+        Real mPhase;
+        Real mAmplitude;
+		Real mDutyCycle;
+
+        /** Overridden from ControllerFunction. */
+        Real getAdjustedInput(Real input);
+
+    public:
+        /** Default constructor, requires at least a wave type, other parameters can be defaulted unless required.
+            @param
+                deltaInput If true, signifies that the input will be a delta value such that the function should
+                add it to an internal counter before calculating the output.
+			@param
+				dutyCycle Used in PWM mode to specify the pulse width.
+        */
+        WaveformControllerFunction(WaveformType wType, Real base = 0, Real frequency = 1, Real phase = 0, Real amplitude = 1, bool deltaInput = true, Real dutyCycle = 0.5);
+
+        /** Overridden function.
+        */
+        Real calculate(Real source);
+
+    };
+    //-----------------------------------------------------------------------
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgrePrefabFactory.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgrePrefabFactory.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgrePrefabFactory.h	(revision 148)
@@ -0,0 +1,73 @@
+/*
+-----------------------------------------------------------------------------
+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 __PrefabFactory_H__
+#define __PrefabFactory_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Resources
+	*  @{
+	*/
+	/** A factory class that can create various mesh prefabs. 
+	@remarks
+		This class is used by OgreMeshManager to offload the loading of various prefab types 
+		to a central location.
+	*/
+	class _OgreExport PrefabFactory
+	{
+	public:
+		/** If the given mesh has a known prefab resource name (e.g "Prefab_Plane") 
+		    then this prefab will be created as a submesh of the given mesh.
+
+			@param mesh The mesh that the potential prefab will be created in.
+			@return true if a prefab has been created, otherwise false.
+		*/
+		static bool createPrefab(Mesh* mesh);
+
+	private:
+		/// Creates a plane as a submesh of the given mesh
+		static void createPlane(Mesh* mesh);
+
+		/// Creates a 100x100x100 cube as a submesh of the given mesh
+		static void createCube(Mesh* mesh);
+
+		/// Creates a sphere with a diameter of 100 units as a submesh of the given mesh
+		static void createSphere(Mesh* mesh);
+	};
+	/** @} */
+	/** @} */
+
+} // namespace Ogre
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgrePrerequisites.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgrePrerequisites.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgrePrerequisites.h	(revision 148)
@@ -0,0 +1,564 @@
+/*-------------------------------------------------------------------------
+This source file is a 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 __OgrePrerequisites_H__
+#define __OgrePrerequisites_H__
+
+// Platform-specific stuff
+#include "OgrePlatform.h"
+
+#include <string>
+
+// configure memory tracking
+#if OGRE_DEBUG_MODE 
+#	if OGRE_MEMORY_TRACKER_DEBUG_MODE
+#        define OGRE_MEMORY_TRACKER 1
+#	else
+#        define OGRE_MEMORY_TRACKER 0
+#	endif
+#else
+#	if OGRE_MEMORY_TRACKER_RELEASE_MODE
+#        define OGRE_MEMORY_TRACKER 1
+#	else
+#        define OGRE_MEMORY_TRACKER 0
+#	endif
+#endif
+
+namespace Ogre {
+    // Define ogre version
+    #define OGRE_VERSION_MAJOR 1
+    #define OGRE_VERSION_MINOR 9
+    #define OGRE_VERSION_PATCH 0
+	#define OGRE_VERSION_SUFFIX ""
+    #define OGRE_VERSION_NAME "Ghadamon"
+
+    #define OGRE_VERSION    ((OGRE_VERSION_MAJOR << 16) | (OGRE_VERSION_MINOR << 8) | OGRE_VERSION_PATCH)
+
+    // define the real number values to be used
+    // default to use 'float' unless precompiler option set
+    #if OGRE_DOUBLE_PRECISION == 1
+        /** Software floating point type.
+        @note Not valid as a pointer to GPU buffers / parameters
+        */
+        typedef double Real;
+    #else
+        /** Software floating point type.
+        @note Not valid as a pointer to GPU buffers / parameters
+        */
+        typedef float Real;
+    #endif
+
+    #if OGRE_COMPILER == OGRE_COMPILER_GNUC && OGRE_COMP_VER >= 310 && !defined(STLPORT)
+	#   if OGRE_COMP_VER >= 430
+	#       define HashMap ::std::tr1::unordered_map
+	#       define HashSet ::std::tr1::unordered_set
+	#    else
+	#       define HashMap ::__gnu_cxx::hash_map
+	#       define HashSet ::__gnu_cxx::hash_set
+	#    endif
+    #elif OGRE_COMPILER == OGRE_COMPILER_CLANG
+    #    if defined(_LIBCPP_VERSION)
+    #       define HashMap ::std::unordered_map
+    #       define HashSet ::std::unordered_set
+    #    else
+    #       define HashMap ::std::tr1::unordered_map
+    #       define HashSet ::std::tr1::unordered_set
+    #    endif
+    #else
+    #   if OGRE_COMPILER == OGRE_COMPILER_MSVC && !defined(_STLP_MSVC)
+    #       if _MSC_FULL_VER >= 150030729 // VC++ 9.0 SP1+
+    #           define HashMap ::std::tr1::unordered_map
+    #           define HashSet ::std::tr1::unordered_set
+    #       elif OGRE_THREAD_PROVIDER == 1
+    #           define HashMap ::boost::unordered_map
+    #           define HashSet ::boost::unordered_set
+    #       else
+    #           define HashMap ::std::unordered_map
+    #           define HashSet ::std::unordered_set
+    #       endif
+    #   else
+    #       define HashMap ::std::unordered_map
+	#       define HashSet ::std::unordered_set
+    #   endif
+    #endif
+
+    #define OGRE_DEFINE_STATIC_LOCAL(type, name, arguments) \
+        static type& name = *new type arguments
+
+    /** In order to avoid finger-aches :)
+    */
+    typedef unsigned char uchar;
+    typedef unsigned short ushort;
+    typedef unsigned int uint;
+	typedef unsigned long ulong;
+
+// Pre-declare classes
+// Allows use of pointers in header files without including individual .h
+// so decreases dependencies between files
+    class Angle;
+    class Animation;
+    class AnimationState;
+    class AnimationStateSet;
+    class AnimationTrack;
+    class Archive;
+    class ArchiveFactory;
+    class ArchiveManager;
+    class AutoParamDataSource;
+    class AxisAlignedBox;
+    class AxisAlignedBoxSceneQuery;
+    class Billboard;
+    class BillboardChain;
+    class BillboardSet;
+    class Bone;
+    class Camera;
+    class Codec;
+    class ColourValue;
+    class ConfigDialog;
+    template <typename T> class Controller;
+    template <typename T> class ControllerFunction;
+    class ControllerManager;
+    template <typename T> class ControllerValue;
+	class DefaultWorkQueue;
+    class Degree;
+	class DepthBuffer;
+    class DynLib;
+    class DynLibManager;
+    class EdgeData;
+    class EdgeListBuilder;
+    class Entity;
+    class ErrorDialog;
+    class ExternalTextureSourceManager;
+    class Factory;
+    struct FrameEvent;
+    class FrameListener;
+    class Frustum;
+    class GpuProgram;
+    class GpuProgramManager;
+	class GpuProgramUsage;
+    class HardwareIndexBuffer;
+    class HardwareOcclusionQuery;
+    class HardwareVertexBuffer;
+	class HardwarePixelBuffer;
+    class HardwarePixelBufferSharedPtr;
+	class HighLevelGpuProgram;
+	class HighLevelGpuProgramManager;
+	class HighLevelGpuProgramFactory;
+    class IndexData;
+	class InstanceBatch;
+	class InstanceBatchHW;
+	class InstanceBatchHW_VTF;
+	class InstanceBatchShader;
+	class InstanceBatchVTF;
+	class InstanceManager;
+	class InstancedEntity;
+    class IntersectionSceneQuery;
+    class IntersectionSceneQueryListener;
+    class Image;
+    class KeyFrame;
+    class Light;
+    class Log;
+    class LogManager;
+	class LodStrategy;
+	class ManualResourceLoader;
+	class ManualObject;
+    class Material;
+    class MaterialManager;
+    class Math;
+    class Matrix3;
+    class Matrix4;
+    class MemoryManager;
+    class Mesh;
+    class MeshSerializer;
+    class MeshSerializerImpl;
+    class MeshManager;
+    class MovableObject;
+    class MovablePlane;
+    class Node;
+	class NodeAnimationTrack;
+	class NodeKeyFrame;
+	class NumericAnimationTrack;
+	class NumericKeyFrame;
+    class Particle;
+    class ParticleAffector;
+    class ParticleAffectorFactory;
+    class ParticleEmitter;
+    class ParticleEmitterFactory;
+    class ParticleSystem;
+    class ParticleSystemManager;
+    class ParticleSystemRenderer;
+    class ParticleSystemRendererFactory;
+    class ParticleVisualData;
+    class Pass;
+    class PatchMesh;
+    class PixelBox;
+    class Plane;
+    class PlaneBoundedVolume;
+    class Plugin;
+    class PMWorker;
+    class PMInjector;
+    class Pose;
+    class ProgressiveMeshGenerator;
+    class Profile;
+	class Profiler;
+    class Quaternion;
+	class Radian;
+    class Ray;
+    class RaySceneQuery;
+    class RaySceneQueryListener;
+    class Renderable;
+    class RenderPriorityGroup;
+    class RenderQueue;
+    class RenderQueueGroup;
+	class RenderQueueInvocation;
+	class RenderQueueInvocationSequence;
+    class RenderQueueListener;
+	class RenderObjectListener;
+    class RenderSystem;
+    class RenderSystemCapabilities;
+    class RenderSystemCapabilitiesManager;
+    class RenderSystemCapabilitiesSerializer;
+    class RenderTarget;
+    class RenderTargetListener;
+    class RenderTexture;
+	class MultiRenderTarget;
+    class RenderWindow;
+    class RenderOperation;
+    class Resource;
+	class ResourceBackgroundQueue;
+	class ResourceGroupManager;
+    class ResourceManager;
+    class RibbonTrail;
+	class Root;
+    class SceneManager;
+    class SceneManagerEnumerator;
+    class SceneNode;
+    class SceneQuery;
+    class SceneQueryListener;
+	class ScriptCompiler;
+	class ScriptCompilerManager;
+	class ScriptLoader;
+    class Serializer;
+    class ShadowCaster;
+    class ShadowRenderable;
+	class ShadowTextureManager;
+    class SimpleRenderable;
+    class SimpleSpline;
+    class Skeleton;
+    class SkeletonInstance;
+    class SkeletonManager;
+    class Sphere;
+    class SphereSceneQuery;
+	class StaticGeometry;
+	class StreamSerialiser;
+    class StringConverter;
+    class StringInterface;
+    class SubEntity;
+    class SubMesh;
+	class TagPoint;
+    class Technique;
+	class TempBlendedBufferInfo;
+	class ExternalTextureSource;
+    class TextureUnitState;
+    class Texture;
+    class TextureManager;
+    class TransformKeyFrame;
+	class Timer;
+	class UserObjectBindings;
+    class Vector2;
+    class Vector3;
+    class Vector4;
+    class Viewport;
+	class VertexAnimationTrack;
+    class VertexBufferBinding;
+    class VertexData;
+    class VertexDeclaration;
+	class VertexMorphKeyFrame;
+    class WireBoundingBox;
+	class WorkQueue;
+    class Compositor;
+    class CompositorManager;
+    class CompositorChain;
+    class CompositorInstance;
+	class CompositorLogic;
+    class CompositionTechnique;
+    class CompositionPass;
+    class CompositionTargetPass;
+	class CustomCompositionPass;
+
+    template<typename T> class SharedPtr;
+    typedef SharedPtr<Compositor> CompositorPtr;
+    typedef SharedPtr<GpuProgram> GpuProgramPtr;
+    typedef SharedPtr<HighLevelGpuProgram> HighLevelGpuProgramPtr;
+    typedef SharedPtr<Material> MaterialPtr;
+    typedef SharedPtr<Mesh> MeshPtr;
+    typedef SharedPtr<PatchMesh> PatchMeshPtr;
+    typedef SharedPtr<Resource> ResourcePtr;
+    typedef SharedPtr<Skeleton> SkeletonPtr;
+    typedef SharedPtr<Texture> TexturePtr;
+}
+
+/* Include all the standard header *after* all the configuration
+settings have been made.
+*/
+#include "OgreStdHeaders.h"
+#include "OgreMemoryAllocatorConfig.h"
+
+
+namespace Ogre
+{
+#if OGRE_STRING_USE_CUSTOM_MEMORY_ALLOCATOR
+    typedef std::basic_string<char, std::char_traits<char>, STLAllocator<char,GeneralAllocPolicy > >        _StringBase;
+    typedef std::basic_stringstream<char,std::char_traits<char>,STLAllocator<char,GeneralAllocPolicy > >    _StringStreamBase;
+
+	#define StdStringT(T) std::basic_string<T, std::char_traits<T>, std::allocator<T> >	
+	#define CustomMemoryStringT(T) std::basic_string<T, std::char_traits<T>, STLAllocator<T,GeneralAllocPolicy> >	
+
+	template<typename T>
+	bool operator <(const CustomMemoryStringT(T)& l,const StdStringT(T)& o)
+	{
+        return l.compare(0,l.length(),o.c_str(),o.length())<0;
+	}
+	template<typename T>
+	bool operator <(const StdStringT(T)& l,const CustomMemoryStringT(T)& o)
+	{
+        return l.compare(0,l.length(),o.c_str(),o.length())<0;
+	}
+	template<typename T>
+	bool operator <=(const CustomMemoryStringT(T)& l,const StdStringT(T)& o)
+	{
+        return l.compare(0,l.length(),o.c_str(),o.length())<=0;
+	}
+	template<typename T>
+	bool operator <=(const StdStringT(T)& l,const CustomMemoryStringT(T)& o)
+	{
+        return l.compare(0,l.length(),o.c_str(),o.length())<=0;
+	}
+	template<typename T>
+	bool operator >(const CustomMemoryStringT(T)& l,const StdStringT(T)& o)
+	{
+        return l.compare(0,l.length(),o.c_str(),o.length())>0;
+	}
+	template<typename T>
+	bool operator >(const StdStringT(T)& l,const CustomMemoryStringT(T)& o)
+	{
+        return l.compare(0,l.length(),o.c_str(),o.length())>0;
+	}
+	template<typename T>
+	bool operator >=(const CustomMemoryStringT(T)& l,const StdStringT(T)& o)
+	{
+        return l.compare(0,l.length(),o.c_str(),o.length())>=0;
+	}
+	template<typename T>
+	bool operator >=(const StdStringT(T)& l,const CustomMemoryStringT(T)& o)
+	{
+        return l.compare(0,l.length(),o.c_str(),o.length())>=0;
+	}
+
+	template<typename T>
+	bool operator ==(const CustomMemoryStringT(T)& l,const StdStringT(T)& o)
+	{
+        return l.compare(0,l.length(),o.c_str(),o.length())==0;
+	}
+	template<typename T>
+	bool operator ==(const StdStringT(T)& l,const CustomMemoryStringT(T)& o)
+	{
+        return l.compare(0,l.length(),o.c_str(),o.length())==0;
+	}
+
+	template<typename T>
+	bool operator !=(const CustomMemoryStringT(T)& l,const StdStringT(T)& o)
+	{
+        return l.compare(0,l.length(),o.c_str(),o.length())!=0;
+	}
+	template<typename T>
+	bool operator !=(const StdStringT(T)& l,const CustomMemoryStringT(T)& o)
+	{
+        return l.compare(0,l.length(),o.c_str(),o.length())!=0;
+	}
+
+	template<typename T>
+	CustomMemoryStringT(T) operator +=(const CustomMemoryStringT(T)& l,const StdStringT(T)& o)
+	{
+        return CustomMemoryStringT(T)(l)+=o.c_str();
+	}
+	template<typename T>
+	CustomMemoryStringT(T) operator +=(const StdStringT(T)& l,const CustomMemoryStringT(T)& o)
+	{
+        return CustomMemoryStringT(T)(l.c_str())+=o.c_str();
+	}
+
+	template<typename T>
+	CustomMemoryStringT(T) operator +(const CustomMemoryStringT(T)& l,const StdStringT(T)& o)
+	{
+        return CustomMemoryStringT(T)(l)+=o.c_str();
+	}
+
+	template<typename T>
+	CustomMemoryStringT(T) operator +(const StdStringT(T)& l,const CustomMemoryStringT(T)& o)
+	{
+        return CustomMemoryStringT(T)(l.c_str())+=o.c_str();
+	}
+
+	template<typename T>
+	CustomMemoryStringT(T) operator +(const T* l,const CustomMemoryStringT(T)& o)
+	{
+        return CustomMemoryStringT(T)(l)+=o;
+	}
+
+	#undef StdStringT
+	#undef CustomMemoryStringT
+
+#else
+    typedef std::string _StringBase;
+    typedef std::basic_stringstream<char,std::char_traits<char>,std::allocator<char> > _StringStreamBase;
+
+#endif
+
+	typedef _StringBase String;
+	typedef _StringStreamBase StringStream;
+	typedef StringStream stringstream;
+
+}
+
+#if OGRE_STRING_USE_CUSTOM_MEMORY_ALLOCATOR 
+namespace std 
+{
+#if (OGRE_COMPILER == OGRE_COMPILER_GNUC && OGRE_COMP_VER >= 430) || OGRE_COMPILER == OGRE_COMPILER_CLANG && !defined(STLPORT) && __cplusplus < 201103L
+	namespace tr1
+	{
+#endif
+    template <> struct hash<Ogre::String>
+	{
+    public :
+        size_t operator()(const Ogre::String &str ) const
+        {
+        	size_t _Val = 2166136261U;
+        	size_t _First = 0;
+        	size_t _Last = str.size();
+        	size_t _Stride = 1 + _Last / 10;
+
+        	for(; _First < _Last; _First += _Stride)
+                _Val = 16777619U * _Val ^ (size_t)str[_First];
+        	return (_Val);
+        }
+    };
+#if (OGRE_COMPILER == OGRE_COMPILER_GNUC && OGRE_COMP_VER >= 430) || OGRE_COMPILER == OGRE_COMPILER_CLANG && !defined(STLPORT) && __cplusplus < 201103L
+	}
+#endif
+}
+#endif
+
+//for stl container
+namespace Ogre
+{ 
+	template <typename T, typename A = STLAllocator<T, GeneralAllocPolicy> > 
+	struct deque 
+	{ 
+#if OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR
+        typedef typename std::deque<T, A> type;    
+        typedef typename std::deque<T, A>::iterator iterator;
+        typedef typename std::deque<T, A>::const_iterator const_iterator;
+#else
+        typedef typename std::deque<T> type;
+        typedef typename std::deque<T>::iterator iterator;
+        typedef typename std::deque<T>::const_iterator const_iterator;
+#endif
+	}; 
+
+	template <typename T, typename A = STLAllocator<T, GeneralAllocPolicy> > 
+	struct vector 
+	{ 
+#if OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR
+        typedef typename std::vector<T, A> type;
+        typedef typename std::vector<T, A>::iterator iterator;
+        typedef typename std::vector<T, A>::const_iterator const_iterator;
+#else
+        typedef typename std::vector<T> type;
+        typedef typename std::vector<T>::iterator iterator;
+        typedef typename std::vector<T>::const_iterator const_iterator;
+#endif
+	}; 
+
+	template <typename T, typename A = STLAllocator<T, GeneralAllocPolicy> > 
+	struct list 
+	{ 
+#if OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR
+        typedef typename std::list<T, A> type;
+        typedef typename std::list<T, A>::iterator iterator;
+        typedef typename std::list<T, A>::const_iterator const_iterator;
+#else
+        typedef typename std::list<T> type;
+        typedef typename std::list<T>::iterator iterator;
+        typedef typename std::list<T>::const_iterator const_iterator;
+#endif
+	}; 
+
+	template <typename T, typename P = std::less<T>, typename A = STLAllocator<T, GeneralAllocPolicy> > 
+	struct set 
+	{ 
+#if OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR
+        typedef typename std::set<T, P, A> type;
+        typedef typename std::set<T, P, A>::iterator iterator;
+        typedef typename std::set<T, P, A>::const_iterator const_iterator;
+#else
+        typedef typename std::set<T, P> type;
+        typedef typename std::set<T, P>::iterator iterator;
+        typedef typename std::set<T, P>::const_iterator const_iterator;
+#endif
+	}; 
+
+	template <typename K, typename V, typename P = std::less<K>, typename A = STLAllocator<std::pair<const K, V>, GeneralAllocPolicy> > 
+	struct map 
+	{ 
+#if OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR
+        typedef typename std::map<K, V, P, A> type;
+        typedef typename std::map<K, V, P, A>::iterator iterator;
+        typedef typename std::map<K, V, P, A>::const_iterator const_iterator;
+#else
+        typedef typename std::map<K, V, P> type;
+        typedef typename std::map<K, V, P>::iterator iterator;
+        typedef typename std::map<K, V, P>::const_iterator const_iterator;
+#endif
+	}; 
+
+	template <typename K, typename V, typename P = std::less<K>, typename A = STLAllocator<std::pair<const K, V>, GeneralAllocPolicy> > 
+	struct multimap 
+	{ 
+#if OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR
+        typedef typename std::multimap<K, V, P, A> type;
+        typedef typename std::multimap<K, V, P, A>::iterator iterator;
+        typedef typename std::multimap<K, V, P, A>::const_iterator const_iterator;
+#else
+        typedef typename std::multimap<K, V, P> type;
+        typedef typename std::multimap<K, V, P>::iterator iterator;
+        typedef typename std::multimap<K, V, P>::const_iterator const_iterator;
+#endif
+	}; 
+
+} // Ogre
+
+#endif // __OgrePrerequisites_H__
+
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreProfiler.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreProfiler.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreProfiler.h	(revision 148)
@@ -0,0 +1,525 @@
+/*
+-----------------------------------------------------------------------------
+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.
+-----------------------------------------------------------------------------
+*/
+/*
+
+    Although the code is original, many of the ideas for the profiler were borrowed from 
+"Real-Time In-Game Profiling" by Steve Rabin which can be found in Game Programming
+Gems 1.
+
+    This code can easily be adapted to your own non-Ogre project. The only code that is 
+Ogre-dependent is in the visualization/logging routines and the use of the Timer class.
+
+    Enjoy!
+
+*/
+
+#ifndef __Profiler_H__
+#define __Profiler_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreSingleton.h"
+#include "OgreString.h"
+#include "OgreHeaderPrefix.h"
+
+#if OGRE_PROFILING == 1
+#	define OgreProfile( a ) Ogre::Profile _OgreProfileInstance( (a) )
+#	define OgreProfileBegin( a ) Ogre::Profiler::getSingleton().beginProfile( (a) )
+#	define OgreProfileEnd( a ) Ogre::Profiler::getSingleton().endProfile( (a) )
+#	define OgreProfileGroup( a, g ) Ogre::Profile _OgreProfileInstance( (a), (g) )
+#	define OgreProfileBeginGroup( a, g ) Ogre::Profiler::getSingleton().beginProfile( (a), (g) )
+#	define OgreProfileEndGroup( a, g ) Ogre::Profiler::getSingleton().endProfile( (a), (g) )
+#	define OgreProfileBeginGPUEvent( g ) Ogre::Profiler::getSingleton().beginGPUEvent(g)
+#	define OgreProfileEndGPUEvent( g ) Ogre::Profiler::getSingleton().endGPUEvent(g)
+#	define OgreProfileMarkGPUEvent( e ) Ogre::Profiler::getSingleton().markGPUEvent(e)
+#else
+#   define OgreProfile( a )
+#   define OgreProfileBegin( a )
+#   define OgreProfileEnd( a )
+#	define OgreProfileGroup( a, g ) 
+#	define OgreProfileBeginGroup( a, g ) 
+#	define OgreProfileEndGroup( a, g ) 
+#	define OgreProfileBeginGPUEvent( e )
+#	define OgreProfileEndGPUEvent( e )
+#	define OgreProfileMarkGPUEvent( e )
+#endif
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+	/** List of reserved profiling masks
+	*/
+	enum ProfileGroupMask
+	{
+		/// User default profile
+		OGREPROF_USER_DEFAULT = 0x00000001,
+		/// All in-built Ogre profiling will match this mask
+		OGREPROF_ALL = 0xFF000000,
+		/// General processing
+		OGREPROF_GENERAL = 0x80000000,
+		/// Culling
+		OGREPROF_CULLING = 0x40000000,
+		/// Rendering
+		OGREPROF_RENDERING = 0x20000000
+	};
+
+    /** An individual profile that will be processed by the Profiler
+        @remarks
+            Use the macro OgreProfile(name) instead of instantiating this profile directly
+        @remarks
+            We use this Profile to allow scoping rules to signify the beginning and end of
+            the profile. Use the Profiler singleton (through the macro OgreProfileBegin(name)
+            and OgreProfileEnd(name)) directly if you want a profile to last
+            outside of a scope (i.e. the main game loop).
+        @author Amit Mathew (amitmathew (at) yahoo (dot) com)
+    */
+	class _OgreExport Profile : 
+		public ProfilerAlloc 
+	{
+
+        public:
+            Profile(const String& profileName, uint32 groupID = (uint32)OGREPROF_USER_DEFAULT);
+            ~Profile();
+
+        protected:
+
+            /// The name of this profile
+            String mName;
+			/// The group ID
+			uint32 mGroupID;
+			
+    };
+
+	/** Represents the total timing information of a profile
+		since profiles can be called more than once each frame
+	*/
+    struct ProfileFrame 
+	{
+
+        /// The total time this profile has taken this frame
+        ulong	frameTime;
+
+        /// The number of times this profile was called this frame
+        uint	calls;
+
+        /// The hierarchical level of this profile, 0 being the main loop
+        uint	hierarchicalLvl;
+
+    };
+
+	/// Represents a history of each profile during the duration of the app
+    struct ProfileHistory 
+	{
+        /// The current percentage of frame time this profile has taken
+        Real	currentTimePercent; 
+		/// The current frame time this profile has taken in milliseconds
+		Real	currentTimeMillisecs;
+
+        /// The maximum percentage of frame time this profile has taken
+        Real	maxTimePercent; 
+		/// The maximum frame time this profile has taken in milliseconds
+		Real	maxTimeMillisecs; 
+
+        /// The minimum percentage of frame time this profile has taken
+        Real	minTimePercent; 
+		/// The minimum frame time this profile has taken in milliseconds
+		Real	minTimeMillisecs; 
+
+        /// The number of times this profile has been called each frame
+        uint	numCallsThisFrame;
+
+        /// The total percentage of frame time this profile has taken
+        Real	totalTimePercent;
+		/// The total frame time this profile has taken in milliseconds
+		Real	totalTimeMillisecs;
+
+        /// The total number of times this profile was called
+        /// (used to calculate average)
+        ulong	totalCalls; 
+
+        /// The hierarchical level of this profile, 0 being the root profile
+        uint	hierarchicalLvl;
+
+	};
+
+	/// Represents an individual profile call
+	class ProfileInstance : public ProfilerAlloc
+	{
+		friend class Profiler;
+	public:
+		ProfileInstance(void);
+		virtual ~ProfileInstance(void);
+
+		typedef Ogre::map<String,ProfileInstance*>::type ProfileChildren;
+
+		void logResults();
+		void reset();
+
+		inline bool watchForMax(void) { return history.currentTimePercent == history.maxTimePercent; }
+		inline bool watchForMin(void) { return history.currentTimePercent == history.minTimePercent; }
+		inline bool watchForLimit(Real limit, bool greaterThan = true)
+		{
+			if (greaterThan)
+				return history.currentTimePercent > limit;
+			else
+				return history.currentTimePercent < limit;
+		}
+
+		bool watchForMax(const String& profileName);
+		bool watchForMin(const String& profileName);
+		bool watchForLimit(const String& profileName, Real limit, bool greaterThan = true);
+                                
+		/// The name of the profile
+		String          name;
+
+		/// The name of the parent, null if root
+		ProfileInstance* parent;
+
+		ProfileChildren children;
+
+		ProfileFrame frame;
+		ulong frameNumber;
+
+		ProfileHistory history;
+
+		/// The time this profile was started
+		ulong           currTime;
+
+		/// Represents the total time of all child profiles to subtract
+		/// from this profile
+		ulong           accum;
+
+		/// The hierarchical level of this profile, 0 being the root profile
+		uint            hierarchicalLvl;
+	};
+
+	/** ProfileSessionListener should be used to visualize profile results.
+		Concrete impl. could be done using Overlay's but its not limited to 
+		them you can also create a custom listener which sends the profile
+		informtaion over a network.
+    */
+	class _OgreExport ProfileSessionListener
+	{
+	public:
+		enum DisplayMode
+		{
+			/// Display % frame usage on the overlay
+			DISPLAY_PERCENTAGE,
+			/// Display milliseconds on the overlay
+			DISPLAY_MILLISECONDS
+		};
+
+		ProfileSessionListener() : mDisplayMode(DISPLAY_MILLISECONDS) {}
+		virtual ~ProfileSessionListener() {}
+
+		/// Create the internal resources
+		virtual void initializeSession() = 0;
+
+		/// All internal resources should be deleted here
+		virtual void finializeSession() = 0;
+
+		/** If the profiler disables this listener then it
+			should hide its panels (if any exists) or stop
+			sending data over the network
+		*/
+		virtual void changeEnableState(bool enabled) {}; 
+		
+		/// Here we get the real profiling information which we can use 
+		virtual void displayResults(const ProfileInstance& instance, ulong maxTotalFrameTime) {};
+
+		/// Set the display mode for the overlay. 
+		void setDisplayMode(DisplayMode d) { mDisplayMode = d; }
+	
+		/// Get the display mode for the overlay. 
+		DisplayMode getDisplayMode() const { return mDisplayMode; }
+	
+	protected:
+		/// How to display the overlay
+		DisplayMode mDisplayMode;
+	};
+
+    /** The profiler allows you to measure the performance of your code
+        @remarks
+            Do not create profiles directly from this unless you want a profile to last
+            outside of its scope (i.e. the main game loop). For most cases, use the macro
+            OgreProfile(name) and braces to limit the scope. You must enable the Profile
+            before you can used it with setEnabled(true). If you want to disable profiling
+            in Ogre, simply set the macro OGRE_PROFILING to 0.
+        @author Amit Mathew (amitmathew (at) yahoo (dot) com)
+        @todo resolve artificial cap on number of profiles displayed
+        @todo fix display ordering of profiles not called every frame
+    */
+    class _OgreExport Profiler : 
+		public Singleton<Profiler>,
+		public ProfilerAlloc
+	{
+        public:
+            Profiler();
+            ~Profiler();
+
+            /** Sets the timer for the profiler */
+            void setTimer(Timer* t);
+
+            /** Retrieves the timer for the profiler */
+            Timer* getTimer();
+
+            /** Begins a profile
+            @remarks 
+                Use the macro OgreProfileBegin(name) instead of calling this directly 
+                so that profiling can be ignored in the release version of your app. 
+            @remarks 
+                You only use the macro (or this) if you want a profile to last outside
+                of its scope (i.e. the main game loop). If you use this function, make sure you 
+                use a corresponding OgreProfileEnd(name). Usually you would use the macro 
+                OgreProfile(name). This function will be ignored for a profile that has been 
+                disabled or if the profiler is disabled.
+            @param profileName Must be unique and must not be an empty string
+			@param groupID A profile group identifier, which can allow you to mask profiles
+            */
+            void beginProfile(const String& profileName, uint32 groupID = (uint32)OGREPROF_USER_DEFAULT);
+
+            /** Ends a profile
+            @remarks 
+                Use the macro OgreProfileEnd(name) instead of calling this directly so that
+                profiling can be ignored in the release version of your app.
+            @remarks
+                This function is usually not called directly unless you want a profile to
+                last outside of its scope. In most cases, using the macro OgreProfile(name) 
+                which will call this function automatically when it goes out of scope. Make 
+                sure the name of this profile matches its corresponding beginProfile name. 
+                This function will be ignored for a profile that has been disabled or if the
+                profiler is disabled.
+			@param profileName Must be unique and must not be an empty string
+			@param groupID A profile group identifier, which can allow you to mask profiles
+            */
+            void endProfile(const String& profileName, uint32 groupID = (uint32)OGREPROF_USER_DEFAULT);
+
+            /** Mark the beginning of a GPU event group
+             @remarks Can be safely called in the middle of the profile.
+             */
+            void beginGPUEvent(const String& event);
+
+            /** Mark the end of a GPU event group
+             @remarks Can be safely called in the middle of the profile.
+             */
+            void endGPUEvent(const String& event);
+
+            /** Mark a specific, ungrouped, GPU event
+             @remarks Can be safely called in the middle of the profile.
+             */
+            void markGPUEvent(const String& event);
+
+            /** Sets whether this profiler is enabled. Only takes effect after the
+                the frame has ended.
+                @remarks When this is called the first time with the parameter true,
+                it initializes the GUI for the Profiler
+            */
+            void setEnabled(bool enabled);
+
+            /** Gets whether this profiler is enabled */
+            bool getEnabled() const;
+
+            /** Enables a previously disabled profile 
+            @remarks Can be safely called in the middle of the profile.
+            */
+            void enableProfile(const String& profileName);
+
+            /** Disables a profile
+            @remarks Can be safely called in the middle of the profile.
+            */
+            void disableProfile(const String& profileName);
+
+			/** Set the mask which all profiles must pass to be enabled. 
+			*/
+			void setProfileGroupMask(uint32 mask) { mProfileMask = mask; }
+			/** Get the mask which all profiles must pass to be enabled. 
+			*/
+			uint32 getProfileGroupMask() const { return mProfileMask; }
+
+            /** Returns true if the specified profile reaches a new frame time maximum
+            @remarks If this is called during a frame, it will be reading the results
+            from the previous frame. Therefore, it is best to use this after the frame
+            has ended.
+            */
+            bool watchForMax(const String& profileName);
+
+            /** Returns true if the specified profile reaches a new frame time minimum
+            @remarks If this is called during a frame, it will be reading the results
+            from the previous frame. Therefore, it is best to use this after the frame
+            has ended.
+            */
+            bool watchForMin(const String& profileName);
+
+            /** Returns true if the specified profile goes over or under the given limit
+                frame time
+            @remarks If this is called during a frame, it will be reading the results
+            from the previous frame. Therefore, it is best to use this after the frame
+            has ended.
+            @param limit A number between 0 and 1 representing the percentage of frame time
+            @param greaterThan If true, this will return whether the limit is exceeded. Otherwise,
+            it will return if the frame time has gone under this limit.
+            */
+            bool watchForLimit(const String& profileName, Real limit, bool greaterThan = true);
+
+            /** Outputs current profile statistics to the log */
+            void logResults();
+
+            /** Clears the profiler statistics */
+            void reset();
+
+            /** Sets the Profiler so the display of results are updated every n frames*/
+            void setUpdateDisplayFrequency(uint freq);
+
+            /** Gets the frequency that the Profiler display is updated */
+            uint getUpdateDisplayFrequency() const;
+
+			/**
+			@remarks
+				Register a ProfileSessionListener from the Profiler
+			@param listener
+				A valid listener derived class
+			*/
+			void addListener(ProfileSessionListener* listener);
+
+			/**
+			@remarks
+				Unregister a ProfileSessionListener from the Profiler
+			@param listener
+				A valid listener derived class
+			*/
+			void removeListener(ProfileSessionListener* listener);
+
+            /** Override standard Singleton retrieval.
+            @remarks
+            Why do we do this? Well, it's because the Singleton
+            implementation is in a .h file, which means it gets compiled
+            into anybody who includes it. This is needed for the
+            Singleton template to work, but we actually only want it
+            compiled into the implementation of the class based on the
+            Singleton, not all of them. If we don't change this, we get
+            link errors when trying to use the Singleton-based class from
+            an outside dll.
+            @par
+            This method just delegates to the template version anyway,
+            but the implementation stays in this single compilation unit,
+            preventing link errors.
+            */
+            static Profiler& getSingleton(void);
+            /** Override standard Singleton retrieval.
+            @remarks
+            Why do we do this? Well, it's because the Singleton
+            implementation is in a .h file, which means it gets compiled
+            into anybody who includes it. This is needed for the
+            Singleton template to work, but we actually only want it
+            compiled into the implementation of the class based on the
+            Singleton, not all of them. If we don't change this, we get
+            link errors when trying to use the Singleton-based class from
+            an outside dll.
+            @par
+            This method just delegates to the template version anyway,
+            but the implementation stays in this single compilation unit,
+            preventing link errors.
+            */
+            static Profiler* getSingletonPtr(void);
+
+        protected:
+			friend class ProfileInstance;
+
+			typedef vector<ProfileSessionListener*>::type TProfileSessionListener;
+			TProfileSessionListener mListeners;
+
+            /** Initializes the profiler's GUI elements */
+            void initialize();
+
+			void displayResults();
+
+			/** Processes frame stats for all of the mRoot's children */
+			void processFrameStats(void);
+            /** Processes specific ProfileInstance and it's children recursively.*/
+            void processFrameStats(ProfileInstance* instance, Real& maxFrameTime);
+
+            /** Handles a change of the profiler's enabled state*/
+            void changeEnableState();
+
+			// lol. Uses typedef; put's original container type in name.
+            typedef set<String>::type DisabledProfileMap;
+			typedef ProfileInstance::ProfileChildren ProfileChildren;
+
+			ProfileInstance* mCurrent;
+			ProfileInstance* mLast;
+			ProfileInstance mRoot;
+
+            /// Holds the names of disabled profiles
+            DisabledProfileMap mDisabledProfiles;
+
+            /// Whether the GUI elements have been initialized
+            bool mInitialized;
+
+            /// The number of frames that must elapse before the current
+            /// frame display is updated
+            uint mUpdateDisplayFrequency;
+
+            /// The number of elapsed frame, used with mUpdateDisplayFrequency
+            uint mCurrentFrame;
+
+            /// The timer used for profiling
+            Timer* mTimer;
+
+            /// The total time each frame takes
+            ulong mTotalFrameTime;
+
+            /// Whether this profiler is enabled
+            bool mEnabled;
+
+            /// Keeps track of the new enabled/disabled state that the user has requested
+            /// which will be applied after the frame ends
+            bool mNewEnableState;
+
+			/// Mask to decide whether a type of profile is enabled or not
+			uint32 mProfileMask;
+
+			/// The max frame time recorded
+			ulong mMaxTotalFrameTime;
+
+			/// Rolling average of millisecs
+			Real mAverageFrameTime;
+			bool mResetExtents;
+
+
+    }; // end class
+	/** @} */
+	/** @} */
+
+} // end namespace
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreProgressiveMeshGenerator.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreProgressiveMeshGenerator.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreProgressiveMeshGenerator.h	(revision 148)
@@ -0,0 +1,255 @@
+/*
+ * -----------------------------------------------------------------------------
+ * 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 __ProgressiveMeshGenerator_H_
+#define __ProgressiveMeshGenerator_H_
+
+#include "OgrePrerequisites.h"
+#include "OgreVector3.h"
+#include "OgreSmallVector.h"
+#include "OgreMesh.h"
+#include "OgreLodConfig.h"
+
+namespace Ogre
+{
+
+class _OgreExport ProgressiveMeshGeneratorBase
+{
+public:
+	/**
+	 * @brief Generates the LOD levels for a mesh.
+	 * 
+	 * @param lodConfig Specification of the requested LOD levels.
+	 */
+	virtual void generateLodLevels(LodConfig& lodConfig) = 0;
+
+	/**
+	 * @brief Generates the LOD levels for a mesh without configuring it.
+	 *
+	 * @param mesh Generate the LOD for this mesh.
+	 */
+	virtual void generateAutoconfiguredLodLevels(MeshPtr& mesh);
+
+	/**
+	 * @brief Fills LOD Config with a config, which works on any mesh.
+	 *
+	 * @param inMesh Optimize for this mesh.
+	 * @param outLodConfig LOD configuration storing the output.
+	 */
+	virtual void getAutoconfig(MeshPtr& inMesh, LodConfig& outLodConfig);
+
+	virtual ~ProgressiveMeshGeneratorBase() { }
+};
+
+/**
+ * @brief Improved version of ProgressiveMesh.
+ */
+class _OgreExport ProgressiveMeshGenerator :
+	public ProgressiveMeshGeneratorBase
+{
+public:
+
+	ProgressiveMeshGenerator();
+	virtual ~ProgressiveMeshGenerator();
+
+	/// @copydoc ProgressiveMeshGeneratorBase::generateLodLevels
+	void generateLodLevels(LodConfig& lodConfig);
+
+protected:
+
+	// VectorSet is basically a helper to use a vector as a small set container.
+	// Also these functions keep the code clean and fast.
+	// You can insert in O(1) time, if you know that it doesn't exists.
+	// You can remove in O(1) time, if you know the position of the item.
+	template<typename T, unsigned S>
+	struct _OgrePrivate VectorSet :
+		public SmallVector<T, S> {
+		typedef typename SmallVector<T, S>::iterator iterator;
+
+		void addNotExists(const T& item); // Complexity: O(1)!!
+		void remove(iterator it); // Complexity: O(1)!!
+		iterator add(const T& item); // Complexity: O(N)
+		void removeExists(const T& item); // Complexity: O(N)
+		bool remove(const T& item); // Complexity: O(N)
+		void replaceExists(const T& oldItem, const T& newItem); // Complexity: O(N)
+		bool has(const T& item); // Complexity: O(N)
+		iterator find(const T& item); // Complexity: O(N)
+		iterator findExists(const T& item); // Complexity: O(N)
+	};
+
+	struct PMEdge;
+	struct PMVertex;
+	struct PMTriangle;
+	struct PMVertexHash;
+	struct PMVertexEqual;
+	struct PMCollapseCostLess;
+	struct PMCollapsedEdge;
+	struct PMIndexBufferInfo;
+
+	typedef vector<PMVertex>::type VertexList;
+	typedef vector<PMTriangle>::type TriangleList;
+	typedef HashSet<PMVertex*, PMVertexHash, PMVertexEqual> UniqueVertexSet;
+	typedef multimap<Real, PMVertex*>::type CollapseCostHeap;
+	typedef vector<PMVertex*>::type VertexLookupList;
+
+	typedef VectorSet<PMEdge, 8> VEdges;
+	typedef VectorSet<PMTriangle*, 7> VTriangles;
+
+	typedef vector<PMCollapsedEdge>::type CollapsedEdges;
+	typedef vector<PMIndexBufferInfo>::type IndexBufferInfoList;
+
+	// Hash function for UniqueVertexSet.
+	struct _OgrePrivate PMVertexHash {
+		ProgressiveMeshGenerator* mGen;
+
+		PMVertexHash() { assert(0); }
+		PMVertexHash(ProgressiveMeshGenerator* gen) { mGen = gen; }
+		size_t operator() (const PMVertex* v) const;
+	};
+
+	// Equality function for UniqueVertexSet.
+	struct _OgrePrivate PMVertexEqual {
+		bool operator() (const PMVertex* lhs, const PMVertex* rhs) const;
+	};
+
+	// Directed edge
+	struct _OgrePrivate PMEdge {
+		PMVertex* dst;
+		Real collapseCost;
+		int refCount;
+
+		explicit PMEdge(PMVertex* destination);
+		bool operator== (const PMEdge& other) const;
+		PMEdge& operator= (const PMEdge& b);
+		PMEdge(const PMEdge& b);
+		bool operator< (const PMEdge& other) const;
+	};
+
+	struct _OgrePrivate PMVertex {
+		Vector3 position;
+		VEdges edges;
+		VTriangles triangles; /// Triangle ID set, which are using this vertex.
+
+		PMVertex* collapseTo;
+		bool seam;
+		CollapseCostHeap::iterator costHeapPosition; /// Iterator pointing to the position in the mCollapseCostSet, which allows fast remove.
+	};
+
+	struct _OgrePrivate PMTriangle {
+		PMVertex* vertex[3];
+		Vector3 normal;
+		bool isRemoved;
+		unsigned short submeshID; /// ID of the submesh. Usable with mMesh.getSubMesh() function.
+		unsigned int vertexID[3]; /// Vertex ID in the buffer associated with the submeshID.
+
+		void computeNormal();
+		bool hasVertex(const PMVertex* v) const;
+		unsigned int getVertexID(const PMVertex* v) const;
+		bool isMalformed();
+	};
+
+	struct _OgrePrivate PMIndexBufferInfo {
+		size_t indexSize;
+		size_t indexCount;
+	};
+
+	union _OgrePrivate IndexBufferPointer {
+		unsigned short* pshort;
+		unsigned int* pint;
+	};
+
+	struct _OgrePrivate PMCollapsedEdge {
+		unsigned int srcID;
+		unsigned int dstID;
+		unsigned short submeshID;
+	};
+
+	VertexLookupList mSharedVertexLookup;
+	VertexLookupList mVertexLookup;
+	VertexList mVertexList;
+	TriangleList mTriangleList;
+	UniqueVertexSet mUniqueVertexSet;
+	CollapseCostHeap mCollapseCostHeap;
+	CollapsedEdges tmpCollapsedEdges; // Tmp container used in collapse().
+	IndexBufferInfoList mIndexBufferInfoList;
+
+	MeshPtr mMesh;
+
+#ifndef NDEBUG
+	/**
+	 * @brief The name of the mesh being processed.
+	 *
+	 * This is separate from mMesh in order to allow for access from background threads.
+	 */
+	String mMeshName;
+#endif
+	Real mMeshBoundingSphereRadius;
+	Real mCollapseCostLimit;
+
+	size_t calcLodVertexCount(const LodLevel& lodConfig);
+	void tuneContainerSize();
+	void addVertexData(VertexData* vertexData, bool useSharedVertexLookup);
+	template<typename IndexType>
+	void addIndexDataImpl(IndexType* iPos, const IndexType* iEnd, VertexLookupList& lookup, unsigned short submeshID);
+	void addIndexData(IndexData* indexData, bool useSharedVertexLookup, unsigned short submeshID);
+
+	void computeCosts();
+	bool isBorderVertex(const PMVertex* vertex) const;
+	PMEdge* getPointer(VEdges::iterator it);
+	void computeVertexCollapseCost(PMVertex* vertex);
+	Real computeEdgeCollapseCost(PMVertex* src, PMEdge* dstEdge);
+	virtual void bakeLods();
+	void collapse(PMVertex* vertex);
+	void initialize();
+	void computeLods(LodConfig& lodConfigs);
+	void updateVertexCollapseCost(PMVertex* src);
+
+	bool hasSrcID(unsigned int srcID, unsigned short submeshID);
+	size_t findDstID(unsigned int srcID, unsigned short submeshID);
+	void replaceVertexID(PMTriangle* triangle, unsigned int oldID, unsigned int newID, PMVertex* dst);
+
+#ifndef NDEBUG
+	void assertValidVertex(PMVertex* v);
+	void assertValidMesh();
+	void assertOutdatedCollapseCost(PMVertex* vertex);
+#endif // ifndef NDEBUG
+
+	void addTriangleToEdges(PMTriangle* triangle);
+	void removeTriangleFromEdges(PMTriangle* triangle, PMVertex* skip = NULL);
+	void addEdge(PMVertex* v, const PMEdge& edge);
+	void removeEdge(PMVertex* v, const PMEdge& edge);
+	void printTriangle(PMTriangle* triangle, stringstream& str);
+	PMTriangle* findSideTriangle(const PMVertex* v1, const PMVertex* v2);
+	bool isDuplicateTriangle(PMTriangle* triangle, PMTriangle* triangle2);
+	PMTriangle* isDuplicateTriangle(PMTriangle* triangle);
+	int getTriangleID(PMTriangle* triangle);
+	void cleanupMemory();
+};
+
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreQuaternion.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreQuaternion.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreQuaternion.h	(revision 148)
@@ -0,0 +1,330 @@
+/*
+-----------------------------------------------------------------------------
+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.
+-----------------------------------------------------------------------------
+*/
+// This file is based on material originally from:
+// Geometric Tools, LLC
+// Copyright (c) 1998-2010
+// Distributed under the Boost Software License, Version 1.0.
+// http://www.boost.org/LICENSE_1_0.txt
+// http://www.geometrictools.com/License/Boost/LICENSE_1_0.txt
+
+
+#ifndef __Quaternion_H__
+#define __Quaternion_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreMath.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Math
+	*  @{
+	*/
+	/** Implementation of a Quaternion, i.e. a rotation around an axis.
+		For more information about Quaternions and the theory behind it, we recommend reading:
+		http://www.ogre3d.org/tikiwiki/Quaternion+and+Rotation+Primer
+		http://www.cprogramming.com/tutorial/3d/quaternions.html
+		http://www.gamedev.net/page/resources/_/reference/programming/math-and-physics/
+		quaternions/quaternion-powers-r1095
+    */
+    class _OgreExport Quaternion
+    {
+    public:
+		/// Default constructor, initializes to identity rotation (aka 0°)
+		inline Quaternion ()
+			: w(1), x(0), y(0), z(0)
+		{
+		}
+		/// Construct from an explicit list of values
+		inline Quaternion (
+			Real fW,
+			Real fX, Real fY, Real fZ)
+			: w(fW), x(fX), y(fY), z(fZ)
+		{
+		}
+        /// Construct a quaternion from a rotation matrix
+        inline Quaternion(const Matrix3& rot)
+        {
+            this->FromRotationMatrix(rot);
+        }
+        /// Construct a quaternion from an angle/axis
+        inline Quaternion(const Radian& rfAngle, const Vector3& rkAxis)
+        {
+            this->FromAngleAxis(rfAngle, rkAxis);
+        }
+        /// Construct a quaternion from 3 orthonormal local axes
+        inline Quaternion(const Vector3& xaxis, const Vector3& yaxis, const Vector3& zaxis)
+        {
+            this->FromAxes(xaxis, yaxis, zaxis);
+        }
+        /// Construct a quaternion from 3 orthonormal local axes
+        inline Quaternion(const Vector3* akAxis)
+        {
+            this->FromAxes(akAxis);
+        }
+		/// Construct a quaternion from 4 manual w/x/y/z values
+		inline Quaternion(Real* valptr)
+		{
+			memcpy(&w, valptr, sizeof(Real)*4);
+		}
+
+		/** Exchange the contents of this quaternion with another. 
+		*/
+		inline void swap(Quaternion& other)
+		{
+			std::swap(w, other.w);
+			std::swap(x, other.x);
+			std::swap(y, other.y);
+			std::swap(z, other.z);
+		}
+
+		/// Array accessor operator
+		inline Real operator [] ( const size_t i ) const
+		{
+			assert( i < 4 );
+
+			return *(&w+i);
+		}
+
+		/// Array accessor operator
+		inline Real& operator [] ( const size_t i )
+		{
+			assert( i < 4 );
+
+			return *(&w+i);
+		}
+
+		/// Pointer accessor for direct copying
+		inline Real* ptr()
+		{
+			return &w;
+		}
+
+		/// Pointer accessor for direct copying
+		inline const Real* ptr() const
+		{
+			return &w;
+		}
+
+		void FromRotationMatrix (const Matrix3& kRot);
+        void ToRotationMatrix (Matrix3& kRot) const;
+		/** Setups the quaternion using the supplied vector, and "roll" around
+			that vector by the specified radians.
+		*/
+        void FromAngleAxis (const Radian& rfAngle, const Vector3& rkAxis);
+        void ToAngleAxis (Radian& rfAngle, Vector3& rkAxis) const;
+        inline void ToAngleAxis (Degree& dAngle, Vector3& rkAxis) const {
+            Radian rAngle;
+            ToAngleAxis ( rAngle, rkAxis );
+            dAngle = rAngle;
+        }
+		/** Constructs the quaternion using 3 axes, the axes are assumed to be orthonormal
+			@see FromAxes
+		*/
+        void FromAxes (const Vector3* akAxis);
+        void FromAxes (const Vector3& xAxis, const Vector3& yAxis, const Vector3& zAxis);
+		/** Gets the 3 orthonormal axes defining the quaternion. @see FromAxes */
+        void ToAxes (Vector3* akAxis) const;
+        void ToAxes (Vector3& xAxis, Vector3& yAxis, Vector3& zAxis) const;
+
+		/** Returns the X orthonormal axis defining the quaternion. Same as doing
+			xAxis = Vector3::UNIT_X * this. Also called the local X-axis
+		*/
+        Vector3 xAxis(void) const;
+
+        /** Returns the Y orthonormal axis defining the quaternion. Same as doing
+			yAxis = Vector3::UNIT_Y * this. Also called the local Y-axis
+		*/
+        Vector3 yAxis(void) const;
+
+		/** Returns the Z orthonormal axis defining the quaternion. Same as doing
+			zAxis = Vector3::UNIT_Z * this. Also called the local Z-axis
+		*/
+        Vector3 zAxis(void) const;
+
+        inline Quaternion& operator= (const Quaternion& rkQ)
+		{
+			w = rkQ.w;
+			x = rkQ.x;
+			y = rkQ.y;
+			z = rkQ.z;
+			return *this;
+		}
+        Quaternion operator+ (const Quaternion& rkQ) const;
+        Quaternion operator- (const Quaternion& rkQ) const;
+        Quaternion operator* (const Quaternion& rkQ) const;
+        Quaternion operator* (Real fScalar) const;
+        _OgreExport friend Quaternion operator* (Real fScalar,
+            const Quaternion& rkQ);
+        Quaternion operator- () const;
+        inline bool operator== (const Quaternion& rhs) const
+		{
+			return (rhs.x == x) && (rhs.y == y) &&
+				(rhs.z == z) && (rhs.w == w);
+		}
+        inline bool operator!= (const Quaternion& rhs) const
+		{
+			return !operator==(rhs);
+		}
+        // functions of a quaternion
+        /// Returns the dot product of the quaternion
+        Real Dot (const Quaternion& rkQ) const;
+        /* Returns the normal length of this quaternion.
+            @note This does <b>not</b> alter any values.
+        */
+        Real Norm () const;
+        /// Normalises this quaternion, and returns the previous length
+        Real normalise(void); 
+        Quaternion Inverse () const;  /// Apply to non-zero quaternion
+        Quaternion UnitInverse () const;  /// Apply to unit-length quaternion
+        Quaternion Exp () const;
+        Quaternion Log () const;
+
+        /// Rotation of a vector by a quaternion
+        Vector3 operator* (const Vector3& rkVector) const;
+
+   		/** Calculate the local roll element of this quaternion.
+		@param reprojectAxis By default the method returns the 'intuitive' result
+			that is, if you projected the local Y of the quaternion onto the X and
+			Y axes, the angle between them is returned. If set to false though, the
+			result is the actual yaw that will be used to implement the quaternion,
+			which is the shortest possible path to get to the same orientation and 
+             may involve less axial rotation.  The co-domain of the returned value is 
+             from -180 to 180 degrees.
+		*/
+		Radian getRoll(bool reprojectAxis = true) const;
+   		/** Calculate the local pitch element of this quaternion
+		@param reprojectAxis By default the method returns the 'intuitive' result
+			that is, if you projected the local Z of the quaternion onto the X and
+			Y axes, the angle between them is returned. If set to true though, the
+			result is the actual yaw that will be used to implement the quaternion,
+			which is the shortest possible path to get to the same orientation and 
+            may involve less axial rotation.  The co-domain of the returned value is 
+            from -180 to 180 degrees.
+		*/
+		Radian getPitch(bool reprojectAxis = true) const;
+   		/** Calculate the local yaw element of this quaternion
+		@param reprojectAxis By default the method returns the 'intuitive' result
+			that is, if you projected the local Y of the quaternion onto the X and
+			Z axes, the angle between them is returned. If set to true though, the
+			result is the actual yaw that will be used to implement the quaternion,
+			which is the shortest possible path to get to the same orientation and 
+			may involve less axial rotation. The co-domain of the returned value is 
+            from -180 to 180 degrees.
+		*/
+		Radian getYaw(bool reprojectAxis = true) const;		
+		/// Equality with tolerance (tolerance is max angle difference)
+		bool equals(const Quaternion& rhs, const Radian& tolerance) const;
+		
+	    /** Performs Spherical linear interpolation between two quaternions, and returns the result.
+			Slerp ( 0.0f, A, B ) = A
+			Slerp ( 1.0f, A, B ) = B
+			@return Interpolated quaternion
+			@remarks
+			Slerp has the proprieties of performing the interpolation at constant
+			velocity, and being torque-minimal (unless shortestPath=false).
+			However, it's NOT commutative, which means
+			Slerp ( 0.75f, A, B ) != Slerp ( 0.25f, B, A );
+			therefore be careful if your code relies in the order of the operands.
+			This is specially important in IK animation.
+		*/
+        static Quaternion Slerp (Real fT, const Quaternion& rkP,
+            const Quaternion& rkQ, bool shortestPath = false);
+
+		/** @see Slerp. It adds extra "spins" (i.e. rotates several times) specified
+			by parameter 'iExtraSpins' while interpolating before arriving to the
+			final values
+		*/
+        static Quaternion SlerpExtraSpins (Real fT,
+            const Quaternion& rkP, const Quaternion& rkQ,
+            int iExtraSpins);
+
+        /// Setup for spherical quadratic interpolation
+        static void Intermediate (const Quaternion& rkQ0,
+            const Quaternion& rkQ1, const Quaternion& rkQ2,
+            Quaternion& rka, Quaternion& rkB);
+
+        /// Spherical quadratic interpolation
+        static Quaternion Squad (Real fT, const Quaternion& rkP,
+            const Quaternion& rkA, const Quaternion& rkB,
+            const Quaternion& rkQ, bool shortestPath = false);
+
+        /** Performs Normalised linear interpolation between two quaternions, and returns the result.
+			nlerp ( 0.0f, A, B ) = A
+			nlerp ( 1.0f, A, B ) = B
+			@remarks
+			Nlerp is faster than Slerp.
+			Nlerp has the proprieties of being commutative (@see Slerp;
+			commutativity is desired in certain places, like IK animation), and
+			being torque-minimal (unless shortestPath=false). However, it's performing
+			the interpolation at non-constant velocity; sometimes this is desired,
+			sometimes it is not. Having a non-constant velocity can produce a more
+			natural rotation feeling without the need of tweaking the weights; however
+			if your scene relies on the timing of the rotation or assumes it will point
+			at a specific angle at a specific weight value, Slerp is a better choice.
+		*/
+        static Quaternion nlerp(Real fT, const Quaternion& rkP, 
+            const Quaternion& rkQ, bool shortestPath = false);
+
+        /// Cutoff for sine near zero
+        static const Real msEpsilon;
+
+        // special values
+        static const Quaternion ZERO;
+        static const Quaternion IDENTITY;
+
+		Real w, x, y, z;
+
+		/// Check whether this quaternion contains valid values
+		inline bool isNaN() const
+		{
+			return Math::isNaN(x) || Math::isNaN(y) || Math::isNaN(z) || Math::isNaN(w);
+		}
+
+        /** Function for writing to a stream. Outputs "Quaternion(w, x, y, z)" with w,x,y,z
+            being the member values of the quaternion.
+        */
+        inline _OgreExport friend std::ostream& operator <<
+            ( std::ostream& o, const Quaternion& q )
+        {
+            o << "Quaternion(" << q.w << ", " << q.x << ", " << q.y << ", " << q.z << ")";
+            return o;
+        }
+
+    };
+	/** @} */
+	/** @} */
+
+}
+
+
+
+
+#endif 
Index: /ogre_src_v1-9-0/OgreMain/include/OgreQueuedProgressiveMeshGenerator.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreQueuedProgressiveMeshGenerator.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreQueuedProgressiveMeshGenerator.h	(revision 148)
@@ -0,0 +1,217 @@
+/*
+ * -----------------------------------------------------------------------------
+ * 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 __QueuedProgressiveMeshGenerator_H_
+#define __QueuedProgressiveMeshGenerator_H_
+
+#include "OgreProgressiveMeshGenerator.h"
+#include "OgreSingleton.h"
+#include "OgreWorkQueue.h"
+#include "OgreFrameListener.h"
+
+namespace Ogre
+{
+
+/**
+ * @brief Request data structure.
+ */
+struct PMGenRequest {
+	struct VertexBuffer {
+		size_t vertexCount;
+		Vector3* vertexBuffer;
+		VertexBuffer() :
+			vertexBuffer(0) { }
+	};
+	struct IndexBuffer {
+		size_t indexSize;
+		size_t indexCount;
+		unsigned char* indexBuffer; // size in bytes = indexSize * indexCount
+		IndexBuffer() :
+			indexBuffer(0) { }
+	};
+	struct SubmeshInfo {
+		vector<IndexBuffer>::type genIndexBuffers; // order: lodlevel/generated index buffer
+		IndexBuffer indexBuffer;
+		VertexBuffer vertexBuffer;
+		bool useSharedVertexBuffer;
+	};
+	vector<SubmeshInfo>::type submesh;
+	VertexBuffer sharedVertexBuffer;
+	LodConfig config;
+	String meshName;
+	~PMGenRequest();
+};
+
+/**
+ * @brief Processes requests.
+ */
+class _OgreExport PMWorker :
+	public Singleton<PMWorker>,
+	private WorkQueue::RequestHandler,
+	private ProgressiveMeshGenerator,
+	public LodAlloc
+{
+public:
+	PMWorker();
+	virtual ~PMWorker();
+	void addRequestToQueue(PMGenRequest* request);
+	void clearPendingLodRequests();
+	
+	/** Override standard Singleton retrieval.
+  @remarks
+  Why do we do this? Well, it's because the Singleton
+  implementation is in a .h file, which means it gets compiled
+  into anybody who includes it. This is needed for the
+  Singleton template to work, but we actually only want it
+  compiled into the implementation of the class based on the
+  Singleton, not all of them. If we don't change this, we get
+  link errors when trying to use the Singleton-based class from
+  an outside dll.
+  @par
+  This method just delegates to the template version anyway,
+  but the implementation stays in this single compilation unit,
+  preventing link errors.
+  */
+  static PMWorker& getSingleton(void);
+  /** Override standard Singleton retrieval.
+  @remarks
+  Why do we do this? Well, it's because the Singleton
+  implementation is in a .h file, which means it gets compiled
+  into anybody who includes it. This is needed for the
+  Singleton template to work, but we actually only want it
+  compiled into the implementation of the class based on the
+  Singleton, not all of them. If we don't change this, we get
+  link errors when trying to use the Singleton-based class from
+  an outside dll.
+  @par
+  This method just delegates to the template version anyway,
+  but the implementation stays in this single compilation unit,
+  preventing link errors.
+  */
+  static PMWorker* getSingletonPtr(void);
+        
+private:
+	PMGenRequest* mRequest; // This is a copy of the current processed request from stack. This is needed to pass it to overloaded functions like bakeLods().
+	ushort mChannelID;
+
+	WorkQueue::Response* handleRequest(const WorkQueue::Request* req, const WorkQueue* srcQ);
+	void buildRequest(LodConfig& lodConfigs);
+	void tuneContainerSize();
+	void initialize();
+	void addVertexBuffer(const PMGenRequest::VertexBuffer& vertexBuffer, bool useSharedVertexLookup);
+	void addIndexBuffer(PMGenRequest::IndexBuffer& indexBuffer, bool useSharedVertexLookup, unsigned short submeshID);
+	void bakeLods();
+};
+
+class _OgreExport PMInjectorListener
+{
+public:
+	PMInjectorListener(){}
+	virtual ~PMInjectorListener(){}
+	virtual bool shouldInject(PMGenRequest* request) = 0;
+	virtual void injectionCompleted(PMGenRequest* request) = 0;
+};
+
+/**
+ * @brief Injects the output of a request to the mesh in a thread safe way.
+ */
+class _OgreExport PMInjector :
+	public Singleton<PMInjector>,
+	public WorkQueue::ResponseHandler,
+	public LodAlloc
+{
+public:
+	PMInjector();
+	virtual ~PMInjector();
+	
+	/** Override standard Singleton retrieval.
+  @remarks
+  Why do we do this? Well, it's because the Singleton
+  implementation is in a .h file, which means it gets compiled
+  into anybody who includes it. This is needed for the
+  Singleton template to work, but we actually only want it
+  compiled into the implementation of the class based on the
+  Singleton, not all of them. If we don't change this, we get
+  link errors when trying to use the Singleton-based class from
+  an outside dll.
+  @par
+  This method just delegates to the template version anyway,
+  but the implementation stays in this single compilation unit,
+  preventing link errors.
+  */
+  static PMInjector& getSingleton(void);
+  /** Override standard Singleton retrieval.
+  @remarks
+  Why do we do this? Well, it's because the Singleton
+  implementation is in a .h file, which means it gets compiled
+  into anybody who includes it. This is needed for the
+  Singleton template to work, but we actually only want it
+  compiled into the implementation of the class based on the
+  Singleton, not all of them. If we don't change this, we get
+  link errors when trying to use the Singleton-based class from
+  an outside dll.
+  @par
+  This method just delegates to the template version anyway,
+  but the implementation stays in this single compilation unit,
+  preventing link errors.
+  */
+  static PMInjector* getSingletonPtr(void);
+
+	void handleResponse(const WorkQueue::Response* res, const WorkQueue* srcQ);
+
+	void setInjectorListener(PMInjectorListener* injectorListener) {mInjectorListener = injectorListener;}
+	void removeInjectorListener() {mInjectorListener = 0;}
+protected:
+
+	// Copies every generated LOD level to the mesh.
+	void inject(PMGenRequest* request);
+
+	PMInjectorListener* mInjectorListener;
+};
+
+/**
+ * @brief Creates a request for the worker. The interface is compatible with ProgressiveMeshGenerator.
+ */
+class _OgreExport QueuedProgressiveMeshGenerator :
+	public ProgressiveMeshGeneratorBase
+{
+public:
+
+	/// @copydoc ProgressiveMeshGeneratorBase::generateLodLevels
+	void generateLodLevels(LodConfig& lodConfig);
+
+	virtual ~QueuedProgressiveMeshGenerator();
+
+private:
+	void copyVertexBuffer(VertexData* data, PMGenRequest::VertexBuffer& out);
+	void copyIndexBuffer(IndexData* data, PMGenRequest::IndexBuffer& out);
+	void copyBuffers(Mesh* mesh, PMGenRequest* req);
+};
+
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreRadixSort.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreRadixSort.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreRadixSort.h	(revision 148)
@@ -0,0 +1,330 @@
+/*
+-----------------------------------------------------------------------------
+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 __RadixSort_H__
+#define __RadixSort_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+	/** Class for performing a radix sort (fast comparison-less sort based on 
+		byte value) on various standard STL containers. 
+	@remarks
+		A radix sort is a very fast sort algorithm. It doesn't use comparisons
+		and thus is able to break the theoretical minimum O(N*logN) complexity. 
+		Radix sort is complexity O(k*N), where k is a constant. Note that radix
+		sorting is not in-place, it requires additional storage, so it trades
+		memory for speed. The overhead of copying means that it is only faster
+		for fairly large datasets, so you are advised to only use it for collections
+		of at least a few hundred items.
+	@par
+		This is a template class to allow it to deal with a variety of containers, 
+		and a variety of value types to sort on. In addition to providing the
+		container and value type on construction, you also need to supply a 
+		functor object which will retrieve the value to compare on for each item
+		in the list. For example, if you had an std::vector of by-value instances
+		of an object of class 'Bibble', and you wanted to sort on 
+		Bibble::getDoobrie(), you'd have to firstly create a functor
+		like this:
+	@code
+		struct BibbleSortFunctor
+		{
+			float operator()(const Bibble& val) const
+			{
+				return val.getDoobrie();
+			}
+		}
+	@endcode
+		Then, you need to declare a RadixSort class which names the container type, 
+		the value type in the container, and the type of the value you want to 
+		sort by. You can then call the sort function. E.g.
+	@code
+		RadixSort<BibbleList, Bibble, float> radixSorter;
+		BibbleSortFunctor functor;
+
+		radixSorter.sort(myBibbleList, functor);
+	@endcode
+		You should try to reuse RadixSort instances, since repeated allocation of the 
+		internal storage is then avoided.
+	@note
+		Radix sorting is often associated with just unsigned integer values. Our
+		implementation can handle both unsigned and signed integers, as well as
+		floats (which are often not supported by other radix sorters). doubles
+		are not supported; you will need to implement your functor object to convert
+		to float if you wish to use this sort routine.
+	*/
+	template <class TContainer, class TContainerValueType, typename TCompValueType>
+	class RadixSort
+	{
+	public:
+		typedef typename TContainer::iterator ContainerIter;
+	protected:
+		/// Alpha-pass counters of values (histogram)
+		/// 4 of them so we can radix sort a maximum of a 32bit value
+		int mCounters[4][256];
+		/// Beta-pass offsets 
+		int mOffsets[256];
+		/// Sort area size
+		int mSortSize;
+		/// Number of passes for this type
+		int mNumPasses;
+
+		struct SortEntry
+		{
+			TCompValueType key;
+			ContainerIter iter;
+			SortEntry() {}
+			SortEntry(TCompValueType k, ContainerIter it)
+				: key(k), iter(it) {}
+
+		};
+		/// Temp sort storage
+		typedef std::vector<SortEntry, STLAllocator<SortEntry, GeneralAllocPolicy> > SortVector; 
+		SortVector mSortArea1;
+		SortVector mSortArea2;
+		SortVector* mSrc;
+		SortVector* mDest;
+		TContainer mTmpContainer; // initial copy
+
+
+		void sortPass(int byteIndex)
+		{
+			// Calculate offsets
+			// Basically this just leaves gaps for duplicate entries to fill
+			mOffsets[0] = 0;
+			for (int i = 1; i < 256; ++i)
+			{
+				mOffsets[i] = mOffsets[i-1] + mCounters[byteIndex][i-1];
+			}
+
+			// Sort pass
+			for (int i = 0; i < mSortSize; ++i)
+			{
+				unsigned char byteVal = getByte(byteIndex, (*mSrc)[i].key);
+				(*mDest)[mOffsets[byteVal]++] = (*mSrc)[i];
+			}
+
+		}
+		template <typename T>
+		void finalPass(int byteIndex, T val)
+		{
+			// default is to do normal pass
+			sortPass(byteIndex);
+		}
+		
+		// special case signed int
+		void finalPass(int byteIndex, int val)
+		{
+			int numNeg = 0;
+			// all negative values are in entries 128+ in most significant byte
+			for (int i = 128; i < 256; ++i)
+			{
+				numNeg += mCounters[byteIndex][i];
+			}
+			// Calculate offsets - positive ones start at the number of negatives
+			// do positive numbers
+			mOffsets[0] = numNeg;
+			for (int i = 1; i < 128; ++i)
+			{
+				mOffsets[i] = mOffsets[i-1] + mCounters[byteIndex][i-1];
+			}
+			// Do negative numbers (must start at zero)
+			// No need to invert ordering, already correct (-1 is highest number)
+			mOffsets[128] = 0;
+			for (int i = 129; i < 256; ++i)
+			{
+				mOffsets[i] = mOffsets[i-1] + mCounters[byteIndex][i-1];
+			}
+
+			// Sort pass
+			for (int i = 0; i < mSortSize; ++i)
+			{
+				unsigned char byteVal = getByte(byteIndex, (*mSrc)[i].key);
+				(*mDest)[mOffsets[byteVal]++] = (*mSrc)[i];
+			}
+		}
+		
+
+		// special case float
+		void finalPass(int byteIndex, float val)
+		{
+			// floats need to be special cased since negative numbers will come
+			// after positives (high bit = sign) and will be in reverse order
+			// (no ones-complement of the +ve value)
+			int numNeg = 0;
+			// all negative values are in entries 128+ in most significant byte
+			for (int i = 128; i < 256; ++i)
+			{
+				numNeg += mCounters[byteIndex][i];
+			}
+			// Calculate offsets - positive ones start at the number of negatives
+			// do positive numbers normally
+			mOffsets[0] = numNeg;
+			for (int i = 1; i < 128; ++i)
+			{
+				mOffsets[i] = mOffsets[i-1] + mCounters[byteIndex][i-1];
+			}
+			// Do negative numbers (must start at zero)
+			// Also need to invert ordering
+			// In order to preserve the stability of the sort (essential since
+			// we rely on previous bytes already being sorted) we have to count
+			// backwards in our offsets from 
+			mOffsets[255] = mCounters[byteIndex][255];
+			for (int i = 254; i > 127; --i)
+			{
+				mOffsets[i] = mOffsets[i+1] + mCounters[byteIndex][i];
+			}
+
+			// Sort pass
+			for (int i = 0; i < mSortSize; ++i)
+			{
+				unsigned char byteVal = getByte(byteIndex, (*mSrc)[i].key);
+				if (byteVal > 127)
+				{
+					// -ve; pre-decrement since offsets set to count
+					(*mDest)[--mOffsets[byteVal]] = (*mSrc)[i];
+				}
+				else
+				{
+					// +ve
+					(*mDest)[mOffsets[byteVal]++] = (*mSrc)[i];
+				}
+			}
+		}
+
+		inline unsigned char getByte(int byteIndex, TCompValueType val)
+		{
+#if OGRE_ENDIAN == OGRE_ENDIAN_LITTLE
+			return ((unsigned char*)(&val))[byteIndex];
+#else
+			return ((unsigned char*)(&val))[mNumPasses - byteIndex - 1];
+#endif
+		}
+
+	public:
+
+		RadixSort() {}
+		~RadixSort() {}
+
+		/** Main sort function
+		@param container A container of the type you declared when declaring
+		@param func A functor which returns the value for comparison when given
+			a container value
+		*/
+		template <class TFunction>
+		void sort(TContainer& container, TFunction func)
+		{
+			if (container.empty())
+				return;
+
+			// Set up the sort areas
+			mSortSize = static_cast<int>(container.size());
+			mSortArea1.resize(container.size());
+			mSortArea2.resize(container.size());
+
+			// Copy data now (we need constant iterators for sorting)
+			mTmpContainer = container;
+
+			mNumPasses = sizeof(TCompValueType);
+
+			// Counter pass
+			// Initialise the counts
+			int p;
+			for (p = 0; p < mNumPasses; ++p)
+				memset(mCounters[p], 0, sizeof(int) * 256);
+
+			// Perform alpha pass to count
+			ContainerIter i = mTmpContainer.begin();
+			TCompValueType prevValue = func.operator()(*i); 
+			bool needsSorting = false;
+			for (int u = 0; i != mTmpContainer.end(); ++i, ++u)
+			{
+				// get sort value
+				TCompValueType val = func.operator()(*i);
+				// cheap check to see if needs sorting (temporal coherence)
+				if (!needsSorting && val < prevValue)
+					needsSorting = true;
+
+				// Create a sort entry
+				mSortArea1[u].key = val;
+				mSortArea1[u].iter = i;
+
+				// increase counters
+				for (p = 0; p < mNumPasses; ++p)
+				{
+					unsigned char byteVal = getByte(p, val);
+					mCounters[p][byteVal]++;
+				}
+
+				prevValue = val;
+
+			}
+
+			// early exit if already sorted
+			if (!needsSorting)
+				return;
+
+
+			// Sort passes
+			mSrc = &mSortArea1;
+			mDest = &mSortArea2;
+
+			for (p = 0; p < mNumPasses - 1; ++p)
+			{
+				sortPass(p);
+				// flip src/dst
+				SortVector* tmp = mSrc;
+				mSrc = mDest;
+				mDest = tmp;
+			}
+			// Final pass may differ, make polymorphic
+			finalPass(p, prevValue);
+
+			// Copy everything back
+			int c = 0;
+			for (i = container.begin(); 
+				i != container.end(); ++i, ++c)
+			{
+				*i = *((*mDest)[c].iter);
+			}
+		}
+
+	};
+
+	/** @} */
+	/** @} */
+
+}
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreRay.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreRay.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreRay.h	(revision 148)
@@ -0,0 +1,122 @@
+/*
+-----------------------------------------------------------------------------
+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 __Ray_H_
+#define __Ray_H_
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+
+#include "OgreVector3.h"
+#include "OgrePlaneBoundedVolume.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Math
+	*  @{
+	*/
+	/** Representation of a ray in space, i.e. a line with an origin and direction. */
+    class _OgreExport Ray
+    {
+    protected:
+        Vector3 mOrigin;
+        Vector3 mDirection;
+    public:
+        Ray():mOrigin(Vector3::ZERO), mDirection(Vector3::UNIT_Z) {}
+        Ray(const Vector3& origin, const Vector3& direction)
+            :mOrigin(origin), mDirection(direction) {}
+
+        /** Sets the origin of the ray. */
+        void setOrigin(const Vector3& origin) {mOrigin = origin;} 
+        /** Gets the origin of the ray. */
+        const Vector3& getOrigin(void) const {return mOrigin;} 
+
+        /** Sets the direction of the ray. */
+        void setDirection(const Vector3& dir) {mDirection = dir;} 
+        /** Gets the direction of the ray. */
+        const Vector3& getDirection(void) const {return mDirection;} 
+
+		/** Gets the position of a point t units along the ray. */
+		Vector3 getPoint(Real t) const { 
+			return Vector3(mOrigin + (mDirection * t));
+		}
+		
+		/** Gets the position of a point t units along the ray. */
+		Vector3 operator*(Real t) const { 
+			return getPoint(t);
+		}
+
+		/** Tests whether this ray intersects the given plane. 
+		@return A pair structure where the first element indicates whether
+			an intersection occurs, and if true, the second element will
+			indicate the distance along the ray at which it intersects. 
+			This can be converted to a point in space by calling getPoint().
+		*/
+		std::pair<bool, Real> intersects(const Plane& p) const
+		{
+			return Math::intersects(*this, p);
+		}
+        /** Tests whether this ray intersects the given plane bounded volume. 
+        @return A pair structure where the first element indicates whether
+        an intersection occurs, and if true, the second element will
+        indicate the distance along the ray at which it intersects. 
+        This can be converted to a point in space by calling getPoint().
+        */
+        std::pair<bool, Real> intersects(const PlaneBoundedVolume& p) const
+        {
+            return Math::intersects(*this, p.planes, p.outside == Plane::POSITIVE_SIDE);
+        }
+		/** Tests whether this ray intersects the given sphere. 
+		@return A pair structure where the first element indicates whether
+			an intersection occurs, and if true, the second element will
+			indicate the distance along the ray at which it intersects. 
+			This can be converted to a point in space by calling getPoint().
+		*/
+		std::pair<bool, Real> intersects(const Sphere& s) const
+		{
+			return Math::intersects(*this, s);
+		}
+		/** Tests whether this ray intersects the given box. 
+		@return A pair structure where the first element indicates whether
+			an intersection occurs, and if true, the second element will
+			indicate the distance along the ray at which it intersects. 
+			This can be converted to a point in space by calling getPoint().
+		*/
+		std::pair<bool, Real> intersects(const AxisAlignedBox& box) const
+		{
+			return Math::intersects(*this, box);
+		}
+
+    };
+	/** @} */
+	/** @} */
+
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreRectangle2D.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreRectangle2D.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreRectangle2D.h	(revision 148)
@@ -0,0 +1,101 @@
+/*
+-----------------------------------------------------------------------------
+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 _Rectangle2D_H__
+#define _Rectangle2D_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreSimpleRenderable.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Scene
+	*  @{
+	*/
+	/** Allows the rendering of a simple 2D rectangle
+    This class renders a simple 2D rectangle; this rectangle has no depth and
+    therefore is best used with specific render queue and depth settings,
+    like RENDER_QUEUE_BACKGROUND and 'depth_write off' for backdrops, and 
+    RENDER_QUEUE_OVERLAY and 'depth_check off' for fullscreen quads.
+    */
+    class _OgreExport Rectangle2D : public SimpleRenderable
+    {
+    protected:
+        /** Override this method to prevent parent transforms (rotation,translation,scale)
+        */
+        void getWorldTransforms( Matrix4* xform ) const;
+
+        void _initRectangle2D(bool includeTextureCoords, Ogre::HardwareBuffer::Usage vBufUsage);
+
+    public:
+
+        Rectangle2D(bool includeTextureCoordinates = false, HardwareBuffer::Usage vBufUsage = HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY);
+        Rectangle2D(const String& name, bool includeTextureCoordinates = false, HardwareBuffer::Usage vBufUsage = HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY);
+        ~Rectangle2D();
+
+        /** Sets the corners of the rectangle, in relative coordinates.
+        @param
+        left Left position in screen relative coordinates, -1 = left edge, 1.0 = right edge
+        @param top Top position in screen relative coordinates, 1 = top edge, -1 = bottom edge
+        @param right Right position in screen relative coordinates
+        @param bottom Bottom position in screen relative coordinates
+		@param updateAABB Tells if you want to recalculate the AABB according to 
+		the new corners. If false, the axis aligned bounding box will remain identical.
+        */
+        void setCorners(Real left, Real top, Real right, Real bottom, bool updateAABB = true);
+
+		/** Sets the normals of the rectangle
+		*/
+		void setNormals(const Ogre::Vector3 &topLeft, const Ogre::Vector3 &bottomLeft, const Ogre::Vector3 &topRight, const Ogre::Vector3 &bottomRight);
+
+		/** Sets the UVs of the rectangle
+		@remarks
+		Doesn't do anything if the rectangle wasn't built with texture coordinates
+		*/
+		void setUVs( const Ogre::Vector2 &topLeft, const Ogre::Vector2 &bottomLeft,
+					 const Ogre::Vector2 &topRight, const Ogre::Vector2 &bottomRight);
+
+		void setDefaultUVs();
+
+        Real getSquaredViewDepth(const Camera* cam) const
+        { (void)cam; return 0; }
+
+        Real getBoundingRadius(void) const { return 0; }
+
+    };
+	/** @} */
+	/** @} */
+
+}// namespace
+
+#endif
+
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreRenderObjectListener.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreRenderObjectListener.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreRenderObjectListener.h	(revision 148)
@@ -0,0 +1,68 @@
+/*
+-----------------------------------------------------------------------------
+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 __RenderObjectListener_H__
+#define __RenderObjectListener_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreRenderable.h"
+#include "OgrePass.h"
+
+namespace Ogre {
+
+    class Pass;
+    class Renderable;
+
+    /** Abstract interface which classes must implement if they wish to receive
+        events from the scene manager when single object is about to be rendered. 
+    */
+    class _OgreExport RenderObjectListener
+    {
+    public:
+        virtual ~RenderObjectListener() {}
+        /** Event raised when render single object started.
+        @remarks
+            This method is called by the SceneManager.
+        @param rend
+            The renderable that is going to be rendered.
+        @param pass
+            The pass which was set.
+        @param source
+            The auto parameter source used within this render call.
+        @param pLightList
+            The light list in use.
+        @param suppressRenderStateChanges
+            True if render state changes should be suppressed.
+        */
+        virtual void notifyRenderSingleObject(Renderable* rend, const Pass* pass, const AutoParamDataSource* source, 
+            const LightList* pLightList, bool suppressRenderStateChanges) = 0;
+    };
+
+} // namespace Ogre
+
+#endif // __RenderObjectListener_H__
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreRenderOperation.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreRenderOperation.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreRenderOperation.h	(revision 148)
@@ -0,0 +1,134 @@
+/*
+-----------------------------------------------------------------------------
+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 _RenderOperation_H__
+#define _RenderOperation_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreVertexIndexData.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup RenderSystem
+	*  @{
+	*/
+	/** 'New' rendering operation using vertex buffers. */
+	class _OgrePrivate RenderOperation {
+	public:
+		/// The rendering operation type to perform
+		enum OperationType {
+			/// A list of points, 1 vertex per point
+            OT_POINT_LIST = 1,
+			/// A list of lines, 2 vertices per line
+            OT_LINE_LIST = 2,
+			/// A strip of connected lines, 1 vertex per line plus 1 start vertex
+            OT_LINE_STRIP = 3,
+			/// A list of triangles, 3 vertices per triangle
+            OT_TRIANGLE_LIST = 4,
+			/// A strip of triangles, 3 vertices for the first triangle, and 1 per triangle after that 
+            OT_TRIANGLE_STRIP = 5,
+			/// A fan of triangles, 3 vertices for the first triangle, and 1 per triangle after that
+            OT_TRIANGLE_FAN = 6,
+			/// Patch control point operations, used with tesselation stages
+			OT_PATCH_1_CONTROL_POINT	= 7,
+			OT_PATCH_2_CONTROL_POINT	= 8,
+			OT_PATCH_3_CONTROL_POINT	= 9,
+			OT_PATCH_4_CONTROL_POINT	= 10,
+			OT_PATCH_5_CONTROL_POINT	= 11,
+			OT_PATCH_6_CONTROL_POINT	= 12,
+			OT_PATCH_7_CONTROL_POINT	= 13,
+			OT_PATCH_8_CONTROL_POINT	= 14,
+			OT_PATCH_9_CONTROL_POINT	= 15,
+			OT_PATCH_10_CONTROL_POINT	= 16,
+			OT_PATCH_11_CONTROL_POINT	= 17,
+			OT_PATCH_12_CONTROL_POINT	= 18,
+			OT_PATCH_13_CONTROL_POINT	= 19,
+			OT_PATCH_14_CONTROL_POINT	= 20,
+			OT_PATCH_15_CONTROL_POINT	= 21,
+			OT_PATCH_16_CONTROL_POINT	= 22,
+			OT_PATCH_17_CONTROL_POINT	= 23,
+			OT_PATCH_18_CONTROL_POINT	= 24,
+			OT_PATCH_19_CONTROL_POINT	= 25,
+			OT_PATCH_20_CONTROL_POINT	= 26,
+			OT_PATCH_21_CONTROL_POINT	= 27,
+			OT_PATCH_22_CONTROL_POINT	= 28,
+			OT_PATCH_23_CONTROL_POINT	= 29,
+			OT_PATCH_24_CONTROL_POINT	= 30,
+			OT_PATCH_25_CONTROL_POINT	= 31,
+			OT_PATCH_26_CONTROL_POINT	= 32,
+			OT_PATCH_27_CONTROL_POINT	= 33,
+			OT_PATCH_28_CONTROL_POINT	= 34,
+			OT_PATCH_29_CONTROL_POINT	= 35,
+			OT_PATCH_30_CONTROL_POINT	= 36,
+			OT_PATCH_31_CONTROL_POINT	= 37,
+			OT_PATCH_32_CONTROL_POINT	= 38
+        };
+
+		/// Vertex source data
+		VertexData *vertexData;
+
+		/// The type of operation to perform
+		OperationType operationType;
+
+		/** Specifies whether to use indexes to determine the vertices to use as input. If false, the vertices are
+		 simply read in sequence to define the primitives. If true, indexes are used instead to identify vertices
+		 anywhere in the buffer, and allowing vertices to be used more than once.
+	   	 If true, then the indexBuffer, indexStart and numIndexes properties must be valid. */
+		bool useIndexes;
+
+		/// Index data - only valid if useIndexes is true
+		IndexData *indexData;
+		/// Debug pointer back to renderable which created this
+		const Renderable* srcRenderable;
+
+		/// The number of instances for the render operation - this option is supported 
+		/// in only a part of the render systems.
+		size_t numberOfInstances;
+
+        /** A flag to indicate that it is possible for this operation to use a global
+            vertex instance buffer if available.*/
+        bool useGlobalInstancingVertexBufferIsAvailable;
+
+        RenderOperation() :
+            vertexData(0), operationType(OT_TRIANGLE_LIST), useIndexes(true),
+                indexData(0), srcRenderable(0), numberOfInstances(1),
+                useGlobalInstancingVertexBufferIsAvailable(true) {}
+
+
+	};
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreRenderQueue.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreRenderQueue.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreRenderQueue.h	(revision 148)
@@ -0,0 +1,311 @@
+/*
+-----------------------------------------------------------------------------
+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 __RenderQueue_H__
+#define __RenderQueue_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	class Camera;
+	class MovableObject;
+	struct VisibleObjectsBoundsInfo;
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup RenderSystem
+	*  @{
+	*/
+	/** Enumeration of queue groups, by which the application may group queued renderables
+        so that they are rendered together with events in between
+	@remarks
+		When passed into methods these are actually passed as a uint8 to allow you
+		to use values in between if you want to.
+    */
+    enum RenderQueueGroupID
+    {
+        /// Use this queue for objects which must be rendered first e.g. backgrounds
+        RENDER_QUEUE_BACKGROUND = 0,
+        /// First queue (after backgrounds), used for skyboxes if rendered first
+        RENDER_QUEUE_SKIES_EARLY = 5,
+        RENDER_QUEUE_1 = 10,
+        RENDER_QUEUE_2 = 20,
+		RENDER_QUEUE_WORLD_GEOMETRY_1 = 25,
+        RENDER_QUEUE_3 = 30,
+        RENDER_QUEUE_4 = 40,
+		/// The default render queue
+        RENDER_QUEUE_MAIN = 50,
+        RENDER_QUEUE_6 = 60,
+        RENDER_QUEUE_7 = 70,
+		RENDER_QUEUE_WORLD_GEOMETRY_2 = 75,
+        RENDER_QUEUE_8 = 80,
+        RENDER_QUEUE_9 = 90,
+        /// Penultimate queue(before overlays), used for skyboxes if rendered last
+        RENDER_QUEUE_SKIES_LATE = 95,
+        /// Use this queue for objects which must be rendered last e.g. overlays
+        RENDER_QUEUE_OVERLAY = 100, 
+		/// Final possible render queue, don't exceed this
+		RENDER_QUEUE_MAX = 105
+    };
+
+    #define OGRE_RENDERABLE_DEFAULT_PRIORITY  100
+
+    /** Class to manage the scene object rendering queue.
+        @remarks
+            Objects are grouped by material to minimise rendering state changes. The map from
+            material to renderable object is wrapped in a class for ease of use.
+        @par
+            This class now includes the concept of 'queue groups' which allows the application
+            adding the renderable to specifically schedule it so that it is included in 
+            a discrete group. Good for separating renderables into the main scene,
+            backgrounds and overlays, and also could be used in the future for more
+            complex multipass routines like stenciling.
+    */
+    class _OgreExport RenderQueue : public RenderQueueAlloc
+    {
+    public:
+
+        typedef map< uint8, RenderQueueGroup* >::type RenderQueueGroupMap;
+        /// Iterator over queue groups
+        typedef MapIterator<RenderQueueGroupMap> QueueGroupIterator;
+        typedef ConstMapIterator<RenderQueueGroupMap> ConstQueueGroupIterator;
+
+		/** Class to listen in on items being added to the render queue. 
+		@remarks
+			Use RenderQueue::setRenderableListener to get callbacks when an item
+			is added to the render queue.
+		*/
+		class _OgreExport RenderableListener
+		{
+		public:
+			RenderableListener() {}
+			virtual ~RenderableListener() {}
+
+			/** Method called when a Renderable is added to the queue.
+			@remarks
+				You can use this event hook to alter the Technique used to
+				render a Renderable as the item is added to the queue. This is
+				a low-level way to override the material settings for a given
+				Renderable on the fly.
+			@param rend The Renderable being added to the queue
+			@param groupID The render queue group this Renderable is being added to
+			@param priority The priority the Renderable has been given
+			@param ppTech A pointer to the pointer to the Technique that is 
+				intended to be used; you can alter this to an alternate Technique
+				if you so wish (the Technique doesn't have to be from the same
+				Material either).
+			@param pQueue Pointer to the render queue that this object is being
+				added to. You can for example call this back to duplicate the 
+				object with a different technique
+			@return true to allow the Renderable to be added to the queue, 
+				false if you want to prevent it being added
+			*/
+			virtual bool renderableQueued(Renderable* rend, uint8 groupID, 
+				ushort priority, Technique** ppTech, RenderQueue* pQueue) = 0;
+		};
+    protected:
+        RenderQueueGroupMap mGroups;
+        /// The current default queue group
+        uint8 mDefaultQueueGroup;
+        /// The default priority
+        ushort mDefaultRenderablePriority;
+
+        bool mSplitPassesByLightingType;
+        bool mSplitNoShadowPasses;
+		bool mShadowCastersCannotBeReceivers;
+
+		RenderableListener* mRenderableListener;
+    public:
+        RenderQueue();
+        virtual ~RenderQueue();
+
+        /** Empty the queue - should only be called by SceneManagers.
+		@param destroyPassMaps Set to true to destroy all pass maps so that
+			the queue is completely clean (useful when switching scene managers)
+        */
+        void clear(bool destroyPassMaps = false);
+
+		/** Get a render queue group.
+		@remarks
+			OGRE registers new queue groups as they are requested, 
+			therefore this method will always return a valid group.
+		*/
+		RenderQueueGroup* getQueueGroup(uint8 qid);
+
+        /** Add a renderable object to the queue.
+        @remarks
+            This methods adds a Renderable to the queue, which will be rendered later by 
+            the SceneManager. This is the advanced version of the call which allows the renderable
+            to be added to any queue.
+        @note
+            Called by implementation of MovableObject::_updateRenderQueue.
+        @param
+            pRend Pointer to the Renderable to be added to the queue
+        @param
+            groupID The group the renderable is to be added to. This
+            can be used to schedule renderable objects in separate groups such that the SceneManager
+            respects the divisions between the groupings and does not reorder them outside these
+            boundaries. This can be handy for overlays where no matter what you want the overlay to 
+            be rendered last.
+        @param
+            priority Controls the priority of the renderable within the queue group. If this number
+            is raised, the renderable will be rendered later in the group compared to it's peers.
+            Don't use this unless you really need to, manually ordering renderables prevents OGRE
+            from sorting them for best efficiency. However this could be useful for ordering 2D
+            elements manually for example.
+        */
+        void addRenderable(Renderable* pRend, uint8 groupID, ushort priority);
+
+        /** Add a renderable object to the queue.
+        @remarks
+            This methods adds a Renderable to the queue, which will be rendered later by 
+            the SceneManager. This is the simplified version of the call which does not 
+            require a priority to be specified. The queue priority is take from the
+            current default (see setDefaultRenderablePriority).
+        @note
+            Called by implementation of MovableObject::_updateRenderQueue.
+        @param pRend
+            Pointer to the Renderable to be added to the queue
+		@param groupId
+            The group the renderable is to be added to. This
+            can be used to schedule renderable objects in separate groups such that the SceneManager
+            respects the divisions between the groupings and does not reorder them outside these
+            boundaries. This can be handy for overlays where no matter what you want the overlay to 
+            be rendered last.
+        */
+        void addRenderable(Renderable* pRend, uint8 groupId);
+
+        /** Add a renderable object to the queue.
+        @remarks
+            This methods adds a Renderable to the queue, which will be rendered later by 
+            the SceneManager. This is the simplified version of the call which does not 
+            require a queue or priority to be specified. The queue group is taken from the
+            current default (see setDefaultQueueGroup).  The queue priority is take from the
+            current default (see setDefaultRenderablePriority).
+        @note
+            Called by implementation of MovableObject::_updateRenderQueue.
+        @param
+            pRend Pointer to the Renderable to be added to the queue
+        */
+        void addRenderable(Renderable* pRend);
+        
+        /** Gets the current default queue group, which will be used for all renderable which do not
+            specify which group they wish to be on.
+        */
+        uint8 getDefaultQueueGroup(void) const;
+
+        /** Sets the current default renderable priority, 
+            which will be used for all renderables which do not
+            specify which priority they wish to use.
+        */
+        void setDefaultRenderablePriority(ushort priority);
+
+        /** Gets the current default renderable priority, which will be used for all renderables which do not
+            specify which priority they wish to use.
+        */
+        ushort getDefaultRenderablePriority(void) const;
+
+        /** Sets the current default queue group, which will be used for all renderable which do not
+            specify which group they wish to be on. See the enum RenderQueueGroupID for what kind of
+			values can be used here.
+        */
+        void setDefaultQueueGroup(uint8 grp);
+        
+        /** Internal method, returns an iterator for the queue groups. */
+        QueueGroupIterator _getQueueGroupIterator(void);
+        ConstQueueGroupIterator _getQueueGroupIterator(void) const;
+
+        /** Sets whether or not the queue will split passes by their lighting type,
+            ie ambient, per-light and decal. 
+        */
+        void setSplitPassesByLightingType(bool split);
+
+        /** Gets whether or not the queue will split passes by their lighting type,
+            ie ambient, per-light and decal. 
+        */
+        bool getSplitPassesByLightingType(void) const;
+
+        /** Sets whether or not the queue will split passes which have shadow receive
+        turned off (in their parent material), which is needed when certain shadow
+        techniques are used.
+        */
+        void setSplitNoShadowPasses(bool split);
+
+        /** Gets whether or not the queue will split passes which have shadow receive
+        turned off (in their parent material), which is needed when certain shadow
+        techniques are used.
+        */
+        bool getSplitNoShadowPasses(void) const;
+
+		/** Sets whether or not objects which cast shadows should be treated as
+		never receiving shadows. 
+		*/
+		void setShadowCastersCannotBeReceivers(bool ind);
+
+		/** Gets whether or not objects which cast shadows should be treated as
+		never receiving shadows. 
+		*/
+		bool getShadowCastersCannotBeReceivers(void) const;
+
+		/** Set a renderable listener on the queue.
+		@remarks
+			There can only be a single renderable listener on the queue, since
+			that listener has complete control over the techniques in use.
+		*/
+		void setRenderableListener(RenderableListener* listener)
+		{ mRenderableListener = listener; }
+
+		RenderableListener* getRenderableListener(void) const
+		{ return mRenderableListener; }
+
+		/** Merge render queue.
+		*/
+		void merge( const RenderQueue* rhs );
+		/** Utility method to perform the standard actions associated with 
+			getting a visible object to add itself to the queue. This is 
+			a replacement for SceneManager implementations of the associated
+			tasks related to calling MovableObject::_updateRenderQueue.
+		*/
+		void processVisibleObject(MovableObject* mo, 
+			Camera* cam, 
+			bool onlyShadowCasters, 
+			VisibleObjectsBoundsInfo* visibleBounds);
+
+    };
+
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreRenderQueueInvocation.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreRenderQueueInvocation.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreRenderQueueInvocation.h	(revision 148)
@@ -0,0 +1,225 @@
+/*
+-----------------------------------------------------------------------------
+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 __RenderQueueInvocation_H__
+#define __RenderQueueInvocation_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreRenderQueueSortingGrouping.h"
+#include "OgreIteratorWrappers.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup RenderSystem
+	*  @{
+	*/
+	/** Class representing the invocation of queue groups in a RenderQueue.
+	@remarks
+		The default behaviour for OGRE's render queue is to render each queue
+		group in turn, dealing with shadows automatically, and rendering solids
+		in grouped passes, followed by transparent objects in descending order.
+		This class, together with RenderQueueInvocationSequence and the ability
+		to associate one with a Viewport, allows you to change that behaviour
+		and render queue groups in arbitrary sequence, repeatedly, and to skip
+		shadows, change the ordering of solids, or even prevent OGRE controlling
+		the render state during a particular invocation for special effects.
+	@par
+		Note that whilst you can change the ordering of rendering solids, you 
+		can't change the ordering on transparent objects, since to do this would
+		cause them to render incorrectly.
+	@par
+		As well as using this class directly and using the options it provides you
+		with, you can also provide subclasses of it to a 
+		RenderQueueInvocationSequence instance if you want to gain ultimate control.
+	@note
+		Invocations will be skipped if there are scene-level options preventing
+		them being rendered - for example special-case render queues and
+		render queue listeners that dictate this.
+	*/
+	class _OgreExport RenderQueueInvocation : public RenderQueueAlloc
+	{
+	protected:
+		/// Target queue group
+		uint8 mRenderQueueGroupID;
+		/// Invocation identifier - used in listeners
+		String mInvocationName;
+		/// Solids ordering mode
+		QueuedRenderableCollection::OrganisationMode mSolidsOrganisation;
+		/// Suppress shadows processing in this invocation?
+		bool mSuppressShadows;
+		/// Suppress OGRE's render state management?
+		bool mSuppressRenderStateChanges;
+	public:
+		/** Constructor
+		@param renderQueueGroupID ID of the queue this will target
+		@param invocationName Optional name to uniquely identify this
+			invocation from others in a RenderQueueListener
+		*/
+		RenderQueueInvocation(uint8 renderQueueGroupID, 
+			const String& invocationName = StringUtil::BLANK);
+		virtual ~RenderQueueInvocation();
+
+		/// Get the render queue group id
+		virtual uint8 getRenderQueueGroupID(void) const { return mRenderQueueGroupID; }
+
+		/// Get the invocation name (may be blank if not set by creator)
+		virtual const String& getInvocationName(void) const { return mInvocationName; }
+
+		/** Set the organisation mode being used for solids in this queue group
+		invocation.
+		*/
+		virtual void setSolidsOrganisation(
+			QueuedRenderableCollection::OrganisationMode org)  
+		{ mSolidsOrganisation = org; }
+
+		/** Get the organisation mode being used for solids in this queue group
+			invocation.
+		*/
+		virtual QueuedRenderableCollection::OrganisationMode
+			getSolidsOrganisation(void) const { return mSolidsOrganisation; }
+
+		/** Sets whether shadows are suppressed when invoking this queue. 
+		@remarks
+			When doing effects you often will want to suppress shadow processing
+			if shadows will already have been done by a previous render.
+		*/
+		virtual void setSuppressShadows(bool suppress) 
+		{ mSuppressShadows =  suppress; }
+
+		/** Gets whether shadows are suppressed when invoking this queue. 
+		*/
+		virtual bool getSuppressShadows(void) const { return mSuppressShadows; }
+
+		/** Sets whether render state changes are suppressed when invoking this queue. 
+		@remarks
+			When doing special effects you may want to set up render state yourself
+			and have it apply for the entire rendering of a queue. In that case, 
+			you should call this method with a parameter of 'true', and use a
+			RenderQueueListener to set the render state directly on RenderSystem
+			yourself before the invocation.
+		@par
+			Suppressing render state changes is only intended for advanced use, 
+			don't use it if you're unsure of the effect. The only RenderSystem
+			calls made are to set the world matrix for each object (note - 
+			view an projection matrices are NOT SET - they are under your control) 
+			and to render the object; it is up to the caller to do everything else, 
+			including enabling any vertex / fragment programs and updating their 
+			parameter state, and binding parameters to the RenderSystem.
+			We advise you use a RenderQueueListener in order to get a notification
+			when this invocation is going to happen (use an invocation name to
+			identify it if you like), at which point you can set the state you
+			need to apply before the objects are rendered.
+		*/
+		virtual void setSuppressRenderStateChanges(bool suppress) 
+		{ mSuppressRenderStateChanges =  suppress; }
+
+		/** Gets whether shadows are suppressed when invoking this queue. 
+		*/
+		virtual bool getSuppressRenderStateChanges(void) const { return mSuppressRenderStateChanges; }
+
+		/** Invoke this class on a concrete queue group.
+		@remarks
+			Implementation will send the queue group to the target scene manager
+			after doing what it needs to do.
+		*/
+		virtual void invoke(RenderQueueGroup* group, SceneManager* targetSceneManager);
+
+		/// Invocation identifier for shadows
+		static String RENDER_QUEUE_INVOCATION_SHADOWS;
+	};
+
+
+	/// List of RenderQueueInvocations
+	typedef vector<RenderQueueInvocation*>::type RenderQueueInvocationList;
+	typedef VectorIterator<RenderQueueInvocationList> RenderQueueInvocationIterator;
+
+	/** Class to hold a linear sequence of RenderQueueInvocation objects. 
+	@remarks
+		This is just a simple data holder class which contains a list of 
+		RenderQueueInvocation objects representing the sequence of invocations
+		made for a viewport. It's only real purpose is to ensure that 
+		RenderQueueInvocation instances are deleted on shutdown, since you can
+		provide your own subclass instances on RenderQueueInvocation. Remember
+		that any invocation instances you give to this class will be deleted
+		by it when it is cleared / destroyed.
+	*/
+	class _OgreExport RenderQueueInvocationSequence : public RenderQueueAlloc
+	{
+	protected:
+		String mName;
+		RenderQueueInvocationList mInvocations;
+	public:
+		RenderQueueInvocationSequence(const String& name);
+		virtual ~RenderQueueInvocationSequence();
+
+		/** Get the name of this sequence. */
+		const String& getName(void) const { return mName; }
+
+		/** Add a standard invocation to the sequence.
+		@param renderQueueGroupID The ID of the render queue group
+		@param invocationName Optional name to identify the invocation, useful
+			for listeners if a single queue group is invoked more than once
+		@return A new RenderQueueInvocatin instance which you may customise
+		*/
+		RenderQueueInvocation* add(uint8 renderQueueGroupID, 
+			const String& invocationName);
+
+		/** Add a custom invocation to the sequence.
+		@remarks
+			Use this to add your own custom subclasses of RenderQueueInvocation
+			to the sequence; just remember that this class takes ownership of
+			deleting this pointer when it is cleared / destroyed.
+		*/
+		void add(RenderQueueInvocation* i);
+
+		/** Get the number of invocations in this sequence. */
+		size_t size(void) const { return mInvocations.size(); }
+
+		/** Clear and delete all invocations in this sequence. */
+		void clear(void);
+
+		/** Gets the details of an invocation at a given index. */
+		RenderQueueInvocation* get(size_t index);
+
+		/** Removes (and deletes) an invocation by index. */
+		void remove(size_t index);
+
+		/** Get an iterator over the invocations. */
+		RenderQueueInvocationIterator iterator(void);
+
+
+	};
+	/** @} */
+	/** @} */
+
+}
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreRenderQueueListener.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreRenderQueueListener.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreRenderQueueListener.h	(revision 148)
@@ -0,0 +1,106 @@
+/*
+-----------------------------------------------------------------------------
+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 __RenderQueueListener_H__
+#define __RenderQueueListener_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreRenderQueue.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup RenderSystem
+	*  @{
+	*/
+	/** Abstract interface which classes must implement if they wish to receive
+        events from the render queue. 
+    @remarks
+        The OGRE render queue is divided into several queue groups, as defined by
+        uint8. A class may implement this interface, and register itself
+        as a listener by calling SceneManager::addRenderQueueListener. After doing so,
+        the class will receive an event before and after each queue group is sent to 
+        the rendering system.
+    @par
+        The event listeners have an option to make a queue either be skipped, or to repeat.
+        Note that if multiple listeners are registered, the one registered last has the final
+        say, although options set by previous listeners will not be changed if the latest
+        does not express a preference.
+    */
+    class _OgreExport RenderQueueListener
+    {
+    public:
+		virtual ~RenderQueueListener() {}
+
+		/** Event raised before all render queues are processed. 
+		*/
+		virtual void preRenderQueues() {}
+		/** Event raised after all render queues are processed. 
+		*/
+		virtual void postRenderQueues() {}
+
+        /** Event raised before a queue group is rendered. 
+        @remarks
+            This method is called by the SceneManager before each queue group is
+            rendered. 
+        @param queueGroupId The id of the queue group which is about to be rendered
+		@param invocation Name of the invocation which is causing this to be 
+			called (@see RenderQueueInvocation)
+		@param skipThisInvocation A boolean passed by reference which is by default set to 
+			false. If the event sets this to true, the queue will be skipped and not
+			rendered. Note that in this case the renderQueueEnded event will not be raised
+			for this queue group.
+        */
+        virtual void renderQueueStarted(uint8 queueGroupId, const String& invocation, 
+			bool& skipThisInvocation)
+        { (void)queueGroupId; (void)invocation; (void)skipThisInvocation; }
+
+        /** Event raised after a queue group is rendered. 
+        @remarks
+            This method is called by the SceneManager after each queue group is
+            rendered. 
+        @param queueGroupId The id of the queue group which has just been rendered
+		@param invocation Name of the invocation which is causing this to be 
+			called (@see RenderQueueInvocation)
+		@param repeatThisInvocation A boolean passed by reference which is by default set to 
+			false. If the event sets this to true, the queue which has just been
+			rendered will be repeated, and the renderQueueStarted and renderQueueEnded
+			events will also be fired for it again.
+        */
+        virtual void renderQueueEnded(uint8 queueGroupId, const String& invocation, 
+			bool& repeatThisInvocation)
+        { (void)queueGroupId; (void)invocation; (void)repeatThisInvocation; }
+    };
+	/** @} */
+	/** @} */
+
+}
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreRenderQueueSortingGrouping.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreRenderQueueSortingGrouping.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreRenderQueueSortingGrouping.h	(revision 148)
@@ -0,0 +1,733 @@
+/*
+-----------------------------------------------------------------------------
+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 __RenderQueueSortingGrouping_H__
+#define __RenderQueueSortingGrouping_H__
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreMaterial.h"
+#include "OgreTechnique.h"
+#include "OgrePass.h"
+#include "OgreRadixSort.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup RenderSystem
+	*  @{
+	*/
+	/** Struct associating a single Pass with a single Renderable. 
+		This is used to for objects sorted by depth and thus not
+		grouped by pass.
+	*/
+	struct RenderablePass
+	{
+		/// Pointer to the Renderable details
+		Renderable* renderable;
+		/// Pointer to the Pass
+		Pass* pass;
+
+		RenderablePass(Renderable* rend, Pass* p) :renderable(rend), pass(p) {}
+	};
+
+
+	/** Visitor interface for items in a QueuedRenderableCollection.
+	@remarks
+		Those wishing to iterate over the items in a 
+		QueuedRenderableCollection should implement this visitor pattern,
+		since internal organisation of the collection depends on the 
+		sorting method in use.
+	*/
+	class _OgreExport QueuedRenderableVisitor
+	{
+	public:
+		QueuedRenderableVisitor() {}
+		virtual ~QueuedRenderableVisitor() {}
+		
+		/** Called when visiting a RenderablePass, i.e. items in a
+			sorted collection where items are not grouped by pass.
+		@remarks
+			If this is called, neither of the other 2 visit methods
+			will be called.
+		*/
+		virtual void visit(RenderablePass* rp) = 0;
+
+		/* When visiting a collection grouped by pass, this is
+			called when the grouping pass changes.
+		@remarks
+			If this method is called, the RenderablePass visit 
+			method will not be called for this collection. The 
+			Renderable visit method will be called for each item
+			underneath the pass grouping level.
+		@return True to continue, false to skip the Renderables underneath
+		*/
+		virtual bool visit(const Pass* p) = 0;
+		/** Visit method called once per Renderable on a grouped 
+			collection.
+		@remarks
+			If this method is called, the RenderablePass visit 
+			method will not be called for this collection. 
+		*/
+		virtual void visit(Renderable* r) = 0;
+		
+		
+	};
+
+	/** Lowest level collection of renderables.
+	@remarks
+		To iterate over items in this collection, you must call
+		the accept method and supply a QueuedRenderableVisitor.
+		The order of the iteration, and whether that iteration is
+		over a RenderablePass list or a 2-level grouped list which 
+		causes a visit call at the Pass level, and a call for each
+		Renderable underneath.
+	*/
+	class _OgreExport QueuedRenderableCollection : public RenderQueueAlloc
+	{
+	public:
+		/** Organisation modes required for this collection.
+		@remarks
+			This affects the internal placement of the items added to this collection;
+			if only one type of sorting / grouping is to be required, then renderables
+			can be stored only once, whilst if multiple types are going to be needed
+			then internally there will be multiple organisations. Changing the organisation
+			needs to be done when the collection is empty.
+		*/		
+		enum OrganisationMode
+		{
+			/// Group by pass
+			OM_PASS_GROUP = 1,
+			/// Sort descending camera distance
+			OM_SORT_DESCENDING = 2,
+			/** Sort ascending camera distance 
+				Note value overlaps with descending since both use same sort
+			*/
+			OM_SORT_ASCENDING = 6
+		};
+
+	protected:
+        /// Comparator to order pass groups
+        struct PassGroupLess
+        {
+            bool _OgreExport operator()(const Pass* a, const Pass* b) const
+            {
+                // Sort by passHash, which is pass, then texture unit changes
+                uint32 hasha = a->getHash();
+                uint32 hashb = b->getHash();
+                if (hasha == hashb)
+                {
+                    // Must differentTransparentQueueItemLessiate by pointer incase 2 passes end up with the same hash
+                    return a < b;
+                }
+                else
+                {
+                    return hasha < hashb;
+                }
+            }
+        };
+        /// Comparator to order objects by descending camera distance
+		struct DepthSortDescendingLess
+        {
+            const Camera* camera;
+
+            DepthSortDescendingLess(const Camera* cam)
+                : camera(cam)
+            {
+            }
+
+            bool _OgreExport operator()(const RenderablePass& a, const RenderablePass& b) const
+            {
+                if (a.renderable == b.renderable)
+                {
+                    // Same renderable, sort by pass hash
+                    return a.pass->getHash() < b.pass->getHash();
+                }
+                else
+                {
+                    // Different renderables, sort by depth
+                    Real adepth = a.renderable->getSquaredViewDepth(camera);
+                    Real bdepth = b.renderable->getSquaredViewDepth(camera);
+					if (Math::RealEqual(adepth, bdepth))
+				    {
+                        // Must return deterministic result, doesn't matter what
+                        return a.pass < b.pass;
+				    }
+				    else
+				    {
+				        // Sort DESCENDING by depth (i.e. far objects first)
+					    return (adepth > bdepth);
+				    }
+                }
+
+            }
+        };
+
+        /** Vector of RenderablePass objects, this is built on the assumption that
+         vectors only ever increase in size, so even if we do clear() the memory stays
+         allocated, ie fast */
+        typedef vector<RenderablePass>::type RenderablePassList;
+        typedef vector<Renderable*>::type RenderableList;
+        /** Map of pass to renderable lists, this is a grouping by pass. */
+        typedef map<Pass*, RenderableList*, PassGroupLess>::type PassGroupRenderableMap;
+
+		/// Functor for accessing sort value 1 for radix sort (Pass)
+		struct RadixSortFunctorPass
+		{
+			uint32 operator()(const RenderablePass& p) const
+            {
+                return p.pass->getHash();
+            }
+		};
+
+        /// Radix sorter for accessing sort value 1 (Pass)
+		static RadixSort<RenderablePassList, RenderablePass, uint32> msRadixSorter1;
+
+		/// Functor for descending sort value 2 for radix sort (distance)
+		struct RadixSortFunctorDistance
+		{
+			const Camera* camera;
+
+            RadixSortFunctorDistance(const Camera* cam)
+                : camera(cam)
+            {
+            }
+
+			float operator()(const RenderablePass& p) const
+            {
+                // Sort DESCENDING by depth (ie far objects first), use negative distance
+                // here because radix sorter always dealing with accessing sort
+                return static_cast<float>(- p.renderable->getSquaredViewDepth(camera));
+            }
+		};
+
+        /// Radix sorter for sort value 2 (distance)
+		static RadixSort<RenderablePassList, RenderablePass, float> msRadixSorter2;
+
+		/// Bitmask of the organisation modes requested
+		uint8 mOrganisationMode;
+
+		/// Grouped 
+		PassGroupRenderableMap mGrouped;
+		/// Sorted descending (can iterate backwards to get ascending)
+		RenderablePassList mSortedDescending;
+
+		/// Internal visitor implementation
+		void acceptVisitorGrouped(QueuedRenderableVisitor* visitor) const;
+		/// Internal visitor implementation
+		void acceptVisitorDescending(QueuedRenderableVisitor* visitor) const;
+		/// Internal visitor implementation
+		void acceptVisitorAscending(QueuedRenderableVisitor* visitor) const;
+
+	public:
+		QueuedRenderableCollection();
+		~QueuedRenderableCollection();
+
+		/// Empty the collection
+		void clear(void);
+
+		/** Remove the group entry (if any) for a given Pass.
+		@remarks
+			To be used when a pass is destroyed, such that any
+			grouping level for it becomes useless.
+		*/	
+		void removePassGroup(Pass* p);
+		
+		/** Reset the organisation modes required for this collection. 
+		@remarks
+			You can only do this when the collection is empty.
+		@see OrganisationMode
+		*/
+		void resetOrganisationModes(void) 
+		{ 
+			mOrganisationMode = 0; 
+		}
+		
+		/** Add a required sorting / grouping mode to this collection when next used.
+		@remarks
+			You can only do this when the collection is empty.
+		@see OrganisationMode
+		*/
+		void addOrganisationMode(OrganisationMode om) 
+		{ 
+			mOrganisationMode |= om; 
+		}
+
+        /// Add a renderable to the collection using a given pass
+        void addRenderable(Pass* pass, Renderable* rend);
+		
+		/** Perform any sorting that is required on this collection.
+		@param cam The camera
+		*/
+		void sort(const Camera* cam);
+
+		/** Accept a visitor over the collection contents.
+		@param visitor Visitor class which should be called back
+		@param om The organisation mode which you want to iterate over.
+			Note that this must have been included in an addOrganisationMode
+			call before any renderables were added.
+		*/
+		void acceptVisitor(QueuedRenderableVisitor* visitor, OrganisationMode om) const;
+
+		/** Merge renderable collection. 
+		*/
+		void merge( const QueuedRenderableCollection& rhs );
+	};
+
+	/** Collection of renderables by priority.
+    @remarks
+        This class simply groups renderables for rendering. All the 
+        renderables contained in this class are destined for the same
+        RenderQueueGroup (coarse groupings like those between the main
+        scene and overlays) and have the same priority (fine groupings
+        for detailed overlap control).
+    @par
+        This class can order solid renderables by a number of criteria; 
+		it can optimise them into groups based on pass to reduce render 
+		state changes, or can sort them by ascending or descending view 
+		depth. Transparent objects are always ordered by descending depth.
+	@par
+		To iterate over items in the collections held by this object 
+	   	you should retrieve the collection in use (e.g. solids, solids with
+		no shadows, transparents) and use the accept() method, providing 
+		a class implementing QueuedRenderableVisitor.
+	
+    */
+    class _OgreExport RenderPriorityGroup : public RenderQueueAlloc
+    {
+	protected:
+
+		/// Parent queue group
+        RenderQueueGroup* mParent;
+        bool mSplitPassesByLightingType;
+        bool mSplitNoShadowPasses;
+		bool mShadowCastersNotReceivers;
+        /// Solid pass list, used when no shadows, modulative shadows, or ambient passes for additive
+		QueuedRenderableCollection mSolidsBasic;
+        /// Solid per-light pass list, used with additive shadows
+        QueuedRenderableCollection mSolidsDiffuseSpecular;
+        /// Solid decal (texture) pass list, used with additive shadows
+        QueuedRenderableCollection mSolidsDecal;
+        /// Solid pass list, used when shadows are enabled but shadow receive is turned off for these passes
+        QueuedRenderableCollection mSolidsNoShadowReceive;
+		/// Unsorted transparent list
+		QueuedRenderableCollection mTransparentsUnsorted;
+		/// Transparent list
+		QueuedRenderableCollection mTransparents;
+
+        /// remove a pass entry from all collections
+        void removePassEntry(Pass* p);
+
+        /// Internal method for adding a solid renderable
+        void addSolidRenderable(Technique* pTech, Renderable* rend, bool toNoShadowMap);
+        /// Internal method for adding a solid renderable
+        void addSolidRenderableSplitByLightType(Technique* pTech, Renderable* rend);
+        /// Internal method for adding an unsorted transparent renderable
+        void addUnsortedTransparentRenderable(Technique* pTech, Renderable* rend);
+        /// Internal method for adding a transparent renderable
+        void addTransparentRenderable(Technique* pTech, Renderable* rend);
+
+    public:
+        RenderPriorityGroup(RenderQueueGroup* parent, 
+            bool splitPassesByLightingType,
+            bool splitNoShadowPasses, 
+			bool shadowCastersNotReceivers); 
+           
+        ~RenderPriorityGroup() { }
+
+        /** Get the collection of basic solids currently queued, this includes
+			all solids when there are no shadows, or all solids which have shadow
+			receiving enabled when using modulative shadows, or all ambient passes
+			of solids which have shadow receive enabled for additive shadows. */
+        const QueuedRenderableCollection& getSolidsBasic(void) const
+        { return mSolidsBasic; }
+        /** Get the collection of solids currently queued per light (only applicable in 
+		 	additive shadow modes). */
+        const QueuedRenderableCollection& getSolidsDiffuseSpecular(void) const
+        { return mSolidsDiffuseSpecular; }
+        /** Get the collection of solids currently queued for decal passes (only 
+			applicable in additive shadow modes). */
+        const QueuedRenderableCollection& getSolidsDecal(void) const
+        { return mSolidsDecal; }
+        /** Get the collection of solids for which shadow receipt is disabled (only
+			applicable when shadows are enabled). */
+        const QueuedRenderableCollection& getSolidsNoShadowReceive(void) const
+        { return mSolidsNoShadowReceive; }
+        /** Get the collection of transparent objects currently queued */
+        const QueuedRenderableCollection& getTransparentsUnsorted(void) const
+        { return mTransparentsUnsorted; }
+        /** Get the collection of transparent objects currently queued */
+        const QueuedRenderableCollection& getTransparents(void) const
+        { return mTransparents; }
+
+
+		/** Reset the organisation modes required for the solids in this group. 
+		@remarks
+			You can only do this when the group is empty, i.e. after clearing the 
+			queue.
+		@see QueuedRenderableCollection::OrganisationMode
+		*/
+		void resetOrganisationModes(void);
+		
+		/** Add a required sorting / grouping mode for the solids in this group.
+		@remarks
+			You can only do this when the group is empty, i.e. after clearing the 
+			queue.
+		@see QueuedRenderableCollection::OrganisationMode
+		*/
+		void addOrganisationMode(QueuedRenderableCollection::OrganisationMode om); 
+
+		/** Set the sorting / grouping mode for the solids in this group to the default.
+		@remarks
+			You can only do this when the group is empty, i.e. after clearing the 
+			queue.
+		@see QueuedRenderableCollection::OrganisationMode
+		*/
+		void defaultOrganisationMode(void); 
+
+		/** Add a renderable to this group. */
+        void addRenderable(Renderable* pRend, Technique* pTech);
+
+		/** Sorts the objects which have been added to the queue; transparent objects by their 
+            depth in relation to the passed in Camera. */
+		void sort(const Camera* cam);
+
+        /** Clears this group of renderables. 
+        */
+        void clear(void);
+
+        /** Sets whether or not the queue will split passes by their lighting type,
+        ie ambient, per-light and decal. 
+        */
+        void setSplitPassesByLightingType(bool split)
+        {
+            mSplitPassesByLightingType = split;
+        }
+
+        /** Sets whether or not passes which have shadow receive disabled should
+            be separated. 
+        */
+        void setSplitNoShadowPasses(bool split)
+        {
+            mSplitNoShadowPasses = split;
+        }
+
+		/** Sets whether or not objects which cast shadows should be treated as
+			never receiving shadows. 
+		*/
+		void setShadowCastersCannotBeReceivers(bool ind)
+		{
+			mShadowCastersNotReceivers = ind;
+		}
+
+		/** Merge group of renderables. 
+		*/
+		void merge( const RenderPriorityGroup* rhs );
+
+
+    };
+
+
+    /** A grouping level underneath RenderQueue which groups renderables
+    to be issued at coarsely the same time to the renderer.
+    @remarks
+        Each instance of this class itself hold RenderPriorityGroup instances, 
+        which are the groupings of renderables by priority for fine control
+        of ordering (not required for most instances).
+    */
+    class _OgreExport RenderQueueGroup : public RenderQueueAlloc
+    {
+    public:
+        typedef map<ushort, RenderPriorityGroup*, std::less<ushort> >::type PriorityMap;
+        typedef MapIterator<PriorityMap> PriorityMapIterator;
+        typedef ConstMapIterator<PriorityMap> ConstPriorityMapIterator;
+    protected:
+        RenderQueue* mParent;
+        bool mSplitPassesByLightingType;
+        bool mSplitNoShadowPasses;
+		bool mShadowCastersNotReceivers;
+        /// Map of RenderPriorityGroup objects
+        PriorityMap mPriorityGroups;
+		/// Whether shadows are enabled for this queue
+		bool mShadowsEnabled;
+		/// Bitmask of the organisation modes requested (for new priority groups)
+		uint8 mOrganisationMode;
+
+
+    public:
+		RenderQueueGroup(RenderQueue* parent,
+            bool splitPassesByLightingType,
+            bool splitNoShadowPasses,
+            bool shadowCastersNotReceivers) 
+            : mParent(parent)
+            , mSplitPassesByLightingType(splitPassesByLightingType)
+            , mSplitNoShadowPasses(splitNoShadowPasses)
+            , mShadowCastersNotReceivers(shadowCastersNotReceivers)
+            , mShadowsEnabled(true)
+			, mOrganisationMode(0)
+        {
+        }
+
+        ~RenderQueueGroup() {
+            // destroy contents now
+            PriorityMap::iterator i;
+            for (i = mPriorityGroups.begin(); i != mPriorityGroups.end(); ++i)
+            {
+                OGRE_DELETE i->second;
+            }
+        }
+
+        /** Get an iterator for browsing through child contents. */
+        PriorityMapIterator getIterator(void)
+        {
+            return PriorityMapIterator(mPriorityGroups.begin(), mPriorityGroups.end());
+        }
+
+        /** Get a const iterator for browsing through child contents. */
+        ConstPriorityMapIterator getIterator(void) const
+        {
+            return ConstPriorityMapIterator(mPriorityGroups.begin(), mPriorityGroups.end());
+        }
+
+        /** Add a renderable to this group, with the given priority. */
+        void addRenderable(Renderable* pRend, Technique* pTech, ushort priority)
+        {
+            // Check if priority group is there
+            PriorityMap::iterator i = mPriorityGroups.find(priority);
+            RenderPriorityGroup* pPriorityGrp;
+            if (i == mPriorityGroups.end())
+            {
+                // Missing, create
+                pPriorityGrp = OGRE_NEW RenderPriorityGroup(this, 
+                    mSplitPassesByLightingType,
+                    mSplitNoShadowPasses, 
+					mShadowCastersNotReceivers);
+				if (mOrganisationMode)
+				{
+					pPriorityGrp->resetOrganisationModes();
+					pPriorityGrp->addOrganisationMode((QueuedRenderableCollection::OrganisationMode)mOrganisationMode);
+				}
+
+                mPriorityGroups.insert(PriorityMap::value_type(priority, pPriorityGrp));
+            }
+            else
+            {
+                pPriorityGrp = i->second;
+            }
+
+            // Add
+            pPriorityGrp->addRenderable(pRend, pTech);
+
+        }
+
+        /** Clears this group of renderables. 
+        @param destroy
+            If false, doesn't delete any priority groups, just empties them. Saves on 
+            memory deallocations since the chances are roughly the same kinds of 
+            renderables are going to be sent to the queue again next time. If
+			true, completely destroys.
+        */
+        void clear(bool destroy = false)
+        {
+            PriorityMap::iterator i, iend;
+            iend = mPriorityGroups.end();
+            for (i = mPriorityGroups.begin(); i != iend; ++i)
+            {
+				if (destroy)
+					OGRE_DELETE i->second;
+				else
+					i->second->clear();
+            }
+
+			if (destroy)
+				mPriorityGroups.clear();
+
+        }
+
+		/** Indicate whether a given queue group will be doing any
+		shadow setup.
+		@remarks
+		This method allows you to inform the queue about a queue group, and to 
+		indicate whether this group will require shadow processing of any sort.
+		In order to preserve rendering order, OGRE has to treat queue groups
+		as very separate elements of the scene, and this can result in it
+		having to duplicate shadow setup for each group. Therefore, if you
+		know that a group which you are using will never need shadows, you
+		should preregister the group using this method in order to improve
+		the performance.
+		*/
+		void setShadowsEnabled(bool enabled) { mShadowsEnabled = enabled; }
+
+		/** Are shadows enabled for this queue? */
+		bool getShadowsEnabled(void) const { return mShadowsEnabled; }
+
+        /** Sets whether or not the queue will split passes by their lighting type,
+        ie ambient, per-light and decal. 
+        */
+        void setSplitPassesByLightingType(bool split)
+        {
+            mSplitPassesByLightingType = split;
+            PriorityMap::iterator i, iend;
+            iend = mPriorityGroups.end();
+            for (i = mPriorityGroups.begin(); i != iend; ++i)
+            {
+                i->second->setSplitPassesByLightingType(split);
+            }
+        }
+        /** Sets whether or not the queue will split passes which have shadow receive
+        turned off (in their parent material), which is needed when certain shadow
+        techniques are used.
+        */
+        void setSplitNoShadowPasses(bool split)
+        {
+            mSplitNoShadowPasses = split;
+            PriorityMap::iterator i, iend;
+            iend = mPriorityGroups.end();
+            for (i = mPriorityGroups.begin(); i != iend; ++i)
+            {
+                i->second->setSplitNoShadowPasses(split);
+            }
+        }
+		/** Sets whether or not objects which cast shadows should be treated as
+		never receiving shadows. 
+		*/
+		void setShadowCastersCannotBeReceivers(bool ind)
+		{
+			mShadowCastersNotReceivers = ind;
+			PriorityMap::iterator i, iend;
+			iend = mPriorityGroups.end();
+			for (i = mPriorityGroups.begin(); i != iend; ++i)
+			{
+				i->second->setShadowCastersCannotBeReceivers(ind);
+			}
+		}
+		/** Reset the organisation modes required for the solids in this group. 
+		@remarks
+			You can only do this when the group is empty, ie after clearing the 
+			queue.
+		@see QueuedRenderableCollection::OrganisationMode
+		*/
+		void resetOrganisationModes(void)
+		{
+			mOrganisationMode = 0;
+
+			PriorityMap::iterator i, iend;
+			iend = mPriorityGroups.end();
+			for (i = mPriorityGroups.begin(); i != iend; ++i)
+			{
+				i->second->resetOrganisationModes();
+			}
+		}
+		
+		/** Add a required sorting / grouping mode for the solids in this group.
+		@remarks
+			You can only do this when the group is empty, ie after clearing the 
+			queue.
+		@see QueuedRenderableCollection::OrganisationMode
+		*/
+		void addOrganisationMode(QueuedRenderableCollection::OrganisationMode om)
+		{
+			mOrganisationMode |= om;
+
+			PriorityMap::iterator i, iend;
+			iend = mPriorityGroups.end();
+			for (i = mPriorityGroups.begin(); i != iend; ++i)
+			{
+				i->second->addOrganisationMode(om);
+			}
+		}
+
+		/** Setthe  sorting / grouping mode for the solids in this group to the default.
+		@remarks
+			You can only do this when the group is empty, ie after clearing the 
+			queue.
+		@see QueuedRenderableCollection::OrganisationMode
+		*/
+		void defaultOrganisationMode(void)
+		{
+			mOrganisationMode = 0;
+
+			PriorityMap::iterator i, iend;
+			iend = mPriorityGroups.end();
+			for (i = mPriorityGroups.begin(); i != iend; ++i)
+			{
+				i->second->defaultOrganisationMode();
+			}
+		}
+
+		/** Merge group of renderables. 
+		*/
+		void merge( const RenderQueueGroup* rhs )
+		{
+			ConstPriorityMapIterator it = rhs->getIterator();
+
+			while( it.hasMoreElements() )
+			{
+				ushort priority = it.peekNextKey();
+				RenderPriorityGroup* pSrcPriorityGrp = it.getNext();
+				RenderPriorityGroup* pDstPriorityGrp;
+
+				// Check if priority group is there
+				PriorityMap::iterator i = mPriorityGroups.find(priority);
+				if (i == mPriorityGroups.end())
+				{
+					// Missing, create
+					pDstPriorityGrp = OGRE_NEW RenderPriorityGroup(this, 
+						mSplitPassesByLightingType,
+						mSplitNoShadowPasses, 
+						mShadowCastersNotReceivers);
+					if (mOrganisationMode)
+					{
+						pDstPriorityGrp->resetOrganisationModes();
+						pDstPriorityGrp->addOrganisationMode((QueuedRenderableCollection::OrganisationMode)mOrganisationMode);
+					}
+
+					mPriorityGroups.insert(PriorityMap::value_type(priority, pDstPriorityGrp));
+				}
+				else
+				{
+					pDstPriorityGrp = i->second;
+				}
+
+				// merge
+				pDstPriorityGrp->merge( pSrcPriorityGrp );
+			}
+		}
+    };
+
+	/** @} */
+	/** @} */
+
+
+}
+
+#endif
+
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreRenderSystem.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreRenderSystem.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreRenderSystem.h	(revision 148)
@@ -0,0 +1,1629 @@
+/*
+-----------------------------------------------------------------------------
+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 __RenderSystem_H_
+#define __RenderSystem_H_
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+
+#include "OgreString.h"
+
+#include "OgreTextureUnitState.h"
+#include "OgreCommon.h"
+
+#include "OgreMaterialManager.h"
+#include "OgreRenderOperation.h"
+#include "OgreRenderSystemCapabilities.h"
+#include "OgreRenderTarget.h"
+#include "OgreRenderTexture.h"
+#include "OgreFrameListener.h"
+#include "OgreConfigOptionMap.h"
+#include "OgreGpuProgram.h"
+#include "OgrePlane.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup RenderSystem
+	*  @{
+	*/
+
+	typedef vector<DepthBuffer*>::type DepthBufferVec;
+	typedef map< uint16, DepthBufferVec >::type DepthBufferMap;
+	typedef map< String, RenderTarget * >::type RenderTargetMap;
+	typedef multimap<uchar, RenderTarget * >::type RenderTargetPriorityMap;
+
+	class TextureManager;
+	/// Enum describing the ways to generate texture coordinates
+	enum TexCoordCalcMethod
+	{
+		/// No calculated texture coordinates
+		TEXCALC_NONE,
+		/// Environment map based on vertex normals
+		TEXCALC_ENVIRONMENT_MAP,
+		/// Environment map based on vertex positions
+		TEXCALC_ENVIRONMENT_MAP_PLANAR,
+		TEXCALC_ENVIRONMENT_MAP_REFLECTION,
+		TEXCALC_ENVIRONMENT_MAP_NORMAL,
+		/// Projective texture
+		TEXCALC_PROJECTIVE_TEXTURE
+	};
+	/// Enum describing the various actions which can be taken on the stencil buffer
+	enum StencilOperation
+	{
+		/// Leave the stencil buffer unchanged
+		SOP_KEEP,
+		/// Set the stencil value to zero
+		SOP_ZERO,
+		/// Set the stencil value to the reference value
+		SOP_REPLACE,
+		/// Increase the stencil value by 1, clamping at the maximum value
+		SOP_INCREMENT,
+		/// Decrease the stencil value by 1, clamping at 0
+		SOP_DECREMENT,
+		/// Increase the stencil value by 1, wrapping back to 0 when incrementing the maximum value
+		SOP_INCREMENT_WRAP,
+		/// Decrease the stencil value by 1, wrapping when decrementing 0
+		SOP_DECREMENT_WRAP,
+		/// Invert the bits of the stencil buffer
+		SOP_INVERT
+	};
+
+
+	/** Defines the functionality of a 3D API
+	@remarks
+	The RenderSystem class provides a base interface
+	which abstracts the general functionality of the 3D API
+	e.g. Direct3D or OpenGL. Whilst a few of the general
+	methods have implementations, most of this class is
+	abstract, requiring a subclass based on a specific API
+	to be constructed to provide the full functionality.
+	Note there are 2 levels to the interface - one which
+	will be used often by the caller of the Ogre library,
+	and one which is at a lower level and will be used by the
+	other classes provided by Ogre. These lower level
+	methods are prefixed with '_' to differentiate them.
+	The advanced user of the library may use these lower
+	level methods to access the 3D API at a more fundamental
+	level (dealing direct with render states and rendering
+	primitives), but still benefiting from Ogre's abstraction
+	of exactly which 3D API is in use.
+	@author
+	Steven Streeting
+	@version
+	1.0
+	*/
+	class _OgreExport RenderSystem : public RenderSysAlloc
+	{
+	public:
+		/** Default Constructor.
+		*/
+		RenderSystem();
+
+		/** Destructor.
+		*/
+		virtual ~RenderSystem();
+
+		/** Returns the name of the rendering system.
+		*/
+		virtual const String& getName(void) const = 0;
+
+		/** Returns the details of this API's configuration options
+		@remarks
+		Each render system must be able to inform the world
+		of what options must/can be specified for it's
+		operation.
+		@par
+		These are passed as strings for portability, but
+		grouped into a structure (_ConfigOption) which includes
+		both options and current value.
+		@par
+		Note that the settings returned from this call are
+		affected by the options that have been set so far,
+		since some options are interdependent.
+		@par
+		This routine is called automatically by the default
+		configuration dialogue produced by Root::showConfigDialog
+		or may be used by the caller for custom settings dialogs
+		@return
+		A 'map' of options, i.e. a list of options which is also
+		indexed by option name.
+		*/
+		virtual ConfigOptionMap& getConfigOptions(void) = 0;
+
+		/** Sets an option for this API
+		@remarks
+		Used to confirm the settings (normally chosen by the user) in
+		order to make the renderer able to initialise with the settings as required.
+		This may be video mode, D3D driver, full screen / windowed etc.
+		Called automatically by the default configuration
+		dialog, and by the restoration of saved settings.
+		These settings are stored and only activated when
+		RenderSystem::initialise or RenderSystem::reinitialise
+		are called.
+		@par
+		If using a custom configuration dialog, it is advised that the
+		caller calls RenderSystem::getConfigOptions
+		again, since some options can alter resulting from a selection.
+		@param
+		name The name of the option to alter.
+		@param
+		value The value to set the option to.
+		*/
+		virtual void setConfigOption(const String &name, const String &value) = 0;
+
+		/** Create an object for performing hardware occlusion queries. 
+		*/
+		virtual HardwareOcclusionQuery* createHardwareOcclusionQuery(void) = 0;
+
+		/** Destroy a hardware occlusion query object. 
+		*/
+		virtual void destroyHardwareOcclusionQuery(HardwareOcclusionQuery *hq);
+
+		/** Validates the options set for the rendering system, returning a message if there are problems.
+		@note
+		If the returned string is empty, there are no problems.
+		*/
+		virtual String validateConfigOptions(void) = 0;
+
+		/** Start up the renderer using the settings selected (Or the defaults if none have been selected).
+		@remarks
+		Called by Root::setRenderSystem. Shouldn't really be called
+		directly, although  this can be done if the app wants to.
+		@param
+		autoCreateWindow If true, creates a render window
+		automatically, based on settings chosen so far. This saves
+		an extra call to _createRenderWindow
+		for the main render window.
+		@param
+		windowTitle Sets the app window title
+		@return
+		A pointer to the automatically created window, if requested, otherwise null.
+		*/
+		virtual RenderWindow* _initialise(bool autoCreateWindow, const String& windowTitle = "OGRE Render Window");
+
+		/*
+		Returns whether under the current render system buffers marked as TU_STATIC can be locked for update
+		@remarks
+		Needed in the implementation of DirectX9 with DirectX9Ex driver
+		*/
+		virtual bool isStaticBufferLockable() const { return true; }
+
+		/** Query the real capabilities of the GPU and driver in the RenderSystem*/
+		virtual RenderSystemCapabilities* createRenderSystemCapabilities() const = 0;
+ 
+		/** Get a pointer to the current capabilities being used by the RenderSystem.
+		@remarks
+		The capabilities may be modified using this pointer, this will only have an effect
+		before the RenderSystem has been initialised. It's intended use is to allow a
+		listener of the RenderSystemCapabilitiesCreated event to customise the capabilities
+		on the fly before the RenderSystem is initialised.
+		*/
+		RenderSystemCapabilities* getMutableCapabilities(){ return mCurrentCapabilities; }
+
+		/** Force the render system to use the special capabilities. Can only be called
+		*    before the render system has been fully initializer (before createWindow is called) 
+		*	@param
+		*		 capabilities has to be a subset of the real capabilities and the caller is 
+		*		 responsible for deallocating capabilities.
+		*/
+		virtual void useCustomRenderSystemCapabilities(RenderSystemCapabilities* capabilities);
+
+		/** Restart the renderer (normally following a change in settings).
+		*/
+		virtual void reinitialise(void) = 0;
+
+		/** Shutdown the renderer and cleanup resources.
+		*/
+		virtual void shutdown(void);
+
+
+		/** Sets the colour & strength of the ambient (global directionless) light in the world.
+		*/
+		virtual void setAmbientLight(float r, float g, float b) = 0;
+
+		/** Sets the type of light shading required (default = Gouraud).
+		*/
+		virtual void setShadingType(ShadeOptions so) = 0;
+
+		/** Sets whether or not dynamic lighting is enabled.
+		@param
+		enabled If true, dynamic lighting is performed on geometry with normals supplied, geometry without
+		normals will not be displayed. If false, no lighting is applied and all geometry will be full brightness.
+		*/
+		virtual void setLightingEnabled(bool enabled) = 0;
+
+		/** Sets whether or not W-buffers are enabled if they are available for this renderer.
+		@param
+		enabled If true and the renderer supports them W-buffers will be used.  If false 
+		W-buffers will not be used even if available.  W-buffers are enabled by default 
+		for 16bit depth buffers and disabled for all other depths.
+		*/
+		void setWBufferEnabled(bool enabled);
+
+		/** Returns true if the renderer will try to use W-buffers when available.
+		*/
+		bool getWBufferEnabled(void) const;
+
+		/** Creates a new rendering window.
+		@remarks
+		This method creates a new rendering window as specified
+		by the paramteters. The rendering system could be
+		responible for only a single window (e.g. in the case
+		of a game), or could be in charge of multiple ones (in the
+		case of a level editor). The option to create the window
+		as a child of another is therefore given.
+		This method will create an appropriate subclass of
+		RenderWindow depending on the API and platform implementation.
+		@par
+		After creation, this window can be retrieved using getRenderTarget().
+		@param
+		name The name of the window. Used in other methods
+		later like setRenderTarget and getRenderTarget.
+		@param
+		width The width of the new window.
+		@param
+		height The height of the new window.
+		@param
+		fullScreen Specify true to make the window full screen
+		without borders, title bar or menu bar.
+		@param
+		miscParams A NameValuePairList describing the other parameters for the new rendering window. 
+		Options are case sensitive. Unrecognised parameters will be ignored silently.
+		These values might be platform dependent, but these are present for all platforms unless
+		indicated otherwise:
+		<table>
+		<tr>
+			<td><b>Key</b></td>
+			<td><b>Type/Values</b></td>
+			<td><b>Default</b></td>
+			<td><b>Description</b></td>
+			<td><b>Notes</b></td>
+		</tr>
+		<tr>
+			<td>title</td>
+			<td>Any string</td>
+			<td>RenderTarget name</td>
+			<td>The title of the window that will appear in the title bar</td>
+			<td>&nbsp;</td>
+		</tr>
+		<tr>
+			<td>colourDepth</td>
+			<td>16, 32</td>
+			<td>Desktop depth</td>
+			<td>Colour depth of the resulting rendering window; only applies if fullScreen</td>
+			<td>Win32 Specific</td>
+		</tr>
+		<tr>
+			<td>left</td>
+			<td>Positive integers</td>
+			<td>Centred</td>
+			<td>Screen x coordinate from left</td>
+			<td>&nbsp;</td>
+		</tr>
+		<tr>
+			<td>top</td>
+			<td>Positive integers</td>
+			<td>Centred</td>
+			<td>Screen y coordinate from left</td>
+			<td>&nbsp;</td>
+		</tr>
+		<tr>
+			<td>depthBuffer</td>
+			<td>true, false</td>
+			<td>true</td>
+			<td>Use depth buffer</td>
+			<td>DirectX9 specific</td>
+		</tr>
+		<tr>
+			<td>externalWindowHandle</td>
+			<td>Win32: HWND as integer<br/>
+			    GLX: poslong:posint:poslong (display*:screen:windowHandle) or poslong:posint:poslong:poslong (display*:screen:windowHandle:XVisualInfo*)<br/>
+                OS X: WindowRef for Carbon or NSWindow for Cocoa address as an integer
+                iOS: UIWindow address as an integer
+            </td>
+			<td>0 (none)</td>
+			<td>External window handle, for embedding the OGRE render in an existing window</td>
+			<td>&nbsp;</td>
+		</tr>
+		<tr>
+			<td>externalGLControl</td>
+			<td>true, false</td>
+			<td>false</td>
+			<td>Let the external window control OpenGL i.e. don't select a pixel format for the window,
+			do not change v-sync and do not swap buffer. When set to true, the calling application
+			is responsible of OpenGL initialization and buffer swapping. It should also create an
+			OpenGL context for its own rendering, Ogre will create one for its use. Then the calling
+			application must also enable Ogre OpenGL context before calling any Ogre function and
+			restore its OpenGL context after these calls.</td>
+			<td>OpenGL specific</td>
+		</tr>
+		<tr>
+			<td>externalGLContext</td>
+			<td>Context as Unsigned Long</td>
+			<td>0 (create own context)</td>
+			<td>Use an externally created GL context</td>
+			<td>OpenGL Specific</td>
+		</tr>
+		<tr>
+			<td>parentWindowHandle</td>
+			<td>Win32: HWND as integer<br/>
+			    GLX: poslong:posint:poslong (display*:screen:windowHandle) or poslong:posint:poslong:poslong (display*:screen:windowHandle:XVisualInfo*)</td>
+			<td>0 (none)</td>
+			<td>Parent window handle, for embedding the OGRE in a child of an external window</td>
+			<td>&nbsp;</td>
+		</tr>
+		<tr>
+			<td>macAPI</td>
+			<td>String: "cocoa" or "carbon"</td>
+			<td>"carbon"</td>
+			<td>Specifies the type of rendering window on the Mac Platform.</td>
+            <td>Mac OS X Specific</td>
+			<td>&nbsp;</td>
+		 </tr>
+		 <tr>
+			<td>macAPICocoaUseNSView</td>
+			<td>bool "true" or "false"</td>
+			<td>"false"</td>
+			<td>On the Mac platform the most diffused method to embed OGRE in a custom application is to use Interface Builder
+				and add to the interface an instance of OgreView.
+				The pointer to this instance is then used as "externalWindowHandle".
+				However, there are cases where you are NOT using Interface Builder and you get the Cocoa NSView* of an existing interface.
+				For example, this is happens when you want to render into a Java/AWT interface.
+				In short, by setting this flag to "true" the Ogre::Root::createRenderWindow interprets the "externalWindowHandle" as a NSView*
+				instead of an OgreView*. See OgreOSXCocoaView.h/mm.
+			</td>
+            <td>Mac OS X Specific</td>
+			<td>&nbsp;</td>
+		 </tr>
+         <tr>
+             <td>contentScalingFactor</td>
+             <td>Positive Float greater than 1.0</td>
+             <td>The default content scaling factor of the screen</td>
+             <td>Specifies the CAEAGLLayer content scaling factor.  Only supported on iOS 4 or greater.
+                 This can be useful to limit the resolution of the OpenGL ES backing store.  For example, the iPhone 4's
+                 native resolution is 960 x 640.  Windows are always 320 x 480, if you would like to limit the display
+                 to 720 x 480, specify 1.5 as the scaling factor.
+             </td>
+             <td>iOS Specific</td>
+             <td>&nbsp;</td>
+		 </tr>
+         <tr>
+             <td>externalViewHandle</td>
+             <td>UIView pointer as an integer</td>
+             <td>0</td>
+             <td>External view handle, for rendering OGRE render in an existing view</td>
+             <td>iOS Specific</td>
+             <td>&nbsp;</td>
+         </tr>
+         <tr>
+             <td>externalViewControllerHandle</td>
+             <td>UIViewController pointer as an integer</td>
+             <td>0</td>
+             <td>External view controller handle, for embedding OGRE in an existing view controller</td>
+             <td>iOS Specific</td>
+             <td>&nbsp;</td>
+         </tr>
+         <tr>
+             <td>externalSharegroup</td>
+             <td>EAGLSharegroup pointer as an integer</td>
+             <td>0</td>
+             <td>External sharegroup, used to shared GL resources between contexts</td>
+             <td>iOS Specific</td>
+             <td>&nbsp;</td>
+         </tr>
+         <tr>
+             <td>Full Screen</td>
+             <td>true, false</td>
+             <td>false</td>
+             <td>Specify whether to create the window in full screen mode</td>
+             <td>OS X Specific</td>
+             <td>&nbsp;</td>
+         </tr>
+         <tr>
+			<td>FSAA</td>
+			<td>Positive integer (usually 0, 2, 4, 8, 16)</td>
+			<td>0</td>
+			<td>Full screen antialiasing factor</td>
+			<td>&nbsp;</td>
+		</tr>
+		<tr>
+			<td>FSAAHint</td>
+			<td>Depends on RenderSystem and hardware. Currently supports:<br/>
+			"Quality": on systems that have an option to prefer higher AA quality over speed, use it</td>
+			<td>Blank</td>
+			<td>Full screen antialiasing hint</td>
+			<td>&nbsp;</td>
+		</tr>
+		<tr>
+			<td>displayFrequency</td>
+			<td>Refresh rate in Hertz (e.g. 60, 75, 100)</td>
+			<td>Desktop vsync rate</td>
+			<td>Display frequency rate, for fullscreen mode</td>
+			<td>&nbsp;</td>
+		</tr>
+		<tr>
+			<td>vsync</td>
+			<td>true, false</td>
+			<td>false</td>
+			<td>Synchronize buffer swaps to monitor vsync, eliminating tearing at the expense of a fixed frame rate</td>
+			<td>&nbsp;</td>
+		</tr>
+		<tr>
+			<td>vsyncInterval</td>
+			<td>1, 2, 3, 4</td>
+			<td>1</td>
+			<td>If vsync is enabled, the minimum number of vertical blanks that should occur between renders. 
+			For example if vsync is enabled, the refresh rate is 60 and this is set to 2, then the
+			frame rate will be locked at 30.</td>
+			<td>&nbsp;</td>
+		</tr>
+		<tr>
+			<td>border</td>
+			<td>none, fixed, resize</td>
+			<td>resize</td>
+			<td>The type of window border (in windowed mode)</td>
+			<td>&nbsp;</td>
+		</tr>
+		<tr>
+			<td>outerDimensions</td>
+			<td>true, false</td>
+			<td>false</td>
+			<td>Whether the width/height is expressed as the size of the 
+			outer window, rather than the content area</td>
+			<td>&nbsp;</td>
+		</tr>
+		<tr>
+			<td>useNVPerfHUD</td>
+			<td>true, false</td>
+			<td>false</td>
+			<td>Enable the use of nVidia NVPerfHUD</td>
+			<td>&nbsp;</td>
+		</tr>
+		<tr>
+			<td>gamma</td>
+			<td>true, false</td>
+			<td>false</td>
+			<td>Enable hardware conversion from linear colour space to gamma
+			colour space on rendering to the window.</td>
+			<td>&nbsp;</td>
+		</tr>
+		<tr>
+			<td>enableDoubleClick</td>
+			<td>true, false</td>
+			<td>false</td>
+			<td>Enable the window to keep track and transmit double click messages.</td>
+			<td>Win32 Specific</td>
+		</tr>
+		
+		*/
+		virtual RenderWindow* _createRenderWindow(const String &name, unsigned int width, unsigned int height, 
+			bool fullScreen, const NameValuePairList *miscParams = 0) = 0;
+
+		/** Creates multiple rendering windows.		
+		@param
+		renderWindowDescriptions Array of structures containing the descriptions of each render window.
+		The structure's members are the same as the parameters of _createRenderWindow:
+		* name
+		* width
+		* height
+		* fullScreen
+		* miscParams
+		See _createRenderWindow for details about each member.		
+		@param
+		createdWindows This array will hold the created render windows.
+		@return
+		true on success.		
+		*/
+		virtual bool _createRenderWindows(const RenderWindowDescriptionList& renderWindowDescriptions, 
+			RenderWindowList& createdWindows);
+
+		
+		/**	Create a MultiRenderTarget, which is a render target that renders to multiple RenderTextures
+		at once. Surfaces can be bound and unbound at will.
+		This fails if mCapabilities->getNumMultiRenderTargets() is smaller than 2.
+		*/
+		virtual MultiRenderTarget * createMultiRenderTarget(const String & name) = 0; 
+
+		/** Destroys a render window */
+		virtual void destroyRenderWindow(const String& name);
+		/** Destroys a render texture */
+		virtual void destroyRenderTexture(const String& name);
+		/** Destroys a render target of any sort */
+		virtual void destroyRenderTarget(const String& name);
+
+		/** Attaches the passed render target to the render system.
+		*/
+		virtual void attachRenderTarget( RenderTarget &target );
+		/** Returns a pointer to the render target with the passed name, or NULL if that
+		render target cannot be found.
+		*/
+		virtual RenderTarget * getRenderTarget( const String &name );
+		/** Detaches the render target with the passed name from the render system and
+		returns a pointer to it.
+		@note
+		If the render target cannot be found, NULL is returned.
+		*/
+		virtual RenderTarget * detachRenderTarget( const String &name );
+
+		/// Iterator over RenderTargets
+		typedef MapIterator<Ogre::RenderTargetMap> RenderTargetIterator;
+
+		/** Returns a specialised MapIterator over all render targets attached to the RenderSystem. */
+		virtual RenderTargetIterator getRenderTargetIterator(void) {
+			return RenderTargetIterator( mRenderTargets.begin(), mRenderTargets.end() );
+		}
+		/** Returns a description of an error code.
+		*/
+		virtual String getErrorDescription(long errorNumber) const = 0;
+
+		/** Returns the global instance vertex buffer.
+		*/
+        HardwareVertexBufferSharedPtr getGlobalInstanceVertexBuffer() const;
+		/** Sets the global instance vertex buffer.
+		*/
+        void setGlobalInstanceVertexBuffer(const HardwareVertexBufferSharedPtr &val);
+		/** Gets vertex declaration for the global vertex buffer for the global instancing
+		*/
+        VertexDeclaration* getGlobalInstanceVertexBufferVertexDeclaration() const;
+		/** Sets vertex declaration for the global vertex buffer for the global instancing
+		*/
+        void setGlobalInstanceVertexBufferVertexDeclaration( VertexDeclaration* val);
+		/** Gets the global number of instances.
+		*/
+        size_t getGlobalNumberOfInstances() const;
+		/** Sets the global number of instances.
+		*/
+        void setGlobalNumberOfInstances(const size_t val);
+
+		/** Sets if fixed pipeline rendering is enabled on the system.
+		*/
+		void setFixedPipelineEnabled(bool enabled);
+
+		/** Returns true if fixed pipeline rendering is enabled on the system.
+		*/
+		bool getFixedPipelineEnabled(void) const;
+
+		/** Retrieves an existing DepthBuffer or creates a new one suited for the given RenderTarget
+			and sets it.
+			@remarks
+				RenderTarget's pool ID is respected. @see RenderTarget::setDepthBufferPool()
+		*/
+		virtual void setDepthBufferFor( RenderTarget *renderTarget );
+
+		// ------------------------------------------------------------------------
+		//                     Internal Rendering Access
+		// All methods below here are normally only called by other OGRE classes
+		// They can be called by library user if required
+		// ------------------------------------------------------------------------
+
+
+		/** Tells the rendersystem to use the attached set of lights (and no others) 
+		up to the number specified (this allows the same list to be used with different
+		count limits) */
+		virtual void _useLights(const LightList& lights, unsigned short limit) = 0;
+		/** Are fixed-function lights provided in view space? Affects optimisation. 
+		*/
+		virtual bool areFixedFunctionLightsInViewSpace() const { return false; }
+		/** Sets the world transform matrix. */
+		virtual void _setWorldMatrix(const Matrix4 &m) = 0;
+		/** Sets multiple world matrices (vertex blending). */
+		virtual void _setWorldMatrices(const Matrix4* m, unsigned short count);
+		/** Sets the view transform matrix */
+		virtual void _setViewMatrix(const Matrix4 &m) = 0;
+		/** Sets the projection transform matrix */
+		virtual void _setProjectionMatrix(const Matrix4 &m) = 0;
+		/** Utility function for setting all the properties of a texture unit at once.
+		This method is also worth using over the individual texture unit settings because it
+		only sets those settings which are different from the current settings for this
+		unit, thus minimising render state changes.
+		*/
+		virtual void _setTextureUnitSettings(size_t texUnit, TextureUnitState& tl);
+		/** Turns off a texture unit. */
+		virtual void _disableTextureUnit(size_t texUnit);
+		/** Disables all texture units from the given unit upwards */
+		virtual void _disableTextureUnitsFrom(size_t texUnit);
+		/** Sets the surface properties to be used for future rendering.
+
+		This method sets the the properties of the surfaces of objects
+		to be rendered after it. In this context these surface properties
+		are the amount of each type of light the object reflects (determining
+		it's colour under different types of light), whether it emits light
+		itself, and how shiny it is. Textures are not dealt with here,
+		see the _setTetxure method for details.
+		This method is used by _setMaterial so does not need to be called
+		direct if that method is being used.
+
+		@param ambient The amount of ambient (sourceless and directionless)
+		light an object reflects. Affected by the colour/amount of ambient light in the scene.
+		@param diffuse The amount of light from directed sources that is
+		reflected (affected by colour/amount of point, directed and spot light sources)
+		@param specular The amount of specular light reflected. This is also
+		affected by directed light sources but represents the colour at the
+		highlights of the object.
+		@param emissive The colour of light emitted from the object. Note that
+		this will make an object seem brighter and not dependent on lights in
+		the scene, but it will not act as a light, so will not illuminate other
+		objects. Use a light attached to the same SceneNode as the object for this purpose.
+		@param shininess A value which only has an effect on specular highlights (so
+		specular must be non-black). The higher this value, the smaller and crisper the
+		specular highlights will be, imitating a more highly polished surface.
+		This value is not constrained to 0.0-1.0, in fact it is likely to
+		be more (10.0 gives a modest sheen to an object).
+		@param tracking A bit field that describes which of the ambient, diffuse, specular
+		and emissive colours follow the vertex colour of the primitive. When a bit in this field is set
+		its ColourValue is ignored. This is a combination of TVC_AMBIENT, TVC_DIFFUSE, TVC_SPECULAR(note that the shininess value is still
+		taken from shininess) and TVC_EMISSIVE. TVC_NONE means that there will be no material property
+		tracking the vertex colours.
+		*/
+		virtual void _setSurfaceParams(const ColourValue &ambient,
+			const ColourValue &diffuse, const ColourValue &specular,
+			const ColourValue &emissive, Real shininess,
+			TrackVertexColourType tracking = TVC_NONE) = 0;
+
+		/** Sets whether or not rendering points using OT_POINT_LIST will 
+		render point sprites (textured quads) or plain points.
+		@param enabled True enables point sprites, false returns to normal
+		point rendering.
+		*/	
+		virtual void _setPointSpritesEnabled(bool enabled) = 0;
+
+		/** Sets the size of points and how they are attenuated with distance.
+		@remarks
+		When performing point rendering or point sprite rendering,
+		point size can be attenuated with distance. The equation for
+		doing this is attenuation = 1 / (constant + linear * dist + quadratic * d^2) .
+		@par
+		For example, to disable distance attenuation (constant screensize) 
+		you would set constant to 1, and linear and quadratic to 0. A
+		standard perspective attenuation would be 0, 1, 0 respectively.
+		*/
+		virtual void _setPointParameters(Real size, bool attenuationEnabled, 
+			Real constant, Real linear, Real quadratic, Real minSize, Real maxSize) = 0;
+
+
+		/**
+		Sets the texture to bind to a given texture unit.
+
+		User processes would not normally call this direct unless rendering
+		primitives themselves.
+
+		@param unit The index of the texture unit to modify. Multitexturing 
+		hardware can support multiple units (see 
+		RenderSystemCapabilites::getNumTextureUnits)
+		@param enabled Boolean to turn the unit on/off
+		@param texPtr Pointer to the texture to use.
+		*/
+		virtual void _setTexture(size_t unit, bool enabled, 
+			const TexturePtr &texPtr) = 0;
+		/**
+		Sets the texture to bind to a given texture unit.
+
+		User processes would not normally call this direct unless rendering
+		primitives themselves.
+
+		@param unit The index of the texture unit to modify. Multitexturing 
+		hardware can support multiple units (see 
+		RenderSystemCapabilites::getNumTextureUnits)
+		@param enabled Boolean to turn the unit on/off
+		@param texname The name of the texture to use - this should have
+		already been loaded with TextureManager::load.
+		*/
+		virtual void _setTexture(size_t unit, bool enabled, const String &texname);
+
+		/** Binds a texture to a vertex sampler.
+		@remarks
+		Not all rendersystems support separate vertex samplers. For those that
+		do, you can set a texture for them, separate to the regular texture
+		samplers, using this method. For those that don't, you should use the
+		regular texture samplers which are shared between the vertex and
+		fragment units; calling this method will throw an exception.
+		@see RenderSystemCapabilites::getVertexTextureUnitsShared
+		*/
+		virtual void _setVertexTexture(size_t unit, const TexturePtr& tex);
+
+		/**
+		Sets the texture coordinate set to use for a texture unit.
+
+		Meant for use internally - not generally used directly by apps - the Material and TextureUnitState
+		classes let you manage textures far more easily.
+
+		@param unit Texture unit as above
+		@param index The index of the texture coordinate set to use.
+		*/
+		virtual void _setTextureCoordSet(size_t unit, size_t index) = 0;
+
+		/**
+		Sets a method for automatically calculating texture coordinates for a stage.
+		Should not be used by apps - for use by Ogre only.
+		@param unit Texture unit as above
+		@param m Calculation method to use
+		@param frustum Optional Frustum param, only used for projective effects
+		*/
+		virtual void _setTextureCoordCalculation(size_t unit, TexCoordCalcMethod m, 
+			const Frustum* frustum = 0) = 0;
+
+		/** Sets the texture blend modes from a TextureUnitState record.
+		Meant for use internally only - apps should use the Material
+		and TextureUnitState classes.
+		@param unit Texture unit as above
+		@param bm Details of the blending mode
+		*/
+		virtual void _setTextureBlendMode(size_t unit, const LayerBlendModeEx& bm) = 0;
+
+		/** Sets the filtering options for a given texture unit.
+		@param unit The texture unit to set the filtering options for
+		@param minFilter The filter used when a texture is reduced in size
+		@param magFilter The filter used when a texture is magnified
+		@param mipFilter The filter used between mipmap levels, FO_NONE disables mipmapping
+		*/
+		virtual void _setTextureUnitFiltering(size_t unit, FilterOptions minFilter,
+			FilterOptions magFilter, FilterOptions mipFilter);
+
+		/** Sets a single filter for a given texture unit.
+		@param unit The texture unit to set the filtering options for
+		@param ftype The filter type
+		@param filter The filter to be used
+		*/
+		virtual void _setTextureUnitFiltering(size_t unit, FilterType ftype, FilterOptions filter) = 0;
+
+		/** Sets whether the compare func is enabled or not for this texture unit 
+		@param unit The texture unit to set the filtering options for
+		@param compare The state (enabled/disabled)
+		*/
+		virtual void _setTextureUnitCompareEnabled(size_t unit, bool compare) = 0;
+
+
+		/** Sets the compare function to use for a given texture unit
+		@param unit The texture unit to set the filtering options for
+		@param function The comparison function
+		*/
+		virtual void _setTextureUnitCompareFunction(size_t unit, CompareFunction function) = 0;
+
+
+		/** Sets the maximal anisotropy for the specified texture unit.*/
+		virtual void _setTextureLayerAnisotropy(size_t unit, unsigned int maxAnisotropy) = 0;
+
+		/** Sets the texture addressing mode for a texture unit.*/
+		virtual void _setTextureAddressingMode(size_t unit, const TextureUnitState::UVWAddressingMode& uvw) = 0;
+
+		/** Sets the texture border colour for a texture unit.*/
+		virtual void _setTextureBorderColour(size_t unit, const ColourValue& colour) = 0;
+
+		/** Sets the mipmap bias value for a given texture unit.
+		@remarks
+		This allows you to adjust the mipmap calculation up or down for a
+		given texture unit. Negative values force a larger mipmap to be used, 
+		positive values force a smaller mipmap to be used. Units are in numbers
+		of levels, so +1 forces the mipmaps to one smaller level.
+		@note Only does something if render system has capability RSC_MIPMAP_LOD_BIAS.
+		*/
+		virtual void _setTextureMipmapBias(size_t unit, float bias) = 0;
+
+		/** Sets the texture coordinate transformation matrix for a texture unit.
+		@param unit Texture unit to affect
+		@param xform The 4x4 matrix
+		*/
+		virtual void _setTextureMatrix(size_t unit, const Matrix4& xform) = 0;
+
+		/** Sets the global blending factors for combining subsequent renders with the existing frame contents.
+		The result of the blending operation is:
+		<p align="center">final = (texture * sourceFactor) + (pixel * destFactor)</p>
+		Each of the factors is specified as one of a number of options, as specified in the SceneBlendFactor
+		enumerated type.
+		By changing the operation you can change addition between the source and destination pixels to a different operator.
+		@param sourceFactor The source factor in the above calculation, i.e. multiplied by the texture colour components.
+		@param destFactor The destination factor in the above calculation, i.e. multiplied by the pixel colour components.
+		@param op The blend operation mode for combining pixels
+		*/
+		virtual void _setSceneBlending(SceneBlendFactor sourceFactor, SceneBlendFactor destFactor, SceneBlendOperation op = SBO_ADD) = 0;
+
+		/** Sets the global blending factors for combining subsequent renders with the existing frame contents.
+		The result of the blending operation is:
+		<p align="center">final = (texture * sourceFactor) + (pixel * destFactor)</p>
+		Each of the factors is specified as one of a number of options, as specified in the SceneBlendFactor
+		enumerated type.
+		@param sourceFactor The source factor in the above calculation, i.e. multiplied by the texture colour components.
+		@param destFactor The destination factor in the above calculation, i.e. multiplied by the pixel colour components.
+		@param sourceFactorAlpha The source factor in the above calculation for the alpha channel, i.e. multiplied by the texture alpha components.
+		@param destFactorAlpha The destination factor in the above calculation for the alpha channel, i.e. multiplied by the pixel alpha components.
+		@param op The blend operation mode for combining pixels
+		@param alphaOp The blend operation mode for combining pixel alpha values
+		*/
+		virtual void _setSeparateSceneBlending(SceneBlendFactor sourceFactor, SceneBlendFactor destFactor, SceneBlendFactor sourceFactorAlpha, 
+			SceneBlendFactor destFactorAlpha, SceneBlendOperation op = SBO_ADD, SceneBlendOperation alphaOp = SBO_ADD) = 0;
+
+		/** Sets the global alpha rejection approach for future renders.
+		By default images are rendered regardless of texture alpha. This method lets you change that.
+		@param func The comparison function which must pass for a pixel to be written.
+		@param value The value to compare each pixels alpha value to (0-255)
+		@param alphaToCoverage Whether to enable alpha to coverage, if supported
+		*/
+		virtual void _setAlphaRejectSettings(CompareFunction func, unsigned char value, bool alphaToCoverage) = 0;
+
+		/** Notify the rendersystem that it should adjust texture projection to be 
+			relative to a different origin.
+		*/
+		virtual void _setTextureProjectionRelativeTo(bool enabled, const Vector3& pos);
+
+		/** Creates a DepthBuffer that can be attached to the specified RenderTarget
+			@remarks
+				It doesn't attach anything, it just returns a pointer to a new DepthBuffer
+				Caller is responsible for putting this buffer into the right pool, for
+				attaching, and deleting it. Here's where API-specific magic happens.
+				Don't call this directly unless you know what you're doing.
+		*/
+		virtual DepthBuffer* _createDepthBufferFor( RenderTarget *renderTarget ) = 0;
+
+		/** Removes all depth buffers. Should be called on device lost and shutdown
+			@remarks
+				Advanced users can call this directly with bCleanManualBuffers=false to
+				remove all depth buffers created for RTTs; when they think the pool has
+				grown too big or they've used lots of depth buffers they don't need anymore,
+				freeing GPU RAM.
+		*/
+		void _cleanupDepthBuffers( bool bCleanManualBuffers=true );
+
+		/**
+		* Signifies the beginning of a frame, i.e. the start of rendering on a single viewport. Will occur
+		* several times per complete frame if multiple viewports exist.
+		*/
+		virtual void _beginFrame(void) = 0;
+		
+		//Dummy structure for render system contexts - implementing RenderSystems can extend
+		//as needed
+		struct RenderSystemContext { };
+		/**
+		* Pause rendering for a frame. This has to be called after _beginFrame and before _endFrame.
+		* Will usually be called by the SceneManager, don't use this manually unless you know what
+		* you are doing.
+		*/
+		virtual RenderSystemContext* _pauseFrame(void);
+		/**
+		* Resume rendering for a frame. This has to be called after a _pauseFrame call
+		* Will usually be called by the SceneManager, don't use this manually unless you know what
+		* you are doing.
+		* @param context the render system context, as returned by _pauseFrame
+		*/
+		virtual void _resumeFrame(RenderSystemContext* context);
+
+		/**
+		* Ends rendering of a frame to the current viewport.
+		*/
+		virtual void _endFrame(void) = 0;
+		/**
+		Sets the provided viewport as the active one for future
+		rendering operations. This viewport is aware of it's own
+		camera and render target. Must be implemented by subclass.
+
+		@param vp Pointer to the appropriate viewport.
+		*/
+		virtual void _setViewport(Viewport *vp) = 0;
+		/** Get the current active viewport for rendering. */
+		virtual Viewport* _getViewport(void);
+
+		/** Sets the culling mode for the render system based on the 'vertex winding'.
+		A typical way for the rendering engine to cull triangles is based on the
+		'vertex winding' of triangles. Vertex winding refers to the direction in
+		which the vertices are passed or indexed to in the rendering operation as viewed
+		from the camera, and will wither be clockwise or anticlockwise (that's 'counterclockwise' for
+		you Americans out there ;) The default is CULL_CLOCKWISE i.e. that only triangles whose vertices
+		are passed/indexed in anticlockwise order are rendered - this is a common approach and is used in 3D studio models
+		for example. You can alter this culling mode if you wish but it is not advised unless you know what you are doing.
+		You may wish to use the CULL_NONE option for mesh data that you cull yourself where the vertex
+		winding is uncertain.
+		*/
+		virtual void _setCullingMode(CullingMode mode) = 0;
+
+		virtual CullingMode _getCullingMode(void) const;
+
+		/** Sets the mode of operation for depth buffer tests from this point onwards.
+		Sometimes you may wish to alter the behaviour of the depth buffer to achieve
+		special effects. Because it's unlikely that you'll set these options for an entire frame,
+		but rather use them to tweak settings between rendering objects, this is an internal
+		method (indicated by the '_' prefix) which will be used by a SceneManager implementation
+		rather than directly from the client application.
+		If this method is never called the settings are automatically the same as the default parameters.
+		@param depthTest If true, the depth buffer is tested for each pixel and the frame buffer is only updated
+		if the depth function test succeeds. If false, no test is performed and pixels are always written.
+		@param depthWrite If true, the depth buffer is updated with the depth of the new pixel if the depth test succeeds.
+		If false, the depth buffer is left unchanged even if a new pixel is written.
+		@param depthFunction Sets the function required for the depth test.
+		*/
+		virtual void _setDepthBufferParams(bool depthTest = true, bool depthWrite = true, CompareFunction depthFunction = CMPF_LESS_EQUAL) = 0;
+
+		/** Sets whether or not the depth buffer check is performed before a pixel write.
+		@param enabled If true, the depth buffer is tested for each pixel and the frame buffer is only updated
+		if the depth function test succeeds. If false, no test is performed and pixels are always written.
+		*/
+		virtual void _setDepthBufferCheckEnabled(bool enabled = true) = 0;
+		/** Sets whether or not the depth buffer is updated after a pixel write.
+		@param enabled If true, the depth buffer is updated with the depth of the new pixel if the depth test succeeds.
+		If false, the depth buffer is left unchanged even if a new pixel is written.
+		*/
+		virtual void _setDepthBufferWriteEnabled(bool enabled = true) = 0;
+		/** Sets the comparison function for the depth buffer check.
+		Advanced use only - allows you to choose the function applied to compare the depth values of
+		new and existing pixels in the depth buffer. Only an issue if the deoth buffer check is enabled
+		(see _setDepthBufferCheckEnabled)
+		@param  func The comparison between the new depth and the existing depth which must return true
+		for the new pixel to be written.
+		*/
+		virtual void _setDepthBufferFunction(CompareFunction func = CMPF_LESS_EQUAL) = 0;
+		/** Sets whether or not colour buffer writing is enabled, and for which channels. 
+		@remarks
+		For some advanced effects, you may wish to turn off the writing of certain colour
+		channels, or even all of the colour channels so that only the depth buffer is updated
+		in a rendering pass. However, the chances are that you really want to use this option
+		through the Material class.
+		@param red, green, blue, alpha Whether writing is enabled for each of the 4 colour channels. */
+		virtual void _setColourBufferWriteEnabled(bool red, bool green, bool blue, bool alpha) = 0;
+		/** Sets the depth bias, NB you should use the Material version of this. 
+		@remarks
+		When polygons are coplanar, you can get problems with 'depth fighting' where
+		the pixels from the two polys compete for the same screen pixel. This is particularly
+		a problem for decals (polys attached to another surface to represent details such as
+		bulletholes etc.).
+		@par
+		A way to combat this problem is to use a depth bias to adjust the depth buffer value
+		used for the decal such that it is slightly higher than the true value, ensuring that
+		the decal appears on top.
+		@note
+		The final bias value is a combination of a constant bias and a bias proportional
+		to the maximum depth slope of the polygon being rendered. The final bias
+		is constantBias + slopeScaleBias * maxslope. Slope scale biasing is
+		generally preferable but is not available on older hardware.
+		@param constantBias The constant bias value, expressed as a value in 
+		homogeneous depth coordinates.
+		@param slopeScaleBias The bias value which is factored by the maximum slope
+		of the polygon, see the description above. This is not supported by all
+		cards.
+
+		*/
+		virtual void _setDepthBias(float constantBias, float slopeScaleBias = 0.0f) = 0;
+		/** Sets the fogging mode for future geometry.
+		@param mode Set up the mode of fog as described in the FogMode enum, or set to FOG_NONE to turn off.
+		@param colour The colour of the fog. Either set this to the same as your viewport background colour,
+		or to blend in with a skydome or skybox.
+		@param expDensity The density of the fog in FOG_EXP or FOG_EXP2 mode, as a value between 0 and 1. The default is 1. i.e. completely opaque, lower values can mean
+		that fog never completely obscures the scene.
+		@param linearStart Distance at which linear fog starts to encroach. The distance must be passed
+		as a parametric value between 0 and 1, with 0 being the near clipping plane, and 1 being the far clipping plane. Only applicable if mode is FOG_LINEAR.
+		@param linearEnd Distance at which linear fog becomes completely opaque.The distance must be passed
+		as a parametric value between 0 and 1, with 0 being the near clipping plane, and 1 being the far clipping plane. Only applicable if mode is FOG_LINEAR.
+		*/
+		virtual void _setFog(FogMode mode = FOG_NONE, const ColourValue& colour = ColourValue::White, Real expDensity = 1.0, Real linearStart = 0.0, Real linearEnd = 1.0) = 0;
+
+
+		/** The RenderSystem will keep a count of tris rendered, this resets the count. */
+		virtual void _beginGeometryCount(void);
+		/** Reports the number of tris rendered since the last _beginGeometryCount call. */
+		virtual unsigned int _getFaceCount(void) const;
+		/** Reports the number of batches rendered since the last _beginGeometryCount call. */
+		virtual unsigned int _getBatchCount(void) const;
+		/** Reports the number of vertices passed to the renderer since the last _beginGeometryCount call. */
+		virtual unsigned int _getVertexCount(void) const;
+
+		/** Generates a packed data version of the passed in ColourValue suitable for
+		use as with this RenderSystem.
+		@remarks
+		Since different render systems have different colour data formats (eg
+		RGBA for GL, ARGB for D3D) this method allows you to use 1 method for all.
+		@param colour The colour to convert
+		@param pDest Pointer to location to put the result.
+		*/
+		virtual void convertColourValue(const ColourValue& colour, uint32* pDest);
+		/** Get the native VertexElementType for a compact 32-bit colour value
+		for this rendersystem.
+		*/
+		virtual VertexElementType getColourVertexElementType(void) const = 0;
+
+		/** Converts a uniform projection matrix to suitable for this render system.
+		@remarks
+		Because different APIs have different requirements (some incompatible) for the
+		projection matrix, this method allows each to implement their own correctly and pass
+		back a generic OGRE matrix for storage in the engine.
+		*/
+		virtual void _convertProjectionMatrix(const Matrix4& matrix,
+			Matrix4& dest, bool forGpuProgram = false) = 0;
+
+		/** Builds a perspective projection matrix suitable for this render system.
+		@remarks
+		Because different APIs have different requirements (some incompatible) for the
+		projection matrix, this method allows each to implement their own correctly and pass
+		back a generic OGRE matrix for storage in the engine.
+		*/
+		virtual void _makeProjectionMatrix(const Radian& fovy, Real aspect, Real nearPlane, Real farPlane, 
+			Matrix4& dest, bool forGpuProgram = false) = 0;
+
+		/** Builds a perspective projection matrix for the case when frustum is
+		not centered around camera.
+		@remarks
+		Viewport coordinates are in camera coordinate frame, i.e. camera is 
+		at the origin.
+		*/
+		virtual void _makeProjectionMatrix(Real left, Real right, Real bottom, Real top, 
+			Real nearPlane, Real farPlane, Matrix4& dest, bool forGpuProgram = false) = 0;
+		/** Builds an orthographic projection matrix suitable for this render system.
+		@remarks
+		Because different APIs have different requirements (some incompatible) for the
+		projection matrix, this method allows each to implement their own correctly and pass
+		back a generic OGRE matrix for storage in the engine.
+		*/
+		virtual void _makeOrthoMatrix(const Radian& fovy, Real aspect, Real nearPlane, Real farPlane, 
+			Matrix4& dest, bool forGpuProgram = false) = 0;
+
+		/** Update a perspective projection matrix to use 'oblique depth projection'.
+		@remarks
+		This method can be used to change the nature of a perspective 
+		transform in order to make the near plane not perpendicular to the 
+		camera view direction, but to be at some different orientation. 
+		This can be useful for performing arbitrary clipping (e.g. to a 
+		reflection plane) which could otherwise only be done using user
+		clip planes, which are more expensive, and not necessarily supported
+		on all cards.
+		@param matrix The existing projection matrix. Note that this must be a
+		perspective transform (not orthographic), and must not have already
+		been altered by this method. The matrix will be altered in-place.
+		@param plane The plane which is to be used as the clipping plane. This
+		plane must be in CAMERA (view) space.
+		@param forGpuProgram Is this for use with a Gpu program or fixed-function
+		*/
+		virtual void _applyObliqueDepthProjection(Matrix4& matrix, const Plane& plane, 
+			bool forGpuProgram) = 0;
+
+		/** Sets how to rasterise triangles, as points, wireframe or solid polys. */
+		virtual void _setPolygonMode(PolygonMode level) = 0;
+
+		/** Turns stencil buffer checking on or off. 
+		@remarks
+		Stencilling (masking off areas of the rendering target based on the stencil 
+		buffer) can be turned on or off using this method. By default, stencilling is
+		disabled.
+		*/
+		virtual void setStencilCheckEnabled(bool enabled) = 0;
+		/** Determines if this system supports hardware accelerated stencil buffer. 
+		@remarks
+		Note that the lack of this function doesn't mean you can't do stencilling, but
+		the stencilling operations will be provided in software, which will NOT be
+		fast.
+		@par
+		Generally hardware stencils are only supported in 32-bit colour modes, because
+		the stencil buffer shares the memory of the z-buffer, and in most cards the 
+		z-buffer has to be the same depth as the colour buffer. This means that in 32-bit
+		mode, 24 bits of the z-buffer are depth and 8 bits are stencil. In 16-bit mode there
+		is no room for a stencil (although some cards support a 15:1 depth:stencil option,
+		this isn't useful for very much) so 8 bits of stencil are provided in software.
+		This can mean that if you use stencilling, your applications may be faster in 
+		32-but colour than in 16-bit, which may seem odd to some people.
+		*/
+		/*virtual bool hasHardwareStencil(void) = 0;*/
+
+		/** This method allows you to set all the stencil buffer parameters in one call.
+		@remarks
+		The stencil buffer is used to mask out pixels in the render target, allowing
+		you to do effects like mirrors, cut-outs, stencil shadows and more. Each of
+		your batches of rendering is likely to ignore the stencil buffer, 
+		update it with new values, or apply it to mask the output of the render.
+		The stencil test is:<PRE>
+		(Reference Value & Mask) CompareFunction (Stencil Buffer Value & Mask)</PRE>
+		The result of this will cause one of 3 actions depending on whether the test fails,
+		succeeds but with the depth buffer check still failing, or succeeds with the
+		depth buffer check passing too.
+		@par
+		Unlike other render states, stencilling is left for the application to turn
+		on and off when it requires. This is because you are likely to want to change
+		parameters between batches of arbitrary objects and control the ordering yourself.
+		In order to batch things this way, you'll want to use OGRE's separate render queue
+		groups (see RenderQueue) and register a RenderQueueListener to get notifications
+		between batches.
+		@par
+		There are individual state change methods for each of the parameters set using 
+		this method. 
+		Note that the default values in this method represent the defaults at system 
+		start up too.
+		@param func The comparison function applied.
+		@param refValue The reference value used in the comparison
+		@param compareMask The bitmask applied to both the stencil value and the reference value 
+		before comparison
+		@param writeMask The bitmask the controls which bits from refValue will be written to 
+		stencil buffer (valid for operations such as SOP_REPLACE).
+		the stencil
+		@param stencilFailOp The action to perform when the stencil check fails
+		@param depthFailOp The action to perform when the stencil check passes, but the
+		depth buffer check still fails
+		@param passOp The action to take when both the stencil and depth check pass.
+		@param twoSidedOperation If set to true, then if you render both back and front faces 
+		(you'll have to turn off culling) then these parameters will apply for front faces, 
+		and the inverse of them will happen for back faces (keep remains the same).
+		*/
+		virtual void setStencilBufferParams(CompareFunction func = CMPF_ALWAYS_PASS, 
+			uint32 refValue = 0, uint32 compareMask = 0xFFFFFFFF, uint32 writeMask = 0xFFFFFFFF, 
+			StencilOperation stencilFailOp = SOP_KEEP, 
+			StencilOperation depthFailOp = SOP_KEEP,
+			StencilOperation passOp = SOP_KEEP, 
+			bool twoSidedOperation = false) = 0;
+
+
+
+		/** Sets the current vertex declaration, ie the source of vertex data. */
+		virtual void setVertexDeclaration(VertexDeclaration* decl) = 0;
+		/** Sets the current vertex buffer binding state. */
+		virtual void setVertexBufferBinding(VertexBufferBinding* binding) = 0;
+
+		/** Sets whether or not normals are to be automatically normalised.
+		@remarks
+		This is useful when, for example, you are scaling SceneNodes such that
+		normals may not be unit-length anymore. Note though that this has an
+		overhead so should not be turn on unless you really need it.
+		@par
+		You should not normally call this direct unless you are rendering
+		world geometry; set it on the Renderable because otherwise it will be
+		overridden by material settings. 
+		*/
+		virtual void setNormaliseNormals(bool normalise) = 0;
+
+		/**
+		Render something to the active viewport.
+
+		Low-level rendering interface to perform rendering
+		operations. Unlikely to be used directly by client
+		applications, since the SceneManager and various support
+		classes will be responsible for calling this method.
+		Can only be called between _beginScene and _endScene
+
+		@param op A rendering operation instance, which contains
+		details of the operation to be performed.
+		*/
+		virtual void _render(const RenderOperation& op);
+
+		/** Gets the capabilities of the render system. */
+		const RenderSystemCapabilities* getCapabilities(void) const { return mCurrentCapabilities; }
+
+
+		/** Returns the driver version.
+		*/
+		virtual const DriverVersion& getDriverVersion(void) const { return mDriverVersion; }
+
+        /** Returns the default material scheme used by the render system.
+            Systems that use the RTSS to emulate a fixed function pipeline 
+            (e.g. OpenGL ES 2, GL3+, DX11) need to override this function to return
+            the default material scheme of the RTSS ShaderGenerator.
+         
+            This is currently only used to set the default material scheme for
+            viewports.  It is a necessary step on these render systems for
+            render textures to be rendered into properly.
+		*/
+		virtual const String& _getDefaultViewportMaterialScheme(void) const;
+
+		/** Binds a given GpuProgram (but not the parameters). 
+		@remarks Only one GpuProgram of each type can be bound at once, binding another
+		one will simply replace the existing one.
+		*/
+		virtual void bindGpuProgram(GpuProgram* prg);
+
+		/** Bind Gpu program parameters.
+		@param gptype The type of program to bind the parameters to
+		@param params The parameters to bind
+		@param variabilityMask A mask of GpuParamVariability identifying which params need binding
+		*/
+		virtual void bindGpuProgramParameters(GpuProgramType gptype, 
+			GpuProgramParametersSharedPtr params, uint16 variabilityMask) = 0;
+
+		/** Only binds Gpu program parameters used for passes that have more than one iteration rendering
+		*/
+		virtual void bindGpuProgramPassIterationParameters(GpuProgramType gptype) = 0;
+		/** Unbinds GpuPrograms of a given GpuProgramType.
+		@remarks
+		This returns the pipeline to fixed-function processing for this type.
+		*/
+		virtual void unbindGpuProgram(GpuProgramType gptype);
+
+		/** Returns whether or not a Gpu program of the given type is currently bound. */
+		virtual bool isGpuProgramBound(GpuProgramType gptype);
+
+        /**
+         * Gets the native shading language version for this render system.
+         * Formatted so that it can be used within a shading program. 
+         * For example, OpenGL 3.2 would return 150, while 3.3 would return 330
+         */
+        uint16 getNativeShadingLanguageVersion() const { return mNativeShadingLanguageVersion; }
+
+		/** Sets the user clipping region.
+		*/
+		virtual void setClipPlanes(const PlaneList& clipPlanes);
+
+		/** Add a user clipping plane. */
+		virtual void addClipPlane (const Plane &p);
+		/** Add a user clipping plane. */
+		virtual void addClipPlane (Real A, Real B, Real C, Real D);
+
+		/** Clears the user clipping region.
+		*/
+		virtual void resetClipPlanes();
+
+		/** Utility method for initialising all render targets attached to this rendering system. */
+		virtual void _initRenderTargets(void);
+
+		/** Utility method to notify all render targets that a camera has been removed, 
+		in case they were referring to it as their viewer. 
+		*/
+		virtual void _notifyCameraRemoved(const Camera* cam);
+
+		/** Internal method for updating all render targets attached to this rendering system. */
+		virtual void _updateAllRenderTargets(bool swapBuffers = true);
+		/** Internal method for swapping all the buffers on all render targets,
+		if _updateAllRenderTargets was called with a 'false' parameter. */
+		virtual void _swapAllRenderTargetBuffers();
+
+		/** Sets whether or not vertex windings set should be inverted; this can be important
+		for rendering reflections. */
+		virtual void setInvertVertexWinding(bool invert);
+
+		/** Indicates whether or not the vertex windings set will be inverted for the current render (e.g. reflections)
+		@see RenderSystem::setInvertVertexWinding
+		*/
+		virtual bool getInvertVertexWinding(void) const;
+
+		/** Sets the 'scissor region' i.e. the region of the target in which rendering can take place.
+		@remarks
+		This method allows you to 'mask off' rendering in all but a given rectangular area
+		as identified by the parameters to this method.
+		@note
+		Not all systems support this method. Check the RenderSystemCapabilities for the
+		RSC_SCISSOR_TEST capability to see if it is supported.
+		@param enabled True to enable the scissor test, false to disable it.
+		@param left, top, right, bottom The location of the corners of the rectangle, expressed in
+		<i>pixels</i>.
+		*/
+		virtual void setScissorTest(bool enabled, size_t left = 0, size_t top = 0, 
+			size_t right = 800, size_t bottom = 600) = 0;
+
+		/** Clears one or more frame buffers on the active render target. 
+		@param buffers Combination of one or more elements of FrameBufferType
+		denoting which buffers are to be cleared
+		@param colour The colour to clear the colour buffer with, if enabled
+		@param depth The value to initialise the depth buffer with, if enabled
+		@param stencil The value to initialise the stencil buffer with, if enabled.
+		*/
+		virtual void clearFrameBuffer(unsigned int buffers, 
+			const ColourValue& colour = ColourValue::Black, 
+			Real depth = 1.0f, unsigned short stencil = 0) = 0;
+		/** Returns the horizontal texel offset value required for mapping 
+		texel origins to pixel origins in this rendersystem.
+		@remarks
+		Since rendersystems sometimes disagree on the origin of a texel, 
+		mapping from texels to pixels can sometimes be problematic to 
+		implement generically. This method allows you to retrieve the offset
+		required to map the origin of a texel to the origin of a pixel in
+		the horizontal direction.
+		*/
+		virtual Real getHorizontalTexelOffset(void) = 0;
+		/** Returns the vertical texel offset value required for mapping 
+		texel origins to pixel origins in this rendersystem.
+		@remarks
+		Since rendersystems sometimes disagree on the origin of a texel, 
+		mapping from texels to pixels can sometimes be problematic to 
+		implement generically. This method allows you to retrieve the offset
+		required to map the origin of a texel to the origin of a pixel in
+		the vertical direction.
+		*/
+		virtual Real getVerticalTexelOffset(void) = 0;
+
+		/** Gets the minimum (closest) depth value to be used when rendering
+		using identity transforms.
+		@remarks
+		When using identity transforms you can manually set the depth
+		of a vertex; however the input values required differ per
+		rendersystem. This method lets you retrieve the correct value.
+		@see Renderable::getUseIdentityView, Renderable::getUseIdentityProjection
+		*/
+		virtual Real getMinimumDepthInputValue(void) = 0;
+		/** Gets the maximum (farthest) depth value to be used when rendering
+		using identity transforms.
+		@remarks
+		When using identity transforms you can manually set the depth
+		of a vertex; however the input values required differ per
+		rendersystem. This method lets you retrieve the correct value.
+		@see Renderable::getUseIdentityView, Renderable::getUseIdentityProjection
+		*/
+		virtual Real getMaximumDepthInputValue(void) = 0;
+		/** set the current multi pass count value.  This must be set prior to 
+		calling _render() if multiple renderings of the same pass state are 
+		required.
+		@param count Number of times to render the current state.
+		*/
+		virtual void setCurrentPassIterationCount(const size_t count) { mCurrentPassIterationCount = count; }
+
+		/** Tell the render system whether to derive a depth bias on its own based on 
+		the values passed to it in setCurrentPassIterationCount.
+		The depth bias set will be baseValue + iteration * multiplier
+		@param derive True to tell the RS to derive this automatically
+		@param baseValue The base value to which the multiplier should be
+		added
+		@param multiplier The amount of depth bias to apply per iteration
+		@param slopeScale The constant slope scale bias for completeness
+		*/
+		virtual void setDeriveDepthBias(bool derive, float baseValue = 0.0f,
+			float multiplier = 0.0f, float slopeScale = 0.0f)
+		{
+			mDerivedDepthBias = derive;
+			mDerivedDepthBiasBase = baseValue;
+			mDerivedDepthBiasMultiplier = multiplier;
+			mDerivedDepthBiasSlopeScale = slopeScale;
+		}
+
+		/**
+         * Set current render target to target, enabling its device context if needed
+         */
+        virtual void _setRenderTarget(RenderTarget *target) = 0;
+
+		/** Defines a listener on the custom events that this render system 
+		can raise.
+		@see RenderSystem::addListener
+		*/
+		class _OgreExport Listener
+		{
+		public:
+			Listener() {}
+			virtual ~Listener() {}
+
+			/** A rendersystem-specific event occurred.
+			@param eventName The name of the event which has occurred
+			@param parameters A list of parameters that may belong to this event,
+			may be null if there are no parameters
+			*/
+			virtual void eventOccurred(const String& eventName, 
+				const NameValuePairList* parameters = 0) = 0;
+		};
+		/** Adds a listener to the custom events that this render system can raise.
+		@remarks
+		Some render systems have quite specific, internally generated events 
+		that the application may wish to be notified of. Many applications
+		don't have to worry about these events, and can just trust OGRE to 
+		handle them, but if you want to know, you can add a listener here.
+		@par
+		Events are raised very generically by string name. Perhaps the most 
+		common example of a render system specific event is the loss and 
+		restoration of a device in DirectX; which OGRE deals with, but you 
+		may wish to know when it happens. 
+		@see RenderSystem::getRenderSystemEvents
+		*/
+		virtual void addListener(Listener* l);
+		/** Remove a listener to the custom events that this render system can raise.
+		*/
+		virtual void removeListener(Listener* l);
+
+		/** Gets a list of the rendersystem specific events that this rendersystem
+		can raise.
+		@see RenderSystem::addListener
+		*/
+		virtual const StringVector& getRenderSystemEvents(void) const { return mEventNames; }
+
+		/** Tell the rendersystem to perform any prep tasks it needs to directly
+		before other threads which might access the rendering API are registered.
+		@remarks
+		Call this from your main thread before starting your other threads
+		(which themselves should call registerThread()). Note that if you
+		start your own threads, there is a specific startup sequence which 
+		must be respected and requires synchronisation between the threads:
+		<ol>
+		<li>[Main thread]Call preExtraThreadsStarted</li>
+		<li>[Main thread]Start other thread, wait</li>
+		<li>[Other thread]Call registerThread, notify main thread & continue</li>
+		<li>[Main thread]Wake up & call postExtraThreadsStarted</li>
+		</ol>
+		Once this init sequence is completed the threads are independent but
+		this startup sequence must be respected.
+		*/
+		virtual void preExtraThreadsStarted() = 0;
+
+		/* Tell the rendersystem to perform any tasks it needs to directly
+		after other threads which might access the rendering API are registered.
+		@see RenderSystem::preExtraThreadsStarted
+		*/
+		virtual void postExtraThreadsStarted() = 0;
+
+		/** Register the an additional thread which may make calls to rendersystem-related 
+		objects.
+		@remarks
+		This method should only be called by additional threads during their
+		initialisation. If they intend to use hardware rendering system resources 
+		they should call this method before doing anything related to the render system.
+		Some rendering APIs require a per-thread setup and this method will sort that
+		out. It is also necessary to call unregisterThread before the thread shuts down.
+		@note
+		This method takes no parameters - it must be called from the thread being
+		registered and that context is enough.
+		*/
+		virtual void registerThread() = 0;
+
+		/** Unregister an additional thread which may make calls to rendersystem-related objects.
+		@see RenderSystem::registerThread
+		*/
+		virtual void unregisterThread() = 0;
+
+		/**
+		* Gets the number of display monitors.
+		@see Root::getDisplayMonitorCount
+		*/
+		virtual unsigned int getDisplayMonitorCount() const = 0;
+
+        /**
+        * This marks the beginning of an event for GPU profiling.
+        */
+        virtual void beginProfileEvent( const String &eventName ) = 0;
+
+        /**
+        * Ends the currently active GPU profiling event.
+        */
+        virtual void endProfileEvent( void ) = 0;
+
+        /**
+        * Marks an instantaneous event for graphics profilers.  
+        * This is equivalent to calling @see beginProfileEvent and @see endProfileEvent back to back.
+        */
+        virtual void markProfileEvent( const String &event ) = 0;
+
+		/** Determines if the system has anisotropic mip map filter support
+		*/
+		virtual bool hasAnisotropicMipMapFilter() const = 0;
+
+		/** Gets a custom (maybe platform-specific) attribute.
+        @remarks This is a nasty way of satisfying any API's need to see platform-specific details.
+        @param name The name of the attribute.
+        @param pData Pointer to memory of the right kind of structure to receive the info.
+        */
+		virtual void getCustomAttribute(const String& name, void* pData);
+
+	protected:
+
+		/** DepthBuffers to be attached to render targets */
+		DepthBufferMap	mDepthBufferPool;
+
+		/** The render targets. */
+		RenderTargetMap mRenderTargets;
+		/** The render targets, ordered by priority. */
+		RenderTargetPriorityMap mPrioritisedRenderTargets;
+		/** The Active render target. */
+		RenderTarget * mActiveRenderTarget;
+
+		/** The Active GPU programs and gpu program parameters*/
+		GpuProgramParametersSharedPtr mActiveVertexGpuProgramParameters;
+		GpuProgramParametersSharedPtr mActiveGeometryGpuProgramParameters;
+		GpuProgramParametersSharedPtr mActiveFragmentGpuProgramParameters;
+		GpuProgramParametersSharedPtr mActiveTesselationHullGpuProgramParameters;
+		GpuProgramParametersSharedPtr mActiveTesselationDomainGpuProgramParameters;
+		GpuProgramParametersSharedPtr mActiveComputeGpuProgramParameters;
+
+		// Texture manager
+		// A concrete class of this will be created and
+		// made available under the TextureManager singleton,
+		// managed by the RenderSystem
+		TextureManager* mTextureManager;
+
+		// Active viewport (dest for future rendering operations)
+		Viewport* mActiveViewport;
+
+		CullingMode mCullingMode;
+
+		bool mWBuffer;
+
+		size_t mBatchCount;
+		size_t mFaceCount;
+		size_t mVertexCount;
+
+		/// Saved manual colour blends
+		ColourValue mManualBlendColours[OGRE_MAX_TEXTURE_LAYERS][2];
+
+		bool mInvertVertexWinding;
+
+		/// Texture units from this upwards are disabled
+		size_t mDisabledTexUnitsFrom;
+
+		/// number of times to render the current state
+		size_t mCurrentPassIterationCount;
+		size_t mCurrentPassIterationNum;
+		/// Whether to update the depth bias per render call
+		bool mDerivedDepthBias;
+		float mDerivedDepthBiasBase;
+		float mDerivedDepthBiasMultiplier;
+		float mDerivedDepthBiasSlopeScale;
+
+        /// a global vertex buffer for global instancing
+        HardwareVertexBufferSharedPtr mGlobalInstanceVertexBuffer;
+        /// a vertex declaration for the global vertex buffer for the global instancing
+        VertexDeclaration* mGlobalInstanceVertexBufferVertexDeclaration;
+        /// the number of global instances (this number will be multiply by the render op instance number) 
+        size_t mGlobalNumberOfInstances;
+
+		/// is fixed pipeline enabled
+		bool mEnableFixedPipeline;
+
+		/** updates pass iteration rendering state including bound gpu program parameter
+		pass iteration auto constant entry
+		@return True if more iterations are required
+		*/
+		bool updatePassIterationRenderState(void);
+
+		/// List of names of events this rendersystem may raise
+		StringVector mEventNames;
+
+		/// Internal method for firing a rendersystem event
+		virtual void fireEvent(const String& name, const NameValuePairList* params = 0);
+
+		typedef list<Listener*>::type ListenerList;
+		ListenerList mEventListeners;
+
+		typedef list<HardwareOcclusionQuery*>::type HardwareOcclusionQueryList;
+		HardwareOcclusionQueryList mHwOcclusionQueries;
+
+		bool mVertexProgramBound;
+		bool mGeometryProgramBound;
+		bool mFragmentProgramBound;
+		bool mTesselationHullProgramBound;
+		bool mTesselationDomainProgramBound;
+		bool mComputeProgramBound;
+
+		// Recording user clip planes
+		PlaneList mClipPlanes;
+		// Indicator that we need to re-set the clip planes on next render call
+		bool mClipPlanesDirty;
+
+		/// Used to store the capabilities of the graphics card
+		RenderSystemCapabilities* mRealCapabilities;
+		RenderSystemCapabilities* mCurrentCapabilities;
+		bool mUseCustomCapabilities;
+
+		/// Internal method used to set the underlying clip planes when needed
+		virtual void setClipPlanesImpl(const PlaneList& clipPlanes) = 0;
+
+		/** Initialize the render system from the capabilities*/
+		virtual void initialiseFromRenderSystemCapabilities(RenderSystemCapabilities* caps, RenderTarget* primary) = 0;
+
+
+		DriverVersion mDriverVersion;
+        uint16 mNativeShadingLanguageVersion;
+
+		bool mTexProjRelative;
+		Vector3 mTexProjRelativeOrigin;
+
+
+
+	};
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreRenderSystemCapabilities.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreRenderSystemCapabilities.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreRenderSystemCapabilities.h	(revision 148)
@@ -0,0 +1,889 @@
+/*
+-----------------------------------------------------------------------------
+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 __RenderSystemCapabilities__
+#define __RenderSystemCapabilities__
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+#include "OgreString.h"
+#include "OgreStringConverter.h"
+#include "OgreStringVector.h"
+#include "OgreResource.h"
+#include "OgreLogManager.h"
+#include "OgreHeaderPrefix.h"
+
+// Because there are more than 32 possible Capabilities, more than 1 int is needed to store them all.
+// In fact, an array of integers is used to store capabilities. However all the capabilities are defined in the single
+// enum. The only way to know which capabilities should be stored where in the array is to use some of the 32 bits
+// to record the category of the capability.  These top few bits are used as an index into mCapabilities array
+// The lower bits are used to identify each capability individually by setting 1 bit for each
+
+// Identifies how many bits are reserved for categories
+// NOTE: Although 4 bits (currently) are enough
+#define CAPS_CATEGORY_SIZE 4
+#define OGRE_CAPS_BITSHIFT (32 - CAPS_CATEGORY_SIZE)
+#define CAPS_CATEGORY_MASK (((1 << CAPS_CATEGORY_SIZE) - 1) << OGRE_CAPS_BITSHIFT)
+#define OGRE_CAPS_VALUE(cat, val) ((cat << OGRE_CAPS_BITSHIFT) | (1 << val))
+
+namespace Ogre 
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup RenderSystem
+	*  @{
+	*/
+
+	/// Enumerates the categories of capabilities
+	enum CapabilitiesCategory
+	{
+		CAPS_CATEGORY_COMMON = 0,
+		CAPS_CATEGORY_COMMON_2 = 1,
+		CAPS_CATEGORY_D3D9 = 2,
+		CAPS_CATEGORY_GL = 3,
+		/// Placeholder for max value
+		CAPS_CATEGORY_COUNT = 4
+	};
+
+	/// Enum describing the different hardware capabilities we want to check for
+	/// OGRE_CAPS_VALUE(a, b) defines each capability
+	// a is the category (which can be from 0 to 15)
+	// b is the value (from 0 to 27)
+	enum Capabilities
+	{
+		/// Supports generating mipmaps in hardware
+		RSC_AUTOMIPMAP              = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 0),
+		RSC_BLENDING                = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 1),
+		/// Supports anisotropic texture filtering
+		RSC_ANISOTROPY              = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 2),
+		/// Supports fixed-function DOT3 texture blend
+		RSC_DOT3                    = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 3),
+		/// Supports cube mapping
+		RSC_CUBEMAPPING             = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 4),
+		/// Supports hardware stencil buffer
+		RSC_HWSTENCIL               = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 5),
+		/// Supports hardware vertex and index buffers
+		RSC_VBO                     = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 7),
+		/// Supports vertex programs (vertex shaders)
+		RSC_VERTEX_PROGRAM          = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 9),
+		/// Supports fragment programs (pixel shaders)
+		RSC_FRAGMENT_PROGRAM        = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 10),
+		/// Supports performing a scissor test to exclude areas of the screen
+		RSC_SCISSOR_TEST            = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 11),
+		/// Supports separate stencil updates for both front and back faces
+		RSC_TWO_SIDED_STENCIL       = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 12),
+		/// Supports wrapping the stencil value at the range extremeties
+		RSC_STENCIL_WRAP            = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 13),
+		/// Supports hardware occlusion queries
+		RSC_HWOCCLUSION             = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 14),
+		/// Supports user clipping planes
+		RSC_USER_CLIP_PLANES        = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 15),
+		/// Supports the VET_UBYTE4 vertex element type
+		RSC_VERTEX_FORMAT_UBYTE4    = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 16),
+		/// Supports infinite far plane projection
+		RSC_INFINITE_FAR_PLANE      = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 17),
+		/// Supports hardware render-to-texture (bigger than framebuffer)
+		RSC_HWRENDER_TO_TEXTURE     = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 18),
+		/// Supports float textures and render targets
+		RSC_TEXTURE_FLOAT           = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 19),
+		/// Supports non-power of two textures
+		RSC_NON_POWER_OF_2_TEXTURES = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 20),
+		/// Supports 3d (volume) textures
+		RSC_TEXTURE_3D              = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 21),
+		/// Supports basic point sprite rendering
+		RSC_POINT_SPRITES           = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 22),
+		/// Supports extra point parameters (minsize, maxsize, attenuation)
+		RSC_POINT_EXTENDED_PARAMETERS = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 23),
+		/// Supports vertex texture fetch
+		RSC_VERTEX_TEXTURE_FETCH = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 24),
+		/// Supports mipmap LOD biasing
+		RSC_MIPMAP_LOD_BIAS = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 25),
+		/// Supports hardware geometry programs
+		RSC_GEOMETRY_PROGRAM = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 26),
+		/// Supports rendering to vertex buffers
+		RSC_HWRENDER_TO_VERTEX_BUFFER = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON, 27),
+
+		/// Supports compressed textures
+		RSC_TEXTURE_COMPRESSION = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 0),
+		/// Supports compressed textures in the DXT/ST3C formats
+		RSC_TEXTURE_COMPRESSION_DXT = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 1),
+		/// Supports compressed textures in the VTC format
+		RSC_TEXTURE_COMPRESSION_VTC = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 2),
+		/// Supports compressed textures in the PVRTC format
+		RSC_TEXTURE_COMPRESSION_PVRTC = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 3),
+		/// Supports compressed textures in the ATC format
+		RSC_TEXTURE_COMPRESSION_ATC = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 4),
+		/// Supports compressed textures in the ETC1 format
+		RSC_TEXTURE_COMPRESSION_ETC1 = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 5),
+		/// Supports compressed textures in the ETC2 format
+		RSC_TEXTURE_COMPRESSION_ETC2 = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 6),
+		/// Supports compressed textures in BC4 and BC5 format (DirectX feature level 10_0)
+		RSC_TEXTURE_COMPRESSION_BC4_BC5 = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 7),
+		/// Supports compressed textures in BC6H and BC7 format (DirectX feature level 11_0)
+		RSC_TEXTURE_COMPRESSION_BC6H_BC7 = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 8),
+		/// Supports fixed-function pipeline
+		RSC_FIXED_FUNCTION = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 9),
+		/// Supports MRTs with different bit depths
+		RSC_MRT_DIFFERENT_BIT_DEPTHS = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 10),
+		/// Supports Alpha to Coverage (A2C)
+		RSC_ALPHA_TO_COVERAGE = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 11),
+		/// Supports Blending operations other than +
+		RSC_ADVANCED_BLEND_OPERATIONS = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 12),
+		/// Supports a separate depth buffer for RTTs. D3D 9 & 10, OGL w/FBO (RSC_FBO implies this flag)
+		RSC_RTT_SEPARATE_DEPTHBUFFER = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 13),
+		/// Supports using the MAIN depth buffer for RTTs. D3D 9&10, OGL w/FBO support unknown
+		/// (undefined behavior?), OGL w/ copy supports it
+		RSC_RTT_MAIN_DEPTHBUFFER_ATTACHABLE = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 14),
+		/// Supports attaching a depth buffer to an RTT that has width & height less or equal than RTT's.
+		/// Otherwise must be of _exact_ same resolution. D3D 9, OGL 3.0 (not 2.0, not D3D10)
+		RSC_RTT_DEPTHBUFFER_RESOLUTION_LESSEQUAL = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 15),
+		/// Supports using vertex buffers for instance data
+		RSC_VERTEX_BUFFER_INSTANCE_DATA = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 16),
+		/// Supports using vertex buffers for instance data
+		RSC_CAN_GET_COMPILED_SHADER_BUFFER = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 17),
+		/// Supports dynamic linkage/shader subroutine
+		RSC_SHADER_SUBROUTINE = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 18),
+
+		RSC_HWRENDER_TO_TEXTURE_3D = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 19),
+		/// Supports 1d textures
+		RSC_TEXTURE_1D              = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 20),
+		/// Supports hardware tesselation hull programs
+		RSC_TESSELATION_HULL_PROGRAM = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 21),
+		/// Supports hardware tesselation domain programs
+		RSC_TESSELATION_DOMAIN_PROGRAM = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 22),
+		/// Supports hardware compute programs
+		RSC_COMPUTE_PROGRAM = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 23),
+		/// Supports asynchronous hardware occlusion queries
+		RSC_HWOCCLUSION_ASYNCHRONOUS = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 24),
+		/// Supports asynchronous hardware occlusion queries
+		RSC_ATOMIC_COUNTERS = OGRE_CAPS_VALUE(CAPS_CATEGORY_COMMON_2, 25),
+
+		// ***** DirectX specific caps *****
+		/// Is DirectX feature "per stage constants" supported
+		RSC_PERSTAGECONSTANT = OGRE_CAPS_VALUE(CAPS_CATEGORY_D3D9, 0),
+
+		// ***** GL Specific Caps *****
+		/// Supports OpenGL version 1.5
+		RSC_GL1_5_NOVBO    = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 1),
+		/// Support for Frame Buffer Objects (FBOs)
+		RSC_FBO              = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 2),
+		/// Support for Frame Buffer Objects ARB implementation (regular FBO is higher precedence)
+		RSC_FBO_ARB          = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 3),
+		/// Support for Frame Buffer Objects ATI implementation (ARB FBO is higher precedence)
+		RSC_FBO_ATI          = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 4),
+		/// Support for PBuffer
+		RSC_PBUFFER          = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 5),
+		/// Support for GL 1.5 but without HW occlusion workaround
+		RSC_GL1_5_NOHWOCCLUSION = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 6),
+		/// Support for point parameters ARB implementation
+		RSC_POINT_EXTENDED_PARAMETERS_ARB = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 7),
+		/// Support for point parameters EXT implementation
+		RSC_POINT_EXTENDED_PARAMETERS_EXT = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 8),
+		/// Support for Separate Shader Objects
+		RSC_SEPARATE_SHADER_OBJECTS = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 9),
+		/// Support for Vertex Array Objects (VAOs)
+        RSC_VAO              = OGRE_CAPS_VALUE(CAPS_CATEGORY_GL, 10)
+	};
+
+	/// DriverVersion is used by RenderSystemCapabilities and both GL and D3D9
+	/// to store the version of the current GPU driver
+	struct _OgreExport DriverVersion 
+	{
+		int major;
+		int minor;
+		int release;
+		int build;
+
+		DriverVersion() 
+		{
+			major = minor = release = build = 0;
+		}
+
+		String toString() const 
+		{
+			StringUtil::StrStreamType str;
+			str << major << "." << minor << "." << release << "." << build;
+			return str.str();
+		}
+
+		void fromString(const String& versionString)
+		{
+			StringVector tokens = StringUtil::split(versionString, ".");
+			if(!tokens.empty())
+			{
+				major = StringConverter::parseInt(tokens[0]);
+				if (tokens.size() > 1)
+					minor = StringConverter::parseInt(tokens[1]);
+				if (tokens.size() > 2)
+					release = StringConverter::parseInt(tokens[2]);
+				if (tokens.size() > 3)
+					build = StringConverter::parseInt(tokens[3]);
+			}
+
+		}
+	};
+
+	/** Enumeration of GPU vendors. */
+	enum GPUVendor
+	{
+		GPU_UNKNOWN = 0,
+		GPU_NVIDIA = 1,
+		GPU_AMD = 2,
+		GPU_INTEL = 3,
+		GPU_S3 = 4,
+		GPU_MATROX = 5,
+		GPU_3DLABS = 6,
+		GPU_SIS = 7,
+        GPU_IMAGINATION_TECHNOLOGIES = 8,
+        GPU_APPLE = 9,  // Apple Software Renderer
+        GPU_NOKIA = 10,
+		GPU_MS_SOFTWARE = 11, // Microsoft software device
+		GPU_MS_WARP = 12, // Microsoft WARP (Windows Advanced Rasterization Platform) software device - http://msdn.microsoft.com/en-us/library/dd285359.aspx
+        GPU_ARM = 13, // For the Mali chipsets
+        GPU_QUALCOMM = 14,
+
+		/// placeholder
+		GPU_VENDOR_COUNT = 15
+	};
+
+	/** singleton class for storing the capabilities of the graphics card. 
+	@remarks
+	This class stores the capabilities of the graphics card.  This
+	information is set by the individual render systems.
+	*/
+	class _OgreExport RenderSystemCapabilities : public RenderSysAlloc
+	{
+
+	public:
+
+		typedef set<String>::type ShaderProfiles;
+	private:
+		/// This is used to build a database of RSC's
+		/// if a RSC with same name, but newer version is introduced, the older one 
+		/// will be removed
+		DriverVersion mDriverVersion;
+		/// GPU Vendor
+		GPUVendor mVendor;
+
+		static StringVector msGPUVendorStrings;
+		static void initVendorStrings();
+
+		/// The number of world matrices available
+		ushort mNumWorldMatrices;
+		/// The number of texture units available
+		ushort mNumTextureUnits;
+		/// The stencil buffer bit depth
+		ushort mStencilBufferBitDepth;
+		/// The number of matrices available for hardware blending
+		ushort mNumVertexBlendMatrices;
+		/// Stores the capabilities flags.
+		int mCapabilities[CAPS_CATEGORY_COUNT];
+		/// Which categories are relevant
+		bool mCategoryRelevant[CAPS_CATEGORY_COUNT];
+		/// The name of the device as reported by the render system
+		String mDeviceName;
+		/// The identifier associated with the render system for which these capabilities are valid
+		String mRenderSystemName;
+
+		/// The number of floating-point constants vertex programs support
+		ushort mVertexProgramConstantFloatCount;           
+		/// The number of integer constants vertex programs support
+		ushort mVertexProgramConstantIntCount;           
+		/// The number of boolean constants vertex programs support
+		ushort mVertexProgramConstantBoolCount;           
+		/// The number of floating-point constants geometry programs support
+		ushort mGeometryProgramConstantFloatCount;           
+		/// The number of integer constants vertex geometry support
+		ushort mGeometryProgramConstantIntCount;           
+		/// The number of boolean constants vertex geometry support
+		ushort mGeometryProgramConstantBoolCount;           
+		/// The number of floating-point constants fragment programs support
+		ushort mFragmentProgramConstantFloatCount;           
+		/// The number of integer constants fragment programs support
+		ushort mFragmentProgramConstantIntCount;           
+		/// The number of boolean constants fragment programs support
+		ushort mFragmentProgramConstantBoolCount;
+		/// The number of simultaneous render targets supported
+		ushort mNumMultiRenderTargets;
+		/// The maximum point size
+		Real mMaxPointSize;
+		/// Are non-POW2 textures feature-limited?
+		bool mNonPOW2TexturesLimited;
+		/// The maximum supported anisotropy
+		Real mMaxSupportedAnisotropy;
+		/// The number of vertex texture units supported
+		ushort mNumVertexTextureUnits;
+		/// Are vertex texture units shared with fragment processor?
+		bool mVertexTextureUnitsShared;
+		/// The number of vertices a geometry program can emit in a single run
+		int mGeometryProgramNumOutputVertices;
+
+
+		/// The list of supported shader profiles
+		ShaderProfiles mSupportedShaderProfiles;
+
+		// Support for new shader stages in shader model 5.0
+		/// The number of floating-point constants tesselation Hull programs support
+		ushort mTesselationHullProgramConstantFloatCount;           
+		/// The number of integer constants tesselation Hull programs support
+		ushort mTesselationHullProgramConstantIntCount;           
+		/// The number of boolean constants tesselation Hull programs support
+		ushort mTesselationHullProgramConstantBoolCount;
+		/// The number of floating-point constants tesselation Domain programs support
+		ushort mTesselationDomainProgramConstantFloatCount;           
+		/// The number of integer constants tesselation Domain programs support
+		ushort mTesselationDomainProgramConstantIntCount;           
+		/// The number of boolean constants tesselation Domain programs support
+		ushort mTesselationDomainProgramConstantBoolCount;
+		/// The number of floating-point constants compute programs support
+		ushort mComputeProgramConstantFloatCount;           
+		/// The number of integer constants compute programs support
+		ushort mComputeProgramConstantIntCount;           
+		/// The number of boolean constants compute programs support
+		ushort mComputeProgramConstantBoolCount;
+
+
+
+	public:	
+		RenderSystemCapabilities ();
+		virtual ~RenderSystemCapabilities ();
+
+		virtual size_t calculateSize() const {return 0;}
+
+		/** Set the driver version. */
+		void setDriverVersion(const DriverVersion& version)
+		{
+			mDriverVersion = version;
+		}
+
+		void parseDriverVersionFromString(const String& versionString)
+		{
+			DriverVersion version;
+			version.fromString(versionString);
+			setDriverVersion(version);
+		}
+
+
+		DriverVersion getDriverVersion() const
+		{
+			return mDriverVersion;
+		}
+
+		GPUVendor getVendor() const
+		{
+			return mVendor;
+		}
+
+		void setVendor(GPUVendor v)
+		{
+			mVendor = v;
+		}
+
+		/// Parse and set vendor
+		void parseVendorFromString(const String& vendorString)
+		{
+			setVendor(vendorFromString(vendorString));
+		}
+
+		/// Convert a vendor string to an enum
+		static GPUVendor vendorFromString(const String& vendorString);
+		/// Convert a vendor enum to a string
+		static String vendorToString(GPUVendor v);
+
+		bool isDriverOlderThanVersion(DriverVersion v) const
+		{
+			if (mDriverVersion.major < v.major)
+				return true;
+			else if (mDriverVersion.major == v.major && 
+				mDriverVersion.minor < v.minor)
+				return true;
+			else if (mDriverVersion.major == v.major && 
+				mDriverVersion.minor == v.minor && 
+				mDriverVersion.release < v.release)
+				return true;
+			else if (mDriverVersion.major == v.major && 
+				mDriverVersion.minor == v.minor && 
+				mDriverVersion.release == v.release &&
+				mDriverVersion.build < v.build)
+				return true;
+			return false;
+		}
+
+		void setNumWorldMatrices(ushort num)
+		{
+			mNumWorldMatrices = num;
+		}
+
+		void setNumTextureUnits(ushort num)
+		{
+			mNumTextureUnits = num;
+		}
+
+		void setStencilBufferBitDepth(ushort num)
+		{
+			mStencilBufferBitDepth = num;
+		}
+
+		void setNumVertexBlendMatrices(ushort num)
+		{
+			mNumVertexBlendMatrices = num;
+		}
+
+		/// The number of simultaneous render targets supported
+		void setNumMultiRenderTargets(ushort num)
+		{
+			mNumMultiRenderTargets = num;
+		}
+
+		ushort getNumWorldMatrices(void) const
+		{ 
+			return mNumWorldMatrices;
+		}
+
+		/** Returns the number of texture units the current output hardware
+		supports.
+
+		For use in rendering, this determines how many texture units the
+		are available for multitexturing (i.e. rendering multiple 
+		textures in a single pass). Where a Material has multiple 
+		texture layers, it will try to use multitexturing where 
+		available, and where it is not available, will perform multipass
+		rendering to achieve the same effect. This property only applies
+		to the fixed-function pipeline, the number available to the 
+		programmable pipeline depends on the shader model in use.
+		*/
+		ushort getNumTextureUnits(void) const
+		{
+			return mNumTextureUnits;
+		}
+
+		/** Determines the bit depth of the hardware accelerated stencil 
+		buffer, if supported.
+		@remarks
+		If hardware stencilling is not supported, the software will
+		provide an 8-bit software stencil.
+		*/
+		ushort getStencilBufferBitDepth(void) const
+		{
+			return mStencilBufferBitDepth;
+		}
+
+		/** Returns the number of matrices available to hardware vertex 
+		blending for this rendering system. */
+		ushort getNumVertexBlendMatrices(void) const
+		{
+			return mNumVertexBlendMatrices;
+		}
+
+		/// The number of simultaneous render targets supported
+		ushort getNumMultiRenderTargets(void) const
+		{
+			return mNumMultiRenderTargets;
+		}
+
+		/** Returns true if capability is render system specific
+		*/
+		bool isCapabilityRenderSystemSpecific(const Capabilities c) const
+		{
+			int cat = c >> OGRE_CAPS_BITSHIFT;
+			if(cat == CAPS_CATEGORY_GL || cat == CAPS_CATEGORY_D3D9)
+				return true;
+			return false;
+		}
+
+		/** Adds a capability flag
+		*/
+		void setCapability(const Capabilities c) 
+		{ 
+			int index = (CAPS_CATEGORY_MASK & c) >> OGRE_CAPS_BITSHIFT;
+			// zero out the index from the stored capability
+			mCapabilities[index] |= (c & ~CAPS_CATEGORY_MASK);
+		}
+
+		/** Remove a capability flag
+		*/
+		void unsetCapability(const Capabilities c) 
+		{ 
+			int index = (CAPS_CATEGORY_MASK & c) >> OGRE_CAPS_BITSHIFT;
+			// zero out the index from the stored capability
+			mCapabilities[index] &= (~c | CAPS_CATEGORY_MASK);
+		}
+
+		/** Checks for a capability
+		*/
+		bool hasCapability(const Capabilities c) const
+		{
+			int index = (CAPS_CATEGORY_MASK & c) >> OGRE_CAPS_BITSHIFT;
+			// test against
+			if(mCapabilities[index] & (c & ~CAPS_CATEGORY_MASK))
+			{
+				return true;
+			}
+			else
+			{
+				return false;
+			}
+		}
+
+		/** Adds the profile to the list of supported profiles
+		*/
+		void addShaderProfile(const String& profile)
+		{
+			mSupportedShaderProfiles.insert(profile);
+
+		}
+
+		/** Remove a given shader profile, if present.
+		*/
+		void removeShaderProfile(const String& profile)
+		{
+			mSupportedShaderProfiles.erase(profile);
+		}
+
+		/** Returns true if profile is in the list of supported profiles
+		*/
+		bool isShaderProfileSupported(const String& profile) const
+		{
+			return (mSupportedShaderProfiles.end() != mSupportedShaderProfiles.find(profile));
+		}
+
+
+		/** Returns a set of all supported shader profiles
+		* */
+		const ShaderProfiles& getSupportedShaderProfiles() const
+		{
+			return mSupportedShaderProfiles;
+		}
+
+
+		/// The number of floating-point constants vertex programs support
+		ushort getVertexProgramConstantFloatCount(void) const
+		{
+			return mVertexProgramConstantFloatCount;           
+		}
+		/// The number of integer constants vertex programs support
+		ushort getVertexProgramConstantIntCount(void) const
+		{
+			return mVertexProgramConstantIntCount;           
+		}
+		/// The number of boolean constants vertex programs support
+		ushort getVertexProgramConstantBoolCount(void) const
+		{
+			return mVertexProgramConstantBoolCount;           
+		}
+		/// The number of floating-point constants geometry programs support
+		ushort getGeometryProgramConstantFloatCount(void) const
+		{
+			return mGeometryProgramConstantFloatCount;           
+		}
+		/// The number of integer constants geometry programs support
+		ushort getGeometryProgramConstantIntCount(void) const
+		{
+			return mGeometryProgramConstantIntCount;           
+		}
+		/// The number of boolean constants geometry programs support
+		ushort getGeometryProgramConstantBoolCount(void) const
+		{
+			return mGeometryProgramConstantBoolCount;           
+		}
+		/// The number of floating-point constants fragment programs support
+		ushort getFragmentProgramConstantFloatCount(void) const
+		{
+			return mFragmentProgramConstantFloatCount;           
+		}
+		/// The number of integer constants fragment programs support
+		ushort getFragmentProgramConstantIntCount(void) const
+		{
+			return mFragmentProgramConstantIntCount;           
+		}
+		/// The number of boolean constants fragment programs support
+		ushort getFragmentProgramConstantBoolCount(void) const
+		{
+			return mFragmentProgramConstantBoolCount;           
+		}
+
+		/// sets the device name for Render system
+		void setDeviceName(const String& name)
+		{
+			mDeviceName = name;
+		}
+
+		/// gets the device name for render system
+		String getDeviceName() const
+		{
+			return mDeviceName;
+		}
+
+		/// The number of floating-point constants vertex programs support
+		void setVertexProgramConstantFloatCount(ushort c)
+		{
+			mVertexProgramConstantFloatCount = c;           
+		}
+		/// The number of integer constants vertex programs support
+		void setVertexProgramConstantIntCount(ushort c)
+		{
+			mVertexProgramConstantIntCount = c;           
+		}
+		/// The number of boolean constants vertex programs support
+		void setVertexProgramConstantBoolCount(ushort c)
+		{
+			mVertexProgramConstantBoolCount = c;           
+		}
+		/// The number of floating-point constants geometry programs support
+		void setGeometryProgramConstantFloatCount(ushort c)
+		{
+			mGeometryProgramConstantFloatCount = c;           
+		}
+		/// The number of integer constants geometry programs support
+		void setGeometryProgramConstantIntCount(ushort c)
+		{
+			mGeometryProgramConstantIntCount = c;           
+		}
+		/// The number of boolean constants geometry programs support
+		void setGeometryProgramConstantBoolCount(ushort c)
+		{
+			mGeometryProgramConstantBoolCount = c;           
+		}
+		/// The number of floating-point constants fragment programs support
+		void setFragmentProgramConstantFloatCount(ushort c)
+		{
+			mFragmentProgramConstantFloatCount = c;           
+		}
+		/// The number of integer constants fragment programs support
+		void setFragmentProgramConstantIntCount(ushort c)
+		{
+			mFragmentProgramConstantIntCount = c;           
+		}
+		/// The number of boolean constants fragment programs support
+		void setFragmentProgramConstantBoolCount(ushort c)
+		{
+			mFragmentProgramConstantBoolCount = c;           
+		}
+		/// Maximum point screen size in pixels
+		void setMaxPointSize(Real s)
+		{
+			mMaxPointSize = s;
+		}
+		/// Maximum point screen size in pixels
+		Real getMaxPointSize(void) const
+		{
+			return mMaxPointSize;
+		}
+		/// Non-POW2 textures limited
+		void setNonPOW2TexturesLimited(bool l)
+		{
+			mNonPOW2TexturesLimited = l;
+		}
+		/** Are non-power of two textures limited in features?
+		@remarks
+		If the RSC_NON_POWER_OF_2_TEXTURES capability is set, but this
+		method returns true, you can use non power of 2 textures only if:
+		<ul><li>You load them explicitly with no mip maps</li>
+		<li>You don't use DXT texture compression</li>
+		<li>You use clamp texture addressing</li></ul>
+		*/
+		bool getNonPOW2TexturesLimited(void) const
+		{
+			return mNonPOW2TexturesLimited;
+		}
+		/// Set the maximum supported anisotropic filtering
+		void setMaxSupportedAnisotropy(Real s)
+		{
+			mMaxSupportedAnisotropy = s;
+		}
+		/// Get the maximum supported anisotropic filtering
+		Real getMaxSupportedAnisotropy()
+		{
+			return mMaxSupportedAnisotropy;
+		}
+
+		/// Set the number of vertex texture units supported
+		void setNumVertexTextureUnits(ushort n)
+		{
+			mNumVertexTextureUnits = n;
+		}
+		/// Get the number of vertex texture units supported
+		ushort getNumVertexTextureUnits(void) const
+		{
+			return mNumVertexTextureUnits;
+		}
+		/// Set whether the vertex texture units are shared with the fragment processor
+		void setVertexTextureUnitsShared(bool shared)
+		{
+			mVertexTextureUnitsShared = shared;
+		}
+		/// Get whether the vertex texture units are shared with the fragment processor
+		bool getVertexTextureUnitsShared(void) const
+		{
+			return mVertexTextureUnitsShared;
+		}
+
+		/// Set the number of vertices a single geometry program run can emit
+		void setGeometryProgramNumOutputVertices(int numOutputVertices)
+		{
+			mGeometryProgramNumOutputVertices = numOutputVertices;
+		}
+		/// Get the number of vertices a single geometry program run can emit
+		int getGeometryProgramNumOutputVertices(void) const
+		{
+			return mGeometryProgramNumOutputVertices;
+		}
+
+		/// Get the identifier of the rendersystem from which these capabilities were generated
+		String getRenderSystemName(void) const
+		{
+			return mRenderSystemName;
+		}
+		///  Set the identifier of the rendersystem from which these capabilities were generated
+		void setRenderSystemName(const String& rs)
+		{
+			mRenderSystemName = rs;
+		}
+
+		/// Mark a category as 'relevant' or not, ie will it be reported
+		void setCategoryRelevant(CapabilitiesCategory cat, bool relevant)
+		{
+			mCategoryRelevant[cat] = relevant;
+		}
+
+		/// Return whether a category is 'relevant' or not, ie will it be reported
+		bool isCategoryRelevant(CapabilitiesCategory cat)
+		{
+			return mCategoryRelevant[cat];
+		}
+
+
+
+		/** Write the capabilities to the pass in Log */
+		void log(Log* pLog);
+
+		// Support for new shader stages in shader model 5.0
+		/// The number of floating-point constants tesselation Hull programs support
+		void setTesselationHullProgramConstantFloatCount(ushort c)
+		{
+			mTesselationHullProgramConstantFloatCount = c;           
+		}
+		/// The number of integer constants tesselation Domain programs support
+		void setTesselationHullProgramConstantIntCount(ushort c)
+		{
+			mTesselationHullProgramConstantIntCount = c;           
+		}
+		/// The number of boolean constants tesselation Domain programs support
+		void setTesselationHullProgramConstantBoolCount(ushort c)
+		{
+			mTesselationHullProgramConstantBoolCount = c;           
+		}
+		/// The number of floating-point constants fragment programs support
+		ushort getTesselationHullProgramConstantFloatCount(void) const
+		{
+			return mTesselationHullProgramConstantFloatCount;           
+		}
+		/// The number of integer constants fragment programs support
+		ushort getTesselationHullProgramConstantIntCount(void) const
+		{
+			return mTesselationHullProgramConstantIntCount;           
+		}
+		/// The number of boolean constants fragment programs support
+		ushort getTesselationHullProgramConstantBoolCount(void) const
+		{
+			return mTesselationHullProgramConstantBoolCount;           
+		}
+
+		/// The number of floating-point constants tesselation Domain programs support
+		void setTesselationDomainProgramConstantFloatCount(ushort c)
+		{
+			mTesselationDomainProgramConstantFloatCount = c;           
+		}
+		/// The number of integer constants tesselation Domain programs support
+		void setTesselationDomainProgramConstantIntCount(ushort c)
+		{
+			mTesselationDomainProgramConstantIntCount = c;           
+		}
+		/// The number of boolean constants tesselation Domain programs support
+		void setTesselationDomainProgramConstantBoolCount(ushort c)
+		{
+			mTesselationDomainProgramConstantBoolCount = c;           
+		}
+		/// The number of floating-point constants fragment programs support
+		ushort getTesselationDomainProgramConstantFloatCount(void) const
+		{
+			return mTesselationDomainProgramConstantFloatCount;           
+		}
+		/// The number of integer constants fragment programs support
+		ushort getTesselationDomainProgramConstantIntCount(void) const
+		{
+			return mTesselationDomainProgramConstantIntCount;           
+		}
+		/// The number of boolean constants fragment programs support
+		ushort getTesselationDomainProgramConstantBoolCount(void) const
+		{
+			return mTesselationDomainProgramConstantBoolCount;           
+		}
+
+		/// The number of floating-point constants compute programs support
+		void setComputeProgramConstantFloatCount(ushort c)
+		{
+			mComputeProgramConstantFloatCount = c;           
+		}
+		/// The number of integer constants compute programs support
+		void setComputeProgramConstantIntCount(ushort c)
+		{
+			mComputeProgramConstantIntCount = c;           
+		}
+		/// The number of boolean constants compute programs support
+		void setComputeProgramConstantBoolCount(ushort c)
+		{
+			mComputeProgramConstantBoolCount = c;           
+		}
+		/// The number of floating-point constants fragment programs support
+		ushort getComputeProgramConstantFloatCount(void) const
+		{
+			return mComputeProgramConstantFloatCount;           
+		}
+		/// The number of integer constants fragment programs support
+		ushort getComputeProgramConstantIntCount(void) const
+		{
+			return mComputeProgramConstantIntCount;           
+		}
+		/// The number of boolean constants fragment programs support
+		ushort getComputeProgramConstantBoolCount(void) const
+		{
+			return mComputeProgramConstantBoolCount;           
+		}
+
+	};
+
+	/** @} */
+	/** @} */
+} // namespace
+
+
+#include "OgreHeaderSuffix.h"
+
+#endif // __RenderSystemCapabilities__
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreRenderSystemCapabilitiesManager.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreRenderSystemCapabilitiesManager.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreRenderSystemCapabilitiesManager.h	(revision 148)
@@ -0,0 +1,131 @@
+/*
+-----------------------------------------------------------------------------
+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 __RENDERSYSTEMCAPABILITIESMANAGER_H__
+#define __RENDERSYSTEMCAPABILITIESMANAGER_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreSingleton.h"
+#include "OgreStringVector.h"
+
+#include "OgreRenderSystemCapabilities.h"
+#include "OgreHeaderPrefix.h"
+
+
+namespace Ogre {
+
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup RenderSystem
+	*  @{
+	*/
+	/** Class for managing RenderSystemCapabilities database for Ogre.
+        @remarks This class behaves similarly to other ResourceManager, although .rendercaps are not resources.
+						It contains and abstract a .rendercaps Serializer
+    */
+    class _OgreExport RenderSystemCapabilitiesManager :  public Singleton<RenderSystemCapabilitiesManager>, public RenderSysAlloc
+    {
+
+    public:
+
+        /** Default constructor.
+        */
+        RenderSystemCapabilitiesManager();
+
+        /** Default destructor.
+        */
+        virtual ~RenderSystemCapabilitiesManager();
+
+
+        /** @see ScriptLoader::parseScript
+        */
+        void parseCapabilitiesFromArchive(const String& filename, const String& archiveType, bool recursive = true);
+		
+		/** Returns a capability loaded with RenderSystemCapabilitiesManager::parseCapabilitiesFromArchive method
+		* @return NULL if the name is invalid, a parsed RenderSystemCapabilities otherwise.
+		*/
+        RenderSystemCapabilities* loadParsedCapabilities(const String& name);
+
+		/** Access to the internal map of loaded capabilities */
+		const map<String, RenderSystemCapabilities*>::type &getCapabilities() const;
+
+        /** Method used by RenderSystemCapabilitiesSerializer::parseScript */
+        void _addRenderSystemCapabilities(const String& name, RenderSystemCapabilities* caps);
+
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static RenderSystemCapabilitiesManager& getSingleton(void);
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static RenderSystemCapabilitiesManager* getSingletonPtr(void);
+
+    protected:
+
+        RenderSystemCapabilitiesSerializer* mSerializer;
+
+        typedef map<String, RenderSystemCapabilities*>::type CapabilitiesMap;
+        CapabilitiesMap mCapabilitiesMap;
+
+        const String mScriptPattern;
+
+    };
+
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreRenderSystemCapabilitiesSerializer.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreRenderSystemCapabilitiesSerializer.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreRenderSystemCapabilitiesSerializer.h	(revision 148)
@@ -0,0 +1,251 @@
+/*
+-----------------------------------------------------------------------------
+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 __RenderSystemCapabilitiesSerializer_H__
+#define __RenderSystemCapabilitiesSerializer_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreRenderSystemCapabilities.h"
+#include "OgreStringVector.h"
+#include "OgreDataStream.h"
+#include "OgreHeaderPrefix.h"
+
+
+namespace Ogre {
+
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup RenderSystem
+	*  @{
+	*/
+	/** Class for serializing RenderSystemCapabilities to / from a .rendercaps script.*/
+	class _OgreExport RenderSystemCapabilitiesSerializer : public RenderSysAlloc
+    {
+
+    public:
+        /** default constructor*/
+        RenderSystemCapabilitiesSerializer();
+        /** default destructor*/
+        virtual ~RenderSystemCapabilitiesSerializer() {}
+
+        /** Writes a RenderSystemCapabilities object to a data stream */
+        void writeScript(const RenderSystemCapabilities* caps, String name, String filename);
+		
+		/** Writes a RenderSystemCapabilities object to a string */
+		String writeString(const RenderSystemCapabilities* caps, String name);
+
+        /** Parses a RenderSystemCapabilities script file passed as a stream.
+            Adds it to RenderSystemCapabilitiesManager::_addRenderSystemCapabilities
+        */
+        void parseScript(DataStreamPtr& stream);
+
+    protected:
+
+
+        enum CapabilityKeywordType {UNDEFINED_CAPABILITY_TYPE = 0, SET_STRING_METHOD, SET_INT_METHOD, SET_BOOL_METHOD, SET_REAL_METHOD,
+                                SET_CAPABILITY_ENUM_BOOL, ADD_SHADER_PROFILE_STRING};
+        // determines what keyword is what type of capability. For example:
+        // "automipmap" and "pbuffer" are both activated with setCapability (passing RSC_AUTOMIPMAP and RSC_PBUFFER respectivelly)
+        // while "max_num_multi_render_targets" is an integer and has it's own method: setMaxMultiNumRenderTargets
+        // we need to know these types to automatically parse each capability
+        typedef map<String, CapabilityKeywordType>::type KeywordTypeMap;
+        KeywordTypeMap mKeywordTypeMap;
+
+        typedef void (RenderSystemCapabilities::*SetStringMethod)(const String&);
+        // maps capability keywords to setCapability(String& cap) style methods
+        typedef map<String, SetStringMethod>::type SetStringMethodDispatchTable;
+        SetStringMethodDispatchTable mSetStringMethodDispatchTable;
+
+        // SET_INT_METHOD parsing tables
+        typedef void (RenderSystemCapabilities::*SetIntMethod)(ushort);
+        typedef map<String, SetIntMethod>::type SetIntMethodDispatchTable;
+        SetIntMethodDispatchTable mSetIntMethodDispatchTable;
+
+        // SET_BOOL_METHOD parsing tables
+        typedef void (RenderSystemCapabilities::*SetBoolMethod)(bool);
+        typedef map<String, SetBoolMethod>::type SetBoolMethodDispatchTable;
+        SetBoolMethodDispatchTable mSetBoolMethodDispatchTable;
+
+        // SET_REAL_METHOD parsing tables
+        typedef void (RenderSystemCapabilities::*SetRealMethod)(Real);
+        typedef map<String, SetRealMethod>::type SetRealMethodDispatchTable;
+        SetRealMethodDispatchTable mSetRealMethodDispatchTable;
+
+        typedef map<String, Capabilities>::type CapabilitiesMap;
+        CapabilitiesMap mCapabilitiesMap;
+
+        inline void addCapabilitiesMapping(String name, Capabilities cap)
+        {
+            mCapabilitiesMap.insert(CapabilitiesMap::value_type(name, cap));
+        }
+
+
+        // capabilities lines for parsing are collected along with their line numbers for debugging
+        typedef vector<std::pair<String, int> >::type CapabilitiesLinesList;
+        // the set of states that the parser can be in
+        enum ParseAction {PARSE_HEADER, FIND_OPEN_BRACE, COLLECT_LINES};
+
+        int mCurrentLineNumber;
+        String* mCurrentLine;
+        DataStreamPtr mCurrentStream;
+
+        RenderSystemCapabilities* mCurrentCapabilities;
+
+        inline void addKeywordType(String keyword, CapabilityKeywordType type)
+        {
+            mKeywordTypeMap.insert(KeywordTypeMap::value_type(keyword, type));
+        }
+
+        inline CapabilityKeywordType getKeywordType(const String& keyword) const
+        {
+						KeywordTypeMap::const_iterator it = mKeywordTypeMap.find(keyword);
+            if(it != mKeywordTypeMap.end())
+							 return (*it).second;
+						else
+						{
+							 logParseError("Can't find the type for keyword: " + keyword);
+							 return UNDEFINED_CAPABILITY_TYPE;
+						}
+        }
+
+        inline void addSetStringMethod(String keyword, SetStringMethod method)
+        {
+            mSetStringMethodDispatchTable.insert(SetStringMethodDispatchTable::value_type(keyword, method));
+        }
+
+        inline void callSetStringMethod(String& keyword, String& val)
+        {
+            SetStringMethodDispatchTable::iterator methodIter = mSetStringMethodDispatchTable.find(keyword);
+            if (methodIter != mSetStringMethodDispatchTable.end())
+            {
+						    SetStringMethod m = (*methodIter).second;
+                (mCurrentCapabilities->*m)(val);
+            }
+            else
+            {
+                logParseError("undefined keyword: " + keyword);
+            }
+        }
+
+
+        inline void addSetIntMethod(String keyword, SetIntMethod method)
+        {
+            mSetIntMethodDispatchTable.insert(SetIntMethodDispatchTable::value_type(keyword, method));
+        }
+
+        inline void callSetIntMethod(String& keyword, ushort val)
+        {
+            SetIntMethodDispatchTable::iterator methodIter = mSetIntMethodDispatchTable.find(keyword);
+            if (methodIter != mSetIntMethodDispatchTable.end())
+            {
+						    SetIntMethod m = (*methodIter).second;
+                (mCurrentCapabilities->*m)(val);
+            }
+            else
+            {
+                logParseError("undefined keyword: " + keyword);
+            }  
+        }
+
+
+        inline void addSetBoolMethod(String keyword, SetBoolMethod method)
+        {
+            mSetBoolMethodDispatchTable.insert(SetBoolMethodDispatchTable::value_type(keyword, method));
+        }
+
+        inline void callSetBoolMethod(String& keyword, bool val)
+        {
+            SetBoolMethodDispatchTable::iterator methodIter = mSetBoolMethodDispatchTable.find(keyword);
+            if (methodIter != mSetBoolMethodDispatchTable.end())
+            {
+						    SetBoolMethod m = (*methodIter).second;
+                (mCurrentCapabilities->*m)(val);
+            }
+            else
+            {
+                logParseError("undefined keyword: " + keyword);
+						}
+        }
+
+
+        inline void addSetRealMethod(String keyword, SetRealMethod method)
+        {
+            mSetRealMethodDispatchTable.insert(SetRealMethodDispatchTable::value_type(keyword, method));
+        }
+
+        inline void callSetRealMethod(String& keyword, Real val)
+        {
+            SetRealMethodDispatchTable::iterator methodIter = mSetRealMethodDispatchTable.find(keyword);
+            if (methodIter != mSetRealMethodDispatchTable.end())
+            {
+						    SetRealMethod m = (*methodIter).second;
+                (mCurrentCapabilities->*m)(val);
+            }
+            else
+            {
+                logParseError("undefined keyword: " + keyword);
+						}
+        }
+
+        inline void addShaderProfile(String& val)
+        {
+            mCurrentCapabilities->addShaderProfile(val);
+        }
+
+        inline void setCapabilityEnumBool(String& name, bool val)
+        {
+            // check for errors
+            if(mCapabilitiesMap.find(name) == mCapabilitiesMap.end())
+            {
+                logParseError("Undefined capability: " + name);
+                return;
+            }
+            // only set true capabilities, we can't unset false
+            if(val)
+            {
+                Capabilities cap = mCapabilitiesMap[name];
+                mCurrentCapabilities->setCapability(cap);
+            }
+        }
+
+        void initialiaseDispatchTables();
+
+        void parseCapabilitiesLines(CapabilitiesLinesList& linesList);
+
+        void logParseError(const String& error) const;
+
+    };
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreRenderTarget.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreRenderTarget.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreRenderTarget.h	(revision 148)
@@ -0,0 +1,524 @@
+/*
+-----------------------------------------------------------------------------
+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 __RenderTarget_H__
+#define __RenderTarget_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreString.h"
+#include "OgreTextureManager.h"
+#include "OgreViewport.h"
+#include "OgreTimer.h"
+#include "OgreHeaderPrefix.h"
+
+/* Define the number of priority groups for the render system's render targets. */
+#ifndef OGRE_NUM_RENDERTARGET_GROUPS
+	#define OGRE_NUM_RENDERTARGET_GROUPS 10
+	#define OGRE_DEFAULT_RT_GROUP 4
+	#define OGRE_REND_TO_TEX_RT_GROUP 2
+#endif
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup RenderSystem
+	*  @{
+	*/
+	/** A 'canvas' which can receive the results of a rendering
+        operation.
+        @remarks
+            This abstract class defines a common root to all targets of rendering operations. A
+            render target could be a window on a screen, or another
+            offscreen surface like a texture or bump map etc.
+        @author
+            Steven Streeting
+        @version
+            1.0
+     */
+    class _OgreExport RenderTarget : public RenderSysAlloc
+    {
+    public:
+        enum StatFlags
+        {
+            SF_NONE           = 0,
+            SF_FPS            = 1,
+            SF_AVG_FPS        = 2,
+            SF_BEST_FPS       = 4,
+            SF_WORST_FPS      = 8,
+            SF_TRIANGLE_COUNT = 16,
+            SF_ALL            = 0xFFFF
+        };
+
+        struct FrameStats
+        {
+            float lastFPS;
+            float avgFPS;
+            float bestFPS;
+            float worstFPS;
+            unsigned long bestFrameTime;
+            unsigned long worstFrameTime;
+            size_t triangleCount;
+            size_t batchCount;
+        };
+
+		enum FrameBuffer
+		{
+			FB_FRONT,
+			FB_BACK,
+			FB_AUTO
+		};
+
+        RenderTarget();
+        virtual ~RenderTarget();
+
+        /// Retrieve target's name.
+        virtual const String& getName(void) const;
+
+        /// Retrieve information about the render target.
+        virtual void getMetrics(unsigned int& width, unsigned int& height, unsigned int& colourDepth);
+
+        virtual uint32 getWidth(void) const;
+        virtual uint32 getHeight(void) const;
+        virtual uint32 getColourDepth(void) const;
+
+		/**
+		 * Sets the pool ID this RenderTarget should query from. Default value is POOL_DEFAULT.
+		 * Set to POOL_NO_DEPTH to avoid using a DepthBuffer (or manually controlling it) @see DepthBuffer
+		 *	@remarks
+		 *		Changing the pool Id will cause the current depth buffer to be detached unless the old
+		 *		id and the new one are the same
+		 */
+		void setDepthBufferPool( uint16 poolId );
+
+		//Returns the pool ID this RenderTarget should query from. @see DepthBuffer
+		uint16 getDepthBufferPool() const;
+
+		DepthBuffer* getDepthBuffer() const;
+
+		//Returns false if couldn't attach
+		virtual bool attachDepthBuffer( DepthBuffer *depthBuffer );
+
+		virtual void detachDepthBuffer();
+
+		/** Detaches DepthBuffer without notifying it from the detach.
+			Useful when called from the DepthBuffer while it iterates through attached
+			RenderTargets (@see DepthBuffer::_setPoolId())
+		*/
+		virtual void _detachDepthBuffer();
+
+        /** Tells the target to update it's contents.
+            @remarks
+                If OGRE is not running in an automatic rendering loop
+                (started using Root::startRendering),
+                the user of the library is responsible for asking each render
+                target to refresh. This is the method used to do this. It automatically
+                re-renders the contents of the target using whatever cameras have been
+                pointed at it (using Camera::setRenderTarget).
+            @par
+                This allows OGRE to be used in multi-windowed utilities
+                and for contents to be refreshed only when required, rather than
+                constantly as with the automatic rendering loop.
+			@param swapBuffers For targets that support double-buffering, if set 
+				to true, the target will immediately
+				swap it's buffers after update. Otherwise, the buffers are
+				not swapped, and you have to call swapBuffers yourself sometime
+				later. You might want to do this on some rendersystems which 
+				pause for queued rendering commands to complete before accepting
+				swap buffers calls - so you could do other CPU tasks whilst the 
+				queued commands complete. Or, you might do this if you want custom
+				control over your windows, such as for externally created windows.
+        */
+        virtual void update(bool swapBuffers = true);
+        /** Swaps the frame buffers to display the next frame.
+            @remarks
+                For targets that are double-buffered so that no
+                'in-progress' versions of the scene are displayed
+                during rendering. Once rendering has completed (to
+                an off-screen version of the window) the buffers
+                are swapped to display the new frame.
+        */
+        virtual void swapBuffers() {}
+
+        /** Adds a viewport to the rendering target.
+            @remarks
+                A viewport is the rectangle into which rendering output is sent. This method adds
+                a viewport to the render target, rendering from the supplied camera. The
+                rest of the parameters are only required if you wish to add more than one viewport
+                to a single rendering target. Note that size information passed to this method is
+                passed as a parametric, i.e. it is relative rather than absolute. This is to allow
+                viewports to automatically resize along with the target.
+            @param
+                cam The camera from which the viewport contents will be rendered (mandatory)
+            @param
+                ZOrder The relative order of the viewport with others on the target (allows overlapping
+                viewports i.e. picture-in-picture). Higher Z-orders are on top of lower ones. The actual number
+                is irrelevant, only the relative Z-order matters (you can leave gaps in the numbering)
+            @param
+                left The relative position of the left of the viewport on the target, as a value between 0 and 1.
+            @param
+                top The relative position of the top of the viewport on the target, as a value between 0 and 1.
+            @param
+                width The relative width of the viewport on the target, as a value between 0 and 1.
+            @param
+                height The relative height of the viewport on the target, as a value between 0 and 1.
+        */
+        virtual Viewport* addViewport(Camera* cam, int ZOrder = 0, float left = 0.0f, float top = 0.0f ,
+            float width = 1.0f, float height = 1.0f);
+
+        /** Returns the number of viewports attached to this target.*/
+        virtual unsigned short getNumViewports(void) const;
+
+        /** Retrieves a pointer to the viewport with the given index. */
+        virtual Viewport* getViewport(unsigned short index);
+
+		/** Retrieves a pointer to the viewport with the given Z-order. 
+			@remarks throws if not found.
+		*/
+        virtual Viewport* getViewportByZOrder(int ZOrder);
+
+		/** Returns true if and only if a viewport exists at the given Z-order. */
+		virtual bool hasViewportWithZOrder(int ZOrder);
+
+        /** Removes a viewport at a given Z-order.
+        */
+        virtual void removeViewport(int ZOrder);
+
+        /** Removes all viewports on this target.
+        */
+        virtual void removeAllViewports(void);
+
+        /** Retieves details of current rendering performance.
+            @remarks
+                If the user application wishes to do it's own performance
+                display, or use performance for some other means, this
+                method allows it to retrieve the statistics.
+                @param
+                    lastFPS Pointer to a float to receive the number of frames per second (FPS)
+                    based on the last frame rendered.
+                @param
+                    avgFPS Pointer to a float to receive the FPS rating based on an average of all
+                    the frames rendered since rendering began (the call to
+                    Root::startRendering).
+                @param
+                    bestFPS Pointer to a float to receive the best FPS rating that has been achieved
+                    since rendering began.
+                @param
+                    worstFPS Pointer to a float to receive the worst FPS rating seen so far.
+        */
+        virtual void getStatistics(float& lastFPS, float& avgFPS,
+            float& bestFPS, float& worstFPS) const;  // Access to stats
+
+        virtual const FrameStats& getStatistics(void) const;
+
+        /** Individual stats access - gets the number of frames per second (FPS) based on the last frame rendered.
+        */
+        virtual float getLastFPS() const;
+
+        /** Individual stats access - gets the average frames per second (FPS) since call to Root::startRendering.
+        */
+        virtual float getAverageFPS() const;
+
+        /** Individual stats access - gets the best frames per second (FPS) since call to Root::startRendering.
+        */
+        virtual float getBestFPS() const;
+
+        /** Individual stats access - gets the worst frames per second (FPS) since call to Root::startRendering.
+        */
+        virtual float getWorstFPS() const;
+
+        /** Individual stats access - gets the best frame time
+        */
+        virtual float getBestFrameTime() const;
+
+        /** Individual stats access - gets the worst frame time
+        */
+        virtual float getWorstFrameTime() const;
+
+        /** Resets saved frame-rate statistices.
+        */
+        virtual void resetStatistics(void);
+
+        /** Gets a custom (maybe platform-specific) attribute.
+            @remarks
+                This is a nasty way of satisfying any API's need to see platform-specific details.
+                It horrid, but D3D needs this kind of info. At least it's abstracted.
+            @param
+                name The name of the attribute.
+            @param
+                pData Pointer to memory of the right kind of structure to receive the info.
+        */
+        virtual void getCustomAttribute(const String& name, void* pData);
+
+        /** Add a listener to this RenderTarget which will be called back before & after rendering.
+        @remarks
+            If you want notifications before and after a target is updated by the system, use
+            this method to register your own custom RenderTargetListener class. This is useful
+            for potentially adding your own manual rendering commands before and after the
+            'normal' system rendering.
+        @par NB this should not be used for frame-based scene updates, use Root::addFrameListener for that.
+        */
+        virtual void addListener(RenderTargetListener* listener);
+        /** Removes a RenderTargetListener previously registered using addListener. */
+        virtual void removeListener(RenderTargetListener* listener);
+        /** Removes all listeners from this instance. */
+        virtual void removeAllListeners(void);
+
+		/** Sets the priority of this render target in relation to the others. 
+        @remarks
+            This can be used in order to schedule render target updates. Lower
+            priorities will be rendered first. Note that the priority must be set
+            at the time the render target is attached to the render system, changes
+            afterwards will not affect the ordering.
+        */
+        virtual void setPriority( uchar priority ) { mPriority = priority; }
+        /** Gets the priority of a render target. */
+		virtual uchar getPriority() const { return mPriority; }
+
+        /** Used to retrieve or set the active state of the render target.
+        */
+        virtual bool isActive() const;
+
+        /** Used to set the active state of the render target.
+        */
+        virtual void setActive( bool state );
+
+        /** Sets whether this target should be automatically updated if Ogre's rendering
+            loop or Root::_updateAllRenderTargets is being used.
+        @remarks
+            By default, if you use Ogre's own rendering loop (Root::startRendering)
+            or call Root::_updateAllRenderTargets, all render targets are updated 
+            automatically. This method allows you to control that behaviour, if 
+            for example you have a render target which you only want to update periodically.
+        @param autoupdate If true, the render target is updated during the automatic render
+            loop or when Root::_updateAllRenderTargets is called. If false, the 
+            target is only updated when its update() method is called explicitly.
+        */
+        virtual void setAutoUpdated(bool autoupdate);
+        /** Gets whether this target is automatically updated if Ogre's rendering
+            loop or Root::_updateAllRenderTargets is being used.
+        */
+        virtual bool isAutoUpdated(void) const;
+
+		/** Copies the current contents of the render target to a pixelbox. 
+		@remarks See suggestPixelFormat for a tip as to the best pixel format to
+			extract into, although you can use whatever format you like and the 
+			results will be converted.
+		*/
+		virtual void copyContentsToMemory(const PixelBox &dst, FrameBuffer buffer = FB_AUTO) = 0;
+
+		/** Suggests a pixel format to use for extracting the data in this target, 
+			when calling copyContentsToMemory.
+		*/
+		virtual PixelFormat suggestPixelFormat() const { return PF_BYTE_RGBA; }
+		
+        /** Writes the current contents of the render target to the named file. */
+        void writeContentsToFile(const String& filename);
+
+		/** Writes the current contents of the render target to the (PREFIX)(time-stamp)(SUFFIX) file.
+			@return the name of the file used.*/
+		virtual String writeContentsToTimestampedFile(const String& filenamePrefix, const String& filenameSuffix);
+
+		virtual bool requiresTextureFlipping() const = 0;
+
+		/** Gets the number of triangles rendered in the last update() call. */
+		virtual size_t getTriangleCount(void) const;
+        /** Gets the number of batches rendered in the last update() call. */
+		virtual size_t getBatchCount(void) const;
+        /** Utility method to notify a render target that a camera has been removed,
+        incase it was referring to it as a viewer.
+        */
+        virtual void _notifyCameraRemoved(const Camera* cam);
+
+        /** Indicates whether this target is the primary window. The
+            primary window is special in that it is destroyed when
+            ogre is shut down, and cannot be destroyed directly.
+            This is the case because it holds the context for vertex,
+            index buffers and textures.
+        */
+        virtual bool isPrimary(void) const;
+
+		/** Indicates whether on rendering, linear colour space is converted to 
+			sRGB gamma colour space. This is the exact opposite conversion of
+			what is indicated by Texture::isHardwareGammaEnabled, and can only
+			be enabled on creation of the render target. For render windows, it's
+			enabled through the 'gamma' creation misc parameter. For textures, 
+			it is enabled through the hwGamma parameter to the create call.
+		*/
+		virtual bool isHardwareGammaEnabled() const { return mHwGamma; }
+
+		/** Indicates whether multisampling is performed on rendering and at what level.
+		*/
+		virtual uint getFSAA() const { return mFSAA; }
+
+		/** Gets the FSAA hint (@see Root::createRenderWindow)
+		*/
+		virtual const String& getFSAAHint() const { return mFSAAHint; }
+
+        /** RenderSystem specific interface for a RenderTarget;
+            this should be subclassed by RenderSystems.
+        */
+        class Impl
+        {
+        protected:
+            ~Impl() { }
+        };
+        /** Get rendersystem specific interface for this RenderTarget.
+            This is used by the RenderSystem to (un)bind this target, 
+            and to get specific information like surfaces
+            and framebuffer objects.
+        */
+        virtual Impl *_getImpl();
+
+		/** Method for manual management of rendering : fires 'preRenderTargetUpdate'
+			and initialises statistics etc.
+		@remarks 
+		<ul>
+		<li>_beginUpdate resets statistics and fires 'preRenderTargetUpdate'.</li>
+		<li>_updateViewport renders the given viewport (even if it is not autoupdated),
+		fires preViewportUpdate and postViewportUpdate and manages statistics.</li>
+		<li>_updateAutoUpdatedViewports renders only viewports that are auto updated,
+		fires preViewportUpdate and postViewportUpdate and manages statistics.</li>
+		<li>_endUpdate() ends statistics calculation and fires postRenderTargetUpdate.</li>
+		</ul>
+		you can use it like this for example :
+		<pre>
+			renderTarget->_beginUpdate();
+			renderTarget->_updateViewport(1); // which is not auto updated
+			renderTarget->_updateViewport(2); // which is not auto updated
+			renderTarget->_updateAutoUpdatedViewports();
+			renderTarget->_endUpdate();
+			renderTarget->swapBuffers();
+		</pre>
+			Please note that in that case, the zorder may not work as you expect,
+			since you are responsible for calling _updateViewport in the correct order.
+        */
+		virtual void _beginUpdate();
+
+		/** Method for manual management of rendering - renders the given 
+		viewport (even if it is not autoupdated)
+		@remarks
+		This also fires preViewportUpdate and postViewportUpdate, and manages statistics.
+		You should call it between _beginUpdate() and _endUpdate().
+		@see _beginUpdate for more details.
+		@param zorder The zorder of the viewport to update.
+		@param updateStatistics Whether you want to update statistics or not.
+		*/
+		virtual void _updateViewport(int zorder, bool updateStatistics = true);
+
+		/** Method for manual management of rendering - renders the given viewport (even if it is not autoupdated)
+		@remarks
+		This also fires preViewportUpdate and postViewportUpdate, and manages statistics
+		if needed. You should call it between _beginUpdate() and _endUpdate().
+		@see _beginUpdate for more details.
+		@param viewport The viewport you want to update, it must be bound to the rendertarget.
+		@param updateStatistics Whether you want to update statistics or not.
+		*/
+		virtual void _updateViewport(Viewport* viewport, bool updateStatistics = true);
+
+		/** Method for manual management of rendering - renders only viewports that are auto updated
+		@remarks
+		This also fires preViewportUpdate and postViewportUpdate, and manages statistics.
+		You should call it between _beginUpdate() and _endUpdate().
+		See _beginUpdate for more details.
+		@param updateStatistics Whether you want to update statistics or not.
+		@see _beginUpdate()
+		*/
+		virtual void _updateAutoUpdatedViewports(bool updateStatistics = true);
+		
+		/** Method for manual management of rendering - finishes statistics calculation 
+			and fires 'postRenderTargetUpdate'.
+		@remarks
+		You should call it after a _beginUpdate
+		@see _beginUpdate for more details.
+		*/
+		virtual void _endUpdate();
+
+    protected:
+        /// The name of this target.
+        String mName;
+		/// The priority of the render target.
+		uchar mPriority;
+
+        uint32 mWidth;
+        uint32 mHeight;
+        uint32 mColourDepth;
+		uint16		 mDepthBufferPoolId;
+        DepthBuffer	*mDepthBuffer;
+
+        // Stats
+		FrameStats mStats;
+        
+        Timer* mTimer ;
+        unsigned long mLastSecond;
+        unsigned long mLastTime;
+        size_t mFrameCount;
+
+        bool mActive;
+        bool mAutoUpdate;
+		// Hardware sRGB gamma conversion done on write?
+		bool mHwGamma;
+		// FSAA performed?
+		uint mFSAA;
+		String mFSAAHint;
+
+        void updateStats(void);
+
+		typedef map<int, Viewport*>::type ViewportList;
+        /// List of viewports, map on Z-order
+        ViewportList mViewportList;
+
+        typedef vector<RenderTargetListener*>::type RenderTargetListenerList;
+        RenderTargetListenerList mListeners;
+	
+
+        /// internal method for firing events
+        virtual void firePreUpdate(void);
+        /// internal method for firing events
+        virtual void firePostUpdate(void);
+        /// internal method for firing events
+        virtual void fireViewportPreUpdate(Viewport* vp);
+        /// internal method for firing events
+        virtual void fireViewportPostUpdate(Viewport* vp);
+		/// internal method for firing events
+		virtual void fireViewportAdded(Viewport* vp);
+		/// internal method for firing events
+		virtual void fireViewportRemoved(Viewport* vp);
+		
+		/// Internal implementation of update()
+		virtual void updateImpl();
+    };
+	/** @} */
+	/** @} */
+
+} // Namespace
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreRenderTargetListener.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreRenderTargetListener.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreRenderTargetListener.h	(revision 148)
@@ -0,0 +1,146 @@
+/*
+-----------------------------------------------------------------------------
+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 __RenderTargetListener_H__
+#define __RenderTargetListener_H__
+
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup RenderSystem
+	*  @{
+	*/
+	/** Struct containing information about a RenderTarget event.
+    */
+    struct RenderTargetEvent
+    {
+        /// The source of the event being raised
+        RenderTarget* source;
+    };
+
+    /** Struct containing information about a RenderTarget Viewport-specific event.
+    */
+    struct RenderTargetViewportEvent
+    {
+        /// The source of the event being raised
+        Viewport* source;
+    };
+
+    /** A interface class defining a listener which can be used to receive
+        notifications of RenderTarget events.
+        @remarks
+            A 'listener' is an interface designed to be called back when
+            particular events are called. This class defines the
+            interface relating to RenderTarget events. In order to receive
+            notifications of RenderTarget events, you should create a subclass of
+            RenderTargetListener and override the methods for which you would like
+            to customise the resulting processing. You should then call
+            RenderTarget::addListener passing an instance of this class.
+            There is no limit to the number of RenderTarget listeners you can register,
+            allowing you to register multiple listeners for different purposes.
+
+            RenderTarget events occur before and after the target is updated as a whole,
+            and before and after each viewport on that target is updated. Each RenderTarget
+            holds it's own set of listeners, but you can register the same listener on
+            multiple render targets if you like since the event contains details of the
+            originating RenderTarget.
+    */
+    class _OgreExport RenderTargetListener
+    {
+        /*
+        Note that this could have been an abstract class, but I made
+        the explicit choice not to do this, because I wanted to give
+        people the option of only implementing the methods they wanted,
+        rather than having to create 'do nothing' implementations for
+        those they weren't interested in. As such this class follows
+        the 'Adapter' classes in Java rather than pure interfaces.
+        */
+    public:
+		virtual ~RenderTargetListener() {}
+        /** Called just before a RenderTarget is about to be rendered into.
+        @remarks
+            This event is raised just before any of the viewports on the target
+            are rendered to. You can perform manual rendering operations here if
+            you want, but please note that if the Viewport objects attached to this
+            target are set up to clear the background, you will lose whatever you 
+            render. If you want some kind of backdrop in this event
+            you should turn off background clearing off on the viewports, and either
+            clear the viewports yourself in this event handler before doing your rendering
+            or just render over the top if you don't need to.
+        */
+        virtual void preRenderTargetUpdate(const RenderTargetEvent& evt)
+        { (void)evt; }
+
+        /** Called just after a RenderTarget has been rendered to.
+        @remarks
+            This event is called just after all the viewports attached to the target
+            in question have been rendered to. You can perform your own manual rendering
+            commands in this event handler if you like, these will be composited with
+            the contents of the target already there (depending on the material settings 
+            you use etc).
+        */
+        virtual void postRenderTargetUpdate(const RenderTargetEvent& evt)
+        { (void)evt; }
+
+        /* Called just before a Viewport on a RenderTarget is to be updated.
+        @remarks
+            This method is called before each viewport on the RenderTarget is
+            rendered to. You can use this to perform per-viewport settings changes,
+            such as showing / hiding particular overlays.
+        */
+        virtual void preViewportUpdate(const RenderTargetViewportEvent& evt)
+        { (void)evt; }
+
+        /* Called just after a Viewport on a RenderTarget is to be updated.
+        @remarks
+            This method is called after each viewport on the RenderTarget is
+            rendered to. 
+        */
+        virtual void postViewportUpdate(const RenderTargetViewportEvent& evt)
+        { (void)evt; }
+
+		/** Called to notify listener that a Viewport has been added to the 
+			target in question.
+		*/
+		virtual void viewportAdded(const RenderTargetViewportEvent& evt)
+                { (void)evt; }
+		/** Called to notify listener that a Viewport has been removed from the 
+			target in question.
+		*/
+		virtual void viewportRemoved(const RenderTargetViewportEvent& evt)
+                { (void)evt; }
+    };
+	/** @} */
+	/** @} */
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreRenderTexture.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreRenderTexture.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreRenderTexture.h	(revision 148)
@@ -0,0 +1,142 @@
+/*
+-----------------------------------------------------------------------------
+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 __RenderTexture_H__
+#define __RenderTexture_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreRenderTarget.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre
+{    
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup RenderSystem
+	*  @{
+	*/
+	/** This class represents a RenderTarget that renders to a Texture. There is no 1 on 1
+        relation between Textures and RenderTextures, as there can be multiple 
+        RenderTargets rendering to different mipmaps, faces (for cubemaps) or slices (for 3D textures)
+        of the same Texture.
+    */
+    class _OgreExport RenderTexture: public RenderTarget
+    {
+    public:
+        RenderTexture(HardwarePixelBuffer *buffer, uint32 zoffset);
+        virtual ~RenderTexture();
+
+		virtual void copyContentsToMemory(const PixelBox &dst, FrameBuffer buffer);
+		PixelFormat suggestPixelFormat() const;
+
+	protected:
+		HardwarePixelBuffer *mBuffer;
+		uint32 mZOffset;
+    };
+
+	/** This class represents a render target that renders to multiple RenderTextures
+		at once. Surfaces can be bound and unbound at will, as long as the following constraints
+		are met:
+		- All bound surfaces have the same size
+		- All bound surfaces have the same bit depth
+		- Target 0 is bound
+	*/
+	class _OgreExport MultiRenderTarget: public RenderTarget
+	{
+	public:
+		MultiRenderTarget(const String &name);
+
+		/** Bind a surface to a certain attachment point.
+            @param attachment	0 .. mCapabilities->getNumMultiRenderTargets()-1
+			@param target		RenderTexture to bind.
+
+			It does not bind the surface and fails with an exception (ERR_INVALIDPARAMS) if:
+			- Not all bound surfaces have the same size
+			- Not all bound surfaces have the same internal format 
+		*/
+
+		virtual void bindSurface(size_t attachment, RenderTexture *target)
+		{
+			for (size_t i = mBoundSurfaces.size(); i <= attachment; ++i)
+			{
+				mBoundSurfaces.push_back(0);
+			}
+			mBoundSurfaces[attachment] = target;
+
+			bindSurfaceImpl(attachment, target);
+		}
+
+
+
+		/** Unbind attachment.
+		*/
+
+		virtual void unbindSurface(size_t attachment)
+		{
+			if (attachment < mBoundSurfaces.size())
+				mBoundSurfaces[attachment] = 0;
+			unbindSurfaceImpl(attachment);
+		}
+
+		/** Error throwing implementation, it's not possible to write a MultiRenderTarget
+			to disk. 
+		*/
+		virtual void copyContentsToMemory(const PixelBox &dst, FrameBuffer buffer);
+
+		/// Irrelevant implementation since cannot copy
+		PixelFormat suggestPixelFormat() const { return PF_UNKNOWN; }
+
+		typedef vector<RenderTexture*>::type BoundSufaceList;
+		/// Get a list of the surfaces which have been bound
+		const BoundSufaceList& getBoundSurfaceList() const { return mBoundSurfaces; }
+
+		/** Get a pointer to a bound surface */
+		RenderTexture* getBoundSurface(size_t index)
+		{
+			assert (index < mBoundSurfaces.size());
+			return mBoundSurfaces[index];
+		}
+
+
+	protected:
+		BoundSufaceList mBoundSurfaces;
+
+		/// Implementation of bindSurface, must be provided
+		virtual void bindSurfaceImpl(size_t attachment, RenderTexture *target) = 0;
+		/// Implementation of unbindSurface, must be provided
+		virtual void unbindSurfaceImpl(size_t attachment) = 0;
+
+
+	};
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreRenderToVertexBuffer.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreRenderToVertexBuffer.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreRenderToVertexBuffer.h	(revision 148)
@@ -0,0 +1,151 @@
+/*
+-----------------------------------------------------------------------------
+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 __RenderToVertexBuffer_H__
+#define __RenderToVertexBuffer_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreMaterial.h"
+#include "OgreRenderOperation.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup RenderSystem
+	*  @{
+	*/
+	/**
+        An object which renders geometry to a vertex.
+    @remarks
+        This is especially useful together with geometry shaders, as you can
+        render procedural geometry which will get saved to a vertex buffer for
+        reuse later, without regenerating it again. You can also create shaders
+        that run on previous results of those shaders, creating stateful 
+        shaders.
+    */
+    class _OgreExport RenderToVertexBuffer
+    {    
+    public:
+		/** C'tor */
+		RenderToVertexBuffer();
+		/** D'tor */
+        virtual ~RenderToVertexBuffer();
+
+        /**
+            Get the vertex declaration that the pass will output.
+        @remarks
+            Use this object to set the elements of the buffer. Object will calculate
+            buffers on its own. Only one source allowed!
+        */
+        VertexDeclaration* getVertexDeclaration();
+        
+        /**
+            Get the maximum number of vertices that the buffer will hold
+        */
+		unsigned int getMaxVertexCount() const { return mMaxVertexCount; }
+        
+        /**
+            Set the maximum number of vertices that the buffer will hold
+        */
+		void setMaxVertexCount(unsigned int maxVertexCount) { mMaxVertexCount = maxVertexCount; }
+
+        /**
+            What type of primitives does this object generate?
+        */
+		RenderOperation::OperationType getOperationType() const { return mOperationType; }
+
+        /**
+            Set the type of primitives that this object generates
+        */
+		void setOperationType(RenderOperation::OperationType operationType) { mOperationType = operationType; }
+
+        /**
+            Set whether this object resets its buffers each time it updates.
+        */
+		void setResetsEveryUpdate(bool resetsEveryUpdate) { mResetsEveryUpdate = resetsEveryUpdate; }
+
+        /**
+            Does this object reset its buffer each time it updates?
+        */
+		bool getResetsEveryUpdate() const { return mResetsEveryUpdate; }
+
+        /**
+            Get the render operation for this buffer 
+        */
+        virtual void getRenderOperation(RenderOperation& op) = 0;
+
+        /**
+            Update the contents of this vertex buffer by rendering
+        */
+        virtual void update(SceneManager* sceneMgr) = 0;
+
+        /**
+            Reset the vertex buffer to the initial state. In the next update,
+            the source renderable will be used as input.
+        */
+		virtual void reset() { mResetRequested = true; }
+        
+        /**
+            Set the source renderable of this object. During the first (and 
+            perhaps later) update of this object, this object's data will be
+            used as input)
+        */
+		void setSourceRenderable(Renderable* source) { mSourceRenderable = source; }
+
+        /**
+            Get the source renderable of this object
+        */
+		const Renderable* getSourceRenderable() const { return mSourceRenderable; }
+
+        /**
+            Get the material which is used to render the geometry into the
+            vertex buffer.
+        */
+		const MaterialPtr& getRenderToBufferMaterial() { return mMaterial; }
+
+        /**
+            Set the material name which is used to render the geometry into
+            the vertex buffer
+        */
+        void setRenderToBufferMaterialName(const String& materialName);
+    protected:
+        RenderOperation::OperationType mOperationType;
+        bool mResetsEveryUpdate;
+		bool mResetRequested;
+        MaterialPtr mMaterial;
+        Renderable* mSourceRenderable;
+		VertexData* mVertexData;
+		unsigned int mMaxVertexCount;
+    };
+
+	typedef SharedPtr<RenderToVertexBuffer> RenderToVertexBufferSharedPtr;
+	/** @} */
+	/** @} */
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreRenderWindow.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreRenderWindow.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreRenderWindow.h	(revision 148)
@@ -0,0 +1,214 @@
+/*-------------------------------------------------------------------------
+This source file is a 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 __RenderWindow_H__
+#define __RenderWindow_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreRenderTarget.h"
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup RenderSystem
+	*  @{
+	*/
+	/** Manages the target rendering window.
+        @remarks
+            This class handles a window into which the contents
+            of a scene are rendered. There is a many-to-1 relationship
+            between instances of this class an instance of RenderSystem
+            which controls the rendering of the scene. There may be
+            more than one window in the case of level editor tools etc.
+            This class is abstract since there may be
+            different implementations for different windowing systems.
+        @remarks
+            Instances are created and communicated with by the render system
+            although client programs can get a reference to it from
+            the render system if required for resizing or moving.
+            Note that you can have multiple viewpoints
+            in the window for effects like rear-view mirrors and
+            picture-in-picture views (see Viewport and Camera).
+        @author
+            Steven Streeting
+        @version
+            1.0
+    */
+    class _OgreExport RenderWindow : public RenderTarget
+    {
+
+    public:
+        /** Default constructor.
+        */
+        RenderWindow();
+
+        /** Creates & displays the new window.
+            @param
+                width The width of the window in pixels.
+            @param
+                height The height of the window in pixels.
+            @param
+                fullScreen If true, the window fills the screen,
+                with no title bar or border.
+            @param
+                miscParams A variable number of pointers to platform-specific arguments. The
+                actual requirements must be defined by the implementing subclasses.
+        */
+		virtual void create(const String& name, unsigned int width, unsigned int height,
+	            bool fullScreen, const NameValuePairList *miscParams) = 0;
+
+		/** Alter fullscreen mode options. 
+		@note Nothing will happen unless the settings here are different from the
+			current settings.
+		@param fullScreen Whether to use fullscreen mode or not. 
+		@param width The new width to use
+		@param height The new height to use
+		*/
+		virtual void setFullscreen(bool fullScreen, unsigned int width, unsigned int height)
+                { (void)fullScreen; (void)width; (void)height; }
+        
+        /** Destroys the window.
+        */
+        virtual void destroy(void) = 0;
+
+        /** Alter the size of the window.
+        */
+        virtual void resize(unsigned int width, unsigned int height) = 0;
+
+        /** Notify that the window has been resized
+        @remarks
+            You don't need to call this unless you created the window externally.
+        */
+        virtual void windowMovedOrResized() {}
+
+        /** Reposition the window.
+        */
+        virtual void reposition(int left, int top) = 0;
+
+        /** Indicates whether the window is visible (not minimized or obscured)
+        */
+        virtual bool isVisible(void) const { return true; }
+
+        /** Set the visibility state
+        */
+        virtual void setVisible(bool visible)
+        { (void)visible; }
+
+		/** Indicates whether the window was set to hidden (not displayed)
+		*/
+		virtual bool isHidden(void) const { return false; }
+
+		/** Hide (or show) the window. If called with hidden=true, this
+			will make the window completely invisible to the user.
+		@remarks
+			Setting a window to hidden is useful to create a dummy primary
+			RenderWindow hidden from the user so that you can create and
+			recreate your actual RenderWindows without having to recreate
+			all your resources.
+		*/
+		virtual void setHidden(bool hidden)
+		{ (void)hidden; }
+
+		/** Enable or disable vertical sync for the RenderWindow.
+		*/
+		virtual void setVSyncEnabled(bool vsync)
+		{ (void)vsync; }
+
+		/** Indicates whether vertical sync is activated for the window.
+		*/
+		virtual bool isVSyncEnabled() const { return false; }
+
+		/** Set the vertical sync interval. This indicates the number of vertical retraces to wait for
+		  	before swapping buffers. A value of 1 is the default.
+		*/
+		virtual void setVSyncInterval(unsigned int interval)
+		{ (void)interval; }
+
+		/** Returns the vertical sync interval. 
+		*/
+		virtual unsigned int getVSyncInterval() const { return 1; }
+	    
+
+        /** Overridden from RenderTarget, flags invisible windows as inactive
+        */
+        virtual bool isActive(void) const { return mActive && isVisible(); }
+
+        /** Indicates whether the window has been closed by the user.
+        */
+        virtual bool isClosed(void) const = 0;
+        
+        /** Indicates whether the window is the primary window. The
+        	primary window is special in that it is destroyed when 
+        	ogre is shut down, and cannot be destroyed directly.
+        	This is the case because it holds the context for vertex,
+        	index buffers and textures.
+        */
+        virtual bool isPrimary(void) const;
+
+        /** Returns true if window is running in fullscreen mode.
+        */
+        virtual bool isFullScreen(void) const;
+
+        /** Overloaded version of getMetrics from RenderTarget, including extra details
+            specific to windowing systems.
+        */
+        virtual void getMetrics(unsigned int& width, unsigned int& height, unsigned int& colourDepth, 
+			int& left, int& top);
+
+		/// Override since windows don't usually have alpha
+		PixelFormat suggestPixelFormat() const { return PF_BYTE_RGB; }
+
+        /** Returns true if the window will automatically de-activate itself when it loses focus.
+        */
+        bool isDeactivatedOnFocusChange() const;
+
+        /** Indicates whether the window will automatically deactivate itself when it loses focus.
+          * @param deactivate a value of 'true' will cause the window to deactivate itself when it loses focus.  'false' will allow it to continue to render even when window focus is lost.
+          * @note 'true' is the default behavior.
+          */
+        void setDeactivateOnFocusChange(bool deactivate);
+
+    protected:
+        bool mIsFullScreen;
+        bool mIsPrimary;
+        bool mAutoDeactivatedOnFocusChange;
+        int mLeft;
+        int mTop;
+        
+        /** Indicates that this is the primary window. Only to be called by
+            Ogre::Root
+        */
+        void _setPrimary() { mIsPrimary = true; }
+        
+        friend class Root;
+    };
+	/** @} */
+	/** @} */
+
+} // Namespace
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreRenderable.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreRenderable.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreRenderable.h	(revision 148)
@@ -0,0 +1,430 @@
+/*
+-----------------------------------------------------------------------------
+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 __Renderable_H__
+#define __Renderable_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreCommon.h"
+
+#include "OgreRenderOperation.h"
+#include "OgreMatrix4.h"
+#include "OgreMaterial.h"
+#include "OgrePlane.h"
+#include "OgreGpuProgram.h"
+#include "OgreVector4.h"
+#include "OgreException.h"
+#include "OgreUserObjectBindings.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+    /** \addtogroup Core
+    *  @{
+    */
+    /** \addtogroup Scene
+    *  @{
+    */
+    /** Abstract class defining the interface all renderable objects must implement.
+    @remarks
+        This interface abstracts renderable discrete objects which will be queued in the render pipeline,
+        grouped by material. Classes implementing this interface must be based on a single material, a single
+        world matrix (or a collection of world matrices which are blended by weights), and must be 
+        renderable via a single render operation.
+    @par
+        Note that deciding whether to put these objects in the rendering pipeline is done from the more specific
+        classes e.g. entities. Only once it is decided that the specific class is to be rendered is the abstract version
+        created (could be more than one per visible object) and pushed onto the rendering queue.
+    */
+    class _OgreExport Renderable
+    {
+    public:
+        /** An internal class that should be used only by a render system for internal use 
+        @remarks
+            This class was created so a render system can associate internal data to this class.
+            The need for this class started when the DX10 render system needed to save state objects.
+        */
+        class RenderSystemData {}; 
+    public:
+        Renderable() : mPolygonModeOverrideable(true), mUseIdentityProjection(false), mUseIdentityView(false), mRenderSystemData(NULL) {}
+        /** Virtual destructor needed as class has virtual methods. */
+        virtual ~Renderable() 
+        {
+            if (mRenderSystemData)
+            {
+                delete mRenderSystemData;
+                mRenderSystemData = NULL;
+            }
+        }
+        /** Retrieves a weak reference to the material this renderable object uses.
+        @remarks
+            Note that the Renderable also has the option to override the getTechnique method
+            to specify a particular Technique to use instead of the best one available.
+        */
+        virtual const MaterialPtr& getMaterial(void) const = 0;
+        /** Retrieves a pointer to the Material Technique this renderable object uses.
+        @remarks
+            This is to allow Renderables to use a chosen Technique if they wish, otherwise
+            they will use the best Technique available for the Material they are using.
+        */
+        virtual Technique* getTechnique(void) const { return getMaterial()->getBestTechnique(0, this); }
+        /** Gets the render operation required to send this object to the frame buffer.
+        */
+        virtual void getRenderOperation(RenderOperation& op) = 0;
+
+        /** Called just prior to the Renderable being rendered. 
+        @remarks
+            OGRE is a queued renderer, so the actual render commands are executed 
+            at a later time than the point at which an object is discovered to be
+            visible. This allows ordering & grouping of renders without the discovery
+            process having to be aware of it. It also means OGRE uses declarative
+            render information rather than immediate mode rendering - this is very useful
+            in that certain effects and processes can automatically be applied to 
+            a wide range of scenes, but the downside is that special cases are
+            more difficult to handle, because there is not the declared state to 
+            cope with it. 
+        @par
+            This method allows a Renderable to do something special at the actual
+            point of rendering if it wishes to. When this method is called, all the
+            material render state as declared by this Renderable has already been set, 
+            all that is left to do is to bind the buffers and perform the render. 
+            The Renderable may modify render state itself if it wants to (and restore it in the 
+            postRender call) before the automated render happens, or by returning
+            'false' from this method can actually suppress the automatic render
+            and perform one of its own.
+        @return
+            true if the automatic render should proceed, false to skip it on 
+            the assumption that the Renderable has done it manually.
+        */
+        virtual bool preRender(SceneManager* sm, RenderSystem* rsys)
+                { (void)sm; (void)rsys; return true; }
+
+        /** Called immediately after the Renderable has been rendered. 
+        */
+        virtual void postRender(SceneManager* sm, RenderSystem* rsys)
+                { (void)sm; (void)rsys; }
+
+        /** Gets the world transform matrix / matrices for this renderable object.
+        @remarks
+            If the object has any derived transforms, these are expected to be up to date as long as
+            all the SceneNode structures have been updated before this is called.
+        @par
+            This method will populate transform with 1 matrix if it does not use vertex blending. If it
+            does use vertex blending it will fill the passed in pointer with an array of matrices,
+            the length being the value returned from getNumWorldTransforms.
+        @note
+            Internal Ogre never supports non-affine matrix for world transform matrix/matrices,
+            the behavior is undefined if returns non-affine matrix here. @see Matrix4::isAffine.
+        */
+        virtual void getWorldTransforms(Matrix4* xform) const = 0;
+
+        /** Returns the number of world transform matrices this renderable requires.
+        @remarks
+            When a renderable uses vertex blending, it uses multiple world matrices instead of a single
+            one. Each vertex sent to the pipeline can reference one or more matrices in this list
+            with given weights.
+            If a renderable does not use vertex blending this method returns 1, which is the default for 
+            simplicity.
+        */
+        virtual unsigned short getNumWorldTransforms(void) const { return 1; }
+
+        /** Sets whether or not to use an 'identity' projection.
+        @remarks
+            Usually Renderable objects will use a projection matrix as determined
+            by the active camera. However, if they want they can cancel this out
+            and use an identity projection, which effectively projects in 2D using
+            a {-1, 1} view space. Useful for overlay rendering. Normal renderables
+            need not change this. The default is false.
+        @see Renderable::getUseIdentityProjection
+        */
+        void setUseIdentityProjection(bool useIdentityProjection)
+        {
+            mUseIdentityProjection = useIdentityProjection;
+        }
+
+        /** Returns whether or not to use an 'identity' projection.
+        @remarks
+            Usually Renderable objects will use a projection matrix as determined
+            by the active camera. However, if they want they can cancel this out
+            and use an identity projection, which effectively projects in 2D using
+            a {-1, 1} view space. Useful for overlay rendering. Normal renderables
+            need not change this.
+        @see Renderable::setUseIdentityProjection
+        */
+        bool getUseIdentityProjection(void) const { return mUseIdentityProjection; }
+
+        /** Sets whether or not to use an 'identity' view.
+        @remarks
+            Usually Renderable objects will use a view matrix as determined
+            by the active camera. However, if they want they can cancel this out
+            and use an identity matrix, which means all geometry is assumed
+            to be relative to camera space already. Useful for overlay rendering. 
+            Normal renderables need not change this. The default is false.
+        @see Renderable::getUseIdentityView
+        */
+        void setUseIdentityView(bool useIdentityView)
+        {
+            mUseIdentityView = useIdentityView;
+        }
+
+        /** Returns whether or not to use an 'identity' view.
+        @remarks
+            Usually Renderable objects will use a view matrix as determined
+            by the active camera. However, if they want they can cancel this out
+            and use an identity matrix, which means all geometry is assumed
+            to be relative to camera space already. Useful for overlay rendering. 
+            Normal renderables need not change this.
+        @see Renderable::setUseIdentityView
+        */
+        bool getUseIdentityView(void) const { return mUseIdentityView; }
+
+        /** Returns the camera-relative squared depth of this renderable.
+        @remarks
+            Used to sort transparent objects. Squared depth is used rather than
+            actual depth to avoid having to perform a square root on the result.
+        */
+        virtual Real getSquaredViewDepth(const Camera* cam) const = 0;
+
+        /** Gets a list of lights, ordered relative to how close they are to this renderable.
+        @remarks
+            Directional lights, which have no position, will always be first on this list.
+        */
+        virtual const LightList& getLights(void) const = 0;
+
+        /** Method which reports whether this renderable would normally cast a
+            shadow. 
+        @remarks
+            Subclasses should override this if they could have been used to 
+            generate a shadow.
+        */
+        virtual bool getCastsShadows(void) const { return false; }
+
+        /** Sets a custom parameter for this Renderable, which may be used to 
+            drive calculations for this specific Renderable, like GPU program parameters.
+        @remarks
+            Calling this method simply associates a numeric index with a 4-dimensional
+            value for this specific Renderable. This is most useful if the material
+            which this Renderable uses a vertex or fragment program, and has an 
+            ACT_CUSTOM parameter entry. This parameter entry can refer to the
+            index you specify as part of this call, thereby mapping a custom
+            parameter for this renderable to a program parameter.
+        @param index The index with which to associate the value. Note that this
+            does not have to start at 0, and can include gaps. It also has no direct
+            correlation with a GPU program parameter index - the mapping between the
+            two is performed by the ACT_CUSTOM entry, if that is used.
+        @param value The value to associate.
+        */
+        void setCustomParameter(size_t index, const Vector4& value) 
+        {
+            mCustomParameters[index] = value;
+        }
+
+        /** Removes a custom value which is associated with this Renderable at the given index.
+        @param index Index of the parameter to remove.
+            @see setCustomParameter for full details.
+        */
+        void removeCustomParameter(size_t index)
+        {
+            mCustomParameters.erase(index);
+        }
+
+        /** Checks whether a custom value is associated with this Renderable at the given index.
+        @param index Index of the parameter to check for existence.
+            @see setCustomParameter for full details.
+        */
+        bool hasCustomParameter(size_t index) const
+        {
+            return mCustomParameters.find(index) != mCustomParameters.end();
+        }
+
+        /** Gets the custom value associated with this Renderable at the given index.
+        @param index Index of the parameter to retrieve.
+            @see setCustomParameter for full details.
+        */
+        const Vector4& getCustomParameter(size_t index) const
+        {
+            CustomParameterMap::const_iterator i = mCustomParameters.find(index);
+            if (i != mCustomParameters.end())
+            {
+                return i->second;
+            }
+            else
+            {
+                OGRE_EXCEPT(Exception::ERR_ITEM_NOT_FOUND, 
+                    "Parameter at the given index was not found.",
+                    "Renderable::getCustomParameter");
+            }
+        }
+
+        /** Update a custom GpuProgramParameters constant which is derived from 
+            information only this Renderable knows.
+        @remarks
+            This method allows a Renderable to map in a custom GPU program parameter
+            based on it's own data. This is represented by a GPU auto parameter
+            of ACT_CUSTOM, and to allow there to be more than one of these per
+            Renderable, the 'data' field on the auto parameter will identify
+            which parameter is being updated. The implementation of this method
+            must identify the parameter being updated, and call a 'setConstant' 
+            method on the passed in GpuProgramParameters object, using the details
+            provided in the incoming auto constant setting to identify the index
+            at which to set the parameter.
+        @par
+            You do not need to override this method if you're using the standard
+            sets of data associated with the Renderable as provided by setCustomParameter
+            and getCustomParameter. By default, the implementation will map from the
+            value indexed by the 'constantEntry.data' parameter to a value previously
+            set by setCustomParameter. But custom Renderables are free to override
+            this if they want, in any case.
+        @param constantEntry The auto constant entry referring to the parameter
+            being updated
+        @param params The parameters object which this method should call to 
+            set the updated parameters.
+        */
+        virtual void _updateCustomGpuParameter(
+            const GpuProgramParameters::AutoConstantEntry& constantEntry,
+            GpuProgramParameters* params) const
+        {
+            CustomParameterMap::const_iterator i = mCustomParameters.find(constantEntry.data);
+            if (i != mCustomParameters.end())
+            {
+                params->_writeRawConstant(constantEntry.physicalIndex, i->second, 
+                    constantEntry.elementCount);
+            }
+        }
+
+        /** Sets whether this renderable's chosen detail level can be
+            overridden (downgraded) by the camera setting. 
+        @param override true means that a lower camera detail will override this
+            renderables detail level, false means it won't.
+        */
+        virtual void setPolygonModeOverrideable(bool override)
+        {
+            mPolygonModeOverrideable = override;
+        }
+
+        /** Gets whether this renderable's chosen detail level can be
+            overridden (downgraded) by the camera setting. 
+        */
+        virtual bool getPolygonModeOverrideable(void) const
+        {
+            return mPolygonModeOverrideable;
+        }
+
+        /** @deprecated use UserObjectBindings::setUserAny via getUserObjectBindings() instead.
+            Sets any kind of user value on this object.
+        @remarks
+            This method allows you to associate any user value you like with 
+            this Renderable. This can be a pointer back to one of your own
+            classes for instance.
+        */
+        OGRE_DEPRECATED virtual void setUserAny(const Any& anything) { getUserObjectBindings().setUserAny(anything); }
+
+        /** @deprecated use UserObjectBindings::getUserAny via getUserObjectBindings() instead.
+            Retrieves the custom user value associated with this object.
+        */
+        OGRE_DEPRECATED virtual const Any& getUserAny(void) const { return getUserObjectBindings().getUserAny(); }
+
+        /** Return an instance of user objects binding associated with this class.
+            You can use it to associate one or more custom objects with this class instance.
+        @see UserObjectBindings::setUserAny.
+        */
+        UserObjectBindings&	getUserObjectBindings() { return mUserObjectBindings; }
+
+        /** Return an instance of user objects binding associated with this class.
+            You can use it to associate one or more custom objects with this class instance.
+        @see UserObjectBindings::setUserAny.
+        */
+        const UserObjectBindings& getUserObjectBindings() const { return mUserObjectBindings; }
+
+
+        /** Visitor object that can be used to iterate over a collection of Renderable
+            instances abstractly.
+        @remarks
+            Different scene objects use Renderable differently; some will have a 
+            single Renderable, others will have many. This visitor interface allows
+            classes using Renderable to expose a clean way for external code to
+            get access to the contained Renderable instance(s) that it will
+            eventually add to the render queue.
+        @par
+            To actually have this method called, you have to call a method on the
+            class containing the Renderable instances. One example is 
+            MovableObject::visitRenderables.
+        */
+        class Visitor
+        {
+        public:
+            /** Virtual destructor needed as class has virtual methods. */
+            virtual ~Visitor() { }
+            /** Generic visitor method. 
+            @param rend The Renderable instance being visited
+            @param lodIndex The LOD index to which this Renderable belongs. Some
+                objects support LOD and this will tell you whether the Renderable
+                you're looking at is from the top LOD (0) or otherwise
+            @param isDebug Whether this is a debug renderable or not.
+            @param pAny Optional pointer to some additional data that the class
+                calling the visitor may populate if it chooses to.
+            */
+            virtual void visit(Renderable* rend, ushort lodIndex, bool isDebug, 
+                Any* pAny = 0) = 0;
+        };
+
+        /** Gets RenderSystem private data
+        @remarks
+            This should only be used by a RenderSystem
+        */
+        virtual RenderSystemData * getRenderSystemData() const 
+        { 
+            return mRenderSystemData; 
+        }
+        /** Sets RenderSystem private data
+        @remarks
+            This should only be used by a RenderSystem
+        */
+        virtual void setRenderSystemData(RenderSystemData * val) const
+        { 
+            mRenderSystemData = val; 
+        }
+
+
+    protected:
+        typedef map<size_t, Vector4>::type CustomParameterMap;
+        CustomParameterMap mCustomParameters;
+        bool mPolygonModeOverrideable;
+        bool mUseIdentityProjection;
+        bool mUseIdentityView;
+        UserObjectBindings mUserObjectBindings;      /// User objects binding.
+        mutable RenderSystemData * mRenderSystemData;/// This should be used only by a render system for internal use
+    };
+
+    /** @} */
+    /** @} */
+
+} // namespace Ogre
+
+#include "OgreHeaderSuffix.h"
+
+#endif //__Renderable_H__
Index: /ogre_src_v1-9-0/OgreMain/include/OgreResource.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreResource.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreResource.h	(revision 148)
@@ -0,0 +1,540 @@
+/*
+-----------------------------------------------------------------------------
+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 _Resource_H__
+#define _Resource_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreString.h"
+#include "OgreSharedPtr.h"
+#include "OgreStringInterface.h"
+#include "OgreAtomicScalar.h"
+#include "Threading/OgreThreadHeaders.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+    typedef unsigned long long int ResourceHandle;
+
+
+	// Forward declaration
+	class ManualResourceLoader;
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Resources
+	*  @{
+	*/
+	/** Abstract class representing a loadable resource (e.g. textures, sounds etc)
+        @remarks
+            Resources are data objects that must be loaded and managed throughout
+			an application. A resource might be a mesh, a texture, or any other
+			piece of data - the key thing is that they must be identified by 
+			a name which is unique, must be loaded only once,
+			must be managed efficiently in terms of retrieval, and they may
+			also be unloadable to free memory up when they have not been used for
+			a while and the memory budget is under stress.
+		@par
+			All Resource instances must be a member of a resource group; see
+			ResourceGroupManager for full details.
+        @par
+            Subclasses must implement:
+			<ol>
+			<li>A constructor, overriding the same parameters as the constructor
+			    defined by this class. Subclasses are not allowed to define
+				constructors with other parameters; other settings must be
+				settable through accessor methods before loading.</li>
+            <li>The loadImpl() and unloadImpl() methods - mSize must be set 
+				after loadImpl()</li>
+			<li>StringInterface ParamCommand and ParamDictionary setups
+			    in order to allow setting of core parameters (prior to load)
+				through a generic interface.</li>
+			</ol>
+    */
+	class _OgreExport Resource : public StringInterface, public ResourceAlloc
+    {
+	public:
+        OGRE_AUTO_MUTEX; // public to allow external locking
+		class Listener
+		{
+		public:
+		   	Listener() {}
+			virtual ~Listener() {}
+
+			/** Callback to indicate that background loading has completed.
+			@deprecated
+				Use loadingComplete instead.
+			*/
+			OGRE_DEPRECATED virtual void backgroundLoadingComplete(Resource*) {}
+
+			/** Callback to indicate that background preparing has completed.
+			@deprecated
+				Use preparingComplete instead.
+			*/
+			OGRE_DEPRECATED virtual void backgroundPreparingComplete(Resource*) {}
+
+			/** Called whenever the resource finishes loading. 
+			@remarks
+				If a Resource has been marked as background loaded (@see Resource::setBackgroundLoaded), 
+				the call does not itself occur in the thread which is doing the loading;
+				when loading is complete a response indicator is placed with the
+				ResourceGroupManager, which will then be sent back to the 
+				listener as part of the application's primary frame loop thread.
+			*/
+			virtual void loadingComplete(Resource*) {}
+
+
+			/** Called whenever the resource finishes preparing (paging into memory).
+			@remarks
+				If a Resource has been marked as background loaded (@see Resource::setBackgroundLoaded)
+				the call does not itself occur in the thread which is doing the preparing;
+				when preparing is complete a response indicator is placed with the
+				ResourceGroupManager, which will then be sent back to the 
+				listener as part of the application's primary frame loop thread.
+			*/
+			virtual void preparingComplete(Resource*) {}
+
+			/** Called whenever the resource has been unloaded. */
+			virtual void unloadingComplete(Resource*) {}
+		};
+		
+		/// Enum identifying the loading state of the resource
+		enum LoadingState
+		{
+            /// Not loaded
+            LOADSTATE_UNLOADED,
+            /// Loading is in progress
+            LOADSTATE_LOADING,
+            /// Fully loaded
+            LOADSTATE_LOADED,
+            /// Currently unloading
+            LOADSTATE_UNLOADING,
+            /// Fully prepared
+            LOADSTATE_PREPARED,
+            /// Preparing is in progress
+            LOADSTATE_PREPARING
+		};
+    protected:
+		/// Creator
+		ResourceManager* mCreator;
+		/// Unique name of the resource
+        String mName;
+		/// The name of the resource group
+		String mGroup;
+		/// Numeric handle for more efficient look up than name
+        ResourceHandle mHandle;
+		/// Is the resource currently loaded?
+        AtomicScalar<LoadingState> mLoadingState;
+		/// Is this resource going to be background loaded? Only applicable for multithreaded
+		volatile bool mIsBackgroundLoaded;
+		/// The size of the resource in bytes
+        size_t mSize;
+		/// Is this file manually loaded?
+		bool mIsManual;
+		/// Origin of this resource (e.g. script name) - optional
+		String mOrigin;
+		/// Optional manual loader; if provided, data is loaded from here instead of a file
+		ManualResourceLoader* mLoader;
+		/// State count, the number of times this resource has changed state
+		size_t mStateCount;
+
+		typedef set<Listener*>::type ListenerList;
+		ListenerList mListenerList;
+		OGRE_MUTEX(mListenerListMutex);
+
+		/** Protected unnamed constructor to prevent default construction. 
+		*/
+		Resource() 
+			: mCreator(0), mHandle(0), mLoadingState(LOADSTATE_UNLOADED), 
+			mIsBackgroundLoaded(false),	mSize(0), mIsManual(0), mLoader(0)
+		{ 
+		}
+
+		/** Internal hook to perform actions before the load process, but
+			after the resource has been marked as 'loading'.
+		@note Mutex will have already been acquired by the loading thread.
+			Also, this call will occur even when using a ManualResourceLoader 
+			(when loadImpl is not actually called)
+		*/
+		virtual void preLoadImpl(void) {}
+		/** Internal hook to perform actions after the load process, but
+			before the resource has been marked as fully loaded.
+		@note Mutex will have already been acquired by the loading thread.
+			Also, this call will occur even when using a ManualResourceLoader 
+			(when loadImpl is not actually called)
+		*/
+		virtual void postLoadImpl(void) {}
+
+		/** Internal hook to perform actions before the unload process.
+		@note Mutex will have already been acquired by the unloading thread.
+		*/
+		virtual void preUnloadImpl(void) {}
+		/** Internal hook to perform actions after the unload process, but
+		before the resource has been marked as fully unloaded.
+		@note Mutex will have already been acquired by the unloading thread.
+		*/
+		virtual void postUnloadImpl(void) {}
+
+        /** Internal implementation of the meat of the 'prepare' action. 
+        */
+        virtual void prepareImpl(void) {}
+        /** Internal function for undoing the 'prepare' action.  Called when
+            the load is completed, and when resources are unloaded when they
+            are prepared but not yet loaded.
+        */
+        virtual void unprepareImpl(void) {}
+		/** Internal implementation of the meat of the 'load' action, only called if this 
+			resource is not being loaded from a ManualResourceLoader. 
+		*/
+		virtual void loadImpl(void) = 0;
+		/** Internal implementation of the 'unload' action; called regardless of
+			whether this resource is being loaded from a ManualResourceLoader. 
+		*/
+		virtual void unloadImpl(void) = 0;
+
+    public:
+		/** Standard constructor.
+		@param creator Pointer to the ResourceManager that is creating this resource
+		@param name The unique name of the resource
+		@param group The name of the resource group to which this resource belongs
+		@param isManual Is this resource manually loaded? If so, you should really
+			populate the loader parameter in order that the load process
+			can call the loader back when loading is required. 
+		@param loader Pointer to a ManualResourceLoader implementation which will be called
+			when the Resource wishes to load (should be supplied if you set
+			isManual to true). You can in fact leave this parameter null 
+			if you wish, but the Resource will never be able to reload if 
+			anything ever causes it to unload. Therefore provision of a proper
+			ManualResourceLoader instance is strongly recommended.
+		*/
+		Resource(ResourceManager* creator, const String& name, ResourceHandle handle,
+			const String& group, bool isManual = false, ManualResourceLoader* loader = 0);
+
+        /** Virtual destructor. Shouldn't need to be overloaded, as the resource
+            deallocation code should reside in unload()
+            @see
+                Resource::unload()
+        */
+        virtual ~Resource();
+
+        /** Prepares the resource for load, if it is not already.  One can call prepare()
+            before load(), but this is not required as load() will call prepare() 
+            itself, if needed.  When OGRE_THREAD_SUPPORT==1 both load() and prepare() 
+            are thread-safe.  When OGRE_THREAD_SUPPORT==2 however, only prepare() 
+            is thread-safe.  The reason for this function is to allow a background 
+            thread to do some of the loading work, without requiring the whole render
+            system to be thread-safe.  The background thread would call
+            prepare() while the main render loop would later call load().  So long as
+            prepare() remains thread-safe, subclasses can arbitrarily split the work of
+            loading a resource between load() and prepare().  It is best to try and
+            do as much work in prepare(), however, since this will leave less work for
+            the main render thread to do and thus increase FPS.
+			@param backgroundThread Whether this is occurring in a background thread
+        */
+        virtual void prepare(bool backgroundThread = false);
+
+     /** Loads the resource, if it is not already.
+		@remarks
+			If the resource is loaded from a file, loading is automatic. If not,
+			if for example this resource gained it's data from procedural calls
+			rather than loading from a file, then this resource will not reload 
+			on it's own.
+		@param backgroundThread Indicates whether the caller of this method is
+			the background resource loading thread. 
+			
+        */
+        virtual void load(bool backgroundThread = false);
+
+		/** Reloads the resource, if it is already loaded.
+		@remarks
+			Calls unload() and then load() again, if the resource is already
+			loaded. If it is not loaded already, then nothing happens.
+		*/
+		virtual void reload(void);
+
+        /** Returns true if the Resource is reloadable, false otherwise.
+        */
+        virtual bool isReloadable(void) const
+        {
+            return !mIsManual || mLoader;
+        }
+
+        /** Is this resource manually loaded?
+		*/
+		virtual bool isManuallyLoaded(void) const
+		{
+			return mIsManual;
+		}
+
+		/** Unloads the resource; this is not permanent, the resource can be
+			reloaded later if required.
+        */
+		virtual void unload(void);
+
+        /** Retrieves info about the size of the resource.
+        */
+        virtual size_t getSize(void) const
+        { 
+            return mSize; 
+        }
+
+        /** 'Touches' the resource to indicate it has been used.
+        */
+        virtual void touch(void);
+
+        /** Gets resource name.
+        */
+        virtual const String& getName(void) const 
+        { 
+            return mName; 
+        }
+
+        virtual ResourceHandle getHandle(void) const
+        {
+            return mHandle;
+        }
+
+        /** Returns true if the Resource has been prepared, false otherwise.
+        */
+        virtual bool isPrepared(void) const 
+        { 
+			// No lock required to read this state since no modify
+            return (mLoadingState.get() == LOADSTATE_PREPARED); 
+        }
+
+        /** Returns true if the Resource has been loaded, false otherwise.
+        */
+        virtual bool isLoaded(void) const 
+        { 
+			// No lock required to read this state since no modify
+            return (mLoadingState.get() == LOADSTATE_LOADED); 
+        }
+
+		/** Returns whether the resource is currently in the process of
+			background loading.
+		*/
+		virtual bool isLoading() const
+		{
+			return (mLoadingState.get() == LOADSTATE_LOADING);
+		}
+
+		/** Returns the current loading state.
+		*/
+		virtual LoadingState getLoadingState() const
+		{
+			return mLoadingState.get();
+		}
+
+
+
+		/** Returns whether this Resource has been earmarked for background loading.
+		@remarks
+			This option only makes sense when you have built Ogre with 
+			thread support (OGRE_THREAD_SUPPORT). If a resource has been marked
+			for background loading, then it won't load on demand like normal
+			when load() is called. Instead, it will ignore request to load()
+			except if the caller indicates it is the background loader. Any
+			other users of this resource should check isLoaded(), and if that
+			returns false, don't use the resource and come back later.
+		*/
+		virtual bool isBackgroundLoaded(void) const { return mIsBackgroundLoaded; }
+
+		/** Tells the resource whether it is background loaded or not.
+
+         @see Resource::isBackgroundLoaded. Note that calling this only
+			defers the normal on-demand loading behaviour of a resource, it
+			does not actually set up a thread to make sure the resource gets
+			loaded in the background. You should use ResourceBackgroundLoadingQueue
+			to manage the actual loading (which will call this method itself).
+		*/
+		virtual void setBackgroundLoaded(bool bl) { mIsBackgroundLoaded = bl; }
+
+		/** Escalates the loading of a background loaded resource. 
+		@remarks
+			If a resource is set to load in the background, but something needs
+			it before it's been loaded, there could be a problem. If the user
+			of this resource really can't wait, they can escalate the loading
+			which basically pulls the loading into the current thread immediately.
+			If the resource is already being loaded but just hasn't quite finished
+			then this method will simply wait until the background load is complete.
+		*/
+		virtual void escalateLoading();
+
+		/** Register a listener on this resource.
+			@see Resource::Listener
+		*/
+		virtual void addListener(Listener* lis);
+
+		/** Remove a listener on this resource.
+			@see Resource::Listener
+		*/
+		virtual void removeListener(Listener* lis);
+
+		/// Gets the group which this resource is a member of
+		virtual const String& getGroup(void) const { return mGroup; }
+
+		/** Change the resource group ownership of a Resource.
+		@remarks
+			This method is generally reserved for internal use, although
+			if you really know what you're doing you can use it to move
+			this resource from one group to another.
+		@param newGroup Name of the new group
+		*/
+		virtual void changeGroupOwnership(const String& newGroup);
+
+		/// Gets the manager which created this resource
+		virtual ResourceManager* getCreator(void) { return mCreator; }
+		/** Get the origin of this resource, e.g. a script file name.
+		@remarks
+			This property will only contain something if the creator of
+			this resource chose to populate it. Script loaders are advised
+			to populate it.
+		*/
+		virtual const String& getOrigin(void) const { return mOrigin; }
+		/// Notify this resource of it's origin
+		virtual void _notifyOrigin(const String& origin) { mOrigin = origin; }
+
+		/** Returns the number of times this resource has changed state, which 
+			generally means the number of times it has been loaded. Objects that 
+			build derived data based on the resource can check this value against 
+			a copy they kept last time they built this derived data, in order to
+			know whether it needs rebuilding. This is a nice way of monitoring
+			changes without having a tightly-bound callback.
+		*/
+		virtual size_t getStateCount() const { return mStateCount; }
+
+		/** Manually mark the state of this resource as having been changed.
+		@remarks
+			You only need to call this from outside if you explicitly want derived
+			objects to think this object has changed. @see getStateCount.
+		*/
+		virtual void _dirtyState();
+
+
+		/** Firing of loading complete event
+		@remarks
+			You should call this from the thread that runs the main frame loop 
+			to avoid having to make the receivers of this event thread-safe.
+			If you use Ogre's built in frame loop you don't need to call this
+			yourself.
+			@param wasBackgroundLoaded Whether this was a background loaded event
+		*/
+		virtual void _fireLoadingComplete(bool wasBackgroundLoaded);
+
+		/** Firing of preparing complete event
+		@remarks
+			You should call this from the thread that runs the main frame loop 
+			to avoid having to make the receivers of this event thread-safe.
+			If you use Ogre's built in frame loop you don't need to call this
+			yourself.
+			@param wasBackgroundLoaded Whether this was a background loaded event
+		*/
+		virtual void _firePreparingComplete(bool wasBackgroundLoaded);
+
+		/** Firing of unloading complete event
+		@remarks
+		You should call this from the thread that runs the main frame loop 
+		to avoid having to make the receivers of this event thread-safe.
+		If you use Ogre's built in frame loop you don't need to call this
+		yourself.
+		*/
+		virtual void _fireUnloadingComplete(void);
+
+		/** Calculate the size of a resource; this will only be called after 'load' */
+		virtual size_t calculateSize(void) const;
+
+    };
+
+	/** Shared pointer to a Resource.
+	@remarks
+		This shared pointer allows many references to a resource to be held, and
+		when the final reference is removed, the resource will be destroyed. 
+		Note that the ResourceManager which created this Resource will be holding
+		at least one reference, so this resource will not get destroyed until 
+		someone removes the resource from the manager - this at least gives you
+		strong control over when resources are freed. But the nature of the 
+		shared pointer means that if anyone refers to the removed resource in the
+		meantime, the resource will remain valid.
+	@par
+		You may well see references to ResourcePtr (i.e. ResourcePtr&) being passed 
+		around internally within Ogre. These are 'weak references' ie they do 
+		not increment the reference count on the Resource. This is done for 
+		efficiency in temporary operations that shouldn't need to incur the 
+		overhead of maintaining the reference count; however we don't recommend 
+		you do it yourself since these references are not guaranteed to remain valid.
+	*/
+	typedef SharedPtr<Resource> ResourcePtr;
+
+	/** Interface describing a manual resource loader.
+	@remarks
+		Resources are usually loaded from files; however in some cases you
+		want to be able to set the data up manually instead. This provides
+		some problems, such as how to reload a Resource if it becomes
+		unloaded for some reason, either because of memory constraints, or
+		because a device fails and some or all of the data is lost.
+	@par
+		This interface should be implemented by all classes which wish to
+		provide manual data to a resource. They provide a pointer to themselves
+		when defining the resource (via the appropriate ResourceManager), 
+		and will be called when the Resource tries to load. 
+		They should implement the loadResource method such that the Resource 
+		is in the end set up exactly as if it had loaded from a file, 
+		although the implementations will likely differ	between subclasses 
+		of Resource, which is why no generic algorithm can be stated here. 
+	@note
+		The loader must remain valid for the entire life of the resource,
+		so that if need be it can be called upon to re-load the resource
+		at any time.
+	*/
+	class _OgreExport ManualResourceLoader
+	{
+	public:
+		ManualResourceLoader() {}
+		virtual ~ManualResourceLoader() {}
+
+        /** Called when a resource wishes to load.  Note that this could get
+         * called in a background thread even in just a semithreaded ogre
+         * (OGRE_THREAD_SUPPORT==2).  Thus, you must not access the rendersystem from
+         * this callback.  Do that stuff in loadResource.
+		@param resource The resource which wishes to load
+		*/
+		virtual void prepareResource(Resource* resource)
+                { (void)resource; }
+
+		/** Called when a resource wishes to prepare.
+		@param resource The resource which wishes to prepare
+		*/
+		virtual void loadResource(Resource* resource) = 0;
+	};
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreResourceBackgroundQueue.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreResourceBackgroundQueue.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreResourceBackgroundQueue.h	(revision 148)
@@ -0,0 +1,362 @@
+/*
+-----------------------------------------------------------------------------
+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 __ResourceBackgroundQueue_H__
+#define __ResourceBackgroundQueue_H__
+
+
+#include "OgrePrerequisites.h"
+#include "OgreCommon.h"
+#include "OgreSingleton.h"
+#include "OgreResource.h"
+#include "OgreWorkQueue.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Resources
+	*  @{
+	*/
+
+	/// Identifier of a background process
+	typedef WorkQueue::RequestID BackgroundProcessTicket;
+
+	/** Encapsulates the result of a background queue request */
+	struct BackgroundProcessResult
+	{
+		/// Whether an error occurred
+		bool error;
+		/// Any messages from the process
+		String message;
+
+		BackgroundProcessResult() : error(false) {}
+	};
+
+	
+	/** This class is used to perform Resource operations in a
+		background thread. 
+	@remarks
+		All these requests are now queued via Root::getWorkQueue in order
+		to share the thread pool amongst all background tasks. You should therefore
+		refer to that class for configuring the behaviour of the threads
+		themselves, this class merely provides an interface that is specific
+		to resource loading around this common functionality.
+	@par
+		The general approach here is that on requesting a background resource
+		process, your request is placed on a queue ready for the background
+		thread to be picked up, and you will get a 'ticket' back, identifying
+		the request. Your call will then return and your thread can
+		proceed, knowing that at some point in the background the operation will 
+		be performed. In it's own thread, the resource operation will be 
+		performed, and once finished the ticket will be marked as complete. 
+		You can check the status of tickets by calling isProcessComplete() 
+		from your queueing thread. 
+	*/
+	class _OgreExport ResourceBackgroundQueue : public Singleton<ResourceBackgroundQueue>, public ResourceAlloc, 
+		public WorkQueue::RequestHandler, public WorkQueue::ResponseHandler
+	{
+	public:
+		/** This abstract listener interface lets you get notifications of
+		completed background processes instead of having to poll ticket 
+		statuses.
+		@note
+		For simplicity, these callbacks are not issued direct from the background
+		loading thread, they are queued themselves to be sent from the main thread
+		so that you don't have to be concerned about thread safety. 
+		*/
+		class _OgreExport Listener
+		{
+		public:
+			/** Called when a requested operation completes, queued into main thread. 
+			@note
+				For simplicity, this callback is not issued direct from the background
+				loading thread, it is queued to be sent from the main thread
+				so that you don't have to be concerned about thread safety. 
+			*/
+			virtual void operationCompleted(BackgroundProcessTicket ticket, const BackgroundProcessResult& result) = 0;
+			/// Need virtual destructor in case subclasses use it
+			virtual ~Listener() {}
+
+		};
+
+	protected:
+
+		uint16 mWorkQueueChannel;
+		/** Enumerates the type of requests */
+		enum RequestType
+		{
+			RT_INITIALISE_GROUP = 0,
+			RT_INITIALISE_ALL_GROUPS = 1,
+			RT_PREPARE_GROUP = 2,
+			RT_PREPARE_RESOURCE = 3,
+			RT_LOAD_GROUP = 4,
+			RT_LOAD_RESOURCE = 5,
+			RT_UNLOAD_GROUP = 6,
+			RT_UNLOAD_RESOURCE = 7
+		};
+		/** Encapsulates a queued request for the background queue */
+		struct ResourceRequest
+		{
+			RequestType type;
+			String resourceName;
+			ResourceHandle resourceHandle;
+			String resourceType;
+			String groupName;
+			bool isManual; 
+			ManualResourceLoader* loader;
+			NameValuePairList* loadParams;
+			Listener* listener;
+			BackgroundProcessResult result;
+
+			_OgreExport friend std::ostream& operator<<(std::ostream& o, const ResourceRequest& r)
+			{ (void)r; return o; }
+		};
+
+		typedef set<BackgroundProcessTicket>::type OutstandingRequestSet;	
+		OutstandingRequestSet mOutstandingRequestSet;
+
+		/// Struct that holds details of queued notifications
+		struct ResourceResponse
+		{
+			ResourceResponse(ResourcePtr r, const ResourceRequest& req)
+				: resource(r), request(req)
+			{}
+
+			ResourcePtr resource;
+			ResourceRequest request;
+
+			_OgreExport friend std::ostream& operator<<(std::ostream& o, const ResourceResponse& r)
+			{ (void)r; return o; }
+		};
+
+		BackgroundProcessTicket addRequest(ResourceRequest& req);
+
+	public:
+		ResourceBackgroundQueue();
+		virtual ~ResourceBackgroundQueue();
+
+		/** Initialise the background queue system. 
+		@note Called automatically by Root::initialise.
+		*/
+		virtual void initialise(void);
+
+		/** Shut down the background queue system. 
+		@note Called automatically by Root::shutdown.
+		*/
+		virtual void shutdown(void);
+
+		/** Initialise a resource group in the background.
+		@see ResourceGroupManager::initialiseResourceGroup
+		@param name The name of the resource group to initialise
+		@param listener Optional callback interface, take note of warnings in 
+			the header and only use if you understand them.
+		@return Ticket identifying the request, use isProcessComplete() to 
+			determine if completed if not using listener
+		*/
+		virtual BackgroundProcessTicket initialiseResourceGroup(
+			const String& name, Listener* listener = 0);
+
+		/** Initialise all resource groups which are yet to be initialised in 
+			the background.
+		@see ResourceGroupManager::intialiseResourceGroup
+		@param listener Optional callback interface, take note of warnings in 
+			the header and only use if you understand them.
+		@return Ticket identifying the request, use isProcessComplete() to 
+			determine if completed if not using listener
+		*/
+		virtual BackgroundProcessTicket initialiseAllResourceGroups( 
+			Listener* listener = 0);
+		/** Prepares a resource group in the background.
+		@see ResourceGroupManager::prepareResourceGroup
+		@param name The name of the resource group to prepare
+		@param listener Optional callback interface, take note of warnings in 
+			the header and only use if you understand them.
+		@return Ticket identifying the request, use isProcessComplete() to 
+			determine if completed if not using listener
+		*/
+		virtual BackgroundProcessTicket prepareResourceGroup(const String& name, 
+			Listener* listener = 0);
+
+		/** Loads a resource group in the background.
+		@see ResourceGroupManager::loadResourceGroup
+		@param name The name of the resource group to load
+		@param listener Optional callback interface, take note of warnings in 
+			the header and only use if you understand them.
+		@return Ticket identifying the request, use isProcessComplete() to 
+			determine if completed if not using listener
+		*/
+		virtual BackgroundProcessTicket loadResourceGroup(const String& name, 
+			Listener* listener = 0);
+
+
+		/** Unload a single resource in the background. 
+		@see ResourceManager::unload
+		@param resType The type of the resource 
+			(from ResourceManager::getResourceType())
+		@param name The name of the Resource
+		*/
+		virtual BackgroundProcessTicket unload(
+			const String& resType, const String& name, 
+			Listener* listener = 0);
+
+		/** Unload a single resource in the background. 
+		@see ResourceManager::unload
+		@param resType The type of the resource 
+			(from ResourceManager::getResourceType())
+		@param handle Handle to the resource 
+		*/
+		virtual BackgroundProcessTicket unload(
+			const String& resType, ResourceHandle handle, 
+			Listener* listener = 0);
+
+		/** Unloads a resource group in the background.
+		@see ResourceGroupManager::unloadResourceGroup
+		@param name The name of the resource group to load
+		@return Ticket identifying the request, use isProcessComplete() to 
+			determine if completed if not using listener
+		*/
+		virtual BackgroundProcessTicket unloadResourceGroup(const String& name, 
+			Listener* listener = 0);
+
+
+		/** Prepare a single resource in the background. 
+		@see ResourceManager::prepare
+		@param resType The type of the resource 
+			(from ResourceManager::getResourceType())
+		@param name The name of the Resource
+		@param group The resource group to which this resource will belong
+		@param isManual Is the resource to be manually loaded? If so, you should
+			provide a value for the loader parameter
+		@param loader The manual loader which is to perform the required actions
+			when this resource is loaded; only applicable when you specify true
+			for the previous parameter. NOTE: must be thread safe!!
+        @param loadParams Optional pointer to a list of name/value pairs 
+            containing loading parameters for this type of resource. Remember 
+			that this must have a lifespan longer than the return of this call!
+		*/
+		virtual BackgroundProcessTicket prepare(
+			const String& resType, const String& name, 
+            const String& group, bool isManual = false, 
+			ManualResourceLoader* loader = 0, 
+			const NameValuePairList* loadParams = 0, 
+			Listener* listener = 0);
+
+		/** Load a single resource in the background. 
+		@see ResourceManager::load
+		@param resType The type of the resource 
+			(from ResourceManager::getResourceType())
+		@param name The name of the Resource
+		@param group The resource group to which this resource will belong
+		@param isManual Is the resource to be manually loaded? If so, you should
+			provide a value for the loader parameter
+		@param loader The manual loader which is to perform the required actions
+			when this resource is loaded; only applicable when you specify true
+			for the previous parameter. NOTE: must be thread safe!!
+        @param loadParams Optional pointer to a list of name/value pairs 
+            containing loading parameters for this type of resource. Remember 
+			that this must have a lifespan longer than the return of this call!
+		*/
+		virtual BackgroundProcessTicket load(
+			const String& resType, const String& name, 
+            const String& group, bool isManual = false, 
+			ManualResourceLoader* loader = 0, 
+			const NameValuePairList* loadParams = 0, 
+			Listener* listener = 0);
+		/** Returns whether a previously queued process has completed or not. 
+		@remarks
+			This method of checking that a background process has completed is
+			the 'polling' approach. Each queued method takes an optional listener
+			parameter to allow you to register a callback instead, which is
+			arguably more efficient.
+		@param ticket The ticket which was returned when the process was queued
+		@return true if process has completed (or if the ticket is 
+			unrecognised), false otherwise
+		@note Tickets are not stored once complete so do not accumulate over 
+			time.
+		This is why a non-existent ticket will return 'true'.
+		*/
+		virtual bool isProcessComplete(BackgroundProcessTicket ticket);
+
+		/** Aborts background process.
+		*/
+		void abortRequest( BackgroundProcessTicket ticket );
+
+		/// Implementation for WorkQueue::RequestHandler
+		bool canHandleRequest(const WorkQueue::Request* req, const WorkQueue* srcQ);
+		/// Implementation for WorkQueue::RequestHandler
+		WorkQueue::Response* handleRequest(const WorkQueue::Request* req, const WorkQueue* srcQ);
+		/// Implementation for WorkQueue::ResponseHandler
+		bool canHandleResponse(const WorkQueue::Response* res, const WorkQueue* srcQ);
+		/// Implementation for WorkQueue::ResponseHandler
+		void handleResponse(const WorkQueue::Response* res, const WorkQueue* srcQ);
+
+		/** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static ResourceBackgroundQueue& getSingleton(void);
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static ResourceBackgroundQueue* getSingletonPtr(void);
+
+	};
+
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreResourceGroupManager.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreResourceGroupManager.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreResourceGroupManager.h	(revision 148)
@@ -0,0 +1,1106 @@
+/*
+-----------------------------------------------------------------------------
+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 _ResourceGroupManager_H__
+#define _ResourceGroupManager_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreSingleton.h"
+#include "OgreCommon.h"
+#include "OgreDataStream.h"
+#include "OgreResource.h"
+#include "OgreArchive.h"
+#include "OgreIteratorWrappers.h"
+#include <ctime>
+#include "OgreHeaderPrefix.h"
+
+// If X11/Xlib.h gets included before this header (for example it happens when
+// including wxWidgets and FLTK), Status is defined as an int which we don't
+// want as we have an enum named Status.
+#ifdef Status
+#undef Status
+#endif
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Resources
+	*  @{
+	*/
+	/** This abstract class defines an interface which is called back during
+        resource group loading to indicate the progress of the load. 
+	@remarks
+		Resource group loading is in 2 phases - creating resources from 
+		declarations (which includes parsing scripts), and loading
+		resources. Note that you don't necessarily have to have both; it
+		is quite possible to just parse all the scripts for a group (see
+		ResourceGroupManager::initialiseResourceGroup, but not to 
+		load the resource group. 
+		The sequence of events is (* signifies a repeating item):
+		<ul>
+		<li>resourceGroupScriptingStarted</li>
+		<li>scriptParseStarted (*)</li>
+        <li>scriptParseEnded (*)</li>
+		<li>resourceGroupScriptingEnded</li>
+		<li>resourceGroupLoadStarted</li>
+		<li>resourceLoadStarted (*)</li>
+        <li>resourceLoadEnded (*)</li>
+        <li>worldGeometryStageStarted (*)</li>
+        <li>worldGeometryStageEnded (*)</li>
+		<li>resourceGroupLoadEnded</li>
+		<li>resourceGroupPrepareStarted</li>
+		<li>resourcePrepareStarted (*)</li>
+        <li>resourcePrepareEnded (*)</li>
+		<li>resourceGroupPrepareEnded</li>
+		</ul>
+    @note
+        If OGRE_THREAD_SUPPORT is 1, this class is thread-safe.
+
+    */
+    class _OgreExport ResourceGroupListener
+    {
+    public:
+        virtual ~ResourceGroupListener() {}
+
+		/** This event is fired when a resource group begins parsing scripts.
+		@note
+			Remember that if you are loading resources through ResourceBackgroundQueue,
+			these callbacks will occur in the background thread, so you should
+			not perform any thread-unsafe actions in this callback if that's the
+			case (check the group name / script name).
+		@param groupName The name of the group 
+		@param scriptCount The number of scripts which will be parsed
+		*/
+		virtual void resourceGroupScriptingStarted(const String& groupName, size_t scriptCount) = 0;
+		/** This event is fired when a script is about to be parsed.
+			@param scriptName Name of the to be parsed
+			@param skipThisScript A boolean passed by reference which is by default set to 
+			false. If the event sets this to true, the script will be skipped and not
+			parsed. Note that in this case the scriptParseEnded event will not be raised
+			for this script.
+		*/
+		virtual void scriptParseStarted(const String& scriptName, bool& skipThisScript) = 0;
+
+		/** This event is fired when the script has been fully parsed.
+		*/
+		virtual void scriptParseEnded(const String& scriptName, bool skipped) = 0;
+		/** This event is fired when a resource group finished parsing scripts. */
+		virtual void resourceGroupScriptingEnded(const String& groupName) = 0;
+
+		/** This event is fired  when a resource group begins preparing.
+		@param groupName The name of the group being prepared
+		@param resourceCount The number of resources which will be prepared, including
+            a number of stages required to prepare any linked world geometry
+		*/
+		virtual void resourceGroupPrepareStarted(const String& groupName, size_t resourceCount)
+                { (void)groupName; (void)resourceCount; }
+
+		/** This event is fired when a declared resource is about to be prepared. 
+		@param resource Weak reference to the resource prepared.
+		*/
+		virtual void resourcePrepareStarted(const ResourcePtr& resource)
+                { (void)resource; }
+
+        /** This event is fired when the resource has been prepared. 
+        */
+        virtual void resourcePrepareEnded(void) {}
+        /** This event is fired when a stage of preparing linked world geometry 
+            is about to start. The number of stages required will have been 
+            included in the resourceCount passed in resourceGroupLoadStarted.
+        @param description Text description of what was just prepared
+        */
+        virtual void worldGeometryPrepareStageStarted(const String& description)
+        { (void)description; }
+
+        /** This event is fired when a stage of preparing linked world geometry 
+            has been completed. The number of stages required will have been 
+            included in the resourceCount passed in resourceGroupLoadStarted.
+        */
+        virtual void worldGeometryPrepareStageEnded(void) {}
+        /** This event is fired when a resource group finished preparing. */
+        virtual void resourceGroupPrepareEnded(const String& groupName)
+        { (void)groupName; }
+
+		/** This event is fired  when a resource group begins loading.
+		@param groupName The name of the group being loaded
+		@param resourceCount The number of resources which will be loaded, including
+            a number of stages required to load any linked world geometry
+		*/
+		virtual void resourceGroupLoadStarted(const String& groupName, size_t resourceCount) = 0;
+		/** This event is fired when a declared resource is about to be loaded. 
+		@param resource Weak reference to the resource loaded.
+		*/
+		virtual void resourceLoadStarted(const ResourcePtr& resource) = 0;
+        /** This event is fired when the resource has been loaded. 
+        */
+        virtual void resourceLoadEnded(void) = 0;
+        /** This event is fired when a stage of loading linked world geometry 
+            is about to start. The number of stages required will have been 
+            included in the resourceCount passed in resourceGroupLoadStarted.
+        @param description Text description of what was just loaded
+        */
+        virtual void worldGeometryStageStarted(const String& description) = 0;
+        /** This event is fired when a stage of loading linked world geometry 
+            has been completed. The number of stages required will have been 
+            included in the resourceCount passed in resourceGroupLoadStarted.
+        */
+        virtual void worldGeometryStageEnded(void) = 0;
+        /** This event is fired when a resource group finished loading. */
+		virtual void resourceGroupLoadEnded(const String& groupName) = 0;
+		/** This event is fired when a resource was just created.
+		@param resource Weak reference to the resource created.
+		*/
+		virtual void resourceCreated(const ResourcePtr& resource)
+		{ (void)resource; }
+		/** This event is fired when a resource is about to be removed.
+		@param resource Weak reference to the resource removed.
+		*/
+		virtual void resourceRemove(const ResourcePtr& resource)
+		{ (void)resource; }
+    };
+
+	/**
+	 @remarks	This class allows users to override resource loading behavior.
+				By overriding this class' methods, you can change how resources
+				are loaded and the behavior for resource name collisions.
+	*/
+	class ResourceLoadingListener
+	{
+	public:
+		virtual ~ResourceLoadingListener() {}
+
+		/** This event is called when a resource beings loading. */
+		virtual DataStreamPtr resourceLoading(const String &name, const String &group, Resource *resource) = 0;
+
+		/** This event is called when a resource stream has been opened, but not processed yet. 
+		@remarks
+			You may alter the stream if you wish or alter the incoming pointer to point at
+			another stream if you wish.
+		*/
+		virtual void resourceStreamOpened(const String &name, const String &group, Resource *resource, DataStreamPtr& dataStream) = 0;
+
+		/** This event is called when a resource collides with another existing one in a resource manager
+		  */
+		virtual bool resourceCollision(Resource *resource, ResourceManager *resourceManager) = 0;
+	};
+
+    /** This singleton class manages the list of resource groups, and notifying
+        the various resource managers of their obligations to load / unload
+        resources in a group. It also provides facilities to monitor resource
+        loading per group (to do progress bars etc), provided the resources 
+        that are required are pre-registered.
+    @par
+        Defining new resource groups,  and declaring the resources you intend to
+        use in advance is optional, however it is a very useful feature. In addition, 
+		if a ResourceManager supports the definition of resources through scripts, 
+		then this is the class which drives the locating of the scripts and telling
+		the ResourceManager to parse them. 
+	@par
+		There are several states that a resource can be in (the concept, not the
+		object instance in this case):
+		<ol>
+		<li><b>Undefined</b>. Nobody knows about this resource yet. It might be
+		in the filesystem, but Ogre is oblivious to it at the moment - there 
+		is no Resource instance. This might be because it's never been declared
+		(either in a script, or using ResourceGroupManager::declareResource), or
+		it may have previously been a valid Resource instance but has been 
+		removed, either individually through ResourceManager::remove or as a group
+		through ResourceGroupManager::clearResourceGroup.</li>
+		<li><b>Declared</b>. Ogre has some forewarning of this resource, either
+		through calling ResourceGroupManager::declareResource, or by declaring
+		the resource in a script file which is on one of the resource locations
+		which has been defined for a group. There is still no instance of Resource,
+		but Ogre will know to create this resource when 
+		ResourceGroupManager::initialiseResourceGroup is called (which is automatic
+		if you declare the resource group before Root::initialise).</li>
+		<li><b>Unloaded</b>. There is now a Resource instance for this resource, 
+		although it is not loaded. This means that code which looks for this
+		named resource will find it, but the Resource is not using a lot of memory
+		because it is in an unloaded state. A Resource can get into this state
+		by having just been created by ResourceGroupManager::initialiseResourceGroup 
+		(either from a script, or from a call to declareResource), by 
+		being created directly from code (ResourceManager::create), or it may 
+		have previously been loaded and has been unloaded, either individually
+		through Resource::unload, or as a group through ResourceGroupManager::unloadResourceGroup.</li>
+		<li><b>Loaded</b>The Resource instance is fully loaded. This may have
+		happened implicitly because something used it, or it may have been 
+		loaded as part of a group.</li>
+		</ol>
+		@see ResourceGroupManager::declareResource
+		@see ResourceGroupManager::initialiseResourceGroup
+		@see ResourceGroupManager::loadResourceGroup
+		@see ResourceGroupManager::unloadResourceGroup
+		@see ResourceGroupManager::clearResourceGroup
+    */
+    class _OgreExport ResourceGroupManager : public Singleton<ResourceGroupManager>, public ResourceAlloc
+    {
+    public:
+        OGRE_AUTO_MUTEX; // public to allow external locking
+		/// Default resource group name
+		static String DEFAULT_RESOURCE_GROUP_NAME;
+        /// Internal resource group name (should be used by OGRE internal only)
+        static String INTERNAL_RESOURCE_GROUP_NAME;
+		/// Special resource group name which causes resource group to be automatically determined based on searching for the resource in all groups.
+		static String AUTODETECT_RESOURCE_GROUP_NAME;
+		/// The number of reference counts held per resource by the resource system
+		static size_t RESOURCE_SYSTEM_NUM_REFERENCE_COUNTS;
+        /// Nested struct defining a resource declaration
+        struct ResourceDeclaration
+        {
+            String resourceName;
+            String resourceType;
+            ManualResourceLoader* loader;
+			NameValuePairList parameters;
+        };
+        /// List of resource declarations
+        typedef list<ResourceDeclaration>::type ResourceDeclarationList;
+		typedef map<String, ResourceManager*>::type ResourceManagerMap;
+		typedef MapIterator<ResourceManagerMap> ResourceManagerIterator;
+		/// Resource location entry
+		struct ResourceLocation
+		{
+			/// Pointer to the archive which is the destination
+			Archive* archive;
+			/// Whether this location was added recursively
+			bool recursive;
+		};
+		/// List of possible file locations
+		typedef list<ResourceLocation*>::type LocationList;
+
+    protected:
+		/// Map of resource types (strings) to ResourceManagers, used to notify them to load / unload group contents
+        ResourceManagerMap mResourceManagerMap;
+
+		/// Map of loading order (Real) to ScriptLoader, used to order script parsing
+		typedef multimap<Real, ScriptLoader*>::type ScriptLoaderOrderMap;
+		ScriptLoaderOrderMap mScriptLoaderOrderMap;
+
+		typedef vector<ResourceGroupListener*>::type ResourceGroupListenerList;
+        ResourceGroupListenerList mResourceGroupListenerList;
+
+		ResourceLoadingListener *mLoadingListener;
+
+        /// Resource index entry, resourcename->location 
+        typedef map<String, Archive*>::type ResourceLocationIndex;
+
+		/// List of resources which can be loaded / unloaded
+		typedef list<ResourcePtr>::type LoadUnloadResourceList;
+		/// Resource group entry
+		struct ResourceGroup
+		{
+			enum Status
+			{
+				UNINITIALSED = 0,
+				INITIALISING = 1,
+				INITIALISED = 2,
+				LOADING = 3,
+				LOADED = 4
+			};
+			/// General mutex for dealing with group content
+                    OGRE_AUTO_MUTEX;
+			/// Status-specific mutex, separate from content-changing mutex
+                    OGRE_MUTEX(statusMutex);
+			/// Group name
+			String name;
+			/// Group status
+			Status groupStatus;
+			/// List of possible locations to search
+			LocationList locationList;
+			/// Index of resource names to locations, built for speedy access (case sensitive archives)
+			ResourceLocationIndex resourceIndexCaseSensitive;
+            /// Index of resource names to locations, built for speedy access (case insensitive archives)
+            ResourceLocationIndex resourceIndexCaseInsensitive;
+			/// Pre-declared resources, ready to be created
+			ResourceDeclarationList resourceDeclarations;
+			/// Created resources which are ready to be loaded / unloaded
+			// Group by loading order of the type (defined by ResourceManager)
+			// (e.g. skeletons and materials before meshes)
+			typedef map<Real, LoadUnloadResourceList*>::type LoadResourceOrderMap;
+			LoadResourceOrderMap loadResourceOrderMap;
+            /// Linked world geometry, as passed to setWorldGeometry
+            String worldGeometry;
+            /// Scene manager to use with linked world geometry
+            SceneManager* worldGeometrySceneManager;
+			// in global pool flag - if true the resource will be loaded even a different	group was requested in the load method as a parameter.
+			bool inGlobalPool;
+
+			void addToIndex(const String& filename, Archive* arch);
+			void removeFromIndex(const String& filename, Archive* arch);
+			void removeFromIndex(Archive* arch);
+
+		};
+        /// Map from resource group names to groups
+        typedef map<String, ResourceGroup*>::type ResourceGroupMap;
+        ResourceGroupMap mResourceGroupMap;
+
+        /// Group name for world resources
+        String mWorldGroupName;
+
+		/** Parses all the available scripts found in the resource locations
+		for the given group, for all ResourceManagers.
+		@remarks
+			Called as part of initialiseResourceGroup
+		*/
+		void parseResourceGroupScripts(ResourceGroup* grp);
+		/** Create all the pre-declared resources.
+		@remarks
+			Called as part of initialiseResourceGroup
+		*/
+		void createDeclaredResources(ResourceGroup* grp);
+		/** Adds a created resource to a group. */
+		void addCreatedResource(ResourcePtr& res, ResourceGroup& group);
+		/** Get resource group */
+		ResourceGroup* getResourceGroup(const String& name);
+		/** Drops contents of a group, leave group there, notify ResourceManagers. */
+		void dropGroupContents(ResourceGroup* grp);
+		/** Delete a group for shutdown - don't notify ResourceManagers. */
+		void deleteGroup(ResourceGroup* grp);
+		/// Internal find method for auto groups
+		ResourceGroup* findGroupContainingResourceImpl(const String& filename);
+		/// Internal event firing method
+		void fireResourceGroupScriptingStarted(const String& groupName, size_t scriptCount);
+		/// Internal event firing method
+		void fireScriptStarted(const String& scriptName, bool &skipScript);
+        /// Internal event firing method
+        void fireScriptEnded(const String& scriptName, bool skipped);
+		/// Internal event firing method
+		void fireResourceGroupScriptingEnded(const String& groupName);
+        /// Internal event firing method
+		void fireResourceGroupLoadStarted(const String& groupName, size_t resourceCount);
+        /// Internal event firing method
+        void fireResourceLoadStarted(const ResourcePtr& resource);
+		/// Internal event firing method
+		void fireResourceLoadEnded(void);
+		/// Internal event firing method
+		void fireResourceGroupLoadEnded(const String& groupName);
+        /// Internal event firing method
+		void fireResourceGroupPrepareStarted(const String& groupName, size_t resourceCount);
+        /// Internal event firing method
+        void fireResourcePrepareStarted(const ResourcePtr& resource);
+		/// Internal event firing method
+		void fireResourcePrepareEnded(void);
+		/// Internal event firing method
+		void fireResourceGroupPrepareEnded(const String& groupName);
+		/// Internal event firing method
+		void fireResourceCreated(const ResourcePtr& resource);
+		/// Internal event firing method
+		void fireResourceRemove(const ResourcePtr& resource);
+		/** Internal modification time retrieval */
+		time_t resourceModifiedTime(ResourceGroup* group, const String& filename);
+
+        /** Find out if the named file exists in a group. Internal use only
+         @param group Pointer to the resource group
+         @param filename Fully qualified name of the file to test for
+         */
+        bool resourceExists(ResourceGroup* group, const String& filename);
+
+		/// Stored current group - optimisation for when bulk loading a group
+		ResourceGroup* mCurrentGroup;
+    public:
+        ResourceGroupManager();
+        virtual ~ResourceGroupManager();
+
+        /** Create a resource group.
+        @remarks
+            A resource group allows you to define a set of resources that can 
+            be loaded / unloaded as a unit. For example, it might be all the 
+            resources used for the level of a game. There is always one predefined
+            resource group called ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, 
+			which is typically used to hold all resources which do not need to 
+			be unloaded until shutdown. There is another predefined resource
+            group called ResourceGroupManager::INTERNAL_RESOURCE_GROUP_NAME too,
+            which should be used by OGRE internal only, the resources created
+            in this group aren't supposed to modify, unload or remove by user.
+            You can create additional ones so that you can control the life of
+            your resources in whichever way you wish.
+			There is one other predefined value, 
+			ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME; using this 
+			causes the group name to be derived at load time by searching for 
+			the resource in the resource locations of each group in turn.
+        @par
+            Once you have defined a resource group, resources which will be loaded
+			as part of it are defined in one of 3 ways:
+			<ol>
+			<li>Manually through declareResource(); this is useful for scripted
+				declarations since it is entirely generalised, and does not 
+				create Resource instances right away</li>
+			<li>Through the use of scripts; some ResourceManager subtypes have
+				script formats (e.g. .material, .overlay) which can be used
+				to declare resources</li>
+			<li>By calling ResourceManager::create to create a resource manually.
+			This resource will go on the list for it's group and will be loaded
+			and unloaded with that group</li>
+			</ol>
+			You must remember to call initialiseResourceGroup if you intend to use
+			the first 2 types.
+        @param name The name to give the resource group.
+		@param inGlobalPool if true the resource will be loaded even a different
+			group was requested in the load method as a parameter.
+        */
+        void createResourceGroup(const String& name, const bool inGlobalPool = true);
+
+
+        /** Initialises a resource group.
+		@remarks
+			After creating a resource group, adding some resource locations, and
+			perhaps pre-declaring some resources using declareResource(), but 
+			before you need to use the resources in the group, you 
+			should call this method to initialise the group. By calling this,
+			you are triggering the following processes:
+			<ol>
+			<li>Scripts for all resource types which support scripting are
+				parsed from the resource locations, and resources within them are
+				created (but not loaded yet).</li>
+			<li>Creates all the resources which have just pre-declared using
+			declareResource (again, these are not loaded yet)</li>
+			</ol>
+			So what this essentially does is create a bunch of unloaded Resource entries
+			in the respective ResourceManagers based on scripts, and resources
+			you've pre-declared. That means that code looking for these resources
+			will find them, but they won't be taking up much memory yet, until
+			they are either used, or they are loaded in bulk using loadResourceGroup.
+			Loading the resource group in bulk is entirely optional, but has the 
+			advantage of coming with progress reporting as resources are loaded.
+		@par
+			Failure to call this method means that loadResourceGroup will do 
+			nothing, and any resources you define in scripts will not be found.
+			Similarly, once you have called this method you won't be able to
+			pick up any new scripts or pre-declared resources, unless you
+			call clearResourceGroup, set up declared resources, and call this
+			method again.
+		@note 
+			When you call Root::initialise, all resource groups that have already been
+			created are automatically initialised too. Therefore you do not need to 
+			call this method for groups you define and set up before you call 
+			Root::initialise. However, since one of the most useful features of 
+			resource groups is to set them up after the main system initialisation
+			has occurred (e.g. a group per game level), you must remember to call this
+			method for the groups you create after this.
+
+		@param name The name of the resource group to initialise
+		*/
+		void initialiseResourceGroup(const String& name);
+
+		/** Initialise all resource groups which are yet to be initialised.
+		@see ResourceGroupManager::intialiseResourceGroup
+		*/
+		void initialiseAllResourceGroups(void);
+
+		/** Prepares a resource group.
+        @remarks
+			Prepares any created resources which are part of the named group.
+			Note that resources must have already been created by calling
+			ResourceManager::create, or declared using declareResource() or
+			in a script (such as .material and .overlay). The latter requires
+			that initialiseResourceGroup has been called. 
+		
+			When this method is called, this class will callback any ResourceGroupListeners
+			which have been registered to update them on progress. 
+        @param name The name of the resource group to prepare.
+		@param prepareMainResources If true, prepares normal resources associated 
+			with the group (you might want to set this to false if you wanted
+			to just prepare world geometry in bulk)
+		@param prepareWorldGeom If true, prepares any linked world geometry
+			@see ResourceGroupManager::linkWorldGeometryToResourceGroup
+        */
+        void prepareResourceGroup(const String& name, bool prepareMainResources = true, 
+			bool prepareWorldGeom = true);
+
+		/** Loads a resource group.
+        @remarks
+			Loads any created resources which are part of the named group.
+			Note that resources must have already been created by calling
+			ResourceManager::create, or declared using declareResource() or
+			in a script (such as .material and .overlay). The latter requires
+			that initialiseResourceGroup has been called. 
+		
+			When this method is called, this class will callback any ResourceGroupListeners
+			which have been registered to update them on progress. 
+        @param name The name of the resource group to load.
+		@param loadMainResources If true, loads normal resources associated 
+			with the group (you might want to set this to false if you wanted
+			to just load world geometry in bulk)
+		@param loadWorldGeom If true, loads any linked world geometry
+			@see ResourceGroupManager::linkWorldGeometryToResourceGroup
+        */
+        void loadResourceGroup(const String& name, bool loadMainResources = true, 
+			bool loadWorldGeom = true);
+
+        /** Unloads a resource group.
+        @remarks
+            This method unloads all the resources that have been declared as
+            being part of the named resource group. Note that these resources
+            will still exist in their respective ResourceManager classes, but
+            will be in an unloaded state. If you want to remove them entirely,
+            you should use clearResourceGroup or destroyResourceGroup.
+        @param name The name to of the resource group to unload.
+        @param reloadableOnly If set to true, only unload the resource that is
+            reloadable. Because some resources isn't reloadable, they will be
+            unloaded but can't load them later. Thus, you might not want to them
+            unloaded. Or, you might unload all of them, and then populate them
+            manually later.
+            @see Resource::isReloadable for resource is reloadable.
+        */
+        void unloadResourceGroup(const String& name, bool reloadableOnly = true);
+
+		/** Unload all resources which are not referenced by any other object.
+		@remarks
+			This method behaves like unloadResourceGroup, except that it only
+			unloads resources in the group which are not in use, ie not referenced
+			by other objects. This allows you to free up some memory selectively
+			whilst still keeping the group around (and the resources present,
+			just not using much memory).
+		@param name The name of the group to check for unreferenced resources
+		@param reloadableOnly If true (the default), only unloads resources
+			which can be subsequently automatically reloaded
+		*/
+		void unloadUnreferencedResourcesInGroup(const String& name, 
+			bool reloadableOnly = true);
+
+		/** Clears a resource group. 
+		@remarks
+			This method unloads all resources in the group, but in addition it
+			removes all those resources from their ResourceManagers, and then 
+			clears all the members from the list. That means after calling this
+			method, there are no resources declared as part of the named group
+			any more. Resource locations still persist though.
+        @param name The name to of the resource group to clear.
+		*/
+		void clearResourceGroup(const String& name);
+        
+        /** Destroys a resource group, clearing it first, destroying the resources
+            which are part of it, and then removing it from
+            the list of resource groups. 
+        @param name The name of the resource group to destroy.
+        */
+        void destroyResourceGroup(const String& name);
+
+		/** Checks the status of a resource group.
+		@remarks
+			Looks at the state of a resource group.
+			If initialiseResourceGroup has been called for the resource
+			group return true, otherwise return false.
+		@param name The name to of the resource group to access.
+		*/
+		bool isResourceGroupInitialised(const String& name);
+
+		/** Checks the status of a resource group.
+		@remarks
+			Looks at the state of a resource group.
+			If loadResourceGroup has been called for the resource
+			group return true, otherwise return false.
+		@param name The name to of the resource group to access.
+		*/
+		bool isResourceGroupLoaded(const String& name);
+
+		/*** Verify if a resource group exists
+		@param name The name of the resource group to look for
+		*/
+		bool resourceGroupExists(const String& name);
+
+        /** Method to add a resource location to for a given resource group. 
+        @remarks
+            Resource locations are places which are searched to load resource files.
+            When you choose to load a file, or to search for valid files to load, 
+            the resource locations are used.
+        @param name The name of the resource location; probably a directory, zip file, URL etc.
+        @param locType The codename for the resource type, which must correspond to the 
+            Archive factory which is providing the implementation.
+        @param resGroup The name of the resource group for which this location is
+            to apply. ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME is the 
+			default group which always exists, and can
+            be used for resources which are unlikely to be unloaded until application
+            shutdown. Otherwise it must be the name of a group; if it
+            has not already been created with createResourceGroup then it is created
+            automatically.
+        @param recursive Whether subdirectories will be searched for files when using 
+			a pattern match (such as *.material), and whether subdirectories will be
+			indexed. This can slow down initial loading of the archive and searches.
+			When opening a resource you still need to use the fully qualified name, 
+			this allows duplicate names in alternate paths.
+        */
+        void addResourceLocation(const String& name, const String& locType, 
+            const String& resGroup = DEFAULT_RESOURCE_GROUP_NAME, bool recursive = false, bool readOnly = true);
+        /** Removes a resource location from the search path. */ 
+        void removeResourceLocation(const String& name, 
+			const String& resGroup = DEFAULT_RESOURCE_GROUP_NAME);
+        /** Verify if a resource location exists for the given group. */ 
+		bool resourceLocationExists(const String& name, 
+			const String& resGroup = DEFAULT_RESOURCE_GROUP_NAME);
+
+        /** Declares a resource to be a part of a resource group, allowing you 
+            to load and unload it as part of the group.
+        @remarks
+            By declaring resources before you attempt to use them, you can 
+            more easily control the loading and unloading of those resources
+            by their group. Declaring them also allows them to be enumerated, 
+            which means events can be raised to indicate the loading progress
+            (@see ResourceGroupListener). Note that another way of declaring
+			resources is to use a script specific to the resource type, if
+			available (e.g. .material).
+		@par
+			Declared resources are not created as Resource instances (and thus
+			are not available through their ResourceManager) until initialiseResourceGroup
+			is called, at which point all declared resources will become created 
+			(but unloaded) Resource instances, along with any resources declared
+			in scripts in resource locations associated with the group.
+        @param name The resource name. 
+        @param resourceType The type of the resource. Ogre comes preconfigured with 
+            a number of resource types: 
+            <ul>
+            <li>Font</li>
+            <li>GpuProgram</li>
+            <li>HighLevelGpuProgram</li>
+            <li>Material</li>
+            <li>Mesh</li>
+            <li>Skeleton</li>
+            <li>Texture</li>
+            </ul>
+            .. but more can be added by plugin ResourceManager classes.
+        @param groupName The name of the group to which it will belong.
+		@param loadParameters A list of name / value pairs which supply custom
+			parameters to the resource which will be required before it can 
+			be loaded. These are specific to the resource type.
+        */
+        void declareResource(const String& name, const String& resourceType,
+            const String& groupName = DEFAULT_RESOURCE_GROUP_NAME,
+			const NameValuePairList& loadParameters = NameValuePairList());
+        /** Declares a resource to be a part of a resource group, allowing you
+            to load and unload it as part of the group.
+        @remarks
+            By declaring resources before you attempt to use them, you can
+            more easily control the loading and unloading of those resources
+            by their group. Declaring them also allows them to be enumerated,
+            which means events can be raised to indicate the loading progress
+            (@see ResourceGroupListener). Note that another way of declaring
+            resources is to use a script specific to the resource type, if
+            available (e.g. .material).
+        @par
+            Declared resources are not created as Resource instances (and thus
+            are not available through their ResourceManager) until initialiseResourceGroup
+            is called, at which point all declared resources will become created
+            (but unloaded) Resource instances, along with any resources declared
+            in scripts in resource locations associated with the group.
+        @param name The resource name.
+        @param resourceType The type of the resource. Ogre comes preconfigured with
+            a number of resource types:
+            <ul>
+            <li>Font</li>
+            <li>GpuProgram</li>
+            <li>HighLevelGpuProgram</li>
+            <li>Material</li>
+            <li>Mesh</li>
+            <li>Skeleton</li>
+            <li>Texture</li>
+            </ul>
+            .. but more can be added by plugin ResourceManager classes.
+        @param groupName The name of the group to which it will belong.
+        @param loader Pointer to a ManualResourceLoader implementation which will
+            be called when the Resource wishes to load. If supplied, the resource
+            is manually loaded, otherwise it'll loading from file automatic.
+            @note We don't support declare manually loaded resource without loader
+                here, since it's meaningless.
+        @param loadParameters A list of name / value pairs which supply custom
+            parameters to the resource which will be required before it can
+            be loaded. These are specific to the resource type.
+        */
+        void declareResource(const String& name, const String& resourceType,
+            const String& groupName, ManualResourceLoader* loader,
+            const NameValuePairList& loadParameters = NameValuePairList());
+        /** Undeclare a resource.
+		@remarks
+			Note that this will not cause it to be unloaded
+            if it is already loaded, nor will it destroy a resource which has 
+			already been created if initialiseResourceGroup has been called already.
+			Only unloadResourceGroup / clearResourceGroup / destroyResourceGroup 
+			will do that. 
+        @param name The name of the resource. 
+		@param groupName The name of the group this resource was declared in. 
+        */
+        void undeclareResource(const String& name, const String& groupName);
+
+		/** Open a single resource by name and return a DataStream
+		 	pointing at the source of the data.
+		@param resourceName The name of the resource to locate.
+			Even if resource locations are added recursively, you
+			must provide a fully qualified name to this method. You 
+			can find out the matching fully qualified names by using the
+			find() method if you need to.
+		@param groupName The name of the resource group; this determines which 
+			locations are searched. 
+		@param searchGroupsIfNotFound If true, if the resource is not found in 
+			the group specified, other groups will be searched. If you're
+			loading a real Resource using this option, you <strong>must</strong>
+			also provide the resourceBeingLoaded parameter to enable the 
+			group membership to be changed
+		@param resourceBeingLoaded Optional pointer to the resource being 
+			loaded, which you should supply if you want
+		@return Shared pointer to data stream containing the data, will be
+			destroyed automatically when no longer referenced
+		*/
+		DataStreamPtr openResource(const String& resourceName, 
+			const String& groupName = DEFAULT_RESOURCE_GROUP_NAME,
+			bool searchGroupsIfNotFound = true, Resource* resourceBeingLoaded = 0);
+
+		/** Open all resources matching a given pattern (which can contain
+			the character '*' as a wildcard), and return a collection of 
+			DataStream objects on them.
+		@param pattern The pattern to look for. If resource locations have been
+			added recursively, subdirectories will be searched too so this
+			does not need to be fully qualified.
+		@param groupName The resource group; this determines which locations
+			are searched.
+		@return Shared pointer to a data stream list , will be
+			destroyed automatically when no longer referenced
+		*/
+		DataStreamListPtr openResources(const String& pattern, 
+			const String& groupName = DEFAULT_RESOURCE_GROUP_NAME);
+		
+        /** List all file or directory names in a resource group.
+        @note
+        This method only returns filenames, you can also retrieve other
+        information using listFileInfo.
+        @param groupName The name of the group
+        @param dirs If true, directory names will be returned instead of file names
+        @return A list of filenames matching the criteria, all are fully qualified
+        */
+        StringVectorPtr listResourceNames(const String& groupName, bool dirs = false);
+
+        /** List all files in a resource group with accompanying information.
+        @param groupName The name of the group
+        @param dirs If true, directory names will be returned instead of file names
+        @return A list of structures detailing quite a lot of information about
+        all the files in the archive.
+        */
+        FileInfoListPtr listResourceFileInfo(const String& groupName, bool dirs = false);
+
+        /** Find all file or directory names matching a given pattern in a
+            resource group.
+        @note
+        This method only returns filenames, you can also retrieve other
+        information using findFileInfo.
+        @param groupName The name of the group
+        @param pattern The pattern to search for; wildcards (*) are allowed
+        @param dirs Set to true if you want the directories to be listed
+            instead of files
+        @return A list of filenames matching the criteria, all are fully qualified
+        */
+        StringVectorPtr findResourceNames(const String& groupName, const String& pattern,
+            bool dirs = false);
+
+        /** Find out if the named file exists in a group. 
+        @param group The name of the resource group
+        @param filename Fully qualified name of the file to test for
+        */
+        bool resourceExists(const String& group, const String& filename);
+		
+        /** Find out if the named file exists in any group. 
+        @param filename Fully qualified name of the file to test for
+        */
+        bool resourceExistsInAnyGroup(const String& filename);
+
+		/** Find the group in which a resource exists.
+		@param filename Fully qualified name of the file the resource should be
+			found as
+		@return Name of the resource group the resource was found in. An
+			exception is thrown if the group could not be determined.
+		*/
+		const String& findGroupContainingResource(const String& filename);
+
+        /** Find all files or directories matching a given pattern in a group
+            and get some detailed information about them.
+        @param group The name of the resource group
+        @param pattern The pattern to search for; wildcards (*) are allowed
+        @param dirs Set to true if you want the directories to be listed
+            instead of files
+        @return A list of file information structures for all files matching 
+        the criteria.
+        */
+        FileInfoListPtr findResourceFileInfo(const String& group, const String& pattern,
+            bool dirs = false);
+
+		/** Retrieve the modification time of a given file */
+		time_t resourceModifiedTime(const String& group, const String& filename); 
+        /** List all resource locations in a resource group.
+        @param groupName The name of the group
+        @return A list of resource locations matching the criteria
+        */
+        StringVectorPtr listResourceLocations(const String& groupName);
+
+        /** Find all resource location names matching a given pattern in a
+            resource group.
+        @param groupName The name of the group
+        @param pattern The pattern to search for; wildcards (*) are allowed
+        @return A list of resource locations matching the criteria
+        */
+        StringVectorPtr findResourceLocation(const String& groupName, const String& pattern);
+
+		/** Create a new resource file in a given group.
+		@remarks
+			This method creates a new file in a resource group and passes you back a 
+			writeable stream. 
+		@param filename The name of the file to create
+		@param groupName The name of the group in which to create the file
+		@param overwrite If true, an existing file will be overwritten, if false
+			an error will occur if the file already exists
+		@param locationPattern If the resource group contains multiple locations, 
+			then usually the file will be created in the first writable location. If you 
+			want to be more specific, you can include a location pattern here and 
+			only locations which match that pattern (as determined by StringUtil::match)
+			will be considered candidates for creation.
+		*/
+		DataStreamPtr createResource(const String& filename, const String& groupName = DEFAULT_RESOURCE_GROUP_NAME, 
+			bool overwrite = false, const String& locationPattern = StringUtil::BLANK);
+
+		/** Delete a single resource file.
+		@param filename The name of the file to delete. 
+		@param groupName The name of the group in which to search
+		@param locationPattern If the resource group contains multiple locations, 
+			then usually first matching file found in any location will be deleted. If you 
+			want to be more specific, you can include a location pattern here and 
+			only locations which match that pattern (as determined by StringUtil::match)
+			will be considered candidates for deletion.
+		*/
+		void deleteResource(const String& filename, const String& groupName = DEFAULT_RESOURCE_GROUP_NAME, 
+			const String& locationPattern = StringUtil::BLANK);
+
+		/** Delete all matching resource files.
+		@param filePattern The pattern (see StringUtil::match) of the files to delete. 
+		@param groupName The name of the group in which to search
+		@param locationPattern If the resource group contains multiple locations, 
+			then usually all matching files in any location will be deleted. If you 
+			want to be more specific, you can include a location pattern here and 
+			only locations which match that pattern (as determined by StringUtil::match)
+			will be considered candidates for deletion.
+		*/
+		void deleteMatchingResources(const String& filePattern, const String& groupName = DEFAULT_RESOURCE_GROUP_NAME, 
+			const String& locationPattern = StringUtil::BLANK);
+
+		/** Adds a ResourceGroupListener which will be called back during 
+            resource loading events. 
+        */
+        void addResourceGroupListener(ResourceGroupListener* l);
+        /** Removes a ResourceGroupListener */
+        void removeResourceGroupListener(ResourceGroupListener* l);
+
+        /** Sets the resource group that 'world' resources will use.
+        @remarks
+            This is the group which should be used by SceneManagers implementing
+            world geometry when looking for their resources. Defaults to the 
+            DEFAULT_RESOURCE_GROUP_NAME but this can be altered.
+        */
+        void setWorldResourceGroupName(const String& groupName) {mWorldGroupName = groupName;}
+
+        /// Gets the resource group that 'world' resources will use.
+        const String& getWorldResourceGroupName(void) const { return mWorldGroupName; }
+
+        /** Associates some world geometry with a resource group, causing it to 
+            be loaded / unloaded with the resource group.
+        @remarks
+            You would use this method to essentially defer a call to 
+            SceneManager::setWorldGeometry to the time when the resource group
+            is loaded. The advantage of this is that compatible scene managers 
+            will include the estimate of the number of loading stages for that
+            world geometry when the resource group begins loading, allowing you
+            to include that in a loading progress report. 
+        @param group The name of the resource group
+        @param worldGeometry The parameter which should be passed to setWorldGeometry
+        @param sceneManager The SceneManager which should be called
+        */
+        void linkWorldGeometryToResourceGroup(const String& group, 
+            const String& worldGeometry, SceneManager* sceneManager);
+
+        /** Clear any link to world geometry from a resource group.
+        @remarks
+            Basically undoes a previous call to linkWorldGeometryToResourceGroup.
+        */
+        void unlinkWorldGeometryFromResourceGroup(const String& group);
+
+			/** Checks the status of a resource group.
+		@remarks
+			Looks at the state of a resource group.
+			If loadResourceGroup has been called for the resource
+			group return true, otherwise return false.
+		@param name The name to of the resource group to access.
+		*/
+		bool isResourceGroupInGlobalPool(const String& name);
+
+        /** Shutdown all ResourceManagers, performed as part of clean-up. */
+        void shutdownAll(void);
+
+
+        /** Internal method for registering a ResourceManager (which should be
+            a singleton). Creators of plugins can register new ResourceManagers
+            this way if they wish.
+		@remarks
+			ResourceManagers that wish to parse scripts must also call 
+			_registerScriptLoader.
+        @param resourceType String identifying the resource type, must be unique.
+        @param rm Pointer to the ResourceManager instance.
+        */
+        void _registerResourceManager(const String& resourceType, ResourceManager* rm);
+
+        /** Internal method for unregistering a ResourceManager.
+		@remarks
+			ResourceManagers that wish to parse scripts must also call 
+			_unregisterScriptLoader.
+        @param resourceType String identifying the resource type.
+        */
+        void _unregisterResourceManager(const String& resourceType);
+
+		/** Get an iterator over the registered resource managers.
+		*/
+		ResourceManagerIterator getResourceManagerIterator()
+		{ return ResourceManagerIterator(
+			mResourceManagerMap.begin(), mResourceManagerMap.end()); }
+
+        /** Internal method for registering a ScriptLoader.
+		@remarks ScriptLoaders parse scripts when resource groups are initialised.
+        @param su Pointer to the ScriptLoader instance.
+        */
+        void _registerScriptLoader(ScriptLoader* su);
+
+        /** Internal method for unregistering a ScriptLoader.
+        @param su Pointer to the ScriptLoader instance.
+        */
+        void _unregisterScriptLoader(ScriptLoader* su);
+
+		/** Method used to directly query for registered script loaders.
+		@param pattern The specific script pattern (e.g. *.material) the script loader handles
+		*/
+		ScriptLoader *_findScriptLoader(const String &pattern);
+
+		/** Internal method for getting a registered ResourceManager.
+		@param resourceType String identifying the resource type.
+		*/
+		ResourceManager* _getResourceManager(const String& resourceType);
+
+		/** Internal method called by ResourceManager when a resource is created.
+		@param res Weak reference to resource
+		*/
+		void _notifyResourceCreated(ResourcePtr& res);
+
+		/** Internal method called by ResourceManager when a resource is removed.
+		@param res Weak reference to resource
+		*/
+		void _notifyResourceRemoved(ResourcePtr& res);
+
+		/** Internal method to notify the group manager that a resource has
+			changed group (only applicable for autodetect group) */
+		void _notifyResourceGroupChanged(const String& oldGroup, Resource* res);
+
+		/** Internal method called by ResourceManager when all resources 
+			for that manager are removed.
+		@param manager Pointer to the manager for which all resources are being removed
+		*/
+		void _notifyAllResourcesRemoved(ResourceManager* manager);
+
+        /** Notify this manager that one stage of world geometry loading has been 
+            started.
+        @remarks
+            Custom SceneManagers which load custom world geometry should call this 
+            method the number of times equal to the value they return from 
+            SceneManager::estimateWorldGeometry while loading their geometry.
+        */
+        void _notifyWorldGeometryStageStarted(const String& description);
+        /** Notify this manager that one stage of world geometry loading has been 
+            completed.
+        @remarks
+            Custom SceneManagers which load custom world geometry should call this 
+            method the number of times equal to the value they return from 
+            SceneManager::estimateWorldGeometry while loading their geometry.
+        */
+        void _notifyWorldGeometryStageEnded(void);
+
+		/** Get a list of the currently defined resource groups. 
+		@note This method intentionally returns a copy rather than a reference in
+			order to avoid any contention issues in multithreaded applications.
+		@return A copy of list of currently defined groups.
+		*/
+		StringVector getResourceGroups(void);
+		/** Get the list of resource declarations for the specified group name. 
+		@note This method intentionally returns a copy rather than a reference in
+			order to avoid any contention issues in multithreaded applications.
+		@param groupName The name of the group
+		@return A copy of list of currently defined resources.
+		*/
+		ResourceDeclarationList getResourceDeclarationList(const String& groupName);
+
+		/** Get the list of resource locations for the specified group name.
+		@param groupName The name of the group
+		@return The list of resource locations associated with the given group.
+		*/		
+		const LocationList& getResourceLocationList(const String& groupName);
+
+		/// Sets a new loading listener
+		void setLoadingListener(ResourceLoadingListener *listener);
+		/// Returns the current loading listener
+		ResourceLoadingListener *getLoadingListener();
+
+		/** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static ResourceGroupManager& getSingleton(void);
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static ResourceGroupManager* getSingletonPtr(void);
+
+    };
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreResourceManager.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreResourceManager.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreResourceManager.h	(revision 148)
@@ -0,0 +1,586 @@
+/*
+-----------------------------------------------------------------------------
+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 _ResourceManager_H__
+#define _ResourceManager_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreResource.h"
+#include "OgreResourceGroupManager.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreCommon.h"
+#include "OgreDataStream.h"
+#include "OgreStringVector.h"
+#include "OgreScriptLoader.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+    /** Template class describing a simple pool of items.
+     */
+	template <typename T>
+	class Pool
+	{
+	protected:
+		typedef typename list<T>::type ItemList;
+		ItemList mItems;
+		OGRE_AUTO_MUTEX;
+	public:
+		Pool() {}
+		virtual ~Pool() {}
+
+		/** Get the next item from the pool.
+         @return pair indicating whether there was a free item, and the item if so
+         */
+		virtual std::pair<bool, T> removeItem()
+		{
+            OGRE_LOCK_AUTO_MUTEX;
+			std::pair<bool, T> ret;
+			if (mItems.empty())
+			{
+				ret.first = false;
+			}
+			else
+			{
+				ret.first = true;
+				ret.second = mItems.front();
+				mItems.pop_front();
+			}
+			return ret;
+		}
+
+		/** Add a new item to the pool.
+         */
+		virtual void addItem(const T& i)
+		{
+            OGRE_LOCK_AUTO_MUTEX;
+			mItems.push_front(i);
+		}
+		/// Clear the pool
+		virtual void clear()
+		{
+            OGRE_LOCK_AUTO_MUTEX;
+			mItems.clear();
+		}
+	};
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Resources
+	*  @{
+	*/
+	/** Defines a generic resource handler.
+    @remarks
+        A resource manager is responsible for managing a pool of
+        resources of a particular type. It must index them, look
+        them up, load and destroy them. It may also need to stay within
+        a defined memory budget, and temporarily unload some resources
+        if it needs to to stay within this budget.
+    @par
+        Resource managers use a priority system to determine what can
+        be unloaded, and a Least Recently Used (LRU) policy within
+        resources of the same priority.
+	@par
+		Resources can be loaded using the generalised load interface,
+		and they can be unloaded and removed. In addition, each 
+		subclass of ResourceManager will likely define custom 'load' methods
+		which take explicit parameters depending on the kind of resource
+		being created.
+	@note
+		Resources can be loaded and unloaded through the Resource class, 
+		but they can only be removed (and thus eventually destroyed) using
+		their parent ResourceManager.
+    @note
+        If OGRE_THREAD_SUPPORT is 1, this class is thread-safe.
+    */
+	class _OgreExport ResourceManager : public ScriptLoader, public ResourceAlloc
+    {
+    public:
+        OGRE_AUTO_MUTEX; // public to allow external locking
+        ResourceManager();
+        virtual ~ResourceManager();
+
+        /** Creates a new blank resource, but does not immediately load it.
+        @remarks
+            Resource managers handle disparate types of resources, so if you want
+			to get at the detailed interface of this resource, you'll have to 
+			cast the result to the subclass you know you're creating. 
+		@param name The unique name of the resource
+		@param group The name of the resource group to attach this new resource to
+		@param isManual Is this resource manually loaded? If so, you should really
+			populate the loader parameter in order that the load process
+			can call the loader back when loading is required. 
+		@param loader Pointer to a ManualLoader implementation which will be called
+			when the Resource wishes to load (should be supplied if you set
+			isManual to true). You can in fact leave this parameter null 
+			if you wish, but the Resource will never be able to reload if 
+			anything ever causes it to unload. Therefore provision of a proper
+			ManualLoader instance is strongly recommended.
+        @param createParams If any parameters are required to create an instance,
+            they should be supplied here as name / value pairs
+        */
+        virtual ResourcePtr createResource(const String& name, const String& group,
+            bool isManual = false, ManualResourceLoader* loader = 0, 
+            const NameValuePairList* createParams = 0);
+
+		typedef std::pair<ResourcePtr, bool> ResourceCreateOrRetrieveResult;
+		/** Create a new resource, or retrieve an existing one with the same
+			name if it already exists.
+		@remarks
+			This method performs the same task as calling getByName() followed
+			by create() if that returns null. The advantage is that it does it
+			in one call so there are no race conditions if using multiple
+			threads that could cause getByName() to return null, but create() to
+			fail because another thread created a resource in between.
+		@see ResourceManager::createResource
+		@see ResourceManager::getResourceByName
+		@return A pair, the first element being the pointer, and the second being 
+			an indicator specifying whether the resource was newly created.
+		*/
+		virtual ResourceCreateOrRetrieveResult createOrRetrieve(const String& name, 
+			const String& group, bool isManual = false, 
+			ManualResourceLoader* loader = 0, 
+			const NameValuePairList* createParams = 0);
+		
+        /** Set a limit on the amount of memory this resource handler may use.
+            @remarks
+                If, when asked to load a new resource, the manager believes it will exceed this memory
+                budget, it will temporarily unload a resource to make room for the new one. This unloading
+                is not permanent and the Resource is not destroyed; it simply needs to be reloaded when
+                next used.
+        */
+        virtual void setMemoryBudget(size_t bytes);
+
+        /** Get the limit on the amount of memory this resource handler may use.
+        */
+        virtual size_t getMemoryBudget(void) const;
+
+		/** Gets the current memory usage, in bytes. */
+		virtual size_t getMemoryUsage(void) const { return mMemoryUsage.get(); }
+
+		/** Unloads a single resource by name.
+		@remarks
+			Unloaded resources are not removed, they simply free up their memory
+			as much as they can and wait to be reloaded.
+			@see ResourceGroupManager for unloading of resource groups.
+		*/
+		virtual void unload(const String& name);
+		
+		/** Unloads a single resource by handle.
+		@remarks
+			Unloaded resources are not removed, they simply free up their memory
+			as much as they can and wait to be reloaded.
+			@see ResourceGroupManager for unloading of resource groups.
+		*/
+		virtual void unload(ResourceHandle handle);
+
+		/** Unloads all resources.
+		@remarks
+			Unloaded resources are not removed, they simply free up their memory
+			as much as they can and wait to be reloaded.
+			@see ResourceGroupManager for unloading of resource groups.
+		@param reloadableOnly If true (the default), only unload the resource that
+            is reloadable. Because some resources isn't reloadable, they will be
+			unloaded but can't load them later. Thus, you might not want to them
+			unloaded. Or, you might unload all of them, and then populate them
+			manually later.
+			@see Resource::isReloadable for resource is reloadable.
+		*/
+		virtual void unloadAll(bool reloadableOnly = true);
+
+		/** Caused all currently loaded resources to be reloaded.
+		@remarks
+			All resources currently being held in this manager which are also
+			marked as currently loaded will be unloaded, then loaded again.
+		@param reloadableOnly If true (the default), only reload the resource that
+            is reloadable. Because some resources isn't reloadable, they will be
+			unloaded but can't loaded again. Thus, you might not want to them
+			unloaded. Or, you might unload all of them, and then populate them
+			manually later.
+			@see Resource::isReloadable for resource is reloadable.
+		*/
+		virtual void reloadAll(bool reloadableOnly = true);
+
+		/** Unload all resources which are not referenced by any other object.
+		@remarks
+			This method behaves like unloadAll, except that it only unloads resources
+            which are not in use, ie not referenced by other objects. This allows you
+            to free up some memory selectively whilst still keeping the group around
+            (and the resources present, just not using much memory).
+        @par
+            Some referenced resource may exists 'weak' pointer to their sub-components
+            (e.g. Entity held pointer to SubMesh), in this case, unload or reload that
+            resource will cause dangerous pointer access. Use this function instead of
+            unloadAll allows you avoid fail in those situations.
+		@param reloadableOnly If true (the default), only unloads resources
+			which can be subsequently automatically reloaded.
+		*/
+		virtual void unloadUnreferencedResources(bool reloadableOnly = true);
+
+		/** Caused all currently loaded but not referenced by any other object
+            resources to be reloaded.
+		@remarks
+			This method behaves like reloadAll, except that it only reloads resources
+            which are not in use, i.e. not referenced by other objects.
+        @par
+            Some referenced resource may exists 'weak' pointer to their sub-components
+            (e.g. Entity held pointer to SubMesh), in this case, unload or reload that
+            resource will cause dangerous pointer access. Use this function instead of
+            reloadAll allows you avoid fail in those situations.
+		@param reloadableOnly If true (the default), only reloads resources
+			which can be subsequently automatically reloaded.
+		*/
+		virtual void reloadUnreferencedResources(bool reloadableOnly = true);
+
+		/** Remove a single resource.
+		@remarks
+			Removes a single resource, meaning it will be removed from the list
+			of valid resources in this manager, also causing it to be unloaded. 
+		@note
+			The word 'Destroy' is not used here, since
+			if any other pointers are referring to this resource, it will persist
+			until they have finished with it; however to all intents and purposes
+			it no longer exists and will likely get destroyed imminently.
+        @note
+            If you do have shared pointers to resources hanging around after the 
+            ResourceManager is destroyed, you may get problems on destruction of
+            these resources if they were relying on the manager (especially if
+            it is a plugin). If you find you get problems on shutdown in the
+            destruction of resources, try making sure you release all your
+            shared pointers before you shutdown OGRE.
+		*/
+		virtual void remove(ResourcePtr& r);
+
+        /** Remove a single resource by name.
+		@remarks
+			Removes a single resource, meaning it will be removed from the list
+			of valid resources in this manager, also causing it to be unloaded. 
+		@note
+			The word 'Destroy' is not used here, since
+			if any other pointers are referring to this resource, it will persist
+			until they have finished with it; however to all intents and purposes
+			it no longer exists and will likely get destroyed imminently.
+        @note
+            If you do have shared pointers to resources hanging around after the 
+            ResourceManager is destroyed, you may get problems on destruction of
+            these resources if they were relying on the manager (especially if
+            it is a plugin). If you find you get problems on shutdown in the
+            destruction of resources, try making sure you release all your
+            shared pointers before you shutdown OGRE.
+		*/
+		virtual void remove(const String& name);
+		
+		/** Remove a single resource by handle.
+		@remarks
+			Removes a single resource, meaning it will be removed from the list
+			of valid resources in this manager, also causing it to be unloaded. 
+		@note
+			The word 'Destroy' is not used here, since
+			if any other pointers are referring to this resource, it will persist
+			until they have finished with it; however to all intents and purposes
+			it no longer exists and will likely get destroyed imminently.
+        @note
+            If you do have shared pointers to resources hanging around after the 
+            ResourceManager is destroyed, you may get problems on destruction of
+            these resources if they were relying on the manager (especially if
+            it is a plugin). If you find you get problems on shutdown in the
+            destruction of resources, try making sure you release all your
+            shared pointers before you shutdown OGRE.
+		*/
+		virtual void remove(ResourceHandle handle);
+		/** Removes all resources.
+		@note
+			The word 'Destroy' is not used here, since
+			if any other pointers are referring to these resources, they will persist
+			until they have been finished with; however to all intents and purposes
+			the resources no longer exist and will get destroyed imminently.
+        @note
+            If you do have shared pointers to resources hanging around after the 
+            ResourceManager is destroyed, you may get problems on destruction of
+            these resources if they were relying on the manager (especially if
+            it is a plugin). If you find you get problems on shutdown in the
+            destruction of resources, try making sure you release all your
+            shared pointers before you shutdown OGRE.
+        */
+        virtual void removeAll(void);
+
+		/** Remove all resources which are not referenced by any other object.
+		@remarks
+			This method behaves like removeAll, except that it only removes resources
+            which are not in use, ie not referenced by other objects. This allows you
+            to free up some memory selectively whilst still keeping the group around
+            (and the resources present, just not using much memory).
+        @par
+            Some referenced resource may exists 'weak' pointer to their sub-components
+            (e.g. Entity held pointer to SubMesh), in this case, remove or reload that
+            resource will cause dangerous pointer access. Use this function instead of
+            removeAll allows you avoid fail in those situations.
+		@param reloadableOnly If true (the default), only removes resources
+			which can be subsequently automatically reloaded.
+		*/
+		virtual void removeUnreferencedResources(bool reloadableOnly = true);
+
+        /** Retrieves a pointer to a resource by name, or null if the resource does not exist.
+        */
+        virtual ResourcePtr getResourceByName(const String& name, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME);
+        /** Retrieves a pointer to a resource by handle, or null if the resource does not exist.
+        */
+        virtual ResourcePtr getByHandle(ResourceHandle handle);
+		
+		/// Returns whether the named resource exists in this manager
+		virtual bool resourceExists(const String& name)
+		{
+			return !getResourceByName(name).isNull();
+		}
+		/// Returns whether a resource with the given handle exists in this manager
+		virtual bool resourceExists(ResourceHandle handle)
+		{
+			return !getByHandle(handle).isNull();
+		}
+
+		/** Notify this manager that a resource which it manages has been 
+			'touched', i.e. used. 
+		*/
+		virtual void _notifyResourceTouched(Resource* res);
+
+		/** Notify this manager that a resource which it manages has been 
+			loaded. 
+		*/
+		virtual void _notifyResourceLoaded(Resource* res);
+
+		/** Notify this manager that a resource which it manages has been 
+			unloaded.
+		*/
+		virtual void _notifyResourceUnloaded(Resource* res);
+
+		/** Generic prepare method, used to create a Resource specific to this 
+			ResourceManager without using one of the specialised 'prepare' methods
+			(containing per-Resource-type parameters).
+		@param name The name of the Resource
+		@param group The resource group to which this resource will belong
+		@param isManual Is the resource to be manually loaded? If so, you should
+			provide a value for the loader parameter
+		@param loader The manual loader which is to perform the required actions
+			when this resource is loaded; only applicable when you specify true
+			for the previous parameter
+        @param loadParams Optional pointer to a list of name/value pairs 
+            containing loading parameters for this type of resource.
+		@param backgroundThread Optional boolean which lets the load routine know if it
+			is being run on the background resource loading thread
+		*/
+		virtual ResourcePtr prepare(const String& name, 
+            const String& group, bool isManual = false, 
+			ManualResourceLoader* loader = 0, const NameValuePairList* loadParams = 0,
+			bool backgroundThread = false);
+
+		/** Generic load method, used to create a Resource specific to this 
+			ResourceManager without using one of the specialised 'load' methods
+			(containing per-Resource-type parameters).
+		@param name The name of the Resource
+		@param group The resource group to which this resource will belong
+		@param isManual Is the resource to be manually loaded? If so, you should
+			provide a value for the loader parameter
+		@param loader The manual loader which is to perform the required actions
+			when this resource is loaded; only applicable when you specify true
+			for the previous parameter
+        @param loadParams Optional pointer to a list of name/value pairs 
+            containing loading parameters for this type of resource.
+		@param backgroundThread Optional boolean which lets the load routine know if it
+			is being run on the background resource loading thread
+		*/
+		virtual ResourcePtr load(const String& name, 
+            const String& group, bool isManual = false, 
+			ManualResourceLoader* loader = 0, const NameValuePairList* loadParams = 0,
+			bool backgroundThread = false);
+
+		/** Gets the file patterns which should be used to find scripts for this
+			ResourceManager.
+		@remarks
+			Some resource managers can read script files in order to define
+			resources ahead of time. These resources are added to the available
+			list inside the manager, but none are loaded initially. This allows
+			you to load the items that are used on demand, or to load them all 
+			as a group if you wish (through ResourceGroupManager).
+		@par
+			This method lets you determine the file pattern which will be used
+			to identify scripts intended for this manager.
+		@return
+			A list of file patterns, in the order they should be searched in.
+		@see isScriptingSupported, parseScript
+		*/
+		virtual const StringVector& getScriptPatterns(void) const { return mScriptPatterns; }
+
+		/** Parse the definition of a set of resources from a script file.
+		@remarks
+			Some resource managers can read script files in order to define
+			resources ahead of time. These resources are added to the available
+			list inside the manager, but none are loaded initially. This allows
+			you to load the items that are used on demand, or to load them all 
+			as a group if you wish (through ResourceGroupManager).
+		@param stream Weak reference to a data stream which is the source of the script
+		@param groupName The name of the resource group that resources which are
+			parsed are to become a member of. If this group is loaded or unloaded, 
+			then the resources discovered in this script will be loaded / unloaded
+			with it.
+		*/
+		virtual void parseScript(DataStreamPtr& stream, const String& groupName)
+                { (void)stream; (void)groupName; }
+
+		/** Gets the relative loading order of resources of this type.
+		@remarks
+			There are dependencies between some kinds of resource in terms of loading
+			order, and this value enumerates that. Higher values load later during
+			bulk loading tasks.
+		*/
+		virtual Real getLoadingOrder(void) const { return mLoadOrder; }
+
+		/** Gets a string identifying the type of resource this manager handles. */
+		const String& getResourceType(void) const { return mResourceType; }
+
+        /** Sets whether this manager and its resources habitually produce log output */
+        virtual void setVerbose(bool v) { mVerbose = v; }
+
+        /** Gets whether this manager and its resources habitually produce log output */
+        virtual bool getVerbose(void) { return mVerbose; }
+
+		/** Definition of a pool of resources, which users can use to reuse similar
+			resources many times without destroying and recreating them.
+		@remarks
+			This is a simple utility class which allows the reuse of resources
+			between code which has a changing need for them. For example, 
+		*/
+		class _OgreExport ResourcePool : public Pool<ResourcePtr>, public ResourceAlloc
+		{
+		protected:
+			String mName;
+		public:
+			ResourcePool(const String& name);
+			~ResourcePool();
+			/// Get the name of the pool
+			const String& getName() const;
+			void clear();
+		};
+		
+		/// Create a resource pool, or reuse one that already exists
+		ResourcePool* getResourcePool(const String& name);
+		/// Destroy a resource pool
+		void destroyResourcePool(ResourcePool* pool);
+		/// Destroy a resource pool
+		void destroyResourcePool(const String& name);
+		/// destroy all pools
+		void destroyAllResourcePools();
+
+
+
+
+    protected:
+
+        /** Allocates the next handle. */
+        ResourceHandle getNextHandle(void);
+
+		/** Create a new resource instance compatible with this manager (no custom 
+			parameters are populated at this point). 
+		@remarks
+			Subclasses must override this method and create a subclass of Resource.
+		@param name The unique name of the resource
+		@param group The name of the resource group to attach this new resource to
+		@param isManual Is this resource manually loaded? If so, you should really
+			populate the loader parameter in order that the load process
+			can call the loader back when loading is required. 
+		@param loader Pointer to a ManualLoader implementation which will be called
+			when the Resource wishes to load (should be supplied if you set
+			isManual to true). You can in fact leave this parameter null 
+			if you wish, but the Resource will never be able to reload if 
+			anything ever causes it to unload. Therefore provision of a proper
+			ManualLoader instance is strongly recommended.
+        @param createParams If any parameters are required to create an instance,
+            they should be supplied here as name / value pairs. These do not need 
+            to be set on the instance (handled elsewhere), just used if required
+            to differentiate which concrete class is created.
+
+		*/
+		virtual Resource* createImpl(const String& name, ResourceHandle handle, 
+			const String& group, bool isManual, ManualResourceLoader* loader, 
+            const NameValuePairList* createParams) = 0;
+		/** Add a newly created resource to the manager (note weak reference) */
+		virtual void addImpl( ResourcePtr& res );
+		/** Remove a resource from this manager; remove it from the lists. */
+		virtual void removeImpl( ResourcePtr& res );
+		/** Checks memory usage and pages out if required. This is automatically done after a new resource is loaded.
+		*/
+		virtual void checkUsage(void);
+
+
+    public:
+		typedef HashMap< String, ResourcePtr > ResourceMap;
+		typedef HashMap< String, ResourceMap > ResourceWithGroupMap;
+		typedef map<ResourceHandle, ResourcePtr>::type ResourceHandleMap;
+    protected:
+        ResourceHandleMap mResourcesByHandle;
+        ResourceMap mResources;
+		ResourceWithGroupMap mResourcesWithGroup;
+        size_t mMemoryBudget; /// In bytes
+        AtomicScalar<ResourceHandle> mNextHandle;
+        AtomicScalar<size_t> mMemoryUsage; /// In bytes
+
+        bool mVerbose;
+
+		// IMPORTANT - all subclasses must populate the fields below
+
+		/// Patterns to use to look for scripts if supported (e.g. *.overlay)
+		StringVector mScriptPatterns; 
+		/// Loading order relative to other managers, higher is later
+		Real mLoadOrder; 
+		/// String identifying the resource type this manager handles
+		String mResourceType; 
+
+    public:
+        typedef MapIterator<ResourceHandleMap> ResourceMapIterator;
+        /** Returns an iterator over all resources in this manager. 
+        @note
+            Use of this iterator is NOT thread safe!
+        */
+        ResourceMapIterator getResourceIterator(void) 
+        {
+            return ResourceMapIterator(mResourcesByHandle.begin(), mResourcesByHandle.end());
+        }
+
+	protected:
+		typedef map<String, ResourcePool*>::type ResourcePoolMap;
+		ResourcePoolMap mResourcePoolMap;
+    };
+
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreRibbonTrail.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreRibbonTrail.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreRibbonTrail.h	(revision 148)
@@ -0,0 +1,248 @@
+/*
+-----------------------------------------------------------------------------
+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 __RibbonTrail_H__
+#define __RibbonTrail_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreBillboardChain.h"
+#include "OgreNode.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreFrameListener.h"
+#include "OgreControllerManager.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Effects
+	*  @{
+	*/
+	/** Subclass of BillboardChain which automatically leaves a trail behind
+		one or more Node instances.
+	@remarks
+		An instance of this class will watch one or more Node instances, and
+		automatically generate a trail behind them as they move. Because this
+		class can monitor multiple modes, it generates its own geometry in 
+		world space and thus, even though it has to be attached to a SceneNode
+		to be visible, changing the position of the scene node it is attached to
+		makes no difference to the geometry rendered.
+	@par
+		The 'head' element grows smoothly in size until it reaches the required size,
+		then a new element is added. If the segment is full, the tail element
+		shrinks by the same proportion as the head grows before disappearing.
+	@par
+		Elements can be faded out on a time basis, either by altering their colour
+		or altering their alpha. The width can also alter over time.
+	@par
+		'v' texture coordinates are fixed at 0.0 if used, meaning that you can
+		use a 1D texture to 'smear' a colour pattern along the ribbon if you wish.
+		The 'u' coordinates are by default (0.0, 1.0), but you can alter this 
+		using setOtherTexCoordRange if you wish.
+	*/
+	class _OgreExport RibbonTrail : public BillboardChain, public Node::Listener
+	{
+	public:
+		/** Constructor (don't use directly, use factory) 
+		@param name The name to give this object
+		@param maxElements The maximum number of elements per chain
+		@param numberOfChains The number of separate chain segments contained in this object,
+			ie the maximum number of nodes that can have trails attached
+		@param useTextureCoords If true, use texture coordinates from the chain elements
+		@param useVertexColours If true, use vertex colours from the chain elements (must
+			be true if you intend to use fading)
+		*/
+		RibbonTrail(const String& name, size_t maxElements = 20, size_t numberOfChains = 1, 
+			bool useTextureCoords = true, bool useVertexColours = true);
+		/// destructor
+		virtual ~RibbonTrail();
+
+		typedef vector<Node*>::type NodeList;
+		typedef ConstVectorIterator<NodeList> NodeIterator;
+
+		/** Add a node to be tracked.
+		@param n The node that will be tracked.
+		*/
+		virtual void addNode(Node* n);
+		/** Remove tracking on a given node. */
+		virtual void removeNode(Node* n);
+		/** Get an iterator over the nodes which are being tracked. */
+		virtual NodeIterator getNodeIterator(void) const;
+		/** Get the chain index for a given Node being tracked. */
+		virtual size_t getChainIndexForNode(const Node* n);
+
+		/** Set the length of the trail. 
+		@remarks
+			This sets the length of the trail, in world units. It also sets how
+			far apart each segment will be, ie length / max_elements. 
+		@param len The length of the trail in world units
+		*/
+		virtual void setTrailLength(Real len);
+		/** Get the length of the trail. */
+		virtual Real getTrailLength(void) const { return mTrailLength; }
+
+		/** @copydoc BillboardChain::setMaxChainElements */
+		void setMaxChainElements(size_t maxElements);
+		/** @copydoc BillboardChain::setNumberOfChains */
+		void setNumberOfChains(size_t numChains);
+		/** @copydoc BillboardChain::clearChain */
+		void clearChain(size_t chainIndex);
+
+		/** Set the starting ribbon colour for a given segment. 
+		@param chainIndex The index of the chain
+		@param col The initial colour
+		@note
+			Only used if this instance is using vertex colours.
+		*/
+		virtual void setInitialColour(size_t chainIndex, const ColourValue& col);
+		/** Set the starting ribbon colour. 
+		@param chainIndex The index of the chain
+		@param r,b,g,a The initial colour
+		@note
+			Only used if this instance is using vertex colours.
+		*/
+		virtual void setInitialColour(size_t chainIndex, Real r, Real g, Real b, Real a = 1.0);
+		/** Get the starting ribbon colour. */
+		virtual const ColourValue& getInitialColour(size_t chainIndex) const;
+
+		/** Enables / disables fading the trail using colour. 
+		@param chainIndex The index of the chain
+		@param valuePerSecond The amount to subtract from colour each second
+		*/
+		virtual void setColourChange(size_t chainIndex, const ColourValue& valuePerSecond);
+
+		/** Set the starting ribbon width in world units. 
+		@param chainIndex The index of the chain
+		@param width The initial width of the ribbon
+		*/
+		virtual void setInitialWidth(size_t chainIndex, Real width);
+		/** Get the starting ribbon width in world units. */
+		virtual Real getInitialWidth(size_t chainIndex) const;
+		
+		/** Set the change in ribbon width per second. 
+		@param chainIndex The index of the chain
+		@param widthDeltaPerSecond The amount the width will reduce by per second
+		*/
+		virtual void setWidthChange(size_t chainIndex, Real widthDeltaPerSecond);
+		/** Get the change in ribbon width per second. */
+		virtual Real getWidthChange(size_t chainIndex) const;
+
+		/** Enables / disables fading the trail using colour. 
+		@param chainIndex The index of the chain
+		@param r,g,b,a The amount to subtract from each colour channel per second
+		*/
+		virtual void setColourChange(size_t chainIndex, Real r, Real g, Real b, Real a);
+
+		/** Get the per-second fading amount */
+		virtual const ColourValue& getColourChange(size_t chainIndex) const;
+
+		/// @see Node::Listener::nodeUpdated
+		void nodeUpdated(const Node* node);
+		/// @see Node::Listener::nodeDestroyed
+		void nodeDestroyed(const Node* node);
+
+		/// Perform any fading / width delta required; internal method
+		virtual void _timeUpdate(Real time);
+
+        /** Overridden from MovableObject */
+        const String& getMovableType(void) const;
+
+	protected:
+		/// List of nodes being trailed
+		NodeList mNodeList;
+		/// Mapping of nodes to chain segments
+		typedef vector<size_t>::type IndexVector;
+		/// Ordered like mNodeList, contains chain index
+		IndexVector mNodeToChainSegment;
+		// chains not in use
+		IndexVector mFreeChains;
+
+		// fast lookup node->chain index
+		// we use positional map too because that can be useful
+		typedef map<const Node*, size_t>::type NodeToChainSegmentMap;
+		NodeToChainSegmentMap mNodeToSegMap;
+
+		/// Total length of trail in world units
+		Real mTrailLength;
+		/// length of each element
+		Real mElemLength;
+		/// Squared length of each element
+		Real mSquaredElemLength;
+		typedef vector<ColourValue>::type ColourValueList;
+		typedef vector<Real>::type RealList;
+		/// Initial colour of the ribbon
+		ColourValueList mInitialColour;
+		/// fade amount per second
+		ColourValueList mDeltaColour;
+		/// Initial width of the ribbon
+		RealList mInitialWidth;
+		/// Delta width of the ribbon
+		RealList mDeltaWidth;
+		/// controller used to hook up frame time to fader
+		Controller<Real>* mFadeController;
+		/// controller value for hooking up frame time to fader
+		ControllerValueRealPtr mTimeControllerValue;
+
+		/// Manage updates to the time controller
+		virtual void manageController(void);
+		/// Node has changed position, update
+		virtual void updateTrail(size_t index, const Node* node);
+        /// Reset the tracked chain to initial state
+        virtual void resetTrail(size_t index, const Node* node);
+        /// Reset all tracked chains to initial state
+        virtual void resetAllTrails(void);
+
+	};
+
+
+	/** Factory object for creating RibbonTrail instances */
+	class _OgreExport RibbonTrailFactory : public MovableObjectFactory
+	{
+	protected:
+		MovableObject* createInstanceImpl( const String& name, const NameValuePairList* params);
+	public:
+		RibbonTrailFactory() {}
+		~RibbonTrailFactory() {}
+
+		static String FACTORY_TYPE_NAME;
+
+		const String& getType(void) const;
+		void destroyInstance( MovableObject* obj);  
+
+	};
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreRoot.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreRoot.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreRoot.h	(revision 148)
@@ -0,0 +1,1093 @@
+/*
+-----------------------------------------------------------------------------
+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 __ROOT__
+#define __ROOT__
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+
+#include "OgreSingleton.h"
+#include "OgreString.h"
+#include "OgreSceneManagerEnumerator.h"
+#include "OgreResourceGroupManager.h"
+#include "OgreLodStrategyManager.h"
+#include "OgreWorkQueue.h"       
+
+#if OGRE_PLATFORM == OGRE_PLATFORM_ANDROID
+#include "Android/OgreAndroidLogListener.h"
+#endif
+
+#include <exception>
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+
+    typedef vector<RenderSystem*>::type RenderSystemList;
+	
+    /** The root class of the Ogre system.
+        @remarks
+            The Ogre::Root class represents a starting point for the client
+            application. From here, the application can gain access to the
+            fundamentals of the system, namely the rendering systems
+            available, management of saved configurations, logging, and
+            access to other classes in the system. Acts as a hub from which
+            all other objects may be reached. An instance of Root must be
+            created before any other Ogre operations are called. Once an
+            instance has been created, the same instance is accessible
+            throughout the life of that object by using Root::getSingleton
+            (as a reference) or Root::getSingletonPtr (as a pointer).
+    */
+    class _OgreExport Root : public Singleton<Root>, public RootAlloc
+    {
+        // To allow update of active renderer if
+        // RenderSystem::initialise is used directly
+        friend class RenderSystem;
+	protected:
+        RenderSystemList mRenderers;
+        RenderSystem* mActiveRenderer;
+        String mVersion;
+		String mConfigFileName;
+	    bool mQueuedEnd;
+        /// In case multiple render windows are created, only once are the resources loaded.
+        bool mFirstTimePostWindowInit;
+
+        // Singletons
+        LogManager* mLogManager;
+        ControllerManager* mControllerManager;
+        SceneManagerEnumerator* mSceneManagerEnum;
+		typedef deque<SceneManager*>::type SceneManagerStack;
+		SceneManagerStack mSceneManagerStack;
+        DynLibManager* mDynLibManager;
+        ArchiveManager* mArchiveManager;
+        MaterialManager* mMaterialManager;
+        MeshManager* mMeshManager;
+        ParticleSystemManager* mParticleManager;
+        SkeletonManager* mSkeletonManager;
+        
+        ArchiveFactory *mZipArchiveFactory;
+        ArchiveFactory *mEmbeddedZipArchiveFactory;
+        ArchiveFactory *mFileSystemArchiveFactory;
+        
+#if OGRE_PLATFORM == OGRE_PLATFORM_ANDROID
+        AndroidLogListener* mAndroidLogger;
+#endif
+        
+		ResourceGroupManager* mResourceGroupManager;
+		ResourceBackgroundQueue* mResourceBackgroundQueue;
+		ShadowTextureManager* mShadowTextureManager;
+		RenderSystemCapabilitiesManager* mRenderSystemCapabilitiesManager;
+        ScriptCompilerManager *mCompilerManager;
+        LodStrategyManager *mLodStrategyManager;
+        PMWorker* mPMWorker;
+        PMInjector* mPMInjector;
+
+        Timer* mTimer;
+        RenderWindow* mAutoWindow;
+        Profiler* mProfiler;
+        HighLevelGpuProgramManager* mHighLevelGpuProgramManager;
+		ExternalTextureSourceManager* mExternalTextureSourceManager;
+        CompositorManager* mCompositorManager;      
+        unsigned long mNextFrame;
+		Real mFrameSmoothingTime;
+		bool mRemoveQueueStructuresOnClear;
+		Real mDefaultMinPixelSize;
+
+	public:
+		typedef vector<DynLib*>::type PluginLibList;
+		typedef vector<Plugin*>::type PluginInstanceList;
+	protected:
+		/// List of plugin DLLs loaded
+        PluginLibList mPluginLibs;
+		/// List of Plugin instances registered
+		PluginInstanceList mPlugins;
+
+		typedef map<String, MovableObjectFactory*>::type MovableObjectFactoryMap;
+		MovableObjectFactoryMap mMovableObjectFactoryMap;
+		uint32 mNextMovableObjectTypeFlag;
+		// stock movable factories
+		MovableObjectFactory* mEntityFactory;
+		MovableObjectFactory* mLightFactory;
+		MovableObjectFactory* mBillboardSetFactory;
+		MovableObjectFactory* mManualObjectFactory;
+		MovableObjectFactory* mBillboardChainFactory;
+		MovableObjectFactory* mRibbonTrailFactory;
+
+		typedef map<String, RenderQueueInvocationSequence*>::type RenderQueueInvocationSequenceMap;
+		RenderQueueInvocationSequenceMap mRQSequenceMap;
+
+		/// Are we initialised yet?
+		bool mIsInitialised;
+
+		WorkQueue* mWorkQueue;
+
+		///Tells whether blend indices information needs to be passed to the GPU
+		bool mIsBlendIndicesGpuRedundant;
+		///Tells whether blend weights information needs to be passed to the GPU
+		bool mIsBlendWeightsGpuRedundant;
+
+        /** Method reads a plugins configuration file and instantiates all
+            plugins.
+            @param
+                pluginsfile The file that contains plugins information.
+                Defaults to "plugins.cfg" in release and to "plugins_d.cfg"
+                in debug build.
+        */
+        void loadPlugins(const String& pluginsfile = "plugins" OGRE_BUILD_SUFFIX ".cfg");
+		/** Initialise all loaded plugins - allows plugins to perform actions
+			once the renderer is initialised.
+		*/
+		void initialisePlugins();
+		/** Shuts down all loaded plugins - allows things to be tidied up whilst
+			all plugins are still loaded.
+		*/
+		void shutdownPlugins();
+
+		/** Unloads all loaded plugins.
+        */
+        void unloadPlugins();
+
+        /// Internal method for one-time tasks after first window creation
+        void oneTimePostWindowInit(void);
+
+        /** Set of registered frame listeners */
+        set<FrameListener*>::type mFrameListeners;
+
+        /** Set of frame listeners marked for removal and addition*/
+        set<FrameListener*>::type mRemovedFrameListeners;
+        set<FrameListener*>::type mAddedFrameListeners;
+        void _syncAddedRemovedFrameListeners();
+
+        /** Indicates the type of event to be considered by calculateEventTime(). */
+        enum FrameEventTimeType {
+            FETT_ANY = 0, 
+			FETT_STARTED = 1, 
+			FETT_QUEUED = 2, 
+			FETT_ENDED = 3, 
+			FETT_COUNT = 4
+        };
+
+        /// Contains the times of recently fired events
+		typedef deque<unsigned long>::type EventTimesQueue;
+        EventTimesQueue mEventTimes[FETT_COUNT];
+
+        /** Internal method for calculating the average time between recently fired events.
+        @param now The current time in ms.
+        @param type The type of event to be considered.
+        */
+        Real calculateEventTime(unsigned long now, FrameEventTimeType type);
+
+		/** Update a set of event times (note, progressive, only call once for each type per frame) */
+		void populateFrameEvent(FrameEventTimeType type, FrameEvent& evtToUpdate);
+
+    public:
+
+        /** Constructor
+        @param pluginFileName The file that contains plugins information.
+            Defaults to "plugins.cfg" in release build and to "plugins_d.cfg"
+            in debug build. May be left blank to ignore.
+		@param configFileName The file that contains the configuration to be loaded.
+			Defaults to "ogre.cfg", may be left blank to load nothing.
+		@param logFileName The logfile to create, defaults to Ogre.log, may be 
+			left blank if you've already set up LogManager & Log yourself
+		*/
+        Root(const String& pluginFileName = "plugins" OGRE_BUILD_SUFFIX ".cfg", 
+			const String& configFileName = "ogre.cfg", 
+			const String& logFileName = "Ogre.log");
+        ~Root();
+
+        /** Saves the details of the current configuration
+            @remarks
+                Stores details of the current configuration so it may be
+                restored later on.
+        */
+        void saveConfig(void);
+
+        /** Checks for saved video/sound/etc settings
+            @remarks
+                This method checks to see if there is a valid saved configuration
+                from a previous run. If there is, the state of the system will
+                be restored to that configuration.
+
+            @return
+                If a valid configuration was found, <b>true</b> is returned.
+            @par
+                If there is no saved configuration, or if the system failed
+                with the last config settings, <b>false</b> is returned.
+        */
+        bool restoreConfig(void);
+
+        /** Displays a dialog asking the user to choose system settings.
+            @remarks
+                This method displays the default dialog allowing the user to
+                choose the rendering system, video mode etc. If there is are
+                any settings saved already, they will be restored automatically
+                before displaying the dialogue. When the user accepts a group of
+                settings, this will automatically call Root::setRenderSystem,
+                RenderSystem::setConfigOption and Root::saveConfig with the
+                user's choices. This is the easiest way to get the system
+                configured.
+            @return
+                If the user clicked 'Ok', <b>true</b> is returned.
+            @par
+                If they clicked 'Cancel' (in which case the app should
+                strongly consider terminating), <b>false</b> is returned.
+         */
+        bool showConfigDialog(void);
+
+        /** Adds a new rendering subsystem to the list of available renderers.
+            @remarks
+                Intended for use by advanced users and plugin writers only!
+                Calling this method with a pointer to a valid RenderSystem
+                (subclass) adds a rendering API implementation to the list of
+                available ones. Typical examples would be an OpenGL
+                implementation and a Direct3D implementation.
+            @note
+                <br>This should usually be called from the dllStartPlugin()
+                function of an extension plug-in.
+        */
+        void addRenderSystem(RenderSystem* newRend);
+
+        /** Retrieve a list of the available render systems.
+            @remarks
+                Retrieves a pointer to the list of available renderers as a
+                list of RenderSystem subclasses. Can be used to build a
+                custom settings dialog.
+        */
+        const RenderSystemList& getAvailableRenderers(void);
+
+        /** Retrieve a pointer to the render system by the given name
+            @param
+                name Name of the render system intend to retrieve.
+            @return
+                A pointer to the render system, <b>NULL</b> if no found.
+        */
+        RenderSystem* getRenderSystemByName(const String& name);
+
+        /** Sets the rendering subsystem to be used.
+            @remarks
+                This method indicates to OGRE which rendering system is to be
+                used (e.g. Direct3D, OpenGL etc). This is called
+                automatically by the default config dialog, and when settings
+                are restored from a previous configuraion. If used manually
+                it could be used to set the renderer from a custom settings
+                dialog. Once this has been done, the renderer can be
+                initialised using Root::initialise.
+            @par
+                This method is also called by render systems if they are
+                initialised directly.
+            @param
+                system Pointer to the render system to use.
+            @see
+                RenderSystem
+        */
+        void setRenderSystem(RenderSystem* system);
+
+        /** Retrieve a pointer to the currently selected render system.
+        */
+        RenderSystem* getRenderSystem(void);
+
+        /** Initialises the renderer.
+            @remarks
+                This method can only be called after a renderer has been
+                selected with Root::setRenderSystem, and it will initialise
+                the selected rendering system ready for use.
+            @param
+                autoCreateWindow If true, a rendering window will
+                automatically be created (saving a call to
+                Root::createRenderWindow). The window will be
+                created based on the options currently set on the render
+                system.
+            @return
+                A pointer to the automatically created window, if
+                requested, otherwise <b>NULL</b>.
+        */
+	    RenderWindow* initialise(bool autoCreateWindow, const String& windowTitle = "OGRE Render Window",
+                                    const String& customCapabilitiesConfig = StringUtil::BLANK);
+
+		/** Returns whether the system is initialised or not. */
+		bool isInitialised(void) const { return mIsInitialised; }
+
+        /** Requests active RenderSystem to use custom RenderSystemCapabilities
+        @remarks
+            This is useful for testing how the RenderSystem would behave on a machine with
+            less advanced GPUs. This method MUST be called before creating the first RenderWindow
+        */
+        void useCustomRenderSystemCapabilities(RenderSystemCapabilities* capabilities);
+
+		/** Get whether the entire render queue structure should be emptied on clearing, 
+			or whether just the objects themselves should be cleared.
+		*/
+		bool getRemoveRenderQueueStructuresOnClear() const { return mRemoveQueueStructuresOnClear; }
+
+		/** Set whether the entire render queue structure should be emptied on clearing, 
+		or whether just the objects themselves should be cleared.
+		*/
+		void setRemoveRenderQueueStructuresOnClear(bool r) { mRemoveQueueStructuresOnClear = r; }
+
+		/** Register a new SceneManagerFactory, a factory object for creating instances
+			of specific SceneManagers. 
+		@remarks
+			Plugins should call this to register as new SceneManager providers.
+		*/
+		void addSceneManagerFactory(SceneManagerFactory* fact);
+
+		/** Unregister a SceneManagerFactory.
+		*/
+		void removeSceneManagerFactory(SceneManagerFactory* fact);
+
+		/** Get more information about a given type of SceneManager.
+		@remarks
+			The metadata returned tells you a few things about a given type 
+			of SceneManager, which can be created using a factory that has been
+			registered already. 
+		@param typeName The type name of the SceneManager you want to enquire on.
+			If you don't know the typeName already, you can iterate over the 
+			metadata for all types using getMetaDataIterator.
+		*/
+		const SceneManagerMetaData* getSceneManagerMetaData(const String& typeName) const;
+
+		/** Iterate over all types of SceneManager available for construction, 
+			providing some information about each one.
+		*/
+		SceneManagerEnumerator::MetaDataIterator getSceneManagerMetaDataIterator(void) const;
+
+		/** Create a SceneManager instance of a given type.
+		@remarks
+			You can use this method to create a SceneManager instance of a 
+			given specific type. You may know this type already, or you may
+			have discovered it by looking at the results from getMetaDataIterator.
+		@note
+			This method throws an exception if the named type is not found.
+		@param typeName String identifying a unique SceneManager type
+		@param instanceName Optional name to given the new instance that is
+			created. If you leave this blank, an auto name will be assigned.
+		*/
+		SceneManager* createSceneManager(const String& typeName, 
+			const String& instanceName = StringUtil::BLANK);
+
+		/** Create a SceneManager instance based on scene type support.
+		@remarks
+			Creates an instance of a SceneManager which supports the scene types
+			identified in the parameter. If more than one type of SceneManager 
+			has been registered as handling that combination of scene types, 
+			in instance of the last one registered is returned.
+		@note This method always succeeds, if a specific scene manager is not
+			found, the default implementation is always returned.
+		@param typeMask A mask containing one or more SceneType flags
+		@param instanceName Optional name to given the new instance that is
+			created. If you leave this blank, an auto name will be assigned.
+		*/
+		SceneManager* createSceneManager(SceneTypeMask typeMask, 
+			const String& instanceName = StringUtil::BLANK);
+
+		/** Destroy an instance of a SceneManager. */
+		void destroySceneManager(SceneManager* sm);
+
+		/** Get an existing SceneManager instance that has already been created,
+			identified by the instance name.
+		@param instanceName The name of the instance to retrieve.
+		*/
+		SceneManager* getSceneManager(const String& instanceName) const;
+
+		/** Determines if a given SceneManager already exists
+		@param instanceName The name of the instance to retrieve.
+		*/
+		bool hasSceneManager(const String& instanceName) const;
+		/** Get an iterator over all the existing SceneManager instances. */
+		SceneManagerEnumerator::SceneManagerIterator getSceneManagerIterator(void);
+
+        /** Retrieves a reference to the current TextureManager.
+            @remarks
+                This performs the same function as
+                TextureManager::getSingleton, but is provided for convenience
+                particularly to scripting engines.
+            @par
+                Note that a TextureManager will NOT be available until the
+                Ogre system has been initialised by selecting a RenderSystem,
+                calling Root::initialise and a window having been created
+                (this may have been done by initialise if required). This is
+                because the exact runtime subclass which will be implementing
+                the calls will differ depending on the rendering engine
+                selected, and these typically require a window upon which to
+                base texture format decisions.
+        */
+        TextureManager* getTextureManager(void);
+
+        /** Retrieves a reference to the current MeshManager.
+            @remarks
+                This performs the same function as MeshManager::getSingleton
+                and is provided for convenience to scripting engines.
+        */
+        MeshManager* getMeshManager(void);
+
+        /** Utility function for getting a better description of an error
+            code.
+        */
+        String getErrorDescription(long errorNumber);
+
+        /** Registers a FrameListener which will be called back every frame.
+            @remarks
+                A FrameListener is a class which implements methods which
+                will be called every frame.
+            @par
+                See the FrameListener class for more details on the specifics
+                It is imperitive that the instance passed to this method is
+                not destroyed before either the rendering loop ends, or the
+                class is removed from the listening list using
+                removeFrameListener.
+            @note
+                <br>This method can only be called after Root::initialise has
+                been called.
+            @see
+                FrameListener, Root::removeFrameListener
+        */
+        void addFrameListener(FrameListener* newListener);
+
+        /** Removes a FrameListener from the list of listening classes.
+            @see
+                FrameListener, Root::addFrameListener
+        */
+        void removeFrameListener(FrameListener* oldListener);
+
+        /** Queues the end of rendering.
+            @remarks
+                This method will do nothing unless startRendering() has
+                been called, in which case before the next frame is rendered
+                the rendering loop will bail out.
+            @see
+                Root, Root::startRendering
+        */
+        void queueEndRendering(bool state = true);
+
+        /** Check for planned end of rendering.
+            @remarks
+                This method return true if queueEndRendering() was called before.
+            @see
+                Root, Root::queueEndRendering, Root::startRendering
+        */
+        bool endRenderingQueued(void);
+
+        /** Starts / restarts the automatic rendering cycle.
+            @remarks
+                This method begins the automatic rendering of the scene. It
+                will <b>NOT</b> return until the rendering cycle is halted.
+            @par
+                During rendering, any FrameListener classes registered using
+                addFrameListener will be called back for each frame that is
+                to be rendered, These classes can tell OGRE to halt the
+                rendering if required, which will cause this method to
+                return.
+            @note
+                <br>Users of the OGRE library do not have to use this
+                automatic rendering loop. It is there as a convenience and is
+                most useful for high frame rate applications e.g. games. For
+                applications that don't need to constantly refresh the
+                rendering targets (e.g. an editor utility), it is better to
+                manually refresh each render target only when required by
+                calling RenderTarget::update, or if you want to run your own
+				render loop you can update all targets on demand using
+				Root::renderOneFrame.
+            @note
+                This frees up the CPU to do other things in between
+                refreshes, since in this case frame rate is less important.
+            @note
+                This method can only be called after Root::initialise has
+                been called.
+        */
+        void startRendering(void);
+
+        /** Render one frame. 
+        @remarks
+            Updates all the render targets automatically and then returns,
+            raising frame events before and after.
+        */
+        bool renderOneFrame(void);
+
+		/** Render one frame, with custom frame time information. 
+		@remarks
+		Updates all the render targets automatically and then returns,
+		raising frame events before and after - all per-frame times are based on
+		the time value you pass in.
+		*/
+		bool renderOneFrame(Real timeSinceLastFrame);
+
+        /** Shuts down the system manually.
+            @remarks
+                This is normally done by Ogre automatically so don't think
+                you have to call this yourself. However this is here for
+                convenience, especially for dealing with unexpected errors or
+                for systems which need to shut down Ogre on demand.
+        */
+        void shutdown(void);
+
+        /** Adds a location to the list of searchable locations for a
+            Resource type.
+            @remarks
+                Resource files (textures, models etc) need to be loaded from
+                specific locations. By calling this method, you add another 
+				search location to the list. Locations added first are preferred
+				over locations added later.
+            @par
+                Locations can be folders, compressed archives, even perhaps
+                remote locations. Facilities for loading from different
+                locations are provided by plugins which provide
+                implementations of the Archive class.
+                All the application user has to do is specify a 'loctype'
+                string in order to indicate the type of location, which
+                should map onto one of the provided plugins. Ogre comes
+                configured with the 'FileSystem' (folders) and 'Zip' (archive
+                compressed with the pkzip / WinZip etc utilities) types.
+            @par
+				You can also supply the name of a resource group which should
+				have this location applied to it. The 
+				ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME group is the
+				default, and one resource group which will always exist. You
+				should consider defining resource groups for your more specific
+				resources (e.g. per level) so that you can control loading /
+				unloading better.
+            @param
+                name The name of the location, e.g. './data' or
+                '/compressed/gamedata.zip'
+            @param
+                locType A string identifying the location type, e.g.
+                'FileSystem' (for folders), 'Zip' etc. Must map to a
+                registered plugin which deals with this type (FileSystem and
+                Zip should always be available)
+            @param
+                groupName Type of name of the resource group which this location
+				should apply to; defaults to the General group which applies to
+				all non-specific resources.
+			@param
+				recursive If the resource location has a concept of recursive
+				directory traversal, enabling this option will mean you can load
+				resources in subdirectories using only their unqualified name.
+				The default is to disable this so that resources in subdirectories
+				with the same name are still unique.
+            @see
+                Archive
+        */
+        void addResourceLocation(const String& name, const String& locType, 
+			const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, 
+			bool recursive = false);
+
+		/** Removes a resource location from the list.
+		@see addResourceLocation
+		@param name The name of the resource location as specified in addResourceLocation
+		@param groupName The name of the resource group to which this location 
+			was assigned.
+		*/
+		void removeResourceLocation(const String& name, 
+			const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+
+		/** Helper method to assist you in creating writeable file streams.
+		@remarks
+			This is a high-level utility method which you can use to find a place to 
+			save a file more easily. If the filename you specify is either an
+			absolute or relative filename (ie it includes path separators), then
+			the file will be created in the normal filesystem using that specification.
+			If it doesn't, then the method will look for a writeable resource location
+			via ResourceGroupManager::createResource using the other params provided.
+		@param filename The name of the file to create. If it includes path separators, 
+			the filesystem will be accessed direct. If no path separators are
+			present the resource system is used, falling back on the raw filesystem after.
+		@param groupName The name of the group in which to create the file, if the 
+			resource system is used
+		@param overwrite If true, an existing file will be overwritten, if false
+			an error will occur if the file already exists
+		@param locationPattern If the resource group contains multiple locations, 
+			then usually the file will be created in the first writable location. If you 
+			want to be more specific, you can include a location pattern here and 
+			only locations which match that pattern (as determined by StringUtil::match)
+			will be considered candidates for creation.
+		*/
+		DataStreamPtr createFileStream(const String& filename, const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, 
+			bool overwrite = false, const String& locationPattern = StringUtil::BLANK);
+
+		/** Helper method to assist you in accessing readable file streams.
+		@remarks
+			This is a high-level utility method which you can use to find a place to 
+			open a file more easily. It checks the resource system first, and if
+			that fails falls back on accessing the file system directly.
+		@param filename The name of the file to open. 
+		@param groupName The name of the group in which to create the file, if the 
+			resource system is used
+		@param locationPattern If the resource group contains multiple locations, 
+			then usually the file will be created in the first writable location. If you 
+			want to be more specific, you can include a location pattern here and 
+			only locations which match that pattern (as determined by StringUtil::match)
+			will be considered candidates for creation.
+		*/		
+		DataStreamPtr openFileStream(const String& filename, const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, 
+			const String& locationPattern = StringUtil::BLANK);
+
+        /** Generates a packed data version of the passed in ColourValue suitable for
+            use with the current RenderSystem.
+        @remarks
+            Since different render systems have different colour data formats (eg
+            RGBA for GL, ARGB for D3D) this method allows you to use 1 method for all.
+        @param colour The colour to convert
+        @param pDest Pointer to location to put the result.
+        */
+        void convertColourValue(const ColourValue& colour, uint32* pDest);
+
+        /** Retrieves a pointer to the window that was created automatically
+            @remarks
+                When Root is initialised an optional window is created. This
+                method retrieves a pointer to that window.
+            @note
+                returns a null pointer when Root has not been initialised with
+                the option of creating a window.
+        */
+        RenderWindow* getAutoCreatedWindow(void);
+
+        /** @copydoc RenderSystem::_createRenderWindow
+        */
+		RenderWindow* createRenderWindow(const String &name, unsigned int width, unsigned int height, 
+			bool fullScreen, const NameValuePairList *miscParams = 0) ;
+
+		/** @copydoc RenderSystem::_createRenderWindows
+		*/
+		bool createRenderWindows(const RenderWindowDescriptionList& renderWindowDescriptions,
+			RenderWindowList& createdWindows);
+	
+        /** Detaches a RenderTarget from the active render system
+        and returns a pointer to it.
+        @note
+        If the render target cannot be found, NULL is returned.
+        */
+        RenderTarget* detachRenderTarget( RenderTarget* pWin );
+
+        /** Detaches a named RenderTarget from the active render system
+        and returns a pointer to it.
+        @note
+        If the render target cannot be found, NULL is returned.
+        */
+        RenderTarget* detachRenderTarget( const String & name );
+
+        /** Destroys the given RenderTarget.
+        */
+        void destroyRenderTarget(RenderTarget* target);
+
+        /** Destroys the given named RenderTarget.
+        */
+        void destroyRenderTarget(const String &name);
+
+        /** Retrieves a pointer to a named render target.
+        */
+        RenderTarget * getRenderTarget(const String &name);
+
+		/** Manually load a Plugin contained in a DLL / DSO.
+		 @remarks
+		 	Plugins embedded in DLLs can be loaded at startup using the plugin 
+			configuration file specified when you create Root.
+			This method allows you to load plugin DLLs directly in code.
+			The DLL in question is expected to implement a dllStartPlugin 
+			method which instantiates a Plugin subclass and calls Root::installPlugin.
+			It should also implement dllStopPlugin (see Root::unloadPlugin)
+		@param pluginName Name of the plugin library to load
+		*/
+		void loadPlugin(const String& pluginName);
+
+		/** Manually unloads a Plugin contained in a DLL / DSO.
+		 @remarks
+		 	Plugin DLLs are unloaded at shutdown automatically. This method 
+			allows you to unload plugins in code, but make sure their 
+			dependencies are decoupled first. This method will call the 
+			dllStopPlugin method defined in the DLL, which in turn should call
+			Root::uninstallPlugin.
+		@param pluginName Name of the plugin library to unload
+		*/
+		void unloadPlugin(const String& pluginName);
+
+		/** Install a new plugin.
+		@remarks
+			This installs a new extension to OGRE. The plugin itself may be loaded
+			from a DLL / DSO, or it might be statically linked into your own 
+			application. Either way, something has to call this method to get
+			it registered and functioning. You should only call this method directly
+			if your plugin is not in a DLL that could otherwise be loaded with 
+			loadPlugin, since the DLL function dllStartPlugin should call this
+			method when the DLL is loaded. 
+		*/
+		void installPlugin(Plugin* plugin);
+
+		/** Uninstall an existing plugin.
+		@remarks
+			This uninstalls an extension to OGRE. Plugins are automatically 
+			uninstalled at shutdown but this lets you remove them early. 
+			If the plugin was loaded from a DLL / DSO you should call unloadPlugin
+			which should result in this method getting called anyway (if the DLL
+			is well behaved).
+		*/
+		void uninstallPlugin(Plugin* plugin);
+
+		/** Gets a read-only list of the currently installed plugins. */
+		const PluginInstanceList& getInstalledPlugins() const { return mPlugins; }
+
+        /** Gets a pointer to the central timer used for all OGRE timings */
+        Timer* getTimer(void);
+
+        /** Method for raising frame started events. 
+        @remarks
+            This method is only for internal use when you use OGRE's inbuilt rendering
+            loop (Root::startRendering). However, if you run your own rendering loop then
+            you should call this method to ensure that FrameListener objects are notified
+            of frame events; processes like texture animation and particle systems rely on 
+            this.
+        @par
+            Calling this method also increments the frame number, which is
+            important for keeping some elements of the engine up to date.
+        @note
+            This method takes an event object as a parameter, so you can specify the times
+            yourself. If you are happy for OGRE to automatically calculate the frame time
+            for you, then call the other version of this method with no parameters.
+        @param evt Event object which includes all the timing information which you have 
+            calculated for yourself
+        @return False if one or more frame listeners elected that the rendering loop should
+            be terminated, true otherwise.
+        */
+        bool _fireFrameStarted(FrameEvent& evt);
+        /** Method for raising frame rendering queued events. 
+        @remarks
+            This method is only for internal use when you use OGRE's inbuilt rendering
+            loop (Root::startRendering). However, if you run your own rendering loop then
+            you should call this method too, to ensure that all state is updated
+			correctly. You should call it after the windows have been updated
+			but before the buffers are swapped, or if you are not separating the
+			update and buffer swap, then after the update just before _fireFrameEnded.
+        */
+        bool _fireFrameRenderingQueued(FrameEvent& evt);
+
+        /** Method for raising frame ended events. 
+        @remarks
+            This method is only for internal use when you use OGRE's inbuilt rendering
+            loop (Root::startRendering). However, if you run your own rendering loop then
+            you should call this method to ensure that FrameListener objects are notified
+            of frame events; processes like texture animation and particle systems rely on 
+            this.
+        @note
+            This method takes an event object as a parameter, so you can specify the times
+            yourself. If you are happy for OGRE to automatically calculate the frame time
+            for you, then call the other version of this method with no parameters.
+        @param evt Event object which includes all the timing information which you have 
+            calculated for yourself
+        @return False if one or more frame listeners elected that the rendering loop should
+            be terminated, true otherwise.
+        */
+        bool _fireFrameEnded(FrameEvent& evt);
+        /** Method for raising frame started events. 
+        @remarks
+            This method is only for internal use when you use OGRE's inbuilt rendering
+            loop (Root::startRendering). However, if you run your own rendering loop then
+            you should call this method to ensure that FrameListener objects are notified
+            of frame events; processes like texture animation and particle systems rely on 
+            this.
+        @par
+            Calling this method also increments the frame number, which is
+            important for keeping some elements of the engine up to date.
+        @note
+            This method calculates the frame timing information for you based on the elapsed
+            time. If you want to specify elapsed times yourself you should call the other 
+            version of this method which takes event details as a parameter.
+        @return False if one or more frame listeners elected that the rendering loop should
+            be terminated, true otherwise.
+        */
+        bool _fireFrameStarted();
+        /** Method for raising frame rendering queued events. 
+        @remarks
+            This method is only for internal use when you use OGRE's inbuilt rendering
+            loop (Root::startRendering). However, if you run your own rendering loop then
+            you you may want to call this method too, although nothing in OGRE relies on this
+			particular event. Really if you're running your own rendering loop at
+			this level of detail then you can get the same effect as doing your
+			updates in a frameRenderingQueued callback by just calling 
+			RenderWindow::update with the 'swapBuffers' option set to false. 
+        */
+        bool _fireFrameRenderingQueued();
+        /** Method for raising frame ended events. 
+        @remarks
+            This method is only for internal use when you use OGRE's inbuilt rendering
+            loop (Root::startRendering). However, if you run your own rendering loop then
+            you should call this method to ensure that FrameListener objects are notified
+            of frame events; processes like texture animation and particle systems rely on 
+            this.
+        @note
+            This method calculates the frame timing information for you based on the elapsed
+            time. If you want to specify elapsed times yourself you should call the other 
+            version of this method which takes event details as a parameter.
+        @return False if one or more frame listeners elected that the rendering loop should
+            be terminated, true otherwise.
+        */
+        bool _fireFrameEnded();
+
+        /** Gets the number of the next frame to be rendered. 
+		@remarks
+			Note that this is 'next frame' rather than 'current frame' because
+			it indicates the frame number that current changes made to the scene
+			will take effect. It is incremented after all rendering commands for
+			the current frame have been queued, thus reflecting that if you 
+			start performing changes then, you will actually see them in the 
+			next frame. */
+        unsigned long getNextFrameNumber(void) const { return mNextFrame; }
+
+        /** Returns the scene manager currently being used to render a frame.
+        @remarks
+            This is only intended for internal use; it is only valid during the
+            rendering of a frame.
+        */
+        SceneManager* _getCurrentSceneManager(void) const;
+        /** Pushes the scene manager currently being used to render.
+        @remarks
+            This is only intended for internal use.
+        */
+        void _pushCurrentSceneManager(SceneManager* sm);
+		/** Pops the scene manager currently being used to render.
+		@remarks
+		This is only intended for internal use.
+		*/
+		void _popCurrentSceneManager(SceneManager* sm);
+
+        /** Internal method used for updating all RenderTarget objects (windows, 
+            renderable textures etc) which are set to auto-update.
+        @remarks
+            You don't need to use this method if you're using Ogre's own internal
+            rendering loop (Root::startRendering). If you're running your own loop
+            you may wish to call it to update all the render targets which are
+            set to auto update (RenderTarget::setAutoUpdated). You can also update
+            individual RenderTarget instances using their own update() method.
+		@return false if a FrameListener indicated it wishes to exit the render loop
+        */
+        bool _updateAllRenderTargets(void);
+
+        /** Internal method used for updating all RenderTarget objects (windows, 
+            renderable textures etc) which are set to auto-update, with a custom time
+			passed to the frameRenderingQueued events.
+        @remarks
+            You don't need to use this method if you're using Ogre's own internal
+            rendering loop (Root::startRendering). If you're running your own loop
+            you may wish to call it to update all the render targets which are
+            set to auto update (RenderTarget::setAutoUpdated). You can also update
+            individual RenderTarget instances using their own update() method.
+		@return false if a FrameListener indicated it wishes to exit the render loop
+        */
+        bool _updateAllRenderTargets(FrameEvent& evt);
+
+		/** Create a new RenderQueueInvocationSequence, useful for linking to
+			Viewport instances to perform custom rendering.
+		@param name The name to give the new sequence
+		*/
+		RenderQueueInvocationSequence* createRenderQueueInvocationSequence(
+			const String& name);
+
+		/** Get a RenderQueueInvocationSequence. 
+		@param name The name to identify the sequence
+		*/
+		RenderQueueInvocationSequence* getRenderQueueInvocationSequence(
+			const String& name);
+
+		/** Destroy a RenderQueueInvocationSequence. 
+		@remarks
+			You must ensure that no Viewports are using this sequence.
+		@param name The name to identify the sequence
+		*/
+		void destroyRenderQueueInvocationSequence(
+			const String& name);
+
+		/** Destroy all RenderQueueInvocationSequences. 
+		@remarks
+			You must ensure that no Viewports are using custom sequences.
+		*/
+		void destroyAllRenderQueueInvocationSequences(void);
+
+        /** Override standard Singleton retrieval.
+            @remarks
+                Why do we do this? Well, it's because the Singleton
+                implementation is in a .h file, which means it gets compiled
+                into anybody who includes it. This is needed for the
+                Singleton template to work, but we actually only want it
+                compiled into the implementation of the class based on the
+                Singleton, not all of them. If we don't change this, we get
+                link errors when trying to use the Singleton-based class from
+                an outside dll.
+            @par
+                This method just delegates to the template version anyway,
+                but the implementation stays in this single compilation unit,
+                preventing link errors.
+        */
+        static Root& getSingleton(void);
+        /** Override standard Singleton retrieval.
+            @remarks
+                Why do we do this? Well, it's because the Singleton
+                implementation is in a .h file, which means it gets compiled
+                into anybody who includes it. This is needed for the
+                Singleton template to work, but we actually only want it
+                compiled into the implementation of the class based on the
+                Singleton, not all of them. If we don't change this, we get
+                link errors when trying to use the Singleton-based class from
+                an outside dll.
+            @par
+                This method just delegates to the template version anyway,
+                but the implementation stays in this single compilation unit,
+                preventing link errors.
+        */
+        static Root* getSingletonPtr(void);
+
+		/** Clears the history of all event times. 
+		@remarks
+			OGRE stores a history of the last few event times in order to smooth
+			out any inaccuracies and temporary fluctuations. However, if you 
+			pause or don't render for a little while this can cause a lurch, so
+			if you're resuming rendering after a break, call this method to reset
+			the stored times
+		*/
+		void clearEventTimes(void);
+
+		/** Sets the period over which OGRE smooths out fluctuations in frame times.
+		@remarks
+			OGRE by default gives you the raw frame time, but can optionally
+			smooths it out over several frames, in order to reduce the 
+			noticeable effect of occasional hiccups in framerate.
+			These smoothed values are passed back as parameters to FrameListener
+			calls.
+		@par
+			This method allow you to tweak the smoothing period, and is expressed
+			in seconds. Setting it to 0 will result in completely unsmoothed
+			frame times (the default).
+		*/
+		void setFrameSmoothingPeriod(Real period) { mFrameSmoothingTime = period; }
+		/** Gets the period over which OGRE smooths out fluctuations in frame times. */
+		Real getFrameSmoothingPeriod(void) const { return mFrameSmoothingTime; }
+
+		/** Register a new MovableObjectFactory which will create new MovableObject
+			instances of a particular type, as identified by the getType() method.
+		@remarks
+			Plugin creators can create subclasses of MovableObjectFactory which 
+			construct custom subclasses of MovableObject for insertion in the 
+			scene. This is the primary way that plugins can make custom objects
+			available.
+		@param fact Pointer to the factory instance
+		@param overrideExisting Set this to true to override any existing 
+			factories which are registered for the same type. You should only
+			change this if you are very sure you know what you're doing. 
+		*/
+		void addMovableObjectFactory(MovableObjectFactory* fact, 
+			bool overrideExisting = false);
+		/** Removes a previously registered MovableObjectFactory.
+		@remarks
+			All instances of objects created by this factory will be destroyed
+			before removing the factory (by calling back the factories 
+			'destroyInstance' method). The plugin writer is responsible for actually
+			destroying the factory.
+		*/
+		void removeMovableObjectFactory(MovableObjectFactory* fact);
+		/// Checks whether a factory is registered for a given MovableObject type
+		bool hasMovableObjectFactory(const String& typeName) const;
+		/// Get a MovableObjectFactory for the given type
+		MovableObjectFactory* getMovableObjectFactory(const String& typeName);
+		/** Allocate the next MovableObject type flag.
+		@remarks
+			This is done automatically if MovableObjectFactory::requestTypeFlags
+			returns true; don't call this manually unless you're sure you need to.
+		*/
+		uint32 _allocateNextMovableObjectTypeFlag(void);
+
+		typedef ConstMapIterator<MovableObjectFactoryMap> MovableObjectFactoryIterator;
+		/** Return an iterator over all the MovableObjectFactory instances currently
+			registered.
+		*/
+		MovableObjectFactoryIterator getMovableObjectFactoryIterator(void) const;
+
+		/**
+		* Gets the number of display monitors.
+		*/
+		unsigned int getDisplayMonitorCount() const;
+
+		/** Get the WorkQueue for processing background tasks.
+			You are free to add new requests and handlers to this queue to
+			process your custom background tasks using the shared thread pool. 
+			However, you must remember to assign yourself a new channel through 
+			which to process your tasks.
+		*/
+		WorkQueue* getWorkQueue() const { return mWorkQueue; }
+
+		/** Replace the current work queue with an alternative. 
+			You can use this method to replace the internal implementation of
+			WorkQueue with  your own, e.g. to externalise the processing of 
+			background events. Doing so will delete the existing queue and
+			replace it with this one. 
+		@param queue The new WorkQueue instance. Root will delete this work queue
+			at shutdown, so do not destroy it yourself.
+		*/
+		void setWorkQueue(WorkQueue* queue);
+			
+		/** Sets whether blend indices information needs to be passed to the GPU.
+			When entities use software animation they remove blend information such as
+			indices and weights from the vertex buffers sent to the graphic card. This function
+			can be used to limit which information is removed.
+		@param redundant Set to true to remove blend indices information.
+		*/
+		void setBlendIndicesGpuRedundant(bool redundant) {	mIsBlendIndicesGpuRedundant = redundant; }
+		/** Returns whether blend indices information needs to be passed to the GPU
+		see setBlendIndicesGpuRedundant() for more information
+		*/
+		bool isBlendIndicesGpuRedundant() const { return mIsBlendIndicesGpuRedundant; }
+
+		/** Sets whether blend weights information needs to be passed to the GPU.
+		When entities use software animation they remove blend information such as
+		indices and weights from the vertex buffers sent to the graphic card. This function
+		can be used to limit which information is removed.
+		@param redundant Set to true to remove blend weights information.
+		*/
+		void setBlendWeightsGpuRedundant(bool redundant) {	mIsBlendWeightsGpuRedundant = redundant; }
+		/** Returns whether blend weights information needs to be passed to the GPU
+		see setBlendWeightsGpuRedundant() for more information
+		*/
+		bool isBlendWeightsGpuRedundant() const { return mIsBlendWeightsGpuRedundant; }
+	
+		/** Set the default minimum pixel size for object to be rendered by
+		@note
+			To use this feature see Camera::setUseMinPixelSize()
+		*/
+		void setDefaultMinPixelSize(Real pixelSize) { mDefaultMinPixelSize = pixelSize; }
+
+		/** Get the default minimum pixel size for object to be rendered by
+		*/
+		Real getDefaultMinPixelSize() { return mDefaultMinPixelSize; }
+	
+
+    };
+	/** @} */
+	/** @} */
+} // Namespace Ogre
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreRotationalSpline.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreRotationalSpline.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreRotationalSpline.h	(revision 148)
@@ -0,0 +1,138 @@
+/*
+-----------------------------------------------------------------------------
+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 __RotationalSpline_H__
+#define __RotationalSpline_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreQuaternion.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Math
+	*  @{
+	*/
+	/** This class interpolates orientations (rotations) along a spline using 
+        derivatives of quaternions.
+    @remarks
+        Like the SimpleSpline class, this class is about interpolating values 
+        smoothly over a spline. Whilst SimpleSpline deals with positions (the normal
+        sense we think about splines), this class interpolates orientations. The
+        theory is identical, except we're now in 4-dimensional space instead of 3.
+    @par
+        In positional splines, we use the points and tangents on those points to generate
+        control points for the spline. In this case, we use quaternions and derivatives
+        of the quaternions (i.e. the rate and direction of change at each point). This is the
+        same as SimpleSpline since a tangent is a derivative of a position. We effectively 
+        generate an extra quaternion in between each actual quaternion which when take with 
+        the original quaternion forms the 'tangent' of that quaternion.
+    */
+	class _OgreExport RotationalSpline
+    {
+    public:
+        RotationalSpline();
+        ~RotationalSpline();
+
+        /** Adds a control point to the end of the spline. */
+        void addPoint(const Quaternion& p);
+
+        /** Gets the detail of one of the control points of the spline. */
+        const Quaternion& getPoint(unsigned short index) const;
+
+        /** Gets the number of control points in the spline. */
+        unsigned short getNumPoints(void) const;
+
+        /** Clears all the points in the spline. */
+        void clear(void);
+
+        /** Updates a single point in the spline. 
+        @remarks
+            This point must already exist in the spline.
+        */
+        void updatePoint(unsigned short index, const Quaternion& value);
+
+        /** Returns an interpolated point based on a parametric value over the whole series.
+        @remarks
+            Given a t value between 0 and 1 representing the parametric distance along the
+            whole length of the spline, this method returns an interpolated point.
+        @param t Parametric value.
+		@param useShortestPath Defines if rotation should take the shortest possible path
+        */
+        Quaternion interpolate(Real t, bool useShortestPath=true);
+
+        /** Interpolates a single segment of the spline given a parametric value.
+        @param fromIndex The point index to treat as t=0. fromIndex + 1 is deemed to be t=1
+        @param t Parametric value
+		@param useShortestPath Defines if rotation should take the shortest possible path
+        */
+        Quaternion interpolate(unsigned int fromIndex, Real t, bool useShortestPath=true);
+
+        /** Tells the spline whether it should automatically calculate tangents on demand
+            as points are added.
+        @remarks
+            The spline calculates tangents at each point automatically based on the input points.
+            Normally it does this every time a point changes. However, if you have a lot of points
+            to add in one go, you probably don't want to incur this overhead and would prefer to 
+            defer the calculation until you are finished setting all the points. You can do this
+            by calling this method with a parameter of 'false'. Just remember to manually call 
+            the recalcTangents method when you are done.
+        @param autoCalc If true, tangents are calculated for you whenever a point changes. If false, 
+            you must call reclacTangents to recalculate them when it best suits.
+        */
+        void setAutoCalculate(bool autoCalc);
+
+        /** Recalculates the tangents associated with this spline. 
+        @remarks
+            If you tell the spline not to update on demand by calling setAutoCalculate(false)
+            then you must call this after completing your updates to the spline points.
+        */
+        void recalcTangents(void);
+
+    protected:
+
+        bool mAutoCalc;
+
+
+
+        vector<Quaternion>::type mPoints;
+        vector<Quaternion>::type mTangents;
+
+    };
+
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreSceneManager.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreSceneManager.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreSceneManager.h	(revision 148)
@@ -0,0 +1,3675 @@
+/*-------------------------------------------------------------------------
+This source file is a 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
+
+You may alternatively use this source under the terms of a specific version of
+the OGRE Unrestricted License provided you have obtained such a license from
+Torus Knot Software Ltd.
+-------------------------------------------------------------------------*/
+#ifndef __SceneManager_H__
+#define __SceneManager_H__
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+
+#include "OgreString.h"
+#include "OgreSceneNode.h"
+#include "OgrePlane.h"
+#include "OgreQuaternion.h"
+#include "OgreColourValue.h"
+#include "OgreCommon.h"
+#include "OgreSceneQuery.h"
+#include "OgreAutoParamDataSource.h"
+#include "OgreAnimationState.h"
+#include "OgreRenderQueue.h"
+#include "OgreRenderQueueSortingGrouping.h"
+#include "OgreRectangle2D.h"
+#include "OgrePixelFormat.h"
+#include "OgreResourceGroupManager.h"
+#include "OgreTexture.h"
+#include "OgreShadowCameraSetup.h"
+#include "OgreShadowTextureManager.h"
+#include "OgreCamera.h"
+#include "OgreInstancedGeometry.h"
+#include "OgreLodListener.h"
+#include "OgreInstanceManager.h"
+#include "OgreRenderSystem.h"
+#include "OgreHeaderPrefix.h"
+#include "OgreNameGenerator.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Scene
+	*  @{
+	*/
+
+    /** Structure for holding a position & orientation pair. */
+    struct ViewPoint
+    {
+        Vector3 position;
+        Quaternion orientation;
+    };
+
+	// Forward declarations
+	class DefaultIntersectionSceneQuery;
+	class DefaultRaySceneQuery;
+	class DefaultSphereSceneQuery;
+	class DefaultAxisAlignedBoxSceneQuery;
+	class CompositorChain;
+
+	/** Structure collecting together information about the visible objects
+	that have been discovered in a scene.
+	*/
+	struct _OgreExport VisibleObjectsBoundsInfo
+	{
+		/// The axis-aligned bounds of the visible objects
+		AxisAlignedBox aabb;
+		/// The axis-aligned bounds of the visible shadow receiver objects
+		AxisAlignedBox receiverAabb;
+		/// The closest a visible object is to the camera
+		Real minDistance;
+		/// The farthest a visible objects is from the camera
+		Real maxDistance;
+		/// The closest a object in the frustum regardless of visibility / shadow caster flags
+		Real minDistanceInFrustum;
+		/// The farthest object in the frustum regardless of visibility / shadow caster flags
+		Real maxDistanceInFrustum;
+
+		VisibleObjectsBoundsInfo();
+		void reset();
+		void merge(const AxisAlignedBox& boxBounds, const Sphere& sphereBounds, 
+			const Camera* cam, bool receiver=true);
+		/** Merge an object that is not being rendered because it's not a shadow caster, 
+			but is a shadow receiver so should be included in the range.
+		*/
+		void mergeNonRenderedButInFrustum(const AxisAlignedBox& boxBounds, 
+			const Sphere& sphereBounds, const Camera* cam);
+
+
+	};
+
+    /** Manages the organisation and rendering of a 'scene' i.e. a collection 
+		of objects and potentially world geometry.
+    @remarks
+		This class defines the interface and the basic behaviour of a 
+		'Scene Manager'. A SceneManager organises the culling and rendering of
+		the scene, in conjunction with the RenderQueue. This class is designed 
+		to be extended through subclassing in order to provide more specialised
+		scene organisation structures for particular needs. The default 
+		SceneManager culls based on a hierarchy of node bounding boxes, other
+		implementations can use an octree (@see OctreeSceneManager), a BSP
+		tree (@see BspSceneManager), and many other options. New SceneManager
+		implementations can be added at runtime by plugins, see 
+		SceneManagerEnumerator for the interfaces for adding new SceneManager
+		types.
+	@par
+		There is a distinction between 'objects' (which subclass MovableObject, 
+		and are movable, discrete objects in the world), and 'world geometry',
+		which is large, generally static geometry. World geometry tends to 
+		influence the SceneManager organisational structure (e.g. lots of indoor
+		static geometry might result in a spatial tree structure) and as such
+		world geometry is generally tied to a given SceneManager implementation,
+		whilst MovableObject instances can be used with any SceneManager.
+		Subclasses are free to define world geometry however they please.
+	@par
+		Multiple SceneManager instances can exist at one time, each one with 
+		a distinct scene. Which SceneManager is used to render a scene is
+		dependent on the Camera, which will always call back the SceneManager
+		which created it to render the scene. 
+     */
+	class _OgreExport SceneManager : public SceneMgtAlloc
+    {
+    public:
+        /// Query type mask which will be used for world geometry @see SceneQuery
+        static uint32 WORLD_GEOMETRY_TYPE_MASK;
+		/// Query type mask which will be used for entities @see SceneQuery
+		static uint32 ENTITY_TYPE_MASK;
+		/// Query type mask which will be used for effects like billboardsets / particle systems @see SceneQuery
+		static uint32 FX_TYPE_MASK;
+		/// Query type mask which will be used for StaticGeometry  @see SceneQuery
+		static uint32 STATICGEOMETRY_TYPE_MASK;
+		/// Query type mask which will be used for lights  @see SceneQuery
+		static uint32 LIGHT_TYPE_MASK;
+		/// Query type mask which will be used for frusta and cameras @see SceneQuery
+		static uint32 FRUSTUM_TYPE_MASK;
+		/// User type mask limit
+		static uint32 USER_TYPE_MASK_LIMIT;
+        /** Comparator for material map, for sorting materials into render order (e.g. transparent last).
+        */
+        struct materialLess
+        {
+            _OgreExport bool operator()(const Material* x, const Material* y) const;
+        };
+        /// Comparator for sorting lights relative to a point
+        struct lightLess
+        {
+            _OgreExport bool operator()(const Light* a, const Light* b) const;
+        };
+
+        /// Describes the stage of rendering when performing complex illumination
+        enum IlluminationRenderStage
+        {
+            /// No special illumination stage
+            IRS_NONE,
+            /// Render to texture stage, used for texture based shadows
+            IRS_RENDER_TO_TEXTURE,
+            /// Render from shadow texture to receivers stage
+            IRS_RENDER_RECEIVER_PASS
+        };
+
+		/** Enumeration of the possible modes allowed for processing the special case
+		render queue list.
+		@see SceneManager::setSpecialCaseRenderQueueMode
+		*/
+		enum SpecialCaseRenderQueueMode
+		{
+			/// Render only the queues in the special case list
+			SCRQM_INCLUDE,
+			/// Render all except the queues in the special case list
+			SCRQM_EXCLUDE
+		};
+
+		struct SkyDomeGenParameters
+		{
+			Real skyDomeCurvature;
+			Real skyDomeTiling;
+			Real skyDomeDistance;
+			int skyDomeXSegments; 
+			int skyDomeYSegments;
+			int skyDomeYSegments_keep;
+		};
+
+		struct SkyPlaneGenParameters
+		{
+			Real skyPlaneScale;
+			Real skyPlaneTiling; 
+			Real skyPlaneBow; 
+			int skyPlaneXSegments; 
+			int skyPlaneYSegments; 
+		};
+
+		struct SkyBoxGenParameters
+		{
+			Real skyBoxDistance;
+		};
+
+		/** Class that allows listening in on the various stages of SceneManager
+			processing, so that custom behaviour can be implemented from outside.
+		*/
+		class Listener
+		{
+		public:
+			Listener() {}
+			virtual ~Listener() {}
+
+			/** Called prior to updating the scene graph in this SceneManager.
+			@remarks
+				This is called before updating the scene graph for a camera.
+			@param source The SceneManager instance raising this event.
+			@param camera The camera being updated.
+			*/
+			virtual void preUpdateSceneGraph(SceneManager* source, Camera* camera)
+                        { (void)source; (void)camera; }
+
+			/** Called after updating the scene graph in this SceneManager.
+			@remarks
+				This is called after updating the scene graph for a camera.
+			@param source The SceneManager instance raising this event.
+			@param camera The camera being updated.
+			*/
+			virtual void postUpdateSceneGraph(SceneManager* source, Camera* camera)
+                        { (void)source; (void)camera; }
+
+			/** Called prior to searching for visible objects in this SceneManager.
+			@remarks
+				Note that the render queue at this stage will be full of the last
+				render's contents and will be cleared after this method is called.
+			@param source The SceneManager instance raising this event.
+			@param irs The stage of illumination being dealt with. IRS_NONE for 
+				a regular render, IRS_RENDER_TO_TEXTURE for a shadow caster render.
+			@param v The viewport being updated. You can get the camera from here.
+			*/
+			virtual void preFindVisibleObjects(SceneManager* source, 
+				IlluminationRenderStage irs, Viewport* v)
+                        { (void)source; (void)irs; (void)v; }
+
+			/** Called after searching for visible objects in this SceneManager.
+			@remarks
+				Note that the render queue at this stage will be full of the current
+				scenes contents, ready for rendering. You may manually add renderables
+				to this queue if you wish.
+			@param source The SceneManager instance raising this event.
+			@param irs The stage of illumination being dealt with. IRS_NONE for 
+				a regular render, IRS_RENDER_TO_TEXTURE for a shadow caster render.
+			@param v The viewport being updated. You can get the camera from here.
+			*/
+			virtual void postFindVisibleObjects(SceneManager* source, 
+				IlluminationRenderStage irs, Viewport* v)
+                        { (void)source; (void)irs; (void)v; }
+
+			/** Event raised after all shadow textures have been rendered into for 
+				all queues / targets but before any other geometry has been rendered
+				(including main scene geometry and any additional shadow receiver 
+				passes). 
+			@remarks
+				This callback is useful for those that wish to perform some 
+				additional processing on shadow textures before they are used to 
+				render shadows. For example you could perform some filtering by 
+				rendering the existing shadow textures into another alternative 
+				shadow texture with a shader.]
+			@note
+				This event will only be fired when texture shadows are in use.
+			@param numberOfShadowTextures The number of shadow textures in use
+			*/
+			virtual void shadowTexturesUpdated(size_t numberOfShadowTextures)
+                        { (void)numberOfShadowTextures; }
+
+			/** This event occurs just before the view & projection matrices are
+		 		set for rendering into a shadow texture.
+			@remarks
+				You can use this event hook to perform some custom processing,
+				such as altering the camera being used for rendering the light's
+				view, including setting custom view & projection matrices if you
+				want to perform an advanced shadow technique.
+			@note
+				This event will only be fired when texture shadows are in use.
+			@param light Pointer to the light for which shadows are being rendered
+			@param camera Pointer to the camera being used to render
+			@param iteration For lights that use multiple shadow textures, the iteration number
+			*/
+			virtual void shadowTextureCasterPreViewProj(Light* light, 
+				Camera* camera, size_t iteration)
+                        { (void)light; (void)camera; (void)iteration; }
+
+			/** This event occurs just before the view & projection matrices are
+		 		set for re-rendering a shadow receiver.
+			@remarks
+				You can use this event hook to perform some custom processing,
+				such as altering the projection frustum being used for rendering 
+				the shadow onto the receiver to perform an advanced shadow 
+				technique.
+			@note
+				This event will only be fired when texture shadows are in use.
+			@param light Pointer to the light for which shadows are being rendered
+			@param frustum Pointer to the projection frustum being used to project
+				the shadow texture
+			*/
+			virtual void shadowTextureReceiverPreViewProj(Light* light, 
+				Frustum* frustum)
+                        { (void)light; (void)frustum; }
+
+			/** Hook to allow the listener to override the ordering of lights for
+				the entire frustum.
+			@remarks
+				Whilst ordinarily lights are sorted per rendered object 
+				(@see MovableObject::queryLights), texture shadows adds another issue
+				in that, given there is a finite number of shadow textures, we must
+				choose which lights to render texture shadows from based on the entire
+				frustum. These lights should always be listed first in every objects
+				own list, followed by any other lights which will not cast texture 
+				shadows (either because they have shadow casting off, or there aren't
+				enough shadow textures to service them).
+			@par
+				This hook allows you to override the detailed ordering of the lights
+				per frustum. The default ordering is shadow casters first (which you 
+				must also respect if you override this method), and ordered
+				by distance from the camera within those 2 groups. Obviously the closest
+				lights with shadow casting enabled will be listed first. Only lights 
+				within the range of the frustum will be in the list.
+			@param lightList The list of lights within range of the frustum which you
+				may sort.
+			@return true if you sorted the list, false otherwise.
+			*/
+			virtual bool sortLightsAffectingFrustum(LightList& lightList)
+                        { (void)lightList; return false; }
+
+			/** Event notifying the listener of the SceneManager's destruction. */
+			virtual void sceneManagerDestroyed(SceneManager* source)
+                        { (void)source; }
+		};
+
+		/** Inner helper class to implement the visitor pattern for rendering objects
+			in a queue. 
+		*/
+		class _OgreExport SceneMgrQueuedRenderableVisitor : public QueuedRenderableVisitor
+		{
+		protected:
+			/// Pass that was actually used at the grouping level
+			const Pass* mUsedPass;
+		public:
+			SceneMgrQueuedRenderableVisitor() 
+				:transparentShadowCastersMode(false) {}
+			~SceneMgrQueuedRenderableVisitor() {}
+			void visit(Renderable* r);
+			bool visit(const Pass* p);
+			void visit(RenderablePass* rp);
+
+			/// Target SM to send renderables to
+			SceneManager* targetSceneMgr;
+			/// Are we in transparent shadow caster mode?
+			bool transparentShadowCastersMode;
+			/// Automatic light handling?
+			bool autoLights;
+			/// Manual light list
+			const LightList* manualLightList;
+			/// Scissoring if requested?
+			bool scissoring;
+
+		};
+		/// Allow visitor helper to access protected methods
+		friend class SceneMgrQueuedRenderableVisitor;
+
+    protected:
+
+        /// Subclasses can override this to ensure their specialised SceneNode is used.
+        virtual SceneNode* createSceneNodeImpl(void);
+        /// Subclasses can override this to ensure their specialised SceneNode is used.
+        virtual SceneNode* createSceneNodeImpl(const String& name);
+
+		/// Instance name
+		String mName;
+
+        /// Queue of objects for rendering
+        RenderQueue* mRenderQueue;
+		bool mLastRenderQueueInvocationCustom;
+
+        /// Current ambient light, cached for RenderSystem
+        ColourValue mAmbientLight;
+
+        /// The rendering system to send the scene to
+        RenderSystem *mDestRenderSystem;
+
+        typedef map<String, Camera* >::type CameraList;
+
+        /** Central list of cameras - for easy memory management and lookup.
+        */
+        CameraList mCameras;
+
+		typedef map<String, StaticGeometry* >::type StaticGeometryList;
+		StaticGeometryList mStaticGeometryList;
+		typedef map<String, InstancedGeometry* >::type InstancedGeometryList;
+		InstancedGeometryList mInstancedGeometryList;
+
+		typedef map<String, InstanceManager*>::type InstanceManagerMap;
+		InstanceManagerMap	mInstanceManagerMap;
+
+        typedef map<String, SceneNode*>::type SceneNodeList;
+
+        /** Central list of SceneNodes - for easy memory management.
+            @note
+                Note that this list is used only for memory management; the structure of the scene
+                is held using the hierarchy of SceneNodes starting with the root node. However you
+                can look up nodes this way.
+        */
+        SceneNodeList mSceneNodes;
+
+        /// Camera in progress
+        Camera* mCameraInProgress;
+        /// Current Viewport
+        Viewport* mCurrentViewport;
+
+        /// Root scene node
+        SceneNode* mSceneRoot;
+
+        /// Autotracking scene nodes
+        typedef set<SceneNode*>::type AutoTrackingSceneNodes;
+        AutoTrackingSceneNodes mAutoTrackingSceneNodes;
+
+        // Sky params
+        // Sky plane
+        Entity* mSkyPlaneEntity;
+        Entity* mSkyDomeEntity[5];
+        ManualObject* mSkyBoxObj;
+
+        SceneNode* mSkyPlaneNode;
+        SceneNode* mSkyDomeNode;
+        SceneNode* mSkyBoxNode;
+
+        // Sky plane
+        bool mSkyPlaneEnabled;
+        uint8 mSkyPlaneRenderQueue;
+        Plane mSkyPlane;
+        SkyPlaneGenParameters mSkyPlaneGenParameters;
+        // Sky box
+        bool mSkyBoxEnabled;
+        uint8 mSkyBoxRenderQueue;
+        Quaternion mSkyBoxOrientation;
+        SkyBoxGenParameters mSkyBoxGenParameters;
+        // Sky dome
+        bool mSkyDomeEnabled;
+        uint8 mSkyDomeRenderQueue;
+        Quaternion mSkyDomeOrientation;
+        SkyDomeGenParameters mSkyDomeGenParameters;
+
+        // Fog
+        FogMode mFogMode;
+        ColourValue mFogColour;
+        Real mFogStart;
+        Real mFogEnd;
+        Real mFogDensity;
+
+		typedef set<uint8>::type SpecialCaseRenderQueueList;
+		SpecialCaseRenderQueueList mSpecialCaseQueueList;
+		SpecialCaseRenderQueueMode mSpecialCaseQueueMode;
+		uint8 mWorldGeometryRenderQueue;
+		
+		unsigned long mLastFrameNumber;
+		Matrix4 mTempXform[256];
+		bool mResetIdentityView;
+		bool mResetIdentityProj;
+
+		bool mNormaliseNormalsOnScale;
+		bool mFlipCullingOnNegativeScale;
+		CullingMode mPassCullingMode;
+
+	protected:
+
+		/** Visible objects bounding box list.
+			@remarks
+				Holds an ABB for each camera that contains the physical extends of the visible
+				scene elements by each camera. The map is crucial for shadow algorithms which
+				have a focus step to limit the shadow sample distribution to only valid visible
+				scene elements.
+		*/
+		typedef map< const Camera*, VisibleObjectsBoundsInfo>::type CamVisibleObjectsMap;
+		CamVisibleObjectsMap mCamVisibleObjectsMap; 
+
+		/** ShadowCamera to light mapping */
+		typedef map< const Camera*, const Light* >::type ShadowCamLightMapping;
+		ShadowCamLightMapping mShadowCamLightMapping;
+
+		/// Array defining shadow count per light type.
+		size_t mShadowTextureCountPerType[3];
+
+		/// Array defining shadow texture index in light list.
+		vector<size_t>::type mShadowTextureIndexLightList;
+
+        /// Cached light information, used to tracking light's changes
+        struct _OgreExport LightInfo
+        {
+            Light* light;       /// Just a pointer for comparison, the light might destroyed for some reason
+            int type;           /// Use int instead of Light::LightTypes to avoid header file dependence
+            Real range;         /// Sets to zero if directional light
+            Vector3 position;   /// Sets to zero if directional light
+			uint32 lightMask;   /// Light mask
+
+            bool operator== (const LightInfo& rhs) const
+            {
+                return light == rhs.light && type == rhs.type &&
+                    range == rhs.range && position == rhs.position && lightMask == rhs.lightMask;
+            }
+
+            bool operator!= (const LightInfo& rhs) const
+            {
+                return !(*this == rhs);
+            }
+        };
+
+        typedef vector<LightInfo>::type LightInfoList;
+
+        LightList mLightsAffectingFrustum;
+        LightInfoList mCachedLightInfos;
+		LightInfoList mTestLightInfos; // potentially new list
+        ulong mLightsDirtyCounter;
+		LightList mShadowTextureCurrentCasterLightList;
+
+		typedef map<String, MovableObject*>::type MovableObjectMap;
+		/// Simple structure to hold MovableObject map and a mutex to go with it.
+		struct MovableObjectCollection
+		{
+                    MovableObjectMap map;
+                    OGRE_MUTEX(mutex);
+		};
+		typedef map<String, MovableObjectCollection*>::type MovableObjectCollectionMap;
+		MovableObjectCollectionMap mMovableObjectCollectionMap;
+		NameGenerator mMovableNameGenerator;
+		/** Gets the movable object collection for the given type name.
+		@remarks
+			This method create new collection if the collection does not exist.
+		*/
+		MovableObjectCollection* getMovableObjectCollection(const String& typeName);
+		/** Gets the movable object collection for the given type name.
+		@remarks
+			This method throw exception if the collection does not exist.
+		*/
+		const MovableObjectCollection* getMovableObjectCollection(const String& typeName) const;
+		/// Mutex over the collection of MovableObject types
+		OGRE_MUTEX(mMovableObjectCollectionMapMutex);
+
+        /** Internal method for initialising the render queue.
+        @remarks
+            Subclasses can use this to install their own RenderQueue implementation.
+        */
+        virtual void initRenderQueue(void);
+        /// A pass designed to let us render shadow colour on white for texture shadows
+        Pass* mShadowCasterPlainBlackPass;
+        /// A pass designed to let us render shadow receivers for texture shadows
+        Pass* mShadowReceiverPass;
+        /** Internal method for turning a regular pass into a shadow caster pass.
+        @remarks
+            This is only used for texture shadows, basically we're trying to
+            ensure that objects are rendered solid black.
+            This method will usually return the standard solid black pass for
+            all fixed function passes, but will merge in a vertex program
+            and fudge the AutoParamDataSource to set black lighting for
+            passes with vertex programs. 
+        */
+        virtual const Pass* deriveShadowCasterPass(const Pass* pass);
+        /** Internal method for turning a regular pass into a shadow receiver pass.
+        @remarks
+        This is only used for texture shadows, basically we're trying to
+        ensure that objects are rendered with a projective texture.
+        This method will usually return a standard single-texture pass for
+        all fixed function passes, but will merge in a vertex program
+        for passes with vertex programs. 
+        */
+        virtual const Pass* deriveShadowReceiverPass(const Pass* pass);
+    
+        /** Internal method to validate whether a Pass should be allowed to render.
+        @remarks
+            Called just before a pass is about to be used for rendering a group to
+            allow the SceneManager to omit it if required. A return value of false
+            skips this pass. 
+        */
+        virtual bool validatePassForRendering(const Pass* pass);
+
+        /** Internal method to validate whether a Renderable should be allowed to render.
+        @remarks
+        Called just before a pass is about to be used for rendering a Renderable to
+        allow the SceneManager to omit it if required. A return value of false
+        skips it. 
+        */
+        virtual bool validateRenderableForRendering(const Pass* pass, const Renderable* rend);
+
+        enum BoxPlane
+        {
+            BP_FRONT = 0,
+            BP_BACK = 1,
+            BP_LEFT = 2,
+            BP_RIGHT = 3,
+            BP_UP = 4,
+            BP_DOWN = 5
+        };
+
+        /* Internal utility method for creating the planes of a skybox.
+        */
+        virtual MeshPtr createSkyboxPlane(
+            BoxPlane bp,
+            Real distance,
+            const Quaternion& orientation,
+            const String& groupName);
+
+        /* Internal utility method for creating the planes of a skydome.
+        */
+        virtual MeshPtr createSkydomePlane(
+            BoxPlane bp,
+            Real curvature, Real tiling, Real distance,
+            const Quaternion& orientation,
+            int xsegments, int ysegments, int ySegmentsToKeep, 
+            const String& groupName);
+
+        /// Flag indicating whether SceneNodes will be rendered as a set of 3 axes
+        bool mDisplayNodes;
+
+        /// Storage of animations, lookup by name
+        typedef map<String, Animation*>::type AnimationList;
+        AnimationList mAnimationsList;
+        OGRE_MUTEX(mAnimationsListMutex);
+        AnimationStateSet mAnimationStates;
+
+
+        /** Internal method used by _renderSingleObject to deal with renderables
+            which override the camera's own view / projection materices. */
+        virtual void useRenderableViewProjMode(const Renderable* pRend, bool fixedFunction);
+        
+        /** Internal method used by _renderSingleObject to deal with renderables
+            which override the camera's own view / projection matrices. */
+        virtual void resetViewProjMode(bool fixedFunction);
+
+        typedef vector<RenderQueueListener*>::type RenderQueueListenerList;
+        RenderQueueListenerList mRenderQueueListeners;
+
+		typedef vector<RenderObjectListener*>::type RenderObjectListenerList;
+		RenderObjectListenerList mRenderObjectListeners;
+        typedef vector<Listener*>::type ListenerList;
+        ListenerList mListeners;
+		/// Internal method for firing the queue start event
+		virtual void firePreRenderQueues();
+		/// Internal method for firing the queue end event
+		virtual void firePostRenderQueues();
+        /// Internal method for firing the queue start event, returns true if queue is to be skipped
+        virtual bool fireRenderQueueStarted(uint8 id, const String& invocation);
+        /// Internal method for firing the queue end event, returns true if queue is to be repeated
+        virtual bool fireRenderQueueEnded(uint8 id, const String& invocation);
+		/// Internal method for firing when rendering a single object.
+		virtual void fireRenderSingleObject(Renderable* rend, const Pass* pass, const AutoParamDataSource* source, 
+			const LightList* pLightList, bool suppressRenderStateChanges);
+
+		/// Internal method for firing the texture shadows updated event
+        virtual void fireShadowTexturesUpdated(size_t numberOfShadowTextures);
+		/// Internal method for firing the pre caster texture shadows event
+        virtual void fireShadowTexturesPreCaster(Light* light, Camera* camera, size_t iteration);
+		/// Internal method for firing the pre receiver texture shadows event
+        virtual void fireShadowTexturesPreReceiver(Light* light, Frustum* f);
+		/// Internal method for firing pre update scene graph event
+		virtual void firePreUpdateSceneGraph(Camera* camera);
+		/// Internal method for firing post update scene graph event
+		virtual void firePostUpdateSceneGraph(Camera* camera);
+		/// Internal method for firing find visible objects event
+		virtual void firePreFindVisibleObjects(Viewport* v);
+		/// Internal method for firing find visible objects event
+		virtual void firePostFindVisibleObjects(Viewport* v);
+		/// Internal method for firing destruction event
+		virtual void fireSceneManagerDestroyed();
+        /** Internal method for setting the destination viewport for the next render. */
+        virtual void setViewport(Viewport *vp);
+
+		/** Flag that indicates if all of the scene node's bounding boxes should be shown as a wireframe. */
+		bool mShowBoundingBoxes;      
+
+		/** Internal method for rendering all objects using the default queue sequence. */
+		virtual void renderVisibleObjectsDefaultSequence(void);
+		/** Internal method for rendering all objects using a custom queue sequence. */
+		virtual void renderVisibleObjectsCustomSequence(RenderQueueInvocationSequence* s);
+		/** Internal method for preparing the render queue for use with each render. */
+		virtual void prepareRenderQueue(void);
+
+
+        /** Internal utility method for rendering a single object. 
+        @remarks
+            Assumes that the pass has already been set up.
+        @param rend The renderable to issue to the pipeline
+        @param pass The pass which is being used
+		@param lightScissoringClipping If true, passes that have the getLightScissorEnabled
+			and/or getLightClipPlanesEnabled flags will cause calculation and setting of 
+			scissor rectangle and user clip planes. 
+        @param doLightIteration If true, this method will issue the renderable to
+            the pipeline possibly multiple times, if the pass indicates it should be
+            done once per light
+        @param manualLightList Only applicable if doLightIteration is false, this
+            method allows you to pass in a previously determined set of lights
+            which will be used for a single render of this object.
+        */
+        virtual void renderSingleObject(Renderable* rend, const Pass* pass, 
+			bool lightScissoringClipping, bool doLightIteration, const LightList* manualLightList = 0);
+
+		/** Internal method for creating the AutoParamDataSource instance. */
+		virtual AutoParamDataSource* createAutoParamDataSource(void) const
+		{
+			return OGRE_NEW AutoParamDataSource();
+		}
+
+        /// Utility class for calculating automatic parameters for gpu programs
+        AutoParamDataSource* mAutoParamDataSource;
+
+		CompositorChain* mActiveCompositorChain;
+		bool mLateMaterialResolving;
+
+        ShadowTechnique mShadowTechnique;
+        bool mDebugShadows;
+        ColourValue mShadowColour;
+        Pass* mShadowDebugPass;
+        Pass* mShadowStencilPass;
+        Pass* mShadowModulativePass;
+		bool mShadowMaterialInitDone;
+        HardwareIndexBufferSharedPtr mShadowIndexBuffer;
+		size_t mShadowIndexBufferSize;
+		size_t mShadowIndexBufferUsedSize;
+        Rectangle2D* mFullScreenQuad;
+        Real mShadowDirLightExtrudeDist;
+        IlluminationRenderStage mIlluminationStage;
+		ShadowTextureConfigList mShadowTextureConfigList;
+		bool mShadowTextureConfigDirty;
+        ShadowTextureList mShadowTextures;
+		TexturePtr mNullShadowTexture;
+		typedef vector<Camera*>::type ShadowTextureCameraList;
+		ShadowTextureCameraList mShadowTextureCameras;
+        Texture* mCurrentShadowTexture;
+		bool mShadowUseInfiniteFarPlane;
+		bool mShadowCasterRenderBackFaces;
+		bool mShadowAdditiveLightClip;
+		/// Struct for caching light clipping information for re-use in a frame
+		struct LightClippingInfo
+		{
+			RealRect scissorRect;
+			PlaneList clipPlanes;
+			bool scissorValid;
+			unsigned long clipPlanesValid;
+			LightClippingInfo() : scissorValid(false), clipPlanesValid(false) {}
+
+		};
+		typedef map<Light*, LightClippingInfo>::type LightClippingInfoMap;
+		LightClippingInfoMap mLightClippingInfoMap;
+		unsigned long mLightClippingInfoMapFrameNumber;
+
+		/// default shadow camera setup
+		ShadowCameraSetupPtr mDefaultShadowCameraSetup;
+
+		/** Default sorting routine which sorts lights which cast shadows
+			to the front of a list, sub-sorting by distance.
+		@remarks
+			Since shadow textures are generated from lights based on the
+			frustum rather than individual objects, a shadow and camera-wise sort is
+			required to pick the best lights near the start of the list. Up to 
+			the number of shadow textures will be generated from this.
+		*/
+		struct lightsForShadowTextureLess
+		{
+			_OgreExport bool operator()(const Light* l1, const Light* l2) const;
+		};
+
+
+        /** Internal method for locating a list of lights which could be affecting the frustum. 
+        @remarks
+            Custom scene managers are encouraged to override this method to make use of their
+            scene partitioning scheme to more efficiently locate lights, and to eliminate lights
+            which may be occluded by word geometry.
+        */
+        virtual void findLightsAffectingFrustum(const Camera* camera);
+        /// Internal method for setting up materials for shadows
+        virtual void initShadowVolumeMaterials(void);
+        /// Internal method for creating shadow textures (texture-based shadows)
+        virtual void ensureShadowTexturesCreated();
+        /// Internal method for destroying shadow textures (texture-based shadows)
+        virtual void destroyShadowTextures(void);
+
+		typedef vector<InstanceManager*>::type		InstanceManagerVec;
+		InstanceManagerVec mDirtyInstanceManagers;
+		InstanceManagerVec mDirtyInstanceMgrsTmp;
+
+		/** Updates all instance managaers with dirty instance batches. @see _addDirtyInstanceManager */
+		void updateDirtyInstanceManagers(void);
+        
+	public:
+		/// Method for preparing shadow textures ready for use in a regular render
+		/// Do not call manually unless before frame start or rendering is paused
+		/// If lightList is not supplied, will render all lights in frustum
+        virtual void prepareShadowTextures(Camera* cam, Viewport* vp, const LightList* lightList = 0);
+
+		//A render context, used to store internal data for pausing/resuming rendering
+		struct RenderContext
+		{
+			RenderQueue* renderQueue;	
+			Viewport* viewport;
+			Camera* camera;
+			CompositorChain* activeChain;
+			RenderSystem::RenderSystemContext* rsContext;
+		};
+
+		/** Pause rendering of the frame. This has to be called when inside a renderScene call
+			(Usually using a listener of some sort)
+		*/
+		virtual RenderContext* _pauseRendering();
+		/** Resume rendering of the frame. This has to be called after a _pauseRendering call
+		@param context The rendring context, as returned by the _pauseRendering call
+		*/
+		virtual void _resumeRendering(RenderContext* context);
+
+	protected:
+        /** Internal method for rendering all the objects for a given light into the 
+            stencil buffer.
+        @param light The light source
+        @param cam The camera being viewed from
+		@param calcScissor Whether the method should set up any scissor state, or
+			false if that's already been done
+        */
+        virtual void renderShadowVolumesToStencil(const Light* light, const Camera* cam, 
+			bool calcScissor);
+        /** Internal utility method for setting stencil state for rendering shadow volumes. 
+        @param secondpass Is this the second pass?
+        @param zfail Should we be using the zfail method?
+        @param twosided Should we use a 2-sided stencil?
+        */
+        virtual void setShadowVolumeStencilState(bool secondpass, bool zfail, bool twosided);
+        /** Render a set of shadow renderables. */
+        void renderShadowVolumeObjects(ShadowCaster::ShadowRenderableListIterator iShadowRenderables,
+            Pass* pass, const LightList *manualLightList, unsigned long flags,
+            bool secondpass, bool zfail, bool twosided);
+        typedef vector<ShadowCaster*>::type ShadowCasterList;
+        ShadowCasterList mShadowCasterList;
+        SphereSceneQuery* mShadowCasterSphereQuery;
+        AxisAlignedBoxSceneQuery* mShadowCasterAABBQuery;
+        Real mDefaultShadowFarDist;
+        Real mDefaultShadowFarDistSquared;
+        Real mShadowTextureOffset; /// Proportion of texture offset in view direction e.g. 0.4
+        Real mShadowTextureFadeStart; /// As a proportion e.g. 0.6
+        Real mShadowTextureFadeEnd; /// As a proportion e.g. 0.9
+		bool mShadowTextureSelfShadow;
+		Pass* mShadowTextureCustomCasterPass;
+		Pass* mShadowTextureCustomReceiverPass;
+		String mShadowTextureCustomCasterVertexProgram;
+		String mShadowTextureCustomCasterFragmentProgram;
+		String mShadowTextureCustomReceiverVertexProgram;
+		String mShadowTextureCustomReceiverFragmentProgram;
+		GpuProgramParametersSharedPtr mShadowTextureCustomCasterVPParams;
+		GpuProgramParametersSharedPtr mShadowTextureCustomCasterFPParams;
+		GpuProgramParametersSharedPtr mShadowTextureCustomReceiverVPParams;
+		GpuProgramParametersSharedPtr mShadowTextureCustomReceiverFPParams;
+
+		/// Visibility mask used to show / hide objects
+		uint32 mVisibilityMask;
+		bool mFindVisibleObjects;
+
+		/// Suppress render state changes?
+		bool mSuppressRenderStateChanges;
+		/// Suppress shadows?
+		bool mSuppressShadows;
+
+
+        GpuProgramParametersSharedPtr mInfiniteExtrusionParams;
+        GpuProgramParametersSharedPtr mFiniteExtrusionParams;
+
+        /// Inner class to use as callback for shadow caster scene query
+        class _OgreExport ShadowCasterSceneQueryListener : public SceneQueryListener, public SceneMgtAlloc
+        {
+        protected:
+			SceneManager* mSceneMgr;
+            ShadowCasterList* mCasterList;
+            bool mIsLightInFrustum;
+            const PlaneBoundedVolumeList* mLightClipVolumeList;
+            const Camera* mCamera;
+            const Light* mLight;
+            Real mFarDistSquared;
+        public:
+            ShadowCasterSceneQueryListener(SceneManager* sm) : mSceneMgr(sm),
+				mCasterList(0), mIsLightInFrustum(false), mLightClipVolumeList(0), 
+                mCamera(0) {}
+            // Prepare the listener for use with a set of parameters  
+            void prepare(bool lightInFrustum, 
+                const PlaneBoundedVolumeList* lightClipVolumes, 
+                const Light* light, const Camera* cam, ShadowCasterList* casterList, 
+                Real farDistSquared) 
+            {
+                mCasterList = casterList;
+                mIsLightInFrustum = lightInFrustum;
+                mLightClipVolumeList = lightClipVolumes;
+                mCamera = cam;
+                mLight = light;
+                mFarDistSquared = farDistSquared;
+            }
+            bool queryResult(MovableObject* object);
+            bool queryResult(SceneQuery::WorldFragment* fragment);
+        };
+
+        ShadowCasterSceneQueryListener* mShadowCasterQueryListener;
+
+        /** Internal method for locating a list of shadow casters which 
+            could be affecting the frustum for a given light. 
+        @remarks
+            Custom scene managers are encouraged to override this method to add optimisations, 
+            and to add their own custom shadow casters (perhaps for world geometry)
+        */
+        virtual const ShadowCasterList& findShadowCastersForLight(const Light* light, 
+            const Camera* camera);
+        /** Render a group in the ordinary way */
+		virtual void renderBasicQueueGroupObjects(RenderQueueGroup* pGroup, 
+			QueuedRenderableCollection::OrganisationMode om);
+		/** Render a group with the added complexity of additive stencil shadows. */
+		virtual void renderAdditiveStencilShadowedQueueGroupObjects(RenderQueueGroup* group, 
+			QueuedRenderableCollection::OrganisationMode om);
+		/** Render a group with the added complexity of modulative stencil shadows. */
+		virtual void renderModulativeStencilShadowedQueueGroupObjects(RenderQueueGroup* group, 
+			QueuedRenderableCollection::OrganisationMode om);
+        /** Render a group rendering only shadow casters. */
+		virtual void renderTextureShadowCasterQueueGroupObjects(RenderQueueGroup* group, 
+			QueuedRenderableCollection::OrganisationMode om);
+        /** Render a group rendering only shadow receivers. */
+		virtual void renderTextureShadowReceiverQueueGroupObjects(RenderQueueGroup* group, 
+			QueuedRenderableCollection::OrganisationMode om);
+        /** Render a group with the added complexity of modulative texture shadows. */
+		virtual void renderModulativeTextureShadowedQueueGroupObjects(RenderQueueGroup* group, 
+			QueuedRenderableCollection::OrganisationMode om);
+
+		/** Render a group with additive texture shadows. */
+		virtual void renderAdditiveTextureShadowedQueueGroupObjects(RenderQueueGroup* group, 
+			QueuedRenderableCollection::OrganisationMode om);
+		/** Render a set of objects, see renderSingleObject for param definitions */
+		virtual void renderObjects(const QueuedRenderableCollection& objs, 
+			QueuedRenderableCollection::OrganisationMode om, bool lightScissoringClipping,
+            bool doLightIteration, const LightList* manualLightList = 0);
+		/** Render those objects in the transparent pass list which have shadow casting forced on
+		@remarks
+			This function is intended to be used to render the shadows of transparent objects which have
+			transparency_casts_shadows set to 'on' in their material
+		*/
+		virtual void renderTransparentShadowCasterObjects(const QueuedRenderableCollection& objs, 
+			QueuedRenderableCollection::OrganisationMode om, bool lightScissoringClipping,
+			bool doLightIteration, const LightList* manualLightList = 0);
+
+		/** Update the state of the global render queue splitting based on a shadow
+		option change. */
+		virtual void updateRenderQueueSplitOptions(void);
+		/** Update the state of the render queue group splitting based on a shadow
+		option change. */
+		virtual void updateRenderQueueGroupSplitOptions(RenderQueueGroup* group, 
+			bool suppressShadows, bool suppressRenderState);
+
+		/// Set up a scissor rectangle from a group of lights
+		virtual ClipResult buildAndSetScissor(const LightList& ll, const Camera* cam);
+		/// Update a scissor rectangle from a single light
+		virtual void buildScissor(const Light* l, const Camera* cam, RealRect& rect);
+		virtual void resetScissor();
+		/// Build a set of user clip planes from a single non-directional light
+		virtual ClipResult buildAndSetLightClip(const LightList& ll);
+		virtual void buildLightClip(const Light* l, PlaneList& planes);
+		virtual void resetLightClip();
+		virtual void checkCachedLightClippingInfo();
+
+		/// The active renderable visitor class - subclasses could override this
+		SceneMgrQueuedRenderableVisitor* mActiveQueuedRenderableVisitor;
+		/// Storage for default renderable visitor
+		SceneMgrQueuedRenderableVisitor mDefaultQueuedRenderableVisitor;
+
+		/// Whether to use camera-relative rendering
+		bool mCameraRelativeRendering;
+		Matrix4 mCachedViewMatrix;
+		Vector3 mCameraRelativePosition;
+
+		/// Last light sets
+		uint32 mLastLightHash;
+		unsigned short mLastLightLimit;
+		uint32 mLastLightHashGpuProgram;
+		/// Gpu params that need rebinding (mask of GpuParamVariability)
+		uint16 mGpuParamsDirty;
+
+		virtual void useLights(const LightList& lights, unsigned short limit);
+		virtual void setViewMatrix(const Matrix4& m);
+		virtual void useLightsGpuProgram(const Pass* pass, const LightList* lights);
+		virtual void bindGpuProgram(GpuProgram* prog);
+		virtual void updateGpuProgramParameters(const Pass* p);
+
+
+
+
+
+
+
+
+        /// Set of registered LOD listeners
+        typedef set<LodListener*>::type LodListenerSet;
+        LodListenerSet mLodListeners;
+
+        /// List of movable object LOD changed events
+		typedef vector<MovableObjectLodChangedEvent>::type MovableObjectLodChangedEventList;
+        MovableObjectLodChangedEventList mMovableObjectLodChangedEvents;
+
+        /// List of entity mesh LOD changed events
+        typedef vector<EntityMeshLodChangedEvent>::type EntityMeshLodChangedEventList;
+        EntityMeshLodChangedEventList mEntityMeshLodChangedEvents;
+
+        /// List of entity material LOD changed events
+        typedef vector<EntityMaterialLodChangedEvent>::type EntityMaterialLodChangedEventList;
+        EntityMaterialLodChangedEventList mEntityMaterialLodChangedEvents;
+
+    public:
+        /** Constructor.
+        */
+        SceneManager(const String& instanceName);
+
+        /** Default destructor.
+        */
+        virtual ~SceneManager();
+
+
+		/** Mutex to protect the scene graph from simultaneous access from
+			multiple threads.
+		@remarks
+			If you are updating the scene in a separate thread from the rendering
+			thread, then you should lock this mutex before making any changes to 
+			the scene graph - that means creating, modifying or deleting a
+			scene node, or attaching / detaching objects. It is <b>your</b> 
+			responsibility to take out this lock, the detail methods on the nodes
+			will not do it for you (for the reasons discussed below).
+		@par
+			Note that locking this mutex will prevent the scene being rendered until 
+			it is unlocked again. Therefore you should do this sparingly. Try
+			to create any objects you need separately and fully prepare them
+			before doing all your scene graph work in one go, thus keeping this
+			lock for the shortest time possible.
+		@note
+			A single global lock is used rather than a per-node lock since 
+			it keeps the number of locks required during rendering down to a 
+			minimum. Obtaining a lock, even if there is no contention, is not free
+			so for performance it is good to do it as little as possible. 
+			Since modifying the scene in a separate thread is a fairly
+			rare occurrence (relative to rendering), it is better to keep the 
+			locking required during rendering lower than to make update locks
+			more granular.
+		*/
+        OGRE_MUTEX(sceneGraphMutex);
+
+		/** Return the instance name of this SceneManager. */
+		const String& getName(void) const { return mName; }
+
+		/** Retrieve the type name of this scene manager.
+		@remarks
+			This method has to be implemented by subclasses. It should
+			return the type name of this SceneManager which agrees with 
+			the type name of the SceneManagerFactory which created it.
+		*/
+		virtual const String& getTypeName(void) const = 0;
+
+        /** Creates a camera to be managed by this scene manager.
+            @remarks
+                This camera must be added to the scene at a later time using
+                the attachObject method of the SceneNode class.
+            @param
+                name Name to give the new camera.
+        */
+        virtual Camera* createCamera(const String& name);
+
+        /** Retrieves a pointer to the named camera.
+		@note Throws an exception if the named instance does not exist
+        */
+        virtual Camera* getCamera(const String& name) const;
+
+		/** Returns whether a camera with the given name exists.
+		*/
+		virtual bool hasCamera(const String& name) const;
+
+        /** Removes a camera from the scene.
+            @remarks
+                This method removes a previously added camera from the scene.
+                The camera is deleted so the caller must ensure no references
+                to it's previous instance (e.g. in a SceneNode) are used.
+            @param
+                cam Pointer to the camera to remove
+        */
+        virtual void destroyCamera(Camera *cam);
+
+        /** Removes a camera from the scene.
+            @remarks
+                This method removes an camera from the scene based on the
+                camera's name rather than a pointer.
+        */
+        virtual void destroyCamera(const String& name);
+
+        /** Removes (and destroys) all cameras from the scene.
+            @remarks
+                Some cameras are internal created to dealing with texture shadow,
+                their aren't supposed to destroy outside. So, while you are using
+                texture shadow, don't call this method, or you can set the shadow
+                technique other than texture-based, which will destroy all internal
+                created shadow cameras and textures.
+        */
+        virtual void destroyAllCameras(void);
+
+        /** Creates a light for use in the scene.
+            @remarks
+                Lights can either be in a fixed position and independent of the
+                scene graph, or they can be attached to SceneNodes so they derive
+                their position from the parent node. Either way, they are created
+                using this method so that the SceneManager manages their
+                existence.
+            @param
+                name The name of the new light, to identify it later.
+        */
+        virtual Light* createLight(const String& name);
+
+		/** Creates a light with a generated name. */
+		virtual Light* createLight();
+
+        /** Returns a pointer to the named Light which has previously been added to the scene.
+		@note Throws an exception if the named instance does not exist
+        */
+        virtual Light* getLight(const String& name) const;
+
+		/** Returns whether a light with the given name exists.
+		*/
+		virtual bool hasLight(const String& name) const;
+
+		/** Retrieve a set of clipping planes for a given light. 
+		*/
+		virtual const PlaneList& getLightClippingPlanes(Light* l);
+
+		/** Retrieve a scissor rectangle for a given light and camera. 
+		*/
+		virtual const RealRect& getLightScissorRect(Light* l, const Camera* cam);
+
+		/** Removes the named light from the scene and destroys it.
+            @remarks
+                Any pointers held to this light after calling this method will be invalid.
+        */
+        virtual void destroyLight(const String& name);
+
+        /** Removes the light from the scene and destroys it based on a pointer.
+            @remarks
+                Any pointers held to this light after calling this method will be invalid.
+        */
+        virtual void destroyLight(Light* light);
+        /** Removes and destroys all lights in the scene.
+        */
+        virtual void destroyAllLights(void);
+
+        /** Advance method to increase the lights dirty counter due lights changed.
+        @remarks
+            Scene manager tracking lights that affecting the frustum, if changes
+            detected (the changes includes light list itself and the light's position
+            and attenuation range), then increase the lights dirty counter.
+        @par
+            For some reason, you can call this method to force whole scene objects
+            re-populate their light list. But near in mind, call to this method
+            will harm performance, so should avoid if possible.
+        */
+        virtual void _notifyLightsDirty(void);
+
+        /** Advance method to gets the lights dirty counter.
+        @remarks
+            Scene manager tracking lights that affecting the frustum, if changes
+            detected (the changes includes light list itself and the light's position
+            and attenuation range), then increase the lights dirty counter.
+        @par
+            When implementing customise lights finding algorithm relied on either
+            SceneManager::_getLightsAffectingFrustum or SceneManager::_populateLightList,
+            might check this value for sure that the light list are really need to
+            re-populate, otherwise, returns cached light list (if exists) for better
+            performance.
+        */
+        ulong _getLightsDirtyCounter(void) const { return mLightsDirtyCounter; }
+
+        /** Get the list of lights which could be affecting the frustum.
+        @remarks
+            Note that default implementation of this method returns a cached light list,
+            which is populated when rendering the scene. So by default the list of lights 
+			is only available during scene rendering.
+        */
+        virtual const LightList& _getLightsAffectingFrustum(void) const;
+
+        /** Populate a light list with an ordered set of the lights which are closest
+        to the position specified.
+        @remarks
+            Note that since directional lights have no position, they are always considered
+            closer than any point lights and as such will always take precedence. 
+        @par
+            Subclasses of the default SceneManager may wish to take into account other issues
+            such as possible visibility of the light if that information is included in their
+            data structures. This basic scenemanager simply orders by distance, eliminating 
+            those lights which are out of range or could not be affecting the frustum (i.e.
+            only the lights returned by SceneManager::_getLightsAffectingFrustum are take into
+            account).
+        @par
+            The number of items in the list max exceed the maximum number of lights supported
+            by the renderer, but the extraneous ones will never be used. In fact the limit will
+            be imposed by Pass::getMaxSimultaneousLights.
+        @param position The position at which to evaluate the list of lights
+        @param radius The bounding radius to test
+        @param destList List to be populated with ordered set of lights; will be cleared by 
+            this method before population.
+		@param lightMask The mask with which to include / exclude lights
+        */
+        virtual void _populateLightList(const Vector3& position, Real radius, LightList& destList, uint32 lightMask = 0xFFFFFFFF);
+
+		/** Populates a light list with an ordered set of the lights which are closest
+        to the position of the SceneNode given.
+        @remarks
+            Note that since directional lights have no position, they are always considered
+            closer than any point lights and as such will always take precedence. 
+			This overloaded version will take the SceneNode's position and use the second method
+			to populate the list.
+        @par
+            Subclasses of the default SceneManager may wish to take into account other issues
+            such as possible visibility of the light if that information is included in their
+            data structures. This basic scenemanager simply orders by distance, eliminating 
+            those lights which are out of range or could not be affecting the frustum (i.e.
+            only the lights returned by SceneManager::_getLightsAffectingFrustum are take into
+            account). 
+		@par   
+			Also note that subclasses of the SceneNode might be used here to provide cached
+			scene related data, accelerating the list population (for example light lists for
+			SceneNodes could be cached inside subclassed SceneNode objects).
+        @par
+            The number of items in the list may exceed the maximum number of lights supported
+            by the renderer, but the extraneous ones will never be used. In fact the limit will
+            be imposed by Pass::getMaxSimultaneousLights.
+        @param sn The SceneNode for which to evaluate the list of lights
+        @param radius The bounding radius to test
+        @param destList List to be populated with ordered set of lights; will be cleared by 
+            this method before population.
+		@param lightMask The mask with which to include / exclude lights
+        */
+        virtual void _populateLightList(const SceneNode* sn, Real radius, LightList& destList, uint32 lightMask = 0xFFFFFFFF);
+
+        /** Creates an instance of a SceneNode.
+            @remarks
+                Note that this does not add the SceneNode to the scene hierarchy.
+                This method is for convenience, since it allows an instance to
+                be created for which the SceneManager is responsible for
+                allocating and releasing memory, which is convenient in complex
+                scenes.
+            @par
+                To include the returned SceneNode in the scene, use the addChild
+                method of the SceneNode which is to be it's parent.
+            @par
+                Note that this method takes no parameters, and the node created is unnamed (it is
+                actually given a generated name, which you can retrieve if you want).
+                If you wish to create a node with a specific name, call the alternative method
+                which takes a name parameter.
+        */
+        virtual SceneNode* createSceneNode(void);
+
+        /** Creates an instance of a SceneNode with a given name.
+            @remarks
+                Note that this does not add the SceneNode to the scene hierarchy.
+                This method is for convenience, since it allows an instance to
+                be created for which the SceneManager is responsible for
+                allocating and releasing memory, which is convenient in complex
+                scenes.
+            @par
+                To include the returned SceneNode in the scene, use the addChild
+                method of the SceneNode which is to be it's parent.
+            @par
+                Note that this method takes a name parameter, which makes the node easier to
+                retrieve directly again later.
+        */
+        virtual SceneNode* createSceneNode(const String& name);
+
+        /** Destroys a SceneNode with a given name.
+        @remarks
+            This allows you to physically delete an individual SceneNode if you want to.
+            Note that this is not normally recommended, it's better to allow SceneManager
+            to delete the nodes when the scene is cleared.
+        */
+        virtual void destroySceneNode(const String& name);
+
+        /** Destroys a SceneNode.
+        @remarks
+            This allows you to physically delete an individual SceneNode if you want to.
+            Note that this is not normally recommended, it's better to allow SceneManager
+            to delete the nodes when the scene is cleared.
+        */
+        virtual void destroySceneNode(SceneNode* sn);
+        /** Gets the SceneNode at the root of the scene hierarchy.
+            @remarks
+                The entire scene is held as a hierarchy of nodes, which
+                allows things like relative transforms, general changes in
+                rendering state etc (See the SceneNode class for more info).
+                In this basic SceneManager class, the application using
+                Ogre is free to structure this hierarchy however it likes,
+                since it has no real significance apart from making transforms
+                relative to each node (more specialised subclasses will
+                provide utility methods for building specific node structures
+                e.g. loading a BSP tree).
+            @par
+                However, in all cases there is only ever one root node of
+                the hierarchy, and this method returns a pointer to it.
+        */
+        virtual SceneNode* getRootSceneNode(void);
+
+        /** Retrieves a named SceneNode from the scene graph.
+        @remarks
+            If you chose to name a SceneNode as you created it, or if you
+            happened to make a note of the generated name, you can look it
+            up wherever it is in the scene graph using this method.
+			@note Throws an exception if the named instance does not exist
+        */
+        virtual SceneNode* getSceneNode(const String& name) const;
+
+		/** Returns whether a scene node with the given name exists.
+		*/
+		virtual bool hasSceneNode(const String& name) const;
+
+
+        /** Create an Entity (instance of a discrete mesh).
+            @param
+                entityName The name to be given to the entity (must be unique).
+            @param
+                meshName The name of the Mesh it is to be based on (e.g. 'knot.oof'). The
+                mesh will be loaded if it is not already.
+        */
+        virtual Entity* createEntity(const String& entityName, const String& meshName, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME );
+
+        /** Create an Entity (instance of a discrete mesh).
+            @param
+                entityName The name to be given to the entity (must be unique).
+            @param
+                pMesh The pointer to the Mesh it is to be based on.
+        */
+        virtual Entity* createEntity(const String& entityName, const MeshPtr& pMesh );
+
+        /** Create an Entity (instance of a discrete mesh) with an autogenerated name.
+            @param
+                meshName The name of the Mesh it is to be based on (e.g. 'knot.oof'). The
+                mesh will be loaded if it is not already.
+        */
+        virtual Entity* createEntity(const String& meshName);
+
+        /** Create an Entity (instance of a discrete mesh) with an autogenerated name.
+            @param
+                pMesh The pointer to the Mesh it is to be based on.
+        */
+        virtual Entity* createEntity(const MeshPtr& pMesh);
+
+        /** Prefab shapes available without loading a model.
+            @note
+                Minimal implementation at present.
+            @todo
+                Add more prefabs (teapots, teapots!!!)
+        */
+        enum PrefabType {
+            PT_PLANE,
+			PT_CUBE,
+			PT_SPHERE
+        };
+
+        /** Create an Entity (instance of a discrete mesh) from a range of prefab shapes.
+            @param
+                entityName The name to be given to the entity (must be unique).
+            @param
+                ptype The prefab type.
+        */
+        virtual Entity* createEntity(const String& entityName, PrefabType ptype);
+
+        /** Create an Entity (instance of a discrete mesh) from a range of prefab shapes, generating the name.
+            @param ptype The prefab type.
+        */
+        virtual Entity* createEntity(PrefabType ptype);
+        /** Retrieves a pointer to the named Entity. 
+		@note Throws an exception if the named instance does not exist
+		*/
+        virtual Entity* getEntity(const String& name) const;
+		/** Returns whether an entity with the given name exists.
+		*/
+		virtual bool hasEntity(const String& name) const;
+
+        /** Removes & destroys an Entity from the SceneManager.
+            @warning
+                Must only be done if the Entity is not attached
+                to a SceneNode. It may be safer to wait to clear the whole
+                scene if you are unsure use clearScene.
+            @see
+                SceneManager::clearScene
+        */
+        virtual void destroyEntity(Entity* ent);
+
+        /** Removes & destroys an Entity from the SceneManager by name.
+            @warning
+                Must only be done if the Entity is not attached
+                to a SceneNode. It may be safer to wait to clear the whole
+                scene if you are unsure use clearScene.
+            @see
+                SceneManager::clearScene
+        */
+        virtual void destroyEntity(const String& name);
+
+        /** Removes & destroys all Entities.
+            @warning
+                Again, use caution since no Entity must be referred to
+                elsewhere e.g. attached to a SceneNode otherwise a crash
+                is likely. Use clearScene if you are unsure (it clears SceneNode
+                entries too.)
+            @see
+                SceneManager::clearScene
+        */
+        virtual void destroyAllEntities(void);
+
+        /** Create a ManualObject, an object which you populate with geometry
+			manually through a GL immediate-mode style interface.
+        @param
+            name The name to be given to the object (must be unique).
+        */
+        virtual ManualObject* createManualObject(const String& name);
+		/** Create a ManualObject, an object which you populate with geometry
+		manually through a GL immediate-mode style interface, generating the name.
+		*/
+		virtual ManualObject* createManualObject();
+        /** Retrieves a pointer to the named ManualObject. 
+		@note Throws an exception if the named instance does not exist
+		*/
+        virtual ManualObject* getManualObject(const String& name) const;
+		/** Returns whether a manual object with the given name exists.
+		*/
+		virtual bool hasManualObject(const String& name) const;
+
+        /** Removes & destroys a ManualObject from the SceneManager.
+        */
+        virtual void destroyManualObject(ManualObject* obj);
+		/** Removes & destroys a ManualObject from the SceneManager.
+		*/
+		virtual void destroyManualObject(const String& name);
+		/** Removes & destroys all ManualObjects from the SceneManager.
+		*/
+		virtual void destroyAllManualObjects(void);
+        /** Create a BillboardChain, an object which you can use to render
+            a linked chain of billboards.
+        @param
+            name The name to be given to the object (must be unique).
+        */
+        virtual BillboardChain* createBillboardChain(const String& name);
+		/** Create a BillboardChain, an object which you can use to render
+		a linked chain of billboards, with a generated name.
+		*/
+		virtual BillboardChain* createBillboardChain();
+        /** Retrieves a pointer to the named BillboardChain. 
+		@note Throws an exception if the named instance does not exist
+		*/
+        virtual BillboardChain* getBillboardChain(const String& name) const;
+		/** Returns whether a billboard chain with the given name exists.
+		*/
+		virtual bool hasBillboardChain(const String& name) const;
+
+        /** Removes & destroys a BillboardChain from the SceneManager.
+        */
+        virtual void destroyBillboardChain(BillboardChain* obj);
+		/** Removes & destroys a BillboardChain from the SceneManager.
+		*/
+		virtual void destroyBillboardChain(const String& name);
+		/** Removes & destroys all BillboardChains from the SceneManager.
+		*/
+		virtual void destroyAllBillboardChains(void);		
+        /** Create a RibbonTrail, an object which you can use to render
+            a linked chain of billboards which follows one or more nodes.
+        @param
+            name The name to be given to the object (must be unique).
+        */
+        virtual RibbonTrail* createRibbonTrail(const String& name);
+		/** Create a RibbonTrail, an object which you can use to render
+		a linked chain of billboards which follows one or more nodes, generating the name.
+		*/
+		virtual RibbonTrail* createRibbonTrail();
+        /** Retrieves a pointer to the named RibbonTrail. 
+		@note Throws an exception if the named instance does not exist
+		*/
+        virtual RibbonTrail* getRibbonTrail(const String& name) const;
+		/** Returns whether a ribbon trail with the given name exists.
+		*/
+		virtual bool hasRibbonTrail(const String& name) const;
+
+        /** Removes & destroys a RibbonTrail from the SceneManager.
+        */
+        virtual void destroyRibbonTrail(RibbonTrail* obj);
+		/** Removes & destroys a RibbonTrail from the SceneManager.
+		*/
+		virtual void destroyRibbonTrail(const String& name);
+		/** Removes & destroys all RibbonTrails from the SceneManager.
+		*/
+		virtual void destroyAllRibbonTrails(void);		
+
+        /** Creates a particle system based on a template.
+        @remarks
+            This method creates a new ParticleSystem instance based on the named template
+			(defined through ParticleSystemManager::createTemplate) and returns a 
+            pointer to the caller. The caller should not delete this object, it will be freed at system shutdown, 
+            or can be released earlier using the destroyParticleSystem method.
+        @par
+            Each system created from a template takes the template's settings at the time of creation, 
+            but is completely separate from the template from there on. 
+        @par
+            Creating a particle system does not make it a part of the scene. As with other MovableObject
+            subclasses, a ParticleSystem is not rendered until it is attached to a SceneNode. 
+        @par
+            This is probably the more useful particle system creation method since it does not require manual
+            setup of the system. Note that the initial quota is based on the template but may be changed later.
+        @param 
+            name The name to give the new particle system instance.
+        @param 
+            templateName The name of the template to base the new instance on.
+        */
+        virtual ParticleSystem* createParticleSystem(const String& name,
+			const String& templateName);
+        /** Create a blank particle system.
+        @remarks
+            This method creates a new, blank ParticleSystem instance and returns a pointer to it.
+            The caller should not delete this object, it will be freed at system shutdown, or can
+            be released earlier using the destroyParticleSystem method.
+        @par
+            The instance returned from this method won't actually do anything because on creation a
+            particle system has no emitters. The caller should manipulate the instance through it's 
+            ParticleSystem methods to actually create a real particle effect. 
+        @par
+            Creating a particle system does not make it a part of the scene. As with other MovableObject
+            subclasses, a ParticleSystem is not rendered until it is attached to a SceneNode. 
+        @param
+            name The name to give the ParticleSystem.
+        @param 
+            quota The maximum number of particles to allow in this system. 
+        @param
+            resourceGroup The resource group which will be used to load dependent resources
+        */
+        virtual ParticleSystem* createParticleSystem(const String& name,
+			size_t quota = 500, 
+            const String& resourceGroup = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+
+        /** Create a blank particle system with a generated name.
+        @remarks
+            This method creates a new, blank ParticleSystem instance and returns a pointer to it.
+            The caller should not delete this object, it will be freed at system shutdown, or can
+            be released earlier using the destroyParticleSystem method.
+        @par
+            The instance returned from this method won't actually do anything because on creation a
+            particle system has no emitters. The caller should manipulate the instance through it's 
+            ParticleSystem methods to actually create a real particle effect. 
+        @par
+            Creating a particle system does not make it a part of the scene. As with other MovableObject
+            subclasses, a ParticleSystem is not rendered until it is attached to a SceneNode. 
+        @param 
+            quota The maximum number of particles to allow in this system. 
+        @param
+            resourceGroup The resource group which will be used to load dependent resources
+        */
+		virtual ParticleSystem* createParticleSystem(size_t quota = 500, 
+			const String& resourceGroup = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+        /** Retrieves a pointer to the named ParticleSystem. 
+		@note Throws an exception if the named instance does not exist
+		*/
+        virtual ParticleSystem* getParticleSystem(const String& name) const;
+		/** Returns whether a particle system with the given name exists.
+		*/
+		virtual bool hasParticleSystem(const String& name) const;
+
+        /** Removes & destroys a ParticleSystem from the SceneManager.
+        */
+        virtual void destroyParticleSystem(ParticleSystem* obj);
+		/** Removes & destroys a ParticleSystem from the SceneManager.
+		*/
+		virtual void destroyParticleSystem(const String& name);
+		/** Removes & destroys all ParticleSystems from the SceneManager.
+		*/
+		virtual void destroyAllParticleSystems(void);		
+
+		/** Empties the entire scene, inluding all SceneNodes, Entities, Lights, 
+            BillboardSets etc. Cameras are not deleted at this stage since
+            they are still referenced by viewports, which are not destroyed during
+            this process.
+        */
+        virtual void clearScene(void);
+
+        /** Sets the ambient light level to be used for the scene.
+            @remarks
+                This sets the colour and intensity of the ambient light in the scene, i.e. the
+                light which is 'sourceless' and illuminates all objects equally.
+                The colour of an object is affected by a combination of the light in the scene,
+                and the amount of light that object reflects (in this case based on the Material::ambient
+                property).
+            @remarks
+                By default the ambient light in the scene is ColourValue::Black, i.e. no ambient light. This
+                means that any objects rendered with a Material which has lighting enabled (see Material::setLightingEnabled)
+                will not be visible unless you have some dynamic lights in your scene.
+        */
+        void setAmbientLight(const ColourValue& colour);
+
+        /** Returns the ambient light level to be used for the scene.
+        */
+        const ColourValue& getAmbientLight(void) const;
+
+        /** Sets the source of the 'world' geometry, i.e. the large, mainly static geometry
+            making up the world e.g. rooms, landscape etc.
+            This function can be called before setWorldGeometry in a background thread, do to
+            some slow tasks (e.g. IO) that do not involve the backend render system.
+            @remarks
+                Depending on the type of SceneManager (subclasses will be specialised
+                for particular world geometry types) you have requested via the Root or
+                SceneManagerEnumerator classes, you can pass a filename to this method and it
+                will attempt to load the world-level geometry for use. If you try to load
+                an inappropriate type of world data an exception will be thrown. The default
+                SceneManager cannot handle any sort of world geometry and so will always
+                throw an exception. However subclasses like BspSceneManager can load
+                particular types of world geometry e.g. "q3dm1.bsp".
+
+        */
+        virtual void prepareWorldGeometry(const String& filename);
+
+        /** Sets the source of the 'world' geometry, i.e. the large, mainly 
+			static geometry making up the world e.g. rooms, landscape etc.
+            This function can be called before setWorldGeometry in a background thread, do to
+            some slow tasks (e.g. IO) that do not involve the backend render system.
+            @remarks
+                Depending on the type of SceneManager (subclasses will be 
+				specialised for particular world geometry types) you have 
+				requested via the Root or SceneManagerEnumerator classes, you 
+				can pass a stream to this method and it will attempt to load 
+				the world-level geometry for use. If the manager can only 
+				handle one input format the typeName parameter is not required.
+				The stream passed will be read (and it's state updated). 
+			@param stream Data stream containing data to load
+			@param typeName String identifying the type of world geometry
+				contained in the stream - not required if this manager only 
+				supports one type of world geometry.
+        */
+		virtual void prepareWorldGeometry(DataStreamPtr& stream, 
+			const String& typeName = StringUtil::BLANK);
+
+        /** Sets the source of the 'world' geometry, i.e. the large, mainly static geometry
+            making up the world e.g. rooms, landscape etc.
+            @remarks
+                Depending on the type of SceneManager (subclasses will be specialised
+                for particular world geometry types) you have requested via the Root or
+                SceneManagerEnumerator classes, you can pass a filename to this method and it
+                will attempt to load the world-level geometry for use. If you try to load
+                an inappropriate type of world data an exception will be thrown. The default
+                SceneManager cannot handle any sort of world geometry and so will always
+                throw an exception. However subclasses like BspSceneManager can load
+                particular types of world geometry e.g. "q3dm1.bsp".
+        */
+        virtual void setWorldGeometry(const String& filename);
+
+        /** Sets the source of the 'world' geometry, i.e. the large, mainly 
+			static geometry making up the world e.g. rooms, landscape etc.
+            @remarks
+                Depending on the type of SceneManager (subclasses will be 
+				specialised for particular world geometry types) you have 
+				requested via the Root or SceneManagerEnumerator classes, you 
+				can pass a stream to this method and it will attempt to load 
+				the world-level geometry for use. If the manager can only 
+				handle one input format the typeName parameter is not required.
+				The stream passed will be read (and it's state updated). 
+			@param stream Data stream containing data to load
+			@param typeName String identifying the type of world geometry
+				contained in the stream - not required if this manager only 
+				supports one type of world geometry.
+        */
+		virtual void setWorldGeometry(DataStreamPtr& stream, 
+			const String& typeName = StringUtil::BLANK);
+
+        /** Estimate the number of loading stages required to load the named
+            world geometry. 
+        @remarks
+            This method should be overridden by SceneManagers that provide
+            custom world geometry that can take some time to load. They should
+            return from this method a count of the number of stages of progress
+            they can report on whilst loading. During real loading (setWorldGeometry),
+            they should call ResourceGroupManager::_notifyWorldGeometryProgress exactly
+            that number of times when loading the geometry for real.
+        @note 
+            The default is to return 0, ie to not report progress. 
+        */
+        virtual size_t estimateWorldGeometry(const String& filename)
+        { (void)filename; return 0; }
+
+        /** Estimate the number of loading stages required to load the named
+            world geometry. 
+        @remarks
+			Operates just like the version of this method which takes a
+			filename, but operates on a stream instead. Note that since the
+			stream is updated, you'll need to reset the stream or reopen it
+			when it comes to loading it for real.
+		@param stream Data stream containing data to load
+		@param typeName String identifying the type of world geometry
+			contained in the stream - not required if this manager only 
+			supports one type of world geometry.
+		*/		
+        virtual size_t estimateWorldGeometry(DataStreamPtr& stream, 
+			const String& typeName = StringUtil::BLANK)
+        { (void)stream; (void)typeName; return 0; }
+
+        /** Asks the SceneManager to provide a suggested viewpoint from which the scene should be viewed.
+            @remarks
+                Typically this method returns the origin unless a) world geometry has been loaded using
+                SceneManager::setWorldGeometry and b) that world geometry has suggested 'start' points.
+                If there is more than one viewpoint which the scene manager can suggest, it will always suggest
+                the first one unless the random parameter is true.
+            @param
+                random If true, and there is more than one possible suggestion, a random one will be used. If false
+                the same one will always be suggested.
+            @return
+                On success, true is returned.
+            @par
+                On failure, false is returned.
+        */
+        virtual ViewPoint getSuggestedViewpoint(bool random = false);
+
+        /** Method for setting a specific option of the Scene Manager. These options are usually
+            specific for a certain implemntation of the Scene Manager class, and may (and probably
+            will) not exist across different implementations.
+            @param
+                strKey The name of the option to set
+            @param
+                pValue A pointer to the value - the size should be calculated by the scene manager
+                based on the key
+            @return
+                On success, true is returned.
+            @par
+                On failure, false is returned.
+        */
+        virtual bool setOption( const String& strKey, const void* pValue )
+        { (void)strKey; (void)pValue; return false; }
+
+        /** Method for getting the value of an implementation-specific Scene Manager option.
+            @param
+                strKey The name of the option
+            @param
+                pDestValue A pointer to a memory location where the value will
+                be copied. Currently, the memory will be allocated by the
+                scene manager, but this may change
+            @return
+                On success, true is returned and pDestValue points to the value of the given
+                option.
+            @par
+                On failure, false is returned and pDestValue is set to NULL.
+        */
+        virtual bool getOption( const String& strKey, void* pDestValue )
+        { (void)strKey; (void)pDestValue; return false; }
+
+        /** Method for verifying whether the scene manager has an implementation-specific
+            option.
+            @param
+                strKey The name of the option to check for.
+            @return
+                If the scene manager contains the given option, true is returned.
+            @remarks
+                If it does not, false is returned.
+        */
+        virtual bool hasOption( const String& strKey ) const
+        { (void)strKey; return false; }
+
+        /** Method for getting all possible values for a specific option. When this list is too large
+            (i.e. the option expects, for example, a float), the return value will be true, but the
+            list will contain just one element whose size will be set to 0.
+            Otherwise, the list will be filled with all the possible values the option can
+            accept.
+            @param
+                strKey The name of the option to get the values for.
+            @param
+                refValueList A reference to a list that will be filled with the available values.
+            @return
+                On success (the option exists), true is returned.
+            @par
+                On failure, false is returned.
+        */
+        virtual bool getOptionValues( const String& strKey, StringVector& refValueList )
+        { (void)strKey; (void)refValueList; return false; }
+
+        /** Method for getting all the implementation-specific options of the scene manager.
+            @param
+                refKeys A reference to a list that will be filled with all the available options.
+            @return
+                On success, true is returned. On failure, false is returned.
+        */
+        virtual bool getOptionKeys( StringVector& refKeys )
+        { (void)refKeys; return false; }
+
+        /** Internal method for updating the scene graph ie the tree of SceneNode instances managed by this class.
+            @remarks
+                This must be done before issuing objects to the rendering pipeline, since derived transformations from
+                parent nodes are not updated until required. This SceneManager is a basic implementation which simply
+                updates all nodes from the root. This ensures the scene is up to date but requires all the nodes
+                to be updated even if they are not visible. Subclasses could trim this such that only potentially visible
+                nodes are updated.
+        */
+        virtual void _updateSceneGraph(Camera* cam);
+
+        /** Internal method which parses the scene to find visible objects to render.
+            @remarks
+                If you're implementing a custom scene manager, this is the most important method to
+                override since it's here you can apply your custom world partitioning scheme. Once you
+                have added the appropriate objects to the render queue, you can let the default
+                SceneManager objects _renderVisibleObjects handle the actual rendering of the objects
+                you pick.
+            @par
+                Any visible objects will be added to a rendering queue, which is indexed by material in order
+                to ensure objects with the same material are rendered together to minimise render state changes.
+        */
+        virtual void _findVisibleObjects(Camera* cam, VisibleObjectsBoundsInfo* visibleBounds, bool onlyShadowCasters);
+
+        /** Internal method for applying animations to scene nodes.
+        @remarks
+            Uses the internally stored AnimationState objects to apply animation to SceneNodes.
+        */
+        virtual void _applySceneAnimations(void);
+
+        /** Sends visible objects found in _findVisibleObjects to the rendering engine.
+        */
+        virtual void _renderVisibleObjects(void);
+
+        /** Prompts the class to send its contents to the renderer.
+            @remarks
+                This method prompts the scene manager to send the
+                contents of the scene it manages to the rendering
+                pipeline, possibly preceded by some sorting, culling
+                or other scene management tasks. Note that this method is not normally called
+                directly by the user application; it is called automatically
+                by the Ogre rendering loop.
+            @param camera Pointer to a camera from whose viewpoint the scene is to
+                be rendered.
+            @param vp The target viewport
+            @param includeOverlays Whether or not overlay objects should be rendered
+        */
+        virtual void _renderScene(Camera* camera, Viewport* vp, bool includeOverlays);
+
+        /** Internal method for queueing the sky objects with the params as 
+            previously set through setSkyBox, setSkyPlane and setSkyDome.
+        */
+        virtual void _queueSkiesForRendering(Camera* cam);
+
+
+
+        /** Notifies the scene manager of its destination render system
+            @remarks
+                Called automatically by RenderSystem::addSceneManager
+                this method simply notifies the manager of the render
+                system to which its output must be directed.
+            @param
+                sys Pointer to the RenderSystem subclass to be used as a render target.
+        */
+        virtual void _setDestinationRenderSystem(RenderSystem* sys);
+
+        /** Enables / disables a 'sky plane' i.e. a plane at constant
+            distance from the camera representing the sky.
+            @remarks
+                You can create sky planes yourself using the standard mesh and
+                entity methods, but this creates a plane which the camera can
+                never get closer or further away from - it moves with the camera.
+                (NB you could create this effect by creating a world plane which
+                was attached to the same SceneNode as the Camera too, but this
+                would only apply to a single camera whereas this plane applies to
+                any camera using this scene manager).
+            @note
+                To apply scaling, scrolls etc to the sky texture(s) you
+                should use the TextureUnitState class methods.
+            @param
+                enable True to enable the plane, false to disable it
+            @param
+                plane Details of the plane, i.e. it's normal and it's
+                distance from the camera.
+            @param
+                materialName The name of the material the plane will use
+            @param
+                scale The scaling applied to the sky plane - higher values
+                mean a bigger sky plane - you may want to tweak this
+                depending on the size of plane.d and the other
+                characteristics of your scene
+            @param
+                tiling How many times to tile the texture across the sky.
+                Applies to all texture layers. If you need finer control use
+                the TextureUnitState texture coordinate transformation methods.
+            @param
+                drawFirst If true, the plane is drawn before all other
+                geometry in the scene, without updating the depth buffer.
+                This is the safest rendering method since all other objects
+                will always appear in front of the sky. However this is not
+                the most efficient way if most of the sky is often occluded
+                by other objects. If this is the case, you can set this
+                parameter to false meaning it draws <em>after</em> all other
+                geometry which can be an optimisation - however you must
+                ensure that the plane.d value is large enough that no objects
+                will 'poke through' the sky plane when it is rendered.
+			@param
+				bow If zero, the plane will be completely flat (like previous
+				versions.  If above zero, the plane will be curved, allowing
+				the sky to appear below camera level.  Curved sky planes are 
+				simular to skydomes, but are more compatible with fog.
+            @param xsegments, ysegments
+                Determines the number of segments the plane will have to it. This
+                is most important when you are bowing the plane, but may also be useful
+                if you need tesselation on the plane to perform per-vertex effects.
+            @param groupName
+                The name of the resource group to which to assign the plane mesh.
+        */
+
+        virtual void setSkyPlane(
+            bool enable,
+            const Plane& plane, const String& materialName, Real scale = 1000,
+            Real tiling = 10, bool drawFirst = true, Real bow = 0, 
+            int xsegments = 1, int ysegments = 1, 
+            const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+        /** Enables / disables a 'sky plane' i.e. a plane at constant
+            distance from the camera representing the sky.
+            @remarks
+                You can create sky planes yourself using the standard mesh and
+                entity methods, but this creates a plane which the camera can
+                never get closer or further away from - it moves with the camera.
+                (NB you could create this effect by creating a world plane which
+                was attached to the same SceneNode as the Camera too, but this
+                would only apply to a single camera whereas this plane applies to
+                any camera using this scene manager).
+            @note
+                To apply scaling, scrolls etc to the sky texture(s) you
+                should use the TextureUnitState class methods.
+            @param
+                enable True to enable the plane, false to disable it
+            @param
+                plane Details of the plane, i.e. it's normal and it's
+                distance from the camera.
+            @param
+                materialName The name of the material the plane will use
+            @param
+                scale The scaling applied to the sky plane - higher values
+                mean a bigger sky plane - you may want to tweak this
+                depending on the size of plane.d and the other
+                characteristics of your scene
+            @param
+                tiling How many times to tile the texture across the sky.
+                Applies to all texture layers. If you need finer control use
+                the TextureUnitState texture coordinate transformation methods.
+            @param
+                renderQueue The render queue to use when rendering this object
+			@param
+				bow If zero, the plane will be completely flat (like previous
+				versions.  If above zero, the plane will be curved, allowing
+				the sky to appear below camera level.  Curved sky planes are 
+				simular to skydomes, but are more compatible with fog.
+            @param xsegments, ysegments
+                Determines the number of segments the plane will have to it. This
+                is most important when you are bowing the plane, but may also be useful
+                if you need tesselation on the plane to perform per-vertex effects.
+            @param groupName
+                The name of the resource group to which to assign the plane mesh.
+        */        
+        virtual void _setSkyPlane(
+            bool enable,
+            const Plane& plane, const String& materialName, Real scale = 1000,
+            Real tiling = 10, uint8 renderQueue = RENDER_QUEUE_SKIES_EARLY, Real bow = 0, 
+            int xsegments = 1, int ysegments = 1, 
+            const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+
+		/** Enables / disables a 'sky plane' */
+		virtual void setSkyPlaneEnabled(bool enable) { mSkyPlaneEnabled = enable; }
+
+		/** Return whether a key plane is enabled */
+		virtual bool isSkyPlaneEnabled(void) const { return mSkyPlaneEnabled; }
+
+		/** Get the sky plane node, if enabled. */
+		virtual SceneNode* getSkyPlaneNode(void) const { return mSkyPlaneNode; }
+
+		/** Get the parameters used to construct the SkyPlane, if any **/
+		virtual const SkyPlaneGenParameters& getSkyPlaneGenParameters(void) const { return mSkyPlaneGenParameters; }
+
+        /** Enables / disables a 'sky box' i.e. a 6-sided box at constant
+            distance from the camera representing the sky.
+            @remarks
+                You could create a sky box yourself using the standard mesh and
+                entity methods, but this creates a plane which the camera can
+                never get closer or further away from - it moves with the camera.
+                (NB you could create this effect by creating a world box which
+                was attached to the same SceneNode as the Camera too, but this
+                would only apply to a single camera whereas this skybox applies
+                to any camera using this scene manager).
+            @par
+                The material you use for the skybox can either contain layers
+                which are single textures, or they can be cubic textures, i.e.
+                made up of 6 images, one for each plane of the cube. See the
+                TextureUnitState class for more information.
+            @param
+                enable True to enable the skybox, false to disable it
+            @param
+                materialName The name of the material the box will use
+            @param
+                distance Distance in world coorinates from the camera to
+                each plane of the box. The default is normally OK.
+            @param
+                drawFirst If true, the box is drawn before all other
+                geometry in the scene, without updating the depth buffer.
+                This is the safest rendering method since all other objects
+                will always appear in front of the sky. However this is not
+                the most efficient way if most of the sky is often occluded
+                by other objects. If this is the case, you can set this
+                parameter to false meaning it draws <em>after</em> all other
+                geometry which can be an optimisation - however you must
+                ensure that the distance value is large enough that no
+                objects will 'poke through' the sky box when it is rendered.
+            @param
+                orientation Optional parameter to specify the orientation
+                of the box. By default the 'top' of the box is deemed to be
+                in the +y direction, and the 'front' at the -z direction.
+                You can use this parameter to rotate the sky if you want.
+            @param groupName
+                The name of the resource group to which to assign the plane mesh.
+        */
+        virtual void setSkyBox(
+            bool enable, const String& materialName, Real distance = 5000,
+            bool drawFirst = true, const Quaternion& orientation = Quaternion::IDENTITY,
+            const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+
+        /** Enables / disables a 'sky box' i.e. a 6-sided box at constant
+            distance from the camera representing the sky.
+            @remarks
+                You could create a sky box yourself using the standard mesh and
+                entity methods, but this creates a plane which the camera can
+                never get closer or further away from - it moves with the camera.
+                (NB you could create this effect by creating a world box which
+                was attached to the same SceneNode as the Camera too, but this
+                would only apply to a single camera whereas this skybox applies
+                to any camera using this scene manager).
+            @par
+                The material you use for the skybox can either contain layers
+                which are single textures, or they can be cubic textures, i.e.
+                made up of 6 images, one for each plane of the cube. See the
+                TextureUnitState class for more information.
+            @param
+                enable True to enable the skybox, false to disable it
+            @param
+                materialName The name of the material the box will use
+            @param
+                distance Distance in world coorinates from the camera to
+                each plane of the box. The default is normally OK.
+            @param
+                renderQueue The render queue to use when rendering this object
+            @param
+                orientation Optional parameter to specify the orientation
+                of the box. By default the 'top' of the box is deemed to be
+                in the +y direction, and the 'front' at the -z direction.
+                You can use this parameter to rotate the sky if you want.
+            @param groupName
+                The name of the resource group to which to assign the plane mesh.
+        */
+        virtual void _setSkyBox(
+            bool enable, const String& materialName, Real distance = 5000,
+            uint8 renderQueue = RENDER_QUEUE_SKIES_EARLY, const Quaternion& orientation = Quaternion::IDENTITY,
+            const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+
+		/** Enables / disables a 'sky box' */
+		virtual void setSkyBoxEnabled(bool enable) { mSkyBoxEnabled = enable; }
+
+		/** Return whether a skybox is enabled */
+		virtual bool isSkyBoxEnabled(void) const { return mSkyBoxEnabled; }
+
+		/** Get the skybox node, if enabled. */
+		virtual SceneNode* getSkyBoxNode(void) const { return mSkyBoxNode; }
+
+		/** Get the parameters used to generate the current SkyBox, if any */
+		virtual const SkyBoxGenParameters& getSkyBoxGenParameters(void) const { return mSkyBoxGenParameters; }
+
+		/** Enables / disables a 'sky dome' i.e. an illusion of a curved sky.
+            @remarks
+                A sky dome is actually formed by 5 sides of a cube, but with
+                texture coordinates generated such that the surface appears
+                curved like a dome. Sky domes are appropriate where you need a
+                realistic looking sky where the scene is not going to be
+                'fogged', and there is always a 'floor' of some sort to prevent
+                the viewer looking below the horizon (the distortion effect below
+                the horizon can be pretty horrible, and there is never anyhting
+                directly below the viewer). If you need a complete wrap-around
+                background, use the setSkyBox method instead. You can actually
+                combine a sky box and a sky dome if you want, to give a positional
+                backdrop with an overlayed curved cloud layer.
+            @par
+                Sky domes work well with 2D repeating textures like clouds. You
+                can change the apparent 'curvature' of the sky depending on how
+                your scene is viewed - lower curvatures are better for 'open'
+                scenes like landscapes, whilst higher curvatures are better for
+                say FPS levels where you don't see a lot of the sky at once and
+                the exaggerated curve looks good.
+            @param
+                enable True to enable the skydome, false to disable it
+            @param
+                materialName The name of the material the dome will use
+            @param
+                curvature The curvature of the dome. Good values are
+                between 2 and 65. Higher values are more curved leading to
+                a smoother effect, lower values are less curved meaning
+                more distortion at the horizons but a better distance effect.
+            @param
+                tiling How many times to tile the texture(s) across the
+                dome.
+            @param
+                distance Distance in world coorinates from the camera to
+                each plane of the box the dome is rendered on. The default
+                is normally OK.
+            @param
+                drawFirst If true, the dome is drawn before all other
+                geometry in the scene, without updating the depth buffer.
+                This is the safest rendering method since all other objects
+                will always appear in front of the sky. However this is not
+                the most efficient way if most of the sky is often occluded
+                by other objects. If this is the case, you can set this
+                parameter to false meaning it draws <em>after</em> all other
+                geometry which can be an optimisation - however you must
+                ensure that the distance value is large enough that no
+                objects will 'poke through' the sky when it is rendered.
+            @param
+                orientation Optional parameter to specify the orientation
+                of the dome. By default the 'top' of the dome is deemed to
+                be in the +y direction, and the 'front' at the -z direction.
+                You can use this parameter to rotate the sky if you want.
+            @param groupName
+                The name of the resource group to which to assign the plane mesh.
+                */
+        virtual void setSkyDome(
+            bool enable, const String& materialName, Real curvature = 10,
+            Real tiling = 8, Real distance = 4000, bool drawFirst = true,
+            const Quaternion& orientation = Quaternion::IDENTITY,
+            int xsegments = 16, int ysegments = 16, int ysegments_keep = -1,
+            const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+
+		/** Enables / disables a 'sky dome' i.e. an illusion of a curved sky.
+            @remarks
+                A sky dome is actually formed by 5 sides of a cube, but with
+                texture coordinates generated such that the surface appears
+                curved like a dome. Sky domes are appropriate where you need a
+                realistic looking sky where the scene is not going to be
+                'fogged', and there is always a 'floor' of some sort to prevent
+                the viewer looking below the horizon (the distortion effect below
+                the horizon can be pretty horrible, and there is never anyhting
+                directly below the viewer). If you need a complete wrap-around
+                background, use the setSkyBox method instead. You can actually
+                combine a sky box and a sky dome if you want, to give a positional
+                backdrop with an overlayed curved cloud layer.
+            @par
+                Sky domes work well with 2D repeating textures like clouds. You
+                can change the apparent 'curvature' of the sky depending on how
+                your scene is viewed - lower curvatures are better for 'open'
+                scenes like landscapes, whilst higher curvatures are better for
+                say FPS levels where you don't see a lot of the sky at once and
+                the exaggerated curve looks good.
+            @param
+                enable True to enable the skydome, false to disable it
+            @param
+                materialName The name of the material the dome will use
+            @param
+                curvature The curvature of the dome. Good values are
+                between 2 and 65. Higher values are more curved leading to
+                a smoother effect, lower values are less curved meaning
+                more distortion at the horizons but a better distance effect.
+            @param
+                tiling How many times to tile the texture(s) across the
+                dome.
+            @param
+                distance Distance in world coorinates from the camera to
+                each plane of the box the dome is rendered on. The default
+                is normally OK.
+            @param
+                renderQueue The render queue to use when rendering this object
+            @param
+                orientation Optional parameter to specify the orientation
+                of the dome. By default the 'top' of the dome is deemed to
+                be in the +y direction, and the 'front' at the -z direction.
+                You can use this parameter to rotate the sky if you want.
+            @param groupName
+                The name of the resource group to which to assign the plane mesh.
+                */        
+        virtual void _setSkyDome(
+            bool enable, const String& materialName, Real curvature = 10,
+            Real tiling = 8, Real distance = 4000, uint8 renderQueue = RENDER_QUEUE_SKIES_EARLY,
+            const Quaternion& orientation = Quaternion::IDENTITY,
+            int xsegments = 16, int ysegments = 16, int ysegments_keep = -1,
+            const String& groupName = ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME);
+
+		/** Enables / disables a 'sky dome' */
+		virtual void setSkyDomeEnabled(bool enable) { mSkyDomeEnabled = enable; }
+
+		/** Return whether a skydome is enabled */
+		virtual bool isSkyDomeEnabled(void) const { return mSkyDomeEnabled; }
+
+		/** Get the sky dome node, if enabled. */
+		virtual SceneNode* getSkyDomeNode(void) const { return mSkyDomeNode; }
+
+		/** Get the parameters used to generate the current SkyDome, if any */
+		virtual const SkyDomeGenParameters& getSkyDomeGenParameters(void) const { return mSkyDomeGenParameters; }
+
+		/** Sets the fogging mode applied to the scene.
+            @remarks
+                This method sets up the scene-wide fogging effect. These settings
+                apply to all geometry rendered, UNLESS the material with which it
+                is rendered has it's own fog settings (see Material::setFog).
+            @param
+                mode Set up the mode of fog as described in the FogMode
+                enum, or set to FOG_NONE to turn off.
+            @param
+                colour The colour of the fog. Either set this to the same
+                as your viewport background colour, or to blend in with a
+                skydome or skybox.
+            @param
+                expDensity The density of the fog in FOG_EXP or FOG_EXP2
+                mode, as a value between 0 and 1. The default is 0.001. 
+            @param
+                linearStart Distance in world units at which linear fog starts to
+                encroach. Only applicable if mode is
+                FOG_LINEAR.
+            @param
+                linearEnd Distance in world units at which linear fog becomes completely
+                opaque. Only applicable if mode is
+                FOG_LINEAR.
+        */
+        void setFog(
+            FogMode mode = FOG_NONE, const ColourValue& colour = ColourValue::White,
+            Real expDensity = 0.001, Real linearStart = 0.0, Real linearEnd = 1.0);
+
+        /** Returns the fog mode for the scene.
+        */
+        virtual FogMode getFogMode(void) const;
+
+        /** Returns the fog colour for the scene.
+        */
+        virtual const ColourValue& getFogColour(void) const;
+
+        /** Returns the fog start distance for the scene.
+        */
+        virtual Real getFogStart(void) const;
+
+        /** Returns the fog end distance for the scene.
+        */
+        virtual Real getFogEnd(void) const;
+
+        /** Returns the fog density for the scene.
+        */
+        virtual Real getFogDensity(void) const;
+
+
+        /** Creates a new BillboardSet for use with this scene manager.
+            @remarks
+                This method creates a new BillboardSet which is registered with
+                the SceneManager. The SceneManager will destroy this object when
+                it shuts down or when the SceneManager::clearScene method is
+                called, so the caller does not have to worry about destroying
+                this object (in fact, it definitely should not do this).
+            @par
+                See the BillboardSet documentations for full details of the
+                returned class.
+            @param
+                name The name to give to this billboard set. Must be unique.
+            @param
+                poolSize The initial size of the pool of billboards (see BillboardSet for more information)
+            @see
+                BillboardSet
+        */
+        virtual BillboardSet* createBillboardSet(const String& name, unsigned int poolSize = 20);
+
+        /** Creates a new BillboardSet for use with this scene manager, with a generated name.
+            @param
+                poolSize The initial size of the pool of billboards (see BillboardSet for more information)
+            @see
+                BillboardSet
+        */
+        virtual BillboardSet* createBillboardSet(unsigned int poolSize = 20);
+        /** Retrieves a pointer to the named BillboardSet.
+		@note Throws an exception if the named instance does not exist
+        */
+        virtual BillboardSet* getBillboardSet(const String& name) const;
+		/** Returns whether a billboardset with the given name exists.
+		*/
+		virtual bool hasBillboardSet(const String& name) const;
+
+        /** Removes & destroys an BillboardSet from the SceneManager.
+            @warning
+                Must only be done if the BillboardSet is not attached
+                to a SceneNode. It may be safer to wait to clear the whole
+                scene. If you are unsure, use clearScene.
+        */
+        virtual void destroyBillboardSet(BillboardSet* set);
+
+        /** Removes & destroys an BillboardSet from the SceneManager by name.
+            @warning
+                Must only be done if the BillboardSet is not attached
+                to a SceneNode. It may be safer to wait to clear the whole
+                scene. If you are unsure, use clearScene.
+        */
+        virtual void destroyBillboardSet(const String& name);
+
+        /** Removes & destroys all BillboardSets.
+        @warning
+        Again, use caution since no BillboardSet must be referred to
+        elsewhere e.g. attached to a SceneNode otherwise a crash
+        is likely. Use clearScene if you are unsure (it clears SceneNode
+        entries too.)
+        @see
+        SceneManager::clearScene
+        */
+        virtual void destroyAllBillboardSets(void);
+
+        /** Tells the SceneManager whether it should render the SceneNodes which 
+            make up the scene as well as the objects in the scene.
+        @remarks
+            This method is mainly for debugging purposes. If you set this to 'true',
+            each node will be rendered as a set of 3 axes to allow you to easily see
+            the orientation of the nodes.
+        */
+        virtual void setDisplaySceneNodes(bool display);
+        /** Returns true if all scene nodes axis are to be displayed */
+        virtual bool getDisplaySceneNodes(void) const {return mDisplayNodes;}
+
+        /** Creates an animation which can be used to animate scene nodes.
+        @remarks
+            An animation is a collection of 'tracks' which over time change the position / orientation
+            of Node objects. In this case, the animation will likely have tracks to modify the position
+            / orientation of SceneNode objects, e.g. to make objects move along a path.
+        @par
+            You don't need to use an Animation object to move objects around - you can do it yourself
+            using the methods of the Node in your FrameListener class. However, when you need relatively
+            complex scripted animation, this is the class to use since it will interpolate between
+            keyframes for you and generally make the whole process easier to manage.
+        @par
+            A single animation can affect multiple Node objects (each AnimationTrack affects a single Node).
+            In addition, through animation blending a single Node can be affected by multiple animations,
+            athough this is more useful when performing skeletal animation (see Skeleton::createAnimation).
+        @par
+            Note that whilst it uses the same classes, the animations created here are kept separate from the
+            skeletal animations of meshes (each Skeleton owns those animations).
+        @param name The name of the animation, must be unique within this SceneManager.
+        @param length The total length of the animation.
+        */
+        virtual Animation* createAnimation(const String& name, Real length);
+
+        /** Looks up an Animation object previously created with createAnimation. 
+		@note Throws an exception if the named instance does not exist
+		*/
+        virtual Animation* getAnimation(const String& name) const;
+		/** Returns whether an animation with the given name exists.
+		*/
+		virtual bool hasAnimation(const String& name) const;
+
+        /** Destroys an Animation. 
+        @remarks
+            You should ensure that none of your code is referencing this animation objects since the 
+            memory will be freed.
+        */
+        virtual void destroyAnimation(const String& name);
+
+        /** Removes all animations created using this SceneManager. */
+        virtual void destroyAllAnimations(void);
+
+        /** Create an AnimationState object for managing application of animations.
+        @remarks
+            You can create Animation objects for animating SceneNode obejcts using the
+            createAnimation method. However, in order to actually apply those animations
+            you have to call methods on Node and Animation in a particular order (namely
+            Node::resetToInitialState and Animation::apply). To make this easier and to
+            help track the current time position of animations, the AnimationState object
+            is provided.
+            So if you don't want to control animation application manually, call this method,
+            update the returned object as you like every frame and let SceneManager apply 
+            the animation state for you.
+        @par
+            Remember, AnimationState objects are disabled by default at creation time. 
+            Turn them on when you want them using their setEnabled method.
+        @par
+            Note that any SceneNode affected by this automatic animation will have it's state
+            reset to it's initial position before application of the animation. Unless specifically
+            modified using Node::setInitialState the Node assumes it's initial state is at the
+            origin. If you want the base state of the SceneNode to be elsewhere, make your changes
+            to the node using the standard transform methods, then call setInitialState to 
+            'bake' this reference position into the node.
+		@par
+			If the target of your animation is to be a generic AnimableValue, you
+			should ensure that it has a base value set (unlike nodes this has no
+			default). @see AnimableValue::setAsBaseValue.
+        @param animName The name of an animation created already with createAnimation.
+        */
+        virtual AnimationState* createAnimationState(const String& animName);
+
+        /** Retrieves animation state as previously created using createAnimationState. 
+		@note Throws an exception if the named instance does not exist
+		*/
+        virtual AnimationState* getAnimationState(const String& animName) const;
+		/** Returns whether an animation state with the given name exists.
+		*/
+		virtual bool hasAnimationState(const String& name) const;
+
+        /** Destroys an AnimationState. 
+        @remarks
+            You should ensure that none of your code is referencing this animation 
+            state object since the memory will be freed.
+        */
+        virtual void destroyAnimationState(const String& name);
+
+        /** Removes all animation states created using this SceneManager. */
+        virtual void destroyAllAnimationStates(void);
+
+        /** Manual rendering method, for advanced users only.
+        @remarks
+            This method allows you to send rendering commands through the pipeline on
+            demand, bypassing OGRE's normal world processing. You should only use this if you
+            really know what you're doing; OGRE does lots of things for you that you really should
+            let it do. However, there are times where it may be useful to have this manual interface,
+            for example overlaying something on top of the scene rendered by OGRE.
+        @par
+            Because this is an instant rendering method, timing is important. The best 
+            time to call it is from a RenderTargetListener event handler.
+        @par
+            Don't call this method a lot, it's designed for rare (1 or 2 times per frame) use. 
+            Calling it regularly per frame will cause frame rate drops!
+        @param rend A RenderOperation object describing the rendering op
+        @param pass The Pass to use for this render
+        @param vp Pointer to the viewport to render to, or 0 to use the current viewport
+        @param worldMatrix The transform to apply from object to world space
+        @param viewMatrix The transform to apply from world to view space
+        @param projMatrix The transform to apply from view to screen space
+        @param doBeginEndFrame If true, beginFrame() and endFrame() are called, 
+            otherwise not. You should leave this as false if you are calling
+            this within the main render loop.
+        */
+        virtual void manualRender(RenderOperation* rend, Pass* pass, Viewport* vp, 
+            const Matrix4& worldMatrix, const Matrix4& viewMatrix, const Matrix4& projMatrix, 
+            bool doBeginEndFrame = false) ;
+
+		/** Manual rendering method for rendering a single object. 
+		@param rend The renderable to issue to the pipeline
+		@param pass The pass to use
+		@param vp Pointer to the viewport to render to, or 0 to use the existing viewport
+		@param doBeginEndFrame If true, beginFrame() and endFrame() are called, 
+		otherwise not. You should leave this as false if you are calling
+		this within the main render loop.
+        @param viewMatrix The transform to apply from world to view space
+        @param projMatrix The transform to apply from view to screen space
+		@param lightScissoringClipping If true, passes that have the getLightScissorEnabled
+		and/or getLightClipPlanesEnabled flags will cause calculation and setting of 
+		scissor rectangle and user clip planes. 
+		@param doLightIteration If true, this method will issue the renderable to
+		the pipeline possibly multiple times, if the pass indicates it should be
+		done once per light
+		@param manualLightList Only applicable if doLightIteration is false, this
+		method allows you to pass in a previously determined set of lights
+		which will be used for a single render of this object.
+		*/
+		virtual void manualRender(Renderable* rend, const Pass* pass, Viewport* vp, 
+			const Matrix4& viewMatrix, const Matrix4& projMatrix, bool doBeginEndFrame = false, bool lightScissoringClipping = true, 
+			bool doLightIteration = true, const LightList* manualLightList = 0);
+
+		/** Retrieves the internal render queue, for advanced users only.
+        @remarks
+            The render queue is mainly used internally to manage the scene object 
+			rendering queue, it also exports some methods to allow advanced users 
+			to configure the behavior of rendering process.
+            Most methods provided by RenderQueue are supposed to be used 
+			internally only, you should reference to the RenderQueue API for 
+			more information. Do not access this directly unless you know what 
+			you are doing.
+        */
+        virtual RenderQueue* getRenderQueue(void);
+
+        /** Registers a new RenderQueueListener which will be notified when render queues
+            are processed.
+        */
+        virtual void addRenderQueueListener(RenderQueueListener* newListener);
+
+        /** Removes a listener previously added with addRenderQueueListener. */
+        virtual void removeRenderQueueListener(RenderQueueListener* delListener);
+		
+		/** Registers a new Render Object Listener which will be notified when rendering an object.		
+		*/
+		virtual void addRenderObjectListener(RenderObjectListener* newListener);
+		/** Removes a listener previously added with addRenderObjectListener. */
+		virtual void removeRenderObjectListener(RenderObjectListener* delListener);
+
+		/** Adds an item to the 'special case' render queue list.
+		@remarks
+			Normally all render queues are rendered, in their usual sequence, 
+			only varying if a RenderQueueListener nominates for the queue to be 
+			repeated or skipped. This method allows you to add a render queue to 
+			a 'special case' list, which varies the behaviour. The effect of this
+			list depends on the 'mode' in which this list is in, which might be
+			to exclude these render queues, or to include them alone (excluding
+			all other queues). This allows you to perform broad selective
+			rendering without requiring a RenderQueueListener.
+		@param qid The identifier of the queue which should be added to the
+			special case list. Nothing happens if the queue is already in the list.
+		*/
+		virtual void addSpecialCaseRenderQueue(uint8 qid);
+		/** Removes an item to the 'special case' render queue list.
+		@see SceneManager::addSpecialCaseRenderQueue
+		@param qid The identifier of the queue which should be removed from the
+			special case list. Nothing happens if the queue is not in the list.
+		*/
+		virtual void removeSpecialCaseRenderQueue(uint8 qid);
+		/** Clears the 'special case' render queue list.
+		@see SceneManager::addSpecialCaseRenderQueue
+		*/
+		virtual void clearSpecialCaseRenderQueues(void);
+		/** Sets the way the special case render queue list is processed.
+		@see SceneManager::addSpecialCaseRenderQueue
+		@param mode The mode of processing
+		*/
+		virtual void setSpecialCaseRenderQueueMode(SpecialCaseRenderQueueMode mode);
+		/** Gets the way the special case render queue list is processed. */
+		virtual SpecialCaseRenderQueueMode getSpecialCaseRenderQueueMode(void);
+		/** Returns whether or not the named queue will be rendered based on the
+			current 'special case' render queue list and mode.
+		@see SceneManager::addSpecialCaseRenderQueue
+		@param qid The identifier of the queue which should be tested
+		@return true if the queue will be rendered, false otherwise
+		*/
+		virtual bool isRenderQueueToBeProcessed(uint8 qid);
+
+		/** Sets the render queue that the world geometry (if any) this SceneManager
+			renders will be associated with.
+		@remarks
+			SceneManagers which provide 'world geometry' should place it in a 
+			specialised render queue in order to make it possible to enable / 
+			disable it easily using the addSpecialCaseRenderQueue method. Even 
+			if the SceneManager does not use the render queues to render the 
+			world geometry, it should still pick a queue to represent it's manual
+			rendering, and check isRenderQueueToBeProcessed before rendering.
+		@note
+			Setting this may not affect the actual ordering of rendering the
+			world geometry, if the world geometry is being rendered manually
+			by the SceneManager. If the SceneManager feeds world geometry into
+			the queues, however, the ordering will be affected. 
+		*/
+		virtual void setWorldGeometryRenderQueue(uint8 qid);
+		/** Gets the render queue that the world geometry (if any) this SceneManager
+			renders will be associated with.
+		@remarks
+			SceneManagers which provide 'world geometry' should place it in a 
+			specialised render queue in order to make it possible to enable / 
+			disable it easily using the addSpecialCaseRenderQueue method. Even 
+			if the SceneManager does not use the render queues to render the 
+			world geometry, it should still pick a queue to represent it's manual
+			rendering, and check isRenderQueueToBeProcessed before rendering.
+		*/
+		virtual uint8 getWorldGeometryRenderQueue(void);
+
+		/** Allows all bounding boxes of scene nodes to be displayed. */
+		virtual void showBoundingBoxes(bool bShow);
+
+		/** Returns if all bounding boxes of scene nodes are to be displayed */
+		virtual bool getShowBoundingBoxes() const;
+
+        /** Internal method for notifying the manager that a SceneNode is autotracking. */
+        virtual void _notifyAutotrackingSceneNode(SceneNode* node, bool autoTrack);
+
+        
+        /** Creates an AxisAlignedBoxSceneQuery for this scene manager. 
+        @remarks
+            This method creates a new instance of a query object for this scene manager, 
+            for an axis aligned box region. See SceneQuery and AxisAlignedBoxSceneQuery 
+            for full details.
+        @par
+            The instance returned from this method must be destroyed by calling
+            SceneManager::destroyQuery when it is no longer required.
+        @param box Details of the box which describes the region for this query.
+        @param mask The query mask to apply to this query; can be used to filter out
+            certain objects; see SceneQuery for details.
+        */
+        virtual AxisAlignedBoxSceneQuery* 
+            createAABBQuery(const AxisAlignedBox& box, uint32 mask = 0xFFFFFFFF);
+        /** Creates a SphereSceneQuery for this scene manager. 
+        @remarks
+            This method creates a new instance of a query object for this scene manager, 
+            for a spherical region. See SceneQuery and SphereSceneQuery 
+            for full details.
+        @par
+            The instance returned from this method must be destroyed by calling
+            SceneManager::destroyQuery when it is no longer required.
+        @param sphere Details of the sphere which describes the region for this query.
+        @param mask The query mask to apply to this query; can be used to filter out
+            certain objects; see SceneQuery for details.
+        */
+        virtual SphereSceneQuery* 
+            createSphereQuery(const Sphere& sphere, uint32 mask = 0xFFFFFFFF);
+        /** Creates a PlaneBoundedVolumeListSceneQuery for this scene manager. 
+        @remarks
+        This method creates a new instance of a query object for this scene manager, 
+        for a region enclosed by a set of planes (normals pointing inwards). 
+        See SceneQuery and PlaneBoundedVolumeListSceneQuery for full details.
+        @par
+        The instance returned from this method must be destroyed by calling
+        SceneManager::destroyQuery when it is no longer required.
+        @param volumes Details of the volumes which describe the region for this query.
+        @param mask The query mask to apply to this query; can be used to filter out
+        certain objects; see SceneQuery for details.
+        */
+        virtual PlaneBoundedVolumeListSceneQuery* 
+            createPlaneBoundedVolumeQuery(const PlaneBoundedVolumeList& volumes, uint32 mask = 0xFFFFFFFF);
+
+
+        /** Creates a RaySceneQuery for this scene manager. 
+        @remarks
+            This method creates a new instance of a query object for this scene manager, 
+            looking for objects which fall along a ray. See SceneQuery and RaySceneQuery 
+            for full details.
+        @par
+            The instance returned from this method must be destroyed by calling
+            SceneManager::destroyQuery when it is no longer required.
+        @param ray Details of the ray which describes the region for this query.
+        @param mask The query mask to apply to this query; can be used to filter out
+            certain objects; see SceneQuery for details.
+        */
+        virtual RaySceneQuery* 
+            createRayQuery(const Ray& ray, uint32 mask = 0xFFFFFFFF);
+        //PyramidSceneQuery* createPyramidQuery(const Pyramid& p, unsigned long mask = 0xFFFFFFFF);
+        /** Creates an IntersectionSceneQuery for this scene manager. 
+        @remarks
+            This method creates a new instance of a query object for locating
+            intersecting objects. See SceneQuery and IntersectionSceneQuery
+            for full details.
+        @par
+            The instance returned from this method must be destroyed by calling
+            SceneManager::destroyQuery when it is no longer required.
+        @param mask The query mask to apply to this query; can be used to filter out
+            certain objects; see SceneQuery for details.
+        */
+        virtual IntersectionSceneQuery* 
+            createIntersectionQuery(uint32 mask = 0xFFFFFFFF);
+
+        /** Destroys a scene query of any type. */
+        virtual void destroyQuery(SceneQuery* query);
+
+        typedef MapIterator<CameraList> CameraIterator;
+        typedef MapIterator<AnimationList> AnimationIterator;
+
+        /** Returns a specialised MapIterator over all cameras in the scene. 
+		*/
+        CameraIterator getCameraIterator(void) {
+            return CameraIterator(mCameras.begin(), mCameras.end());
+        }
+		/** Returns a const version of the camera list. 
+		*/
+		const CameraList& getCameras() const { return mCameras; }
+        /** Returns a specialised MapIterator over all animations in the scene. */
+        AnimationIterator getAnimationIterator(void) {
+            return AnimationIterator(mAnimationsList.begin(), mAnimationsList.end());
+        }
+		/** Returns a const version of the animation list. 
+		*/
+		const AnimationList& getAnimations() const { return mAnimationsList; }
+        /** Returns a specialised MapIterator over all animation states in the scene. */
+        AnimationStateIterator getAnimationStateIterator(void) {
+            return mAnimationStates.getAnimationStateIterator();
+        }
+
+        /** Sets the general shadow technique to be used in this scene.
+        @remarks   
+            There are multiple ways to generate shadows in a scene, and each has 
+            strengths and weaknesses. 
+            <ul><li>Stencil-based approaches can be used to 
+            draw very long, extreme shadows without loss of precision and the 'additive'
+            version can correctly show the shadowing of complex effects like bump mapping
+            because they physically exclude the light from those areas. However, the edges
+            are very sharp and stencils cannot handle transparency, and they involve a 
+            fair amount of CPU work in order to calculate the shadow volumes, especially
+            when animated objects are involved.</li>
+            <li>Texture-based approaches are good for handling transparency (they can, for
+            example, correctly shadow a mesh which uses alpha to represent holes), and they
+            require little CPU overhead, and can happily shadow geometry which is deformed
+            by a vertex program, unlike stencil shadows. However, they have a fixed precision 
+            which can introduce 'jaggies' at long range and have fillrate issues of their own.</li>
+            </ul>
+        @par
+            We support 2 kinds of stencil shadows, and 2 kinds of texture-based shadows, and one
+            simple decal approach. The 2 stencil approaches differ in the amount of multipass work 
+            that is required - the modulative approach simply 'darkens' areas in shadow after the 
+            main render, which is the least expensive, whilst the additive approach has to perform 
+            a render per light and adds the cumulative effect, which is more expensive but more 
+            accurate. The texture based shadows both work in roughly the same way, the only difference is
+            that the shadowmap approach is slightly more accurate, but requires a more recent
+            graphics card.
+        @par
+            Note that because mixing many shadow techniques can cause problems, only one technique
+            is supported at once. Also, you should call this method at the start of the 
+            scene setup. 
+        @param technique The shadowing technique to use for the scene.
+        */
+        virtual void setShadowTechnique(ShadowTechnique technique);
+        
+        /** Gets the current shadow technique. */
+        virtual ShadowTechnique getShadowTechnique(void) const { return mShadowTechnique; }
+
+        /** Enables / disables the rendering of debug information for shadows. */
+        virtual void setShowDebugShadows(bool debug) { mDebugShadows = debug; }
+        /** Are debug shadows shown? */
+        virtual bool getShowDebugShadows(void ) const { return mDebugShadows; }
+
+        /** Set the colour used to modulate areas in shadow. 
+        @remarks This is only applicable for shadow techniques which involve 
+            darkening the area in shadow, as opposed to masking out the light. 
+            This colour provided is used as a modulative value to darken the
+            areas.
+        */
+        virtual void setShadowColour(const ColourValue& colour);
+        /** Get the colour used to modulate areas in shadow. 
+        @remarks This is only applicable for shadow techniques which involve 
+        darkening the area in shadow, as opposed to masking out the light. 
+        This colour provided is used as a modulative value to darken the
+        areas.
+        */
+        virtual const ColourValue& getShadowColour(void) const;
+        /** Sets the distance a shadow volume is extruded for a directional light.
+        @remarks
+            Although directional lights are essentially infinite, there are many
+            reasons to limit the shadow extrusion distance to a finite number, 
+            not least of which is compatibility with older cards (which do not
+            support infinite positions), and shadow caster elimination.
+        @par
+            The default value is 10,000 world units. This does not apply to
+            point lights or spotlights, since they extrude up to their 
+            attenuation range.
+        */
+        virtual void setShadowDirectionalLightExtrusionDistance(Real dist); 
+        /** Gets the distance a shadow volume is extruded for a directional light.
+        */
+        virtual Real getShadowDirectionalLightExtrusionDistance(void) const;
+        /** Sets the default maximum distance away from the camera that shadows
+        will be visible. You have to call this function before you create lights
+        or the default distance of zero will be used.
+        @remarks
+        Shadow techniques can be expensive, therefore it is a good idea
+        to limit them to being rendered close to the camera if possible,
+        and to skip the expense of rendering shadows for distance objects.
+        This method allows you to set the distance at which shadows will no
+        longer be rendered.
+        @note
+        Each shadow technique can interpret this subtely differently.
+        For example, one technique may use this to eliminate casters,
+        another might use it to attenuate the shadows themselves.
+        You should tweak this value to suit your chosen shadow technique
+        and scene setup.
+        */
+        virtual void setShadowFarDistance(Real distance);
+        /** Gets the default maximum distance away from the camera that shadows
+        will be visible.
+        */
+        virtual Real getShadowFarDistance(void) const
+        { return mDefaultShadowFarDist; }
+        virtual Real getShadowFarDistanceSquared(void) const
+        { return mDefaultShadowFarDistSquared; }
+
+		/** Sets the maximum size of the index buffer used to render shadow
+		 	primitives.
+		@remarks
+			This method allows you to tweak the size of the index buffer used
+			to render shadow primitives (including stencil shadow volumes). The
+			default size is 51,200 entries, which is 100k of GPU memory, or
+			enough to render approximately 17,000 triangles. You can reduce this
+			as long as you do not have any models / world geometry chunks which 
+			could require more than the amount you set.
+		@par
+			The maximum number of triangles required to render a single shadow 
+			volume (including light and dark caps when needed) will be 3x the 
+			number of edges on the light silhouette, plus the number of 
+			light-facing triangles.	On average, half the 
+			triangles will be facing toward the light, but the number of 
+			triangles in the silhouette entirely depends on the mesh - 
+			angular meshes will have a higher silhouette tris/mesh tris
+			ratio than a smooth mesh. You can estimate the requirements for
+			your particular mesh by rendering it alone in a scene with shadows
+			enabled and a single light - rotate it or the light and make a note
+			of how high the triangle count goes (remembering to subtract the 
+			mesh triangle count)
+		@param size The number of indexes; divide this by 3 to determine the
+			number of triangles.
+		*/
+		virtual void setShadowIndexBufferSize(size_t size);
+        /// Get the size of the shadow index buffer
+		virtual size_t getShadowIndexBufferSize(void) const
+		{ return mShadowIndexBufferSize; }
+        /** Set the size of the texture used for all texture-based shadows.
+        @remarks
+            The larger the shadow texture, the better the detail on 
+            texture based shadows, but obviously this takes more memory.
+            The default size is 512. Sizes must be a power of 2.
+		@note This is the simple form, see setShadowTextureConfig for the more 
+			complex form.
+        */
+        virtual void setShadowTextureSize(unsigned short size);
+
+		/** Set the detailed configuration for a shadow texture.
+		@param shadowIndex The index of the texture to configure, must be < the
+			number of shadow textures setting
+		@param width The width of the texture
+        @param height The height of the texture
+		@param format The pixel format of the texture
+        @param fsaa The level of multisampling to use. Ignored if the device does not support it.
+		@param depthBufferPoolId The pool # it should query the depth buffers from
+		*/
+		virtual void setShadowTextureConfig(size_t shadowIndex, unsigned short width, 
+			unsigned short height, PixelFormat format, unsigned short fsaa = 0, uint16 depthBufferPoolId=1);
+		/** Set the detailed configuration for a shadow texture.
+		@param shadowIndex The index of the texture to configure, must be < the
+			number of shadow textures setting
+		@param config Configuration structure
+		*/
+		virtual void setShadowTextureConfig(size_t shadowIndex, 
+			const ShadowTextureConfig& config);
+
+		/** Get an iterator over the current shadow texture settings. */
+		ConstShadowTextureConfigIterator getShadowTextureConfigIterator() const;
+
+        /** Set the pixel format of the textures used for texture-based shadows.
+        @remarks
+			By default, a colour texture is used (PF_X8R8G8B8) for texture shadows,
+			but if you want to use more advanced texture shadow types you can 
+			alter this. If you do, you will have to also call
+			setShadowTextureCasterMaterial and setShadowTextureReceiverMaterial
+			to provide shader-based materials to use these customised shadow
+			texture formats.
+		@note This is the simple form, see setShadowTextureConfig for the more 
+			complex form.
+        */
+        virtual void setShadowTexturePixelFormat(PixelFormat fmt);
+        /** Set the level of multisample AA of the textures used for texture-based shadows.
+        @remarks
+            By default, the level of multisample AA is zero.
+        @note This is the simple form, see setShadowTextureConfig for the more 
+            complex form.
+        */
+        virtual void setShadowTextureFSAA(unsigned short fsaa);
+
+        /** Set the number of textures allocated for texture-based shadows.
+        @remarks
+            The default number of textures assigned to deal with texture based
+            shadows is 1; however this means you can only have one light casting
+            shadows at the same time. You can increase this number in order to 
+            make this more flexible, but be aware of the texture memory it will use.
+        */
+        virtual void setShadowTextureCount(size_t count);
+        /// Get the number of the textures allocated for texture based shadows
+        size_t getShadowTextureCount(void) const {return mShadowTextureConfigList.size(); }
+
+		/** Set the number of shadow textures a light type uses.
+		@remarks
+			The default for all light types is 1. This means that each light uses only 1 shadow
+			texture. Call this if you need more than 1 shadow texture per light, E.G. PSSM. 
+		@note
+			This feature only works with the Integrated shadow technique.
+			Also remember to increase the total number of shadow textures you request
+			appropriately (e.g. via setShadowTextureCount)!!
+		*/
+		void setShadowTextureCountPerLightType(Light::LightTypes type, size_t count)
+		{ mShadowTextureCountPerType[type] = count; }
+		/// Get the number of shadow textures is assigned for the given light type.
+		size_t getShadowTextureCountPerLightType(Light::LightTypes type) const
+		{return mShadowTextureCountPerType[type]; }
+
+        /** Sets the size and count of textures used in texture-based shadows. 
+        @see setShadowTextureSize and setShadowTextureCount for details, this
+            method just allows you to change both at once, which can save on
+            reallocation if the textures have already been created.
+		@note This is the simple form, see setShadowTextureConfig for the more 
+			complex form.
+        */
+        virtual void setShadowTextureSettings(unsigned short size, unsigned short count, 
+			PixelFormat fmt = PF_X8R8G8B8, unsigned short fsaa = 0, uint16 depthBufferPoolId=1);
+
+		/** Get a reference to the shadow texture currently in use at the given index.
+		@note
+			If you change shadow settings, this reference may no longer
+			be correct, so be sure not to hold the returned reference over 
+			texture shadow configuration changes.
+		*/
+		virtual const TexturePtr& getShadowTexture(size_t shadowIndex);
+
+        /** Sets the proportional distance which a texture shadow which is generated from a
+            directional light will be offset into the camera view to make best use of texture space.
+        @remarks
+            When generating a shadow texture from a directional light, an approximation is used
+            since it is not possible to render the entire scene to one texture. 
+            The texture is projected onto an area centred on the camera, and is
+            the shadow far distance * 2 in length (it is square). This wastes
+            a lot of texture space outside the frustum though, so this offset allows
+            you to move the texture in front of the camera more. However, be aware
+            that this can cause a little shadow 'jittering' during rotation, and
+            that if you move it too far then you'll start to get artefacts close 
+            to the camera. The value is represented as a proportion of the shadow
+            far distance, and the default is 0.6.
+        */
+        virtual void setShadowDirLightTextureOffset(Real offset) { mShadowTextureOffset = offset;}
+		/** Gets the proportional distance which a texture shadow which is generated from a
+		directional light will be offset into the camera view to make best use of texture space.
+		*/
+		virtual Real getShadowDirLightTextureOffset(void)  const { return mShadowTextureOffset; }
+        /** Sets the proportional distance at which texture shadows begin to fade out.
+        @remarks
+            To hide the edges where texture shadows end (in directional lights)
+            Ogre will fade out the shadow in the distance. This value is a proportional
+            distance of the entire shadow visibility distance at which the shadow
+            begins to fade out. The default is 0.7
+        */
+        virtual void setShadowTextureFadeStart(Real fadeStart) 
+        { mShadowTextureFadeStart = fadeStart; }
+        /** Sets the proportional distance at which texture shadows finish to fading out.
+        @remarks
+        To hide the edges where texture shadows end (in directional lights)
+        Ogre will fade out the shadow in the distance. This value is a proportional
+        distance of the entire shadow visibility distance at which the shadow
+        is completely invisible. The default is 0.9.
+        */
+        virtual void setShadowTextureFadeEnd(Real fadeEnd) 
+        { mShadowTextureFadeEnd = fadeEnd; }
+
+		/** Sets whether or not texture shadows should attempt to self-shadow.
+		@remarks
+			The default implementation of texture shadows uses a fixed-function 
+			colour texture projection approach for maximum compatibility, and 
+			as such cannot support self-shadowing. However, if you decide to 
+			implement a more complex shadowing technique using the 
+			setShadowTextureCasterMaterial and setShadowTextureReceiverMaterial 
+			there is a possibility you may be able to support 
+			self-shadowing (e.g by implementing a shader-based shadow map). In 
+			this case you might want to enable this option.
+		@param selfShadow Whether to attempt self-shadowing with texture shadows
+		*/
+		virtual void setShadowTextureSelfShadow(bool selfShadow); 
+
+		/// Gets whether or not texture shadows attempt to self-shadow.
+		virtual bool getShadowTextureSelfShadow(void) const 
+		{ return mShadowTextureSelfShadow; }
+		/** Sets the default material to use for rendering shadow casters.
+		@remarks
+			By default shadow casters are rendered into the shadow texture using
+			an automatically generated fixed-function pass. This allows basic
+			projective texture shadows, but it's possible to use more advanced
+			shadow techniques by overriding the caster and receiver materials, for
+			example providing vertex and fragment programs to implement shadow
+			maps.
+		@par
+			You can rely on the ambient light in the scene being set to the 
+			requested texture shadow colour, if that's useful. 
+		@note
+			Individual objects may also override the vertex program in
+			your default material if their materials include 
+			shadow_caster_vertex_program_ref, shadow_receiver_vertex_program_ref
+			shadow_caster_material entries, so if you use both make sure they are compatible.			
+		@note
+			Only a single pass is allowed in your material, although multiple
+			techniques may be used for hardware fallback.
+		*/
+		virtual void setShadowTextureCasterMaterial(const String& name);
+		/** Sets the default material to use for rendering shadow receivers.
+		@remarks
+			By default shadow receivers are rendered as a post-pass using basic
+			modulation. This allows basic projective texture shadows, but it's 
+			possible to use more advanced shadow techniques by overriding the 
+			caster and receiver materials, for example providing vertex and 
+			fragment programs to implement shadow maps.
+		@par
+			You can rely on texture unit 0 containing the shadow texture, and 
+			for the unit to be set to use projective texturing from the light 
+			(only useful if you're using fixed-function, which is unlikely; 
+			otherwise you should rely on the texture_viewproj_matrix auto binding)
+		@note
+			Individual objects may also override the vertex program in
+			your default material if their materials include 
+			shadow_caster_vertex_program_ref shadow_receiver_vertex_program_ref
+			shadow_receiver_material entries, so if you use both make sure they are compatible.
+		@note
+			Only a single pass is allowed in your material, although multiple
+			techniques may be used for hardware fallback.
+		*/
+		virtual void setShadowTextureReceiverMaterial(const String& name);
+
+		/** Sets whether or not shadow casters should be rendered into shadow
+			textures using their back faces rather than their front faces. 
+		@remarks
+			Rendering back faces rather than front faces into a shadow texture
+			can help minimise depth comparison issues, if you're using depth
+			shadowmapping. You will probably still need some biasing but you
+			won't need as much. For solid objects the result is the same anyway,
+			if you have objects with holes you may want to turn this option off.
+			The default is to enable this option.
+		*/
+		virtual void setShadowCasterRenderBackFaces(bool bf) { mShadowCasterRenderBackFaces = bf; }
+
+		/** Gets whether or not shadow casters should be rendered into shadow
+			textures using their back faces rather than their front faces. 
+		*/
+		virtual bool getShadowCasterRenderBackFaces() const { return mShadowCasterRenderBackFaces; }
+
+		/** Set the shadow camera setup to use for all lights which don't have
+			their own shadow camera setup.
+		@see ShadowCameraSetup
+		*/
+		virtual void setShadowCameraSetup(const ShadowCameraSetupPtr& shadowSetup);
+
+		/** Get the shadow camera setup in use for all lights which don't have
+			their own shadow camera setup.
+		@see ShadowCameraSetup
+		*/
+		virtual const ShadowCameraSetupPtr& getShadowCameraSetup() const;
+
+		/** Sets whether we should use an inifinite camera far plane
+			when rendering stencil shadows.
+		@remarks
+			Stencil shadow coherency is very reliant on the shadow volume
+			not being clipped by the far plane. If this clipping happens, you
+			get a kind of 'negative' shadow effect. The best way to achieve
+			coherency is to move the far plane of the camera out to infinity,
+			thus preventing the far plane from clipping the shadow volumes.
+			When combined with vertex program extrusion of the volume to 
+			infinity, which	Ogre does when available, this results in very
+			robust shadow volumes. For this reason, when you enable stencil 
+			shadows, Ogre automatically changes your camera settings to 
+			project to infinity if the card supports it. You can disable this
+			behaviour if you like by calling this method; although you can 
+			never enable infinite projection if the card does not support it.
+		@par	
+			If you disable infinite projection, or it is not available, 
+			you need to be far more careful with your light attenuation /
+			directional light extrusion distances to avoid clipping artefacts
+			at the far plane.
+		@note
+			Recent cards will generally support infinite far plane projection.
+			However, we have found some cases where they do not, especially
+			on Direct3D. There is no standard capability we can check to 
+			validate this, so we use some heuristics based on experience:
+			<UL>
+			<LI>OpenGL always seems to support it no matter what the card</LI>
+			<LI>Direct3D on non-vertex program capable systems (including 
+			vertex program capable cards on Direct3D7) does not
+			support it</LI>
+			<LI>Direct3D on GeForce3 and GeForce4 Ti does not seem to support
+			infinite projection<LI>
+			</UL>
+			Therefore in the RenderSystem implementation, we may veto the use
+			of an infinite far plane based on these heuristics. 
+		*/
+        virtual void setShadowUseInfiniteFarPlane(bool enable) {
+            mShadowUseInfiniteFarPlane = enable; }
+
+		/** Is there a stencil shadow based shadowing technique in use? */
+		virtual bool isShadowTechniqueStencilBased(void) const 
+		{ return (mShadowTechnique & SHADOWDETAILTYPE_STENCIL) != 0; }
+		/** Is there a texture shadow based shadowing technique in use? */
+		virtual bool isShadowTechniqueTextureBased(void) const 
+		{ return (mShadowTechnique & SHADOWDETAILTYPE_TEXTURE) != 0; }
+		/** Is there a modulative shadowing technique in use? */
+		virtual bool isShadowTechniqueModulative(void) const 
+		{ return (mShadowTechnique & SHADOWDETAILTYPE_MODULATIVE) != 0; }
+		/** Is there an additive shadowing technique in use? */
+		virtual bool isShadowTechniqueAdditive(void) const 
+		{ return (mShadowTechnique & SHADOWDETAILTYPE_ADDITIVE) != 0; }
+		/** Is the shadow technique integrated into primary materials? */
+		virtual bool isShadowTechniqueIntegrated(void) const 
+		{ return (mShadowTechnique & SHADOWDETAILTYPE_INTEGRATED) != 0; }
+		/** Is there any shadowing technique in use? */
+		virtual bool isShadowTechniqueInUse(void) const 
+		{ return mShadowTechnique != SHADOWTYPE_NONE; }
+		/** Sets whether when using a built-in additive shadow mode, user clip
+			planes should be used to restrict light rendering.
+		*/
+		virtual void setShadowUseLightClipPlanes(bool enabled) { mShadowAdditiveLightClip = enabled; }
+		/** Gets whether when using a built-in additive shadow mode, user clip
+		planes should be used to restrict light rendering.
+		*/
+		virtual bool getShadowUseLightClipPlanes() const { return mShadowAdditiveLightClip; }
+
+		/** Sets the active compositor chain of the current scene being rendered.
+			@note CompositorChain does this automatically, no need to call manually.
+		*/
+		virtual void _setActiveCompositorChain(CompositorChain* chain) { mActiveCompositorChain = chain; }
+
+		/** Sets whether to use late material resolving or not. If set, materials will be resolved
+			from the materials at the pass-setting stage and not at the render queue building stage.
+			This is useful when the active material scheme during the render queue building stage
+			is different from the one during the rendering stage.
+		*/
+		virtual void setLateMaterialResolving(bool isLate) { mLateMaterialResolving = isLate; }
+		
+		/** Gets whether using late material resolving or not.
+			@see setLateMaterialResolving */
+		virtual bool isLateMaterialResolving() const { return mLateMaterialResolving; }
+
+		/** Gets the active compositor chain of the current scene being rendered */
+		virtual CompositorChain* _getActiveCompositorChain() const { return mActiveCompositorChain; }
+
+		/** Add a listener which will get called back on scene manager events.
+		*/
+		virtual void addListener(Listener* s);
+		/** Remove a listener
+		*/
+		virtual void removeListener(Listener* s);
+
+		/** Creates a StaticGeometry instance suitable for use with this
+			SceneManager.
+		@remarks
+			StaticGeometry is a way of batching up geometry into a more 
+			efficient form at the expense of being able to move it. Please 
+			read the StaticGeometry class documentation for full information.
+		@param name The name to give the new object
+		@return The new StaticGeometry instance
+		*/
+		virtual StaticGeometry* createStaticGeometry(const String& name);
+		/** Retrieve a previously created StaticGeometry instance. 
+		@note Throws an exception if the named instance does not exist
+		*/
+		virtual StaticGeometry* getStaticGeometry(const String& name) const;
+		/** Returns whether a static geometry instance with the given name exists. */
+		virtual bool hasStaticGeometry(const String& name) const;
+		/** Remove & destroy a StaticGeometry instance. */
+		virtual void destroyStaticGeometry(StaticGeometry* geom);
+		/** Remove & destroy a StaticGeometry instance. */
+		virtual void destroyStaticGeometry(const String& name);
+		/** Remove & destroy all StaticGeometry instances. */
+		virtual void destroyAllStaticGeometry(void);
+
+		/** Creates a InstancedGeometry instance suitable for use with this
+			SceneManager.
+		@remarks
+			InstancedGeometry is a way of batching up geometry into a more 
+			efficient form, and still be able to move it. Please 
+			read the InstancedGeometry class documentation for full information.
+		@param name The name to give the new object
+		@return The new InstancedGeometry instance
+		*/
+		virtual InstancedGeometry* createInstancedGeometry(const String& name);
+		/** Retrieve a previously created InstancedGeometry instance. */
+		virtual InstancedGeometry* getInstancedGeometry(const String& name) const;
+		/** Remove & destroy a InstancedGeometry instance. */
+		virtual void destroyInstancedGeometry(InstancedGeometry* geom);
+		/** Remove & destroy a InstancedGeometry instance. */
+		virtual void destroyInstancedGeometry(const String& name);
+		/** Remove & destroy all InstancedGeometry instances. */
+		virtual void destroyAllInstancedGeometry(void);
+
+		/** Creates an InstanceManager interface to create & manipulate instanced entities
+			You need to call this function at least once before start calling createInstancedEntity
+			to build up an instance based on the given mesh.
+		@remarks
+			Instancing is a way of batching up geometry into a much more 
+			efficient form, but with some limitations, and still be able to move & animate it.
+			Please @see InstanceManager class documentation for full information.
+		@param customName Custom name for referencing. Must be unique
+		@param meshName The mesh name the instances will be based upon
+		@param groupName The resource name where the mesh lives
+		@param technique Technique to use, which may be shader based, or hardware based.
+		@param numInstancesPerBatch Suggested number of instances per batch. The actual number
+		may end up being lower if the technique doesn't support having so many. It can't be zero
+		@param flags Flags to pass to the InstanceManager @see InstanceManagerFlags
+		@param subMeshIdx InstanceManager only supports using one submesh from the base mesh. This parameter
+		says which submesh to pick (must be <= Mesh::getNumSubMeshes())
+		@return The new InstanceManager instance
+		*/
+		virtual InstanceManager* createInstanceManager( const String &customName, const String &meshName,
+														const String &groupName,
+														InstanceManager::InstancingTechnique technique,
+														size_t numInstancesPerBatch, uint16 flags=0,
+														unsigned short subMeshIdx=0 );
+
+		/** Retrieves an existing InstanceManager by it's name.
+		@note Throws an exception if the named InstanceManager does not exist
+		*/
+		virtual InstanceManager* getInstanceManager( const String &managerName ) const;
+
+    /** Returns whether an InstanceManager with the given name exists. */
+    virtual bool hasInstanceManager( const String &managerName ) const;
+
+		/** Destroys an InstanceManager <b>if</b> it was created with createInstanceManager()
+		@remarks
+			Be sure you don't have any InstancedEntity referenced somewhere which was created with
+			this manager, since it will become a dangling pointer.
+		@param name Name of the manager to remove
+		*/
+		virtual void destroyInstanceManager( const String &name );
+		virtual void destroyInstanceManager( InstanceManager *instanceManager );
+
+		virtual void destroyAllInstanceManagers(void);
+
+		/** @see InstanceManager::getMaxOrBestNumInstancesPerBatch
+		@remarks
+			If you've already created an InstanceManager, you can call it's
+			getMaxOrBestNumInstancesPerBatch() function directly.
+			Another (not recommended) way to know if the technique is unsupported is by creating
+			an InstanceManager and use createInstancedEntity, which will return null pointer.
+			The input parameter "numInstancesPerBatch" is a suggested value when using IM_VTFBESTFIT
+			flag (in that case it should be non-zero)
+		@return
+			The ideal (or maximum, depending on flags) number of instances per batch for
+			the given technique. Zero if technique is unsupported or errors were spotted
+		*/
+		virtual size_t getNumInstancesPerBatch( const String &meshName, const String &groupName,
+												const String &materialName,
+												InstanceManager::InstancingTechnique technique,
+												size_t numInstancesPerBatch, uint16 flags=0,
+												unsigned short subMeshIdx=0 );
+
+		/** Creates an InstancedEntity based on an existing InstanceManager (@see createInstanceManager)
+		@remarks
+			* Return value may be null if the InstanceManger technique isn't supported
+			* Try to keep the number of entities with different materials <b>to a minimum</b>
+			* For more information @see InstancedManager @see InstancedBatch, @see InstancedEntity
+			* Alternatively you can call InstancedManager::createInstanceEntity using the returned
+			pointer from createInstanceManager
+		@param materialName Material name 
+		@param managerName Name of the instance manager
+		@return An InstancedEntity ready to be attached to a SceneNode
+		*/
+		virtual InstancedEntity* createInstancedEntity( const String &materialName,
+														const String &managerName );
+
+		/** Removes an InstancedEntity, @see SceneManager::createInstancedEntity &
+			@see InstanceBatch::removeInstancedEntity
+		@param instancedEntity Instance to remove
+		*/
+		virtual void destroyInstancedEntity( InstancedEntity *instancedEntity );
+
+		/** Called by an InstanceManager when it has at least one InstanceBatch that needs their bounds
+			to be updated for proper culling
+			@param dirtyManager The manager with dirty batches to update
+		*/
+		void _addDirtyInstanceManager( InstanceManager *dirtyManager );
+
+		/** Create a movable object of the type specified.
+		@remarks
+			This is the generalised form of MovableObject creation where you can
+			create a MovableObject of any specialised type generically, including
+			any new types registered using plugins.
+		@param name The name to give the object. Must be unique within type.
+		@param typeName The type of object to create
+		@param params Optional name/value pair list to give extra parameters to
+			the created object.
+		*/
+		virtual MovableObject* createMovableObject(const String& name, 
+			const String& typeName, const NameValuePairList* params = 0);
+		/** Create a movable object of the type specified without a name.
+		@remarks
+		This is the generalised form of MovableObject creation where you can
+		create a MovableObject of any specialised type generically, including
+		any new types registered using plugins. The name is generated automatically.
+		@param typeName The type of object to create
+		@param params Optional name/value pair list to give extra parameters to
+		the created object.
+		*/
+		virtual MovableObject* createMovableObject(const String& typeName, const NameValuePairList* params = 0);
+		/** Destroys a MovableObject with the name specified, of the type specified.
+		@remarks
+			The MovableObject will automatically detach itself from any nodes
+			on destruction.
+		*/
+		virtual void destroyMovableObject(const String& name, const String& typeName);
+		/** Destroys a MovableObject.
+		@remarks
+			The MovableObject will automatically detach itself from any nodes
+			on destruction.
+		*/
+		virtual void destroyMovableObject(MovableObject* m);
+		/** Destroy all MovableObjects of a given type. */
+		virtual void destroyAllMovableObjectsByType(const String& typeName);
+		/** Destroy all MovableObjects. */
+		virtual void destroyAllMovableObjects(void);
+		/** Get a reference to a previously created MovableObject. 
+		@note Throws an exception if the named instance does not exist
+		*/
+		virtual MovableObject* getMovableObject(const String& name, const String& typeName) const;
+		/** Returns whether a movable object instance with the given name exists. */
+		virtual bool hasMovableObject(const String& name, const String& typeName) const;
+		typedef MapIterator<MovableObjectMap> MovableObjectIterator;
+		/** Get an iterator over all MovableObect instances of a given type. 
+		@note
+			The iterator returned from this method is not thread safe, do not use this
+			if you are creating or deleting objects of this type in another thread.
+		*/
+		virtual MovableObjectIterator getMovableObjectIterator(const String& typeName);
+		/** Inject a MovableObject instance created externally.
+		@remarks
+			This method 'injects' a MovableObject instance created externally into
+			the MovableObject instance registry held in the SceneManager. You
+			might want to use this if you have a MovableObject which you don't
+			want to register a factory for; for example a MovableObject which 
+			cannot be generally constructed by clients. 
+		@note
+			It is important that the MovableObject has a unique name for the type,
+			and that its getMovableType() method returns a proper type name.
+		*/
+		virtual void injectMovableObject(MovableObject* m);
+		/** Extract a previously injected MovableObject.
+		@remarks
+			Essentially this does the same as destroyMovableObject, but only
+			removes the instance from the internal lists, it does not attempt
+			to destroy it.
+		*/
+		virtual void extractMovableObject(const String& name, const String& typeName);
+		/** Extract a previously injected MovableObject.
+		@remarks
+			Essentially this does the same as destroyMovableObject, but only
+			removes the instance from the internal lists, it does not attempt
+			to destroy it.
+		*/
+		virtual void extractMovableObject(MovableObject* m);
+		/** Extract all injected MovableObjects of a given type.
+		@remarks
+			Essentially this does the same as destroyAllMovableObjectsByType, 
+			but only removes the instances from the internal lists, it does not 
+			attempt to destroy them.
+		*/
+		virtual void extractAllMovableObjectsByType(const String& typeName);
+
+		/** Sets a mask which is bitwise 'and'ed with objects own visibility masks
+			to determine if the object is visible.
+		@remarks
+			Note that this is combined with any per-viewport visibility mask
+			through an 'and' operation. @see Viewport::setVisibilityMask
+		*/
+		virtual void setVisibilityMask(uint32 vmask) { mVisibilityMask = vmask; }
+
+		/** Gets a mask which is bitwise 'and'ed with objects own visibility masks
+			to determine if the object is visible.
+		*/
+		virtual uint32 getVisibilityMask(void) { return mVisibilityMask; }
+
+		/** Internal method for getting the combination between the global visibility
+			mask and the per-viewport visibility mask.
+		*/
+		uint32 _getCombinedVisibilityMask(void) const;
+
+		/** Sets whether the SceneManager should search for visible objects, or
+            whether they are being manually handled.
+        @remarks
+            This is an advanced function, you should not use this unless you know
+            what you are doing.
+		*/
+		virtual void setFindVisibleObjects(bool find) { mFindVisibleObjects = find; }
+
+		/** Gets whether the SceneManager should search for visible objects, or
+            whether they are being manually handled.
+ 		*/
+		virtual bool getFindVisibleObjects(void) { return mFindVisibleObjects; }
+
+		/** Set whether to automatically normalise normals on objects whenever they
+			are scaled.
+		@remarks
+			Scaling can distort normals so the default behaviour is to compensate
+			for this, but it has a cost. If you would prefer to manually manage 
+			this, set this option to 'false' and use Pass::setNormaliseNormals
+			only when needed.
+		*/
+		virtual void setNormaliseNormalsOnScale(bool n) { mNormaliseNormalsOnScale = n; }
+
+		/** Get whether to automatically normalise normals on objects whenever they
+			are scaled.
+		*/
+		virtual bool getNormaliseNormalsOnScale() const { return mNormaliseNormalsOnScale; }
+
+		/** Set whether to automatically flip the culling mode on objects whenever they
+			are negatively scaled.
+		@remarks
+			Negativelyl scaling an object has the effect of flipping the triangles, 
+			so the culling mode should probably be inverted to deal with this. 
+			If you would prefer to manually manage this, set this option to 'false' 
+			and use different materials with Pass::setCullingMode set manually as needed.
+		*/
+		virtual void setFlipCullingOnNegativeScale(bool n) { mFlipCullingOnNegativeScale = n; }
+
+		/** Get whether to automatically flip the culling mode on objects whenever they
+			are negatively scaled.
+		*/
+		virtual bool getFlipCullingOnNegativeScale() const { return mFlipCullingOnNegativeScale; }
+
+		/** Render something as if it came from the current queue.
+			@param pass		Material pass to use for setting up this quad.
+			@param rend		Renderable to render
+			@param shadowDerivation Whether passes should be replaced with shadow caster / receiver passes
+		 */
+		virtual void _injectRenderWithPass(Pass *pass, Renderable *rend, bool shadowDerivation = true,
+			bool doLightIteration = false, const LightList* manualLightList = 0);
+
+		/** Indicates to the SceneManager whether it should suppress changing
+			the RenderSystem states when rendering objects.
+		@remarks
+			This method allows you to tell the SceneManager not to change any
+			RenderSystem state until you tell it to. This method is only 
+			intended for advanced use, don't use it if you're unsure of the 
+			effect. The only RenderSystems calls made are to set the world 
+			matrix for each object (note - view an projection matrices are NOT
+			SET - they are under your control) and to render the object; it is up to 
+			the caller to do everything else, including enabling any vertex / 
+			fragment programs and updating their parameter state, and binding
+			parameters to the RenderSystem.
+		@note
+			Calling this implicitly disables shadow processing since no shadows
+			can be rendered without changing state.
+		@param suppress If true, no RenderSystem state changes will be issued
+			until this method is called again with a parameter of false.
+		*/
+		virtual void _suppressRenderStateChanges(bool suppress);
+		
+		/** Are render state changes suppressed? 
+		@see _suppressRenderStateChanges
+		*/
+		virtual bool _areRenderStateChangesSuppressed(void) const
+		{ return mSuppressRenderStateChanges; }
+
+        /** Internal method for setting up the renderstate for a rendering pass.
+            @param pass The Pass details to set.
+			@param evenIfSuppressed Sets the pass details even if render state
+				changes are suppressed; if you are using this to manually set state
+				when render state changes are suppressed, you should set this to 
+				true.
+			@param shadowDerivation If false, disables the derivation of shadow
+				passes from original passes
+            @return
+                A Pass object that was used instead of the one passed in, can
+                happen when rendering shadow passes
+        */
+        virtual const Pass* _setPass(const Pass* pass, 
+			bool evenIfSuppressed = false, bool shadowDerivation = true);
+		
+		/** Method to allow you to mark gpu parameters as dirty, causing them to 
+			be updated according to the mask that you set when updateGpuProgramParameters is
+			next called. Only really useful if you're controlling parameter state in 
+			inner rendering loop callbacks.
+			@param mask Some combination of GpuParamVariability which is bitwise OR'ed with the
+				current dirty state.
+		*/
+		virtual void _markGpuParamsDirty(uint16 mask);
+
+
+		/** Indicates to the SceneManager whether it should suppress the 
+			active shadow rendering technique until told otherwise.
+		@remarks
+			This is a temporary alternative to setShadowTechnique to suppress
+			the rendering of shadows and forcing all processing down the 
+			standard rendering path. This is intended for internal use only.
+		@param suppress If true, no shadow rendering will occur until this
+			method is called again with a parameter of false.
+		*/
+		virtual void _suppressShadows(bool suppress); 
+
+		/** Are shadows suppressed? 
+		@see _suppressShadows
+		*/
+		virtual bool _areShadowsSuppressed(void) const
+		{ return mSuppressShadows; }
+
+		/** Render the objects in a given queue group 
+		@remarks You should only call this from a RenderQueueInvocation implementation
+		*/
+		virtual void _renderQueueGroupObjects(RenderQueueGroup* group, 
+			QueuedRenderableCollection::OrganisationMode om);
+
+		/** Advanced method for supplying an alternative visitor, used for parsing the
+			render queues and sending the results to the renderer.
+		@remarks
+			You can use this method to insert your own implementation of the 
+			QueuedRenderableVisitor interface, which receives calls as the queued
+			renderables are parsed in a given order (determined by RenderQueueInvocationSequence)
+			and are sent to the renderer. If you provide your own implementation of
+			this visitor, you are responsible for either calling the rendersystem, 
+			or passing the calls on to the base class implementation.
+		@note
+			Ownership is not taken of this pointer, you are still required to 
+			delete it yourself once you're finished.
+		@param visitor Your implementation of SceneMgrQueuedRenderableVisitor. 
+			If you pass 0, the default implementation will be used.
+		*/
+		void setQueuedRenderableVisitor(SceneMgrQueuedRenderableVisitor* visitor);
+
+		/** Gets the current visitor object which processes queued renderables. */
+		SceneMgrQueuedRenderableVisitor* getQueuedRenderableVisitor(void) const;
+
+
+		/** Get the rendersystem subclass to which the output of this Scene Manager
+			gets sent
+		*/
+		RenderSystem *getDestinationRenderSystem();
+
+		/** Gets the current viewport being rendered (advanced use only, only 
+			valid during viewport update. */
+		Viewport* getCurrentViewport(void) const { return mCurrentViewport; }
+
+		/** Returns a visibility boundary box for a specific camera. */
+		const VisibleObjectsBoundsInfo& getVisibleObjectsBoundsInfo(const Camera* cam) const;
+
+		/**  Returns the shadow caster AAB for a specific light-camera combination */
+		const VisibleObjectsBoundsInfo& getShadowCasterBoundsInfo(const Light* light, size_t iteration = 0) const;
+
+		/** Set whether to use camera-relative co-ordinates when rendering, ie
+			to always place the camera at the origin and move the world around it.
+		@remarks
+			This is a technique to alleviate some of the precision issues associated with 
+			rendering far from the origin, where single-precision floats as used in most
+			GPUs begin to lose their precision. Instead of including the camera
+			translation in the view matrix, it only includes the rotation, and
+			the world matrices of objects must be expressed relative to this.
+		@note
+			If you need this option, you will probably also need to enable double-precision
+			mode in Ogre (OGRE_DOUBLE_PRECISION), since even though this will 
+			alleviate the rendering precision, the source camera and object positions will still 
+			suffer from precision issues leading to jerky movement. 
+		*/
+		virtual void setCameraRelativeRendering(bool rel) { mCameraRelativeRendering = rel; }
+
+		/** Get whether to use camera-relative co-ordinates when rendering, ie
+			to always place the camera at the origin and move the world around it.
+		*/
+		virtual bool getCameraRelativeRendering() const { return mCameraRelativeRendering; }
+
+
+        /** Add a level of detail listener. */
+        void addLodListener(LodListener *listener);
+
+        /**
+        Remove a level of detail listener.
+        @remarks
+            Do not call from inside an LodListener callback method.
+        */
+        void removeLodListener(LodListener *listener);
+
+        /** Notify that a movable object LOD change event has occurred. */
+        void _notifyMovableObjectLodChanged(MovableObjectLodChangedEvent& evt);
+
+        /** Notify that an entity mesh LOD change event has occurred. */
+        void _notifyEntityMeshLodChanged(EntityMeshLodChangedEvent& evt);
+
+        /** Notify that an entity material LOD change event has occurred. */
+        void _notifyEntityMaterialLodChanged(EntityMaterialLodChangedEvent& evt);
+
+        /** Handle LOD events. */
+        void _handleLodEvents();
+
+		IlluminationRenderStage _getCurrentRenderStage() {return mIlluminationStage;}
+    };
+
+    /** Default implementation of IntersectionSceneQuery. */
+    class _OgreExport DefaultIntersectionSceneQuery : 
+        public IntersectionSceneQuery
+    {
+    public:
+        DefaultIntersectionSceneQuery(SceneManager* creator);
+        ~DefaultIntersectionSceneQuery();
+
+        /** See IntersectionSceneQuery. */
+        void execute(IntersectionSceneQueryListener* listener);
+    };
+
+    /** Default implementation of RaySceneQuery. */
+	class _OgreExport DefaultRaySceneQuery : public RaySceneQuery
+    {
+    public:
+        DefaultRaySceneQuery(SceneManager* creator);
+        ~DefaultRaySceneQuery();
+
+        /** See RayScenQuery. */
+        void execute(RaySceneQueryListener* listener);
+    };
+    /** Default implementation of SphereSceneQuery. */
+	class _OgreExport DefaultSphereSceneQuery : public SphereSceneQuery
+    {
+    public:
+        DefaultSphereSceneQuery(SceneManager* creator);
+        ~DefaultSphereSceneQuery();
+
+        /** See SceneQuery. */
+        void execute(SceneQueryListener* listener);
+    };
+    /** Default implementation of PlaneBoundedVolumeListSceneQuery. */
+    class _OgreExport DefaultPlaneBoundedVolumeListSceneQuery : public PlaneBoundedVolumeListSceneQuery
+    {
+    public:
+        DefaultPlaneBoundedVolumeListSceneQuery(SceneManager* creator);
+        ~DefaultPlaneBoundedVolumeListSceneQuery();
+
+        /** See SceneQuery. */
+        void execute(SceneQueryListener* listener);
+    };
+    /** Default implementation of AxisAlignedBoxSceneQuery. */
+	class _OgreExport DefaultAxisAlignedBoxSceneQuery : public AxisAlignedBoxSceneQuery
+    {
+    public:
+        DefaultAxisAlignedBoxSceneQuery(SceneManager* creator);
+        ~DefaultAxisAlignedBoxSceneQuery();
+
+        /** See RayScenQuery. */
+        void execute(SceneQueryListener* listener);
+    };
+    
+
+	/// Bitmask containing scene types
+	typedef uint16 SceneTypeMask;
+
+	/** Classification of a scene to allow a decision of what type of
+	SceenManager to provide back to the application.
+	*/
+	enum SceneType
+	{
+		ST_GENERIC = 1,
+		ST_EXTERIOR_CLOSE = 2,
+		ST_EXTERIOR_FAR = 4,
+		ST_EXTERIOR_REAL_FAR = 8,
+		ST_INTERIOR = 16
+	};
+
+	/** Structure containing information about a scene manager. */
+	struct SceneManagerMetaData
+	{
+		/// A globally unique string identifying the scene manager type
+		String typeName;
+		/// A text description of the scene manager
+		String description;
+		/// A mask describing which sorts of scenes this manager can handle
+		SceneTypeMask sceneTypeMask;
+		/// Flag indicating whether world geometry is supported
+		bool worldGeometrySupported;
+	};
+
+
+
+	/** Class which will create instances of a given SceneManager. */
+	class _OgreExport SceneManagerFactory : public SceneMgtAlloc
+	{
+	protected:
+		mutable SceneManagerMetaData mMetaData;
+		mutable bool mMetaDataInit;
+		/// Internal method to initialise the metadata, must be implemented
+		virtual void initMetaData(void) const = 0;
+	public:
+		SceneManagerFactory() : mMetaDataInit(true) {}
+		virtual ~SceneManagerFactory() {}
+		/** Get information about the SceneManager type created by this factory. */
+		virtual const SceneManagerMetaData& getMetaData(void) const 
+		{
+			if (mMetaDataInit)
+			{
+				initMetaData();
+				mMetaDataInit = false;
+			}
+			return mMetaData; 
+		}
+		/** Create a new instance of a SceneManager.
+		@remarks
+		Don't call directly, use SceneManagerEnumerator::createSceneManager.
+		*/
+		virtual SceneManager* createInstance(const String& instanceName) = 0;
+		/** Destroy an instance of a SceneManager. */
+		virtual void destroyInstance(SceneManager* instance) = 0;
+
+	};
+
+	/** @} */
+	/** @} */
+
+
+} // Namespace
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreSceneManagerEnumerator.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreSceneManagerEnumerator.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreSceneManagerEnumerator.h	(revision 148)
@@ -0,0 +1,236 @@
+/*
+-----------------------------------------------------------------------------
+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 __SceneManagerEnumerator_H__
+#define __SceneManagerEnumerator_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreSceneManager.h"
+#include "OgreSingleton.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+    
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Scene
+	*  @{
+	*/
+	/// Factory for default scene manager
+	class _OgreExport DefaultSceneManagerFactory : public SceneManagerFactory
+	{
+	protected:
+		void initMetaData(void) const;
+	public:
+		DefaultSceneManagerFactory() {}
+		~DefaultSceneManagerFactory() {}
+		/// Factory type name
+		static const String FACTORY_TYPE_NAME;
+		SceneManager* createInstance(const String& instanceName);
+		void destroyInstance(SceneManager* instance);
+	};
+	/// Default scene manager
+	class _OgreExport DefaultSceneManager : public SceneManager
+	{
+	public:
+		DefaultSceneManager(const String& name);
+		~DefaultSceneManager();
+		const String& getTypeName(void) const;
+	};
+
+    /** Enumerates the SceneManager classes available to applications.
+        @remarks
+            As described in the SceneManager class, SceneManagers are responsible
+            for organising the scene and issuing rendering commands to the
+            RenderSystem. Certain scene types can benefit from different
+            rendering approaches, and it is intended that subclasses will
+            be created to special case this.
+        @par
+            In order to give applications easy access to these implementations,
+            this class has a number of methods to create or retrieve a SceneManager
+            which is appropriate to the scene type. 
+		@par
+			SceneManagers are created by SceneManagerFactory instances. New factories
+			for new types of SceneManager can be registered with this class to make
+			them available to clients.
+		@par
+			Note that you can still plug in your own custom SceneManager without
+			using a factory, should you choose, it's just not as flexible that way.
+			Just instantiate your own SceneManager manually and use it directly.
+    */
+    class _OgreExport SceneManagerEnumerator : public Singleton<SceneManagerEnumerator>, public SceneMgtAlloc
+    {
+	public:
+		/// Scene manager instances, indexed by instance name
+		typedef map<String, SceneManager*>::type Instances;
+		/// List of available scene manager types as meta data
+		typedef vector<const SceneManagerMetaData*>::type MetaDataList;
+    private:
+		/// Scene manager factories
+		typedef list<SceneManagerFactory*>::type Factories;
+		Factories mFactories;
+		Instances mInstances;
+		/// Stored separately to allow iteration
+		MetaDataList mMetaDataList;
+		/// Factory for default scene manager
+		DefaultSceneManagerFactory mDefaultFactory;
+		/// Count of creations for auto-naming
+		unsigned long mInstanceCreateCount;
+		/// Currently assigned render system
+		RenderSystem* mCurrentRenderSystem;
+
+
+    public:
+        SceneManagerEnumerator();
+        ~SceneManagerEnumerator();
+
+		/** Register a new SceneManagerFactory. 
+		@remarks
+			Plugins should call this to register as new SceneManager providers.
+		*/
+		void addFactory(SceneManagerFactory* fact);
+
+		/** Remove a SceneManagerFactory. 
+		*/
+		void removeFactory(SceneManagerFactory* fact);
+
+		/** Get more information about a given type of SceneManager.
+		@remarks
+			The metadata returned tells you a few things about a given type 
+			of SceneManager, which can be created using a factory that has been
+			registered already. 
+		@param typeName The type name of the SceneManager you want to enquire on.
+			If you don't know the typeName already, you can iterate over the 
+			metadata for all types using getMetaDataIterator.
+		*/
+		const SceneManagerMetaData* getMetaData(const String& typeName) const;
+
+		typedef ConstVectorIterator<MetaDataList> MetaDataIterator;
+		/** Iterate over all types of SceneManager available for construction, 
+			providing some information about each one.
+		*/
+		MetaDataIterator getMetaDataIterator(void) const;
+
+		/** Create a SceneManager instance of a given type.
+		@remarks
+			You can use this method to create a SceneManager instance of a 
+			given specific type. You may know this type already, or you may
+			have discovered it by looking at the results from getMetaDataIterator.
+		@note
+			This method throws an exception if the named type is not found.
+		@param typeName String identifying a unique SceneManager type
+		@param instanceName Optional name to given the new instance that is
+			created. If you leave this blank, an auto name will be assigned.
+		*/
+		SceneManager* createSceneManager(const String& typeName, 
+			const String& instanceName = StringUtil::BLANK);
+
+		/** Create a SceneManager instance based on scene type support.
+		@remarks
+			Creates an instance of a SceneManager which supports the scene types
+			identified in the parameter. If more than one type of SceneManager 
+			has been registered as handling that combination of scene types, 
+			in instance of the last one registered is returned.
+		@note This method always succeeds, if a specific scene manager is not
+			found, the default implementation is always returned.
+		@param typeMask A mask containing one or more SceneType flags
+		@param instanceName Optional name to given the new instance that is
+			created. If you leave this blank, an auto name will be assigned.
+		*/
+		SceneManager* createSceneManager(SceneTypeMask typeMask, 
+			const String& instanceName = StringUtil::BLANK);
+
+		/** Destroy an instance of a SceneManager. */
+		void destroySceneManager(SceneManager* sm);
+
+		/** Get an existing SceneManager instance that has already been created,
+			identified by the instance name.
+		@param instanceName The name of the instance to retrieve.
+		*/
+		SceneManager* getSceneManager(const String& instanceName) const;
+
+		/** Identify if a SceneManager instance already exists.
+		@param instanceName The name of the instance to retrieve.
+		*/
+		bool hasSceneManager(const String& instanceName) const;
+
+		typedef MapIterator<Instances> SceneManagerIterator;
+		/** Get an iterator over all the existing SceneManager instances. */
+		SceneManagerIterator getSceneManagerIterator(void);
+
+        /** Notifies all SceneManagers of the destination rendering system.
+        */
+        void setRenderSystem(RenderSystem* rs);
+
+        /// Utility method to control shutdown of the managers
+        void shutdownAll(void);
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static SceneManagerEnumerator& getSingleton(void);
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static SceneManagerEnumerator* getSingletonPtr(void);
+
+    };
+
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreSceneNode.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreSceneNode.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreSceneNode.h	(revision 148)
@@ -0,0 +1,475 @@
+/*
+-----------------------------------------------------------------------------
+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 _SceneNode_H__
+#define _SceneNode_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreNode.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreAxisAlignedBox.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	// forward decl
+	struct VisibleObjectsBoundsInfo;
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Scene
+	*  @{
+	*/
+	/** Class representing a node in the scene graph.
+        @remarks
+            A SceneNode is a type of Node which is used to organise objects in a scene.
+            It has the same hierarchical transformation properties of the generic Node class,
+            but also adds the ability to attach world objects to the node, and stores hierarchical
+            bounding volumes of the nodes in the tree.
+            Child nodes are contained within the bounds of the parent, and so on down the
+            tree, allowing for fast culling.
+    */
+    class _OgreExport SceneNode : public Node
+    {
+    public:
+        typedef HashMap<String, MovableObject*> ObjectMap;
+        typedef MapIterator<ObjectMap> ObjectIterator;
+		typedef ConstMapIterator<ObjectMap> ConstObjectIterator;
+
+    protected:
+        ObjectMap mObjectsByName;
+
+		/// Pointer to a Wire Bounding Box for this Node
+		WireBoundingBox *mWireBoundingBox;
+		/// Flag that determines if the bounding box of the node should be displayed
+		bool mShowBoundingBox;
+        bool mHideBoundingBox;
+
+        /// SceneManager which created this node
+        SceneManager* mCreator;
+
+        /// World-Axis aligned bounding box, updated only through _update
+        AxisAlignedBox mWorldAABB;
+
+        /** @copydoc Node::updateFromParentImpl. */
+        void updateFromParentImpl(void) const;
+
+        /** See Node. */
+        Node* createChildImpl(void);
+
+        /** See Node. */
+        Node* createChildImpl(const String& name);
+
+		/** See Node */
+		void setParent(Node* parent);
+
+		/** Internal method for setting whether the node is in the scene 
+			graph.
+		*/
+		virtual void setInSceneGraph(bool inGraph);
+
+        /// Whether to yaw around a fixed axis.
+        bool mYawFixed;
+        /// Fixed axis to yaw around
+        Vector3 mYawFixedAxis;
+
+        /// Auto tracking target
+        SceneNode* mAutoTrackTarget;
+        /// Tracking offset for fine tuning
+        Vector3 mAutoTrackOffset;
+        /// Local 'normal' direction vector
+        Vector3 mAutoTrackLocalDirection;
+		/// Is this node a current part of the scene graph?
+		bool mIsInSceneGraph;
+    public:
+        /** Constructor, only to be called by the creator SceneManager.
+        @remarks
+            Creates a node with a generated name.
+        */
+        SceneNode(SceneManager* creator);
+        /** Constructor, only to be called by the creator SceneManager.
+        @remarks
+            Creates a node with a specified name.
+        */
+        SceneNode(SceneManager* creator, const String& name);
+        ~SceneNode();
+
+        /** Adds an instance of a scene object to this node.
+        @remarks
+            Scene objects can include Entity objects, Camera objects, Light objects, 
+            ParticleSystem objects etc. Anything that subclasses from MovableObject.
+        */
+        virtual void attachObject(MovableObject* obj);
+
+        /** Reports the number of objects attached to this node.
+        */
+        virtual unsigned short numAttachedObjects(void) const;
+
+        /** Retrieves a pointer to an attached object.
+        @remarks Retrieves by index, see alternate version to retrieve by name. The index
+        of an object may change as other objects are added / removed.
+        */
+        virtual MovableObject* getAttachedObject(unsigned short index);
+
+        /** Retrieves a pointer to an attached object.
+        @remarks Retrieves by object name, see alternate version to retrieve by index.
+        */
+        virtual MovableObject* getAttachedObject(const String& name);
+
+        /** Detaches the indexed object from this scene node.
+        @remarks
+            Detaches by index, see the alternate version to detach by name. Object indexes
+            may change as other objects are added / removed.
+        */
+        virtual MovableObject* detachObject(unsigned short index);
+        /** Detaches an object by pointer. */
+        virtual void detachObject(MovableObject* obj);
+
+        /** Detaches the named object from this node and returns a pointer to it. */
+        virtual MovableObject* detachObject(const String& name);
+
+        /** Detaches all objects attached to this node.
+        */
+        virtual void detachAllObjects(void);
+
+		/** Determines whether this node is in the scene graph, i.e.
+			whether it's ultimate ancestor is the root scene node.
+		*/
+		virtual bool isInSceneGraph(void) const { return mIsInSceneGraph; }
+
+		/** Notifies this SceneNode that it is the root scene node. 
+		@remarks
+			Only SceneManager should call this!
+		*/
+		virtual void _notifyRootNode(void) { mIsInSceneGraph = true; }
+			
+
+        /** Internal method to update the Node.
+            @note
+                Updates this scene node and any relevant children to incorporate transforms etc.
+                Don't call this yourself unless you are writing a SceneManager implementation.
+            @param
+                updateChildren If true, the update cascades down to all children. Specify false if you wish to
+                update children separately, e.g. because of a more selective SceneManager implementation.
+            @param
+                parentHasChanged This flag indicates that the parent transform has changed,
+                    so the child should retrieve the parent's transform and combine it with its own
+                    even if it hasn't changed itself.
+        */
+        virtual void _update(bool updateChildren, bool parentHasChanged);
+
+		/** Tells the SceneNode to update the world bound info it stores.
+		*/
+		virtual void _updateBounds(void);
+
+        /** Internal method which locates any visible objects attached to this node and adds them to the passed in queue.
+            @remarks
+                Should only be called by a SceneManager implementation, and only after the _updat method has been called to
+                ensure transforms and world bounds are up to date.
+                SceneManager implementations can choose to let the search cascade automatically, or choose to prevent this
+                and select nodes themselves based on some other criteria.
+            @param
+                cam The active camera
+            @param
+                queue The SceneManager's rendering queue
+			@param
+				visibleBounds bounding information created on the fly containing all visible objects by the camera
+            @param
+                includeChildren If true, the call is cascaded down to all child nodes automatically.
+            @param
+                displayNodes If true, the nodes themselves are rendered as a set of 3 axes as well
+                    as the objects being rendered. For debugging purposes.
+        */
+		virtual void _findVisibleObjects(Camera* cam, RenderQueue* queue, 
+			VisibleObjectsBoundsInfo* visibleBounds, 
+            bool includeChildren = true, bool displayNodes = false, bool onlyShadowCasters = false);
+
+        /** Gets the axis-aligned bounding box of this node (and hence all subnodes).
+        @remarks
+            Recommended only if you are extending a SceneManager, because the bounding box returned
+            from this method is only up to date after the SceneManager has called _update.
+        */
+        virtual const AxisAlignedBox& _getWorldAABB(void) const;
+
+        /** Retrieves an iterator which can be used to efficiently step through the objects 
+            attached to this node.
+        @remarks
+            This is a much faster way to go through <B>all</B> the objects attached to the node
+            than using getAttachedObject. But the iterator returned is only valid until a change
+            is made to the collection (ie an addition or removal) so treat the returned iterator
+            as transient, and don't add / remove items as you go through the iterator, save changes
+            until the end, or retrieve a new iterator after making the change. Making changes to
+            the object returned through the iterator is OK though.
+        */
+        virtual ObjectIterator getAttachedObjectIterator(void);
+        /** Retrieves an iterator which can be used to efficiently step through the objects 
+            attached to this node.
+        @remarks
+            This is a much faster way to go through <B>all</B> the objects attached to the node
+            than using getAttachedObject. But the iterator returned is only valid until a change
+            is made to the collection (ie an addition or removal) so treat the returned iterator
+            as transient, and don't add / remove items as you go through the iterator, save changes
+            until the end, or retrieve a new iterator after making the change. Making changes to
+            the object returned through the iterator is OK though.
+        */
+		virtual ConstObjectIterator getAttachedObjectIterator(void) const;
+
+        /** Gets the creator of this scene node. 
+        @remarks
+            This method returns the SceneManager which created this node.
+            This can be useful for destroying this node.
+        */
+        SceneManager* getCreator(void) const { return mCreator; }
+
+        /** This method removes and destroys the named child and all of its children.
+        @remarks
+            Unlike removeChild, which removes a single named child from this
+            node but does not destroy it, this method destroys the child
+            and all of it's children. 
+        @par
+            Use this if you wish to recursively destroy a node as well as 
+            detaching it from it's parent. Note that any objects attached to
+            the nodes will be detached but will not themselves be destroyed.
+        */
+        virtual void removeAndDestroyChild(const String& name);
+
+        /** This method removes and destroys the child and all of its children.
+        @remarks
+            Unlike removeChild, which removes a single named child from this
+            node but does not destroy it, this method destroys the child
+            and all of it's children. 
+        @par
+            Use this if you wish to recursively destroy a node as well as 
+            detaching it from it's parent. Note that any objects attached to
+            the nodes will be detached but will not themselves be destroyed.
+        */
+        virtual void removeAndDestroyChild(unsigned short index);
+
+        /** Removes and destroys all children of this node.
+        @remarks
+            Use this to destroy all child nodes of this node and remove
+            them from the scene graph. Note that all objects attached to this
+            node will be detached but will not be destroyed.
+        */
+        virtual void removeAndDestroyAllChildren(void);
+
+        /** Allows the showing of the node's bounding box.
+        @remarks
+            Use this to show or hide the bounding box of the node.
+        */
+		virtual void showBoundingBox(bool bShow);
+
+        /** Allows the overriding of the node's bounding box
+            over the SceneManager's bounding box setting.
+        @remarks
+            Use this to override the bounding box setting of the node.
+        */
+		virtual void hideBoundingBox(bool bHide);
+
+        /** Add the bounding box to the rendering queue.
+        */
+		virtual void _addBoundingBoxToQueue(RenderQueue* queue);
+
+        /** This allows scene managers to determine if the node's bounding box
+			should be added to the rendering queue.
+        @remarks
+            Scene Managers that implement their own _findVisibleObjects will have to 
+			check this flag and then use _addBoundingBoxToQueue to add the bounding box
+			wireframe.
+        */
+		virtual bool getShowBoundingBox() const;
+
+        /** Creates an unnamed new SceneNode as a child of this node.
+        @param
+            translate Initial translation offset of child relative to parent
+        @param
+            rotate Initial rotation relative to parent
+        */
+        virtual SceneNode* createChildSceneNode(
+            const Vector3& translate = Vector3::ZERO, 
+            const Quaternion& rotate = Quaternion::IDENTITY );
+
+        /** Creates a new named SceneNode as a child of this node.
+        @remarks
+            This creates a child node with a given name, which allows you to look the node up from 
+            the parent which holds this collection of nodes.
+            @param
+                translate Initial translation offset of child relative to parent
+            @param
+                rotate Initial rotation relative to parent
+        */
+        virtual SceneNode* createChildSceneNode(const String& name, const Vector3& translate = Vector3::ZERO, const Quaternion& rotate = Quaternion::IDENTITY);
+
+        /** Allows retrieval of the nearest lights to the centre of this SceneNode.
+        @remarks
+            This method allows a list of lights, ordered by proximity to the centre
+            of this SceneNode, to be retrieved. Can be useful when implementing
+            MovableObject::queryLights and Renderable::getLights.
+        @par
+            Note that only lights could be affecting the frustum will take into
+            account, which cached in scene manager.
+        @see SceneManager::_getLightsAffectingFrustum
+        @see SceneManager::_populateLightList
+        @param destList List to be populated with ordered set of lights; will be
+            cleared by this method before population.
+        @param radius Parameter to specify lights intersecting a given radius of
+            this SceneNode's centre.
+		@param lightMask The mask with which to include / exclude lights
+        */
+        virtual void findLights(LightList& destList, Real radius, uint32 lightMask = 0xFFFFFFFF) const;
+
+        /** Tells the node whether to yaw around it's own local Y axis or a fixed axis of choice.
+        @remarks
+        This method allows you to change the yaw behaviour of the node - by default, it
+        yaws around it's own local Y axis when told to yaw with TS_LOCAL, this makes it
+        yaw around a fixed axis. 
+        You only really need this when you're using auto tracking (see setAutoTracking,
+        because when you're manually rotating a node you can specify the TransformSpace
+        in which you wish to work anyway.
+        @param
+        useFixed If true, the axis passed in the second parameter will always be the yaw axis no
+        matter what the node orientation. If false, the node returns to it's default behaviour.
+        @param
+        fixedAxis The axis to use if the first parameter is true.
+        */
+        virtual void setFixedYawAxis( bool useFixed, const Vector3& fixedAxis = Vector3::UNIT_Y );
+
+		/** Rotate the node around the Y-axis.
+		*/
+		virtual void yaw(const Radian& angle, TransformSpace relativeTo = TS_LOCAL);
+        /** Sets the node's direction vector ie it's local -z.
+        @remarks
+        Note that the 'up' vector for the orientation will automatically be 
+        recalculated based on the current 'up' vector (i.e. the roll will 
+        remain the same). If you need more control, use setOrientation.
+        @param x,y,z The components of the direction vector
+        @param relativeTo The space in which this direction vector is expressed
+        @param localDirectionVector The vector which normally describes the natural
+        direction of the node, usually -Z
+        */
+        virtual void setDirection(Real x, Real y, Real z, 
+            TransformSpace relativeTo = TS_LOCAL, 
+            const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
+
+        /** Sets the node's direction vector ie it's local -z.
+        @remarks
+        Note that the 'up' vector for the orientation will automatically be 
+        recalculated based on the current 'up' vector (i.e. the roll will 
+        remain the same). If you need more control, use setOrientation.
+        @param vec The direction vector
+        @param relativeTo The space in which this direction vector is expressed
+        @param localDirectionVector The vector which normally describes the natural
+        direction of the node, usually -Z
+        */
+        virtual void setDirection(const Vector3& vec, TransformSpace relativeTo = TS_LOCAL, 
+            const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
+        /** Points the local -Z direction of this node at a point in space.
+        @param targetPoint A vector specifying the look at point.
+        @param relativeTo The space in which the point resides
+        @param localDirectionVector The vector which normally describes the natural
+        direction of the node, usually -Z
+        */
+        virtual void lookAt( const Vector3& targetPoint, TransformSpace relativeTo,
+            const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z);
+        /** Enables / disables automatic tracking of another SceneNode.
+        @remarks
+        If you enable auto-tracking, this SceneNode will automatically rotate to
+        point it's -Z at the target SceneNode every frame, no matter how 
+        it or the other SceneNode move. Note that by default the -Z points at the 
+        origin of the target SceneNode, if you want to tweak this, provide a 
+        vector in the 'offset' parameter and the target point will be adjusted.
+        @param enabled If true, tracking will be enabled and the next 
+        parameter cannot be null. If false tracking will be disabled and the 
+        current orientation will be maintained.
+        @param target Pointer to the SceneNode to track. Make sure you don't
+        delete this SceneNode before turning off tracking (e.g. SceneManager::clearScene will
+        delete it so be careful of this). Can be null if and only if the enabled param is false.
+        @param localDirectionVector The local vector considered to be the usual 'direction'
+        of the node; normally the local -Z but can be another direction.
+        @param offset If supplied, this is the target point in local space of the target node
+        instead of the origin of the target node. Good for fine tuning the look at point.
+        */
+        virtual void setAutoTracking(bool enabled, SceneNode* const target = 0, 
+            const Vector3& localDirectionVector = Vector3::NEGATIVE_UNIT_Z,
+            const Vector3& offset = Vector3::ZERO);
+		/** Get the auto tracking target for this node, if any. */
+        virtual SceneNode* getAutoTrackTarget(void) { return mAutoTrackTarget; }
+		/** Get the auto tracking offset for this node, if the node is auto tracking. */
+		virtual const Vector3& getAutoTrackOffset(void) { return mAutoTrackOffset; }
+		/** Get the auto tracking local direction for this node, if it is auto tracking. */
+		virtual const Vector3& getAutoTrackLocalDirection(void) { return mAutoTrackLocalDirection; }
+		/** Internal method used by OGRE to update auto-tracking cameras. */
+        void _autoTrack(void);
+        /** Gets the parent of this SceneNode. */
+        SceneNode* getParentSceneNode(void) const;
+        /** Makes all objects attached to this node become visible / invisible.
+        @remarks    
+            This is a shortcut to calling setVisible() on the objects attached
+            to this node, and optionally to all objects attached to child
+            nodes. 
+        @param visible Whether the objects are to be made visible or invisible
+        @param cascade If true, this setting cascades into child nodes too.
+        */
+        virtual void setVisible(bool visible, bool cascade = true);
+        /** Inverts the visibility of all objects attached to this node.
+        @remarks    
+        This is a shortcut to calling setVisible(!isVisible()) on the objects attached
+        to this node, and optionally to all objects attached to child
+        nodes. 
+        @param cascade If true, this setting cascades into child nodes too.
+        */
+        virtual void flipVisibility(bool cascade = true);
+
+        /** Tells all objects attached to this node whether to display their
+			debug information or not.
+        @remarks    
+            This is a shortcut to calling setDebugDisplayEnabled() on the objects attached
+            to this node, and optionally to all objects attached to child
+            nodes. 
+        @param enabled Whether the objects are to display debug info or not
+        @param cascade If true, this setting cascades into child nodes too.
+        */
+        virtual void setDebugDisplayEnabled(bool enabled, bool cascade = true);
+
+		/// As Node::getDebugRenderable, except scaling is automatically determined
+		virtual DebugRenderable* getDebugRenderable();
+
+
+
+
+    };
+	/** @} */
+	/** @} */
+
+
+}// namespace
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreSceneQuery.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreSceneQuery.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreSceneQuery.h	(revision 148)
@@ -0,0 +1,565 @@
+/*
+-----------------------------------------------------------------------------
+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 __SceneQuery_H__
+#define __SceneQuery_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreAxisAlignedBox.h"
+#include "OgreSphere.h"
+#include "OgreRay.h"
+#include "OgreRenderOperation.h"
+#include "OgrePlaneBoundedVolume.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+    // forward declaration
+    class SceneQueryListener;
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Scene
+	*  @{
+	*/
+	/** A class for performing queries on a scene.
+    @remarks
+        This is an abstract class for performing a query on a scene, i.e. to retrieve
+        a list of objects and/or world geometry sections which are potentially intersecting a
+        given region. Note the use of the word 'potentially': the results of a scene query
+        are generated based on bounding volumes, and as such are not correct at a triangle
+        level; the user of the SceneQuery is expected to filter the results further if
+        greater accuracy is required.
+    @par
+        Different SceneManagers will implement these queries in different ways to
+        exploit their particular scene organisation, and thus will provide their own
+        concrete subclasses. In fact, these subclasses will be derived from subclasses
+        of this class rather than directly because there will be region-type classes
+        in between.
+    @par
+        These queries could have just been implemented as methods on the SceneManager,
+        however, they are wrapped up as objects to allow 'compilation' of queries
+        if deemed appropriate by the implementation; i.e. each concrete subclass may
+        precalculate information (such as fixed scene partitions involved in the query)
+        to speed up the repeated use of the query.
+    @par
+        You should never try to create a SceneQuery object yourself, they should be created
+        using the SceneManager interfaces for the type of query required, e.g.
+        SceneManager::createSphereSceneQuery.
+    */
+	class _OgreExport SceneQuery : public SceneMgtAlloc
+    {
+    public:
+        /** This type can be used by collaborating applications & SceneManagers to 
+            agree on the type of world geometry to be returned from queries. Not all
+            these types will be supported by all SceneManagers; once the application
+            has decided which SceneManager specialisation to use, it is expected that 
+            it will know which type of world geometry abstraction is available to it.
+        */
+        enum WorldFragmentType {
+            /// Return no world geometry hits at all
+            WFT_NONE,
+            /// Return pointers to convex plane-bounded regions
+            WFT_PLANE_BOUNDED_REGION,
+            /// Return a single intersection point (typically RaySceneQuery only)
+            WFT_SINGLE_INTERSECTION,
+            /// Custom geometry as defined by the SceneManager
+            WFT_CUSTOM_GEOMETRY,
+            /// General RenderOperation structure
+            WFT_RENDER_OPERATION
+        };
+
+        /** Represents part of the world geometry that is a result of a SceneQuery. 
+        @remarks
+            Since world geometry is normally vast and sprawling, we need a way of
+            retrieving parts of it based on a query. That is what this struct is for;
+            note there are potentially as many data structures for world geometry as there
+            are SceneManagers, however this structure includes a few common abstractions as 
+            well as a more general format.
+        @par
+            The type of world fragment that is returned from a query depends on the
+            SceneManager, and the option set using SceneQuery::setWorldFragmentType. 
+            You can see what fragment types are supported on the query in question by
+            calling SceneQuery::getSupportedWorldFragmentTypes().
+        */
+        struct WorldFragment {
+            /// The type of this world fragment
+            WorldFragmentType fragmentType;
+            /// Single intersection point, only applicable for WFT_SINGLE_INTERSECTION
+            Vector3 singleIntersection;
+            /// Planes bounding a convex region, only applicable for WFT_PLANE_BOUNDED_REGION
+            list<Plane>::type* planes;
+            /// Custom geometry block, only applicable for WFT_CUSTOM_GEOMETRY
+            void* geometry;
+            /// General render operation structure, fallback if nothing else is available
+            RenderOperation* renderOp;
+            
+        };
+    protected:
+        SceneManager* mParentSceneMgr;
+        uint32 mQueryMask;
+		uint32 mQueryTypeMask;
+        set<WorldFragmentType>::type mSupportedWorldFragments;
+        WorldFragmentType mWorldFragmentType;
+    
+    public:
+        /** Standard constructor, should be called by SceneManager. */
+        SceneQuery(SceneManager* mgr);
+        virtual ~SceneQuery();
+
+        /** Sets the mask for results of this query.
+        @remarks
+            This method allows you to set a 'mask' to limit the results of this
+            query to certain types of result. The actual meaning of this value is
+            up to the application; basically MovableObject instances will only be returned
+            from this query if a bitwise AND operation between this mask value and the
+            MovableObject::getQueryFlags value is non-zero. The application will
+            have to decide what each of the bits means.
+        */
+        virtual void setQueryMask(uint32 mask);
+        /** Returns the current mask for this query. */
+        virtual uint32 getQueryMask(void) const;
+
+        /** Sets the type mask for results of this query.
+        @remarks
+            This method allows you to set a 'type mask' to limit the results of this
+            query to certain types of objects. Whilst setQueryMask deals with flags
+			set per instance of object, this method deals with setting a mask on 
+			flags set per type of object. Both may exclude an object from query
+			results.
+        */
+        virtual void setQueryTypeMask(uint32 mask);
+        /** Returns the current mask for this query. */
+        virtual uint32 getQueryTypeMask(void) const;
+
+		/** Tells the query what kind of world geometry to return from queries;
+            often the full renderable geometry is not what is needed. 
+        @remarks
+            The application receiving the world geometry is expected to know 
+            what to do with it; inevitably this means that the application must 
+            have knowledge of at least some of the structures
+            used by the custom SceneManager.
+        @par
+            The default setting is WFT_NONE.
+        */
+        virtual void setWorldFragmentType(enum WorldFragmentType wft);
+
+        /** Gets the current world fragment types to be returned from the query. */
+        virtual WorldFragmentType getWorldFragmentType(void) const;
+
+        /** Returns the types of world fragments this query supports. */
+        virtual const set<WorldFragmentType>::type* getSupportedWorldFragmentTypes(void) const
+            {return &mSupportedWorldFragments;}
+
+        
+    };
+
+    /** This optional class allows you to receive per-result callbacks from
+        SceneQuery executions instead of a single set of consolidated results.
+    @remarks
+        You should override this with your own subclass. Note that certain query
+        classes may refine this listener interface.
+    */
+    class _OgreExport SceneQueryListener
+    {
+    public:
+        virtual ~SceneQueryListener() { }
+        /** Called when a MovableObject is returned by a query.
+        @remarks
+            The implementor should return 'true' to continue returning objects,
+            or 'false' to abandon any further results from this query.
+        */
+        virtual bool queryResult(MovableObject* object) = 0;
+        /** Called when a WorldFragment is returned by a query.
+        @remarks
+            The implementor should return 'true' to continue returning objects,
+            or 'false' to abandon any further results from this query.
+        */
+        virtual bool queryResult(SceneQuery::WorldFragment* fragment) = 0;
+
+    };
+
+    typedef list<MovableObject*>::type SceneQueryResultMovableList;
+    typedef list<SceneQuery::WorldFragment*>::type SceneQueryResultWorldFragmentList;
+    /** Holds the results of a scene query. */
+	struct _OgreExport SceneQueryResult : public SceneMgtAlloc
+    {
+        /// List of movable objects in the query (entities, particle systems etc)
+        SceneQueryResultMovableList movables;
+        /// List of world fragments
+		SceneQueryResultWorldFragmentList worldFragments;
+    };
+
+    /** Abstract class defining a query which returns single results from a region. 
+    @remarks
+        This class is simply a generalisation of the subtypes of query that return 
+        a set of individual results in a region. See the SceneQuery class for abstract
+        information, and subclasses for the detail of each query type.
+    */
+    class _OgreExport RegionSceneQuery
+        : public SceneQuery, public SceneQueryListener
+    {
+    protected:
+        SceneQueryResult* mLastResult;
+    public:
+        /** Standard constructor, should be called by SceneManager. */
+        RegionSceneQuery(SceneManager* mgr);
+        virtual ~RegionSceneQuery();
+        /** Executes the query, returning the results back in one list.
+        @remarks
+            This method executes the scene query as configured, gathers the results
+            into one structure and returns a reference to that structure. These
+            results will also persist in this query object until the next query is
+            executed, or clearResults() is called. An more lightweight version of
+            this method that returns results through a listener is also available.
+        */
+        virtual SceneQueryResult& execute(void);
+
+        /** Executes the query and returns each match through a listener interface. 
+        @remarks
+            Note that this method does not store the results of the query internally 
+            so does not update the 'last result' value. This means that this version of
+            execute is more lightweight and therefore more efficient than the version 
+            which returns the results as a collection.
+        */
+        virtual void execute(SceneQueryListener* listener) = 0;
+        
+        /** Gets the results of the last query that was run using this object, provided
+            the query was executed using the collection-returning version of execute. 
+        */
+        virtual SceneQueryResult& getLastResults(void) const;
+        /** Clears the results of the last query execution.
+        @remarks
+            You only need to call this if you specifically want to free up the memory
+            used by this object to hold the last query results. This object clears the
+            results itself when executing and when destroying itself.
+        */
+        virtual void clearResults(void);
+
+        /** Self-callback in order to deal with execute which returns collection. */
+        bool queryResult(MovableObject* first);
+        /** Self-callback in order to deal with execute which returns collection. */
+        bool queryResult(SceneQuery::WorldFragment* fragment);
+    };
+
+    /** Specialises the SceneQuery class for querying within an axis aligned box. */
+    class _OgreExport AxisAlignedBoxSceneQuery : public RegionSceneQuery
+    {
+    protected:
+        AxisAlignedBox mAABB;
+    public:
+        AxisAlignedBoxSceneQuery(SceneManager* mgr);
+        virtual ~AxisAlignedBoxSceneQuery();
+
+        /** Sets the size of the box you wish to query. */
+        void setBox(const AxisAlignedBox& box);
+
+        /** Gets the box which is being used for this query. */
+        const AxisAlignedBox& getBox(void) const;
+
+    };
+
+    /** Specialises the SceneQuery class for querying within a sphere. */
+    class _OgreExport SphereSceneQuery : public RegionSceneQuery
+    {
+    protected:
+        Sphere mSphere;
+    public:
+        SphereSceneQuery(SceneManager* mgr);
+        virtual ~SphereSceneQuery();
+        /** Sets the sphere which is to be used for this query. */
+        void setSphere(const Sphere& sphere);
+
+        /** Gets the sphere which is being used for this query. */
+        const Sphere& getSphere() const;
+
+    };
+
+    /** Specialises the SceneQuery class for querying within a plane-bounded volume. 
+    */
+    class _OgreExport PlaneBoundedVolumeListSceneQuery : public RegionSceneQuery
+    {
+    protected:
+        PlaneBoundedVolumeList mVolumes;
+    public:
+        PlaneBoundedVolumeListSceneQuery(SceneManager* mgr);
+        virtual ~PlaneBoundedVolumeListSceneQuery();
+        /** Sets the volume which is to be used for this query. */
+        void setVolumes(const PlaneBoundedVolumeList& volumes);
+
+        /** Gets the volume which is being used for this query. */
+        const PlaneBoundedVolumeList& getVolumes() const;
+
+    };
+
+
+    /*
+    /// Specialises the SceneQuery class for querying within a pyramid. 
+    class _OgreExport PyramidSceneQuery : public RegionSceneQuery
+    {
+    public:
+        PyramidSceneQuery(SceneManager* mgr);
+        virtual ~PyramidSceneQuery();
+    };
+    */
+
+    /** Alternative listener class for dealing with RaySceneQuery.
+    @remarks
+        Because the RaySceneQuery returns results in an extra bit of information, namely
+        distance, the listener interface must be customised from the standard SceneQueryListener.
+    */
+    class _OgreExport RaySceneQueryListener 
+    {
+    public:
+        virtual ~RaySceneQueryListener() { }
+        /** Called when a movable objects intersects the ray.
+        @remarks
+            As with SceneQueryListener, the implementor of this method should return 'true'
+            if further results are required, or 'false' to abandon any further results from
+            the current query.
+        */
+        virtual bool queryResult(MovableObject* obj, Real distance) = 0;
+
+        /** Called when a world fragment is intersected by the ray. 
+        @remarks
+            As with SceneQueryListener, the implementor of this method should return 'true'
+            if further results are required, or 'false' to abandon any further results from
+            the current query.
+        */
+        virtual bool queryResult(SceneQuery::WorldFragment* fragment, Real distance) = 0;
+
+    };
+      
+    /** This struct allows a single comparison of result data no matter what the type */
+    struct _OgreExport RaySceneQueryResultEntry
+    {
+        /// Distance along the ray
+        Real distance;
+        /// The movable, or NULL if this is not a movable result
+        MovableObject* movable;
+        /// The world fragment, or NULL if this is not a fragment result
+        SceneQuery::WorldFragment* worldFragment;
+        /// Comparison operator for sorting
+        bool operator < (const RaySceneQueryResultEntry& rhs) const
+        {
+            return this->distance < rhs.distance;
+        }
+
+    };
+    typedef vector<RaySceneQueryResultEntry>::type RaySceneQueryResult;
+
+    /** Specialises the SceneQuery class for querying along a ray. */
+    class _OgreExport RaySceneQuery : public SceneQuery, public RaySceneQueryListener
+    {
+    protected:
+        Ray mRay;
+        bool mSortByDistance;
+        ushort mMaxResults;
+        RaySceneQueryResult mResult;
+
+    public:
+        RaySceneQuery(SceneManager* mgr);
+        virtual ~RaySceneQuery();
+        /** Sets the ray which is to be used for this query. */
+        virtual void setRay(const Ray& ray);
+        /** Gets the ray which is to be used for this query. */
+        virtual const Ray& getRay(void) const;
+        /** Sets whether the results of this query will be sorted by distance along the ray.
+        @remarks
+            Often you want to know what was the first object a ray intersected with, and this 
+            method allows you to ask the query to sort the results so that the nearest results
+            are listed first.
+        @par
+            Note that because the query returns results based on bounding volumes, the ray may not
+            actually intersect the detail of the objects returned from the query, just their 
+            bounding volumes. For this reason the caller is advised to use more detailed 
+            intersection tests on the results if a more accurate result is required; OGRE uses 
+            bounds checking in order to give the most speedy results since not all applications 
+            need extreme accuracy.
+        @param sort If true, results will be sorted.
+        @param maxresults If sorting is enabled, this value can be used to constrain the maximum number
+            of results that are returned. Please note (as above) that the use of bounding volumes mean that
+            accuracy is not guaranteed; if in doubt, allow more results and filter them in more detail.
+            0 means unlimited results.
+        */
+        virtual void setSortByDistance(bool sort, ushort maxresults = 0);
+        /** Gets whether the results are sorted by distance. */
+        virtual bool getSortByDistance(void) const;
+        /** Gets the maximum number of results returned from the query (only relevant if 
+        results are being sorted) */
+        virtual ushort getMaxResults(void) const;
+        /** Executes the query, returning the results back in one list.
+        @remarks
+            This method executes the scene query as configured, gathers the results
+            into one structure and returns a reference to that structure. These
+            results will also persist in this query object until the next query is
+            executed, or clearResults() is called. An more lightweight version of
+            this method that returns results through a listener is also available.
+        */
+        virtual RaySceneQueryResult& execute(void);
+
+        /** Executes the query and returns each match through a listener interface. 
+        @remarks
+            Note that this method does not store the results of the query internally 
+            so does not update the 'last result' value. This means that this version of
+            execute is more lightweight and therefore more efficient than the version 
+            which returns the results as a collection.
+        */
+        virtual void execute(RaySceneQueryListener* listener) = 0;
+
+        /** Gets the results of the last query that was run using this object, provided
+            the query was executed using the collection-returning version of execute. 
+        */
+        virtual RaySceneQueryResult& getLastResults(void);
+        /** Clears the results of the last query execution.
+        @remarks
+            You only need to call this if you specifically want to free up the memory
+            used by this object to hold the last query results. This object clears the
+            results itself when executing and when destroying itself.
+        */
+        virtual void clearResults(void);
+
+        /** Self-callback in order to deal with execute which returns collection. */
+        bool queryResult(MovableObject* obj, Real distance);
+        /** Self-callback in order to deal with execute which returns collection. */
+        bool queryResult(SceneQuery::WorldFragment* fragment, Real distance);
+
+
+
+
+    };
+
+    /** Alternative listener class for dealing with IntersectionSceneQuery.
+    @remarks
+        Because the IntersectionSceneQuery returns results in pairs, rather than singularly,
+        the listener interface must be customised from the standard SceneQueryListener.
+    */
+    class _OgreExport IntersectionSceneQueryListener 
+    {
+    public:
+        virtual ~IntersectionSceneQueryListener() { }
+        /** Called when 2 movable objects intersect one another.
+        @remarks
+            As with SceneQueryListener, the implementor of this method should return 'true'
+            if further results are required, or 'false' to abandon any further results from
+            the current query.
+        */
+        virtual bool queryResult(MovableObject* first, MovableObject* second) = 0;
+
+        /** Called when a movable intersects a world fragment. 
+        @remarks
+            As with SceneQueryListener, the implementor of this method should return 'true'
+            if further results are required, or 'false' to abandon any further results from
+            the current query.
+        */
+        virtual bool queryResult(MovableObject* movable, SceneQuery::WorldFragment* fragment) = 0;
+
+        /* NB there are no results for world fragments intersecting other world fragments;
+           it is assumed that world geometry is either static or at least that self-intersections
+           are irrelevant or dealt with elsewhere (such as the custom scene manager) */
+        
+    
+    };
+        
+    typedef std::pair<MovableObject*, MovableObject*> SceneQueryMovableObjectPair;
+    typedef std::pair<MovableObject*, SceneQuery::WorldFragment*> SceneQueryMovableObjectWorldFragmentPair;
+    typedef list<SceneQueryMovableObjectPair>::type SceneQueryMovableIntersectionList;
+    typedef list<SceneQueryMovableObjectWorldFragmentPair>::type SceneQueryMovableWorldFragmentIntersectionList;
+    /** Holds the results of an intersection scene query (pair values). */
+	struct _OgreExport IntersectionSceneQueryResult : public SceneMgtAlloc
+    {
+        /// List of movable / movable intersections (entities, particle systems etc)
+        SceneQueryMovableIntersectionList movables2movables;
+        /// List of movable / world intersections
+        SceneQueryMovableWorldFragmentIntersectionList movables2world;
+        
+        
+
+    };
+
+    /** Separate SceneQuery class to query for pairs of objects which are
+        possibly intersecting one another.
+    @remarks
+        This SceneQuery subclass considers the whole world and returns pairs of objects
+        which are close enough to each other that they may be intersecting. Because of
+        this slightly different focus, the return types and listener interface are
+        different for this class.
+    */
+    class _OgreExport IntersectionSceneQuery
+        : public SceneQuery, public IntersectionSceneQueryListener 
+    {
+    protected:
+        IntersectionSceneQueryResult* mLastResult;
+    public:
+        IntersectionSceneQuery(SceneManager* mgr);
+        virtual ~IntersectionSceneQuery();
+
+        /** Executes the query, returning the results back in one list.
+        @remarks
+            This method executes the scene query as configured, gathers the results
+            into one structure and returns a reference to that structure. These
+            results will also persist in this query object until the next query is
+            executed, or clearResults() is called. An more lightweight version of
+            this method that returns results through a listener is also available.
+        */
+        virtual IntersectionSceneQueryResult& execute(void);
+
+        /** Executes the query and returns each match through a listener interface. 
+        @remarks
+            Note that this method does not store the results of the query internally 
+            so does not update the 'last result' value. This means that this version of
+            execute is more lightweight and therefore more efficient than the version 
+            which returns the results as a collection.
+        */
+        virtual void execute(IntersectionSceneQueryListener* listener) = 0;
+
+        /** Gets the results of the last query that was run using this object, provided
+            the query was executed using the collection-returning version of execute. 
+        */
+        virtual IntersectionSceneQueryResult& getLastResults(void) const;
+        /** Clears the results of the last query execution.
+        @remarks
+            You only need to call this if you specifically want to free up the memory
+            used by this object to hold the last query results. This object clears the
+            results itself when executing and when destroying itself.
+        */
+        virtual void clearResults(void);
+
+        /** Self-callback in order to deal with execute which returns collection. */
+        bool queryResult(MovableObject* first, MovableObject* second);
+        /** Self-callback in order to deal with execute which returns collection. */
+        bool queryResult(MovableObject* movable, SceneQuery::WorldFragment* fragment);
+    };
+    
+	/** @} */
+	/** @} */
+
+}
+    
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreScriptCompiler.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreScriptCompiler.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreScriptCompiler.h	(revision 148)
@@ -0,0 +1,876 @@
+/*
+-----------------------------------------------------------------------------
+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 __SCRIPTCOMPILER_H_
+#define __SCRIPTCOMPILER_H_
+
+#include "OgreSharedPtr.h"
+#include "OgreMaterial.h"
+#include "OgreHighLevelGpuProgram.h"
+#include "OgreCompositor.h"
+#include "OgreCompositionPass.h"
+#include "OgreAny.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+	/** These enums hold the types of the concrete parsed nodes */
+	enum ConcreteNodeType
+	{
+		CNT_VARIABLE,
+		CNT_VARIABLE_ASSIGN,
+		CNT_WORD,
+		CNT_IMPORT,
+		CNT_QUOTE,
+		CNT_LBRACE,
+		CNT_RBRACE,
+		CNT_COLON
+	};
+
+	/** The ConcreteNode is the struct that holds an un-conditioned sub-tree of parsed input */
+	struct ConcreteNode;
+	typedef SharedPtr<ConcreteNode> ConcreteNodePtr;
+	typedef list<ConcreteNodePtr>::type ConcreteNodeList;
+	typedef SharedPtr<ConcreteNodeList> ConcreteNodeListPtr;
+	struct ConcreteNode : public ScriptCompilerAlloc
+	{
+		String token, file;
+		unsigned int line;
+		ConcreteNodeType type;
+		ConcreteNodeList children;
+		ConcreteNode *parent;
+	};
+
+	/** This enum holds the types of the possible abstract nodes */
+	enum AbstractNodeType
+	{
+		ANT_UNKNOWN,
+		ANT_ATOM,
+		ANT_OBJECT,
+		ANT_PROPERTY,
+		ANT_IMPORT,
+		ANT_VARIABLE_SET,
+		ANT_VARIABLE_ACCESS
+	};
+	class AbstractNode;
+	typedef SharedPtr<AbstractNode> AbstractNodePtr;
+	typedef list<AbstractNodePtr>::type AbstractNodeList;
+	typedef SharedPtr<AbstractNodeList> AbstractNodeListPtr;
+
+	class _OgreExport AbstractNode : public AbstractNodeAlloc
+	{
+	public:
+		String file;
+		unsigned int line;
+		AbstractNodeType type;
+		AbstractNode *parent;
+		Any context; // A holder for translation context data
+	public:
+		AbstractNode(AbstractNode *ptr);
+		virtual ~AbstractNode(){}
+		/// Returns a new AbstractNode which is a replica of this one.
+		virtual AbstractNode *clone() const = 0;
+		/// Returns a string value depending on the type of the AbstractNode.
+		virtual String getValue() const = 0;
+	};
+
+	/** This is an abstract node which cannot be broken down further */
+	class _OgreExport AtomAbstractNode : public AbstractNode
+	{
+	public:
+		String value;
+		uint32 id;
+	public:
+		AtomAbstractNode(AbstractNode *ptr);
+		AbstractNode *clone() const;
+		String getValue() const;
+	private:
+		void parseNumber() const;
+	};
+
+	/** This specific abstract node represents a script object */
+	class _OgreExport ObjectAbstractNode : public AbstractNode
+	{
+	private:
+		map<String,String>::type mEnv;
+	public:
+		String name, cls;
+		vector<String>::type bases;
+		uint32 id;
+		bool abstract;
+		AbstractNodeList children;
+		AbstractNodeList values;
+		AbstractNodeList overrides; // For use when processing object inheritance and overriding
+	public:
+		ObjectAbstractNode(AbstractNode *ptr);
+		AbstractNode *clone() const;
+		String getValue() const;
+
+		void addVariable(const String &name);
+		void setVariable(const String &name, const String &value);
+		std::pair<bool,String> getVariable(const String &name) const;
+		const map<String,String>::type &getVariables() const;
+	};
+
+	/** This abstract node represents a script property */
+	class _OgreExport PropertyAbstractNode : public AbstractNode
+	{
+	public:
+		String name;
+		uint32 id;
+		AbstractNodeList values;
+	public:
+		PropertyAbstractNode(AbstractNode *ptr);
+		AbstractNode *clone() const;
+		String getValue() const;
+	};
+
+	/** This abstract node represents an import statement */
+	class _OgreExport ImportAbstractNode : public AbstractNode
+	{
+	public:
+		String target, source;
+	public:
+		ImportAbstractNode();
+		AbstractNode *clone() const;
+		String getValue() const;
+	};
+
+	/** This abstract node represents a variable assignment */
+	class _OgreExport VariableAccessAbstractNode : public AbstractNode
+	{
+	public:
+		String name;
+	public:
+		VariableAccessAbstractNode(AbstractNode *ptr);
+		AbstractNode *clone() const;
+		String getValue() const;
+	};
+
+	class ScriptCompilerEvent;
+	class ScriptCompilerListener;
+
+	/** This is the main class for the compiler. It calls the parser
+		and processes the CST into an AST and then uses translators
+		to translate the AST into the final resources.
+	*/
+	class _OgreExport ScriptCompiler : public ScriptCompilerAlloc
+	{
+	public: // Externally accessible types
+		//typedef map<String,uint32>::type IdMap;
+		typedef HashMap<String,uint32> IdMap;
+
+		// The container for errors
+		struct Error : public ScriptCompilerAlloc
+		{
+			String file, message;
+			int line;
+			uint32 code;
+		};
+		typedef SharedPtr<Error> ErrorPtr;
+		typedef list<ErrorPtr>::type ErrorList;
+
+		// These are the built-in error codes
+		enum{
+			CE_STRINGEXPECTED,
+			CE_NUMBEREXPECTED,
+			CE_FEWERPARAMETERSEXPECTED,
+			CE_VARIABLEEXPECTED,
+			CE_UNDEFINEDVARIABLE,
+			CE_OBJECTNAMEEXPECTED,
+			CE_OBJECTALLOCATIONERROR,
+			CE_INVALIDPARAMETERS,
+			CE_DUPLICATEOVERRIDE,
+			CE_UNEXPECTEDTOKEN,
+			CE_OBJECTBASENOTFOUND,
+			CE_UNSUPPORTEDBYRENDERSYSTEM,
+			CE_REFERENCETOANONEXISTINGOBJECT
+		};
+		static String formatErrorCode(uint32 code);
+	public:
+		ScriptCompiler();
+		virtual ~ScriptCompiler() {}
+
+		/// Takes in a string of script code and compiles it into resources
+		/**
+		 * @param str The script code
+		 * @param source The source of the script code (e.g. a script file)
+		 * @param group The resource group to place the compiled resources into
+		 */
+		bool compile(const String &str, const String &source, const String &group);
+		/// Compiles resources from the given concrete node list
+		bool compile(const ConcreteNodeListPtr &nodes, const String &group);
+		/// Generates the AST from the given string script
+		AbstractNodeListPtr _generateAST(const String &str, const String &source, bool doImports = false, bool doObjects = false, bool doVariables = false);
+		/// Compiles the given abstract syntax tree
+		bool _compile(AbstractNodeListPtr nodes, const String &group, bool doImports = true, bool doObjects = true, bool doVariables = true);
+		/// Adds the given error to the compiler's list of errors
+		void addError(uint32 code, const String &file, int line, const String &msg = "");
+		/// Sets the listener used by the compiler
+		void setListener(ScriptCompilerListener *listener);
+		/// Returns the currently set listener
+		ScriptCompilerListener *getListener();
+		/// Returns the resource group currently set for this compiler
+		const String &getResourceGroup() const;
+		/// Adds a name exclusion to the map
+		/**
+		 * Name exclusions identify object types which cannot accept
+		 * names. This means that excluded types will always have empty names.
+		 * All values in the object header are stored as object values.
+		 */
+		void addNameExclusion(const String &type);
+		/// Removes a name exclusion
+		void removeNameExclusion(const String &type);
+		/// Internal method for firing the handleEvent method
+		bool _fireEvent(ScriptCompilerEvent *evt, void *retval);
+	private: // Tree processing
+		AbstractNodeListPtr convertToAST(const ConcreteNodeListPtr &nodes);
+		/// This built-in function processes import nodes
+		void processImports(AbstractNodeListPtr &nodes);
+		/// Loads the requested script and converts it to an AST
+		AbstractNodeListPtr loadImportPath(const String &name);
+		/// Returns the abstract nodes from the given tree which represent the target
+		AbstractNodeListPtr locateTarget(AbstractNodeList *nodes, const String &target);
+		/// Handles object inheritance and variable expansion
+		void processObjects(AbstractNodeList *nodes, const AbstractNodeListPtr &top);
+		/// Handles processing the variables
+		void processVariables(AbstractNodeList *nodes);
+		/// This function overlays the given object on the destination object following inheritance rules
+		void overlayObject(const AbstractNodePtr &source, ObjectAbstractNode *dest);
+		/// Returns true if the given class is name excluded
+		bool isNameExcluded(const String &cls, AbstractNode *parent);
+		/// This function sets up the initial values in word id map
+		void initWordMap();
+	private:
+		// Resource group
+		String mGroup;
+		// The word -> id conversion table
+		IdMap mIds;
+		// This is an environment map
+		typedef map<String,String>::type Environment;
+		Environment mEnv;
+
+		typedef map<String,AbstractNodeListPtr>::type ImportCacheMap;
+		ImportCacheMap mImports; // The set of imported scripts to avoid circular dependencies
+		typedef multimap<String,String>::type ImportRequestMap;
+		ImportRequestMap mImportRequests; // This holds the target objects for each script to be imported
+
+		// This stores the imports of the scripts, so they are separated and can be treated specially
+		AbstractNodeList mImportTable;
+
+		// Error list
+		ErrorList mErrors;
+
+		// The listener
+		ScriptCompilerListener *mListener;
+	private: // Internal helper classes and processors
+		class AbstractTreeBuilder
+		{
+		private:
+			AbstractNodeListPtr mNodes;
+			AbstractNode *mCurrent;
+			ScriptCompiler *mCompiler;
+		public:
+			AbstractTreeBuilder(ScriptCompiler *compiler);
+			const AbstractNodeListPtr &getResult() const;
+			void visit(ConcreteNode *node);
+			static void visit(AbstractTreeBuilder *visitor, const ConcreteNodeList &nodes);
+		};
+		friend class AbstractTreeBuilder;
+	public: // Public translator definitions
+		// This enum are built-in word id values
+		enum
+		{
+			ID_ON = 1,
+			ID_OFF = 2,
+			ID_TRUE = 1,
+			ID_FALSE = 2,
+			ID_YES = 1,
+			ID_NO = 2
+		};	
+	};
+
+	/**
+	 * This struct is a base class for events which can be thrown by the compilers and caught by
+	 * subscribers. There are a set number of standard events which are used by Ogre's core.
+	 * New event types may be derived for more custom compiler processing.
+	 */
+	class ScriptCompilerEvent
+	{
+	public:
+		String mType;
+
+		ScriptCompilerEvent(const String &type):mType(type){}
+		virtual ~ScriptCompilerEvent(){}
+	private: // Non-copyable
+		ScriptCompilerEvent(const ScriptCompilerEvent&);
+		ScriptCompilerEvent &operator = (const ScriptCompilerEvent&);
+	};
+
+	/** This is a listener for the compiler. The compiler can be customized with
+		this listener. It lets you listen in on events occurring during compilation,
+		hook them, and change the behavior.
+	*/
+	class _OgreExport ScriptCompilerListener
+	{
+	public:
+		ScriptCompilerListener();
+		virtual ~ScriptCompilerListener() {}
+
+		/// Returns the concrete node list from the given file
+		virtual ConcreteNodeListPtr importFile(ScriptCompiler *compiler, const String &name);
+		/// Allows for responding to and overriding behavior before a CST is translated into an AST
+		virtual void preConversion(ScriptCompiler *compiler, ConcreteNodeListPtr nodes);
+		/// Allows vetoing of continued compilation after the entire AST conversion process finishes
+		/**
+		 @remarks	Once the script is turned completely into an AST, including import
+					and override handling, this function allows a listener to exit
+					the compilation process.
+		 @return True continues compilation, false aborts
+		 */
+		virtual bool postConversion(ScriptCompiler *compiler, const AbstractNodeListPtr&);
+		/// Called when an error occurred
+		virtual void handleError(ScriptCompiler *compiler, uint32 code, const String &file, int line, const String &msg);
+		/// Called when an event occurs during translation, return true if handled
+		/**
+		 @remarks	This function is called from the translators when an event occurs that
+					that can be responded to. Often this is overriding names, or it can be a request for
+					custom resource creation.
+		 @arg compiler A reference to the compiler
+		 @arg evt The event object holding information about the event to be processed
+		 @arg retval A possible return value from handlers
+		 @return True if the handler processed the event
+		*/
+		virtual bool handleEvent(ScriptCompiler *compiler, ScriptCompilerEvent *evt, void *retval);
+	};
+
+	class ScriptTranslator;
+	class ScriptTranslatorManager;
+
+	/** Manages threaded compilation of scripts. This script loader forwards
+		scripts compilations to a specific compiler instance.
+	*/
+	class _OgreExport ScriptCompilerManager : public Singleton<ScriptCompilerManager>, public ScriptLoader, public ScriptCompilerAlloc
+	{
+	private:
+            OGRE_AUTO_MUTEX;
+
+		// A list of patterns loaded by this compiler manager
+		StringVector mScriptPatterns;
+
+		// A pointer to the listener used for compiling scripts
+		ScriptCompilerListener *mListener;
+
+		// Stores a map from object types to the translators that handle them
+		vector<ScriptTranslatorManager*>::type mManagers;
+
+		// A pointer to the built-in ScriptTranslatorManager
+		ScriptTranslatorManager *mBuiltinTranslatorManager;
+
+		// A pointer to the specific compiler instance used
+		OGRE_THREAD_POINTER(ScriptCompiler, mScriptCompiler);
+	public:
+		ScriptCompilerManager();
+		virtual ~ScriptCompilerManager();
+
+		/// Sets the listener used for compiler instances
+		void setListener(ScriptCompilerListener *listener);
+		/// Returns the currently set listener used for compiler instances
+		ScriptCompilerListener *getListener();
+
+		/// Adds the given translator manager to the list of managers
+		void addTranslatorManager(ScriptTranslatorManager *man);
+		/// Removes the given translator manager from the list of managers
+		void removeTranslatorManager(ScriptTranslatorManager *man);
+		/// Clears all translator managers
+		void clearTranslatorManagers();
+		/// Retrieves a ScriptTranslator from the supported managers
+		ScriptTranslator *getTranslator(const AbstractNodePtr &node);
+
+		/// Adds a script extension that can be handled (e.g. *.material, *.pu, etc.)
+		void addScriptPattern(const String &pattern);
+		/// @copydoc ScriptLoader::getScriptPatterns
+        const StringVector& getScriptPatterns(void) const;
+        /// @copydoc ScriptLoader::parseScript
+        void parseScript(DataStreamPtr& stream, const String& groupName);
+        /// @copydoc ScriptLoader::getLoadingOrder
+        Real getLoadingOrder(void) const;
+
+		/** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static ScriptCompilerManager& getSingleton(void);
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static ScriptCompilerManager* getSingletonPtr(void);
+	};
+
+	// Standard event types
+	class _OgreExport PreApplyTextureAliasesScriptCompilerEvent : public ScriptCompilerEvent
+	{
+	public:
+		Material *mMaterial;
+		AliasTextureNamePairList *mAliases;
+		static String eventType;
+
+		PreApplyTextureAliasesScriptCompilerEvent(Material *material, AliasTextureNamePairList *aliases)
+			:ScriptCompilerEvent(eventType), mMaterial(material), mAliases(aliases){}
+	};
+
+	class _OgreExport ProcessResourceNameScriptCompilerEvent : public ScriptCompilerEvent
+	{
+	public:
+		enum ResourceType
+		{
+			TEXTURE,
+			MATERIAL,
+			GPU_PROGRAM,
+			COMPOSITOR
+		};
+		ResourceType mResourceType;
+		String mName;
+		static String eventType;
+
+		ProcessResourceNameScriptCompilerEvent(ResourceType resourceType, const String &name)
+			:ScriptCompilerEvent(eventType), mResourceType(resourceType), mName(name){}     
+	};
+
+	class _OgreExport ProcessNameExclusionScriptCompilerEvent : public ScriptCompilerEvent
+	{
+	public:
+		String mClass;
+		AbstractNode *mParent;
+		static String eventType;
+
+		ProcessNameExclusionScriptCompilerEvent(const String &cls, AbstractNode *parent)
+			:ScriptCompilerEvent(eventType), mClass(cls), mParent(parent){}     
+	};
+
+	class _OgreExport CreateMaterialScriptCompilerEvent : public ScriptCompilerEvent
+	{
+	public:
+		String mFile, mName, mResourceGroup;
+		static String eventType;
+
+		CreateMaterialScriptCompilerEvent(const String &file, const String &name, const String &resourceGroup)
+			:ScriptCompilerEvent(eventType), mFile(file), mName(name), mResourceGroup(resourceGroup){}  
+	};
+
+	class _OgreExport CreateGpuProgramScriptCompilerEvent : public ScriptCompilerEvent
+	{
+	public:
+		String mFile, mName, mResourceGroup, mSource, mSyntax;
+		GpuProgramType mProgramType;
+		static String eventType;
+
+		CreateGpuProgramScriptCompilerEvent(const String &file, const String &name, const String &resourceGroup, const String &source, 
+			const String &syntax, GpuProgramType programType)
+			:ScriptCompilerEvent(eventType), mFile(file), mName(name), mResourceGroup(resourceGroup), mSource(source), 
+			 mSyntax(syntax), mProgramType(programType)
+		{}  
+	};
+
+	class _OgreExport CreateHighLevelGpuProgramScriptCompilerEvent : public ScriptCompilerEvent
+	{
+	public:
+		String mFile, mName, mResourceGroup, mSource, mLanguage;
+		GpuProgramType mProgramType;
+		static String eventType;
+
+		CreateHighLevelGpuProgramScriptCompilerEvent(const String &file, const String &name, const String &resourceGroup, const String &source, 
+			const String &language, GpuProgramType programType)
+			:ScriptCompilerEvent(eventType), mFile(file), mName(name), mResourceGroup(resourceGroup), mSource(source), 
+			 mLanguage(language), mProgramType(programType)
+		{}  
+	};
+
+	class _OgreExport CreateGpuSharedParametersScriptCompilerEvent : public ScriptCompilerEvent
+	{
+	public:
+		String mFile, mName, mResourceGroup;
+		static String eventType;
+
+		CreateGpuSharedParametersScriptCompilerEvent(const String &file, const String &name, const String &resourceGroup)
+			:ScriptCompilerEvent(eventType), mFile(file), mName(name), mResourceGroup(resourceGroup){}  
+	};
+
+	class _OgreExport CreateParticleSystemScriptCompilerEvent : public ScriptCompilerEvent
+	{
+	public:
+		String mFile, mName, mResourceGroup;
+		static String eventType;
+
+		CreateParticleSystemScriptCompilerEvent(const String &file, const String &name, const String &resourceGroup)
+			:ScriptCompilerEvent(eventType), mFile(file), mName(name), mResourceGroup(resourceGroup){}  
+	};
+
+	class _OgreExport CreateCompositorScriptCompilerEvent : public ScriptCompilerEvent
+	{
+	public:
+		String mFile, mName, mResourceGroup;
+		static String eventType;
+
+		CreateCompositorScriptCompilerEvent(const String &file, const String &name, const String &resourceGroup)
+			:ScriptCompilerEvent(eventType), mFile(file), mName(name), mResourceGroup(resourceGroup){}  
+	};
+
+	/// This enum defines the integer ids for keywords this compiler handles
+	enum
+	{
+		ID_MATERIAL = 3,
+		ID_VERTEX_PROGRAM,
+		ID_GEOMETRY_PROGRAM,
+		ID_FRAGMENT_PROGRAM,
+		ID_TECHNIQUE,
+		ID_PASS,
+		ID_TEXTURE_UNIT,
+		ID_VERTEX_PROGRAM_REF,
+		ID_GEOMETRY_PROGRAM_REF,
+		ID_FRAGMENT_PROGRAM_REF,
+		ID_SHADOW_CASTER_VERTEX_PROGRAM_REF,
+		ID_SHADOW_CASTER_FRAGMENT_PROGRAM_REF,
+		ID_SHADOW_RECEIVER_VERTEX_PROGRAM_REF,
+		ID_SHADOW_RECEIVER_FRAGMENT_PROGRAM_REF,
+		ID_SHADOW_CASTER_MATERIAL,
+		ID_SHADOW_RECEIVER_MATERIAL,
+		
+        ID_LOD_VALUES,
+        ID_LOD_STRATEGY,
+		ID_LOD_DISTANCES,
+		ID_RECEIVE_SHADOWS,
+		ID_TRANSPARENCY_CASTS_SHADOWS,
+		ID_SET_TEXTURE_ALIAS,
+
+		ID_SOURCE,
+		ID_SYNTAX,
+		ID_DEFAULT_PARAMS,
+		ID_PARAM_INDEXED,
+		ID_PARAM_NAMED,
+		ID_PARAM_INDEXED_AUTO,
+		ID_PARAM_NAMED_AUTO,
+
+		ID_SCHEME,
+		ID_LOD_INDEX,
+		ID_GPU_VENDOR_RULE,
+		ID_GPU_DEVICE_RULE,
+		ID_INCLUDE, 
+		ID_EXCLUDE, 
+
+		ID_AMBIENT,
+		ID_DIFFUSE,
+		ID_SPECULAR,
+		ID_EMISSIVE,
+			ID_VERTEXCOLOUR,
+		ID_SCENE_BLEND,
+			ID_COLOUR_BLEND,
+			ID_ONE,
+			ID_ZERO,
+			ID_DEST_COLOUR,
+			ID_SRC_COLOUR,
+			ID_ONE_MINUS_DEST_COLOUR,
+			ID_ONE_MINUS_SRC_COLOUR,
+			ID_DEST_ALPHA,
+			ID_SRC_ALPHA,
+			ID_ONE_MINUS_DEST_ALPHA,
+			ID_ONE_MINUS_SRC_ALPHA,
+		ID_SEPARATE_SCENE_BLEND,
+		ID_SCENE_BLEND_OP,
+			ID_REVERSE_SUBTRACT,
+			ID_MIN,
+			ID_MAX,
+		ID_SEPARATE_SCENE_BLEND_OP,
+		ID_DEPTH_CHECK,
+		ID_DEPTH_WRITE,
+		ID_DEPTH_FUNC,
+		ID_DEPTH_BIAS,
+		ID_ITERATION_DEPTH_BIAS,
+			ID_ALWAYS_FAIL,
+			ID_ALWAYS_PASS,
+			ID_LESS_EQUAL,
+			ID_LESS,
+			ID_EQUAL,
+			ID_NOT_EQUAL,
+			ID_GREATER_EQUAL,
+			ID_GREATER,
+		ID_ALPHA_REJECTION,
+		ID_ALPHA_TO_COVERAGE,
+		ID_LIGHT_SCISSOR,
+		ID_LIGHT_CLIP_PLANES,
+		ID_TRANSPARENT_SORTING,
+		ID_ILLUMINATION_STAGE,
+			ID_DECAL,
+		ID_CULL_HARDWARE,
+			ID_CLOCKWISE,
+			ID_ANTICLOCKWISE,
+		ID_CULL_SOFTWARE,
+			ID_BACK,
+			ID_FRONT,
+		ID_NORMALISE_NORMALS,
+		ID_LIGHTING,
+		ID_SHADING,
+			ID_FLAT, 
+			ID_GOURAUD,
+			ID_PHONG,
+		ID_POLYGON_MODE,
+			ID_SOLID,
+			ID_WIREFRAME,
+			ID_POINTS,
+		ID_POLYGON_MODE_OVERRIDEABLE,
+		ID_FOG_OVERRIDE,
+			ID_NONE,
+			ID_LINEAR,
+			ID_EXP,
+			ID_EXP2,
+		ID_COLOUR_WRITE,
+		ID_MAX_LIGHTS,
+		ID_START_LIGHT,
+		ID_ITERATION,
+			ID_ONCE,
+			ID_ONCE_PER_LIGHT,
+			ID_PER_LIGHT,
+			ID_PER_N_LIGHTS,
+			ID_POINT,
+			ID_SPOT,
+			ID_DIRECTIONAL,
+		ID_LIGHT_MASK,
+		ID_POINT_SIZE,
+		ID_POINT_SPRITES,
+		ID_POINT_SIZE_ATTENUATION,
+		ID_POINT_SIZE_MIN,
+		ID_POINT_SIZE_MAX,
+
+		ID_TEXTURE_ALIAS,
+		ID_TEXTURE,
+			ID_1D,
+			ID_2D,
+			ID_3D,
+			ID_CUBIC,
+			ID_2DARRAY,
+			ID_UNLIMITED,
+			ID_ALPHA,
+			ID_GAMMA,
+		ID_ANIM_TEXTURE,
+		ID_CUBIC_TEXTURE,
+			ID_SEPARATE_UV,
+			ID_COMBINED_UVW,
+		ID_TEX_COORD_SET,
+		ID_TEX_ADDRESS_MODE,
+			ID_WRAP,
+			ID_CLAMP,
+			ID_BORDER,
+			ID_MIRROR,
+		ID_TEX_BORDER_COLOUR,
+		ID_FILTERING,
+			ID_BILINEAR,
+			ID_TRILINEAR,
+			ID_ANISOTROPIC,
+		ID_CMPTEST,
+			ID_ON,
+			ID_OFF,
+		ID_CMPFUNC,
+		ID_MAX_ANISOTROPY,
+		ID_MIPMAP_BIAS,
+		ID_COLOUR_OP,
+			ID_REPLACE,
+			ID_ADD,
+			ID_MODULATE,
+			ID_ALPHA_BLEND,
+		ID_COLOUR_OP_EX,
+			ID_SOURCE1,
+			ID_SOURCE2,
+			ID_MODULATE_X2,
+			ID_MODULATE_X4,
+			ID_ADD_SIGNED,
+			ID_ADD_SMOOTH,
+			ID_SUBTRACT,
+			ID_BLEND_DIFFUSE_COLOUR,
+			ID_BLEND_DIFFUSE_ALPHA,
+			ID_BLEND_TEXTURE_ALPHA,
+			ID_BLEND_CURRENT_ALPHA,
+			ID_BLEND_MANUAL,
+			ID_DOT_PRODUCT,
+			ID_SRC_CURRENT,
+			ID_SRC_TEXTURE,
+			ID_SRC_DIFFUSE,
+			ID_SRC_SPECULAR,
+			ID_SRC_MANUAL,
+		ID_COLOUR_OP_MULTIPASS_FALLBACK,
+		ID_ALPHA_OP_EX,
+		ID_ENV_MAP,
+			ID_SPHERICAL,
+			ID_PLANAR,
+			ID_CUBIC_REFLECTION,
+			ID_CUBIC_NORMAL,
+		ID_SCROLL,
+		ID_SCROLL_ANIM,
+		ID_ROTATE,
+		ID_ROTATE_ANIM,
+		ID_SCALE,
+		ID_WAVE_XFORM,
+			ID_SCROLL_X,
+			ID_SCROLL_Y,
+			ID_SCALE_X,
+			ID_SCALE_Y,
+			ID_SINE,
+			ID_TRIANGLE,
+			ID_SQUARE,
+			ID_SAWTOOTH,
+			ID_INVERSE_SAWTOOTH,
+		ID_TRANSFORM,
+		ID_BINDING_TYPE,
+			ID_VERTEX,
+			ID_FRAGMENT,
+		ID_CONTENT_TYPE,
+			ID_NAMED,
+			ID_SHADOW,
+		ID_TEXTURE_SOURCE,
+		ID_SHARED_PARAMS,
+		ID_SHARED_PARAM_NAMED,
+		ID_SHARED_PARAMS_REF,
+
+		ID_PARTICLE_SYSTEM,
+		ID_EMITTER,
+		ID_AFFECTOR,
+
+		ID_COMPOSITOR,
+			ID_TARGET,
+			ID_TARGET_OUTPUT,
+
+			ID_INPUT,
+				ID_PREVIOUS,
+				ID_TARGET_WIDTH,
+				ID_TARGET_HEIGHT,
+				ID_TARGET_WIDTH_SCALED,
+				ID_TARGET_HEIGHT_SCALED,
+			ID_COMPOSITOR_LOGIC,
+			ID_TEXTURE_REF,
+			ID_SCOPE_LOCAL,
+			ID_SCOPE_CHAIN,
+			ID_SCOPE_GLOBAL,
+			ID_POOLED,
+			//ID_GAMMA, - already registered for material
+			ID_NO_FSAA,
+			ID_DEPTH_POOL,
+			ID_ONLY_INITIAL,
+			ID_VISIBILITY_MASK,
+			ID_LOD_BIAS,
+			ID_MATERIAL_SCHEME,
+			ID_SHADOWS_ENABLED,
+
+			ID_CLEAR,
+			ID_STENCIL,
+			ID_RENDER_SCENE,
+			ID_RENDER_QUAD,
+			ID_IDENTIFIER,
+			ID_FIRST_RENDER_QUEUE,
+			ID_LAST_RENDER_QUEUE,
+			ID_QUAD_NORMALS,
+				ID_CAMERA_FAR_CORNERS_VIEW_SPACE,
+				ID_CAMERA_FAR_CORNERS_WORLD_SPACE,
+
+			ID_BUFFERS,
+				ID_COLOUR,
+				ID_DEPTH,
+			ID_COLOUR_VALUE,
+			ID_DEPTH_VALUE,
+			ID_STENCIL_VALUE,
+
+			ID_CHECK,
+			ID_COMP_FUNC,
+			ID_REF_VALUE,
+			ID_MASK,
+			ID_FAIL_OP,
+				ID_KEEP,
+				ID_INCREMENT,
+				ID_DECREMENT,
+				ID_INCREMENT_WRAP,
+				ID_DECREMENT_WRAP,
+				ID_INVERT,
+			ID_DEPTH_FAIL_OP,
+			ID_PASS_OP,
+			ID_TWO_SIDED,
+#ifdef RTSHADER_SYSTEM_BUILD_CORE_SHADERS
+        ID_RT_SHADER_SYSTEM,
+#endif
+		/// Suport for shader model 5.0
+		// More program IDs
+		ID_TESSELATION_HULL_PROGRAM,
+		ID_TESSELATION_DOMAIN_PROGRAM,
+		ID_COMPUTE_PROGRAM,
+		ID_TESSELATION_HULL_PROGRAM_REF,
+		ID_TESSELATION_DOMAIN_PROGRAM_REF,
+		ID_COMPUTE_PROGRAM_REF,
+		// More binding IDs
+		ID_GEOMETRY,
+		ID_TESSELATION_HULL,
+		ID_TESSELATION_DOMAIN,
+		ID_COMPUTE,
+
+		// Support for subroutine
+		ID_SUBROUTINE,
+
+		ID_END_BUILTIN_IDS
+	};
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreScriptLexer.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreScriptLexer.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreScriptLexer.h	(revision 148)
@@ -0,0 +1,98 @@
+/*
+-----------------------------------------------------------------------------
+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 __ScriptLexer_H_
+#define __ScriptLexer_H_
+
+#include "OgrePrerequisites.h"
+#include "OgreSharedPtr.h"
+#include "OgreDataStream.h"
+#include "OgreStringConverter.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+	/** These codes represent token IDs which are numerical translations of
+		specific lexemes. Specific compilers using the lexer can register their
+		own token IDs which are given precedence over these built-in ones.
+	*/
+	enum{
+		TID_LBRACKET = 0, // {
+		TID_RBRACKET, // }
+		TID_COLON, // :
+		TID_VARIABLE, // $...
+		TID_WORD, // *
+		TID_QUOTE, // "*"
+		TID_NEWLINE, // \n
+		TID_UNKNOWN,
+		TID_END
+	};
+
+	/** This struct represents a token, which is an ID'd lexeme from the
+		parsing input stream.
+	*/
+	struct ScriptToken
+	{
+		/// This is the lexeme for this token
+		String lexeme, file;
+		/// This is the id associated with the lexeme, which comes from a lexeme-token id mapping
+		uint32 type;
+		/// This holds the line number of the input stream where the token was found.
+		uint32 line;
+	};
+	typedef SharedPtr<ScriptToken> ScriptTokenPtr;
+	typedef vector<ScriptTokenPtr>::type ScriptTokenList;
+	typedef SharedPtr<ScriptTokenList> ScriptTokenListPtr;
+
+	class _OgreExport ScriptLexer : public ScriptCompilerAlloc
+	{
+	public:
+		ScriptLexer();
+		virtual ~ScriptLexer() {}
+
+		/** Tokenizes the given input and returns the list of tokens found */
+		ScriptTokenListPtr tokenize(const String &str, const String &source);
+	private: // Private utility operations
+		void setToken(const String &lexeme, uint32 line, const String &source, ScriptTokenList *tokens);
+		bool isWhitespace(Ogre::String::value_type c) const;
+		bool isNewline(Ogre::String::value_type c) const;
+	};
+
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreScriptLoader.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreScriptLoader.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreScriptLoader.h	(revision 148)
@@ -0,0 +1,98 @@
+/*
+-----------------------------------------------------------------------------
+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 __ScriptLoader_H__
+#define __ScriptLoader_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreDataStream.h"
+#include "OgreStringVector.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+	/** Abstract class defining the interface used by classes which wish 
+		to perform script loading to define instances of whatever they manage.
+	@remarks
+		Typically classes of this type wish to either parse individual script files
+		on demand, or be called with a group of files matching a certain pattern
+		at the appropriate time. Normally this will coincide with resource loading,
+		although the script use does not necessarily have to be a ResourceManager
+		(which subclasses from this class), it may be simply a script loader which 
+		manages non-resources but needs to be synchronised at the same loading points.
+	@par
+		Subclasses should add themselves to the ResourceGroupManager as a script loader
+		if they wish to be called at the point a resource group is loaded, at which 
+		point the parseScript method will be called with each file which matches a 
+		the pattern returned from getScriptPatterns.
+	*/
+	class _OgreExport ScriptLoader
+	{
+	public:
+		virtual ~ScriptLoader();
+		/** Gets the file patterns which should be used to find scripts for this
+			class.
+		@remarks
+			This method is called when a resource group is loaded if you use 
+			ResourceGroupManager::_registerScriptLoader.
+		@return
+			A list of file patterns, in the order they should be searched in.
+		*/
+		virtual const StringVector& getScriptPatterns(void) const = 0;
+
+		/** Parse a script file.
+		@param stream Weak reference to a data stream which is the source of the script
+		@param groupName The name of a resource group which should be used if any resources
+			are created during the parse of this script.
+		*/
+		virtual void parseScript(DataStreamPtr& stream, const String& groupName) = 0;
+
+		/** Gets the relative loading order of scripts of this type.
+		@remarks
+			There are dependencies between some kinds of scripts, and to enforce
+			this all implementors of this interface must define a loading order. 
+		@return A value representing the relative loading order of these scripts
+			compared to other script users, where higher values load later.
+		*/
+		virtual Real getLoadingOrder(void) const  = 0;
+
+	};
+
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreScriptParser.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreScriptParser.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreScriptParser.h	(revision 148)
@@ -0,0 +1,65 @@
+/*
+-----------------------------------------------------------------------------
+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 __SCRIPTPARSER_H_
+#define __SCRIPTPARSER_H_
+
+#include "OgrePrerequisites.h"
+#include "OgreScriptCompiler.h"
+#include "OgreScriptLexer.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+
+	class _OgreExport ScriptParser : public ScriptCompilerAlloc
+	{
+	public:
+		ScriptParser();
+		virtual ~ScriptParser() {}
+
+		ConcreteNodeListPtr parse(const ScriptTokenListPtr &tokens);
+		ConcreteNodeListPtr parseChunk(const ScriptTokenListPtr &tokens);
+	private:
+		ScriptToken *getToken(ScriptTokenList::iterator i, ScriptTokenList::iterator end, int offset);
+		ScriptTokenList::iterator skipNewlines(ScriptTokenList::iterator i, ScriptTokenList::iterator end);
+	};
+	
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreScriptTranslator.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreScriptTranslator.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreScriptTranslator.h	(revision 148)
@@ -0,0 +1,291 @@
+/*
+-----------------------------------------------------------------------------
+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 __SCRIPTTRANSLATOR_H_
+#define __SCRIPTTRANSLATOR_H_
+
+#include "OgrePrerequisites.h"
+#include "OgreScriptCompiler.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+	/** This class translates script AST (abstract syntax tree) into
+	 *  Ogre resources. It defines a common interface for subclasses
+	 *  which perform the actual translation.
+	 */
+
+	class _OgreExport ScriptTranslator : public ScriptTranslatorAlloc
+	{
+	public:
+		/**
+		 * This function translates the given node into Ogre resource(s).
+		 * @param compiler The compiler invoking this translator
+		 * @param node The current AST node to be translated
+		 */
+		virtual void translate(ScriptCompiler *compiler, const AbstractNodePtr &node) = 0;
+	protected:
+		// needs virtual destructor
+		virtual ~ScriptTranslator() {}
+		/// Retrieves a new translator from the factories and uses it to process the give node
+		void processNode(ScriptCompiler *compiler, const AbstractNodePtr &node);
+
+		/// Retrieves the node iterator at the given index
+		static AbstractNodeList::const_iterator getNodeAt(const AbstractNodeList &nodes, int index);
+		/// Converts the node to a boolean and returns true if successful
+		static bool getBoolean(const AbstractNodePtr &node, bool *result);
+		/// Converts the node to a string and returns true if successful
+		static bool getString(const AbstractNodePtr &node, String *result);
+		/// Converts the node to a Real and returns true if successful
+		static bool getReal(const AbstractNodePtr &node, Real *result);
+		/// Converts the node to a float and returns true if successful
+		static bool getFloat(const AbstractNodePtr &node, float *result);
+		/// Converts the node to an integer and returns true if successful
+		static bool getInt(const AbstractNodePtr &node, int *result); 
+		/// Converts the node to an unsigned integer and returns true if successful
+		static bool getUInt(const AbstractNodePtr &node, uint32 *result); 
+		/// Converts the range of nodes to a ColourValue and returns true if successful
+		static bool getColour(AbstractNodeList::const_iterator i, AbstractNodeList::const_iterator end, ColourValue *result, int maxEntries = 4);
+		/// Converts the node to a SceneBlendFactor enum and returns true if successful
+		static bool getSceneBlendFactor(const AbstractNodePtr &node, SceneBlendFactor *sbf);
+		/// Converts the node to a CompareFunction enum and returns true if successful
+		static bool getCompareFunction(const AbstractNodePtr &node, CompareFunction *func);
+		/// Converts the range of nodes to a Matrix4 and returns true if successful
+		static bool getMatrix4(AbstractNodeList::const_iterator i, AbstractNodeList::const_iterator end, Matrix4 *m);
+		/// Converts the range of nodes to an array of ints and returns true if successful
+		static bool getInts(AbstractNodeList::const_iterator i, AbstractNodeList::const_iterator end, int *vals, int count);
+		/// Converts the range of nodes to an array of floats and returns true if successful
+		static bool getFloats(AbstractNodeList::const_iterator i, AbstractNodeList::const_iterator end, float *vals, int count);
+		/// Converts the node to a StencilOperation enum and returns true if successful
+		static bool getStencilOp(const AbstractNodePtr &node, StencilOperation *op); 
+		/// Converts the node to a GpuConstantType enum and returns true if successful
+		static bool getConstantType(AbstractNodeList::const_iterator i, GpuConstantType *op); 
+
+	};
+
+	/** The ScriptTranslatorManager manages the lifetime and access to
+	 *  script translators. You register these managers with the
+	 *  ScriptCompilerManager tied to specific object types.
+	 *  Each manager may manage multiple types.
+	 */
+	class ScriptTranslatorManager : public ScriptTranslatorAlloc
+	{
+	public:
+		// required - virtual destructor
+		virtual ~ScriptTranslatorManager() {}
+
+		/// Returns the number of translators being managed
+		virtual size_t getNumTranslators() const = 0;
+		/// Returns a manager for the given object abstract node, or null if it is not supported
+		virtual ScriptTranslator *getTranslator(const AbstractNodePtr&) = 0;
+	};
+
+	/**************************************************************************
+	 * Material compilation section
+	 *************************************************************************/
+	class _OgreExport MaterialTranslator : public ScriptTranslator
+	{
+	protected:
+		Material *mMaterial;
+		Ogre::AliasTextureNamePairList mTextureAliases;
+	public:
+		MaterialTranslator();
+		void translate(ScriptCompiler *compiler, const AbstractNodePtr &node);
+	};
+		
+	class _OgreExport TechniqueTranslator : public ScriptTranslator
+	{
+	protected:
+		Technique *mTechnique;
+	public:
+		TechniqueTranslator();
+		void translate(ScriptCompiler *compiler, const AbstractNodePtr &node);
+	};
+	
+	class _OgreExport PassTranslator : public ScriptTranslator
+	{
+	protected:
+		Pass *mPass;
+	public:
+		PassTranslator();
+		void translate(ScriptCompiler *compiler, const AbstractNodePtr &node);
+	protected:
+		void translateVertexProgramRef(ScriptCompiler *compiler, ObjectAbstractNode *node);
+		void translateGeometryProgramRef(ScriptCompiler *compiler, ObjectAbstractNode *node);
+		void translateFragmentProgramRef(ScriptCompiler *compiler, ObjectAbstractNode *node);
+		void translateTesselationHullProgramRef(ScriptCompiler *compiler, ObjectAbstractNode *node);
+		void translateTesselationDomainProgramRef(ScriptCompiler *compiler, ObjectAbstractNode *node);
+		void translateComputeProgramRef(ScriptCompiler *compiler, ObjectAbstractNode *node);
+		void translateShadowCasterVertexProgramRef(ScriptCompiler *compiler, ObjectAbstractNode *node);
+		void translateShadowCasterFragmentProgramRef(ScriptCompiler *compiler, ObjectAbstractNode *node);
+		void translateShadowReceiverVertexProgramRef(ScriptCompiler *compiler, ObjectAbstractNode *node);
+		void translateShadowReceiverFragmentProgramRef(ScriptCompiler *compiler, ObjectAbstractNode *node);
+	};
+
+	class _OgreExport TextureUnitTranslator : public ScriptTranslator
+	{
+	protected:
+		TextureUnitState *mUnit;
+	public:
+		TextureUnitTranslator();
+		void translate(ScriptCompiler *compiler, const AbstractNodePtr &node);
+	};
+
+	class _OgreExport TextureSourceTranslator : public ScriptTranslator
+	{
+	public:
+		TextureSourceTranslator();
+		void translate(ScriptCompiler *compiler, const AbstractNodePtr &node);
+	};
+
+	class _OgreExport GpuProgramTranslator : public ScriptTranslator
+	{	
+	public:
+		GpuProgramTranslator();
+		void translate(ScriptCompiler *compiler, const AbstractNodePtr &node);
+	protected:
+		void translateGpuProgram(ScriptCompiler *compiler, ObjectAbstractNode *obj);
+		void translateHighLevelGpuProgram(ScriptCompiler *compiler, ObjectAbstractNode *obj);
+		void translateUnifiedGpuProgram(ScriptCompiler *compiler, ObjectAbstractNode *obj);
+	public:
+		static void translateProgramParameters(ScriptCompiler *compiler, GpuProgramParametersSharedPtr params, ObjectAbstractNode *obj);
+	};
+
+	class _OgreExport SharedParamsTranslator : public ScriptTranslator
+	{	
+	public:
+		SharedParamsTranslator();
+		void translate(ScriptCompiler *compiler, const AbstractNodePtr &node);
+	protected:
+	};
+
+	/**************************************************************************
+	 * Particle System section
+	 *************************************************************************/
+	class _OgreExport ParticleSystemTranslator : public ScriptTranslator
+	{
+	protected:
+		Ogre::ParticleSystem *mSystem;
+	public:
+		ParticleSystemTranslator();
+		void translate(ScriptCompiler *compiler, const AbstractNodePtr &node);
+	};
+	class _OgreExport ParticleEmitterTranslator : public ScriptTranslator
+	{
+	protected:
+		Ogre::ParticleEmitter *mEmitter;
+	public:
+		ParticleEmitterTranslator();
+		void translate(ScriptCompiler *compiler, const AbstractNodePtr &node);
+	};
+	class _OgreExport ParticleAffectorTranslator : public ScriptTranslator
+	{
+	protected:
+		Ogre::ParticleAffector *mAffector;
+	public:
+		ParticleAffectorTranslator();
+		void translate(ScriptCompiler *compiler, const AbstractNodePtr &node);
+	};
+
+	/**************************************************************************
+	 * Compositor section
+	 *************************************************************************/
+	class _OgreExport CompositorTranslator : public ScriptTranslator
+	{
+	protected:
+		Compositor *mCompositor;
+	public:
+		CompositorTranslator();
+		void translate(ScriptCompiler *compiler, const AbstractNodePtr &node);
+	};
+	class _OgreExport CompositionTechniqueTranslator : public ScriptTranslator
+	{
+	protected:
+		CompositionTechnique *mTechnique;
+	public:
+		CompositionTechniqueTranslator();
+		void translate(ScriptCompiler *compiler, const AbstractNodePtr &node);
+	};
+	class _OgreExport CompositionTargetPassTranslator : public ScriptTranslator
+	{
+	protected:
+		CompositionTargetPass *mTarget;
+	public:
+		CompositionTargetPassTranslator();
+		void translate(ScriptCompiler *compiler, const AbstractNodePtr &node);
+	};
+	class _OgreExport CompositionPassTranslator : public ScriptTranslator
+	{
+	protected:
+		CompositionPass *mPass;
+	public:
+		CompositionPassTranslator();
+		void translate(ScriptCompiler *compiler, const AbstractNodePtr &node);
+	};
+
+	/**************************************************************************
+	 * BuiltinScriptTranslatorManager
+	 *************************************************************************/
+	/// This class manages the builtin translators
+	class _OgreExport BuiltinScriptTranslatorManager : public ScriptTranslatorManager
+	{
+	private:
+		MaterialTranslator mMaterialTranslator;
+		TechniqueTranslator mTechniqueTranslator;
+		PassTranslator mPassTranslator;
+		TextureUnitTranslator mTextureUnitTranslator;
+		TextureSourceTranslator mTextureSourceTranslator;
+		GpuProgramTranslator mGpuProgramTranslator;
+		SharedParamsTranslator mSharedParamsTranslator;
+		ParticleSystemTranslator mParticleSystemTranslator;
+		ParticleEmitterTranslator mParticleEmitterTranslator;
+		ParticleAffectorTranslator mParticleAffectorTranslator;
+		CompositorTranslator mCompositorTranslator;
+		CompositionTechniqueTranslator mCompositionTechniqueTranslator;
+		CompositionTargetPassTranslator mCompositionTargetPassTranslator;
+		CompositionPassTranslator mCompositionPassTranslator;
+	public:
+		BuiltinScriptTranslatorManager();
+		/// Returns the number of translators being managed
+		virtual size_t getNumTranslators() const;
+		/// Returns a manager for the given object abstract node, or null if it is not supported
+		virtual ScriptTranslator *getTranslator(const AbstractNodePtr &node);
+	};
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreSearchOps.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreSearchOps.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreSearchOps.h	(revision 148)
@@ -0,0 +1,69 @@
+/*
+-----------------------------------------------------------------------------
+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 __SearchOps_H_
+#define __SearchOps_H_
+
+// Emulate _findfirst, _findnext on non-Windows platforms
+
+
+
+#include <string.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <stdlib.h>
+
+#include "OgrePlatform.h"
+
+
+#if OGRE_PLATFORM != OGRE_PLATFORM_WIN32 && OGRE_PLATFORM != OGRE_PLATFORM_WINRT
+
+#include <dirent.h>
+#include <unistd.h>
+#include <fnmatch.h>
+
+/* Our simplified data entry structure */
+struct _finddata_t
+{
+    char *name;
+    int attrib;
+    unsigned long size;
+};
+
+#define _A_NORMAL 0x00  /* Normalfile-Noread/writerestrictions */
+#define _A_RDONLY 0x01  /* Read only file */
+#define _A_HIDDEN 0x02  /* Hidden file */
+#define _A_SYSTEM 0x04  /* System file */
+#define _A_ARCH   0x20  /* Archive file */
+#endif
+#define _A_SUBDIR 0x10  /* Subdirectory */
+
+intptr_t _findfirst(const char *pattern, struct _finddata_t *data);
+int _findnext(intptr_t id, struct _finddata_t *data);
+int _findclose(intptr_t id);
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreSerializer.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreSerializer.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreSerializer.h	(revision 148)
@@ -0,0 +1,122 @@
+/*
+-----------------------------------------------------------------------------
+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 __Serializer_H__
+#define __Serializer_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreString.h"
+#include "OgreDataStream.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+	/** Generic class for serialising data to / from binary stream-based files.
+    @remarks
+        This class provides a number of useful methods for exporting / importing data
+        from stream-oriented binary files (e.g. .mesh and .skeleton).
+    */
+	class _OgreExport Serializer : public SerializerAlloc
+    {
+    public:
+        Serializer();
+        virtual ~Serializer();
+
+		/// The endianness of written files
+		enum Endian
+		{
+			/// Use the platform native endian
+			ENDIAN_NATIVE,
+			/// Use big endian (0x1000 is serialised as 0x10 0x00)
+			ENDIAN_BIG,
+			/// Use little endian (0x1000 is serialised as 0x00 0x10)
+			ENDIAN_LITTLE
+		};
+
+
+    protected:
+
+        uint32 mCurrentstreamLen;
+        DataStreamPtr mStream;
+        String mVersion;
+		bool mFlipEndian; /// Default to native endian, derive from header
+
+        // Internal methods
+        virtual void writeFileHeader(void);
+        virtual void writeChunkHeader(uint16 id, size_t size);
+        
+        void writeFloats(const float* const pfloat, size_t count);
+        void writeFloats(const double* const pfloat, size_t count);
+        void writeShorts(const uint16* const pShort, size_t count);
+        void writeInts(const uint32* const pInt, size_t count); 
+        void writeBools(const bool* const pLong, size_t count);
+        void writeObject(const Vector3& vec);
+        void writeObject(const Quaternion& q);
+        
+        void writeString(const String& string);
+        void writeData(const void* const buf, size_t size, size_t count);
+        
+        virtual void readFileHeader(DataStreamPtr& stream);
+        virtual unsigned short readChunk(DataStreamPtr& stream);
+        
+        void readBools(DataStreamPtr& stream, bool* pDest, size_t count);
+        void readFloats(DataStreamPtr& stream, float* pDest, size_t count);
+        void readFloats(DataStreamPtr& stream, double* pDest, size_t count);
+        void readShorts(DataStreamPtr& stream, uint16* pDest, size_t count);
+        void readInts(DataStreamPtr& stream, uint32* pDest, size_t count);
+        void readObject(DataStreamPtr& stream, Vector3& pDest);
+        void readObject(DataStreamPtr& stream, Quaternion& pDest);
+
+        String readString(DataStreamPtr& stream);
+        String readString(DataStreamPtr& stream, size_t numChars);
+        
+        virtual void flipToLittleEndian(void* pData, size_t size, size_t count = 1);
+        virtual void flipFromLittleEndian(void* pData, size_t size, size_t count = 1);
+        
+        virtual void flipEndian(void * pData, size_t size, size_t count);
+        virtual void flipEndian(void * pData, size_t size);
+
+		/// Determine the endianness of the incoming stream compared to native
+		virtual void determineEndianness(DataStreamPtr& stream);
+		/// Determine the endianness to write with based on option
+		virtual void determineEndianness(Endian requestedEndian);
+    };
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreShadowCameraSetup.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreShadowCameraSetup.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreShadowCameraSetup.h	(revision 148)
@@ -0,0 +1,109 @@
+/*
+-----------------------------------------------------------------------------
+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 __ShadowCameraSetup_H__
+#define __ShadowCameraSetup_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreMovablePlane.h"
+#include "OgreSharedPtr.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Scene
+	*  @{
+	*/
+	/** This class allows you to plug in new ways to define the camera setup when
+		rendering and projecting shadow textures.
+	@remarks
+		The default projection used when rendering shadow textures is a uniform
+		frustum. This is pretty straight forward but doesn't make the best use of 
+		the space in the shadow map since texels closer to the camera will be larger, 
+		resulting in 'jaggies'. There are several ways to distribute the texels
+		in the shadow texture differently, and this class allows you to override
+		that. 
+	@par
+		Ogre is provided with several alternative shadow camera setups, including
+		LiSPSM (LiSPSMShadowCameraSetup) and Plane Optimal (PlaneOptimalShadowCameraSetup).
+		Others can of course be written to incorporate other algorithms. All you 
+		have to do is instantiate one of these classes and enable it using 
+		SceneManager::setShadowCameraSetup (global) or Light::setCustomShadowCameraSetup
+		(per light). In both cases the instance is wrapped in a SharedPtr which means
+		it will  be deleted automatically when no more references to it exist.
+	@note
+        Shadow map matrices, being projective matrices, have 15 degrees of freedom.
+		3 of these degrees of freedom are fixed by the light's position.  4 are used to
+		affinely affect z values.  6 affinely affect u,v sampling.  2 are projective
+		degrees of freedom.  This class is meant to allow custom methods for 
+		handling optimization.
+    */
+	class _OgreExport ShadowCameraSetup : public ShadowDataAlloc
+	{
+	public:
+		/// Function to implement -- must set the shadow camera properties
+		virtual void getShadowCamera (const SceneManager *sm, const Camera *cam, 
+									  const Viewport *vp, const Light *light, Camera *texCam, size_t iteration) const = 0;
+		/// Need virtual destructor in case subclasses use it
+		virtual ~ShadowCameraSetup() {}
+
+	};
+
+
+
+	/** Implements default shadow camera setup
+        @remarks
+            This implements the default shadow camera setup algorithm.  This is what might
+			be referred to as "normal" shadow mapping.  
+    */
+	class _OgreExport DefaultShadowCameraSetup : public ShadowCameraSetup
+	{
+	public:
+		/// Default constructor
+		DefaultShadowCameraSetup();
+		/// Destructor
+		virtual ~DefaultShadowCameraSetup();
+
+		/// Default shadow camera setup
+		virtual void getShadowCamera (const SceneManager *sm, const Camera *cam, 
+									  const Viewport *vp, const Light *light, Camera *texCam, size_t iteration) const;
+	};
+
+
+
+	typedef SharedPtr<ShadowCameraSetup> ShadowCameraSetupPtr;
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreShadowCameraSetupFocused.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreShadowCameraSetupFocused.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreShadowCameraSetupFocused.h	(revision 148)
@@ -0,0 +1,316 @@
+/*
+-----------------------------------------------------------------------------
+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
+Copyright (c) 2006 Matthias Fink, netAllied GmbH <matthias.fink@web.de>								
+
+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 __ShadowCameraSetupFocused_H__
+#define __ShadowCameraSetupFocused_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreShadowCameraSetup.h"
+#include "OgrePolygon.h"
+#include "OgreConvexBody.h"
+#include "OgreHeaderPrefix.h"
+
+
+namespace Ogre {
+
+    class ConvexBody;
+
+    /** \addtogroup Core
+    *  @{
+    */
+    /** \addtogroup Scene
+    *  @{
+    */
+    /** Implements the uniform shadow mapping algorithm in focused mode.
+    @remarks
+        Differs from the default shadow mapping projection in that it focuses the
+        shadow map on the visible areas of the scene. This results in better
+        shadow map texel usage, at the expense of some 'swimming' of the shadow
+        texture on receivers as the basis is constantly being reevaluated.
+    @note
+        Original implementation by Matthias Fink <matthias.fink@web.de>, 2006.
+    */
+    class _OgreExport FocusedShadowCameraSetup : public ShadowCameraSetup
+    {
+    protected:
+        /** Transform to or from light space as defined by Wimmer et al.
+        @remarks
+            Point and spot lights need to be converted to directional lights to enable a 1:1 
+            light mapping. Otherwise a directional light may become a point light or a point 
+            sink (opposite of a light source) or point/spot lights may become directional lights
+            or light sinks. The light direction is always -y.
+        */
+        static const Matrix4 msNormalToLightSpace;
+        static const Matrix4 msLightSpaceToNormal;
+
+        /** Temporary preallocated frustum to set up a projection matrix in 
+            calculateShadowMappingMatrix().
+        */
+        Frustum* mTempFrustum;
+
+        /** Temporary preallocated camera to set up a light frustum for clipping in FocusedShadowCameraSetup::calculateB.
+        */
+        Camera* mLightFrustumCamera;
+        mutable bool mLightFrustumCameraCalculated;
+
+        /// Use tighter focus region?
+        bool mUseAggressiveRegion;
+
+        /** Internal class holding a point list representation of a convex body.
+        */
+        class _OgreExport PointListBody
+        {
+            Polygon::VertexList mBodyPoints;
+            AxisAlignedBox      mAAB;
+
+        public:
+            PointListBody();
+            PointListBody(const ConvexBody& body);
+            ~PointListBody();
+
+            /** Merges a second PointListBody into this one.
+            */
+            void merge(const PointListBody& plb);
+
+            /** Builds a point list body from a 'real' body.
+            @remarks
+                Inserts all vertices from a body into the point list with or without adding duplicate vertices.
+            */
+            void build(const ConvexBody& body, bool filterDuplicates = true);
+
+            /** Builds a PointListBody from a Body and includes all the space in a given direction.
+            @remarks
+                Intersects the bounding box with a ray from each available point of the body with the given
+                direction. Base and intersection points are stored in a PointListBody structure.
+            @note
+                Duplicate vertices are not filtered.
+            @note
+                Body is not checked for correctness.
+            */
+            void buildAndIncludeDirection(const ConvexBody& body, 
+                Real extrudeDist, const Vector3& dir);
+
+            /** Returns the bounding box representation.
+            */
+            const AxisAlignedBox& getAAB(void) const;	
+
+            /** Adds a specific point to the body list.
+            */
+            void addPoint(const Vector3& point);
+
+            /** Adds all points of an AAB.
+            */
+            void addAAB(const AxisAlignedBox& aab);
+
+            /** Returns a point.
+            */
+            const Vector3& getPoint(size_t cnt) const;
+
+            /** Returns the point count.
+            */
+            size_t getPointCount(void) const;
+
+            /** Resets the body.
+            */
+            void reset(void);
+
+        };
+
+        // Persistent calculations to prevent reallocation
+        mutable ConvexBody mBodyB;
+        mutable PointListBody mPointListBodyB;
+        mutable PointListBody mPointListBodyLVS;
+
+    protected:
+        /** Calculates the standard shadow mapping matrix.
+        @remarks
+            Provides the view and projection matrix for standard shadow mapping.
+        @note
+            You can choose which things you want to have: view matrix and/or projection 
+            matrix and/or shadow camera. Passing a NULL value as parameter ignores the
+            generation of this specific value.
+        @param sm
+            Scene manager.
+        @param cam
+            Currently active camera.
+        @param light
+            Currently active light.
+        @param out_view
+            Calculated uniform view shadow mapping matrix (may be @c NULL).
+        @param out_proj
+            Calculated uniform projection shadow mapping matrix (may be @c NULL).
+        @param out_cam
+            Calculated uniform shadow camera (may be @c NULL).
+        */
+        void calculateShadowMappingMatrix(const SceneManager& sm, const Camera& cam, 
+            const Light& light, Matrix4 *out_view, 
+            Matrix4 *out_proj, Camera *out_cam) const;
+
+        /** Calculates the intersection bodyB.
+        @remarks
+            The intersection bodyB consists of the concatenation the cam frustum clipped 
+            by the scene bounding box followed by a convex hullification with the light's 
+            position and the clipping with the scene bounding box and the light frustum:
+            ((V \cap S) + l) \cap S \cap L (\cap: convex intersection, +: convex hull 
+            operation).
+            For directional lights the bodyB is assembled out of the camera frustum 
+            clipped by the scene bounding box followed by the extrusion of all available 
+            bodyB points towards the negative light direction. The rays are intersected 
+            by a maximum bounding box and added to the bodyB points to form the final 
+            intersection bodyB point list.
+        @param sm
+            Scene manager.
+        @param cam
+            Currently active camera.
+        @param light
+            Currently active light.
+        @param sceneBB
+            Scene bounding box for clipping operations.
+        @param receiverBB
+            Bounding information for just the receivers.
+        @param out_bodyB
+            Final intersection bodyB point list.
+        */
+        void calculateB(const SceneManager& sm, const Camera& cam, const Light& light, 
+            const AxisAlignedBox& sceneBB, const AxisAlignedBox& receiverBB, PointListBody *out_bodyB) const;
+
+        /** Calculates the bodyLVS.
+        @remarks
+            Calculates the bodyLVS which consists of the convex intersection operation 
+            affecting the light frustum, the view frustum, and the current scene bounding
+            box is used to find suitable positions in the viewer's frustum to build the 
+            rotation matrix L_r. This matrix is applied after the projection matrix L_p to 
+            avoid an accidental flip of the frustum orientation for views tilted with 
+            respect to the shadow map.
+        @param cam
+            Current viewer camera.
+        @param light
+            Current light.
+        @param sceneBB
+            Holds all potential occluders / receivers as one single bounding box
+            of the currently active scene node.
+        @param out_LVS
+            Intersection body LVS (world coordinates).
+        */
+        void calculateLVS(const SceneManager& sm, const Camera& cam, const Light& light,
+            const AxisAlignedBox& sceneBB, PointListBody *out_LVS) const;
+
+        /** Returns the projection view direction.
+        @remarks
+            After the matrix L_p is applied the orientation of the light space may tilt for
+            non-identity projections. To prevent a false shadow cast the real view direction
+            is evaluated and applied to the light matrix L.
+        @param lightSpace
+            Matrix of the light space transformation.
+        @param cam
+            Current viewer camera.
+        @param bodyLVS
+            Intersection body LVS (relevant space in front of the camera).
+        */
+        Vector3 getLSProjViewDir(const Matrix4& lightSpace, const Camera& cam, 
+            const PointListBody& bodyLVS) const;
+
+        /** Returns a valid near-point seen by the camera.
+        @remarks
+            Returns a point that is situated near the camera by analyzing the bodyLVS that
+            contains all the relevant scene space in front of the light and the camera in
+            a point list array. The view matrix is relevant because the nearest point in
+            front of the camera should be determined.
+        @param viewMatrix
+            View matrix of the current camera.
+        @param bodyLVS
+            Intersection body LVS (relevant space in front of the camera).
+        */
+        Vector3 getNearCameraPoint_ws(const Matrix4& viewMatrix, 
+            const PointListBody& bodyLVS) const;
+
+        /** Transforms a given body to the unit cube (-1,-1,-1) / (+1,+1,+1) with a specific 
+            shadow matrix enabled.
+        @remarks
+            Transforms a given point list body object with the matrix m and then maps its
+            extends to a (-1,-1,-1) / (+1,+1,+1) unit cube.
+        @param m
+            Transformation matrix applied on the point list body.
+        @param body 
+            Contains the points of the extends of all valid scene elements which 
+            are mapped to the unit cube.
+        */
+        Matrix4 transformToUnitCube(const Matrix4& m, const PointListBody& body) const;
+
+        /** Builds a view matrix.
+        @remarks
+            Builds a standard view matrix out of a given position, direction and up vector.
+        */
+        Matrix4 buildViewMatrix(const Vector3& pos, const Vector3& dir, const Vector3& up) const;
+
+    public:
+        /** Default constructor.
+        @remarks
+            Temporary frustum and camera set up here.
+        */
+        FocusedShadowCameraSetup(void);
+
+        /** Default destructor.
+        @remarks
+            Temporary frustum and camera destroyed here.
+        */
+        virtual ~FocusedShadowCameraSetup(void);
+
+        /** Returns a uniform shadow camera with a focused view.
+        */
+        virtual void getShadowCamera(const SceneManager *sm, const Camera *cam, 
+            const Viewport *vp, const Light *light, Camera *texCam, size_t iteration) const;
+
+        /** Sets whether or not to use the more aggressive approach to deciding on
+            the focus region or not.
+        @note
+            There are 2 approaches that can  be used to define the focus region,
+            the more aggressive way introduced by Wimmer et al, or the original
+            way as described in Stamminger et al. Wimmer et al's way tends to 
+            come up with a tighter focus region but in rare cases (mostly highly
+            glancing angles) can cause some shadow casters to be clipped 
+            incorrectly. By default the more aggressive approach is used since it
+            leads to significantly better results in most cases, but if you experience
+            clipping issues, you can use the less aggressive version.
+        @param aggressive
+            True to use the more aggressive approach, false otherwise.
+        */
+        void setUseAggressiveFocusRegion(bool aggressive) { mUseAggressiveRegion = aggressive; }
+
+        bool getUseAggressiveFocusRegion() const { return mUseAggressiveRegion; }
+
+    };
+
+    /** @} */
+    /** @} */
+
+} // namespace Ogre
+
+#include "OgreHeaderSuffix.h"
+
+#endif // __ShadowCameraSetupFocused_H__
Index: /ogre_src_v1-9-0/OgreMain/include/OgreShadowCameraSetupLiSPSM.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreShadowCameraSetupLiSPSM.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreShadowCameraSetupLiSPSM.h	(revision 148)
@@ -0,0 +1,256 @@
+/*
+-----------------------------------------------------------------------------
+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
+Copyright (c) 2006 Matthias Fink, netAllied GmbH <matthias.fink@web.de>								
+
+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 __ShadowCameraSetupLiSPSM_H__
+#define __ShadowCameraSetupLiSPSM_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreShadowCameraSetupFocused.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre 
+{
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Scene
+	*  @{
+	*/
+	/** Implements the Light Space Perspective Shadow Mapping Algorithm.
+	@remarks
+	Implements the LiSPSM algorithm for an advanced shadow map generation. LiSPSM was
+	developed by Michael Wimmer, Daniel Scherzer and Werner Purgathofer of the TU Wien.
+	The algorithm was presented on the Eurographics Symposium on Rendering 2004.
+	@note
+	Shadow mapping was introduced by Williams in 1978. First a depth image is rendered
+	from the light's view and compared in a second pass with depth values of the normal 
+	camera view. In case the depth camera's depth value is greater than the depth seen
+	by the light the fragment lies in the shadow.
+	The concept has a major draw back named perspective aliasing. The shadow map distri-
+	butes the samples uniformly meaning the position of the viewer is ignored. For the 
+	viewer however the perspective projection affects near objects to be displayed 
+	bigger than further away objects. The same thing happens with the shadow map texels:
+	Near shadows appear very coarse and far away shadows are perfectly sampled.
+	In 2002 Stamminger et al. presented an algorithm called Perspective Shadow Maps 
+	(PSM). PSM battles the perspective aliasing by distributing 50% of the shadow map 
+	texels for objects in the range of <near clipping plane> to <near clipping plane * 2>
+	which inverts the problem: The shadows near the viewer are perfectly sampled, 
+	however far away shadow may contain aliasing artefacts. A near clipping plane may be
+	a problem. But this is not the only one. In the post-perspective space the light 
+	sources are non-intuitively mapped: Directional lights may become point light and 
+	point lights may become directional lights. Also light sinks (opposite of a light 
+	source) may appear.	Another problem are shadow casters located behind the viewer. 
+	In post-projective space objects behind the viewer are mapped in front of him with 
+	a flipped up-vector.
+	LiSPSM battles the light source problem of the post-projective space by rearranging
+	the light space before transformation in such a way that no special cases appear. 
+	This is done by converting point/spot lights into directional lights. The light 
+	space is arranged in such a way that the light direction equals the inverse UNIT_Y.
+	In this combination	the directional light will neither change its type nor its 
+	direction. Furthermore all visible objects and shadow casters affecting the user's 
+	visible area lie in front of the shadow camera: After building the intersection body
+	that contains all these objects (body intersection building was introduced with PSM; 
+	have a look at the description for the method "calculateB" for further info) a 
+	frustum around the body's light space bounding box is created. A parameter (called 
+	'n') automatically adjusts the shadow map sample distribution by specifying the 
+	frustum's view point - near plane which affects the perspective warp. In case the 
+	distance is small the perspecive warp will be strong. As a consequence near objects 
+	will gain quality.
+	However there are still problems. PSM as well as LiSPSM only devote to minimize
+	perspective aliasing. Projection aliasing is still a problem, also 'swimming 
+	artefacts' still occur. The LiSPSM quality distribution is very good but not the 
+	best available: Some sources say logarithmic shadow mapping is the non plus ultra, 
+	however others reject this thought. There is a research project on logarithmic shadow 
+	maps. The web page url is http://gamma.cs.unc.edu/logsm/. However there is no techical 
+	report available yet (Oct 23rd, 2006).
+	@note
+	More information can be found on the webpage of the TU Wien: 
+	http://www.cg.tuwien.ac.at/research/vr/lispsm/
+	@note
+	Original implementation by Matthias Fink <matthias.fink@web.de>, 2006.
+	*/
+	class _OgreExport LiSPSMShadowCameraSetup : public FocusedShadowCameraSetup
+	{
+	protected:
+		/// Warp factor adjustment
+		Real mOptAdjustFactor;
+		/// Use simple nopt derivation?
+		bool mUseSimpleNOpt;
+		/// Extra calculated warp factor
+		mutable Real mOptAdjustFactorTweak;
+		/// Threshold (cos angle) within which to start increasing the opt adjust as camera direction approaches light direction
+		Real mCosCamLightDirThreshold;
+
+		/** Calculates the LiSPSM projection matrix P.
+		@remarks
+		The LiSPSM projection matrix will be built around the axis aligned bounding box 
+		of the intersection body B in light space. The distance between the near plane 
+		and the projection center is chosen in such a way (distance is set by the para-
+		meter n) that the perspective error is the same on the near and far	plane. In 
+		case P equals the identity matrix the algorithm falls back to a uniform shadow
+		mapping matrix.
+		@param lightSpace Matrix of the light space transformation
+		@param bodyB Intersection body B
+		@param bodyLVS Intersection body LVS (relevant space in front of the camera)
+		@param sm Scene manager
+		@param cam Currently active camera
+		@param light Currently active light
+		*/
+		Matrix4 calculateLiSPSM(const Matrix4& lightSpace, const PointListBody& bodyB, 
+			const PointListBody& bodyLVS, const SceneManager& sm, 
+			const Camera& cam, const Light& light) const;
+
+		/** Calculates the distance between camera position and near clipping plane.
+		@remarks
+		n_opt determines the distance between light space origin (shadow camera position)
+		and	the near clipping plane to achieve an optimal perspective foreshortening effect.
+		In this	way the texel distribution over the shadow map is controlled.
+
+		Formula:
+		               d
+		n_opt = ---------------
+		        sqrt(z1/z0) - 1
+
+		Parameters:
+		d: distance between the near and the far clipping plane
+		z0: located on the near clipping plane of the intersection body b
+		z1: located on the far clipping plane with the same x/y values as z0		
+		@note
+		A positive value is applied as the distance between viewer and near clipping plane.
+		In case null is returned uniform shadow mapping will be applied.
+		@param lightSpace Matrix of the light space transformation
+		@param bodyBABB_ls Bounding box of the transformed (light space) bodyB
+		@param bodyLVS Point list of the bodyLVS which describes the scene space which is in
+		front of the light and the camera
+		@param cam Currently active camera
+		*/
+		Real calculateNOpt(const Matrix4& lightSpace, const AxisAlignedBox& bodyBABB_ls, 
+			const PointListBody& bodyLVS, const Camera& cam) const;
+
+		/** Calculates a simpler version than the one above.
+		*/
+		Real calculateNOptSimple(const PointListBody& bodyLVS, 
+			const Camera& cam) const;
+
+		/** Calculates the visible point on the near plane for the n_opt calculation
+		@remarks
+		z0 lies on the parallel plane to the near plane through e and on the near plane of 
+		the frustum C (plane z = bodyB_zMax_ls) and on the line x = e.x.
+		@param lightSpace Matrix of the light space transformation
+		@param e The LiSPSM parameter e is located near or on the near clipping plane of the
+		LiSPSM frustum C
+		@param bodyB_zMax_ls Maximum z-value of the light space bodyB bounding box
+		@param cam Currently active camera
+		*/
+		Vector3 calculateZ0_ls(const Matrix4& lightSpace, const Vector3& e, Real bodyB_zMax_ls, 
+			const Camera& cam) const;
+
+		/** Builds a frustum matrix.
+		@remarks
+		Builds a standard frustum matrix out of the distance info of the six frustum 
+		clipping planes.
+		*/
+		Matrix4 buildFrustumProjection(Real left, Real right, Real bottom, 
+			Real top, Real near, Real far) const;
+
+	public:
+		/** Default constructor.
+		@remarks
+		Nothing done here.
+		*/
+		LiSPSMShadowCameraSetup(void);
+
+		/** Default destructor.
+		@remarks
+		Nothing done here.
+		*/
+		virtual ~LiSPSMShadowCameraSetup(void);
+
+		/** Returns a LiSPSM shadow camera.
+		@remarks
+		Builds and returns a LiSPSM shadow camera. 
+		More information can be found on the webpage of the TU Wien: 
+		http://www.cg.tuwien.ac.at/research/vr/lispsm/
+		*/
+		virtual void getShadowCamera(const SceneManager *sm, const Camera *cam, 
+			const Viewport *vp, const Light *light, Camera *texCam, size_t iteration) const;
+
+		/** Adjusts the parameter n to produce optimal shadows.
+		@remarks
+		The smaller the parameter n, the stronger the perspective warping effect.
+		The consequence of a stronger warping is that the near shadows will gain 
+		quality while the far ones will lose it. Depending on your scene and light
+		types you may want to tweak this value - for example directional lights
+		tend to benefit from higher values of n than other types of light, 
+		especially if you expect to see more distant shadows (say if the viewpoint is
+		higher above the ground plane). Remember that you can supply separate
+		ShadowCameraSetup instances configured differently per light if you wish.
+		@param n The adjustment factor - default is 0.1f. 
+		*/
+		virtual void setOptimalAdjustFactor(Real n) { mOptAdjustFactor = n; }
+		/** Get the parameter n used to produce optimal shadows. 
+		@see setOptimalAdjustFactor
+		*/
+		virtual Real getOptimalAdjustFactor() const { return mOptAdjustFactor; }
+		/** Sets whether or not to use a slightly simpler version of the 
+			camera near point derivation (default is true)
+		*/
+		virtual void setUseSimpleOptimalAdjust(bool s) { mUseSimpleNOpt = s; }
+		/** Gets whether or not to use a slightly simpler version of the 
+		camera near point derivation (default is true)
+		*/
+		virtual bool getUseSimpleOptimalAdjust() const { return mUseSimpleNOpt; }
+
+		/** Sets the threshold between the camera and the light direction below
+			which the LiSPSM projection is 'flattened', since coincident light
+			and camera projections cause problems with the perspective skew.
+			@remarks
+			For example, setting this to 20 degrees will mean that as the difference 
+			between the light and camera direction reduces from 20 degrees to 0
+			degrees, the perspective skew will be proportionately removed.
+		*/
+		virtual void setCameraLightDirectionThreshold(Degree angle);
+
+		/** Sets the threshold between the camera and the light direction below
+		which the LiSPSM projection is 'flattened', since coincident light
+		and camera projections cause problems with the perspective skew.
+		*/
+		virtual Degree getCameraLightDirectionThreshold() const;
+
+
+	};
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreShadowCameraSetupPSSM.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreShadowCameraSetupPSSM.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreShadowCameraSetupPSSM.h	(revision 148)
@@ -0,0 +1,130 @@
+/*
+-----------------------------------------------------------------------------
+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
+Copyright (c) 2006 Matthias Fink, netAllied GmbH <matthias.fink@web.de>								
+
+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 __ShadowCameraSetupPSSM_H__
+#define __ShadowCameraSetupPSSM_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreShadowCameraSetupLiSPSM.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre
+{
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Scene
+	*  @{
+	*/
+	/** Parallel Split Shadow Map (PSSM) shadow camera setup. 
+	@remarks
+		A PSSM shadow system uses multiple shadow maps per light and maps each
+		texture into a region of space, progressing away from the camera. As such
+		it is most appropriate for directional light setups. This particular version
+		also uses LiSPSM projection for each split to maximise the quality. 
+	@note
+		Because PSSM uses multiple shadow maps per light, you will need to increase
+		the number of shadow textures available (via SceneManager) to match the 
+		number of shadow maps required (default is 3 per light). 
+	*/
+	class _OgreExport PSSMShadowCameraSetup : public Ogre::LiSPSMShadowCameraSetup
+	{
+	public:
+		typedef vector<Real>::type SplitPointList;
+		typedef vector<Real>::type OptimalAdjustFactorList;
+
+	protected:
+		uint mSplitCount;
+		SplitPointList mSplitPoints;
+		OptimalAdjustFactorList mOptimalAdjustFactors;
+		Real mSplitPadding;
+
+		mutable size_t mCurrentIteration;
+
+	public:
+		/// Constructor, defaults to 3 splits
+		PSSMShadowCameraSetup();
+		~PSSMShadowCameraSetup();
+
+		/** Calculate a new splitting scheme.
+		@param splitCount The number of splits to use
+		@param nearDist The near plane to use for the first split
+		@param farDist The far plane to use for the last split
+		@param lambda Factor to use to reduce the split size 
+		*/
+		void calculateSplitPoints(uint splitCount, Real nearDist, Real farDist, Real lambda = 0.95);
+
+		/** Manually configure a new splitting scheme.
+		@param newSplitPoints A list which is splitCount + 1 entries long, containing the
+			split points. The first value is the near point, the last value is the
+			far point, and each value in between is both a far point of the previous
+			split, and a near point for the next one.
+		*/
+		void setSplitPoints(const SplitPointList& newSplitPoints);
+
+		/** Set the LiSPSM optimal adjust factor for a given split (call after
+			configuring splits).
+		*/
+		void setOptimalAdjustFactor(size_t splitIndex, Real factor);
+
+		/** Set the padding factor to apply to the near & far distances when matching up
+			splits to one another, to avoid 'cracks'.
+		*/
+		void setSplitPadding(Real pad) { mSplitPadding = pad; }
+
+		/** Get the padding factor to apply to the near & far distances when matching up
+			splits to one another, to avoid 'cracks'.
+		*/
+		Real getSplitPadding() const { return mSplitPadding; }
+		/// Get the number of splits. 
+		uint getSplitCount() const { return mSplitCount; }
+
+		/// Returns a LiSPSM shadow camera with PSSM splits base on iteration.
+		virtual void getShadowCamera(const Ogre::SceneManager *sm, const Ogre::Camera *cam,
+			const Ogre::Viewport *vp, const Ogre::Light *light, Ogre::Camera *texCam, size_t iteration) const;
+
+		/// Returns the calculated split points.
+		inline const SplitPointList& getSplitPoints() const
+		{ return mSplitPoints; }
+
+		/// Returns the optimal adjust factor for a given split.
+		inline Real getOptimalAdjustFactor(size_t splitIndex) const
+		{ return mOptimalAdjustFactors[splitIndex]; }
+
+		/// Overridden, recommended internal use only since depends on current iteration
+		Real getOptimalAdjustFactor() const;
+
+	};
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreShadowCameraSetupPlaneOptimal.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreShadowCameraSetupPlaneOptimal.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreShadowCameraSetupPlaneOptimal.h	(revision 148)
@@ -0,0 +1,91 @@
+/*
+-----------------------------------------------------------------------------
+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 __ShadowCameraSetupPlaneOptimal_H__
+#define __ShadowCameraSetupPlaneOptimal_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreShadowCameraSetup.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Scene
+	*  @{
+	*/
+	/** Implements the plane optimal shadow camera algorithm.
+        @remarks
+            Given a plane of interest, it is possible to set up the shadow camera
+			matrix such that the mapping between screen and shadow map is the identity
+			(when restricted to pixels that view the plane of interest).  Therefore,
+			if the shadow map resolution matches the screen space resolution (of the 
+			seen planar receiver), we can get pixel perfect shadowing on the plane. 
+			Off the plane, the shadowing is not guaranteed to be perfect and will 
+			likely exhibit the usual sampling artifacts associated with shadow mapping.
+		@note Important: this routine requires double-precision calculations. When you
+			are running under Direct3D, you must ensure that you set the floating
+			point mode to 'Consistent' rather than 'Fastest' to ensure this precision.
+			This does allegedly come with some performance cost but when measuring 
+			it appears to be negligible in modern systems for normal usage.
+		@note Second important note: this projection also only works for lights with
+			a finite position. Therefore you cannot use it for directional lights
+			at this time.
+    */
+	class _OgreExport PlaneOptimalShadowCameraSetup : public ShadowCameraSetup
+	{
+	private:
+		MovablePlane* mPlane;	///< pointer to plane of interest
+	private:
+		PlaneOptimalShadowCameraSetup() {}	///< Default constructor is private
+
+		/// helper function computing projection matrix given constraints
+		Matrix4 computeConstrainedProjection( const Vector4& pinhole, 
+											  const vector<Vector4>::type& fpoint, 
+											  const vector<Vector2>::type& constraint) const;
+
+	public:
+		/// Constructor -- requires a plane of interest
+		PlaneOptimalShadowCameraSetup(MovablePlane *plane);
+		/// Destructor
+		virtual ~PlaneOptimalShadowCameraSetup();
+
+		/// Returns shadow camera configured to get 1-1 homography between screen and shadow map when restricted to plane
+		virtual void getShadowCamera (const SceneManager *sm, const Camera *cam, 
+									  const Viewport *vp, const Light *light, Camera *texCam, size_t iteration) const;
+	};
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreShadowCaster.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreShadowCaster.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreShadowCaster.h	(revision 148)
@@ -0,0 +1,250 @@
+/*
+-----------------------------------------------------------------------------
+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 __ShadowCaster_H__
+#define __ShadowCaster_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreRenderable.h"
+#include "OgreHeaderPrefix.h"
+
+
+namespace Ogre {
+
+    /** \addtogroup Core
+    *  @{
+    */
+    /** \addtogroup Scene
+    *  @{
+    */
+    /** Class which represents the renderable aspects of a set of shadow volume faces. 
+    @remarks
+        Note that for casters comprised of more than one set of vertex buffers (e.g. SubMeshes each
+        using their own geometry), it will take more than one ShadowRenderable to render the 
+        shadow volume. Therefore for shadow caster geometry, it is best to stick to one set of
+        vertex buffers (not necessarily one buffer, but the positions for the entire geometry 
+        should come from one buffer if possible)
+    */
+    class _OgreExport ShadowRenderable : public Renderable, public ShadowDataAlloc
+    {
+    protected:
+        MaterialPtr mMaterial;
+        RenderOperation mRenderOp;
+        ShadowRenderable* mLightCap; /// Used only if isLightCapSeparate == true
+    public:
+        ShadowRenderable() : mMaterial(), mLightCap(0) {}
+        virtual ~ShadowRenderable() { delete mLightCap; }
+        /** Set the material to be used by the shadow, should be set by the caller 
+            before adding to a render queue
+        */
+        void setMaterial(const MaterialPtr& mat) { mMaterial = mat; }
+        /// @copydoc Renderable::getMaterial
+        const MaterialPtr& getMaterial(void) const { return mMaterial; }
+        /// @copydoc Renderable::getRenderOperation
+        void getRenderOperation(RenderOperation& op) { op = mRenderOp; }
+        /// Get the internal render operation for set up.
+        RenderOperation* getRenderOperationForUpdate(void) {return &mRenderOp;}
+        /// @copydoc Renderable::getWorldTransforms
+        void getWorldTransforms(Matrix4* xform) const = 0;
+        /// @copydoc Renderable::getSquaredViewDepth
+        Real getSquaredViewDepth(const Camera*) const{ return 0; /* not used */}
+        /// @copydoc Renderable::getLights.
+        const LightList& getLights(void) const;
+        /** Does this renderable require a separate light cap?
+        @remarks
+            If possible, the light cap (when required) should be contained in the
+            usual geometry of the shadow renderable. However, if for some reason
+            the normal depth function (less than) could cause artefacts, then a
+            separate light cap with a depth function of 'always fail' can be used 
+            instead. The primary example of this is when there are floating point
+            inaccuracies caused by calculating the shadow geometry separately from
+            the real geometry. 
+        */
+        bool isLightCapSeparate(void) const { return mLightCap != 0; }
+
+        /// Get the light cap version of this renderable.
+        ShadowRenderable* getLightCapRenderable(void) { return mLightCap; }
+        /// Should this ShadowRenderable be treated as visible?
+        virtual bool isVisible(void) const { return true; }
+
+        /** This function informs the shadow renderable that the global index buffer
+            from the SceneManager has been updated. As all shadow use this buffer their pointer 
+            must be updated as well.
+        @param indexBuffer
+            Pointer to the new index buffer.
+        */
+        virtual void rebindIndexBuffer(const HardwareIndexBufferSharedPtr& indexBuffer) = 0;
+
+    };
+
+    /** A set of flags that can be used to influence ShadowRenderable creation. */
+    enum ShadowRenderableFlags
+    {
+        /// For shadow volume techniques only, generate a light cap on the volume.
+        SRF_INCLUDE_LIGHT_CAP = 0x00000001,
+        /// For shadow volume techniques only, generate a dark cap on the volume.
+        SRF_INCLUDE_DARK_CAP  = 0x00000002,
+        /// For shadow volume techniques only, indicates volume is extruded to infinity.
+        SRF_EXTRUDE_TO_INFINITY  = 0x00000004
+    };
+
+    /** This class defines the interface that must be implemented by shadow casters.
+    */
+    class _OgreExport ShadowCaster
+    {
+    public:
+        virtual ~ShadowCaster() { }
+        /** Returns whether or not this object currently casts a shadow. */
+        virtual bool getCastShadows(void) const = 0;
+
+        /** Returns details of the edges which might be used to determine a silhouette. */
+        virtual EdgeData* getEdgeList(void) = 0;
+        /** Returns whether the object has a valid edge list. */
+        virtual bool hasEdgeList(void) = 0;
+
+        /** Get the world bounding box of the caster. */
+        virtual const AxisAlignedBox& getWorldBoundingBox(bool derive = false) const = 0;
+        /** Gets the world space bounding box of the light cap. */
+        virtual const AxisAlignedBox& getLightCapBounds(void) const = 0;
+        /** Gets the world space bounding box of the dark cap, as extruded using the light provided. */
+        virtual const AxisAlignedBox& getDarkCapBounds(const Light& light, Real dirLightExtrusionDist) const = 0;
+
+        typedef vector<ShadowRenderable*>::type ShadowRenderableList;
+        typedef VectorIterator<ShadowRenderableList> ShadowRenderableListIterator;
+
+        /** Gets an iterator over the renderables required to render the shadow volume. 
+        @remarks
+            Shadowable geometry should ideally be designed such that there is only one
+            ShadowRenderable required to render the the shadow; however this is not a necessary
+            limitation and it can be exceeded if required.
+        @param shadowTechnique
+            The technique being used to generate the shadow.
+        @param light
+            The light to generate the shadow from.
+        @param indexBuffer
+            The index buffer to build the renderables into, 
+            the current contents are assumed to be disposable.
+        @param extrudeVertices
+            If @c true, this means this class should extrude
+            the vertices of the back of the volume in software. If false, it
+            will not be done (a vertex program is assumed).
+        @param extrusionDistance
+            The distance to extrude the shadow volume.
+        @param flags
+            Technique-specific flags, see ShadowRenderableFlags.
+        */
+        virtual ShadowRenderableListIterator getShadowVolumeRenderableIterator(
+            ShadowTechnique shadowTechnique, const Light* light, 
+            HardwareIndexBufferSharedPtr* indexBuffer, size_t* indexBufferUsedSize,
+            bool extrudeVertices, Real extrusionDistance, unsigned long flags = 0 ) = 0;
+
+        /** Utility method for extruding vertices based on a light. 
+        @remarks
+            Unfortunately, because D3D cannot handle homogeneous (4D) position
+            coordinates in the fixed-function pipeline (GL can, but we have to
+            be cross-API), when we extrude in software we cannot extrude to 
+            infinity the way we do in the vertex program (by setting w to
+            0.0f). Therefore we extrude by a fixed distance, which may cause 
+            some problems with larger scenes. Luckily better hardware (ie
+            vertex programs) can fix this.
+        @param vertexBuffer
+            The vertex buffer containing ONLY xyz position
+            values, which must be originalVertexCount * 2 * 3 floats long.
+        @param originalVertexCount
+            The count of the original number of
+            vertices, i.e. the number in the mesh, not counting the doubling
+            which has already been done (by VertexData::prepareForShadowVolume)
+            to provide the extruded area of the buffer.
+        @param lightPos
+            4D light position in object space, when w=0.0f this
+            represents a directional light.
+        @param extrudeDist
+            The distance to extrude.
+        */
+        static void extrudeVertices(const HardwareVertexBufferSharedPtr& vertexBuffer, 
+            size_t originalVertexCount, const Vector4& lightPos, Real extrudeDist);
+        /** Get the distance to extrude for a point/spot light. */
+        virtual Real getPointExtrusionDistance(const Light* l) const = 0;
+    protected:
+        /// Helper method for calculating extrusion distance.
+        Real getExtrusionDistance(const Vector3& objectPos, const Light* light) const;
+        /** Tells the caster to perform the tasks necessary to update the 
+            edge data's light listing. Can be overridden if the subclass needs 
+            to do additional things. 
+        @param edgeData
+            The edge information to update.
+        @param lightPos
+            4D vector representing the light, a directional light has w=0.0.
+       */
+        virtual void updateEdgeListLightFacing(EdgeData* edgeData, 
+            const Vector4& lightPos);
+
+        /** Generates the indexes required to render a shadow volume into the 
+            index buffer which is passed in, and updates shadow renderables
+            to use it.
+        @param edgeData
+            The edge information to use.
+        @param indexBuffer
+            The buffer into which to write data into; current 
+            contents are assumed to be discardable.
+        @param indexBufferUsedSize
+            If the rest of buffer is enough than it would be locked with
+            HBL_NO_OVERWRITE semantic and indexBufferUsedSize would be increased,
+            otherwise HBL_DISCARD would be used and indexBufferUsedSize would be reset.
+        @param light
+            The light, mainly for type info as silhouette calculations
+            should already have been done in updateEdgeListLightFacing
+        @param shadowRenderables
+            A list of shadow renderables which has 
+            already been constructed but will need populating with details of
+            the index ranges to be used.
+        @param flags
+            Additional controller flags, see ShadowRenderableFlags.
+        */
+        virtual void generateShadowVolume(EdgeData* edgeData, 
+            const HardwareIndexBufferSharedPtr& indexBuffer, size_t& indexBufferUsedSize,
+            const Light* light, ShadowRenderableList& shadowRenderables, unsigned long flags);
+        /** Utility method for extruding a bounding box. 
+        @param box
+            Original bounding box, will be updated in-place.
+        @param lightPos
+            4D light position in object space, when w=0.0f this
+            represents a directional light.
+        @param extrudeDist
+            The distance to extrude.
+        */
+        virtual void extrudeBounds(AxisAlignedBox& box, const Vector4& lightPos, 
+            Real extrudeDist) const;
+
+
+    };
+    /** @} */
+    /** @} */
+} // namespace Ogre
+#include "OgreHeaderSuffix.h"
+
+#endif // __ShadowCaster_H__
Index: /ogre_src_v1-9-0/OgreMain/include/OgreShadowTextureManager.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreShadowTextureManager.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreShadowTextureManager.h	(revision 148)
@@ -0,0 +1,157 @@
+/*-------------------------------------------------------------------------
+This source file is a 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
+
+You may alternatively use this source under the terms of a specific version of
+the OGRE Unrestricted License provided you have obtained such a license from
+Torus Knot Software Ltd.
+-------------------------------------------------------------------------*/
+#ifndef __ShadowTextureManager_H__
+#define __ShadowTextureManager_H__
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+#include "OgreSingleton.h"
+#include "OgrePixelFormat.h"
+#include "OgreTexture.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Scene
+	*  @{
+	*/
+	typedef vector<TexturePtr>::type ShadowTextureList;
+
+	/** Structure containing the configuration for one shadow texture. */
+	struct ShadowTextureConfig
+	{
+		unsigned int width;
+		unsigned int height;
+		PixelFormat format;
+        unsigned int fsaa;
+		uint16		depthBufferPoolId;
+
+		ShadowTextureConfig()
+			: width(512), height(512), format(PF_X8R8G8B8), fsaa(0), depthBufferPoolId(1) {}
+	};
+
+	typedef vector<ShadowTextureConfig>::type ShadowTextureConfigList;
+	typedef ConstVectorIterator<ShadowTextureConfigList> ConstShadowTextureConfigIterator;
+
+	inline _OgreExport bool operator== ( const ShadowTextureConfig& lhs, const ShadowTextureConfig& rhs );
+	inline _OgreExport bool operator!= ( const ShadowTextureConfig& lhs, const ShadowTextureConfig& rhs );
+
+
+	/** Class to manage the available shadow textures which may be shared between
+		many SceneManager instances if formats agree.
+	@remarks
+		The management of the list of shadow textures has been separated out into
+		a dedicated class to enable the clean management of shadow textures
+		across many scene manager instances. Where multiple scene managers are
+		used with shadow textures, the configuration of those shadows may or may
+		not be consistent - if it is, it is good to centrally manage the textures
+		so that creation and destruction responsibility is clear.
+	*/
+	class _OgreExport ShadowTextureManager : public Singleton<ShadowTextureManager>, public ShadowDataAlloc
+	{
+	protected:
+		ShadowTextureList mTextureList;
+		ShadowTextureList mNullTextureList;
+		size_t mCount;
+
+	public:
+		ShadowTextureManager();
+		virtual ~ShadowTextureManager();
+
+		/** Populate an incoming list with shadow texture references as requested
+			in the configuration list.
+		*/
+		virtual void getShadowTextures(const ShadowTextureConfigList& config, 
+			ShadowTextureList& listToPopulate);
+
+		/** Get an appropriately defined 'null' texture, i.e. one which will always
+			result in no shadows.
+		*/
+		virtual TexturePtr getNullShadowTexture(PixelFormat format);
+
+		/** Remove any shadow textures that are no longer being referenced.
+		@remarks
+			This should be called fairly regularly since references may take a 
+			little while to disappear in some cases (if referenced by materials)
+		*/
+		virtual void clearUnused();
+		/** Dereference all the shadow textures kept in this class and remove them
+			from TextureManager; note that it is up to the SceneManagers to clear 
+			their local references.
+		*/
+		virtual void clear();
+
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static ShadowTextureManager& getSingleton(void);
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static ShadowTextureManager* getSingletonPtr(void);
+
+	};
+
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreShadowVolumeExtrudeProgram.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreShadowVolumeExtrudeProgram.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreShadowVolumeExtrudeProgram.h	(revision 148)
@@ -0,0 +1,315 @@
+/*
+-----------------------------------------------------------------------------
+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 __SHADOWVOLUMEEXTRUDEPROGRAM_H__
+#define __SHADOWVOLUMEEXTRUDEPROGRAM_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreLight.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Scene
+	*  @{
+	*/
+	/** Static class containing source for vertex programs for extruding shadow volumes
+    @remarks
+        This exists so we don't have to be dependent on an external media files.
+        Assembler is used so we don't have to rely on particular plugins.
+        The assembler contents of this file were generated from the following Cg:
+    @code
+        // Point light shadow volume extrude
+        void shadowVolumeExtrudePointLight_vp (
+            float4 position			: POSITION,
+            float  wcoord			: TEXCOORD0,
+
+            out float4 oPosition	: POSITION,
+
+            uniform float4x4 worldViewProjMatrix,
+            uniform float4   lightPos // homogeneous, object space
+            )
+        {
+            // extrusion in object space
+            // vertex unmodified if w==1, extruded if w==0
+            float4 newpos = 
+                (wcoord.xxxx * lightPos) + 
+                float4(position.xyz - lightPos.xyz, 0);
+
+            oPosition = mul(worldViewProjMatrix, newpos);
+
+        }
+
+        // Directional light extrude
+        void shadowVolumeExtrudeDirLight_vp (
+            float4 position			: POSITION,
+            float  wcoord			: TEXCOORD0,
+
+            out float4 oPosition	: POSITION,
+
+            uniform float4x4 worldViewProjMatrix,
+            uniform float4   lightPos // homogenous, object space
+            )
+        {
+            // extrusion in object space
+            // vertex unmodified if w==1, extruded if w==0
+            float4 newpos = 
+                (wcoord.xxxx * (position + lightPos)) - lightPos;
+
+            oPosition = mul(worldViewProjMatrix, newpos);
+
+        }
+        // Point light shadow volume extrude - FINITE
+        void shadowVolumeExtrudePointLightFinite_vp (
+            float4 position			: POSITION,
+            float  wcoord			: TEXCOORD0,
+
+            out float4 oPosition	: POSITION,
+
+            uniform float4x4 worldViewProjMatrix,
+            uniform float4   lightPos, // homogeneous, object space
+			uniform float    extrusionDistance // how far to extrude
+            )
+        {
+            // extrusion in object space
+            // vertex unmodified if w==1, extruded if w==0
+			float3 extrusionDir = position.xyz - lightPos.xyz;
+			extrusionDir = normalize(extrusionDir);
+			
+            float4 newpos = float4(position.xyz +  
+                ((1 - wcoord.x) * extrusionDistance * extrusionDir), 1);
+
+            oPosition = mul(worldViewProjMatrix, newpos);
+
+        }
+
+        // Directional light extrude - FINITE
+        void shadowVolumeExtrudeDirLightFinite_vp (
+            float4 position			: POSITION,
+            float  wcoord			: TEXCOORD0,
+
+            out float4 oPosition	: POSITION,
+
+            uniform float4x4 worldViewProjMatrix,
+            uniform float4   lightPos, // homogeneous, object space
+			uniform float    extrusionDistance // how far to extrude
+            )
+        {
+            // extrusion in object space
+            // vertex unmodified if w==1, extruded if w==0
+			// -ve lightPos is direction
+            float4 newpos = float4(position.xyz - 
+                (wcoord.x * extrusionDistance * lightPos.xyz), 1);
+
+            oPosition = mul(worldViewProjMatrix, newpos);
+
+        }		
+    @endcode
+    */
+	class _OgreExport ShadowVolumeExtrudeProgram : public ShadowDataAlloc
+    {
+    private:
+        static String mPointArbvp1;
+        static String mPointVs_1_1;
+		static String mPointVs_4_0;
+		static String mPointVs_glsl;
+		static String mPointVs_glsles;
+        static String mDirArbvp1;
+        static String mDirVs_1_1;
+		static String mDirVs_4_0;
+		static String mDirVs_glsl;
+		static String mDirVs_glsles;
+        // same as above, except the color is set to 1 to enable debug volumes to be seen
+        static String mPointArbvp1Debug;
+        static String mPointVs_1_1Debug;
+		static String mPointVs_4_0Debug;
+		static String mPointVs_glslDebug;
+		static String mPointVs_glslesDebug;
+        static String mDirArbvp1Debug;
+        static String mDirVs_1_1Debug;
+		static String mDirVs_4_0Debug;
+		static String mDirVs_glslDebug;
+		static String mDirVs_glslesDebug;
+		
+        static String mPointArbvp1Finite;
+        static String mPointVs_1_1Finite;
+		static String mPointVs_4_0Finite;
+		static String mPointVs_glslFinite;
+		static String mPointVs_glslesFinite;
+        static String mDirArbvp1Finite;
+        static String mDirVs_1_1Finite;
+		static String mDirVs_4_0Finite;
+		static String mDirVs_glslFinite;
+		static String mDirVs_glslesFinite;
+        // same as above, except the color is set to 1 to enable debug volumes to be seen
+        static String mPointArbvp1FiniteDebug;
+        static String mPointVs_1_1FiniteDebug;
+		static String mPointVs_4_0FiniteDebug;
+		static String mPointVs_glslFiniteDebug;
+		static String mPointVs_glslesFiniteDebug;
+        static String mDirArbvp1FiniteDebug;
+        static String mDirVs_1_1FiniteDebug;
+		static String mDirVs_4_0FiniteDebug;
+		static String mDirVs_glslFiniteDebug;
+		static String mDirVs_glslesFiniteDebug;
+
+		static String mGeneralFs_4_0;
+		static String mGeneralFs_glsl;
+		static String mGeneralFs_glsles;
+
+		static bool mInitialised;
+
+	public:
+#define OGRE_NUM_SHADOW_EXTRUDER_PROGRAMS 8
+        enum Programs
+        {
+            // Point light extruder, infinite distance
+            POINT_LIGHT = 0,
+            // Point light extruder, infinite distance, debug mode
+            POINT_LIGHT_DEBUG = 1,
+            // Directional light extruder, infinite distance
+            DIRECTIONAL_LIGHT = 2,
+            // Directional light extruder, infinite distance, debug mode
+            DIRECTIONAL_LIGHT_DEBUG = 3,
+            // Point light extruder, finite distance
+            POINT_LIGHT_FINITE = 4,
+            // Point light extruder, finite distance, debug mode
+            POINT_LIGHT_FINITE_DEBUG = 5,
+            // Directional light extruder, finite distance
+            DIRECTIONAL_LIGHT_FINITE = 6,
+            // Directional light extruder, finite distance, debug mode
+            DIRECTIONAL_LIGHT_FINITE_DEBUG = 7
+
+        };
+        static const String programNames[OGRE_NUM_SHADOW_EXTRUDER_PROGRAMS];
+		static String frgProgramName;
+
+        /// Initialise the creation of these vertex programs
+        static void initialise(void);
+        /// Shutdown & destroy the vertex programs
+        static void shutdown(void);
+        /// Get extruder program source for point lights, compatible with arbvp1
+        static const String& getPointLightExtruderArbvp1(void) { return mPointArbvp1; }
+        /// Get extruder program source for point lights, compatible with vs_1_1
+        static const String& getPointLightExtruderVs_1_1(void) { return mPointVs_1_1; }
+		/// Get extruder program source for point lights, compatible with vs_4_0
+		static const String& getPointLightExtruderVs_4_0(void) { return mPointVs_4_0; }
+		/// Get extruder program source for point lights, compatible with glsl
+		static const String& getPointLightExtruderVs_glsl(void) { return mPointVs_glsl; }
+		/// Get extruder program source for point lights, compatible with glsles
+		static const String& getPointLightExtruderVs_glsles(void) { return mPointVs_glsles; }
+        /// Get extruder program source for directional lights, compatible with arbvp1
+        static const String& getDirectionalLightExtruderArbvp1(void) { return mDirArbvp1; }
+        /// Get extruder program source for directional lights, compatible with vs_1_1
+        static const String& getDirectionalLightExtruderVs_1_1(void) { return mDirVs_1_1; }
+		/// Get extruder program source for directional lights, compatible with vs_4_0
+		static const String& getDirectionalLightExtruderVs_4_0(void) { return mDirVs_4_0; }
+		/// Get extruder program source for directional lights, compatible with glsl
+		static const String& getDirectionalLightExtruderVs_glsl(void) { return mDirVs_glsl; }
+		/// Get extruder program source for directional lights, compatible with glsles
+		static const String& getDirectionalLightExtruderVs_glsles(void) { return mDirVs_glsles; }
+
+        /// Get extruder program source for debug point lights, compatible with arbvp1
+        static const String& getPointLightExtruderArbvp1Debug(void) { return mPointArbvp1Debug; }
+        /// Get extruder program source for debug point lights, compatible with vs_1_1
+        static const String& getPointLightExtruderVs_1_1Debug(void) { return mPointVs_1_1Debug; }
+		/// Get extruder program source for debug point lights, compatible with vs_4_0
+		static const String& getPointLightExtruderVs_4_0Debug(void) { return mPointVs_4_0Debug; }
+		/// Get extruder program source for debug point lights, compatible with glsl
+		static const String& getPointLightExtruderVs_glslDebug(void) { return mPointVs_glslDebug; }
+		/// Get extruder program source for debug point lights, compatible with glsles
+		static const String& getPointLightExtruderVs_glslesDebug(void) { return mPointVs_glslesDebug; }
+        /// Get extruder program source for debug directional lights, compatible with arbvp1
+        static const String& getDirectionalLightExtruderArbvp1Debug(void) { return mDirArbvp1Debug; }
+        /// Get extruder program source for debug directional lights, compatible with vs_1_1
+        static const String& getDirectionalLightExtruderVs_1_1Debug(void) { return mDirVs_1_1Debug; }
+		/// Get extruder program source for debug directional lights, compatible with vs_4_0
+		static const String& getDirectionalLightExtruderVs_4_0Debug(void) { return mDirVs_4_0Debug; }
+		/// Get extruder program source for debug directional lights, compatible with glsl
+		static const String& getDirectionalLightExtruderVs_glslDebug(void) { return mDirVs_glslDebug; }
+		/// Get extruder program source for debug directional lights, compatible with glsles
+		static const String& getDirectionalLightExtruderVs_glslesDebug(void) { return mDirVs_glslesDebug; }
+        /// General purpose method to get any of the program sources
+        static const String& getProgramSource(Light::LightTypes lightType, const String syntax, 
+            bool finite, bool debug);
+
+        static const String& getProgramName(Light::LightTypes lightType, bool finite, bool debug);
+
+
+        /// Get FINITE extruder program source for point lights, compatible with arbvp1
+        static const String& getPointLightExtruderArbvp1Finite(void) { return mPointArbvp1Finite; }
+        /// Get FINITE extruder program source for point lights, compatible with vs_1_1
+        static const String& getPointLightExtruderVs_1_1Finite(void) { return mPointVs_1_1Finite; }
+		/// Get FINITE extruder program source for point lights, compatible with vs_4_0
+		static const String& getPointLightExtruderVs_4_0Finite(void) { return mPointVs_4_0Finite; }
+		/// Get FINITE extruder program source for point lights, compatible with glsl
+		static const String& getPointLightExtruderVs_glslFinite(void) { return mPointVs_glslFinite; }
+		/// Get FINITE extruder program source for point lights, compatible with glsles
+		static const String& getPointLightExtruderVs_glslesFinite(void) { return mPointVs_glslesFinite; }
+        /// Get FINITE extruder program source for directional lights, compatible with arbvp1
+        static const String& getDirectionalLightExtruderArbvp1Finite(void) { return mDirArbvp1Finite; }
+        /// Get FINITE extruder program source for directional lights, compatible with vs_1_1
+        static const String& getDirectionalLightExtruderVs_1_1Finite(void) { return mDirVs_1_1Finite; }
+		/// Get FINITE extruder program source for directional lights, compatible with vs_4_0
+		static const String& getDirectionalLightExtruderVs_4_0Finite(void) { return mDirVs_4_0Finite; }
+		/// Get FINITE extruder program source for directional lights, compatible with glsl
+		static const String& getDirectionalLightExtruderVs_glslFinite(void) { return mDirVs_glslFinite; }
+		/// Get FINITE extruder program source for directional lights, compatible with glsles
+		static const String& getDirectionalLightExtruderVs_glslesFinite(void) { return mDirVs_glslesFinite; }
+
+        /// Get FINITE extruder program source for debug point lights, compatible with arbvp1
+        static const String& getPointLightExtruderArbvp1FiniteDebug(void) { return mPointArbvp1FiniteDebug; }
+        /// Get extruder program source for debug point lights, compatible with vs_1_1
+        static const String& getPointLightExtruderVs_1_1FiniteDebug(void) { return mPointVs_1_1FiniteDebug; }
+		/// Get extruder program source for debug point lights, compatible with vs_4_0
+		static const String& getPointLightExtruderVs_4_0FiniteDebug(void) { return mPointVs_4_0FiniteDebug; }
+		/// Get extruder program source for debug point lights, compatible with glsl
+		static const String& getPointLightExtruderVs_glslFiniteDebug(void) { return mPointVs_glslFiniteDebug; }
+		/// Get extruder program source for debug point lights, compatible with glsles
+		static const String& getPointLightExtruderVs_glslesFiniteDebug(void) { return mPointVs_glslesFiniteDebug; }
+        /// Get FINITE extruder program source for debug directional lights, compatible with arbvp1
+        static const String& getDirectionalLightExtruderArbvp1FiniteDebug(void) { return mDirArbvp1FiniteDebug; }
+        /// Get FINITE extruder program source for debug directional lights, compatible with vs_1_1
+        static const String& getDirectionalLightExtruderVs_1_1FiniteDebug(void) { return mDirVs_1_1FiniteDebug; }
+		/// Get FINITE extruder program source for debug directional lights, compatible with vs_4_0
+		static const String& getDirectionalLightExtruderVs_4_0FiniteDebug(void) { return mDirVs_4_0FiniteDebug; }
+		/// Get FINITE extruder program source for debug directional lights, compatible with glsl
+		static const String& getDirectionalLightExtruderVs_glslFiniteDebug(void) { return mDirVs_glslFiniteDebug; }
+		/// Get FINITE extruder program source for debug directional lights, compatible with glsles
+		static const String& getDirectionalLightExtruderVs_glslesFiniteDebug(void) { return mDirVs_glslesFiniteDebug; }
+
+    };
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreSharedPtr.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreSharedPtr.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreSharedPtr.h	(revision 148)
@@ -0,0 +1,336 @@
+/*
+-----------------------------------------------------------------------------
+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 __SharedPtr_H__
+#define __SharedPtr_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreAtomicScalar.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+
+	/// The method to use to free memory on destruction
+	enum SharedPtrFreeMethod
+	{
+		/// Use OGRE_DELETE to free the memory
+		SPFM_DELETE,
+		/// Use OGRE_DELETE_T to free (only MEMCATEGORY_GENERAL supported)
+		SPFM_DELETE_T,
+		/// Use OGRE_FREE to free (only MEMCATEGORY_GENERAL supported)
+		SPFM_FREE
+	};
+
+    struct SharedPtrInfo {
+        inline SharedPtrInfo() 
+            : useCount(1)
+        {}
+
+        virtual ~SharedPtrInfo() {}
+
+        AtomicScalar<unsigned>  useCount;
+    };
+
+	template <class T>
+	class SharedPtrInfoDelete : public SharedPtrInfo
+	{
+        T* mObject;
+    public:
+        inline SharedPtrInfoDelete(T* o) : mObject(o) {}
+
+		virtual ~SharedPtrInfoDelete()
+		{
+			OGRE_DELETE mObject;
+		}
+	};
+
+	template <class T>
+	class SharedPtrInfoDeleteT : public SharedPtrInfo
+	{
+        T* mObject;
+    public:
+        inline SharedPtrInfoDeleteT(T* o) : mObject(o) {}
+
+		virtual ~SharedPtrInfoDeleteT()
+		{
+			OGRE_DELETE_T(mObject, T, MEMCATEGORY_GENERAL);
+		}
+	};
+
+	template <class T>
+	class SharedPtrInfoFree : public SharedPtrInfo
+	{
+        T* mObject;
+    public:
+        inline SharedPtrInfoFree(T* o) : mObject(o) {}        
+
+		virtual ~SharedPtrInfoFree()
+		{
+			OGRE_FREE(mObject, MEMCATEGORY_GENERAL);
+		}
+	};
+
+
+	/** Reference-counted shared pointer, used for objects where implicit destruction is 
+        required. 
+    @remarks
+        This is a standard shared pointer implementation which uses a reference 
+        count to work out when to delete the object. 
+	@par
+		If OGRE_THREAD_SUPPORT is defined to be 1, use of this class is thread-safe.
+    */
+	template<class T> class SharedPtr
+	{
+        template<typename Y> friend class SharedPtr;
+	protected:
+        /* DO NOT ADD MEMBERS TO THIS CLASS!
+         *
+         * The average Ogre application has *thousands* of them. Every extra
+         * member causes extra memory use in general, and causes extra padding
+         * to be added to a multitude of structures. 
+         *
+         * Everything you need to do can be acomplished by creatively working 
+         * with the SharedPtrInfo object.
+         *
+         * There is no reason for this object to ever have more than two members.
+         */
+
+		T*             pRep;
+        SharedPtrInfo* pInfo;
+
+        SharedPtr(T* rep, SharedPtrInfo* info) : pRep(rep), pInfo(info)
+		{
+		}
+
+	public:
+		/** Constructor, does not initialise the SharedPtr.
+			@remarks
+				<b>Dangerous!</b> You have to call bind() before using the SharedPtr.
+		*/
+		SharedPtr() : pRep(0), pInfo(0)
+        {}
+
+    private:
+        static SharedPtrInfo* createInfoForMethod(T* rep, SharedPtrFreeMethod method)
+        {
+            switch(method) {
+                case SPFM_DELETE:   return OGRE_NEW_T(SharedPtrInfoDelete<T>,  MEMCATEGORY_GENERAL) (rep);
+                case SPFM_DELETE_T: return OGRE_NEW_T(SharedPtrInfoDeleteT<T>, MEMCATEGORY_GENERAL) (rep);
+                case SPFM_FREE:     return OGRE_NEW_T(SharedPtrInfoFree<T>,    MEMCATEGORY_GENERAL) (rep);
+            }
+            assert(!"Bad method");
+            return 0;
+        }
+    public:
+
+		/** Constructor.
+		@param rep The pointer to take ownership of
+		@param inFreeMethod The mechanism to use to free the pointer
+		*/
+        template< class Y>
+		explicit SharedPtr(Y* rep, SharedPtrFreeMethod inFreeMethod = SPFM_DELETE) 
+            : pRep(rep)
+            , pInfo(rep ? createInfoForMethod(rep, inFreeMethod) : 0)
+		{
+		}
+
+		SharedPtr(const SharedPtr& r)
+            : pRep(r.pRep)
+            , pInfo(r.pInfo)
+		{
+            if (pRep) 
+            {
+                ++pInfo->useCount;
+            }
+		}
+
+		SharedPtr& operator=(const SharedPtr& r) {
+			if (pRep == r.pRep)
+            {
+                assert(pInfo == r.pInfo);
+				return *this;
+            }
+			// Swap current data into a local copy
+			// this ensures we deal with rhs and this being dependent
+			SharedPtr<T> tmp(r);
+			swap(tmp);
+			return *this;
+		}
+		
+		/* For C++11 compilers, use enable_if to only expose functions when viable
+         *
+         * MSVC 2012 and earlier only claim conformance to C++98. This is fortunate,
+         * because they don't support default template parameters
+         */
+#if __cplusplus >= 201103L
+        template<class Y,
+            class = typename std::enable_if<std::is_convertible<Y*, T*>::value>::type>
+#else
+        template<class Y>
+#endif
+        SharedPtr(const SharedPtr<Y>& r)
+            : pRep(r.getPointer())
+            , pInfo(r.pInfo)
+		{
+            if (pRep) 
+            {
+                ++pInfo->useCount;
+            }
+        }
+
+		
+#if __cplusplus >= 201103L
+        template<class Y,
+                 class = typename std::enable_if<std::is_assignable<T*, Y*>::value>::type>
+#else
+        template<class Y>
+#endif
+        SharedPtr& operator=(const SharedPtr<Y>& r)
+        {
+			if (pRep == r.pRep)
+				return *this;
+			// Swap current data into a local copy
+			// this ensures we deal with rhs and this being dependent
+			SharedPtr<T> tmp(r);
+			swap(tmp);
+			return *this;
+		}
+
+		~SharedPtr() {
+            release();
+		}
+
+
+        template<typename Y>
+        inline SharedPtr<Y> staticCast() const
+        {
+            if(pRep) {
+                ++pInfo->useCount;
+				return SharedPtr<Y>(static_cast<Y*>(pRep), pInfo);
+            } else return SharedPtr<Y>();
+        }
+
+        template<typename Y>
+        inline SharedPtr<Y> dynamicCast() const
+        {
+            if(pRep) {
+                Y* rep = dynamic_cast<Y*>(pRep);
+                ++pInfo->useCount;
+				return SharedPtr<Y>(rep, pInfo);
+            } else return SharedPtr<Y>();
+        }
+
+		inline T& operator*() const { assert(pRep); return *pRep; }
+		inline T* operator->() const { assert(pRep); return pRep; }
+		inline T* get() const { return pRep; }
+
+		/** Binds rep to the SharedPtr.
+			@remarks
+				Assumes that the SharedPtr is uninitialised!
+
+            @warning
+                The object must not be bound into a SharedPtr elsewhere
+		*/
+		void bind(T* rep, SharedPtrFreeMethod inFreeMethod = SPFM_DELETE) {
+			assert(!pRep && !pInfo);
+			pInfo = createInfoForMethod(rep, inFreeMethod);
+			pRep = rep;
+		}
+
+		inline bool unique() const { assert(pInfo && pInfo->useCount.get()); return pInfo->useCount.get() == 1; }
+		inline unsigned int useCount() const { assert(pInfo && pInfo->useCount.get()); return pInfo->useCount.get(); }
+        inline void setUseCount(unsigned value) { assert(pInfo); pInfo->useCount = value; }
+
+		inline T* getPointer() const { return pRep; }
+
+		inline bool isNull(void) const { return pRep == 0; }
+
+        inline void setNull(void) { 
+			if (pRep)
+			{
+				release();
+			}
+        }
+
+    protected:
+
+        inline void release(void)
+        {
+            if (pRep)
+            {
+                assert(pInfo);
+                if(--pInfo->useCount == 0)
+                    destroy();
+            }
+
+            pRep = 0;
+            pInfo = 0;
+        }
+
+        /** IF YOU GET A CRASH HERE, YOU FORGOT TO FREE UP POINTERS
+         BEFORE SHUTTING OGRE DOWN
+         Use setNull() before shutdown or make sure your pointer goes
+         out of scope before OGRE shuts down to avoid this. */
+        inline void destroy(void)
+        {
+            assert(pRep && pInfo);
+            OGRE_DELETE_T(pInfo, SharedPtrInfo, MEMCATEGORY_GENERAL);
+        }
+
+		inline void swap(SharedPtr<T> &other) 
+		{
+			std::swap(pRep, other.pRep);
+			std::swap(pInfo, other.pInfo);
+		}
+	};
+
+	template<class T, class U> inline bool operator==(SharedPtr<T> const& a, SharedPtr<U> const& b)
+	{
+		return a.get() == b.get();
+	}
+
+	template<class T, class U> inline bool operator!=(SharedPtr<T> const& a, SharedPtr<U> const& b)
+	{
+		return a.get() != b.get();
+	}
+
+	template<class T, class U> inline bool operator<(SharedPtr<T> const& a, SharedPtr<U> const& b)
+	{
+		return std::less<const void*>()(a.get(), b.get());
+	}
+	/** @} */
+	/** @} */
+}
+
+
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreSimpleRenderable.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreSimpleRenderable.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreSimpleRenderable.h	(revision 148)
@@ -0,0 +1,114 @@
+/*
+-----------------------------------------------------------------------------
+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 __SimpleRenderable_H__
+#define __SimpleRenderable_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreMovableObject.h"
+#include "OgreRenderable.h"
+#include "OgreAxisAlignedBox.h"
+#include "OgreMaterial.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Scene
+	*  @{
+	*/
+	/** Simple implementation of MovableObject and Renderable for single-part custom objects. 
+	@see ManualObject for a simpler interface with more flexibility
+	*/
+	class _OgreExport SimpleRenderable : public MovableObject, public Renderable
+    {
+    protected:
+        RenderOperation mRenderOp;
+
+        Matrix4 mWorldTransform;
+        AxisAlignedBox mBox;
+
+        String mMatName;
+        MaterialPtr mMaterial;
+
+        /// The scene manager for the current frame.
+        SceneManager *mParentSceneManager;
+
+        /// The camera for the current frame.
+        Camera *mCamera;
+
+        /// Static member used to automatically generate names for SimpleRendaerable objects.
+        static uint msGenNameCount;
+
+    public:
+        /// Constructor
+        SimpleRenderable();
+
+        /// Named constructor
+        SimpleRenderable(const String& name);
+
+        virtual void setMaterial( const String& matName );
+        virtual const MaterialPtr& getMaterial(void) const;
+
+        virtual void setRenderOperation( const RenderOperation& rend );
+        virtual void getRenderOperation(RenderOperation& op);
+
+        void setWorldTransform( const Matrix4& xform );
+        virtual void getWorldTransforms( Matrix4* xform ) const;
+
+
+        virtual void _notifyCurrentCamera(Camera* cam);
+
+        void setBoundingBox( const AxisAlignedBox& box );
+        virtual const AxisAlignedBox& getBoundingBox(void) const;
+
+        virtual void _updateRenderQueue(RenderQueue* queue);
+		/// @copydoc MovableObject::visitRenderables
+		void visitRenderables(Renderable::Visitor* visitor, 
+			bool debugRenderables = false);
+
+        virtual ~SimpleRenderable();
+
+
+        /** Overridden from MovableObject */
+        virtual const String& getMovableType(void) const;
+
+        /** @copydoc Renderable::getLights */
+        const LightList& getLights(void) const;
+
+    };
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreSimpleSpline.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreSimpleSpline.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreSimpleSpline.h	(revision 148)
@@ -0,0 +1,140 @@
+/*
+-----------------------------------------------------------------------------
+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 __SimpleSpline_H__
+#define __SimpleSpline_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreVector3.h"
+#include "OgreMatrix4.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Math
+	*  @{
+	*/
+	/** A very simple spline class which implements the Catmull-Rom class of splines.
+    @remarks
+        Splines are bendy lines. You define a series of points, and the spline forms
+        a smoother line between the points to eliminate the sharp angles.
+    @par
+        Catmull-Rom splines are a specialisation of the general Hermite spline. With
+        a Hermite spline, you define the start and end point of the line, and 2 tangents,
+        one at the start of the line and one at the end. The Catmull-Rom spline simplifies
+        this by just asking you to define a series of points, and the tangents are 
+        created for you. 
+    */
+	class _OgreExport SimpleSpline
+    {
+    public:
+        SimpleSpline();
+        ~SimpleSpline();
+
+        /** Adds a control point to the end of the spline. */
+        void addPoint(const Vector3& p);
+
+        /** Gets the detail of one of the control points of the spline. */
+        const Vector3& getPoint(unsigned short index) const;
+
+        /** Gets the number of control points in the spline. */
+        unsigned short getNumPoints(void) const;
+
+        /** Clears all the points in the spline. */
+        void clear(void);
+
+        /** Updates a single point in the spline. 
+        @remarks
+            This point must already exist in the spline.
+        */
+        void updatePoint(unsigned short index, const Vector3& value);
+
+        /** Returns an interpolated point based on a parametric value over the whole series.
+        @remarks
+            Given a t value between 0 and 1 representing the parametric distance along the
+            whole length of the spline, this method returns an interpolated point.
+        @param t Parametric value.
+        */
+        Vector3 interpolate(Real t) const;
+
+        /** Interpolates a single segment of the spline given a parametric value.
+        @param fromIndex The point index to treat as t=0. fromIndex + 1 is deemed to be t=1
+        @param t Parametric value
+        */
+        Vector3 interpolate(unsigned int fromIndex, Real t) const;
+
+
+        /** Tells the spline whether it should automatically calculate tangents on demand
+            as points are added.
+        @remarks
+            The spline calculates tangents at each point automatically based on the input points.
+            Normally it does this every time a point changes. However, if you have a lot of points
+            to add in one go, you probably don't want to incur this overhead and would prefer to 
+            defer the calculation until you are finished setting all the points. You can do this
+            by calling this method with a parameter of 'false'. Just remember to manually call 
+            the recalcTangents method when you are done.
+        @param autoCalc If true, tangents are calculated for you whenever a point changes. If false, 
+            you must call reclacTangents to recalculate them when it best suits.
+        */
+        void setAutoCalculate(bool autoCalc);
+
+        /** Recalculates the tangents associated with this spline. 
+        @remarks
+            If you tell the spline not to update on demand by calling setAutoCalculate(false)
+            then you must call this after completing your updates to the spline points.
+        */
+        void recalcTangents(void);
+
+    protected:
+
+        bool mAutoCalc;
+
+        vector<Vector3>::type mPoints;
+        vector<Vector3>::type mTangents;
+
+        /// Matrix of coefficients 
+        Matrix4 mCoeffs;
+
+
+
+    };
+
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreSingleton.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreSingleton.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreSingleton.h	(revision 148)
@@ -0,0 +1,103 @@
+/*
+-----------------------------------------------------------------------------
+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.
+-----------------------------------------------------------------------------
+*/
+/* Original version Copyright (C) Scott Bilas, 2000.
+ * All rights reserved worldwide.
+ *
+ * This software is provided "as is" without express or implied
+ * warranties. You may freely copy and compile this source into
+ * applications you distribute provided that the copyright text
+ * below is included in the resulting source code, for example:
+ * "Portions Copyright (C) Scott Bilas, 2000"
+ */
+#ifndef _SINGLETON_H__
+#define _SINGLETON_H__
+
+// Added by Steve Streeting for Ogre
+#include "OgrePrerequisites.h"
+
+#if OGRE_COMPILER == OGRE_COMPILER_MSVC
+// Turn off warnings generated by this singleton implementation
+#   pragma warning (disable : 4311)
+#   pragma warning (disable : 4312)
+#   pragma warning (disable : 4661)
+#endif
+
+#if defined ( OGRE_GCC_VISIBILITY )
+#   pragma GCC visibility push(default)
+#endif
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+
+// End SJS additions
+    /** Template class for creating single-instance global classes.
+    */
+    template <typename T> class Singleton
+    {
+	private:
+		/** @brief Explicit private copy constructor. This is a forbidden operation.*/
+		Singleton(const Singleton<T> &);
+
+		/** @brief Private operator= . This is a forbidden operation. */
+		Singleton& operator=(const Singleton<T> &);
+    
+	protected:
+
+        static T* msSingleton;
+
+    public:
+        Singleton( void )
+        {
+            assert( !msSingleton );
+#if defined( _MSC_VER ) && _MSC_VER < 1200	 
+            int offset = (int)(T*)1 - (int)(Singleton <T>*)(T*)1;
+            msSingleton = (T*)((int)this + offset);
+#else
+	    msSingleton = static_cast< T* >( this );
+#endif
+        }
+        ~Singleton( void )
+            {  assert( msSingleton );  msSingleton = 0;  }
+        static T& getSingleton( void )
+		{	assert( msSingleton );  return ( *msSingleton ); }
+        static T* getSingletonPtr( void )
+		{ return msSingleton; }
+    };
+	/** @} */
+	/** @} */
+
+}
+#if defined ( OGRE_GCC_VISIBILITY )
+#   pragma GCC visibility pop
+#endif
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreSkeleton.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreSkeleton.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreSkeleton.h	(revision 148)
@@ -0,0 +1,486 @@
+/*
+-----------------------------------------------------------------------------
+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 __Skeleton_H__
+#define __Skeleton_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreResource.h"
+#include "OgreQuaternion.h"
+#include "OgreVector3.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreStringVector.h"
+#include "OgreAnimation.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Animation
+	*  @{
+	*/
+
+    /**  */
+    enum SkeletonAnimationBlendMode {
+        /// Animations are applied by calculating a weighted average of all animations
+	    ANIMBLEND_AVERAGE = 0,
+        /// Animations are applied by calculating a weighted cumulative total
+	    ANIMBLEND_CUMULATIVE = 1
+    };
+
+#define OGRE_MAX_NUM_BONES 256
+
+	
+	struct LinkedSkeletonAnimationSource;
+
+    /** A collection of Bone objects used to animate a skinned mesh.
+    @remarks
+        Skeletal animation works by having a collection of 'bones' which are 
+        actually just joints with a position and orientation, arranged in a tree structure.
+        For example, the wrist joint is a child of the elbow joint, which in turn is a
+        child of the shoulder joint. Rotating the shoulder automatically moves the elbow
+        and wrist as well due to this hierarchy.
+    @par
+        So how does this animate a mesh? Well every vertex in a mesh is assigned to one or more
+        bones which affects it's position when the bone is moved. If a vertex is assigned to 
+        more than one bone, then weights must be assigned to determine how much each bone affects
+        the vertex (actually a weight of 1.0 is used for single bone assignments). 
+        Weighted vertex assignments are especially useful around the joints themselves
+        to avoid 'pinching' of the mesh in this region. 
+    @par
+        Therefore by moving the skeleton using preset animations, we can animate the mesh. The
+        advantage of using skeletal animation is that you store less animation data, especially
+        as vertex counts increase. In addition, you are able to blend multiple animations together
+        (e.g. walking and looking around, running and shooting) and provide smooth transitions
+        between animations without incurring as much of an overhead as would be involved if you
+        did this on the core vertex data.
+    @par
+        Skeleton definitions are loaded from datafiles, namely the .skeleton file format. They
+        are loaded on demand, especially when referenced by a Mesh.
+    */
+    class _OgreExport Skeleton : public Resource, public AnimationContainer
+    {
+		friend class SkeletonInstance;
+	protected:
+		/// Internal constructor for use by SkeletonInstance only
+		Skeleton();
+
+    public:
+        /** Constructor, don't call directly, use SkeletonManager.
+        @remarks
+            On creation, a Skeleton has a no bones, you should create them and link
+            them together appropriately. 
+        */
+        Skeleton(ResourceManager* creator, const String& name, ResourceHandle handle,
+            const String& group, bool isManual = false, ManualResourceLoader* loader = 0);
+        virtual ~Skeleton();
+
+
+        /** Creates a brand new Bone owned by this Skeleton. 
+        @remarks
+            This method creates an unattached new Bone for this skeleton.
+			Unless this is to be a root bone (there may be more than one of 
+			these), you must attach it to another Bone in the skeleton using addChild for it to be any use.
+            For this reason you will likely be better off creating child bones using the
+            Bone::createChild method instead, once you have created the root bone. 
+        @par
+            Note that this method automatically generates a handle for the bone, which you
+            can retrieve using Bone::getHandle. If you wish the new Bone to have a specific
+            handle, use the alternate form of this method which takes a handle as a parameter,
+            although you should note the restrictions.
+        */
+        virtual Bone* createBone(void);
+
+        /** Creates a brand new Bone owned by this Skeleton. 
+        @remarks
+            This method creates an unattached new Bone for this skeleton and assigns it a 
+            specific handle. Unless this is to be a root bone (there may be more than one of 
+			these), you must attach it to another Bone in the skeleton using addChild for it to be any use. 
+            For this reason you will likely be better off creating child bones using the
+            Bone::createChild method instead, once you have created a root bone. 
+        @param handle The handle to give to this new bone - must be unique within this skeleton. 
+            You should also ensure that all bone handles are eventually contiguous (this is to simplify
+            their compilation into an indexed array of transformation matrices). For this reason
+            it is advised that you use the simpler createBone method which automatically assigns a
+            sequential handle starting from 0.
+        */
+        virtual Bone* createBone(unsigned short handle);
+
+        /** Creates a brand new Bone owned by this Skeleton. 
+        @remarks
+            This method creates an unattached new Bone for this skeleton and assigns it a 
+            specific name.Unless this is to be a root bone (there may be more than one of 
+			these), you must attach it to another Bone in the skeleton using addChild for it to be any use.
+            For this reason you will likely be better off creating child bones using the
+            Bone::createChild method instead, once you have created the root bone. 
+        @param name The name to give to this new bone - must be unique within this skeleton. 
+            Note that the way OGRE looks up bones is via a numeric handle, so if you name a
+            Bone this way it will be given an automatic sequential handle. The name is just
+            for your convenience, although it is recommended that you only use the handle to 
+            retrieve the bone in performance-critical code.
+        */
+        virtual Bone* createBone(const String& name);
+
+        /** Creates a brand new Bone owned by this Skeleton. 
+        @remarks
+            This method creates an unattached new Bone for this skeleton and assigns it a 
+            specific name and handle. Unless this is to be a root bone (there may be more than one of 
+			these), you must attach it to another Bone in the skeleton using addChild for it to be any use.
+            For this reason you will likely be better off creating child bones using the
+            Bone::createChild method instead, once you have created the root bone. 
+        @param name The name to give to this new bone - must be unique within this skeleton. 
+        @param handle The handle to give to this new bone - must be unique within this skeleton. 
+        */
+        virtual Bone* createBone(const String& name, unsigned short handle);
+
+        /** Returns the number of bones in this skeleton. */
+        virtual unsigned short getNumBones(void) const;
+
+        /** Gets the root bone of the skeleton: deprecated in favour of getRootBoneIterator. 
+        @remarks
+            The system derives the root bone the first time you ask for it. The root bone is the
+            only bone in the skeleton which has no parent. The system locates it by taking the
+            first bone in the list and going up the bone tree until there are no more parents,
+            and saves this top bone as the root. If you are building the skeleton manually using
+            createBone then you must ensure there is only one bone which is not a child of 
+            another bone, otherwise your skeleton will not work properly. If you use createBone
+            only once, and then use Bone::createChild from then on, then inherently the first
+            bone you create will by default be the root.
+        */
+        virtual Bone* getRootBone(void) const;
+
+        typedef vector<Bone*>::type BoneList;
+        typedef VectorIterator<BoneList> BoneIterator;
+        /// Get an iterator over the root bones in the skeleton, ie those with no parents
+        virtual BoneIterator getRootBoneIterator(void);
+        /// Get an iterator over all the bones in the skeleton
+        virtual BoneIterator getBoneIterator(void);
+
+        /** Gets a bone by it's handle. */
+        virtual Bone* getBone(unsigned short handle) const;
+
+        /** Gets a bone by it's name. */
+        virtual Bone* getBone(const String& name) const;
+
+		/** Returns whether this skeleton contains the named bone. */
+        virtual bool hasBone(const String& name) const;
+
+        /** Sets the current position / orientation to be the 'binding pose' i.e. the layout in which 
+            bones were originally bound to a mesh.
+        */
+        virtual void setBindingPose(void);
+
+        /** Resets the position and orientation of all bones in this skeleton to their original binding position.
+        @remarks
+            A skeleton is bound to a mesh in a binding pose. Bone positions are then modified from this
+            position during animation. This method returns all the bones to their original position and
+            orientation.
+        @param resetManualBones If set to true, causes the state of manual bones to be reset
+            too, which is normally not done to allow the manual state to persist even 
+            when keyframe animation is applied.
+        */
+        virtual void reset(bool resetManualBones = false);
+
+        /** Creates a new Animation object for animating this skeleton. 
+        @param name The name of this animation
+        @param length The length of the animation in seconds
+        */
+        virtual Animation* createAnimation(const String& name, Real length);
+
+        /** Returns the named Animation object. 
+		@remarks
+			Will pick up animations in linked skeletons 
+			(@see addLinkedSkeletonAnimationSource). 
+		@param name The name of the animation
+		@param linker Optional pointer to a pointer to the linked skeleton animation
+			where this is coming from.
+		*/
+        virtual Animation* getAnimation(const String& name, 
+			const LinkedSkeletonAnimationSource** linker) const;
+
+		/** Returns the named Animation object.
+		 @remarks
+			 Will pick up animations in linked skeletons 
+			 (@see addLinkedSkeletonAnimationSource). 
+		 @param name The name of the animation
+		 */
+		virtual Animation* getAnimation(const String& name) const;
+
+		/// Internal accessor for animations (returns null if animation does not exist)
+		virtual Animation* _getAnimationImpl(const String& name, 
+			const LinkedSkeletonAnimationSource** linker = 0) const;
+
+
+		/** Returns whether this skeleton contains the named animation. */
+		virtual bool hasAnimation(const String& name) const;
+
+        /** Removes an Animation from this skeleton. */
+        virtual void removeAnimation(const String& name);
+
+        /** Changes the state of the skeleton to reflect the application of the passed in collection of animations.
+        @remarks
+            Animating a skeleton involves both interpolating between keyframes of a specific animation,
+            and blending between the animations themselves. Calling this method sets the state of
+            the skeleton so that it reflects the combination of all the passed in animations, at the
+            time index specified for each, using the weights specified. Note that the weights between 
+            animations do not have to sum to 1.0, because some animations may affect only subsets
+            of the skeleton. If the weights exceed 1.0 for the same area of the skeleton, the 
+            movement will just be exaggerated.
+        */
+        virtual void setAnimationState(const AnimationStateSet& animSet);
+
+
+        /** Initialise an animation set suitable for use with this skeleton. 
+        @remarks
+            Only recommended for use inside the engine, not by applications.
+        */
+        virtual void _initAnimationState(AnimationStateSet* animSet);
+
+		/** Refresh an animation set suitable for use with this skeleton. 
+		@remarks
+			Only recommended for use inside the engine, not by applications.
+		*/
+		virtual void _refreshAnimationState(AnimationStateSet* animSet);
+
+		/** Populates the passed in array with the bone matrices based on the current position.
+        @remarks
+            Internal use only. The array pointed to by the passed in pointer must
+            be at least as large as the number of bones.
+            Assumes animation has already been updated.
+        */
+        virtual void _getBoneMatrices(Matrix4* pMatrices);
+
+        /** Gets the number of animations on this skeleton. */
+        virtual unsigned short getNumAnimations(void) const;
+
+        /** Gets a single animation by index. 
+		@remarks
+			Will NOT pick up animations in linked skeletons 
+			(@see addLinkedSkeletonAnimationSource).
+		*/
+        virtual Animation* getAnimation(unsigned short index) const;
+
+
+		/** Gets the animation blending mode which this skeleton will use. */
+        virtual SkeletonAnimationBlendMode getBlendMode() const;
+        /** Sets the animation blending mode this skeleton will use. */
+		virtual void setBlendMode(SkeletonAnimationBlendMode state);
+
+        /// Updates all the derived transforms in the skeleton
+        virtual void _updateTransforms(void);
+
+		/** Optimise all of this skeleton's animations.
+		@see Animation::optimise
+        @param
+            preservingIdentityNodeTracks If true, don't destroy identity node tracks.
+		*/
+		virtual void optimiseAllAnimations(bool preservingIdentityNodeTracks = false);
+
+		/** Allows you to use the animations from another Skeleton object to animate
+			this skeleton.
+		@remarks
+			If you have skeletons of identical structure (that means identically
+			named bones with identical handles, and with the same hierarchy), but
+			slightly different proportions or binding poses, you can re-use animations
+			from one in the other. Because animations are actually stored as
+			changes to bones from their bind positions, it's possible to use the
+			same animation data for different skeletons, provided the skeletal
+			structure matches and the 'deltas' stored in the keyframes apply
+			equally well to the other skeletons bind position (so they must be
+			roughly similar, but don't have to be identical). You can use the 
+			'scale' option to adjust the translation and scale keyframes where
+			there are large differences in size between the skeletons.
+		@note
+			This method takes a skeleton name, rather than a more specific 
+			animation name, for two reasons; firstly it allows some validation 
+			of compatibility of skeletal structure, and secondly skeletons are
+			the unit of loading. Linking a skeleton to another in this way means
+			that the linkee will be prevented from being destroyed until the 
+			linker is destroyed.
+
+			You cannot set up cyclic relationships, e.g. SkeletonA uses SkeletonB's
+			animations, and SkeletonB uses SkeletonA's animations. This is because
+			it would set up a circular dependency which would prevent proper 
+			unloading - make one of the skeletons the 'master' in this case.
+		@param skelName Name of the skeleton to link animations from. This 
+			skeleton will be loaded immediately if this skeleton is already 
+			loaded, otherwise it will be loaded when this skeleton is.
+		@param scale A scale factor to apply to translation and scaling elements
+			of the keyframes in the other skeleton when applying the animations
+			to this one. Compensates for skeleton size differences.
+		*/
+		virtual void addLinkedSkeletonAnimationSource(const String& skelName, 
+			Real scale = 1.0f);
+		/// Remove all links to other skeletons for the purposes of sharing animation
+		virtual void removeAllLinkedSkeletonAnimationSources(void);
+		
+		typedef vector<LinkedSkeletonAnimationSource>::type 
+			LinkedSkeletonAnimSourceList;
+		typedef ConstVectorIterator<LinkedSkeletonAnimSourceList> 
+			LinkedSkeletonAnimSourceIterator;
+		/// Get an iterator over the linked skeletons used as animation sources
+		virtual LinkedSkeletonAnimSourceIterator 
+			getLinkedSkeletonAnimationSourceIterator(void) const;
+
+		/// Internal method for marking the manual bones as dirty
+		virtual void _notifyManualBonesDirty(void);
+		/// Internal method for notifying that a bone is manual
+		virtual void _notifyManualBoneStateChange(Bone* bone);
+
+		/// Have manual bones been modified since the skeleton was last updated?
+		virtual bool getManualBonesDirty(void) const { return mManualBonesDirty; }
+		/// Are there any manually controlled bones?
+		virtual bool hasManualBones(void) const { return !mManualBones.empty(); }
+
+        /// Map to translate bone handle from one skeleton to another skeleton.
+        typedef vector<ushort>::type BoneHandleMap;
+
+        /** Merge animations from another Skeleton object into this skeleton.
+        @remarks
+            This function allow merge two structures compatible skeletons. The
+            'compatible' here means identically bones will have same hierarchy,
+            but skeletons are not necessary to have same number of bones (if
+            number bones of source skeleton's more than this skeleton, they will
+            copied as is, except that duplicate names are disallowed; and in the
+            case of bones missing in source skeleton, nothing happen for those
+            bones).
+        @par
+            There are also unnecessary to have same binding poses, this function
+            will adjust keyframes of the source skeleton to match this skeleton
+            automatically.
+        @par
+            It's useful for exporting skeleton animations separately. i.e. export
+            mesh and 'master' skeleton at the same time, and then other animations
+            will export separately (even if used completely difference binding
+            pose), finally, merge separately exported animations into 'master'
+            skeleton.
+        @param
+            source Pointer to source skeleton. It'll keep unmodified.
+        @param
+            boneHandleMap A map to translate identically bone's handle from source
+            skeleton to this skeleton. If mapped bone handle doesn't exists in this
+            skeleton, it'll created. You can populate bone handle map manually, or
+            use predefined functions build bone handle map for you. (@see 
+            _buildMapBoneByHandle, _buildMapBoneByName)
+        @param
+            animations A list name of animations to merge, if empty, all animations
+            of source skeleton are used to merge. Note that the animation names
+            must not presented in this skeleton, and will NOT pick up animations
+            in linked skeletons (@see addLinkedSkeletonAnimationSource).
+        */
+        virtual void _mergeSkeletonAnimations(const Skeleton* source,
+            const BoneHandleMap& boneHandleMap,
+            const StringVector& animations = StringVector());
+
+        /** Build the bone handle map to use with Skeleton::_mergeSkeletonAnimations.
+        @remarks
+            Identically bones are determine by handle.
+        */
+        virtual void _buildMapBoneByHandle(const Skeleton* source,
+            BoneHandleMap& boneHandleMap) const;
+
+        /** Build the bone handle map to use with Skeleton::_mergeSkeletonAnimations.
+        @remarks
+            Identically bones are determine by name.
+        */
+        virtual void _buildMapBoneByName(const Skeleton* source,
+            BoneHandleMap& boneHandleMap) const;
+
+	protected:
+		SkeletonAnimationBlendMode mBlendState;
+        /// Storage of bones, indexed by bone handle
+        BoneList mBoneList;
+        /// Lookup by bone name
+        typedef map<String, Bone*>::type BoneListByName;
+        BoneListByName mBoneListByName;
+
+
+        /// Pointer to root bones (can now have multiple roots)
+        mutable BoneList mRootBones;
+        /// Bone automatic handles
+        unsigned short mNextAutoHandle;
+		typedef set<Bone*>::type BoneSet;
+		/// Manual bones
+		BoneSet mManualBones;
+		/// Manual bones dirty?
+		bool mManualBonesDirty;
+
+
+        /// Storage of animations, lookup by name
+        typedef map<String, Animation*>::type AnimationList;
+        AnimationList mAnimationsList;
+
+		/// List of references to other skeletons to use animations from 
+		mutable LinkedSkeletonAnimSourceList mLinkedSkeletonAnimSourceList;
+
+        /** Internal method which parses the bones to derive the root bone. 
+        @remarks
+            Must be const because called in getRootBone but mRootBone is mutable
+            since lazy-updated.
+        */
+        void deriveRootBone(void) const;
+
+        /// Debugging method
+        void _dumpContents(const String& filename);
+
+        /** @copydoc Resource::loadImpl
+        */
+        void loadImpl(void);
+
+        /** @copydoc Resource::unloadImpl
+        */
+        void unloadImpl(void);
+		/// @copydoc Resource::calculateSize
+		size_t calculateSize(void) const;
+
+    };
+
+    typedef SharedPtr<Skeleton> SkeletonPtr;
+
+	/// Link to another skeleton to share animations
+	struct LinkedSkeletonAnimationSource
+	{
+		String skeletonName;
+		SkeletonPtr pSkeleton;
+		Real scale;
+		LinkedSkeletonAnimationSource(const String& skelName, Real scl)
+			: skeletonName(skelName), scale(scl) {}
+			LinkedSkeletonAnimationSource(const String& skelName, Real scl, 
+				SkeletonPtr skelPtr)
+				: skeletonName(skelName), pSkeleton(skelPtr), scale(scl) {}
+	};
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreSkeletonFileFormat.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreSkeletonFileFormat.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreSkeletonFileFormat.h	(revision 148)
@@ -0,0 +1,117 @@
+/*
+-----------------------------------------------------------------------------
+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 __SkeletonFileFormat_H__
+#define __SkeletonFileFormat_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Animation
+	*  @{
+	*/
+/** Definition of the OGRE .skeleton file format 
+
+    .skeleton files are binary files (for read efficiency at runtime) and are arranged into chunks 
+    of data, very like 3D Studio's format.
+    A chunk always consists of:
+        unsigned short CHUNK_ID        : one of the following chunk ids identifying the chunk
+        unsigned long  LENGTH          : length of the chunk in bytes, including this header
+        void*          DATA            : the data, which may contain other sub-chunks (various data types)
+    
+    A .skeleton file contains both the definition of the Skeleton object and the animations it contains. It
+    contains only a single skeleton but can contain multiple animations.
+
+
+*/
+    enum SkeletonChunkID {
+        SKELETON_HEADER            = 0x1000,
+            // char* version           : Version number check
+			SKELETON_BLENDMODE		   = 0x1010, // optional
+				// unsigned short blendmode		: SkeletonAnimationBlendMode
+		
+        SKELETON_BONE              = 0x2000,
+        // Repeating section defining each bone in the system. 
+        // Bones are assigned indexes automatically based on their order of declaration
+        // starting with 0.
+
+            // char* name                       : name of the bone
+            // unsigned short handle            : handle of the bone, should be contiguous & start at 0
+            // Vector3 position                 : position of this bone relative to parent 
+            // Quaternion orientation           : orientation of this bone relative to parent 
+            // Vector3 scale                    : scale of this bone relative to parent 
+
+        SKELETON_BONE_PARENT       = 0x3000,
+        // Record of the parent of a single bone, used to build the node tree
+        // Repeating section, listed in Bone Index order, one per Bone
+
+            // unsigned short handle             : child bone
+            // unsigned short parentHandle   : parent bone
+
+        SKELETON_ANIMATION         = 0x4000,
+        // A single animation for this skeleton
+
+            // char* name                       : Name of the animation
+            // float length                      : Length of the animation in seconds
+		
+			SKELETON_ANIMATION_BASEINFO = 0x4010,
+			// [Optional] base keyframe information
+			// char* baseAnimationName (blank for self)
+			// float baseKeyFrameTime
+
+            SKELETON_ANIMATION_TRACK = 0x4100,
+            // A single animation track (relates to a single bone)
+            // Repeating section (within SKELETON_ANIMATION)
+                
+                // unsigned short boneIndex     : Index of bone to apply to
+
+                SKELETON_ANIMATION_TRACK_KEYFRAME = 0x4110,
+                // A single keyframe within the track
+                // Repeating section
+
+                    // float time                    : The time position (seconds)
+                    // Quaternion rotate            : Rotation to apply at this keyframe
+                    // Vector3 translate            : Translation to apply at this keyframe
+                    // Vector3 scale                : Scale to apply at this keyframe
+		SKELETON_ANIMATION_LINK         = 0x5000
+		// Link to another skeleton, to re-use its animations
+
+			// char* skeletonName					: name of skeleton to get animations from
+			// float scale							: scale to apply to trans/scale keys
+
+    };
+	/** @} */
+	/** @} */
+
+} // namespace
+
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreSkeletonInstance.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreSkeletonInstance.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreSkeletonInstance.h	(revision 148)
@@ -0,0 +1,165 @@
+/*
+-----------------------------------------------------------------------------
+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 __SkeletonInstance_H__
+#define __SkeletonInstance_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreSkeleton.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Scene
+	*  @{
+	*/
+	/** A SkeletonInstance is a single instance of a Skeleton used by a world object.
+    @remarks
+        The difference between a Skeleton and a SkeletonInstance is that the
+        Skeleton is the 'master' version much like Mesh is a 'master' version of
+        Entity. Many SkeletonInstance objects can be based on a single Skeleton, 
+        and are copies of it when created. Any changes made to this are not
+        reflected in the master copy. The exception is animations; these are
+        shared on the Skeleton itself and may not be modified here.
+    */
+    class _OgreExport SkeletonInstance : public Skeleton
+    {
+    public:
+        /** Constructor, don't call directly, this will be created automatically
+        when you create an Entity based on a skeletally animated Mesh.
+        */
+        SkeletonInstance(const SkeletonPtr& masterCopy);
+        ~SkeletonInstance();
+
+        /** Gets the number of animations on this skeleton. */
+        unsigned short getNumAnimations(void) const;
+
+        /** Gets a single animation by index. */
+        Animation* getAnimation(unsigned short index) const;
+		/// Internal accessor for animations (returns null if animation does not exist)
+		Animation* _getAnimationImpl(const String& name, 
+			const LinkedSkeletonAnimationSource** linker = 0) const;
+
+        /** Creates a new Animation object for animating this skeleton. 
+        @remarks
+            This method updates the reference skeleton, not just this instance!
+        @param name The name of this animation
+        @param length The length of the animation in seconds
+        */
+        Animation* createAnimation(const String& name, Real length);
+
+        /** Returns the named Animation object. */
+        Animation* getAnimation(const String& name, 
+			const LinkedSkeletonAnimationSource** linker = 0) const;
+
+        /** Removes an Animation from this skeleton. 
+        @remarks
+            This method updates the reference skeleton, not just this instance!
+        */
+        void removeAnimation(const String& name);
+
+
+        /** Creates a TagPoint ready to be attached to a bone */
+        TagPoint* createTagPointOnBone(Bone* bone, 
+            const Quaternion &offsetOrientation = Quaternion::IDENTITY, 
+            const Vector3 &offsetPosition = Vector3::ZERO);
+
+        /** Frees a TagPoint that already attached to a bone */
+        void freeTagPoint(TagPoint* tagPoint);
+
+		/// @copydoc Skeleton::addLinkedSkeletonAnimationSource
+		void addLinkedSkeletonAnimationSource(const String& skelName, 
+			Real scale = 1.0f);
+		/// @copydoc Skeleton::removeAllLinkedSkeletonAnimationSources
+		void removeAllLinkedSkeletonAnimationSources(void);
+		/// @copydoc Skeleton::getLinkedSkeletonAnimationSourceIterator
+		LinkedSkeletonAnimSourceIterator 
+			getLinkedSkeletonAnimationSourceIterator(void) const;
+
+		/// @copydoc Skeleton::_initAnimationState
+		void _initAnimationState(AnimationStateSet* animSet);
+
+		/// @copydoc Skeleton::_refreshAnimationState
+		void _refreshAnimationState(AnimationStateSet* animSet);
+
+		/// @copydoc Resource::getName
+		const String& getName(void) const;
+		/// @copydoc Resource::getHandle
+		ResourceHandle getHandle(void) const;
+		/// @copydoc Resource::getGroup
+		const String& getGroup(void);
+
+    protected:
+        /// Pointer back to master Skeleton
+        SkeletonPtr mSkeleton;
+
+        typedef list<TagPoint*>::type TagPointList;
+
+        /** Active tag point list.
+        @remarks
+            This is a linked list of pointers to active tag points
+        @par
+            This allows very fast insertions and deletions from anywhere in the list to activate / deactivate
+            tag points (required for weapon / equip systems etc) as well as reuse of TagPoint instances
+            without construction & destruction which avoids memory thrashing.
+        */
+        TagPointList mActiveTagPoints;
+
+        /** Free tag point list.
+        @remarks
+            This contains a list of the tag points free for use as new instances
+            as required by the set. When a TagPoint instance is deactivated, there will be a reference on this
+            list. As they get used this list reduces, as they get released back to to the set they get added
+            back to the list.
+        */
+        TagPointList mFreeTagPoints;
+
+        /// TagPoint automatic handles
+        unsigned short mNextTagPointAutoHandle;
+
+        void cloneBoneAndChildren(Bone* source, Bone* parent);
+        /** Overridden from Skeleton
+        */
+        void loadImpl(void);
+        /** Overridden from Skeleton
+        */
+        void unloadImpl(void);
+
+    };
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreSkeletonManager.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreSkeletonManager.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreSkeletonManager.h	(revision 148)
@@ -0,0 +1,115 @@
+/*
+-----------------------------------------------------------------------------
+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 __SkeletonManager_H__
+#define __SkeletonManager_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreResourceManager.h"
+#include "OgreSingleton.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Animation
+	*  @{
+	*/
+	/** Handles the management of skeleton resources.
+        @remarks
+            This class deals with the runtime management of
+            skeleton data; like other resource managers it handles
+            the creation of resources (in this case skeleton data),
+            working within a fixed memory budget.
+    */
+    class _OgreExport SkeletonManager: public ResourceManager, public Singleton<SkeletonManager>
+    {
+    public:
+        /// Constructor
+        SkeletonManager();
+        ~SkeletonManager();
+
+		/// Create a new skeleton
+		/// @see ResourceManager::createResource
+		SkeletonPtr create (const String& name, const String& group,
+							bool isManual = false, ManualResourceLoader* loader = 0,
+							const NameValuePairList* createParams = 0);
+
+		/// Get a resource by name
+		/// @see ResourceManager::getResourceByName
+		SkeletonPtr getByName(const String& name, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME);
+
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static SkeletonManager& getSingleton(void);
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static SkeletonManager* getSingletonPtr(void);
+    protected:
+
+        /// @copydoc ResourceManager::createImpl
+        Resource* createImpl(const String& name, ResourceHandle handle, 
+            const String& group, bool isManual, ManualResourceLoader* loader, 
+            const NameValuePairList* createParams);
+
+    };
+
+	/** @} */
+	/** @} */
+
+}
+
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreSkeletonSerializer.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreSkeletonSerializer.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreSkeletonSerializer.h	(revision 148)
@@ -0,0 +1,151 @@
+/*
+-----------------------------------------------------------------------------
+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 __SkeletonSerializer_H__
+#define __SkeletonSerializer_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreSkeleton.h"
+#include "OgreSerializer.h"
+
+namespace Ogre {
+
+	/// Skeleton compatibility versions
+	enum SkeletonVersion 
+	{
+		/// OGRE version v1.0+
+		SKELETON_VERSION_1_0,
+		/// OGRE version v1.8+
+		SKELETON_VERSION_1_8,
+		
+		/// Latest version available
+		SKELETON_VERSION_LATEST = 100
+	};
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Animation
+	*  @{
+	*/
+	/** Class for serialising skeleton data to/from an OGRE .skeleton file.
+    @remarks
+        This class allows exporters to write OGRE .skeleton files easily, and allows the
+        OGRE engine to import .skeleton files into instantiated OGRE Skeleton objects.
+        Note that a .skeleton file includes not only the Skeleton, but also definitions of
+        any Animations it uses.
+    @par
+        To export a Skeleton:<OL>
+        <LI>Create a Skeleton object and populate it using it's methods.</LI>
+        <LI>Call the exportSkeleton method</LI>
+        </OL>
+    */
+    class _OgreExport SkeletonSerializer : public Serializer
+    {
+		
+	public:
+        SkeletonSerializer();
+        virtual ~SkeletonSerializer();
+
+
+        /** Exports a skeleton to the file specified. 
+        @remarks
+            This method takes an externally created Skeleton object, and exports both it
+            and animations it uses to a .skeleton file.
+        @param pSkeleton Weak reference to the Skeleton to export
+        @param filename The destination filename
+		@param endianMode The endian mode to write in
+        */
+        void exportSkeleton(const Skeleton* pSkeleton, const String& filename,
+			SkeletonVersion ver = SKELETON_VERSION_LATEST, Endian endianMode = ENDIAN_NATIVE);
+
+        /** Exports a skeleton to the stream specified. 
+        @remarks
+            This method takes an externally created Skeleton object, and exports both it
+            and animations it uses to a .skeleton file.
+        @param pSkeleton Weak reference to the Skeleton to export
+        @param stream The destination stream
+		@param endianMode The endian mode to write in
+        */
+        void exportSkeleton(const Skeleton* pSkeleton, DataStreamPtr stream,
+			SkeletonVersion ver = SKELETON_VERSION_LATEST, Endian endianMode = ENDIAN_NATIVE);
+        /** Imports Skeleton and animation data from a .skeleton file DataStream.
+        @remarks
+            This method imports data from a DataStream opened from a .skeleton file and places it's
+            contents into the Skeleton object which is passed in. 
+        @param stream The DataStream holding the .skeleton data. Must be initialised (pos at the start of the buffer).
+        @param pDest Weak reference to the Skeleton object which will receive the data. Should be blank already.
+        */
+        void importSkeleton(DataStreamPtr& stream, Skeleton* pDest);
+
+        // TODO: provide Cal3D importer?
+
+    protected:
+		
+		void setWorkingVersion(SkeletonVersion ver);
+		
+		// Internal export methods
+		void writeSkeleton(const Skeleton* pSkel, SkeletonVersion ver);
+        void writeBone(const Skeleton* pSkel, const Bone* pBone);
+        void writeBoneParent(const Skeleton* pSkel, unsigned short boneId, unsigned short parentId);
+		void writeAnimation(const Skeleton* pSkel, const Animation* anim, SkeletonVersion ver);
+        void writeAnimationTrack(const Skeleton* pSkel, const NodeAnimationTrack* track);
+        void writeKeyFrame(const Skeleton* pSkel, const TransformKeyFrame* key);
+		void writeSkeletonAnimationLink(const Skeleton* pSkel, 
+			const LinkedSkeletonAnimationSource& link);
+
+        // Internal import methods
+		void readFileHeader(DataStreamPtr& stream);
+		void readBone(DataStreamPtr& stream, Skeleton* pSkel);
+        void readBoneParent(DataStreamPtr& stream, Skeleton* pSkel);
+        void readAnimation(DataStreamPtr& stream, Skeleton* pSkel);
+        void readAnimationTrack(DataStreamPtr& stream, Animation* anim, Skeleton* pSkel);
+        void readKeyFrame(DataStreamPtr& stream, NodeAnimationTrack* track, Skeleton* pSkel);
+		void readSkeletonAnimationLink(DataStreamPtr& stream, Skeleton* pSkel);
+
+        size_t calcBoneSize(const Skeleton* pSkel, const Bone* pBone);
+        size_t calcBoneSizeWithoutScale(const Skeleton* pSkel, const Bone* pBone);
+        size_t calcBoneParentSize(const Skeleton* pSkel);
+        size_t calcAnimationSize(const Skeleton* pSkel, const Animation* pAnim);
+        size_t calcAnimationTrackSize(const Skeleton* pSkel, const NodeAnimationTrack* pTrack);
+        size_t calcKeyFrameSize(const Skeleton* pSkel, const TransformKeyFrame* pKey);
+        size_t calcKeyFrameSizeWithoutScale(const Skeleton* pSkel, const TransformKeyFrame* pKey);
+		size_t calcSkeletonAnimationLinkSize(const Skeleton* pSkel, 
+			const LinkedSkeletonAnimationSource& link);
+
+
+
+
+    };
+	/** @} */
+	/** @} */
+
+}
+
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreSmallVector.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreSmallVector.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreSmallVector.h	(revision 148)
@@ -0,0 +1,814 @@
+//===- llvm/ADT/SmallVector.h - 'Normally small' vectors --------*- C++ -*-===//
+//
+//                     The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License.
+// ==============================================================================
+// LLVM Release License
+// ==============================================================================
+// University of Illinois/NCSA
+// Open Source License
+//
+// Copyright (c) 2003-2010 University of Illinois at Urbana-Champaign.
+// All rights reserved.
+//
+// Developed by:
+//
+// LLVM Team
+//
+// University of Illinois at Urbana-Champaign
+//
+// http://llvm.org
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy of
+// this software and associated documentation files (the "Software"), to deal with
+// 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:
+//
+// * Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimers.
+//
+// * Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimers in the
+// documentation and/or other materials provided with the distribution.
+//
+// * Neither the names of the LLVM Team, University of Illinois at
+// Urbana-Champaign, nor the names of its contributors may be used to
+// endorse or promote products derived from this Software without specific
+// prior written permission.
+//
+// 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
+// CONTRIBUTORS 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 WITH THE
+// SOFTWARE.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines the SmallVector class.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef __SmallVector_H
+#define __SmallVector_H
+
+#include <algorithm>
+#include <cassert>
+#include <cstddef>
+#include <cstdlib>
+#include <cstring>
+#include <iterator>
+#include <memory>
+
+#ifdef _MSC_VER
+namespace std {
+#if _MSC_VER <= 1310
+	// Work around flawed VC++ implementation of std::uninitialized_copy.  Define
+	// additional overloads so that elements with pointer types are recognized as
+	// scalars and not objects, causing bizarre type conversion errors.
+	template<class T1, class T2>
+	inline _Scalar_ptr_iterator_tag _Ptr_cat(T1 **, T2 **) {
+		_Scalar_ptr_iterator_tag _Cat;
+		return _Cat;
+	}
+	
+	template<class T1, class T2>
+	inline _Scalar_ptr_iterator_tag _Ptr_cat(T1* const *, T2 **) {
+		_Scalar_ptr_iterator_tag _Cat;
+		return _Cat;
+	}
+#else
+	// FIXME: It is not clear if the problem is fixed in VS 2005.  What is clear
+	// is that the above hack won't work if it wasn't fixed.
+#endif
+}
+#endif
+
+namespace Ogre {
+	
+    // some type traits
+	template <typename T>	struct isPodLike { static const bool value = false; };
+	
+	template <>				struct isPodLike<bool>				{ static const bool value = true; };
+	template <>				struct isPodLike<char>				{ static const bool value = true; };
+	template <>				struct isPodLike<signed char>		{ static const bool value = true; };
+	template <>				struct isPodLike<unsigned char>		{ static const bool value = true; };
+	template <>				struct isPodLike<int>				{ static const bool value = true; };
+	template <>				struct isPodLike<unsigned>			{ static const bool value = true; };
+	template <>				struct isPodLike<short>				{ static const bool value = true; };
+	template <>				struct isPodLike<unsigned short>	{ static const bool value = true; };
+	template <>				struct isPodLike<long>				{ static const bool value = true; };
+	template <>				struct isPodLike<unsigned long>		{ static const bool value = true; };
+	template <>				struct isPodLike<float>				{ static const bool value = true; };
+	template <>				struct isPodLike<double>			{ static const bool value = true; };
+	template <typename T>	struct isPodLike<T*>				{ static const bool value = true; };
+	
+	template<typename T, typename U>
+	struct isPodLike<std::pair<T, U> > { static const bool value = isPodLike<T>::value & isPodLike<U>::value; };
+
+	/// SmallVectorBase - This is all the non-templated stuff common to all
+	/// SmallVectors.
+	class SmallVectorBase {
+	protected:
+		void *BeginX, *EndX, *CapacityX;
+		
+		// Allocate raw space for N elements of type T.  If T has a ctor or dtor, we
+		// don't want it to be automatically run, so we need to represent the space as
+		// something else.  An array of char would work great, but might not be
+  // aligned sufficiently.  Instead we use some number of union instances for
+  // the space, which guarantee maximal alignment.
+  union U {
+				double D;
+				long double LD;
+				long long L;
+				void *P;
+		} FirstEl;
+		// Space after 'FirstEl' is clobbered, do not add any instance vars after it.
+		
+	protected:
+		SmallVectorBase(size_t Size)
+		: BeginX(&FirstEl), EndX(&FirstEl), CapacityX((char*)&FirstEl+Size) {}
+		
+		/// isSmall - Return true if this is a smallvector which has not had dynamic
+		/// memory allocated for it.
+		bool isSmall() const {
+			return BeginX == static_cast<const void*>(&FirstEl);
+		}
+		
+		/// size_in_bytes - This returns size()*sizeof(T).
+		size_t size_in_bytes() const {
+			return size_t((char*)EndX - (char*)BeginX);
+		}
+		
+		/// capacity_in_bytes - This returns capacity()*sizeof(T).
+		size_t capacity_in_bytes() const {
+			return size_t((char*)CapacityX - (char*)BeginX);
+		}
+		
+		/// grow_pod - This is an implementation of the grow() method which only works
+  /// on POD-like data types and is out of line to reduce code duplication.
+		void grow_pod(size_t MinSizeInBytes, size_t TSize);
+		
+	public:
+		bool empty() const { return BeginX == EndX; }
+	};
+	
+	
+	template <typename T>
+	class SmallVectorTemplateCommon : public SmallVectorBase {
+	protected:
+		void setEnd(T *P) { this->EndX = P; }
+	public:
+		SmallVectorTemplateCommon(size_t Size) : SmallVectorBase(Size) {}
+		
+		typedef size_t size_type;
+		typedef ptrdiff_t difference_type;
+		typedef T value_type;
+		typedef T *iterator;
+		typedef const T *const_iterator;
+		
+		typedef std::reverse_iterator<const_iterator> const_reverse_iterator;
+		typedef std::reverse_iterator<iterator> reverse_iterator;
+		
+		typedef T &reference;
+		typedef const T &const_reference;
+		typedef T *pointer;
+		typedef const T *const_pointer;
+		
+		// forward iterator creation methods.
+		iterator begin() { return (iterator)this->BeginX; }
+		const_iterator begin() const { return (const_iterator)this->BeginX; }
+		iterator end() { return (iterator)this->EndX; }
+		const_iterator end() const { return (const_iterator)this->EndX; }
+	protected:
+		iterator capacity_ptr() { return (iterator)this->CapacityX; }
+		const_iterator capacity_ptr() const { return (const_iterator)this->CapacityX;}
+	public:
+		
+		// reverse iterator creation methods.
+		reverse_iterator rbegin()            { return reverse_iterator(end()); }
+		const_reverse_iterator rbegin() const{ return const_reverse_iterator(end()); }
+		reverse_iterator rend()              { return reverse_iterator(begin()); }
+		const_reverse_iterator rend() const { return const_reverse_iterator(begin());}
+		
+		size_type size() const { return end()-begin(); }
+		size_type max_size() const { return size_type(-1) / sizeof(T); }
+		
+		/// capacity - Return the total number of elements in the currently allocated
+		/// buffer.
+		size_t capacity() const { return capacity_ptr() - begin(); }
+		
+		/// data - Return a pointer to the vector's buffer, even if empty().
+		pointer data() { return pointer(begin()); }
+		/// data - Return a pointer to the vector's buffer, even if empty().
+		const_pointer data() const { return const_pointer(begin()); }
+		
+		reference operator[](unsigned idx) {
+			assert(begin() + idx < end());
+			return begin()[idx];
+		}
+		const_reference operator[](unsigned idx) const {
+			assert(begin() + idx < end());
+			return begin()[idx];
+		}
+		
+		reference front() {
+			return begin()[0];
+		}
+		const_reference front() const {
+			return begin()[0];
+		}
+		
+		reference back() {
+			return end()[-1];
+		}
+		const_reference back() const {
+			return end()[-1];
+		}
+	};
+	
+	/// SmallVectorTemplateBase<isPodLike = false> - This is where we put method
+	/// implementations that are designed to work with non-POD-like T's.
+	template <typename T, bool isPodLike>
+	class SmallVectorTemplateBase : public SmallVectorTemplateCommon<T> {
+	public:
+		SmallVectorTemplateBase(size_t Size) : SmallVectorTemplateCommon<T>(Size) {}
+		
+		static void destroy_range(T *S, T *E) {
+			while (S != E) {
+				--E;
+				E->~T();
+			}
+		}
+		
+		/// uninitialized_copy - Copy the range [I, E) onto the uninitialized memory
+		/// starting with "Dest", constructing elements into it as needed.
+		template<typename It1, typename It2>
+		static void uninitialized_copy(It1 I, It1 E, It2 Dest) {
+			std::uninitialized_copy(I, E, Dest);
+		}
+		
+		/// grow - double the size of the allocated memory, guaranteeing space for at
+		/// least one more element or MinSize if specified.
+		void grow(size_t MinSize = 0);
+	};
+	
+	// Define this out-of-line to dissuade the C++ compiler from inlining it.
+	template <typename T, bool isPodLike>
+	void SmallVectorTemplateBase<T, isPodLike>::grow(size_t MinSize) {
+		size_t CurCapacity = this->capacity();
+		size_t CurSize = this->size();
+  size_t NewCapacity = 2*CurCapacity + 1; // Always grow, even from zero.
+		if (NewCapacity < MinSize)
+			NewCapacity = MinSize;
+		T *NewElts = static_cast<T*>(malloc(NewCapacity*sizeof(T)));
+		
+		// Copy the elements over.
+		this->uninitialized_copy(this->begin(), this->end(), NewElts);
+		
+		// Destroy the original elements.
+		destroy_range(this->begin(), this->end());
+		
+		// If this wasn't grown from the inline copy, deallocate the old space.
+		if (!this->isSmall())
+			free(this->begin());
+		
+		this->setEnd(NewElts+CurSize);
+		this->BeginX = NewElts;
+		this->CapacityX = this->begin()+NewCapacity;
+	}
+	
+	
+	/// SmallVectorTemplateBase<isPodLike = true> - This is where we put method
+	/// implementations that are designed to work with POD-like T's.
+	template <typename T>
+	class SmallVectorTemplateBase<T, true> : public SmallVectorTemplateCommon<T> {
+	public:
+		SmallVectorTemplateBase(size_t Size) : SmallVectorTemplateCommon<T>(Size) {}
+		
+		// No need to do a destroy loop for POD's.
+		static void destroy_range(T *, T *) {}
+		
+		/// uninitialized_copy - Copy the range [I, E) onto the uninitialized memory
+		/// starting with "Dest", constructing elements into it as needed.
+		template<typename It1, typename It2>
+		static void uninitialized_copy(It1 I, It1 E, It2 Dest) {
+			// Arbitrary iterator types; just use the basic implementation.
+			std::uninitialized_copy(I, E, Dest);
+		}
+		
+		/// uninitialized_copy - Copy the range [I, E) onto the uninitialized memory
+		/// starting with "Dest", constructing elements into it as needed.
+		template<typename T1, typename T2>
+		static void uninitialized_copy(T1 *I, T1 *E, T2 *Dest) {
+			// Use memcpy for PODs iterated by pointers (which includes SmallVector
+			// iterators): std::uninitialized_copy optimizes to memmove, but we can
+			// use memcpy here.
+			memcpy(Dest, I, (E-I)*sizeof(T));
+		}
+		
+		/// grow - double the size of the allocated memory, guaranteeing space for at
+		/// least one more element or MinSize if specified.
+		void grow(size_t MinSize = 0) {
+			this->grow_pod(MinSize*sizeof(T), sizeof(T));
+		}
+	};
+	
+	
+	/// SmallVectorImpl - This class consists of common code factored out of the
+	/// SmallVector class to reduce code duplication based on the SmallVector 'N'
+	/// template parameter.
+	template <typename T>
+	class SmallVectorImpl : public SmallVectorTemplateBase<T, isPodLike<T>::value> {
+		typedef SmallVectorTemplateBase<T, isPodLike<T>::value > SuperClass;
+		
+		SmallVectorImpl(const SmallVectorImpl&); // DISABLED.
+	public:
+		typedef typename SuperClass::iterator iterator;
+		typedef typename SuperClass::size_type size_type;
+		
+		// Default ctor - Initialize to empty.
+		explicit SmallVectorImpl(unsigned N)
+		: SmallVectorTemplateBase<T, isPodLike<T>::value>(N*sizeof(T)) {
+		}
+		
+		~SmallVectorImpl() {
+			// Destroy the constructed elements in the vector.
+			this->destroy_range(this->begin(), this->end());
+			
+			// If this wasn't grown from the inline copy, deallocate the old space.
+			if (!this->isSmall())
+				free(this->begin());
+		}
+		
+		
+		void clear() {
+			this->destroy_range(this->begin(), this->end());
+			this->EndX = this->BeginX;
+		}
+		
+		void resize(unsigned N) {
+			if (N < this->size()) {
+				this->destroy_range(this->begin()+N, this->end());
+				this->setEnd(this->begin()+N);
+			} else if (N > this->size()) {
+				if (this->capacity() < N)
+					this->grow(N);
+				this->construct_range(this->end(), this->begin()+N, T());
+				this->setEnd(this->begin()+N);
+			}
+		}
+		
+		void resize(unsigned N, const T &NV) {
+			if (N < this->size()) {
+				this->destroy_range(this->begin()+N, this->end());
+				this->setEnd(this->begin()+N);
+			} else if (N > this->size()) {
+				if (this->capacity() < N)
+					this->grow(N);
+				construct_range(this->end(), this->begin()+N, NV);
+				this->setEnd(this->begin()+N);
+			}
+		}
+		
+		void reserve(unsigned N) {
+			if (this->capacity() < N)
+				this->grow(N);
+		}
+		
+		void push_back(const T &Elt) {
+			if (this->EndX < this->CapacityX) {
+			Retry:
+				new (this->end()) T(Elt);
+				this->setEnd(this->end()+1);
+				return;
+			}
+			this->grow();
+			goto Retry;
+		}
+		
+		void pop_back() {
+			this->setEnd(this->end()-1);
+			this->end()->~T();
+		}
+		
+		T pop_back_val() {
+			T Result = this->back();
+			pop_back();
+			return Result;
+		}
+		
+		void swap(SmallVectorImpl &RHS);
+		
+		/// append - Add the specified range to the end of the SmallVector.
+		///
+		template<typename in_iter>
+		void append(in_iter in_start, in_iter in_end) {
+			size_type NumInputs = std::distance(in_start, in_end);
+			// Grow allocated space if needed.
+			if (NumInputs > size_type(this->capacity_ptr()-this->end()))
+				this->grow(this->size()+NumInputs);
+			
+			// Copy the new elements over.
+			// TODO: NEED To compile time dispatch on whether in_iter is a random access
+			// iterator to use the fast uninitialized_copy.
+			std::uninitialized_copy(in_start, in_end, this->end());
+			this->setEnd(this->end() + NumInputs);
+		}
+		
+		/// append - Add the specified range to the end of the SmallVector.
+		///
+		void append(size_type NumInputs, const T &Elt) {
+			// Grow allocated space if needed.
+			if (NumInputs > size_type(this->capacity_ptr()-this->end()))
+				this->grow(this->size()+NumInputs);
+			
+			// Copy the new elements over.
+			std::uninitialized_fill_n(this->end(), NumInputs, Elt);
+			this->setEnd(this->end() + NumInputs);
+		}
+		
+		void assign(unsigned NumElts, const T &Elt) {
+			clear();
+			if (this->capacity() < NumElts)
+				this->grow(NumElts);
+			this->setEnd(this->begin()+NumElts);
+			construct_range(this->begin(), this->end(), Elt);
+		}
+		
+		iterator erase(iterator I) {
+			iterator N = I;
+			// Shift all elts down one.
+			std::copy(I+1, this->end(), I);
+			// Drop the last elt.
+			pop_back();
+			return(N);
+		}
+		
+		iterator erase(iterator S, iterator E) {
+			iterator N = S;
+			// Shift all elts down.
+			iterator I = std::copy(E, this->end(), S);
+			// Drop the last elts.
+			this->destroy_range(I, this->end());
+			this->setEnd(I);
+			return(N);
+		}
+		
+		iterator insert(iterator I, const T &Elt) {
+			if (I == this->end()) {  // Important special case for empty vector.
+				push_back(Elt);
+				return this->end()-1;
+			}
+			
+			if (this->EndX < this->CapacityX) {
+			Retry:
+				new (this->end()) T(this->back());
+				this->setEnd(this->end()+1);
+				// Push everything else over.
+				std::copy_backward(I, this->end()-1, this->end());
+				*I = Elt;
+				return I;
+			}
+			size_t EltNo = I-this->begin();
+			this->grow();
+			I = this->begin()+EltNo;
+			goto Retry;
+		}
+		
+		iterator insert(iterator I, size_type NumToInsert, const T &Elt) {
+			if (I == this->end()) {  // Important special case for empty vector.
+				append(NumToInsert, Elt);
+				return this->end()-1;
+			}
+			
+			// Convert iterator to elt# to avoid invalidating iterator when we reserve()
+			size_t InsertElt = I - this->begin();
+			
+			// Ensure there is enough space.
+			reserve(static_cast<unsigned>(this->size() + NumToInsert));
+			
+			// Uninvalidate the iterator.
+			I = this->begin()+InsertElt;
+			
+			// If there are more elements between the insertion point and the end of the
+			// range than there are being inserted, we can use a simple approach to
+			// insertion.  Since we already reserved space, we know that this won't
+			// reallocate the vector.
+			if (size_t(this->end()-I) >= NumToInsert) {
+				T *OldEnd = this->end();
+				append(this->end()-NumToInsert, this->end());
+				
+				// Copy the existing elements that get replaced.
+				std::copy_backward(I, OldEnd-NumToInsert, OldEnd);
+				
+				std::fill_n(I, NumToInsert, Elt);
+				return I;
+			}
+			
+			// Otherwise, we're inserting more elements than exist already, and we're
+			// not inserting at the end.
+			
+			// Copy over the elements that we're about to overwrite.
+			T *OldEnd = this->end();
+			this->setEnd(this->end() + NumToInsert);
+			size_t NumOverwritten = OldEnd-I;
+			this->uninitialized_copy(I, OldEnd, this->end()-NumOverwritten);
+			
+			// Replace the overwritten part.
+			std::fill_n(I, NumOverwritten, Elt);
+			
+			// Insert the non-overwritten middle part.
+			std::uninitialized_fill_n(OldEnd, NumToInsert-NumOverwritten, Elt);
+			return I;
+		}
+		
+		template<typename ItTy>
+		iterator insert(iterator I, ItTy From, ItTy To) {
+			if (I == this->end()) {  // Important special case for empty vector.
+				append(From, To);
+				return this->end()-1;
+			}
+			
+			size_t NumToInsert = std::distance(From, To);
+			// Convert iterator to elt# to avoid invalidating iterator when we reserve()
+			size_t InsertElt = I - this->begin();
+			
+			// Ensure there is enough space.
+			reserve(static_cast<unsigned>(this->size() + NumToInsert));
+			
+			// Uninvalidate the iterator.
+			I = this->begin()+InsertElt;
+			
+			// If there are more elements between the insertion point and the end of the
+			// range than there are being inserted, we can use a simple approach to
+			// insertion.  Since we already reserved space, we know that this won't
+			// reallocate the vector.
+			if (size_t(this->end()-I) >= NumToInsert) {
+				T *OldEnd = this->end();
+				append(this->end()-NumToInsert, this->end());
+				
+				// Copy the existing elements that get replaced.
+				std::copy_backward(I, OldEnd-NumToInsert, OldEnd);
+				
+				std::copy(From, To, I);
+				return I;
+			}
+			
+			// Otherwise, we're inserting more elements than exist already, and we're
+			// not inserting at the end.
+			
+			// Copy over the elements that we're about to overwrite.
+			T *OldEnd = this->end();
+			this->setEnd(this->end() + NumToInsert);
+			size_t NumOverwritten = OldEnd-I;
+			this->uninitialized_copy(I, OldEnd, this->end()-NumOverwritten);
+			
+			// Replace the overwritten part.
+			for (; NumOverwritten > 0; --NumOverwritten) {
+				*I = *From;
+				++I; ++From;
+			}
+			
+			// Insert the non-overwritten middle part.
+			this->uninitialized_copy(From, To, OldEnd);
+			return I;
+		}
+		
+		const SmallVectorImpl
+		&operator=(const SmallVectorImpl &RHS);
+		
+		bool operator==(const SmallVectorImpl &RHS) const {
+			if (this->size() != RHS.size()) return false;
+			return std::equal(this->begin(), this->end(), RHS.begin());
+		}
+		bool operator!=(const SmallVectorImpl &RHS) const {
+			return !(*this == RHS);
+		}
+		
+		bool operator<(const SmallVectorImpl &RHS) const {
+			return std::lexicographical_compare(this->begin(), this->end(),
+												RHS.begin(), RHS.end());
+		}
+		
+		/// set_size - Set the array size to \arg N, which the current array must have
+		/// enough capacity for.
+		///
+		/// This does not construct or destroy any elements in the vector.
+		///
+		/// Clients can use this in conjunction with capacity() to write past the end
+		/// of the buffer when they know that more elements are available, and only
+		/// update the size later. This avoids the cost of value initializing elements
+		/// which will only be overwritten.
+		void set_size(unsigned N) {
+			assert(N <= this->capacity());
+			this->setEnd(this->begin() + N);
+		}
+		
+	private:
+		static void construct_range(T *S, T *E, const T &Elt) {
+			for (; S != E; ++S)
+				new (S) T(Elt);
+		}
+	};
+	
+	
+	template <typename T>
+	void SmallVectorImpl<T>::swap(SmallVectorImpl<T> &RHS) {
+		if (this == &RHS) return;
+		
+		// We can only avoid copying elements if neither vector is small.
+		if (!this->isSmall() && !RHS.isSmall()) {
+			std::swap(this->BeginX, RHS.BeginX);
+			std::swap(this->EndX, RHS.EndX);
+			std::swap(this->CapacityX, RHS.CapacityX);
+			return;
+		}
+		if (RHS.size() > this->capacity())
+			this->grow(RHS.size());
+		if (this->size() > RHS.capacity())
+			RHS.grow(this->size());
+		
+		// Swap the shared elements.
+		size_t NumShared = this->size();
+		if (NumShared > RHS.size()) NumShared = RHS.size();
+		for (unsigned i = 0; i != static_cast<unsigned>(NumShared); ++i)
+			std::swap((*this)[i], RHS[i]);
+		
+		// Copy over the extra elts.
+		if (this->size() > RHS.size()) {
+			size_t EltDiff = this->size() - RHS.size();
+			this->uninitialized_copy(this->begin()+NumShared, this->end(), RHS.end());
+			RHS.setEnd(RHS.end()+EltDiff);
+			this->destroy_range(this->begin()+NumShared, this->end());
+			this->setEnd(this->begin()+NumShared);
+		} else if (RHS.size() > this->size()) {
+			size_t EltDiff = RHS.size() - this->size();
+			this->uninitialized_copy(RHS.begin()+NumShared, RHS.end(), this->end());
+			this->setEnd(this->end() + EltDiff);
+			this->destroy_range(RHS.begin()+NumShared, RHS.end());
+			RHS.setEnd(RHS.begin()+NumShared);
+		}
+	}
+	
+	template <typename T>
+	const SmallVectorImpl<T> &SmallVectorImpl<T>::
+	operator=(const SmallVectorImpl<T> &RHS) {
+		// Avoid self-assignment.
+		if (this == &RHS) return *this;
+		
+		// If we already have sufficient space, assign the common elements, then
+		// destroy any excess.
+		size_t RHSSize = RHS.size();
+		size_t CurSize = this->size();
+		if (CurSize >= RHSSize) {
+			// Assign common elements.
+			iterator NewEnd;
+			if (RHSSize)
+				NewEnd = std::copy(RHS.begin(), RHS.begin()+RHSSize, this->begin());
+			else
+				NewEnd = this->begin();
+			
+			// Destroy excess elements.
+			this->destroy_range(NewEnd, this->end());
+			
+			// Trim.
+			this->setEnd(NewEnd);
+			return *this;
+		}
+		
+		// If we have to grow to have enough elements, destroy the current elements.
+		// This allows us to avoid copying them during the grow.
+		if (this->capacity() < RHSSize) {
+			// Destroy current elements.
+			this->destroy_range(this->begin(), this->end());
+			this->setEnd(this->begin());
+			CurSize = 0;
+			this->grow(RHSSize);
+		} else if (CurSize) {
+			// Otherwise, use assignment for the already-constructed elements.
+			std::copy(RHS.begin(), RHS.begin()+CurSize, this->begin());
+		}
+		
+		// Copy construct the new elements in place.
+		this->uninitialized_copy(RHS.begin()+CurSize, RHS.end(),
+								 this->begin()+CurSize);
+		
+		// Set end.
+		this->setEnd(this->begin()+RHSSize);
+		return *this;
+	}
+	
+	
+	/// SmallVector - This is a 'vector' (really, a variable-sized array), optimized
+	/// for the case when the array is small.  It contains some number of elements
+	/// in-place, which allows it to avoid heap allocation when the actual number of
+	/// elements is below that threshold.  This allows normal "small" cases to be
+	/// fast without losing generality for large inputs.
+	///
+	/// Note that this does not attempt to be exception safe.
+	///
+	template <typename T, unsigned N>
+	class SmallVector : public SmallVectorImpl<T> {
+		/// InlineElts - These are 'N-1' elements that are stored inline in the body
+		/// of the vector.  The extra '1' element is stored in SmallVectorImpl.
+		typedef typename SmallVectorImpl<T>::U U;
+		enum {
+			// MinUs - The number of U's require to cover N T's.
+			MinUs = (static_cast<unsigned int>(sizeof(T))*N +
+					 static_cast<unsigned int>(sizeof(U)) - 1) /
+            static_cast<unsigned int>(sizeof(U)),
+			
+			// NumInlineEltsElts - The number of elements actually in this array.  There
+			// is already one in the parent class, and we have to round up to avoid
+			// having a zero-element array.
+			NumInlineEltsElts = MinUs > 1 ? (MinUs - 1) : 1,
+			
+			// NumTsAvailable - The number of T's we actually have space for, which may
+			// be more than N due to rounding.
+			NumTsAvailable = (NumInlineEltsElts+1)*static_cast<unsigned int>(sizeof(U))/
+			static_cast<unsigned int>(sizeof(T))
+		};
+		U InlineElts[NumInlineEltsElts];
+	public:
+		SmallVector() : SmallVectorImpl<T>(NumTsAvailable) {
+		}
+		
+		explicit SmallVector(unsigned Size, const T &Value = T())
+		: SmallVectorImpl<T>(NumTsAvailable) {
+			this->reserve(Size);
+			while (Size--)
+				this->push_back(Value);
+		}
+		
+		template<typename ItTy>
+		SmallVector(ItTy S, ItTy E) : SmallVectorImpl<T>(NumTsAvailable) {
+			this->append(S, E);
+		}
+		
+		SmallVector(const SmallVector &RHS) : SmallVectorImpl<T>(NumTsAvailable) {
+			if (!RHS.empty())
+				SmallVectorImpl<T>::operator=(RHS);
+		}
+		
+		const SmallVector &operator=(const SmallVector &RHS) {
+			SmallVectorImpl<T>::operator=(RHS);
+			return *this;
+		}
+		
+	};
+
+/// Specialize SmallVector at N=0.  This specialization guarantees
+/// that it can be instantiated at an incomplete T if none of its
+/// members are required.
+template <typename T>
+class SmallVector<T,0> : public SmallVectorImpl<T> {
+public:
+  SmallVector() : SmallVectorImpl<T>(0) {}
+
+  explicit SmallVector(unsigned Size, const T &Value = T())
+    : SmallVectorImpl<T>(0) {
+    this->reserve(Size);
+    while (Size--)
+      this->push_back(Value);
+  }
+
+  template<typename ItTy>
+  SmallVector(ItTy S, ItTy E) : SmallVectorImpl<T>(0) {
+    this->append(S, E);
+  }
+
+  SmallVector(const SmallVector &RHS) : SmallVectorImpl<T>(0) {
+    SmallVectorImpl<T>::operator=(RHS);
+  }
+
+  SmallVector &operator=(const SmallVectorImpl<T> &RHS) {
+    return SmallVectorImpl<T>::operator=(RHS);
+  }
+
+};
+
+} // End Ogre namespace
+
+namespace std {
+	/// Implement std::swap in terms of SmallVector swap.
+	template<typename T>
+	inline void
+	swap(Ogre::SmallVectorImpl<T> &LHS, Ogre::SmallVectorImpl<T> &RHS) {
+		LHS.swap(RHS);
+	}
+	
+	/// Implement std::swap in terms of SmallVector swap.
+	template<typename T, unsigned N>
+	inline void
+	swap(Ogre::SmallVector<T, N> &LHS, Ogre::SmallVector<T, N> &RHS) {
+		LHS.swap(RHS);
+	}
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreSphere.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreSphere.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreSphere.h	(revision 148)
@@ -0,0 +1,134 @@
+/*
+-----------------------------------------------------------------------------
+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 __Sphere_H_
+#define __Sphere_H_
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+
+#include "OgreVector3.h"
+
+namespace Ogre {
+
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Math
+	*  @{
+	*/
+	/** A sphere primitive, mostly used for bounds checking. 
+    @remarks
+        A sphere in math texts is normally represented by the function
+        x^2 + y^2 + z^2 = r^2 (for sphere's centered on the origin). Ogre stores spheres
+        simply as a center point and a radius.
+    */
+    class _OgreExport Sphere
+    {
+    protected:
+        Real mRadius;
+        Vector3 mCenter;
+    public:
+        /** Standard constructor - creates a unit sphere around the origin.*/
+        Sphere() : mRadius(1.0), mCenter(Vector3::ZERO) {}
+        /** Constructor allowing arbitrary spheres. 
+            @param center The center point of the sphere.
+            @param radius The radius of the sphere.
+        */
+        Sphere(const Vector3& center, Real radius)
+            : mRadius(radius), mCenter(center) {}
+
+        /** Returns the radius of the sphere. */
+        Real getRadius(void) const { return mRadius; }
+
+        /** Sets the radius of the sphere. */
+        void setRadius(Real radius) { mRadius = radius; }
+
+        /** Returns the center point of the sphere. */
+        const Vector3& getCenter(void) const { return mCenter; }
+
+        /** Sets the center point of the sphere. */
+        void setCenter(const Vector3& center) { mCenter = center; }
+
+		/** Returns whether or not this sphere intersects another sphere. */
+		bool intersects(const Sphere& s) const
+		{
+            return (s.mCenter - mCenter).squaredLength() <=
+                Math::Sqr(s.mRadius + mRadius);
+		}
+		/** Returns whether or not this sphere intersects a box. */
+		bool intersects(const AxisAlignedBox& box) const
+		{
+			return Math::intersects(*this, box);
+		}
+		/** Returns whether or not this sphere intersects a plane. */
+		bool intersects(const Plane& plane) const
+		{
+			return Math::intersects(*this, plane);
+		}
+		/** Returns whether or not this sphere intersects a point. */
+		bool intersects(const Vector3& v) const
+		{
+            return ((v - mCenter).squaredLength() <= Math::Sqr(mRadius));
+		}
+		/** Merges another Sphere into the current sphere */
+		void merge(const Sphere& oth)
+		{
+			Vector3 diff = oth.getCenter() - mCenter;
+			Real lengthSq = diff.squaredLength();
+			Real radiusDiff = oth.getRadius() - mRadius;
+			
+			// Early-out
+			if (Math::Sqr(radiusDiff) >= lengthSq) 
+			{
+				// One fully contains the other
+				if (radiusDiff <= 0.0f) 
+					return; // no change
+				else 
+				{
+					mCenter = oth.getCenter();
+					mRadius = oth.getRadius();
+					return;
+				}
+			}
+
+			Real length = Math::Sqrt(lengthSq);
+            Real t = (length + radiusDiff) / (2.0f * length);
+            mCenter = mCenter + diff * t;
+			mRadius = 0.5f * (length + mRadius + oth.getRadius());
+		}
+        
+
+    };
+	/** @} */
+	/** @} */
+
+}
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreSpotShadowFadePng.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreSpotShadowFadePng.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreSpotShadowFadePng.h	(revision 148)
@@ -0,0 +1,647 @@
+/*
+-----------------------------------------------------------------------------
+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 __SPOT_SHADOW_FADE_PNG_H__
+#define __SPOT_SHADOW_FADE_PNG_H__
+
+namespace Ogre {
+
+    // This exists so we don't have to be dependent on an external .png file
+    // for this core feature (PNG used to fade out the edges of spotlight shadows)
+    #define SPOT_SHADOW_FADE_PNG_SIZE 9728
+    unsigned char SPOT_SHADOW_FADE_PNG[SPOT_SHADOW_FADE_PNG_SIZE] = {
+         0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52  
+       , 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x00, 0x80, 0x08, 0x02, 0x00, 0x00, 0x00, 0x4c, 0x5c, 0xf6  
+       , 0x9c, 0x00, 0x00, 0x00, 0x04, 0x67, 0x41, 0x4d, 0x41, 0x00, 0x00, 0xb1, 0x8e, 0x7c, 0xfb, 0x51  
+       , 0x93, 0x00, 0x00, 0x00, 0x20, 0x63, 0x48, 0x52, 0x4d, 0x00, 0x00, 0x7a, 0x25, 0x00, 0x00, 0x80  
+       , 0x83, 0x00, 0x00, 0xf9, 0xff, 0x00, 0x00, 0x80, 0xe8, 0x00, 0x00, 0x75, 0x30, 0x00, 0x00, 0xea  
+       , 0x60, 0x00, 0x00, 0x3a, 0x97, 0x00, 0x00, 0x17, 0x6f, 0x97, 0xa9, 0x99, 0xd4, 0x00, 0x00, 0x25  
+       , 0x8a, 0x49, 0x44, 0x41, 0x54, 0x78, 0x9c, 0x62, 0xfc, 0xff, 0xff, 0x3f, 0xc3, 0x28, 0x18, 0x38                                                               
+       , 0x00, 0x10, 0x80, 0x58, 0x2a, 0xc8, 0x01, 0x00, 0x04, 0x41, 0x40, 0xfd, 0xff, 0xc7, 0x61, 0x66  
+       , 0xeb, 0x5a, 0xc7, 0x60, 0x32, 0x98, 0x17, 0xdc, 0xec, 0xbf, 0x0b, 0x3c, 0x90, 0xff, 0x11, 0x8e  
+       , 0x61, 0x87, 0xd7, 0x54, 0x32, 0xca, 0xed, 0x6d, 0x2a, 0x89, 0x48, 0x21, 0x04, 0x82, 0x92, 0x28  
+       , 0x1e, 0xa3, 0x96, 0xe4, 0xef, 0x2b, 0x2e, 0x98, 0x02, 0x30, 0x47, 0xe6, 0x48, 0x00, 0x02, 0x20  
+       , 0x10, 0x93, 0xe3, 0xff, 0x2f, 0x46, 0x34, 0x69, 0xac, 0xec, 0x75, 0x19, 0x42, 0x4d, 0xf6, 0x8f  
+       , 0x05, 0xa0, 0x7a, 0xce, 0x61, 0xc9, 0xac, 0xbb, 0x70, 0x69, 0x61, 0x85, 0x25, 0x88, 0xeb, 0x70  
+       , 0x9e, 0xd0, 0x40, 0xa8, 0x1e, 0xed, 0x11, 0xa5, 0xfc, 0x2a, 0xed, 0x77, 0xb6, 0xb7, 0x1b, 0x14  
+       , 0xc8, 0xfc, 0xee, 0xb3, 0x97, 0xdc, 0x02, 0x30, 0x4f, 0x06, 0x37, 0x00, 0x80, 0x20, 0x0c, 0x94  
+       , 0x08, 0xfb, 0x0f, 0x0c, 0x1a, 0xaf, 0xe8, 0x10, 0x92, 0x58, 0x1a, 0x9e, 0xed, 0xf9, 0x4b, 0x01  
+       , 0xc2, 0x7c, 0x55, 0x12, 0x7c, 0xa5, 0x5e, 0x56, 0xdb, 0x52, 0x0f, 0x34, 0xd1, 0xc2, 0xec, 0x5b  
+       , 0xc3, 0xfd, 0x09, 0xc2, 0x1f, 0x31, 0x01, 0x6e, 0xa3, 0xa1, 0x87, 0x76, 0x91, 0xff, 0x82, 0x57  
+       , 0xe2, 0xa4, 0x8f, 0xb0, 0x7c, 0x86, 0x07, 0x26, 0xe4, 0xfb, 0x32, 0xed, 0x83, 0x32, 0x8e, 0x00  
+       , 0xc4, 0x94, 0x5b, 0x0a, 0x00, 0x20, 0x08, 0x04, 0x31, 0xb2, 0xfb, 0x9f, 0xb7, 0xe8, 0xb1, 0x63  
+       , 0x41, 0x47, 0x70, 0xa3, 0x10, 0x03, 0x3f, 0x46, 0xd7, 0xe4, 0x06, 0x88, 0x9f, 0x60, 0x0f, 0x88  
+       , 0xc7, 0xdb, 0x91, 0xb8, 0x77, 0x12, 0x04, 0x64, 0xe9, 0x83, 0x34, 0x31, 0xc6, 0x0c, 0x33, 0xec  
+       , 0xf5, 0x3d, 0x60, 0x54, 0x61, 0xea, 0xd9, 0x41, 0x06, 0xfa, 0xc2, 0xec, 0x5f, 0xd5, 0x20, 0xfe  
+       , 0xc8, 0x7b, 0xe3, 0x28, 0x68, 0xee, 0x71, 0xaf, 0xf4, 0x65, 0x96, 0xb6, 0xa5, 0x8e, 0x00, 0xc4  
+       , 0x94, 0x41, 0x12, 0xc0, 0x20, 0x08, 0x03, 0x0f, 0x15, 0xf8, 0xff, 0x73, 0x01, 0x47, 0x9b, 0x00  
+       , 0x6f, 0x68, 0x99, 0x51, 0x31, 0x07, 0x0f, 0x1b, 0xc9, 0x6f, 0x06, 0x14, 0xd7, 0x4c, 0x8f, 0x00
+       , 0xe9, 0x70, 0xf7, 0xc4, 0x42, 0x13, 0x14, 0x12, 0x02, 0x8f, 0xe4, 0x65, 0x8f, 0x07, 0x35, 0x02
+       , 0x7b, 0xb2, 0x88, 0x31, 0x74, 0xf0, 0x4c, 0x65, 0xd0, 0xed, 0x09, 0xe0, 0xdf, 0x6f, 0xfa, 0xd8
+       , 0xd7, 0xd4, 0x53, 0xac, 0x17, 0x49, 0xab, 0x69, 0x97, 0x08, 0x3b, 0x33, 0x83, 0x62, 0x52, 0x82
+       , 0xb6, 0x13, 0xdf, 0x73, 0x78, 0x05, 0xe0, 0xa5, 0x4c, 0x52, 0x00, 0x08, 0x61, 0x20, 0xa8, 0xe0
+       , 0xf6, 0xff, 0xd7, 0x46, 0x2f, 0xda, 0xd5, 0xc8, 0x30, 0x2f, 0xd0, 0x98, 0xe5, 0x10, 0x14, 0xaa
+       , 0x8d, 0xcf, 0xaf, 0xdc, 0x1b, 0xae, 0x26, 0x0f, 0xf6, 0x19, 0x11, 0x0a, 0x98, 0xf2, 0x52, 0x5a
+       , 0x81, 0x0a, 0x08, 0xc0, 0x34, 0xa8, 0xd5, 0x83, 0xe0, 0x11, 0xc0, 0xe1, 0x0f, 0x7d, 0x1f, 0x95
+       , 0xd2, 0x1d, 0x82, 0x8c, 0xff, 0x35, 0x28, 0xf7, 0xa3, 0xa9, 0xc5, 0x68, 0x5b, 0xed, 0xbc, 0xfe
+       , 0xfe, 0x2d, 0x95, 0x83, 0x8d, 0xb9, 0x54, 0x68, 0x74, 0x20, 0xc6, 0x4b, 0x1e, 0x47, 0x00, 0xde
+       , 0xca, 0x25, 0x07, 0x60, 0x10, 0x84, 0x82, 0xa9, 0x6d, 0x2c, 0xdc, 0xff, 0xb0, 0x60, 0x62, 0x62
+       , 0x65, 0xa8, 0x1e, 0x41, 0x16, 0x7c, 0x5c, 0xb8, 0x98, 0x87, 0xcf, 0x73, 0x02, 0x8c, 0x44, 0x1f
+       , 0xb4, 0x03, 0xb6, 0xbb, 0x79, 0x84, 0x19, 0xd5, 0x18, 0x1b, 0x1d, 0xfc, 0x5b, 0x3e, 0x82, 0xfe
+       , 0x6f, 0x3e, 0xd6, 0xc3, 0xea, 0xe7, 0xfa, 0x0f, 0x62, 0x5f, 0x8e, 0x85, 0x14, 0x4c, 0xa8, 0xf0
+       , 0x03, 0x5f, 0xf7, 0xb2, 0xa2, 0x87, 0x54, 0x17, 0xfe, 0x24, 0xaf, 0x22, 0xa2, 0xfa, 0xce, 0x14
+       , 0x35, 0x26, 0xe1, 0x48, 0xb6, 0x40, 0x53, 0x86, 0x23, 0xb6, 0xf4, 0x09, 0xc0, 0x6b, 0x15, 0xe4
+       , 0x00, 0x08, 0x83, 0xb0, 0x10, 0xb2, 0x0c, 0xf8, 0xff, 0x5b, 0xd5, 0x2d, 0x31, 0x0a, 0xed, 0xf4
+       , 0x07, 0x5a, 0xb2, 0x25, 0xdb, 0xb1, 0x05, 0xda, 0x9f, 0x04, 0xc0, 0x6e, 0x1f, 0xa4, 0x79, 0x07
+       , 0xb6, 0x3a, 0x85, 0xf5, 0x38, 0x56, 0xa5, 0x06, 0xb3, 0x9a, 0x1d, 0x9e, 0xf0, 0xb0, 0x7f, 0xc2
+       , 0x01, 0x88, 0x8b, 0xf5, 0x0a, 0x80, 0x28, 0x24, 0x68, 0x7f, 0x06, 0x21, 0x11, 0xf8, 0x40, 0xd1
+       , 0xcf, 0xdc, 0xa3, 0xda, 0xb4, 0x61, 0x1c, 0x72, 0x28, 0xd2, 0x03, 0xba, 0x81, 0xf0, 0x82, 0x85
+       , 0x87, 0x79, 0x04, 0x2f, 0x0f, 0xe7, 0x2f, 0x14, 0xe9, 0x58, 0x59, 0x5f, 0x33, 0x73, 0x0b, 0x40
+       , 0x6b, 0xb9, 0xe3, 0x00, 0x0c, 0xc3, 0x20, 0x74, 0x89, 0xf2, 0x31, 0xf7, 0x3f, 0xaa, 0xe7, 0x16
+       , 0xb0, 0xdb, 0x1b, 0x44, 0x8a, 0x62, 0x65, 0x05, 0xe7, 0xc1, 0x75, 0x03, 0xa8, 0xa3, 0x95, 0x97
+       , 0xf0, 0x29, 0xad, 0x93, 0xa2, 0x67, 0xea, 0x70, 0xea, 0x25, 0x1f, 0xe4, 0x8b, 0x89, 0x43, 0xda
+       , 0xf8, 0xea, 0xdd, 0x37, 0x78, 0xb8, 0xf9, 0x8d, 0xfe, 0xe7, 0xeb, 0xa1, 0x6e, 0x41, 0x5d, 0x43
+       , 0x9d, 0x00, 0xb5, 0xff, 0xc5, 0xa0, 0x2e, 0x42, 0x4e, 0x64, 0x39, 0x30, 0x8a, 0x48, 0x7f, 0x18
+       , 0x4f, 0x07, 0x30, 0x77, 0x7c, 0x87, 0x6c, 0x40, 0x80, 0xe2, 0x23, 0x7a, 0x02, 0x87, 0x66, 0xe0
+       , 0x44, 0x7d, 0x8d, 0xb9, 0x36, 0x11, 0x76, 0x4f, 0x9f, 0x57, 0x00, 0xda, 0xcb, 0x1e, 0x0b, 0x60
+       , 0x10, 0x84, 0xc1, 0x0b, 0xaf, 0x43, 0xcb, 0xfd, 0x4f, 0xaa, 0xfd, 0xa1, 0x4b, 0xc3, 0x27, 0xf5
+       , 0x06, 0xf2, 0x14, 0x9d, 0x1c, 0x82, 0x49, 0x60, 0xe1, 0xd3, 0x82, 0x4c, 0x6a, 0x7e, 0xe7, 0xff
+       , 0x16, 0xce, 0xda, 0xbd, 0x01, 0xbc, 0x72, 0x6f, 0x6d, 0xdc, 0x15, 0xc8, 0x4d, 0x44, 0x99, 0x6f
+       , 0x60, 0x10, 0x74, 0x3d, 0x6f, 0xa9, 0xbe, 0x40, 0xcf, 0xb1, 0x60, 0x52, 0x60, 0x16, 0xa0, 0x24
+       , 0x08, 0x07, 0x80, 0x05, 0x63, 0x0e, 0xa8, 0x69, 0x00, 0x0e, 0x98, 0x91, 0xe8, 0x87, 0x20, 0x81
+       , 0xfd, 0xbd, 0x4f, 0x5a, 0xef, 0x76, 0xa6, 0x25, 0x4b, 0x92, 0x40, 0xff, 0x70, 0x56, 0x86, 0xfb
+       , 0xc5, 0xf9, 0x88, 0x13, 0x7b, 0xa8, 0x12, 0xaa, 0x83, 0x4a, 0xba, 0x02, 0xa5, 0x4f, 0x00, 0xda
+       , 0xab, 0x20, 0x07, 0x40, 0x10, 0x86, 0x69, 0x48, 0xd4, 0xb8, 0xf1, 0xff, 0x7f, 0x3a, 0x34, 0xc0
+       , 0xc9, 0xb2, 0x95, 0x27, 0x00, 0x64, 0x1c, 0xe0, 0x40, 0xba, 0xd1, 0xb5, 0xab, 0x12, 0xe0, 0x1c
+       , 0x5e, 0xa3, 0xd8, 0x11, 0x0a, 0x87, 0x19, 0x90, 0xb7, 0x82, 0x88, 0x83, 0x1a, 0x97, 0x00, 0x7a
+       , 0xeb, 0x8d, 0xd0, 0x77, 0x6a, 0xd2, 0x90, 0x3d, 0x93, 0x83, 0x9c, 0xff, 0x69, 0x87, 0x69, 0x02
+       , 0xb6, 0x70, 0xc9, 0x6c, 0x03, 0x6c, 0xc1, 0x7b, 0xd8, 0x30, 0x67, 0xa1, 0x44, 0x27, 0x36, 0xf5
+       , 0x68, 0x18, 0x01, 0xac, 0x34, 0x3f, 0xc0, 0x98, 0xae, 0x85, 0x0e, 0x14, 0xc8, 0xf9, 0x18, 0xe0
+       , 0x57, 0x95, 0x2c, 0x59, 0xdf, 0x4f, 0x91, 0x03, 0x64, 0x01, 0x5b, 0x93, 0x1b, 0x6f, 0x1b, 0xec
+       , 0x74, 0xad, 0x60, 0xa4, 0x5f, 0x00, 0x56, 0xac, 0x2d, 0x07, 0x40, 0x10, 0x86, 0x61, 0x8c, 0x18
+       , 0x15, 0xb8, 0xff, 0x39, 0x1d, 0x7e, 0x18, 0x9f, 0x5d, 0xd9, 0x12, 0x0f, 0xe0, 0x08, 0x7c, 0xf0
+       , 0x45, 0xba, 0xad, 0x6b, 0xf9, 0x3f, 0x01, 0x00, 0x4a, 0x89, 0x5c, 0xc9, 0x66, 0x13, 0x16, 0xbb
+       , 0x00, 0x76, 0x91, 0x55, 0xb8, 0xab, 0xe0, 0x86, 0x8a, 0xc7, 0x74, 0x0f, 0x55, 0xcf, 0x4e, 0xb9
+       , 0x73, 0x78, 0x34, 0xec, 0x79, 0x2a, 0xff, 0xdc, 0x97, 0xd7, 0x3f, 0x5d, 0x70, 0xfb, 0x88, 0x78
+       , 0xc2, 0x67, 0x0a, 0x77, 0x96, 0x82, 0xc0, 0x14, 0x98, 0x21, 0x56, 0x4f, 0xa0, 0xb3, 0xd8, 0x69
+       , 0xa8, 0xb7, 0x16, 0x88, 0x03, 0x1b, 0x41, 0xe1, 0x8f, 0xa3, 0x2f, 0x84, 0x92, 0x24, 0x8a, 0x64
+       , 0xa9, 0x39, 0xa5, 0x5c, 0x0a, 0x9a, 0x36, 0x63, 0x26, 0x41, 0x34, 0xe0, 0x89, 0xd0, 0x62, 0xe7
+       , 0x4c, 0x4e, 0x9a, 0xfe, 0xf5, 0xd2, 0xaf, 0x00, 0xac, 0x58, 0x5b, 0x0a, 0xc0, 0x20, 0x0c, 0x2b
+       , 0x7b, 0xc0, 0xee, 0x7f, 0xd4, 0x22, 0x63, 0xdd, 0x70, 0x5b, 0xd2, 0x07, 0x5e, 0xc0, 0x8a, 0xe2
+       , 0x8f, 0x20, 0x89, 0x6d, 0x52, 0x27, 0x13, 0x00, 0xf0, 0x42, 0x5c, 0x51, 0x61, 0x08, 0x3c, 0x43
+       , 0x55, 0x39, 0xb1, 0x34, 0x6d, 0x90, 0x59, 0x57, 0x5a, 0xb7, 0x9e, 0x44, 0xdf, 0xb2, 0x13, 0x88
+       , 0x0e, 0x8c, 0xe0, 0xdf, 0x04, 0xff, 0xa9, 0xe6, 0x97, 0x5f, 0x11, 0xd5, 0xfd, 0xbe, 0xfd, 0x1b
+       , 0x06, 0x08, 0x3b, 0x91, 0x14, 0x60, 0x19, 0x3e, 0x34, 0x85, 0x58, 0x96, 0x8a, 0xad, 0xd2, 0xa0
+       , 0x08, 0x58, 0xa3, 0x0e, 0x31, 0x0f, 0xe8, 0x76, 0xf6, 0x60, 0x00, 0xaa, 0x7b, 0x61, 0xd8, 0x01
+       , 0xb5, 0x3a, 0x5d, 0xa8, 0xc2, 0x20, 0xb8, 0x55, 0xf3, 0x5b, 0x5a, 0xbc, 0x8c, 0x0e, 0x0e, 0x70
+       , 0x74, 0x16, 0x62, 0xbf, 0x00, 0xac, 0x58, 0x5b, 0x0a, 0xc0, 0x20, 0x0c, 0x1b, 0x8c, 0x09, 0xc2
+       , 0xee, 0x7f, 0xcf, 0x0e, 0x86, 0x2b, 0xb8, 0x47, 0x9a, 0xa8, 0xbb, 0x80, 0x08, 0xfd, 0xd6, 0xa4
+       , 0xa6, 0x69, 0x66, 0x12, 0x80, 0x96, 0x3e, 0xa3, 0x89, 0xa2, 0xe9, 0x71, 0xec, 0x30, 0xc0, 0x6e
+       , 0xd6, 0xaa, 0xcc, 0x0f, 0x1e, 0xe4, 0x45, 0x66, 0xd3, 0x9b, 0xf8, 0xd3, 0x6e, 0x82, 0x85, 0xca
+       , 0x52, 0x99, 0x47, 0x08, 0x7c, 0x94, 0x57, 0xe6, 0xf3, 0x8f, 0x1f, 0x98, 0xc5, 0x2d, 0xdc, 0x00
+       , 0x9e, 0x11, 0x05, 0x29, 0x92, 0xd3, 0x3e, 0xdb, 0x45, 0x68, 0x1d, 0x93, 0x80, 0xf8, 0xf7, 0x59
+       , 0xb0, 0x29, 0x8b, 0x10, 0x01, 0x89, 0x22, 0xc4, 0x8f, 0x80, 0x8e, 0x48, 0x17, 0x58, 0xf0, 0x1c
+       , 0x70, 0x67, 0xdc, 0x2d, 0xfc, 0x41, 0x69, 0x1c, 0xe8, 0xaa, 0xf2, 0x06, 0x7b, 0xbd, 0x21, 0x48
+       , 0x58, 0x20, 0xa6, 0x80, 0xf6, 0x09, 0xc0, 0x8a, 0x99, 0x23, 0x01, 0x08, 0xc3, 0x30, 0x70, 0x86
+       , 0x9b, 0xff, 0x7f, 0x34, 0x98, 0x02, 0x12, 0x12, 0x40, 0xb6, 0x1c, 0x4a, 0x1a, 0xf8, 0x82, 0x0f
+       , 0x49, 0xab, 0x7f, 0x16, 0x80, 0xb1, 0xe0, 0xaa, 0x55, 0x73, 0x54, 0xe4, 0x57, 0xb1, 0xd9, 0x07
+       , 0x4c, 0x7d, 0x09, 0x12, 0x04, 0xdb, 0xf0, 0xdc, 0xa9, 0xd7, 0xbf, 0x91, 0xbe, 0x68, 0x00, 0x86
+       , 0xc0, 0x14, 0x9f, 0x5c, 0x93, 0xe7, 0x61, 0xb2, 0x93, 0x6b, 0xe9, 0x80, 0x25, 0x9c, 0x57, 0x79
+       , 0x1a, 0x38, 0xea, 0xce, 0x5b, 0x85, 0x5e, 0xbf, 0xc0, 0x4a, 0x51, 0x03, 0x02, 0xe6, 0xd2, 0xae
+       , 0x75, 0x42, 0x63, 0x35, 0xe4, 0x5e, 0xdc, 0x0f, 0x51, 0x61, 0x78, 0x8c, 0x2a, 0x43, 0x10, 0x9b
+       , 0x3d, 0xcd, 0x13, 0xef, 0x22, 0x19, 0x0a, 0x12, 0x4e, 0xd4, 0xaa, 0xa2, 0x53, 0x7a, 0xb1, 0x74
+       , 0x00, 0x51, 0x84, 0x39, 0x37, 0x9f, 0x3b, 0x8c, 0x5b, 0x00, 0x56, 0xac, 0x20, 0x05, 0x60, 0x18
+       , 0x84, 0xc1, 0xf6, 0xff, 0xb7, 0xb6, 0x3b, 0x2a, 0xb4, 0x34, 0x89, 0x8a, 0xe7, 0xb1, 0x09, 0x3d
+       , 0xf4, 0x56, 0x8c, 0x49, 0x13, 0x7f, 0x00, 0x00, 0x2a, 0x81, 0xee, 0x4a, 0x73, 0x28, 0xf5, 0x68
+       , 0xfa, 0xe4, 0x41, 0x3d, 0x73, 0x0c, 0x09, 0x52, 0xf7, 0xbf, 0x18, 0xad, 0x3c, 0xe6, 0x56, 0xce
+       , 0x27, 0x56, 0x3e, 0x1d, 0xbb, 0x7a, 0xee, 0x95, 0x79, 0x5f, 0x55, 0x9a, 0x24, 0x10, 0x64, 0xe9
+       , 0x2e, 0x49, 0x8a, 0x58, 0x70, 0xf5, 0x9f, 0x9c, 0xeb, 0x21, 0x62, 0xe0, 0x20, 0x83, 0x29, 0xa0
+       , 0xb9, 0x11, 0x04, 0xe7, 0x50, 0x04, 0x04, 0x8a, 0xe2, 0x78, 0x70, 0x11, 0x35, 0x13, 0xf9, 0xda
+       , 0xe9, 0x09, 0x10, 0x24, 0xee, 0x6f, 0xee, 0xe8, 0x08, 0xc0, 0x9a, 0x19, 0xec, 0x00, 0x08, 0x83
+       , 0x30, 0xd4, 0x93, 0xff, 0xff, 0xa7, 0xc3, 0x78, 0xd0, 0x19, 0x62, 0x7c, 0x14, 0x66, 0xbc, 0x4f
+       , 0x0e, 0x9c, 0x96, 0x65, 0xa1, 0xa1, 0x94, 0x6e, 0x16, 0x00, 0x1e, 0xc3, 0xb0, 0x92, 0xbe, 0xd9
+       , 0x37, 0x85, 0x51, 0xf5, 0x66, 0xcd, 0x0c, 0x28, 0x8e, 0x60, 0x53, 0x41, 0x70, 0x72, 0xea, 0x2d
+       , 0x7f, 0x51, 0x7f, 0x11, 0xbf, 0xfb, 0x67, 0xeb, 0xca, 0x81, 0xeb, 0x7f, 0xfe, 0x12, 0x25, 0x73
+       , 0xdd, 0x34, 0xd5, 0x92, 0x46, 0xb5, 0xc6, 0xc2, 0xf0, 0x2a, 0xb4, 0x17, 0xac, 0xa4, 0x10, 0x63
+       , 0xbd, 0x03, 0x42, 0x5a, 0x20, 0xf2, 0x4a, 0xae, 0x12, 0x64, 0x91, 0xca, 0x9d, 0x1a, 0xd6, 0x20
+       , 0x41, 0x8b, 0x72, 0x2f, 0x5b, 0xc3, 0x8c, 0x89, 0xf4, 0x08, 0x40, 0x8b, 0x15, 0xe4, 0x00, 0x08
+       , 0xc2, 0x30, 0x09, 0x99, 0xfc, 0xff, 0xa3, 0xec, 0xa4, 0x07, 0x96, 0x19, 0xd7, 0x55, 0x78, 0x80
+       , 0x46, 0xc2, 0x03, 0x9a, 0x6e, 0xb4, 0xa5, 0x9f, 0x06, 0x10, 0x20, 0x10, 0x31, 0x21, 0xf7, 0xc1
+       , 0x76, 0x68, 0x8e, 0x6a, 0x4f, 0xf2, 0xbb, 0x22, 0x6e, 0x1e, 0xd3, 0xca, 0x4e, 0x4a, 0xe9, 0x53
+       , 0x36, 0x70, 0xf7, 0xd3, 0x78, 0x6d, 0x06, 0x4e, 0x76, 0x6d, 0x17, 0x8d, 0xf5, 0xbf, 0x83, 0xf2
+       , 0xd5, 0x7d, 0x73, 0x2f, 0xc5, 0xf8, 0x10, 0xa4, 0x56, 0x80, 0x10, 0x09, 0xf3, 0x1f, 0xb6, 0x37
+       , 0x84, 0x00, 0xb3, 0x96, 0x59, 0x6c, 0x2c, 0xbe, 0x8d, 0x7b, 0x9f, 0x83, 0xc0, 0xf5, 0x05, 0x37
+       , 0x13, 0x71, 0xfc, 0xa1, 0xc3, 0x5a, 0xde, 0x41, 0xba, 0x05, 0x10, 0xf9, 0x11, 0x00, 0x74, 0x1d
+       , 0xa8, 0xb5, 0x03, 0xae, 0x6c, 0x3f, 0x02, 0xc3, 0xfe, 0xc3, 0xfb, 0x77, 0xef, 0xde, 0xbd, 0x07
+       , 0xc1, 0xb7, 0x5f, 0xbf, 0x80, 0xfb, 0x58, 0xdf, 0xa1, 0x1d, 0x5d, 0x48, 0xf1, 0x03, 0x2b, 0x7b
+       , 0x7e, 0x40, 0x06, 0xda, 0xa0, 0x8d, 0x4e, 0xa8, 0xcf, 0xfe, 0xe1, 0x2f, 0xd6, 0xa9, 0x0e, 0x40
+       , 0x31, 0x01, 0x19, 0xe3, 0x06, 0x66, 0x04, 0xe8, 0xc0, 0xec, 0x6f, 0x56, 0x50, 0xd0, 0xff, 0x81
+       , 0xb5, 0x84, 0x61, 0xce, 0x83, 0xa7, 0x78, 0x70, 0xc3, 0x00, 0x34, 0x52, 0x0e, 0x2e, 0x82, 0xe0
+       , 0x23, 0x53, 0x0c, 0xe0, 0x16, 0x19, 0xb0, 0x1f, 0xc7, 0x4a, 0x56, 0x3e, 0x00, 0x08, 0x20, 0x32
+       , 0x23, 0x00, 0xe8, 0x3e, 0x50, 0x95, 0xfb, 0xe5, 0x0b, 0xb8, 0xcc, 0x01, 0x15, 0x3a, 0xc0, 0xd0
+       , 0x7f, 0x0b, 0x8c, 0x80, 0xf7, 0xef, 0x21, 0x3d, 0x5d, 0x50, 0xf2, 0x87, 0x0e, 0x33, 0x7c, 0xfb
+       , 0x81, 0x14, 0xfc, 0x90, 0x7e, 0x2f, 0xc4, 0x87, 0x90, 0x74, 0x4f, 0x9e, 0x03, 0xa8, 0x05, 0x60
+       , 0x61, 0xfb, 0x87, 0x05, 0x08, 0xff, 0xc0, 0x66, 0x81, 0xfe, 0x40, 0x3b, 0xe3, 0x7f, 0xff, 0xc0
+       , 0xc6, 0xa3, 0x20, 0x49, 0x1e, 0x14, 0xf0, 0xa0, 0x60, 0x87, 0x54, 0x52, 0xf0, 0xf6, 0x30, 0x24
+       , 0xed, 0x70, 0x73, 0x03, 0xcb, 0x22, 0x92, 0xf3, 0x01, 0x40, 0x00, 0x91, 0x13, 0x01, 0xa0, 0x92
+       , 0xe7, 0xeb, 0x37, 0x50, 0xe8, 0x7f, 0xfa, 0x08, 0x2e, 0x6f, 0x40, 0x81, 0xff, 0xf6, 0x2d, 0x28
+       , 0xf4, 0xc1, 0x43, 0x0c, 0xa0, 0x51, 0x06, 0xd0, 0x90, 0x03, 0x38, 0xfc, 0xc1, 0x81, 0x0f, 0x22
+       , 0x20, 0x2d, 0x39, 0x20, 0xfe, 0x03, 0x69, 0x6d, 0xfe, 0xfd, 0x43, 0xdf, 0x44, 0x8f, 0x0f, 0xfc
+       , 0x01, 0x57, 0x3e, 0x2c, 0x90, 0x99, 0x37, 0x10, 0x87, 0xed, 0x0f, 0x6c, 0x22, 0xee, 0x0f, 0xb4
+       , 0x23, 0x8e, 0xd4, 0x2a, 0x00, 0x4d, 0x51, 0xff, 0xfb, 0x0b, 0x1b, 0x93, 0x85, 0x0c, 0x8b, 0x03
+       , 0xfb, 0x21, 0xc0, 0x06, 0x11, 0x30, 0x1f, 0x00, 0x6b, 0x16, 0x92, 0xac, 0x06, 0x08, 0x20, 0x92
+       , 0x23, 0x00, 0xe8, 0x10, 0x60, 0xa8, 0x02, 0xc3, 0x19, 0xd8, 0xba, 0x07, 0x85, 0x3e, 0x30, 0xe8
+       , 0xc1, 0xc1, 0x0f, 0x64, 0x83, 0x87, 0x18, 0xa0, 0xc9, 0x1f, 0x54, 0x02, 0x41, 0x4a, 0x1f, 0x68
+       , 0xb7, 0x0b, 0xdc, 0xf2, 0x81, 0x8e, 0xb5, 0xfd, 0xa5, 0x75, 0x59, 0x4f, 0x0e, 0xf8, 0x0f, 0x4a
+       , 0x58, 0xff, 0x20, 0x03, 0x7f, 0x7f, 0xa0, 0x81, 0xfe, 0x0f, 0x36, 0x35, 0xfd, 0xef, 0xcf, 0x3f
+       , 0x44, 0x7f, 0xe4, 0x1f, 0x68, 0x55, 0x00, 0x6c, 0x4d, 0x00, 0x74, 0x3c, 0x0a, 0xb2, 0x26, 0x80
+       , 0x81, 0x91, 0x89, 0x87, 0x9b, 0x0b, 0xd8, 0xd6, 0x22, 0xde, 0x5a, 0x80, 0x00, 0x22, 0x2d, 0x02
+       , 0x80, 0x36, 0x82, 0x87, 0x18, 0x80, 0x6d, 0x1e, 0x68, 0xc9, 0x03, 0x4c, 0xf7, 0xc0, 0xd0, 0x87
+       , 0xa4, 0x7d, 0xf0, 0x30, 0x03, 0x08, 0x02, 0xfb, 0xc1, 0xe0, 0xd4, 0xff, 0xf5, 0x3b, 0x78, 0xdc
+       , 0xff, 0x27, 0x64, 0x84, 0x1f, 0xd2, 0x88, 0x1e, 0xe8, 0x32, 0x07, 0x3f, 0x00, 0x06, 0x2c, 0x28
+       , 0x81, 0x80, 0x12, 0x39, 0x6c, 0x0c, 0xea, 0x2f, 0xa8, 0xad, 0x03, 0x0a, 0xfd, 0xff, 0x7f, 0xe1
+       , 0xc3, 0xe0, 0xf0, 0xc2, 0x07, 0xa4, 0x87, 0x91, 0x91, 0x11, 0xa9, 0xeb, 0x01, 0x6c, 0xf2, 0x72
+       , 0x73, 0x71, 0x11, 0x3f, 0xdb, 0x0c, 0x10, 0x40, 0xa4, 0x45, 0x00, 0xb0, 0x24, 0x01, 0x26, 0xed
+       , 0x4f, 0x9f, 0x3f, 0x81, 0xda, 0xf8, 0xa0, 0x5a, 0x17, 0x98, 0xfa, 0xdf, 0x7c, 0x00, 0x87, 0x3e
+       , 0x78, 0x9c, 0xed, 0x0b, 0x74, 0xc0, 0x13, 0x5a, 0xf7, 0x7e, 0x83, 0xb5, 0xf9, 0x41, 0x6d, 0x1e
+       , 0x60, 0xed, 0xf5, 0x6f, 0x10, 0x26, 0x7c, 0x6c, 0x00, 0xbc, 0x10, 0x03, 0x29, 0xc1, 0x83, 0x02
+       , 0xff, 0x3f, 0x78, 0xb5, 0xc6, 0x7f, 0x06, 0x94, 0xde, 0x20, 0x23, 0x6c, 0x31, 0x06, 0xac, 0xa3
+       , 0x01, 0xeb, 0x7d, 0x73, 0x71, 0x71, 0x11, 0x69, 0x17, 0x40, 0x00, 0x91, 0x10, 0x01, 0xc0, 0x84
+       , 0x0c, 0x4c, 0xd4, 0xa0, 0xc1, 0x1d, 0x60, 0x8b, 0xf3, 0x03, 0xb0, 0xe8, 0xff, 0x00, 0xaa, 0x74
+       , 0x3f, 0x00, 0x4b, 0x1e, 0xc8, 0xf8, 0xe6, 0x17, 0x70, 0x05, 0xf0, 0x15, 0xd2, 0xfa, 0x84, 0x8e
+       , 0x3a, 0xfc, 0x00, 0x25, 0x7e, 0x60, 0x13, 0x1a, 0x58, 0xe8, 0x93, 0x13, 0x12, 0x03, 0x07, 0x80
+       , 0x41, 0x0c, 0xac, 0xb1, 0xa0, 0x7d, 0xba, 0x7f, 0x90, 0xe1, 0x6f, 0xd8, 0x48, 0x38, 0x03, 0x6c
+       , 0x14, 0x16, 0xba, 0x14, 0x83, 0x01, 0xdc, 0xd1, 0x03, 0x8f, 0x76, 0x30, 0x32, 0xb1, 0x40, 0xd6
+       , 0xbe, 0x30, 0x33, 0x11, 0x39, 0x56, 0x01, 0x10, 0x40, 0xc4, 0x46, 0x00, 0xb0, 0xf4, 0x00, 0x16
+       , 0xea, 0xa0, 0xc1, 0xcc, 0x4f, 0xe0, 0xd2, 0x07, 0x98, 0xec, 0xdf, 0xbd, 0x05, 0xb7, 0x79, 0xc0
+       , 0x65, 0xcf, 0x17, 0x58, 0xdb, 0x07, 0x3c, 0xfc, 0xfc, 0xe3, 0xdb, 0x37, 0x78, 0xb3, 0x07, 0xd2
+       , 0x96, 0x23, 0x3b, 0x20, 0x06, 0x16, 0x00, 0x1d, 0x0f, 0xce, 0x02, 0x90, 0xb1, 0x3f, 0xa4, 0x19
+       , 0x08, 0x06, 0x06, 0xa4, 0x81, 0x3f, 0xf0, 0x42, 0x24, 0x70, 0xb8, 0x83, 0x46, 0x9b, 0x58, 0xa1
+       , 0x7d, 0x6d, 0x66, 0x26, 0x66, 0x62, 0xc6, 0xec, 0x00, 0x02, 0x88, 0xa8, 0x08, 0x00, 0xe6, 0x46
+       , 0x60, 0x82, 0x86, 0x8c, 0x6f, 0x7e, 0x00, 0xa5, 0x7e, 0x50, 0xda, 0x07, 0x86, 0x3f, 0x52, 0xaa
+       , 0x07, 0xb6, 0xfc, 0xbf, 0x7c, 0x05, 0xcf, 0x70, 0x41, 0x26, 0x18, 0x41, 0x33, 0x5c, 0xe0, 0x62
+       , 0x1f, 0x58, 0x84, 0x52, 0x12, 0x04, 0x03, 0x0e, 0x80, 0xc5, 0x11, 0x34, 0x27, 0xfc, 0x43, 0x6e
+       , 0xb5, 0xfd, 0x87, 0x0c, 0xfd, 0x31, 0xc2, 0x26, 0x21, 0xc0, 0xb3, 0x9f, 0xe0, 0xf9, 0x06, 0x66
+       , 0x56, 0x56, 0xd8, 0x78, 0x13, 0x64, 0x81, 0x06, 0x7e, 0xf3, 0x01, 0x02, 0x88, 0xa8, 0x08, 0xf8
+       , 0x09, 0x1a, 0xa1, 0x05, 0xf6, 0xb9, 0xbe, 0x7e, 0x82, 0xf4, 0xb9, 0xde, 0x83, 0xaa, 0x5f, 0xe8
+       , 0x84, 0x16, 0xa4, 0xc8, 0x07, 0x91, 0x90, 0xa9, 0x45, 0x50, 0xab, 0x1f, 0xd2, 0xe6, 0x01, 0xf6
+       , 0xb5, 0xc8, 0x18, 0xc9, 0x19, 0x84, 0x00, 0x58, 0x11, 0x03, 0x0b, 0x24, 0x06, 0xc8, 0x10, 0x2c
+       , 0x08, 0x80, 0xc7, 0xbf, 0x61, 0xcb, 0x1f, 0x21, 0xa5, 0x3e, 0x64, 0x70, 0x83, 0x15, 0x3a, 0xc0
+       , 0x04, 0x1a, 0xdf, 0x00, 0xd2, 0xc0, 0x38, 0x21, 0x58, 0x19, 0x00, 0x04, 0x10, 0xe1, 0x08, 0x00
+       , 0x36, 0xdd, 0x41, 0xed, 0x4e, 0x50, 0xf2, 0xff, 0x04, 0x2a, 0xfd, 0x41, 0x4d, 0x7f, 0xe8, 0x48
+       , 0x03, 0xb8, 0xb9, 0x0f, 0x29, 0x75, 0xbe, 0x7e, 0x83, 0x0f, 0x77, 0xc2, 0x06, 0x6f, 0x87, 0x47
+       , 0xe8, 0x43, 0x00, 0xb0, 0x4e, 0x06, 0xe6, 0x03, 0x10, 0x0b, 0x3a, 0xed, 0x00, 0x1d, 0xe2, 0x83
+       , 0x54, 0xba, 0xcc, 0x90, 0xa9, 0x1f, 0x66, 0x16, 0xe8, 0x1a, 0x23, 0xc8, 0xc2, 0x23, 0xf0, 0x92
+       , 0x30, 0x66, 0x16, 0x16, 0x76, 0xbc, 0xf3, 0x68, 0x00, 0x01, 0x44, 0x20, 0x02, 0xc0, 0xd3, 0x5b
+       , 0xdf, 0x21, 0x43, 0x0e, 0xa0, 0x61, 0x7d, 0xf0, 0x58, 0x27, 0xb0, 0x1a, 0x80, 0x84, 0xfc, 0xb7
+       , 0x2f, 0x5f, 0xbe, 0x41, 0xc2, 0x1e, 0x3c, 0xe2, 0x86, 0x98, 0xbb, 0x18, 0x5e, 0xa1, 0x0f, 0x01
+       , 0x40, 0x1f, 0x01, 0xfd, 0xc5, 0x00, 0xa9, 0x7a, 0x99, 0x18, 0x20, 0x4d, 0x4e, 0xf0, 0xfa, 0x17
+       , 0x66, 0xe8, 0xd4, 0x27, 0xb8, 0xfe, 0x05, 0x47, 0x00, 0x3b, 0x08, 0xb1, 0xb2, 0xb1, 0xb2, 0xb3
+       , 0x83, 0xe7, 0x40, 0x59, 0xf0, 0xcc, 0x27, 0x03, 0x04, 0x10, 0x81, 0x08, 0x00, 0x06, 0x27, 0x30
+       , 0x65, 0x83, 0xc7, 0xf9, 0x41, 0xb3, 0x5a, 0xe0, 0xd6, 0xe7, 0x07, 0x48, 0x59, 0xff, 0x0d, 0x5e
+       , 0xde, 0x43, 0x06, 0x1a, 0xc0, 0x83, 0xfc, 0xe0, 0x72, 0xff, 0xe7, 0xf0, 0x0b, 0x7d, 0x08, 0x00
+       , 0xc5, 0xc1, 0xef, 0xdf, 0xf0, 0x66, 0x3f, 0xac, 0xf0, 0x81, 0xa5, 0x7f, 0xf0, 0x18, 0xf7, 0x47
+       , 0x96, 0x8f, 0xec, 0xd0, 0xa5, 0x5e, 0xe0, 0xf9, 0x66, 0xf0, 0xaa, 0x30, 0x2e, 0x4e, 0x9c, 0x05
+       , 0x11, 0x40, 0x00, 0xe1, 0x8b, 0x00, 0x60, 0xfb, 0x05, 0x58, 0x97, 0x02, 0x43, 0xfa, 0x33, 0x64
+       , 0xb4, 0x19, 0x34, 0xaf, 0xf5, 0xf1, 0x1b, 0x0c, 0x7c, 0x87, 0x91, 0xdf, 0x7f, 0x40, 0xdb, 0x9c
+       , 0x90, 0xb9, 0xdd, 0xe1, 0x1a, 0xfa, 0x10, 0x00, 0xec, 0x92, 0x01, 0x9b, 0x46, 0xf0, 0xf9, 0x4e
+       , 0x26, 0xd8, 0xac, 0x3f, 0x64, 0x82, 0x01, 0x32, 0xeb, 0x0f, 0x0c, 0x27, 0xc8, 0xaa, 0x2f, 0x0e
+       , 0x0e, 0xf0, 0xea, 0x47, 0x36, 0x76, 0xf0, 0xfa, 0x3c, 0xec, 0x41, 0x0d, 0x10, 0x40, 0xf8, 0x22
+       , 0xe0, 0xd7, 0x2f, 0xd0, 0x28, 0x3e, 0xa8, 0x6b, 0x0b, 0x2c, 0x7f, 0x40, 0x81, 0xff, 0x09, 0xd8
+       , 0x08, 0x85, 0x34, 0xf1, 0xe1, 0xe1, 0x0e, 0xce, 0x00, 0xa0, 0x0e, 0x2f, 0x64, 0x6e, 0x0b, 0xd8
+       , 0x66, 0xa0, 0x8d, 0xc7, 0x07, 0x11, 0x00, 0xb6, 0xaa, 0xe1, 0xeb, 0xc0, 0x20, 0xcb, 0x20, 0x61
+       , 0xab, 0x5e, 0x58, 0x41, 0x2d, 0x20, 0x70, 0x24, 0x70, 0x7c, 0xe4, 0x04, 0x86, 0x3e, 0x08, 0x73
+       , 0x70, 0xb2, 0x71, 0xb0, 0x83, 0x57, 0x22, 0xf1, 0x60, 0x35, 0x0d, 0x20, 0x80, 0x70, 0x46, 0x00
+       , 0xb0, 0xbc, 0x03, 0x06, 0x2c, 0x78, 0xd8, 0xe7, 0x0b, 0x64, 0x3d, 0x03, 0xb0, 0x08, 0x02, 0x86
+       , 0x36, 0x64, 0x76, 0xeb, 0x1b, 0xa8, 0x5d, 0x04, 0x99, 0x2d, 0xfd, 0x01, 0x5d, 0x53, 0x0b, 0x1e
+       , 0xc1, 0xa5, 0x99, 0xaf, 0x07, 0x17, 0x00, 0xfa, 0x95, 0x89, 0xf1, 0x17, 0xa4, 0xfc, 0x81, 0xac
+       , 0x74, 0x87, 0x2e, 0x04, 0x06, 0xaf, 0xbc, 0x06, 0xd6, 0xc4, 0xc0, 0xf4, 0x0a, 0x5a, 0xf2, 0x05
+       , 0x5e, 0xcc, 0xc2, 0x09, 0xc9, 0x09, 0x60, 0x80, 0x69, 0x14, 0x40, 0x00, 0xe1, 0x88, 0x80, 0xff
+       , 0xff, 0x81, 0x09, 0xfa, 0x3b, 0x64, 0xdc, 0x07, 0x12, 0x01, 0x9f, 0x3e, 0x7f, 0x87, 0x04, 0x39
+       , 0x2c, 0xd9, 0xc3, 0x66, 0x57, 0xc0, 0xbd, 0x2d, 0xf0, 0x38, 0x0f, 0x6d, 0x3d, 0x3d, 0xc8, 0x00
+       , 0xb0, 0x7b, 0xc9, 0xf4, 0xfb, 0x17, 0x13, 0x33, 0x3c, 0x07, 0x80, 0x92, 0x3e, 0x64, 0xed, 0x35
+       , 0x24, 0xac, 0x81, 0xe9, 0x15, 0xbc, 0xda, 0x11, 0x18, 0x07, 0x5c, 0xe0, 0x28, 0xc0, 0xbe, 0xde
+       , 0x14, 0x20, 0x80, 0xb0, 0x47, 0x00, 0x68, 0x46, 0xee, 0x27, 0xb8, 0xfc, 0xf9, 0x0a, 0x2e, 0x81
+       , 0xc0, 0x2b, 0x7b, 0xbe, 0xc3, 0xc1, 0x0f, 0xe8, 0x38, 0xc3, 0xcf, 0x1f, 0x3f, 0xa1, 0x73, 0xd7
+       , 0x7f, 0x7e, 0xff, 0x1f, 0xd6, 0x45, 0x3f, 0x26, 0x00, 0x56, 0x75, 0xbf, 0x7f, 0xfd, 0x61, 0x64
+       , 0xfa, 0xcd, 0xc2, 0xf4, 0x93, 0x05, 0x69, 0xc9, 0x11, 0x3c, 0x06, 0x80, 0x41, 0xc6, 0xcd, 0xfd
+       , 0x99, 0x1b, 0xb4, 0xdc, 0x91, 0x0b, 0xb2, 0xe0, 0x14, 0xb2, 0x08, 0x0c, 0xcd, 0x1c, 0x80, 0x00
+       , 0xc2, 0x16, 0x01, 0xff, 0x19, 0xc0, 0xc9, 0x1f, 0x54, 0xff, 0x42, 0xd3, 0xff, 0xe7, 0xcf, 0x3f
+       , 0x7e, 0x40, 0x92, 0x3d, 0x7c, 0x9d, 0x0c, 0x74, 0x66, 0x11, 0x32, 0x6f, 0xfa, 0xf7, 0xcf, 0xd0
+       , 0xee, 0xee, 0x92, 0x07, 0xfe, 0xfc, 0xfd, 0xc3, 0xf8, 0x9b, 0xf1, 0x17, 0x30, 0x13, 0xfc, 0x04
+       , 0xe7, 0x00, 0x36, 0xd6, 0x1f, 0x3f, 0x20, 0x11, 0xc0, 0xfa, 0x1d, 0xb4, 0xe4, 0x8e, 0x03, 0x18
+       , 0x6e, 0xa0, 0x05, 0x8e, 0x5c, 0x20, 0xf4, 0x9d, 0xf3, 0x3b, 0x3b, 0x27, 0xb0, 0x59, 0x8a, 0x9e
+       , 0x09, 0x00, 0x02, 0x08, 0x4b, 0xfb, 0x14, 0xb4, 0x86, 0xfc, 0xd7, 0x4f, 0x60, 0x58, 0x03, 0x5b
+       , 0xfa, 0xe0, 0xe9, 0x15, 0xd0, 0x70, 0x03, 0xb0, 0x87, 0x0b, 0x5e, 0x3b, 0x0e, 0x2f, 0x75, 0xa0
+       , 0xcb, 0xc7, 0x21, 0xbb, 0x58, 0xe8, 0xe4, 0xe3, 0xc1, 0x07, 0xfe, 0x80, 0xa7, 0x92, 0x21, 0x0b
+       , 0xcb, 0xa0, 0xbb, 0x1c, 0x40, 0x0b, 0x9f, 0x20, 0x8c, 0xef, 0xe0, 0x11, 0x32, 0x50, 0x5f, 0xe9
+       , 0x2b, 0x78, 0x70, 0x0c, 0x54, 0x60, 0x60, 0x84, 0x15, 0x40, 0x00, 0x61, 0x89, 0x00, 0xa0, 0x22
+       , 0x90, 0x21, 0x90, 0x76, 0x26, 0x78, 0xde, 0x11, 0xba, 0xa0, 0xff, 0x07, 0x64, 0x31, 0x09, 0x64
+       , 0x80, 0x19, 0xbc, 0x48, 0x06, 0x9c, 0xfc, 0xff, 0x8d, 0xe0, 0x8d, 0xae, 0xe0, 0xb9, 0xe5, 0xbf
+       , 0xe0, 0xd5, 0xad, 0xe0, 0xe9, 0x3e, 0x48, 0x48, 0xfd, 0xfc, 0x0e, 0x0d, 0xaf, 0x1f, 0x3f, 0xc1
+       , 0xe3, 0x94, 0xa0, 0x28, 0x00, 0xd6, 0xa7, 0x3f, 0xc0, 0xc3, 0xf2, 0x68, 0x26, 0x00, 0x04, 0x10
+       , 0x7a, 0x04, 0x00, 0x8d, 0x03, 0x2f, 0x9c, 0xfa, 0x0e, 0x5e, 0x51, 0x02, 0x9d, 0xdc, 0x02, 0xa7
+       , 0x79, 0xd8, 0xd0, 0x3e, 0xac, 0xd1, 0xf3, 0x0b, 0xb6, 0x64, 0x80, 0x5e, 0x9e, 0x1d, 0xa4, 0x00
+       , 0x1c, 0x08, 0xa0, 0x49, 0x6e, 0xe8, 0xac, 0xd3, 0x2f, 0x70, 0xd9, 0x0c, 0x49, 0xad, 0x3f, 0x7e
+       , 0x7c, 0x85, 0x4e, 0xd1, 0x82, 0xf2, 0x00, 0x30, 0x5e, 0x80, 0xb2, 0x7f, 0x51, 0x43, 0x0c, 0x20
+       , 0x80, 0xd0, 0x23, 0x00, 0x5c, 0xfe, 0xfc, 0x02, 0x16, 0xf5, 0xdf, 0xc0, 0x4b, 0xf9, 0xc1, 0xa1
+       , 0x0f, 0x2e, 0x6f, 0x7e, 0x80, 0xe7, 0xd3, 0x61, 0x4b, 0xc9, 0x41, 0x6b, 0x36, 0x40, 0xb6, 0x8e
+       , 0xc4, 0xa2, 0x1f, 0x13, 0x80, 0x16, 0x53, 0x82, 0x83, 0x04, 0x92, 0x0b, 0xc0, 0x39, 0xe1, 0x27
+       , 0xac, 0x67, 0xfa, 0x0b, 0x31, 0x48, 0x0c, 0xd9, 0xfd, 0x83, 0x5a, 0x0a, 0x01, 0x04, 0x10, 0x4a
+       , 0x04, 0x40, 0x66, 0x21, 0x7e, 0x41, 0x1a, 0xa0, 0x60, 0x00, 0x8c, 0x38, 0x70, 0xc4, 0x82, 0x0c
+       , 0x83, 0xec, 0xdd, 0x82, 0xad, 0xe4, 0xff, 0x0d, 0x5e, 0x42, 0x38, 0xd2, 0x93, 0x3f, 0x04, 0xfc
+       , 0x85, 0xae, 0x6b, 0xf9, 0x0d, 0x59, 0xe4, 0x0a, 0xdb, 0xf1, 0x00, 0x59, 0x7f, 0xfc, 0x13, 0xba
+       , 0xd4, 0x17, 0x1c, 0x01, 0x40, 0x2e, 0x50, 0x19, 0xf2, 0xe6, 0x2a, 0x80, 0x00, 0x42, 0x89, 0x00
+       , 0x70, 0x5f, 0xea, 0x17, 0xa4, 0xa5, 0x03, 0x89, 0x03, 0xd0, 0x5a, 0xc9, 0x9f, 0xd0, 0x65, 0x9c
+       , 0xbf, 0x21, 0x4b, 0x09, 0xe1, 0x8b, 0x4a, 0x46, 0x64, 0xcb, 0x07, 0x17, 0x80, 0x2c, 0x2e, 0xfb
+       , 0xfd, 0x0b, 0xba, 0xae, 0x0e, 0x52, 0x5c, 0x80, 0x96, 0x96, 0x82, 0x56, 0xe1, 0xff, 0x02, 0xd5
+       , 0x01, 0xdf, 0x20, 0x03, 0xc5, 0x3f, 0x20, 0x8b, 0x01, 0xe1, 0x1a, 0x01, 0x02, 0x88, 0x09, 0xd5
+       , 0x14, 0x90, 0x09, 0x60, 0x3d, 0xd0, 0xe1, 0x86, 0x9f, 0x30, 0xe3, 0xc0, 0x85, 0x3e, 0xb4, 0xc3
+       , 0x05, 0x5b, 0x3c, 0x3e, 0x9a, 0xfc, 0x11, 0x00, 0xb4, 0x92, 0xe2, 0x37, 0x74, 0x95, 0x25, 0xb8
+       , 0x59, 0xf4, 0x1b, 0xba, 0xe8, 0x1e, 0x5c, 0x2b, 0x40, 0x36, 0xc2, 0x41, 0xd6, 0x27, 0xfc, 0x44
+       , 0x2d, 0x85, 0x00, 0x02, 0x08, 0x11, 0x01, 0xff, 0xc0, 0xbb, 0x18, 0x7f, 0x42, 0xab, 0x60, 0xc8
+       , 0x00, 0xdb, 0x77, 0x48, 0x44, 0xfe, 0x86, 0x6d, 0xd9, 0x85, 0xac, 0x61, 0x1e, 0xad, 0x7b, 0xb1
+       , 0x02, 0xd0, 0xd2, 0x45, 0xe8, 0xee, 0x9e, 0x5f, 0xb0, 0xac, 0x00, 0x2e, 0x37, 0x80, 0x09, 0xfa
+       , 0x1b, 0xa4, 0x0f, 0x05, 0xde, 0x12, 0xf1, 0xeb, 0x27, 0x50, 0x01, 0xbc, 0xe9, 0x08, 0x10, 0x40
+       , 0x88, 0x08, 0x00, 0x45, 0xe1, 0x6f, 0x68, 0xde, 0x81, 0xf4, 0xb6, 0x60, 0xab, 0x37, 0x21, 0xc5
+       , 0xfe, 0xaf, 0x3f, 0xa0, 0xf5, 0x54, 0xbf, 0x20, 0x6b, 0xb3, 0x87, 0xf7, 0x90, 0x27, 0x79, 0xe0
+       , 0x1f, 0x78, 0x41, 0xfd, 0x1f, 0x70, 0x18, 0x41, 0x0a, 0xf3, 0x5f, 0xf0, 0xb8, 0x80, 0x14, 0xec
+       , 0x90, 0xf1, 0x1b, 0xd0, 0xba, 0xd8, 0x3f, 0xff, 0x60, 0x29, 0x18, 0x20, 0x80, 0x10, 0x11, 0x00
+       , 0x0e, 0xff, 0xdf, 0xd0, 0xba, 0xe3, 0x07, 0xa8, 0x27, 0x0c, 0x5d, 0xbe, 0x09, 0x69, 0xef, 0x40
+       , 0xb7, 0xaf, 0x40, 0x57, 0xec, 0x8d, 0x46, 0x00, 0x26, 0xf8, 0xf7, 0xff, 0x1f, 0x6c, 0x37, 0x39
+       , 0x28, 0xb4, 0xa0, 0x1b, 0x7f, 0x60, 0xcb, 0x7c, 0xbf, 0xc3, 0x67, 0xab, 0x7e, 0x42, 0xc2, 0x14
+       , 0x1a, 0x01, 0x00, 0x01, 0x84, 0x94, 0x03, 0x20, 0x91, 0x06, 0xae, 0x37, 0xc0, 0xbd, 0xad, 0xef
+       , 0xbf, 0x7f, 0x23, 0x0a, 0x1f, 0xe8, 0x6a, 0xc9, 0xdf, 0xd0, 0xc5, 0xfb, 0x03, 0xe4, 0xc7, 0xc1
+       , 0x0e, 0x40, 0x4b, 0xe9, 0x20, 0x5b, 0x0b, 0xa1, 0x1b, 0x1e, 0xa0, 0x6b, 0x7c, 0xc1, 0x87, 0x31
+       , 0x20, 0x76, 0xda, 0x40, 0xd6, 0x66, 0x42, 0xb4, 0x00, 0x04, 0x10, 0x34, 0x02, 0x40, 0xf3, 0x0c
+       , 0x7f, 0xc0, 0x6d, 0xd9, 0x9f, 0xbf, 0x7f, 0xfd, 0x84, 0xad, 0x22, 0x04, 0x17, 0xf8, 0xb0, 0x3d
+       , 0xa3, 0x90, 0xdd, 0x13, 0xbf, 0x21, 0x8b, 0x24, 0x07, 0xce, 0x8f, 0x83, 0x1a, 0xfc, 0x83, 0xc4
+       , 0xc0, 0x6f, 0x68, 0x7d, 0x0c, 0x5b, 0x69, 0x0d, 0xdd, 0x62, 0x00, 0x69, 0xe2, 0x83, 0x82, 0x18
+       , 0x1a, 0x98, 0xa0, 0x60, 0x04, 0x08, 0x20, 0x68, 0x04, 0x80, 0x34, 0x82, 0xc3, 0x1b, 0xd2, 0x9f
+       , 0x06, 0x45, 0x00, 0xec, 0x00, 0x13, 0xc4, 0x02, 0x6d, 0xd8, 0x8e, 0xd1, 0xd1, 0x43, 0xb6, 0x70
+       , 0x01, 0xc8, 0xfa, 0x2d, 0xf0, 0xda, 0xd2, 0xbf, 0xe0, 0x63, 0x77, 0xfe, 0xc2, 0xb7, 0x3c, 0x03
+       , 0xc3, 0x12, 0x36, 0x82, 0xf6, 0xeb, 0xf7, 0x2f, 0xe8, 0x36, 0x74, 0xa0, 0x16, 0x80, 0x00, 0x82
+       , 0x45, 0x00, 0xf8, 0x5c, 0x1e, 0x48, 0x91, 0x03, 0xe9, 0x52, 0xff, 0x85, 0xec, 0x15, 0xfd, 0x0d
+       , 0xdd, 0x2f, 0x8d, 0x7c, 0x54, 0xc9, 0x80, 0xfa, 0x71, 0xb0, 0x03, 0xf8, 0xb9, 0x16, 0xe0, 0x50
+       , 0x03, 0x57, 0xac, 0xd0, 0x9a, 0x01, 0x7c, 0x04, 0x0c, 0x64, 0x9f, 0x13, 0x58, 0xec, 0x1f, 0xb8
+       , 0x24, 0x07, 0x08, 0x20, 0x68, 0x04, 0xfc, 0x81, 0x86, 0xf5, 0x6f, 0xc8, 0xd6, 0x09, 0xd8, 0xce
+       , 0x21, 0xc8, 0xee, 0x09, 0xd8, 0x69, 0x49, 0x90, 0x55, 0xd9, 0xa3, 0x11, 0x80, 0x17, 0x40, 0x8e
+       , 0xf5, 0x82, 0xef, 0xf2, 0x04, 0xe7, 0x05, 0xe8, 0x16, 0x9b, 0x9f, 0xb0, 0x5d, 0x29, 0xd0, 0xc0
+       , 0x05, 0x2f, 0x59, 0x03, 0x08, 0x20, 0x50, 0x04, 0x80, 0x32, 0xce, 0x5f, 0x70, 0x0e, 0x00, 0x8d
+       , 0x69, 0x80, 0xca, 0x21, 0xc8, 0x86, 0x04, 0x78, 0xd8, 0xff, 0x81, 0x2e, 0x90, 0x07, 0x1f, 0x15
+       , 0x33, 0x1a, 0x01, 0x78, 0x01, 0x28, 0xfc, 0xff, 0x43, 0xf2, 0x00, 0x24, 0x0a, 0x60, 0x61, 0x09
+       , 0xa9, 0x9e, 0xc1, 0x6d, 0x23, 0x48, 0xd2, 0xfe, 0xf7, 0x07, 0xb4, 0xdf, 0x1f, 0x20, 0x80, 0x20
+       , 0x11, 0x00, 0x8d, 0x33, 0x68, 0x2f, 0x02, 0xdc, 0xd1, 0xfd, 0x0b, 0xdd, 0x99, 0xf0, 0xef, 0x2f
+       , 0x52, 0xea, 0x07, 0x2d, 0xd2, 0x1e, 0x68, 0x1f, 0x0e, 0x7e, 0x00, 0x89, 0x01, 0x10, 0xf8, 0xf3
+       , 0xef, 0x2f, 0x3c, 0x13, 0x80, 0xe3, 0x01, 0xd2, 0x45, 0x80, 0x6c, 0x85, 0x86, 0x24, 0x68, 0x80
+       , 0x00, 0x02, 0x45, 0xc0, 0x3f, 0x78, 0x7c, 0xfd, 0x81, 0x56, 0x19, 0xe0, 0x9d, 0x09, 0x7f, 0x61
+       , 0x25, 0xcf, 0xdf, 0x7f, 0x14, 0x6c, 0x1a, 0x1d, 0x81, 0xe0, 0x3f, 0xe4, 0x48, 0x8b, 0x7f, 0x88
+       , 0xad, 0x35, 0xd0, 0xd3, 0x8e, 0xfe, 0xfe, 0x45, 0x6a, 0xd0, 0x80, 0x02, 0x17, 0xa8, 0x10, 0x20
+       , 0x80, 0x40, 0x11, 0x00, 0x39, 0x83, 0x0d, 0xda, 0x82, 0x85, 0xed, 0x46, 0xfb, 0x0f, 0x2b, 0x73
+       , 0xfe, 0x41, 0x4b, 0xb5, 0xbf, 0xd0, 0x0d, 0x69, 0xa3, 0x80, 0x10, 0x80, 0x1c, 0x66, 0x81, 0x48
+       , 0xb3, 0x90, 0x28, 0x00, 0x85, 0xe8, 0xbf, 0x3f, 0xc8, 0xc1, 0x0f, 0x0e, 0x53, 0x80, 0x00, 0x02
+       , 0x17, 0x41, 0xd0, 0xd3, 0xa8, 0xfe, 0x82, 0x8f, 0xc5, 0x03, 0xe5, 0x15, 0xa8, 0x2e, 0xf0, 0xee
+       , 0x5a, 0xf8, 0x09, 0x31, 0xff, 0x50, 0x0f, 0xa9, 0x1a, 0x05, 0xb8, 0x00, 0x74, 0x2f, 0xc1, 0xdf
+       , 0xff, 0xd0, 0xa4, 0x0b, 0x0d, 0xdd, 0x3f, 0xc0, 0x92, 0xfe, 0xcf, 0x1f, 0x78, 0xc9, 0xfe, 0x0f
+       , 0x52, 0xa1, 0x02, 0x04, 0x10, 0xb8, 0x08, 0x02, 0xe7, 0x19, 0x58, 0x69, 0x03, 0x3e, 0x25, 0xe0
+       , 0x3f, 0x54, 0x33, 0xf4, 0x74, 0x3c, 0xc8, 0x1a, 0x79, 0xd8, 0x71, 0xa9, 0xa3, 0x00, 0x3f, 0x80
+       , 0x6d, 0x61, 0x42, 0x3a, 0xe0, 0x0b, 0xb6, 0xb7, 0xef, 0x2f, 0xfc, 0x04, 0x4e, 0x48, 0xe0, 0xfe
+       , 0xfb, 0x0f, 0x10, 0x40, 0xe0, 0x66, 0x28, 0xf4, 0x10, 0x0c, 0x68, 0x2c, 0x80, 0x25, 0x80, 0xbd
+       , 0x34, 0x48, 0xe0, 0x43, 0xf6, 0x25, 0x80, 0x63, 0x93, 0x61, 0x34, 0xfc, 0x89, 0x02, 0x28, 0xdb
+       , 0x69, 0xe0, 0x87, 0x4b, 0xfd, 0x87, 0x6e, 0x77, 0xfa, 0x0f, 0xa9, 0x13, 0xa0, 0x27, 0xaf, 0xfd
+       , 0x03, 0x08, 0x20, 0x48, 0x25, 0x0c, 0x29, 0xb3, 0xfe, 0x83, 0xcb, 0x79, 0xd8, 0xc9, 0xb4, 0xff
+       , 0xa0, 0x14, 0xf8, 0xa0, 0x60, 0xc8, 0xe9, 0x84, 0xff, 0xe9, 0xbc, 0x9d, 0x7a, 0xe8, 0x02, 0xe8
+       , 0x26, 0x4a, 0xe8, 0x29, 0x3b, 0x88, 0x6d, 0x4e, 0xb0, 0x62, 0x05, 0x7a, 0xd4, 0x04, 0x50, 0x08
+       , 0x20, 0x80, 0xa0, 0xfd, 0x80, 0xff, 0xb0, 0xc3, 0x60, 0xa0, 0xb1, 0xc4, 0x00, 0xdf, 0x0b, 0xf5
+       , 0x1f, 0x1a, 0xf6, 0xa3, 0xe5, 0x3f, 0x49, 0x00, 0x11, 0x60, 0xff, 0xa0, 0x47, 0x5d, 0xc3, 0xc2
+       , 0xf3, 0x1f, 0xd2, 0xb9, 0x2f, 0x40, 0x00, 0x10, 0x40, 0x4c, 0x30, 0xd5, 0xf0, 0xd0, 0x06, 0x1f
+       , 0x83, 0xf4, 0x0f, 0x23, 0xec, 0xff, 0x8f, 0xb6, 0x80, 0x48, 0x05, 0xe0, 0x8d, 0x65, 0xff, 0x91
+       , 0xea, 0x04, 0xa8, 0x30, 0x4a, 0x80, 0x02, 0x04, 0x10, 0x38, 0x07, 0x80, 0x16, 0x6b, 0x41, 0xf3
+       , 0x0c, 0xa8, 0xb4, 0x81, 0x6d, 0xc2, 0x84, 0x9d, 0x0b, 0x06, 0x3b, 0x9a, 0x90, 0x71, 0x34, 0x06
+       , 0x88, 0x05, 0xe0, 0x30, 0x86, 0x84, 0x17, 0x34, 0x23, 0x80, 0xcb, 0x6f, 0x44, 0xca, 0x87, 0xd4
+       , 0xa7, 0xc0, 0xe0, 0x05, 0x08, 0x20, 0xc8, 0x58, 0x10, 0x2c, 0xfd, 0x83, 0x16, 0x5d, 0xff, 0x87
+       , 0x10, 0xd8, 0xcc, 0xa4, 0xa3, 0x0f, 0x86, 0x3c, 0x80, 0xa6, 0x69, 0x44, 0x48, 0x32, 0xfe, 0x87
+       , 0x09, 0x83, 0x12, 0xfc, 0x7f, 0x46, 0x70, 0x9a, 0xfe, 0xcf, 0x00, 0x10, 0x40, 0x4c, 0x08, 0xf5
+       , 0xe0, 0xf3, 0x1f, 0xc1, 0x2a, 0xc1, 0xd9, 0x86, 0x11, 0xd9, 0x2c, 0xc8, 0xde, 0xa8, 0x51, 0x40
+       , 0x2c, 0x00, 0x27, 0x61, 0xd4, 0x00, 0x03, 0x05, 0x28, 0x38, 0xe0, 0x61, 0x61, 0x09, 0x8e, 0x02
+       , 0x06, 0x80, 0x00, 0x02, 0x47, 0x00, 0x23, 0xe4, 0x58, 0x29, 0x88, 0x04, 0x13, 0x64, 0xf7, 0x31
+       , 0x23, 0x2c, 0x52, 0x60, 0xb1, 0x82, 0x6e, 0xe0, 0x28, 0xc0, 0x0b, 0x18, 0x61, 0x49, 0x1e, 0xbc
+       , 0x9f, 0x95, 0x11, 0x7a, 0xb4, 0x20, 0x78, 0x6b, 0x2b, 0x13, 0x94, 0x05, 0x62, 0x30, 0x02, 0x04
+       , 0x10, 0x94, 0x83, 0x38, 0x77, 0x13, 0x92, 0xdc, 0x99, 0xa0, 0xa7, 0xc1, 0x33, 0x42, 0x99, 0x20
+       , 0xf6, 0x68, 0x0c, 0x90, 0x04, 0xc0, 0xc1, 0xc7, 0x08, 0x0b, 0x5c, 0xc8, 0x69, 0x06, 0xb0, 0xcd
+       , 0xf5, 0xa0, 0x42, 0x1e, 0x7a, 0xed, 0x01, 0x40, 0x00, 0x81, 0x22, 0x80, 0x09, 0x16, 0xf6, 0xf0
+       , 0xa3, 0x0e, 0x18, 0x61, 0xb1, 0xc2, 0xc8, 0x04, 0xdb, 0x8d, 0xc3, 0xc0, 0x38, 0x80, 0x87, 0xec
+       , 0x0f, 0x3d, 0x80, 0x48, 0xf7, 0xa0, 0x42, 0x85, 0x89, 0x89, 0x81, 0x11, 0x76, 0xbe, 0x38, 0x64
+       , 0x6b, 0x31, 0xfc, 0x84, 0x59, 0x80, 0x00, 0x02, 0xe7, 0x00, 0xf8, 0x59, 0xa7, 0xcc, 0x90, 0xa3
+       , 0x97, 0x19, 0xa1, 0x18, 0xa2, 0x11, 0xa6, 0x14, 0x62, 0xee, 0xc0, 0xfa, 0x6b, 0xa8, 0x00, 0x26
+       , 0xc4, 0x95, 0x2a, 0x48, 0xa7, 0xa9, 0x00, 0xc3, 0x17, 0x92, 0xc0, 0x99, 0x19, 0x21, 0x27, 0x5c
+       , 0x03, 0x05, 0x01, 0x02, 0x08, 0x52, 0x07, 0x20, 0x0e, 0x5b, 0x66, 0x86, 0xc9, 0x43, 0xe3, 0x08
+       , 0xb2, 0x17, 0x16, 0x16, 0x2b, 0x03, 0x7f, 0xe3, 0xc7, 0x50, 0x00, 0x8c, 0x8c, 0xb0, 0xd4, 0xcd
+       , 0x08, 0xbe, 0xc9, 0x06, 0x12, 0x78, 0x90, 0x53, 0xc5, 0xc1, 0x5b, 0x5a, 0x99, 0xa0, 0xc7, 0xbb
+       , 0x83, 0xc2, 0x15, 0x20, 0x80, 0xc0, 0x45, 0x10, 0x23, 0xe4, 0x94, 0x5f, 0xd8, 0x79, 0xef, 0xcc
+       , 0x4c, 0x30, 0x15, 0x70, 0x65, 0xd0, 0x18, 0x61, 0x18, 0x8d, 0x02, 0x22, 0x00, 0xa4, 0xe6, 0x44
+       , 0x94, 0x34, 0x4c, 0x88, 0x62, 0x87, 0x99, 0x89, 0x05, 0xbc, 0x6d, 0x1b, 0x72, 0xb4, 0x0a, 0x28
+       , 0x43, 0x00, 0x04, 0x10, 0x38, 0x02, 0x60, 0xb7, 0x4e, 0x80, 0xa5, 0xc1, 0x47, 0xbd, 0x33, 0x31
+       , 0xc2, 0x22, 0x01, 0x1a, 0x13, 0xb0, 0x93, 0x41, 0x46, 0x8b, 0x20, 0xc2, 0x00, 0x72, 0x70, 0x2f
+       , 0x13, 0xec, 0x3a, 0x0f, 0xf8, 0x66, 0x62, 0xd0, 0xe1, 0xbd, 0xa0, 0xb3, 0x54, 0x58, 0x20, 0x29
+       , 0x1d, 0x92, 0xa6, 0x01, 0x02, 0x08, 0x9a, 0x03, 0x20, 0x19, 0x03, 0xb1, 0xdf, 0x12, 0x1c, 0x4d
+       , 0x90, 0x33, 0x10, 0xe0, 0x65, 0x13, 0x33, 0xe4, 0x7e, 0xae, 0x51, 0x40, 0x08, 0xc0, 0xca, 0x0d
+       , 0xa4, 0x32, 0x9d, 0x09, 0x1a, 0x9c, 0xe0, 0x04, 0x0e, 0x39, 0xca, 0x1d, 0x12, 0xb6, 0x8c, 0x00
+       , 0x01, 0x04, 0x8e, 0x00, 0x70, 0xf4, 0x40, 0x64, 0x20, 0x47, 0xad, 0x30, 0xc1, 0xee, 0xdc, 0x62
+       , 0x86, 0xdd, 0x89, 0x03, 0x2b, 0xb1, 0x46, 0x8b, 0x20, 0xc2, 0x00, 0x71, 0x80, 0x0a, 0xa8, 0xfc
+       , 0x07, 0x97, 0x28, 0x48, 0xc7, 0x19, 0x40, 0x6e, 0x91, 0x80, 0x5e, 0xad, 0xc2, 0xc8, 0x04, 0x10
+       , 0x40, 0x90, 0x56, 0x10, 0x23, 0xe2, 0x74, 0x71, 0xf0, 0x79, 0xca, 0xf0, 0xfb, 0xb7, 0xa0, 0xea
+       , 0x20, 0x87, 0xc0, 0x43, 0x1a, 0xa8, 0xa3, 0x79, 0x80, 0x10, 0x60, 0x42, 0xbe, 0x43, 0x05, 0x92
+       , 0x8c, 0x61, 0xfb, 0xb9, 0xe1, 0xd7, 0x35, 0x41, 0xaa, 0x5a, 0x60, 0xb8, 0x03, 0x04, 0x10, 0x38
+       , 0x02, 0x40, 0x0d, 0x51, 0x58, 0xe8, 0x83, 0xf7, 0xba, 0xc2, 0xee, 0xbe, 0x81, 0xc4, 0x03, 0x14
+       , 0x30, 0xc2, 0xca, 0xad, 0x81, 0xf6, 0xe0, 0xa0, 0x06, 0x4c, 0xe0, 0xd3, 0x9b, 0x18, 0x11, 0xc1
+       , 0x06, 0x0a, 0x43, 0x56, 0x48, 0xb9, 0xc3, 0xcc, 0x0c, 0x3a, 0x24, 0x19, 0x7a, 0x79, 0x19, 0x48
+       , 0x02, 0x98, 0x98, 0x01, 0x02, 0x08, 0x1a, 0x9a, 0x90, 0xf4, 0xcf, 0x06, 0x3e, 0x54, 0x02, 0x84
+       , 0xd8, 0x59, 0x99, 0x21, 0x07, 0x0f, 0xc1, 0xaf, 0xe3, 0x82, 0x34, 0x8f, 0x98, 0x07, 0xdd, 0x55
+       , 0x80, 0x83, 0x0d, 0x30, 0x22, 0x1f, 0xe0, 0x01, 0x4d, 0xf7, 0x90, 0xd0, 0x65, 0x06, 0x5f, 0x92
+       , 0xc5, 0x0e, 0xbd, 0xc6, 0x83, 0x99, 0x15, 0xa8, 0x0a, 0xa8, 0x1e, 0x20, 0x80, 0xa0, 0xa1, 0x09
+       , 0xcc, 0x28, 0xe0, 0x20, 0x07, 0xef, 0x32, 0x06, 0xdf, 0x68, 0x00, 0x3d, 0x6c, 0x1f, 0x7a, 0x0b
+       , 0x20, 0xbc, 0xd4, 0x62, 0xa2, 0xd1, 0x55, 0x2a, 0xc3, 0x06, 0xb0, 0x80, 0x23, 0x80, 0x05, 0x1e
+       , 0xfc, 0xa0, 0x23, 0xcc, 0x58, 0x21, 0xe5, 0x3e, 0xf8, 0xc0, 0x08, 0x50, 0xe2, 0x86, 0x1c, 0xe8
+       , 0xc1, 0x02, 0x3e, 0x5e, 0x14, 0x20, 0x80, 0x10, 0x39, 0x00, 0x52, 0xff, 0x02, 0x63, 0x08, 0x08
+       , 0x81, 0x80, 0x05, 0xae, 0x0f, 0x9a, 0x5f, 0x58, 0xc1, 0x87, 0xa0, 0x81, 0xf0, 0x68, 0x63, 0x14
+       , 0x17, 0x60, 0x84, 0x1e, 0xdf, 0x07, 0xbb, 0xa7, 0x00, 0x76, 0x4c, 0x3e, 0xf8, 0xec, 0x2c, 0x56
+       , 0xc8, 0x11, 0x42, 0xa0, 0x04, 0xce, 0x06, 0xa9, 0x87, 0x41, 0x11, 0x00, 0x10, 0x40, 0xd0, 0x08
+       , 0x00, 0xf5, 0x10, 0xa0, 0x47, 0x1d, 0x40, 0xef, 0x54, 0x81, 0x9c, 0x7c, 0x06, 0x12, 0x04, 0xdf
+       , 0x7d, 0xc3, 0x0a, 0xa9, 0x42, 0xa0, 0xb9, 0x60, 0x34, 0x13, 0x60, 0x07, 0x90, 0xa3, 0xf1, 0x21
+       , 0xa7, 0xb2, 0x43, 0xc3, 0x1d, 0x56, 0xe4, 0x83, 0x0e, 0x6e, 0x02, 0x5f, 0x11, 0xc7, 0x0a, 0x3a
+       , 0x45, 0x0b, 0x58, 0x15, 0x40, 0x8f, 0xd1, 0x02, 0x08, 0x20, 0x44, 0x50, 0x82, 0x4f, 0x5b, 0x01
+       , 0x1f, 0x77, 0x06, 0xba, 0x60, 0x0e, 0x74, 0xe4, 0x13, 0xec, 0xa6, 0x15, 0x48, 0x5e, 0x60, 0x05
+       , 0x1f, 0x42, 0x07, 0xad, 0x0d, 0x06, 0xce, 0x8f, 0x83, 0x1a, 0xc0, 0xcf, 0x0e, 0x42, 0xbd, 0x32
+       , 0x0b, 0x7c, 0x95, 0x22, 0x27, 0xe4, 0xc4, 0x14, 0x76, 0xc8, 0xad, 0x8a, 0xf0, 0x23, 0xa6, 0x01
+       , 0x02, 0x08, 0x39, 0x02, 0xa0, 0xf7, 0xfd, 0x41, 0x2e, 0x56, 0xe4, 0x00, 0xdd, 0xda, 0x04, 0xbd
+       , 0x71, 0x0b, 0x7a, 0xe7, 0x28, 0x88, 0x64, 0x86, 0x5c, 0xcc, 0xcb, 0x34, 0xa8, 0x2f, 0x49, 0x1e
+       , 0x18, 0x00, 0x2d, 0x7e, 0x60, 0x07, 0x07, 0x41, 0x5a, 0x33, 0xf0, 0x1b, 0xb3, 0xc0, 0xc7, 0x37
+       , 0x71, 0xb0, 0x71, 0x80, 0x0f, 0x94, 0x43, 0xba, 0x38, 0x14, 0x20, 0x80, 0x10, 0x11, 0x00, 0xaa
+       , 0x73, 0xc1, 0xa7, 0xfd, 0x01, 0x63, 0x00, 0x7c, 0xcc, 0x10, 0x27, 0xec, 0xf8, 0x1b, 0x70, 0xbe
+       , 0x80, 0x34, 0x60, 0x61, 0xf5, 0x02, 0x33, 0x89, 0x67, 0x84, 0x8f, 0x04, 0x00, 0x6f, 0xf7, 0xb0
+       , 0xb2, 0x42, 0x1b, 0x9b, 0xb0, 0x23, 0x14, 0x41, 0x81, 0x08, 0xbe, 0x01, 0x0b, 0x7c, 0x76, 0x13
+       , 0x1b, 0x1b, 0xa4, 0x42, 0x85, 0xe8, 0x02, 0x08, 0x20, 0x44, 0x04, 0x00, 0xcb, 0x2f, 0xc8, 0x05
+       , 0x73, 0xe0, 0x5b, 0x46, 0x39, 0x39, 0x20, 0x47, 0xdc, 0x80, 0x0e, 0x3c, 0x83, 0xd6, 0x1b, 0xb0
+       , 0x38, 0x00, 0xd9, 0x01, 0x1e, 0xa8, 0x1e, 0x20, 0x8f, 0x0e, 0x52, 0xc0, 0xc8, 0x82, 0x28, 0x76
+       , 0x58, 0xc0, 0x37, 0xc4, 0x41, 0xd3, 0x2f, 0x90, 0xe6, 0xe0, 0x84, 0x5d, 0x19, 0xca, 0x06, 0x2e
+       , 0x87, 0xd8, 0x58, 0xe1, 0x23, 0xcb, 0x00, 0x01, 0x84, 0x52, 0x9d, 0xb2, 0x82, 0x0e, 0xb9, 0x84
+       , 0x96, 0x3f, 0xa0, 0x83, 0x9e, 0xb8, 0x38, 0x21, 0x47, 0xce, 0x41, 0x2e, 0xdd, 0x85, 0x46, 0x27
+       , 0xf8, 0x1e, 0x34, 0xf0, 0x11, 0xb1, 0xa3, 0x99, 0x00, 0x01, 0x90, 0x92, 0x3f, 0xa4, 0xe8, 0x81
+       , 0x26, 0x7c, 0x76, 0xf0, 0xf1, 0x4d, 0x90, 0x23, 0x9b, 0xc0, 0x47, 0xc8, 0x81, 0x02, 0x12, 0xf9
+       , 0xce, 0x19, 0x80, 0x00, 0x42, 0x89, 0x00, 0x70, 0x19, 0xc4, 0x0a, 0x8e, 0x2e, 0x48, 0x04, 0x70
+       , 0x71, 0x80, 0x63, 0x80, 0x1d, 0x12, 0x9d, 0xa0, 0xe3, 0x86, 0xd8, 0xa1, 0xb7, 0x1f, 0xc3, 0x5a
+       , 0x51, 0xa3, 0x00, 0x02, 0xc0, 0xa1, 0x0f, 0xbf, 0x9e, 0x0f, 0x72, 0x37, 0x1f, 0xa8, 0x42, 0x05
+       , 0xa6, 0x78, 0x60, 0xb0, 0x83, 0x2f, 0x07, 0x85, 0x64, 0x01, 0x0e, 0x48, 0x2a, 0x86, 0x6b, 0x04
+       , 0x08, 0x20, 0x94, 0x08, 0x60, 0x62, 0x64, 0x04, 0xdf, 0xa9, 0x05, 0xaa, 0x31, 0x40, 0xc1, 0x0f
+       , 0xbe, 0x5c, 0x14, 0xda, 0x7a, 0x05, 0x9a, 0xc3, 0x06, 0x0f, 0x7e, 0x36, 0x78, 0x5d, 0x40, 0x77
+       , 0x9f, 0x0e, 0x46, 0x00, 0x6d, 0xf9, 0x80, 0xd3, 0x3c, 0xa4, 0xe0, 0xe1, 0x80, 0x84, 0x22, 0x38
+       , 0x22, 0xc0, 0x37, 0xb4, 0x72, 0x81, 0xef, 0xcd, 0xe5, 0x04, 0x0a, 0x02, 0xa3, 0x08, 0xb9, 0x23
+       , 0x05, 0x10, 0x40, 0xe8, 0x2d, 0x7a, 0x16, 0xf0, 0x59, 0x5b, 0xa0, 0x4b, 0x44, 0xa1, 0x37, 0xbc
+       , 0x72, 0x83, 0x8b, 0x24, 0x76, 0xf0, 0xf5, 0xba, 0x1c, 0x88, 0x92, 0x0d, 0x54, 0x10, 0xb1, 0x01
+       , 0xab, 0x6d, 0xfa, 0xfa, 0x74, 0x90, 0x02, 0x48, 0x03, 0x91, 0x15, 0x7a, 0x5a, 0x1f, 0xa4, 0x2f
+       , 0x05, 0xbe, 0xae, 0x1b, 0xd4, 0xf2, 0xe4, 0x00, 0x5f, 0x90, 0xcb, 0x0d, 0x39, 0x39, 0x8e, 0x1d
+       , 0x7c, 0x96, 0x2e, 0xb2, 0x5e, 0x80, 0x00, 0xc2, 0x88, 0x00, 0x66, 0x66, 0x50, 0xa5, 0x01, 0xae
+       , 0xb1, 0x81, 0xe1, 0xcf, 0x0b, 0xba, 0xda, 0x95, 0x1b, 0x1c, 0x05, 0x10, 0x13, 0xc1, 0x14, 0xe4
+       , 0xfa, 0x3f, 0x36, 0x68, 0x73, 0x97, 0x8e, 0x3e, 0x1d, 0x8c, 0x00, 0x16, 0xfa, 0xac, 0x90, 0x12
+       , 0x9a, 0x1d, 0x1c, 0xec, 0x90, 0x9b, 0xd2, 0x81, 0x80, 0x07, 0x72, 0x4f, 0x2e, 0x17, 0x27, 0xb8
+       , 0x6f, 0xc5, 0x01, 0x1a, 0x0a, 0x42, 0x0d, 0x31, 0x80, 0x00, 0xc2, 0xd2, 0xa7, 0x05, 0x9f, 0x79
+       , 0x0c, 0x29, 0x83, 0xb8, 0x21, 0x97, 0xec, 0x42, 0x62, 0x92, 0x13, 0x1a, 0x09, 0xe0, 0xac, 0xc0
+       , 0x0e, 0x1e, 0xd4, 0x60, 0x03, 0xd9, 0x3c, 0x92, 0x27, 0x09, 0x80, 0x8d, 0x19, 0xf0, 0x81, 0xf5
+       , 0x6c, 0x90, 0x31, 0x06, 0x68, 0xb8, 0x73, 0xb0, 0x43, 0x2e, 0xed, 0x06, 0x06, 0x1b, 0x0f, 0x30
+       , 0xfd, 0x72, 0x83, 0x02, 0x92, 0x0b, 0x74, 0xfd, 0x24, 0xf8, 0xe4, 0x4a, 0x54, 0x00, 0x10, 0x40
+       , 0x58, 0xd2, 0x2f, 0x2b, 0xf8, 0xf6, 0x75, 0xf0, 0x55, 0xd3, 0x5c, 0xc0, 0xf0, 0xe7, 0xe5, 0xe1
+       , 0xf9, 0x02, 0xba, 0x80, 0xf6, 0xc7, 0x8f, 0x9f, 0x1c, 0xe0, 0x6b, 0x16, 0x39, 0xa0, 0x27, 0x66
+       , 0x21, 0x5d, 0x69, 0xf6, 0xfb, 0x17, 0xfa, 0x51, 0x68, 0x23, 0x04, 0x40, 0x5b, 0x9c, 0xa0, 0x24
+       , 0xcb, 0x06, 0x09, 0x7e, 0xd0, 0x81, 0xb9, 0xec, 0x90, 0xea, 0x96, 0x83, 0x1b, 0x7c, 0x43, 0x31
+       , 0x0f, 0x38, 0x17, 0x70, 0x82, 0xd3, 0x2f, 0x2b, 0xc6, 0xb1, 0x95, 0x00, 0x01, 0x84, 0x25, 0x02
+       , 0x80, 0x15, 0x04, 0xc8, 0x34, 0x60, 0x16, 0x00, 0x6a, 0xfc, 0xc6, 0xcd, 0xc3, 0xcb, 0xcb, 0x0b
+       , 0x3e, 0xa4, 0x9e, 0xf3, 0x27, 0x07, 0xe4, 0x00, 0x16, 0xd8, 0x11, 0x14, 0x88, 0x5b, 0x67, 0xff
+       , 0x8d, 0xc8, 0x03, 0x24, 0xc0, 0x57, 0x82, 0x42, 0x86, 0x0f, 0xd8, 0x40, 0x57, 0x9f, 0xb3, 0x43
+       , 0x12, 0x3e, 0x27, 0xa4, 0x19, 0x09, 0x4c, 0xc1, 0xbc, 0x20, 0xc0, 0x03, 0x29, 0x82, 0x80, 0xc1
+       , 0x09, 0x94, 0xc7, 0xec, 0x3b, 0x01, 0x04, 0x10, 0xf6, 0x12, 0x1c, 0x58, 0xb6, 0x00, 0x8d, 0xe3
+       , 0x04, 0x97, 0x41, 0xc0, 0x38, 0x84, 0x44, 0xc1, 0x2f, 0xf8, 0xf5, 0x8f, 0xe0, 0x03, 0x3f, 0x90
+       , 0x4f, 0x6e, 0x02, 0xed, 0x2a, 0xf8, 0xf9, 0xe3, 0xff, 0x48, 0xda, 0xc3, 0x0a, 0xea, 0xb7, 0x82
+       , 0xc6, 0x8e, 0xc1, 0x77, 0x72, 0x43, 0x2a, 0x5c, 0xc8, 0xf8, 0x01, 0xa4, 0xc5, 0xcf, 0xc9, 0xc9
+       , 0x03, 0x0e, 0x37, 0x20, 0x01, 0xb9, 0xa5, 0x1e, 0x9c, 0xfc, 0xb1, 0xb4, 0x59, 0x00, 0x02, 0x08
+       , 0x7b, 0x04, 0x00, 0xdb, 0x49, 0xa0, 0x52, 0x08, 0x94, 0x89, 0xb8, 0x78, 0xbf, 0xf3, 0xc0, 0xaf
+       , 0x26, 0x87, 0x9e, 0x1c, 0xf4, 0x0b, 0x7a, 0x4e, 0xe0, 0x1f, 0xd8, 0xf6, 0x57, 0xc8, 0xee, 0xa6
+       , 0x5f, 0x23, 0xa9, 0x20, 0x82, 0xdc, 0x02, 0x0a, 0x0a, 0x7b, 0x36, 0x58, 0x81, 0xcf, 0x01, 0xef
+       , 0xf0, 0x82, 0x1a, 0xfd, 0x7c, 0xbc, 0x7c, 0xc0, 0x08, 0x00, 0xb5, 0x61, 0x40, 0x11, 0xc0, 0x09
+       , 0x4e, 0xfe, 0x58, 0x06, 0x0f, 0x00, 0x02, 0x08, 0x67, 0x1b, 0x06, 0xd8, 0xca, 0x01, 0x6a, 0xfb
+       , 0xf9, 0x13, 0x74, 0xb5, 0xfd, 0x77, 0xde, 0xef, 0xbc, 0x90, 0xa3, 0x47, 0x51, 0x8e, 0x4c, 0x84
+       , 0x1e, 0x64, 0xf0, 0xef, 0x0f, 0xec, 0x86, 0x3f, 0xf0, 0x99, 0x5b, 0xb4, 0xf4, 0xf5, 0x60, 0x01
+       , 0xe0, 0x92, 0x87, 0x0d, 0x92, 0xf8, 0xd9, 0xc1, 0x41, 0xce, 0x05, 0xed, 0x37, 0x81, 0x8a, 0x1a
+       , 0x20, 0xe6, 0xe3, 0xe7, 0xe7, 0xe3, 0xe7, 0xe3, 0x01, 0xe5, 0x00, 0x48, 0x03, 0x14, 0xe7, 0x7d
+       , 0xf4, 0x00, 0x01, 0x84, 0xaf, 0x11, 0x09, 0x89, 0x03, 0x60, 0x09, 0xf6, 0xf3, 0x07, 0xf4, 0x8a
+       , 0x86, 0xef, 0xdf, 0xbf, 0xff, 0xf9, 0x0d, 0x3b, 0x6d, 0x02, 0x71, 0x13, 0x27, 0x78, 0x17, 0x26
+       , 0x64, 0x67, 0xda, 0xff, 0xff, 0x7f, 0x87, 0xfb, 0x69, 0x66, 0xa0, 0xb9, 0x5b, 0x70, 0xab, 0x07
+       , 0xd2, 0x36, 0x04, 0x0f, 0xb2, 0x41, 0x82, 0x9d, 0x13, 0x3c, 0x7c, 0xc3, 0xc5, 0xcb, 0xc7, 0xc3
+       , 0xcf, 0x07, 0x4c, 0xfe, 0x40, 0x0c, 0x0c, 0x7f, 0x1e, 0xa0, 0x14, 0xb0, 0x61, 0x8f, 0xcb, 0x34
+       , 0x80, 0x00, 0xc2, 0x17, 0x01, 0xc0, 0xb6, 0x2d, 0x30, 0x53, 0x71, 0xff, 0xe2, 0xfa, 0xc5, 0xc3
+       , 0x0b, 0x3d, 0xb9, 0x15, 0x7c, 0x62, 0x34, 0xfc, 0x18, 0x1b, 0xc4, 0x09, 0x12, 0xd0, 0x6d, 0x7f
+       , 0x20, 0xe2, 0x17, 0x78, 0x0b, 0x1a, 0x0d, 0x3c, 0x3e, 0x28, 0x00, 0x33, 0x13, 0x33, 0x78, 0x6c
+       , 0x12, 0x56, 0xe1, 0x72, 0x42, 0xd2, 0x3e, 0x24, 0xec, 0x41, 0x7d, 0x57, 0x2e, 0x6e, 0x4e, 0x7e
+       , 0x7e, 0x01, 0x7e, 0x7e, 0x50, 0x14, 0x70, 0x73, 0xf3, 0x82, 0xe4, 0x80, 0xcd, 0x7f, 0x1c, 0xb7
+       , 0x37, 0x00, 0x01, 0x40, 0x00, 0x11, 0xe8, 0x46, 0x81, 0xa3, 0xf8, 0xf7, 0x2f, 0x1e, 0xd8, 0x29
+       , 0x42, 0xe0, 0xf3, 0x48, 0xff, 0xc2, 0xaf, 0x34, 0x06, 0x6f, 0x7b, 0x05, 0x1f, 0x6b, 0x00, 0xdf
+       , 0x4c, 0x0c, 0xde, 0x69, 0xf3, 0xeb, 0xff, 0xb0, 0x3c, 0xd5, 0x86, 0x89, 0x99, 0x09, 0x52, 0xf2
+       , 0x70, 0x40, 0x2b, 0x5d, 0x48, 0xd8, 0x73, 0x40, 0xfa, 0x4c, 0xe0, 0x12, 0x88, 0x8b, 0x5f, 0x40
+       , 0x10, 0x14, 0xf8, 0xa0, 0x1c, 0x00, 0x6a, 0x01, 0x81, 0xab, 0x5f, 0x7c, 0x37, 0xba, 0x01, 0x04
+       , 0x10, 0x81, 0x08, 0x60, 0x66, 0x62, 0x02, 0x9a, 0x0f, 0x3e, 0xa2, 0xfa, 0x17, 0xe4, 0x34, 0x27
+       , 0xc8, 0x6d, 0xc0, 0xd0, 0xba, 0x17, 0x76, 0x8c, 0xc4, 0xdf, 0xff, 0xb0, 0x7d, 0xb1, 0xb0, 0x8b
+       , 0x81, 0xff, 0x0f, 0xbb, 0x7b, 0x7c, 0x80, 0xcd, 0x1e, 0xc8, 0x48, 0x0f, 0xb8, 0xb1, 0x8f, 0x28
+       , 0x75, 0xb8, 0x78, 0x20, 0xdd, 0x55, 0x4e, 0x60, 0x83, 0x85, 0x8f, 0x0f, 0x98, 0xf8, 0x05, 0x04
+       , 0xf8, 0x80, 0x39, 0x80, 0x0f, 0xd8, 0xfe, 0x01, 0x5f, 0x1e, 0xc0, 0x8e, 0x7f, 0x06, 0x17, 0x20
+       , 0x80, 0x08, 0x0f, 0x24, 0x80, 0x1a, 0xb9, 0x7f, 0x39, 0x79, 0xc0, 0xa7, 0x6e, 0x41, 0x4f, 0xec
+       , 0x06, 0x9f, 0x29, 0x04, 0x4c, 0xfc, 0xff, 0x61, 0x97, 0xbc, 0xfe, 0x05, 0xef, 0xe4, 0xfe, 0x0f
+       , 0xdd, 0x48, 0x0c, 0x46, 0x8c, 0x8c, 0xbf, 0x7f, 0xfd, 0x84, 0x9c, 0xca, 0x35, 0x0c, 0x00, 0x74
+       , 0xb6, 0x8a, 0x9d, 0x0d, 0xda, 0xc4, 0xe1, 0x84, 0x24, 0x77, 0x70, 0x33, 0x9d, 0x93, 0x1b, 0x02
+       , 0x80, 0x21, 0x2e, 0x28, 0x28, 0x20, 0x08, 0x2e, 0x7e, 0x78, 0x80, 0xf5, 0x00, 0xb8, 0xfa, 0x05
+       , 0x66, 0x17, 0xfc, 0x26, 0x03, 0x04, 0x10, 0x51, 0x23, 0x39, 0xc0, 0x52, 0xec, 0xdf, 0x9f, 0x3f
+       , 0xc8, 0xc7, 0x9f, 0x81, 0xcf, 0xe3, 0xfa, 0x0d, 0xbe, 0xe6, 0x15, 0x7a, 0xe5, 0x25, 0xf4, 0xa2
+       , 0x39, 0xe8, 0xde, 0x4a, 0xf0, 0x5e, 0x28, 0x10, 0xff, 0xd7, 0x30, 0xe8, 0xa0, 0x81, 0x43, 0x1f
+       , 0x52, 0xea, 0xb3, 0x43, 0x1a, 0xf9, 0xc0, 0xc0, 0x07, 0x5f, 0x0b, 0x00, 0x09, 0x78, 0xc8, 0x15
+       , 0x01, 0x3c, 0x82, 0x20, 0x00, 0x0c, 0x7e, 0x01, 0x60, 0x3e, 0x00, 0x8f, 0x3f, 0x70, 0x01, 0x35
+       , 0x10, 0x34, 0x1c, 0x20, 0x80, 0x88, 0x8a, 0x00, 0x60, 0x26, 0x02, 0xe6, 0x39, 0xee, 0xbf, 0x90
+       , 0x03, 0xe9, 0x20, 0x17, 0x61, 0xff, 0xfe, 0xf3, 0xf7, 0x37, 0xfc, 0xc0, 0x03, 0xc8, 0x4e, 0x64
+       , 0x86, 0xff, 0x88, 0xcd, 0xc4, 0xe0, 0x1d, 0x50, 0xa0, 0xed, 0x09, 0xc0, 0x4c, 0x33, 0xa4, 0xe3
+       , 0x00, 0x34, 0x55, 0x0e, 0x1e, 0xd8, 0x07, 0xcf, 0xea, 0x42, 0xd2, 0x3d, 0x38, 0xe8, 0x81, 0x45
+       , 0x0f, 0x0f, 0x24, 0xe1, 0x83, 0x68, 0x21, 0x41, 0x10, 0x14, 0xe0, 0x17, 0x04, 0x96, 0x41, 0xbc
+       , 0xe0, 0xd6, 0x0f, 0x30, 0xa6, 0x08, 0xde, 0x63, 0x08, 0x04, 0x00, 0x01, 0x44, 0xec, 0x58, 0x26
+       , 0x30, 0x03, 0x02, 0xed, 0x86, 0x1e, 0x81, 0x03, 0x6a, 0xfb, 0x43, 0x9a, 0x9f, 0x7f, 0x61, 0xc9
+       , 0x1e, 0x96, 0xfe, 0x21, 0x3b, 0xc9, 0x60, 0xdb, 0x42, 0x20, 0x4b, 0xe5, 0x81, 0x45, 0x17, 0x30
+       , 0xd3, 0x50, 0x12, 0x0a, 0x03, 0x05, 0x20, 0x63, 0xfc, 0xec, 0x90, 0x72, 0x9f, 0x13, 0x5a, 0xf6
+       , 0xc0, 0x13, 0x3e, 0x0f, 0x37, 0x64, 0xa4, 0x81, 0x57, 0x40, 0x50, 0x48, 0x48, 0x58, 0x48, 0x48
+       , 0x00, 0x1a, 0xfa, 0xc0, 0x38, 0x01, 0xe6, 0x10, 0x62, 0x6e, 0xf2, 0x04, 0x02, 0x80, 0x00, 0x22
+       , 0x61, 0x30, 0x19, 0x58, 0xf3, 0x83, 0x8f, 0x5e, 0x41, 0xb4, 0x3e, 0x11, 0xcd, 0x4f, 0xf8, 0x31
+       , 0x1e, 0x90, 0x6d, 0x80, 0xc8, 0x7b, 0x44, 0x20, 0xbb, 0x0b, 0x98, 0x40, 0xc3, 0x47, 0x43, 0x68
+       , 0xac, 0x02, 0xe8, 0x64, 0x16, 0x36, 0xc8, 0x22, 0x1d, 0x76, 0xc8, 0xa0, 0x00, 0x27, 0x64, 0x78
+       , 0x92, 0x13, 0x14, 0xbc, 0xdc, 0xe0, 0x31, 0x36, 0xf0, 0x48, 0x27, 0xb0, 0xe4, 0x11, 0x10, 0x16
+       , 0x16, 0x02, 0x15, 0x3e, 0x02, 0xe0, 0xc2, 0x87, 0x87, 0x97, 0x07, 0x54, 0xf8, 0x10, 0x28, 0xfa
+       , 0xe1, 0x00, 0x20, 0x80, 0x48, 0x1b, 0xcd, 0x07, 0x16, 0x7f, 0xff, 0xa1, 0x67, 0x10, 0x81, 0xae
+       , 0x99, 0x06, 0x9d, 0xe0, 0x04, 0xa9, 0x7b, 0xa1, 0x75, 0x2d, 0x23, 0x24, 0x03, 0x80, 0x17, 0x51
+       , 0x23, 0xf6, 0x78, 0x40, 0x77, 0x2a, 0x30, 0x32, 0x83, 0x4f, 0xa3, 0x1b, 0x02, 0xc5, 0x11, 0xe8
+       , 0x46, 0x42, 0xc8, 0xfc, 0x0a, 0x64, 0x4a, 0x11, 0x3c, 0xc6, 0x00, 0x2a, 0x7d, 0x80, 0xe5, 0x0e
+       , 0x78, 0x84, 0x98, 0x1b, 0x34, 0x46, 0x0c, 0xec, 0xe7, 0x72, 0x03, 0x4b, 0x7d, 0x70, 0xe2, 0x17
+       , 0x12, 0x00, 0xb5, 0x3e, 0x41, 0x6d, 0x7f, 0x1e, 0xf0, 0xe8, 0x3d, 0xf1, 0x76, 0x01, 0x04, 0x10
+       , 0x69, 0x11, 0x00, 0x0c, 0x55, 0xa0, 0x4b, 0xfe, 0xa2, 0x9e, 0xc2, 0xf2, 0x1f, 0xba, 0xb3, 0x95
+       , 0x01, 0xb2, 0xb7, 0x95, 0x11, 0xb6, 0x99, 0x00, 0xb1, 0xd3, 0x89, 0x19, 0xb6, 0x4f, 0x81, 0x99
+       , 0x11, 0x7c, 0x62, 0xe6, 0xe0, 0xcd, 0x0a, 0xe0, 0xf1, 0x7d, 0xf0, 0xdc, 0x2e, 0x68, 0x76, 0x85
+       , 0x03, 0xda, 0xec, 0xe1, 0x00, 0x97, 0x3d, 0xdc, 0xa0, 0xf0, 0x87, 0xd4, 0xbd, 0xbc, 0xe0, 0xf0
+       , 0x17, 0x10, 0x00, 0xa6, 0x7d, 0x60, 0xea, 0x17, 0x12, 0x04, 0xb7, 0x7e, 0x80, 0x6d, 0x7f, 0xa0
+       , 0x28, 0xb0, 0x8e, 0x26, 0x69, 0x82, 0x04, 0x20, 0x80, 0x48, 0x9e, 0xcf, 0x02, 0x06, 0x25, 0x30
+       , 0x29, 0x30, 0xfc, 0x83, 0x16, 0x3b, 0xe0, 0x43, 0x0e, 0x18, 0x60, 0x9b, 0x58, 0x11, 0xbb, 0x72
+       , 0x90, 0x02, 0x9f, 0x89, 0x85, 0x09, 0xb4, 0x5a, 0x92, 0x85, 0x99, 0xf9, 0xc7, 0x2f, 0x16, 0x66
+       , 0xa6, 0x5f, 0xbf, 0x98, 0x98, 0x20, 0xdd, 0x38, 0x52, 0xad, 0xa6, 0x35, 0x80, 0xae, 0x2b, 0x81
+       , 0x4d, 0xea, 0x42, 0x26, 0xb7, 0x20, 0x6d, 0x1e, 0x0e, 0x2e, 0x4e, 0xe8, 0x7d, 0x48, 0xdc, 0x90
+       , 0xe1, 0x35, 0x50, 0x9b, 0x07, 0x1c, 0xf8, 0xc0, 0xe0, 0x07, 0x25, 0x7f, 0x48, 0xcf, 0x0b, 0x18
+       , 0x51, 0xa4, 0xae, 0x55, 0x00, 0x08, 0x20, 0x72, 0x26, 0x14, 0x59, 0x98, 0x59, 0x80, 0x2e, 0x81
+       , 0xa6, 0xe1, 0xff, 0x90, 0xed, 0x05, 0xd0, 0x7b, 0xfd, 0x18, 0x11, 0x25, 0x0e, 0x74, 0x6f, 0x0d
+       , 0x78, 0xa9, 0x24, 0x2b, 0x64, 0xcd, 0x06, 0x90, 0xf5, 0x13, 0xc8, 0xfd, 0xc5, 0x0c, 0x1b, 0xcd
+       , 0xfe, 0x33, 0x48, 0x4a, 0x24, 0xe8, 0xde, 0x15, 0xe8, 0x6a, 0x2a, 0xc8, 0x32, 0x10, 0xd8, 0x00
+       , 0x27, 0x6c, 0x79, 0x02, 0x17, 0xa4, 0xf0, 0xe1, 0x02, 0x95, 0xfc, 0x90, 0xb4, 0x2f, 0x04, 0x49
+       , 0xfb, 0xe0, 0xae, 0x2f, 0x2f, 0xb0, 0xdb, 0x05, 0x0c, 0x7d, 0xd2, 0x27, 0x68, 0x01, 0x02, 0x88
+       , 0xcc, 0x19, 0x5d, 0xa0, 0x73, 0xb9, 0xa1, 0x57, 0x15, 0x43, 0xb7, 0xd4, 0x33, 0xc2, 0x36, 0xa3
+       , 0xbd, 0x83, 0x06, 0x3d, 0x33, 0x33, 0xfc, 0x8e, 0x39, 0xf0, 0x42, 0x30, 0xe8, 0x75, 0x97, 0x3f
+       , 0x59, 0x7e, 0xb2, 0xb2, 0xfc, 0xfc, 0xf9, 0x9b, 0x85, 0x05, 0x74, 0x9a, 0x32, 0xf8, 0x00, 0x47
+       , 0xd0, 0x19, 0x69, 0x03, 0x73, 0x14, 0x14, 0xb0, 0xa6, 0x85, 0xee, 0xcd, 0x82, 0x2e, 0xe5, 0x61
+       , 0x45, 0x8c, 0xf3, 0x40, 0x46, 0x39, 0x39, 0x39, 0x11, 0xeb, 0x43, 0x20, 0xed, 0x1f, 0x1e, 0x70
+       , 0xb8, 0x83, 0x8a, 0x7d, 0x60, 0xe8, 0x43, 0x5a, 0xfd, 0xe0, 0xb6, 0x10, 0x37, 0x79, 0xd3, 0xe3
+       , 0x00, 0x01, 0x44, 0xfe, 0x94, 0x3a, 0xd0, 0xcd, 0x40, 0x5b, 0x19, 0x20, 0x7b, 0xfc, 0x40, 0x11
+       , 0x00, 0x49, 0xef, 0xd0, 0x30, 0x47, 0xec, 0x79, 0x82, 0xae, 0xd0, 0x66, 0x86, 0x6c, 0x4c, 0x00
+       , 0x11, 0x3f, 0x81, 0x1e, 0x85, 0xdc, 0x36, 0xcf, 0xf2, 0x9b, 0x15, 0x94, 0x13, 0x58, 0x20, 0x47
+       , 0x59, 0x03, 0x5b, 0xb7, 0xf4, 0x3a, 0x91, 0x05, 0xb4, 0x8e, 0x13, 0xbc, 0x17, 0x0e, 0xb4, 0x20
+       , 0x19, 0xb6, 0x9c, 0x0a, 0xdc, 0xde, 0x67, 0x87, 0xad, 0x02, 0x01, 0x35, 0x7c, 0x10, 0xa3, 0x6c
+       , 0xa0, 0xf0, 0xe7, 0x04, 0x56, 0xbb, 0xc0, 0x90, 0x17, 0x14, 0x80, 0xa4, 0x7b, 0xd0, 0x90, 0x03
+       , 0x30, 0xf0, 0x81, 0x51, 0xc2, 0x45, 0x6e, 0xe8, 0x03, 0x01, 0x40, 0x00, 0x51, 0xb4, 0xa6, 0x01
+       , 0x68, 0x2b, 0x30, 0xea, 0xa1, 0x7b, 0x60, 0x21, 0xd7, 0x1a, 0xb3, 0x30, 0x43, 0x97, 0xf1, 0xb2
+       , 0x81, 0xf7, 0x39, 0xb1, 0x42, 0x20, 0x2b, 0x2b, 0x7c, 0x7d, 0xe9, 0x77, 0x50, 0x1e, 0xff, 0xf9
+       , 0x03, 0xc8, 0x02, 0x76, 0xd1, 0x58, 0x21, 0x97, 0xa0, 0x41, 0x0f, 0x2b, 0x65, 0xf9, 0x03, 0x9b
+       , 0xdd, 0xfc, 0xf7, 0x9f, 0x36, 0x19, 0x02, 0xbc, 0x7d, 0x14, 0x9c, 0x4c, 0x58, 0xc0, 0x77, 0x90
+       , 0x83, 0x17, 0x37, 0x41, 0x52, 0x3e, 0x64, 0x74, 0x9f, 0x0d, 0xbc, 0x8c, 0x10, 0xd2, 0xf2, 0xe1
+       , 0x82, 0x0c, 0xf6, 0x40, 0x46, 0xfa, 0xb9, 0xb9, 0xf9, 0x78, 0xf9, 0x40, 0xc1, 0x0e, 0xc4, 0xe0
+       , 0xf6, 0x3e, 0x3f, 0x1f, 0xbc, 0xc9, 0xcf, 0x49, 0xc9, 0xd2, 0x10, 0x80, 0x00, 0xa2, 0x74, 0x51
+       , 0x09, 0xd0, 0x2b, 0x5c, 0xdc, 0x5c, 0xf0, 0xba, 0x17, 0x9a, 0xdc, 0x59, 0x59, 0xd8, 0xc1, 0x49
+       , 0xea, 0xc3, 0x87, 0x0f, 0x90, 0x28, 0x80, 0x2e, 0x6b, 0xfc, 0x0e, 0x9a, 0x40, 0xfd, 0xf1, 0xf3
+       , 0x27, 0x1b, 0xdb, 0x0f, 0x20, 0x84, 0x5c, 0x4d, 0xf3, 0x9b, 0xed, 0x17, 0xbc, 0x4a, 0x80, 0x0d
+       , 0x71, 0x43, 0x46, 0xf8, 0x20, 0xe3, 0x4c, 0x54, 0x38, 0xa8, 0x0e, 0xb1, 0x5d, 0x17, 0x71, 0xfb
+       , 0x2f, 0xa2, 0xd0, 0x67, 0x85, 0xb7, 0xf7, 0xc1, 0xeb, 0x71, 0xd8, 0xe1, 0x73, 0x5b, 0xb0, 0xe4
+       , 0x0f, 0x24, 0x40, 0xe9, 0x9d, 0x1f, 0x1c, 0xf2, 0x7c, 0xe0, 0x74, 0x0f, 0x6a, 0xef, 0x83, 0xa7
+       , 0xba, 0xb8, 0xb8, 0x88, 0xe9, 0xee, 0xe2, 0x01, 0x00, 0x01, 0x58, 0xbb, 0x62, 0x2d, 0x00, 0x41
+       , 0x10, 0x38, 0x50, 0x5a, 0x53, 0xff, 0xff, 0x99, 0x4c, 0xe5, 0x23, 0xdf, 0x0b, 0x0e, 0xc2, 0x96
+       , 0xa6, 0x9a, 0x5c, 0x01, 0x15, 0x79, 0x78, 0x77, 0xfc, 0x80, 0xea, 0x51, 0xaf, 0xd4, 0x48, 0x02
+       , 0xdd, 0xfe, 0x26, 0x34, 0x05, 0x4e, 0x49, 0x7d, 0x62, 0xe6, 0xe4, 0x19, 0xf8, 0xfb, 0x56, 0xf6
+       , 0xa3, 0xcd, 0xa5, 0x55, 0xdd, 0x88, 0x0a, 0xb5, 0x7c, 0x09, 0x51, 0xeb, 0xd3, 0x67, 0x33, 0x49
+       , 0x97, 0x87, 0x5e, 0x6f, 0x47, 0xa7, 0xb5, 0xa3, 0xdb, 0x61, 0x82, 0x6a, 0x10, 0xfe, 0x7a, 0xcf
+       , 0x54, 0x21, 0x0a, 0x93, 0x02, 0x17, 0x04, 0x0a, 0x68, 0x5e, 0xd0, 0x31, 0xfb, 0x97, 0xc2, 0xaa
+       , 0x09, 0x18, 0xc2, 0xa0, 0xa5, 0x20, 0xfe, 0xe3, 0x67, 0xd7, 0x56, 0x2d, 0x38, 0x37, 0x6f, 0xf0
+       , 0xdb, 0xa9, 0xb7, 0xd8, 0x7b, 0x0d, 0x6a, 0xb8, 0xcd, 0x75, 0xf9, 0x4e, 0x59, 0xbc, 0x04, 0x10
+       , 0x75, 0x96, 0x55, 0x01, 0xdd, 0x01, 0x4c, 0x0b, 0xd0, 0x04, 0x06, 0xbb, 0xd8, 0x15, 0x36, 0x57
+       , 0x0d, 0x9a, 0xb5, 0xf8, 0xf8, 0xf1, 0x33, 0x28, 0xe4, 0xbf, 0x43, 0x72, 0x39, 0xfb, 0x4f, 0x8e
+       , 0x9f, 0x3f, 0x7e, 0x70, 0x40, 0x2e, 0xe5, 0x83, 0xc5, 0xc0, 0xaf, 0xdf, 0x90, 0x73, 0xc3, 0x21
+       , 0xd7, 0x74, 0x40, 0xe7, 0xda, 0xc0, 0xd3, 0xfd, 0x90, 0x33, 0x64, 0x41, 0x03, 0xae, 0x90, 0x51
+       , 0x6f, 0xa0, 0x85, 0xff, 0xe0, 0x27, 0xaa, 0x31, 0x40, 0x4f, 0xe1, 0x61, 0x80, 0x32, 0x20, 0x07
+       , 0x1f, 0x31, 0x42, 0x77, 0xf7, 0x23, 0x6d, 0x55, 0x87, 0xee, 0x72, 0x83, 0xec, 0xb8, 0x42, 0x5a
+       , 0x42, 0x0e, 0xd9, 0x35, 0x01, 0x1e, 0xe4, 0xe7, 0x80, 0xe6, 0x00, 0x4e, 0xd8, 0x68, 0x33, 0x1f
+       , 0x78, 0x68, 0x9f, 0x1f, 0x32, 0xc0, 0xcf, 0xc7, 0x07, 0x1e, 0xe4, 0x01, 0xa5, 0x7c, 0x60, 0x9f
+       , 0x98, 0x83, 0xe8, 0xbe, 0x2e, 0x7e, 0x00, 0x10, 0x40, 0xd4, 0x5c, 0xd7, 0x06, 0x0c, 0x70, 0x48
+       , 0x35, 0x0c, 0xee, 0xcb, 0x40, 0x4b, 0x55, 0x78, 0x72, 0xfa, 0xf4, 0x09, 0x74, 0x27, 0x2e, 0xfb
+       , 0x77, 0x60, 0xef, 0x06, 0x74, 0x25, 0xe8, 0x0f, 0x0e, 0xd8, 0xa5, 0xa0, 0xe0, 0xd5, 0x16, 0xbf
+       , 0xe1, 0x17, 0xae, 0x80, 0xe7, 0xf9, 0x7f, 0xff, 0xfe, 0x83, 0x74, 0x74, 0x35, 0x38, 0x12, 0xfe
+       , 0xc2, 0x4e, 0xf0, 0x05, 0x1f, 0x1f, 0x0b, 0x3b, 0x94, 0x10, 0x3e, 0x02, 0x02, 0x3d, 0xcc, 0x85
+       , 0x09, 0x7e, 0x34, 0x09, 0x68, 0x63, 0x2d, 0xf8, 0x84, 0x12, 0xc4, 0x76, 0x51, 0xd8, 0xbe, 0x2d
+       , 0x56, 0x16, 0x78, 0xc9, 0xc3, 0x06, 0x5d, 0x47, 0x08, 0x9e, 0x5c, 0x87, 0xcf, 0xae, 0x73, 0x72
+       , 0x00, 0x9b, 0x95, 0xa0, 0x00, 0xe7, 0x03, 0xcf, 0x2d, 0x82, 0xa7, 0xd7, 0x41, 0x3d, 0x5f, 0x1e
+       , 0x6e, 0x48, 0xbd, 0x4c, 0xe4, 0x38, 0x0f, 0x31, 0x00, 0x20, 0x00, 0x6b, 0x67, 0x94, 0x02, 0x30
+       , 0x0c, 0xc2, 0xd0, 0xbf, 0xb5, 0x65, 0xbb, 0xff, 0x45, 0x45, 0xe6, 0xba, 0x51, 0x46, 0x13, 0x1d
+       , 0xc2, 0x7e, 0x7b, 0x85, 0x22, 0x55, 0x7c, 0x31, 0x59, 0x2c, 0x2c, 0xc4, 0x1d, 0x93, 0x4f, 0x9e
+       , 0x8e, 0xee, 0x2a, 0x1b, 0x1a, 0xb6, 0x58, 0xb2, 0x8b, 0x88, 0xaa, 0x9a, 0x9d, 0xd5, 0xfa, 0xd5
+       , 0x90, 0x6a, 0x03, 0xd4, 0x3f, 0x83, 0x0d, 0x9e, 0x19, 0xd4, 0xd4, 0xef, 0x8f, 0xb7, 0xb1, 0x25
+       , 0x8c, 0xb0, 0xbf, 0x1e, 0x79, 0xf3, 0xfa, 0xf3, 0xd1, 0x0c, 0x4b, 0xa3, 0x48, 0x1a, 0x4f, 0x4e
+       , 0x01, 0x3e, 0x96, 0xf1, 0xf1, 0xb7, 0xf4, 0xf5, 0xa3, 0xfe, 0x29, 0x27, 0x2c, 0xc5, 0x41, 0x57
+       , 0xa1, 0x96, 0xca, 0x91, 0x16, 0xb1, 0xd6, 0xe1, 0x6c, 0x1d, 0x02, 0xe7, 0xb6, 0xf6, 0x44, 0xee
+       , 0x15, 0x40, 0xd4, 0x5f, 0xd9, 0x09, 0x74, 0x1f, 0xd0, 0xa9, 0xe0, 0x28, 0x00, 0xaf, 0x53, 0x05
+       , 0xe5, 0x6b, 0x76, 0x0e, 0xe8, 0x38, 0x22, 0xa8, 0x29, 0x0d, 0x8c, 0x00, 0x48, 0x34, 0xfc, 0xfc
+       , 0xc9, 0x09, 0x2c, 0x86, 0x7e, 0x71, 0xc2, 0x4a, 0x21, 0xd8, 0xa5, 0x59, 0xa0, 0xb9, 0x86, 0x5f
+       , 0x88, 0x63, 0xc4, 0x41, 0xb3, 0x9e, 0x48, 0xe7, 0xb7, 0x83, 0x4f, 0x76, 0x84, 0x54, 0x05, 0xb0
+       , 0x56, 0x2b, 0xb8, 0xe0, 0x87, 0x9c, 0x7a, 0xc1, 0xc4, 0x08, 0x3b, 0x1c, 0x06, 0x3a, 0xf8, 0x81
+       , 0x52, 0xeb, 0x42, 0x9b, 0x08, 0xf0, 0xd5, 0xfb, 0x6c, 0x6c, 0xd0, 0x4d, 0xb9, 0xe0, 0x9d, 0x2b
+       , 0x5c, 0x5c, 0xa0, 0x55, 0x3c, 0xbc, 0xd0, 0x51, 0x4e, 0xc8, 0x50, 0x1b, 0x2f, 0x64, 0x64, 0x1f
+       , 0x92, 0x89, 0x71, 0xad, 0x6c, 0xa0, 0x04, 0x00, 0x04, 0x10, 0xad, 0x96, 0xd6, 0x82, 0xb7, 0x21
+       , 0x30, 0xc3, 0xca, 0x58, 0x70, 0x87, 0x1e, 0x3a, 0x73, 0xca, 0xfd, 0xe5, 0xeb, 0x37, 0x1e, 0xf0
+       , 0x72, 0x47, 0xf0, 0x6a, 0xa3, 0xaf, 0xb0, 0x8b, 0x85, 0x60, 0x77, 0x54, 0x22, 0xb7, 0x88, 0xa0
+       , 0xcb, 0x2e, 0x10, 0x07, 0xb9, 0xff, 0x07, 0x1f, 0x79, 0xcd, 0x80, 0x38, 0xc7, 0x1a, 0x71, 0x28
+       , 0x21, 0xe4, 0x68, 0x24, 0x06, 0xf8, 0xa9, 0x5f, 0x90, 0x1c, 0xc0, 0x02, 0xdb, 0x33, 0x0a, 0xdf
+       , 0x87, 0xcb, 0x8a, 0x68, 0xfb, 0x40, 0x00, 0x30, 0xf5, 0xc3, 0x86, 0x98, 0xa1, 0x23, 0xfc, 0x90
+       , 0xa1, 0x7e, 0x48, 0xdb, 0x1f, 0x34, 0xaf, 0x02, 0x5a, 0x56, 0xce, 0xce, 0x4c, 0x9b, 0x0d, 0xd2
+       , 0x00, 0x01, 0xc4, 0x48, 0xeb, 0xd3, 0x28, 0xc1, 0xb7, 0xf3, 0xfd, 0x82, 0xde, 0x8d, 0x08, 0xb9
+       , 0xa5, 0xfe, 0x2b, 0xe4, 0x86, 0x63, 0x08, 0x0b, 0xbc, 0xe4, 0x0b, 0xb4, 0xea, 0xe5, 0x3b, 0x2c
+       , 0x0a, 0x7e, 0x41, 0xee, 0x7f, 0x82, 0x1f, 0xf4, 0x0e, 0xbd, 0xb9, 0x06, 0x36, 0xfd, 0x09, 0x3f
+       , 0x0a, 0x98, 0x01, 0x56, 0x09, 0xff, 0x87, 0x1e, 0x3b, 0x08, 0x3b, 0x51, 0x07, 0x51, 0xfe, 0xc0
+       , 0xce, 0x88, 0x61, 0x81, 0x77, 0xc8, 0x61, 0x3b, 0x47, 0xd9, 0x40, 0x7b, 0x81, 0xc0, 0x83, 0xcc
+       , 0xd0, 0xe9, 0x74, 0x2e, 0xd8, 0x3c, 0x0b, 0x78, 0xd4, 0x07, 0x3a, 0xe3, 0x0b, 0x5e, 0x5f, 0x0b
+       , 0xda, 0x32, 0x4d, 0xbb, 0xf0, 0x01, 0x08, 0x20, 0x9a, 0x47, 0x00, 0x04, 0x80, 0x2f, 0x70, 0x02
+       , 0xdf, 0x10, 0xf7, 0x1d, 0x72, 0x4d, 0x28, 0xe8, 0x5e, 0x39, 0xf0, 0x1d, 0xa3, 0x60, 0x0e, 0xf4
+       , 0xa6, 0x7a, 0xf0, 0x1d, 0xa2, 0x3f, 0x7f, 0x42, 0x57, 0xdd, 0x41, 0x66, 0xde, 0x20, 0xf8, 0xcf
+       , 0x3f, 0xa4, 0x6a, 0x00, 0xf9, 0xe4, 0x5f, 0xd8, 0xd1, 0x8e, 0x90, 0xb3, 0x20, 0xa1, 0xc7, 0x7b
+       , 0x81, 0x4b, 0x20, 0xc8, 0x71, 0x30, 0xb0, 0xd3, 0x2e, 0x20, 0x5b, 0xa5, 0x59, 0xa0, 0xeb, 0xc8
+       , 0xd9, 0x21, 0x2b, 0xd8, 0x38, 0x61, 0x00, 0xb6, 0xa8, 0x0a, 0xd6, 0xf8, 0xe7, 0xe4, 0x80, 0x6c
+       , 0x16, 0xa5, 0x45, 0x99, 0x83, 0x06, 0x00, 0x02, 0xf0, 0x76, 0x06, 0x29, 0x00, 0x80, 0x20, 0x10
+       , 0x94, 0xa0, 0xff, 0x3f, 0x57, 0x8d, 0xc2, 0x50, 0x57, 0xfb, 0x41, 0x9d, 0xba, 0x27, 0x62, 0xab
+       , 0xee, 0x7c, 0x7a, 0x00, 0x3f, 0x66, 0xc1, 0x29, 0x53, 0x01, 0x2a, 0x11, 0xc8, 0xd0, 0x40, 0xb7
+       , 0x0a, 0x2b, 0x03, 0x99, 0x0e, 0x7e, 0x71, 0xf0, 0xbf, 0x97, 0xfa, 0xd0, 0xcb, 0x86, 0xff, 0xfe
+       , 0xa9, 0x14, 0x64, 0xd5, 0x01, 0xb5, 0x0e, 0x7f, 0xca, 0x3e, 0x10, 0x8d, 0xe7, 0x7f, 0xd7, 0x52
+       , 0xa0, 0x1b, 0x96, 0x60, 0xc7, 0x0a, 0xf5, 0xa6, 0x7f, 0x76, 0x53, 0xe9, 0xa9, 0x61, 0x5a, 0x5c
+       , 0x53, 0x06, 0x8a, 0xfa, 0x68, 0xfe, 0x31, 0x04, 0xb8, 0x02, 0x88, 0x8e, 0x11, 0x00, 0x06, 0xc0
+       , 0x60, 0x83, 0xb6, 0xfa, 0xc1, 0x57, 0x6a, 0x41, 0x82, 0xfb, 0x27, 0x74, 0xc5, 0xd7, 0x0f, 0xf0
+       , 0x9d, 0xc5, 0x3f, 0x7f, 0xc0, 0x2e, 0xed, 0xfe, 0x0d, 0xbe, 0x4f, 0xee, 0x17, 0xe4, 0xd6, 0x21
+       , 0x58, 0x7d, 0x00, 0x5f, 0x80, 0xf4, 0x0f, 0x6a, 0x1e, 0x68, 0xfa, 0x1f, 0xd6, 0xfc, 0x81, 0xf6
+       , 0x00, 0x60, 0x07, 0x5d, 0x30, 0x43, 0x0e, 0x5c, 0x00, 0x36, 0xf9, 0x61, 0x5b, 0x7b, 0xa0, 0x85
+       , 0x3e, 0x78, 0x23, 0x28, 0x74, 0x55, 0x2d, 0xa4, 0x06, 0x86, 0x1d, 0x22, 0x00, 0xaa, 0xa0, 0xe9
+       , 0xb9, 0xff, 0x13, 0x20, 0x80, 0xe8, 0x1d, 0x01, 0x70, 0xf0, 0x17, 0x7c, 0x71, 0x1f, 0xa4, 0xe9
+       , 0xf3, 0x13, 0x52, 0x42, 0x41, 0xaf, 0x66, 0x87, 0x62, 0xe8, 0x95, 0xb0, 0xd0, 0x65, 0xc0, 0xd0
+       , 0x7b, 0x85, 0xfe, 0xc0, 0xd6, 0xc1, 0xfc, 0x83, 0x1d, 0x73, 0xcd, 0x08, 0x5e, 0x02, 0x03, 0xad
+       , 0x84, 0x11, 0x65, 0x3f, 0xe2, 0xfc, 0x29, 0xc8, 0x26, 0x73, 0x48, 0xa2, 0x06, 0x9f, 0xc1, 0x00
+       , 0x86, 0x6c, 0x88, 0x1c, 0x01, 0xdb, 0x0c, 0xcd, 0x32, 0x20, 0xfb, 0x3e, 0x01, 0x02, 0x68, 0xc0
+       , 0x22, 0x00, 0x02, 0x80, 0xc1, 0x08, 0xb9, 0xeb, 0x0c, 0xda, 0xfa, 0xf9, 0x85, 0xc0, 0x7f, 0xa0
+       , 0x0b, 0x61, 0x20, 0x37, 0x58, 0x42, 0xae, 0x16, 0x82, 0x5e, 0xf3, 0x81, 0x58, 0x87, 0x01, 0x39
+       , 0x88, 0x19, 0x94, 0x0b, 0xd0, 0x9a, 0xff, 0xa8, 0x9d, 0x2f, 0x50, 0xa5, 0x0b, 0xed, 0x1c, 0xb2
+       , 0xa2, 0x01, 0x70, 0x5b, 0x6d, 0x00, 0x8f, 0x62, 0x03, 0x08, 0xa0, 0x01, 0x8e, 0x00, 0x38, 0x00
+       , 0x3a, 0xe3, 0x0f, 0xa2, 0xa0, 0x81, 0xdd, 0x60, 0x09, 0x5f, 0xff, 0xf8, 0x07, 0x7c, 0xbd, 0x0d
+       , 0xec, 0x7e, 0x8f, 0xff, 0x90, 0x8a, 0x00, 0x7a, 0x3a, 0x3c, 0xbc, 0x17, 0x8c, 0xd4, 0x04, 0x02
+       , 0x9d, 0x58, 0x02, 0x1e, 0x1a, 0x44, 0x8e, 0x06, 0x0c, 0x30, 0x18, 0x8e, 0x7d, 0x01, 0x08, 0xa0
+       , 0xc1, 0x12, 0x01, 0xc8, 0x00, 0x76, 0x75, 0x19, 0xb8, 0x13, 0x06, 0xbd, 0xdf, 0x09, 0x72, 0x0d
+       , 0x11, 0xb4, 0x06, 0x86, 0xb4, 0x83, 0x90, 0x2b, 0x61, 0x06, 0x58, 0x04, 0x30, 0xc0, 0x8e, 0x9f
+       , 0x85, 0x8f, 0x7e, 0xb2, 0xc0, 0xe6, 0x87, 0x20, 0x1b, 0xfc, 0x07, 0xdb, 0xf6, 0x66, 0x80, 0x00
+       , 0x1a, 0x8c, 0x11, 0x80, 0x0c, 0x40, 0xc1, 0x0c, 0xbb, 0x17, 0x0d, 0x72, 0xa5, 0x0d, 0x7c, 0x35
+       , 0x00, 0xe4, 0x18, 0x78, 0xd0, 0x19, 0xcc, 0xd0, 0x59, 0x69, 0xd8, 0x89, 0xcb, 0x88, 0x13, 0x98
+       , 0xa1, 0x43, 0x42, 0x83, 0xf9, 0xd4, 0x6b, 0x80, 0x00, 0x03, 0x00, 0x36, 0x48, 0x61, 0x8b, 0x2d
+       , 0x54, 0xbb, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, 0x0a };
+
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreStableHeaders.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreStableHeaders.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreStableHeaders.h	(revision 148)
@@ -0,0 +1,82 @@
+/*
+-----------------------------------------------------------------------------
+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.
+-----------------------------------------------------------------------------
+*/
+
+/* Stable headers which will be used for precompilation if the compiler
+   supports it. Add entries here when headers are unlikely to change.
+   NB: a change to any of these headers will result in a full rebuild,
+   so don't add things to this lightly.
+*/
+
+#ifndef __OgreStableHeaders__
+#define __OgreStableHeaders__
+
+#include "OgrePlatform.h"
+
+#if (OGRE_PLATFORM == OGRE_PLATFORM_WIN32 && !defined(__MINGW32__)) || OGRE_PLATFORM == OGRE_PLATFORM_WINRT || OGRE_PLATFORM == OGRE_PLATFORM_APPLE || OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS
+#include "OgreArchive.h"
+#include "OgreAxisAlignedBox.h"
+#include "OgreBitwise.h"
+#include "OgreCamera.h"
+#include "OgreColourValue.h"
+#include "OgreCommon.h"
+#include "OgreDataStream.h"
+#include "OgreException.h"
+#include "OgreFileSystem.h"
+#include "OgreLog.h"
+#include "OgreMath.h"
+#include "OgreMatrix3.h"
+#include "OgreMatrix4.h"
+#include "OgreMovableObject.h"
+#include "OgreNode.h"
+#include "OgrePlane.h"
+#include "OgrePrerequisites.h"
+#include "OgreQuaternion.h"
+#include "OgreResource.h"
+#include "OgreSerializer.h"
+#include "OgreSharedPtr.h"
+#include "OgreSimpleRenderable.h"
+#include "OgreSimpleSpline.h"
+#include "OgreSingleton.h"
+#include "OgreSphere.h"
+#include "OgreStdHeaders.h"
+#include "OgreString.h"
+#include "OgreStringConverter.h"
+#include "OgreStringInterface.h"
+#include "OgreStringVector.h"
+#include "OgreUserObjectBindings.h"
+#include "OgreVector2.h"
+#include "OgreVector3.h"
+#include "OgreVector4.h"
+#include "OgreWireBoundingBox.h"
+#if OGRE_NO_ZIP_ARCHIVE == 0
+#	include "OgreZip.h"
+#endif
+
+#endif
+
+#endif 
Index: /ogre_src_v1-9-0/OgreMain/include/OgreStaticFaceGroup.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreStaticFaceGroup.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreStaticFaceGroup.h	(revision 148)
@@ -0,0 +1,141 @@
+/*
+-----------------------------------------------------------------------------
+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 __StaticFaceGroup_H__
+#define __StaticFaceGroup_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgrePlane.h"
+#include "OgrePatchSurface.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Scene
+	*  @{
+	*/
+	/** A type of face group, i.e. face list of procedural etc */
+    enum FaceGroupType {
+        FGT_FACE_LIST,
+        FGT_PATCH,
+        FGT_UNKNOWN
+    };
+
+    /** Collects a group of static i.e. immovable faces together which have common
+        properties like the material they use, the plane they lie on.
+        @remarks
+            Whilst for discrete geometry (i.e. movable objects) groups of faces are
+            held in the SubMesh class, for immovable objects like scenery there
+            needs to ba little more flexibility in the grouping since the group is
+            likely to be a small part of a huge set of geometry. In addition, because
+            the faces are unmoving certain optimisations can be performed, e.g.
+            precalculating a world-coordinate bounding box and normal.
+        @par
+            Exactly how this class is used depends on the format of the large
+            static geometry used in the level. An example would be the use of this
+            class in the BspNode class for indoor levels.
+            For flexibility and efficiency, it is not assumed that this class holds
+            details of the vertices itself, or in fact that it holds the vertex indices
+            itself. Everything is manipulated via pointers so if you want this
+            class to point into a block of geometry data it can.
+    */
+    struct StaticFaceGroup {
+        // Type of face group.
+        FaceGroupType fType;
+
+        /// Is this a sky surface?
+        bool isSky;
+
+        /** Index into a buffer containing vertex definitions. Because we're
+            dealing with subsets of large levels this is likely to be part-way
+            through a huge vertex buffer. */
+        int vertexStart;
+
+        /** The range of vertices in the buffer this facegroup references.
+            This is really for copying purposes only, so that we know which
+            subset of vertices to copy from our large-level buffer into the rendering buffer.
+        */
+        int numVertices;
+
+        /** Index into a buffer containing vertex indices. This buffer
+            may be individual to this group or shared for memory allocation
+            efficiency.The vertex indexes are relative the the mVertexStart pointer,
+            not to the start of the large-level buffer, allowing simple reindexing
+            when copying data into rendering buffers.
+            This is only applicable to FGT_FACE_LIST face group types.
+        */
+        int elementStart;
+
+        /** The number of vertex indices.
+            This is only applicable to FGT_FACE_LIST face group types.
+        */
+        int numElements;
+
+        /** Handle to material used by this group.
+            Note the use of the material handle rather than the material
+            name - this is for efficiency since there will be many of these.
+        */
+        ResourceHandle materialHandle;
+
+        Plane plane;
+
+        /// Patch surface (only applicable when fType = FGT_PATCH)
+        PatchSurface* patchSurf;
+
+
+        _OgreExport friend std::ostream& operator<<(std::ostream& o, const StaticFaceGroup& s)
+        {
+            o << "StaticFaceGroup(";
+            if (s.fType == FGT_FACE_LIST)
+            {
+                o << "faceList, numVertices=" << s.numVertices << ", vertexStart=" << s.vertexStart;
+                o << ", numElements=" << s.numElements << ", elementStart=" << s.elementStart;
+                o << ", normal=" << s.plane.normal;
+            }
+            else if (s.fType == FGT_PATCH)
+            {
+                o << "bezierPatch, numVertices=" << s.numVertices << ", vertexStart=" << s.vertexStart;
+                // TODO
+            }
+
+            o << ", materialHandle=" << s.materialHandle;
+            o << ")";
+
+            return o;
+        }
+
+
+    };
+	/** @} */
+	/** @} */
+
+} // namespace
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreStaticGeometry.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreStaticGeometry.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreStaticGeometry.h	(revision 148)
@@ -0,0 +1,784 @@
+/*
+-----------------------------------------------------------------------------
+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 __StaticGeometry_H__
+#define __StaticGeometry_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreMovableObject.h"
+#include "OgreRenderable.h"
+#include "OgreMesh.h"
+#include "OgreLodStrategy.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Scene
+	*  @{
+	*/
+	/** Pre-transforms and batches up meshes for efficient use as static
+		geometry in a scene.
+	@remarks
+		Modern graphics cards (GPUs) prefer to receive geometry in large
+		batches. It is orders of magnitude faster to render 10 batches
+		of 10,000 triangles than it is to render 10,000 batches of 10 
+		triangles, even though both result in the same number of on-screen
+		triangles.
+	@par
+		Therefore it is important when you are rendering a lot of geometry to 
+		batch things up into as few rendering calls as possible. This
+		class allows you to build a batched object from a series of entities 
+		in order to benefit from this behaviour.
+		Batching has implications of it's own though:
+		@li Batched geometry cannot be subdivided; that means that the whole
+			group will be displayed, or none of it will. This obivously has
+			culling issues.
+		@li A single world transform must apply to the entire batch. Therefore
+			once you have batched things, you can't move them around relative to
+			each other. That's why this class is most useful when dealing with 
+			static geometry (hence the name). In addition, geometry is 
+			effectively duplicated, so if you add 3 entities based on the same 
+			mesh in different positions, they will use 3 times the geometry 
+			space than the movable version (which re-uses the same geometry). 
+			So you trade memory	and flexibility of movement for pure speed when
+			using this class.
+		@li A single material must apply for each batch. In fact this class 
+			allows you to use multiple materials, but you should be aware that 
+			internally this means that there is one batch per material. 
+			Therefore you won't gain as much benefit from the batching if you 
+			use many different materials; try to keep the number down.
+	@par
+		In order to retain some sort of culling, this class will batch up 
+		meshes in localised regions. The size and shape of these blocks is
+		controlled by the SceneManager which constructs this object, since it
+		makes sense to batch things up in the most appropriate way given the 
+		existing partitioning of the scene. 
+	@par
+		The LOD settings of both the Mesh and the Materials used in 
+		constructing this static geometry will be respected. This means that 
+		if you use meshes/materials which have LOD, batches in the distance 
+		will have a lower polygon count or material detail to those in the 
+		foreground. Since each mesh might have different LOD distances, during 
+		build the furthest distance at each LOD level from all meshes  
+		in that region is used. This means all the LOD levels change at the 
+		same time, but at the furthest distance of any of them (so quality is 
+		not degraded). Be aware that using Mesh LOD in this class will 
+		further increase the memory required. Only generated LOD
+		is supported for meshes.
+	@par
+		There are 2 ways you can add geometry to this class; you can add
+		Entity objects directly with predetermined positions, scales and 
+		orientations, or you can add an entire SceneNode and it's subtree, 
+		including all the objects attached to it. Once you've added everything
+		you need to, you have to call build() the fix the geometry in place. 
+	@note
+		This class is not a replacement for world geometry (@see 
+		SceneManager::setWorldGeometry). The single most efficient way to 
+		render large amounts of static geometry is to use a SceneManager which 
+		is specialised for dealing with that particular world structure. 
+		However, this class does provide you with a good 'halfway house'
+		between generalised movable geometry (Entity) which works with all 
+		SceneManagers but isn't efficient when using very large numbers, and 
+		highly specialised world geometry which is extremely fast but not 
+		generic and typically requires custom world editors.
+	@par
+		You should not construct instances of this class directly; instead, cal 
+		SceneManager::createStaticGeometry, which gives the SceneManager the 
+		option of providing you with a specialised version of this class if it
+		wishes, and also handles the memory management for you like other 
+		classes.
+	@note
+		Warning: this class only works with indexed triangle lists at the moment,
+		do not pass it triangle strips, fans or lines / points, or unindexed geometry.
+	*/
+	class _OgreExport StaticGeometry : public BatchedGeometryAlloc
+	{
+	public:
+		/** Struct holding geometry optimised per SubMesh / LOD level, ready
+			for copying to instances. 
+		@remarks
+			Since we're going to be duplicating geometry lots of times, it's
+			far more important that we don't have redundant vertex data. If a 
+			SubMesh uses shared geometry, or we're looking at a lower LOD, not
+			all the vertices are being referenced by faces on that submesh.
+			Therefore to duplicate them, potentially hundreds or even thousands
+			of times, would be extremely wasteful. Therefore, if a SubMesh at
+			a given LOD has wastage, we create an optimised version of it's
+			geometry which is ready for copying with no wastage.
+		*/
+		class _OgrePrivate OptimisedSubMeshGeometry : public BatchedGeometryAlloc
+		{
+		public:
+			OptimisedSubMeshGeometry() :vertexData(0), indexData(0) {}
+			~OptimisedSubMeshGeometry() 
+			{
+				OGRE_DELETE vertexData;
+				OGRE_DELETE indexData;
+			}
+			VertexData *vertexData;
+			IndexData *indexData;
+		};
+		typedef list<OptimisedSubMeshGeometry*>::type OptimisedSubMeshGeometryList;
+		/// Saved link between SubMesh at a LOD and vertex/index data
+		/// May point to original or optimised geometry
+		struct SubMeshLodGeometryLink
+		{
+			VertexData* vertexData;
+			IndexData* indexData;
+		};
+		typedef vector<SubMeshLodGeometryLink>::type SubMeshLodGeometryLinkList;
+		typedef map<SubMesh*, SubMeshLodGeometryLinkList*>::type SubMeshGeometryLookup;
+		/// Structure recording a queued submesh for the build
+		struct QueuedSubMesh : public BatchedGeometryAlloc
+		{
+			SubMesh* submesh;
+			/// Link to LOD list of geometry, potentially optimised
+			SubMeshLodGeometryLinkList* geometryLodList;
+			String materialName;
+			Vector3 position;
+			Quaternion orientation;
+			Vector3 scale;
+			/// Pre-transformed world AABB 
+			AxisAlignedBox worldBounds;
+		};
+		typedef vector<QueuedSubMesh*>::type QueuedSubMeshList;
+		/// Structure recording a queued geometry for low level builds
+		struct QueuedGeometry : public BatchedGeometryAlloc
+		{
+			SubMeshLodGeometryLink* geometry;
+			Vector3 position;
+			Quaternion orientation;
+			Vector3 scale;
+		};
+		typedef vector<QueuedGeometry*>::type QueuedGeometryList;
+		
+		// forward declarations
+		class LODBucket;
+		class MaterialBucket;
+		class Region;
+
+		/** A GeometryBucket is a the lowest level bucket where geometry with 
+			the same vertex & index format is stored. It also acts as the 
+			renderable.
+		*/
+		class _OgreExport GeometryBucket :	public Renderable,  public BatchedGeometryAlloc
+		{
+		protected:
+			/// Geometry which has been queued up pre-build (not for deallocation)
+			QueuedGeometryList mQueuedGeometry;
+			/// Pointer to parent bucket
+			MaterialBucket* mParent;
+			/// String identifying the vertex / index format
+			String mFormatString;
+			/// Vertex information, includes current number of vertices
+			/// committed to be a part of this bucket
+			VertexData* mVertexData;
+			/// Index information, includes index type which limits the max
+			/// number of vertices which are allowed in one bucket
+			IndexData* mIndexData;
+			/// Size of indexes
+			HardwareIndexBuffer::IndexType mIndexType;
+			/// Maximum vertex indexable
+			size_t mMaxVertexIndex;
+
+			template<typename T>
+			void copyIndexes(const T* src, T* dst, size_t count, size_t indexOffset)
+			{
+				if (indexOffset == 0)
+				{
+					memcpy(dst, src, sizeof(T) * count);
+				}
+				else
+				{
+					while(count--)
+					{
+						*dst++ = static_cast<T>(*src++ + indexOffset);
+					}
+				}
+			}
+		public:
+			GeometryBucket(MaterialBucket* parent, const String& formatString, 
+				const VertexData* vData, const IndexData* iData);
+			virtual ~GeometryBucket();
+			MaterialBucket* getParent(void) { return mParent; }
+			/// Get the vertex data for this geometry 
+			const VertexData* getVertexData(void) const { return mVertexData; }
+			/// Get the index data for this geometry 
+			const IndexData* getIndexData(void) const { return mIndexData; }
+			/// @copydoc Renderable::getMaterial
+			const MaterialPtr& getMaterial(void) const;
+			Technique* getTechnique(void) const;
+			void getRenderOperation(RenderOperation& op);
+	        void getWorldTransforms(Matrix4* xform) const;
+			Real getSquaredViewDepth(const Camera* cam) const;
+	        const LightList& getLights(void) const;
+			bool getCastsShadows(void) const;
+			
+			/** Try to assign geometry to this bucket.
+			@return false if there is no room left in this bucket
+			*/
+			bool assign(QueuedGeometry* qsm);
+			/// Build
+			void build(bool stencilShadows);
+			/// Dump contents for diagnostics
+			void dump(std::ofstream& of) const;
+		};
+		/** A MaterialBucket is a collection of smaller buckets with the same 
+			Material (and implicitly the same LOD). */
+		class _OgreExport MaterialBucket : public BatchedGeometryAlloc
+		{
+		public:
+			/// list of Geometry Buckets in this region
+			typedef vector<GeometryBucket*>::type GeometryBucketList;
+		protected:
+			/// Pointer to parent LODBucket
+			LODBucket* mParent;
+			/// Material being used
+			String mMaterialName;
+			/// Pointer to material being used
+			MaterialPtr mMaterial;
+			/// Active technique
+			Technique* mTechnique;
+
+			/// list of Geometry Buckets in this region
+			GeometryBucketList mGeometryBucketList;
+			// index to current Geometry Buckets for a given geometry format
+			typedef map<String, GeometryBucket*>::type CurrentGeometryMap;
+			CurrentGeometryMap mCurrentGeometryMap;
+			/// Get a packed string identifying the geometry format
+			String getGeometryFormatString(SubMeshLodGeometryLink* geom);
+			
+		public:
+			MaterialBucket(LODBucket* parent, const String& materialName);
+			virtual ~MaterialBucket();
+			LODBucket* getParent(void) { return mParent; }
+			/// Get the material name
+			const String& getMaterialName(void) const { return mMaterialName; }
+			/// Assign geometry to this bucket
+			void assign(QueuedGeometry* qsm);
+			/// Build
+			void build(bool stencilShadows);
+			/// Add children to the render queue
+			void addRenderables(RenderQueue* queue, uint8 group, 
+				Real lodValue);
+			/// Get the material for this bucket
+			const MaterialPtr& getMaterial(void) const { return mMaterial; }
+			/// Iterator over geometry
+			typedef VectorIterator<GeometryBucketList> GeometryIterator;
+			/// Get an iterator over the contained geometry
+			GeometryIterator getGeometryIterator(void);
+			/// Get the current Technique
+			Technique* getCurrentTechnique(void) const { return mTechnique; }
+			/// Dump contents for diagnostics
+			void dump(std::ofstream& of) const;
+			void visitRenderables(Renderable::Visitor* visitor, bool debugRenderables);
+		};
+		/** A LODBucket is a collection of smaller buckets with the same LOD. 
+		@remarks
+			LOD refers to Mesh LOD here. Material LOD can change separately
+			at the next bucket down from this.
+		*/
+		class _OgreExport LODBucket : public BatchedGeometryAlloc
+		{
+		public:
+			/// Lookup of Material Buckets in this region
+			typedef map<String, MaterialBucket*>::type MaterialBucketMap;
+		protected:
+			/** Nested class to allow shadows. */
+			class _OgreExport LODShadowRenderable : public ShadowRenderable
+			{
+			protected:
+				LODBucket* mParent;
+				// Shared link to position buffer
+				HardwareVertexBufferSharedPtr mPositionBuffer;
+				// Shared link to w-coord buffer (optional)
+				HardwareVertexBufferSharedPtr mWBuffer;
+
+			public:
+				LODShadowRenderable(LODBucket* parent, 
+					HardwareIndexBufferSharedPtr* indexBuffer, const VertexData* vertexData, 
+					bool createSeparateLightCap, bool isLightCap = false);
+				~LODShadowRenderable();
+				/// Overridden from ShadowRenderable
+				void getWorldTransforms(Matrix4* xform) const;
+				HardwareVertexBufferSharedPtr getPositionBuffer(void) { return mPositionBuffer; }
+				HardwareVertexBufferSharedPtr getWBuffer(void) { return mWBuffer; }
+				/// Overridden from ShadowRenderable
+				virtual void rebindIndexBuffer(const HardwareIndexBufferSharedPtr& indexBuffer);
+
+			};
+			/// Pointer to parent region
+			Region* mParent;
+			/// LOD level (0 == full LOD)
+			unsigned short mLod;
+			/// LOD value at which this LOD starts to apply (squared)
+			Real mLodValue;
+			/// Lookup of Material Buckets in this region
+			MaterialBucketMap mMaterialBucketMap;
+			/// Geometry queued for a single LOD (deallocated here)
+			QueuedGeometryList mQueuedGeometryList;
+			/// Edge list, used if stencil shadow casting is enabled 
+			EdgeData* mEdgeList;
+			/// Is a vertex program in use somewhere in this group?
+			bool mVertexProgramInUse;
+			/// List of shadow renderables
+			ShadowCaster::ShadowRenderableList mShadowRenderables;
+		public:
+			LODBucket(Region* parent, unsigned short lod, Real lodValue);
+			virtual ~LODBucket();
+			Region* getParent(void) { return mParent; }
+			/// Get the LOD index
+			ushort getLod(void) const { return mLod; }
+			/// Get the LOD value
+			Real getLodValue(void) const { return mLodValue; }
+			/// Assign a queued submesh to this bucket, using specified mesh LOD
+			void assign(QueuedSubMesh* qsm, ushort atLod);
+			/// Build
+			void build(bool stencilShadows);
+			/// Add children to the render queue
+			void addRenderables(RenderQueue* queue, uint8 group, 
+				Real lodValue);
+			/// Iterator over the materials in this LOD
+			typedef MapIterator<MaterialBucketMap> MaterialIterator;
+			/// Get an iterator over the materials in this LOD
+			MaterialIterator getMaterialIterator(void);
+			/// Dump contents for diagnostics
+			void dump(std::ofstream& of) const;
+			void visitRenderables(Renderable::Visitor* visitor, bool debugRenderables);
+			EdgeData* getEdgeList() const { return mEdgeList; }
+			ShadowCaster::ShadowRenderableList& getShadowRenderableList() { return mShadowRenderables; }
+			bool isVertexProgramInUse() const { return mVertexProgramInUse; }
+			void updateShadowRenderables(
+				ShadowTechnique shadowTechnique, const Vector4& lightPos, 
+				HardwareIndexBufferSharedPtr* indexBuffer, 
+				bool extrudeVertices, Real extrusionDistance, unsigned long flags = 0 );
+			
+		};
+		/** The details of a topological region which is the highest level of
+			partitioning for this class.
+		@remarks
+			The size & shape of regions entirely depends on the SceneManager
+			specific implementation. It is a MovableObject since it will be
+			attached to a node based on the local centre - in practice it
+			won't actually move (although in theory it could).
+		*/
+		class _OgreExport Region : public MovableObject
+		{
+            friend class MaterialBucket;
+            friend class GeometryBucket;
+		public:
+			/// list of LOD Buckets in this region
+			typedef vector<LODBucket*>::type LODBucketList;
+		protected:
+			/// Parent static geometry
+			StaticGeometry* mParent;
+			/// Scene manager link
+			SceneManager* mSceneMgr;
+			/// Scene node
+			SceneNode* mNode;
+			/// Local list of queued meshes (not used for deallocation)
+			QueuedSubMeshList mQueuedSubMeshes;
+			/// Unique identifier for the region
+			uint32 mRegionID;
+			/// Center of the region
+			Vector3 mCentre;
+			/// LOD values as built up - use the max at each level
+			Mesh::LodValueList mLodValues;
+			/// Local AABB relative to region centre
+			AxisAlignedBox mAABB;
+			/// Local bounding radius
+			Real mBoundingRadius;
+			/// The current LOD level, as determined from the last camera
+			ushort mCurrentLod;
+			/// Current LOD value, passed on to do material LOD later
+			Real mLodValue;
+			/// List of LOD buckets			
+			LODBucketList mLodBucketList;
+			/// List of lights for this region
+			mutable LightList mLightList;
+			/// The last frame that this light list was updated in
+			mutable ulong mLightListUpdated;
+            /// LOD strategy reference
+            const LodStrategy *mLodStrategy;
+            /// Current camera
+            Camera *mCamera;
+            /// Cached squared view depth value to avoid recalculation by GeometryBucket
+            Real mSquaredViewDepth;
+
+		public:
+			Region(StaticGeometry* parent, const String& name, SceneManager* mgr, 
+				uint32 regionID, const Vector3& centre);
+			virtual ~Region();
+			// more fields can be added in subclasses
+			StaticGeometry* getParent(void) const { return mParent;}
+			/// Assign a queued mesh to this region, read for final build
+			void assign(QueuedSubMesh* qmesh);
+			/// Build this region
+			void build(bool stencilShadows);
+			/// Get the region ID of this region
+			uint32 getID(void) const { return mRegionID; }
+			/// Get the centre point of the region
+			const Vector3& getCentre(void) const { return mCentre; }
+			const String& getMovableType(void) const;
+			void _notifyCurrentCamera(Camera* cam);
+			const AxisAlignedBox& getBoundingBox(void) const;
+			Real getBoundingRadius(void) const;
+			void _updateRenderQueue(RenderQueue* queue);
+			/// @copydoc MovableObject::visitRenderables
+			void visitRenderables(Renderable::Visitor* visitor, 
+				bool debugRenderables = false);
+			bool isVisible(void) const;
+			uint32 getTypeFlags(void) const;
+
+			typedef VectorIterator<LODBucketList> LODIterator;
+			/// Get an iterator over the LODs in this region
+			LODIterator getLODIterator(void);
+			/// @copydoc ShadowCaster::getShadowVolumeRenderableIterator
+			ShadowRenderableListIterator getShadowVolumeRenderableIterator(
+				ShadowTechnique shadowTechnique, const Light* light, 
+				HardwareIndexBufferSharedPtr* indexBuffer, size_t* indexBufferUsedSize,
+				bool extrudeVertices, Real extrusionDistance, unsigned long flags = 0 );
+			/// Overridden from MovableObject
+			EdgeData* getEdgeList(void);
+			/** Overridden member from ShadowCaster. */
+			bool hasEdgeList(void);
+
+			/// Dump contents for diagnostics
+			void dump(std::ofstream& of) const;
+			
+		};
+		/** Indexed region map based on packed x/y/z region index, 10 bits for
+			each axis.
+		@remarks
+			Regions are indexed 0-1023 in all axes, where for example region 
+			0 in the x axis begins at mOrigin.x + (mRegionDimensions.x * -512), 
+			and region 1023 ends at mOrigin + (mRegionDimensions.x * 512).
+		*/
+		typedef map<uint32, Region*>::type RegionMap;
+	protected:
+		// General state & settings
+		SceneManager* mOwner;
+		String mName;
+		bool mBuilt;
+		Real mUpperDistance;
+		Real mSquaredUpperDistance;
+		bool mCastShadows;
+		Vector3 mRegionDimensions;
+		Vector3 mHalfRegionDimensions;
+		Vector3 mOrigin;
+		bool mVisible;
+        /// The render queue to use when rendering this object
+        uint8 mRenderQueueID;
+		/// Flags whether the RenderQueue's default should be used.
+		bool mRenderQueueIDSet;
+		/// Stores the visibility flags for the regions
+		uint32 mVisibilityFlags;
+
+		QueuedSubMeshList mQueuedSubMeshes;
+
+		/// List of geometry which has been optimised for SubMesh use
+		/// This is the primary storage used for cleaning up later
+		OptimisedSubMeshGeometryList mOptimisedSubMeshGeometryList;
+
+		/** Cached links from SubMeshes to (potentially optimised) geometry
+			This is not used for deletion since the lookup may reference
+			original vertex data
+		*/
+		SubMeshGeometryLookup mSubMeshGeometryLookup;
+			
+		/// Map of regions
+		RegionMap mRegionMap;
+
+		/** Virtual method for getting a region most suitable for the
+			passed in bounds. Can be overridden by subclasses.
+		*/
+		virtual Region* getRegion(const AxisAlignedBox& bounds, bool autoCreate);
+		/** Get the region within which a point lies */
+		virtual Region* getRegion(const Vector3& point, bool autoCreate);
+		/** Get the region using indexes */
+		virtual Region* getRegion(ushort x, ushort y, ushort z, bool autoCreate);
+		/** Get the region using a packed index, returns null if it doesn't exist. */
+		virtual Region* getRegion(uint32 index);
+		/** Get the region indexes for a point.
+		*/
+		virtual void getRegionIndexes(const Vector3& point, 
+			ushort& x, ushort& y, ushort& z);
+		/** Pack 3 indexes into a single index value
+		*/
+		virtual uint32 packIndex(ushort x, ushort y, ushort z);
+		/** Get the volume intersection for an indexed region with some bounds.
+		*/
+		virtual Real getVolumeIntersection(const AxisAlignedBox& box,  
+			ushort x, ushort y, ushort z);
+		/** Get the bounds of an indexed region.
+		*/
+		virtual AxisAlignedBox getRegionBounds(ushort x, ushort y, ushort z);
+		/** Get the centre of an indexed region.
+		*/
+		virtual Vector3 getRegionCentre(ushort x, ushort y, ushort z);
+		/** Calculate world bounds from a set of vertex data. */
+		virtual AxisAlignedBox calculateBounds(VertexData* vertexData, 
+			const Vector3& position, const Quaternion& orientation, 
+			const Vector3& scale);
+		/** Look up or calculate the geometry data to use for this SubMesh */
+		SubMeshLodGeometryLinkList* determineGeometry(SubMesh* sm);
+		/** Split some shared geometry into dedicated geometry. */
+		void splitGeometry(VertexData* vd, IndexData* id, 
+			SubMeshLodGeometryLink* targetGeomLink);
+
+		typedef map<size_t, size_t>::type IndexRemap;
+		/** Method for figuring out which vertices are used by an index buffer
+			and calculating a remap lookup for a vertex buffer just containing
+			those vertices. 
+		*/
+		template <typename T>
+		void buildIndexRemap(T* pBuffer, size_t numIndexes, IndexRemap& remap)
+		{
+			remap.clear();
+			for (size_t i = 0; i < numIndexes; ++i)
+			{
+				// use insert since duplicates are silently discarded
+				remap.insert(IndexRemap::value_type(*pBuffer++, remap.size()));
+				// this will have mapped oldindex -> new index IF oldindex
+				// wasn't already there
+			}
+		}
+		/** Method for altering indexes based on a remap. */
+		template <typename T>
+		void remapIndexes(T* src, T* dst, const IndexRemap& remap, 
+				size_t numIndexes)
+		{
+			for (size_t i = 0; i < numIndexes; ++i)
+			{
+				// look up original and map to target
+				IndexRemap::const_iterator ix = remap.find(*src++);
+				assert(ix != remap.end());
+				*dst++ = static_cast<T>(ix->second);
+			}
+		}
+		
+	public:
+		/// Constructor; do not use directly (@see SceneManager::createStaticGeometry)
+		StaticGeometry(SceneManager* owner, const String& name);
+		/// Destructor
+		virtual ~StaticGeometry();
+
+		/// Get the name of this object
+		const String& getName(void) const { return mName; }
+		/** Adds an Entity to the static geometry.
+		@remarks
+			This method takes an existing Entity and adds its details to the 
+			list of	elements to include when building. Note that the Entity
+			itself is not copied or referenced in this method; an Entity is 
+			passed simply so that you can change the materials of attached 
+			SubEntity objects if you want. You can add the same Entity 
+			instance multiple times with different material settings 
+			completely safely, and destroy the Entity before destroying 
+			this StaticGeometry if you like. The Entity passed in is simply 
+			used as a definition.
+		@note Must be called before 'build'.
+		@param ent The Entity to use as a definition (the Mesh and Materials 
+			referenced will be recorded for the build call).
+		@param position The world position at which to add this Entity
+		@param orientation The world orientation at which to add this Entity
+		@param scale The scale at which to add this entity
+		*/
+		virtual void addEntity(Entity* ent, const Vector3& position,
+			const Quaternion& orientation = Quaternion::IDENTITY, 
+			const Vector3& scale = Vector3::UNIT_SCALE);
+
+		/** Adds all the Entity objects attached to a SceneNode and all it's
+			children to the static geometry.
+		@remarks
+			This method performs just like addEntity, except it adds all the 
+			entities attached to an entire sub-tree to the geometry. 
+			The position / orientation / scale parameters are taken from the
+			node structure instead of being specified manually. 
+		@note
+			The SceneNode you pass in will not be automatically detached from 
+			it's parent, so if you have this node already attached to the scene
+			graph, you will need to remove it if you wish to avoid the overhead
+			of rendering <i>both</i> the original objects and their new static
+			versions! We don't do this for you incase you are preparing this 
+			in advance and so don't want the originals detached yet. 
+		@note Must be called before 'build'.
+		@param node Pointer to the node to use to provide a set of Entity 
+			templates
+		*/
+		virtual void addSceneNode(const SceneNode* node);
+
+		/** Build the geometry. 
+		@remarks
+			Based on all the entities which have been added, and the batching 
+			options which have been set, this method constructs	the batched 
+			geometry structures required. The batches are added to the scene 
+			and will be rendered unless you specifically hide them.
+		@note
+			Once you have called this method, you can no longer add any more 
+			entities.
+		*/
+		virtual void build(void);
+
+		/** Destroys all the built geometry state (reverse of build). 
+		@remarks
+			You can call build() again after this and it will pick up all the
+			same entities / nodes you queued last time.
+		*/
+		virtual void destroy(void);
+
+		/** Clears any of the entities / nodes added to this geometry and 
+			destroys anything which has already been built.
+		*/
+		virtual void reset(void);
+
+		/** Sets the distance at which batches are no longer rendered.
+		@remarks
+			This lets you turn off batches at a given distance. This can be 
+			useful for things like detail meshes (grass, foliage etc) and could
+			be combined with a shader which fades the geometry out beforehand 
+			to lessen the effect.
+		@param dist Distance beyond which the batches will not be rendered 
+			(the default is 0, which means batches are always rendered).
+		*/
+		virtual void setRenderingDistance(Real dist) { 
+			mUpperDistance = dist; 
+			mSquaredUpperDistance = mUpperDistance * mUpperDistance;
+		}
+
+		/** Gets the distance at which batches are no longer rendered. */
+		virtual Real getRenderingDistance(void) const { return mUpperDistance; }
+
+		/** Gets the squared distance at which batches are no longer rendered. */
+		virtual Real getSquaredRenderingDistance(void) const 
+		{ return mSquaredUpperDistance; }
+
+		/** Hides or shows all the batches. */
+		virtual void setVisible(bool visible);
+
+		/** Are the batches visible? */
+		virtual bool isVisible(void) const { return mVisible; }
+
+		/** Sets whether this geometry should cast shadows.
+		@remarks
+			No matter what the settings on the original entities,
+			the StaticGeometry class defaults to not casting shadows. 
+			This is because, being static, unless you have moving lights
+			you'd be better to use precalculated shadows of some sort.
+			However, if you need them, you can enable them using this
+			method. If the SceneManager is set up to use stencil shadows,
+			edge lists will be copied from the underlying meshes on build.
+			It is essential that all meshes support stencil shadows in this
+			case.
+		@note If you intend to use stencil shadows, you must set this to 
+			true before calling 'build' as well as making sure you set the
+			scene's shadow type (that should always be the first thing you do
+			anyway). You can turn shadows off temporarily but they can never 
+			be turned on if they were not at the time of the build. 
+		*/
+		virtual void setCastShadows(bool castShadows);
+		/// Will the geometry from this object cast shadows?
+		virtual bool getCastShadows(void) { return mCastShadows; }
+
+		/** Sets the size of a single region of geometry.
+		@remarks
+			This method allows you to configure the physical world size of 
+			each region, so you can balance culling against batch size. Entities
+			will be fitted within the batch they most closely fit, and the 
+			eventual bounds of each batch may well be slightly larger than this
+			if they overlap a little. The default is Vector3(1000, 1000, 1000).
+		@note Must be called before 'build'.
+		@param size Vector3 expressing the 3D size of each region.
+		*/
+		virtual void setRegionDimensions(const Vector3& size) { 
+			mRegionDimensions = size; 
+			mHalfRegionDimensions = size * 0.5;
+		}
+		/** Gets the size of a single batch of geometry. */
+		virtual const Vector3& getRegionDimensions(void) const { return mRegionDimensions; }
+		/** Sets the origin of the geometry.
+		@remarks
+			This method allows you to configure the world centre of the geometry,
+			thus the place which all regions surround. You probably don't need 
+			to mess with this unless you have a seriously large world, since the
+			default set up can handle an area 1024 * mRegionDimensions, and 
+			the sparseness of population is no issue when it comes to rendering.
+			The default is Vector3(0,0,0).
+		@note Must be called before 'build'.
+		@param origin Vector3 expressing the 3D origin of the geometry.
+		*/
+		virtual void setOrigin(const Vector3& origin) { mOrigin = origin; }
+		/** Gets the origin of this geometry. */
+		virtual const Vector3& getOrigin(void) const { return mOrigin; }
+
+		/// Sets the visibility flags of all the regions at once
+		void setVisibilityFlags(uint32 flags);
+		/// Returns the visibility flags of the regions
+		uint32 getVisibilityFlags() const;
+
+        /** Sets the render queue group this object will be rendered through.
+        @remarks
+            Render queues are grouped to allow you to more tightly control the ordering
+            of rendered objects. If you do not call this method, all  objects default
+            to the default queue (RenderQueue::getDefaultQueueGroup), which is fine for 
+			most objects. You may want to alter this if you want to perform more complex
+			rendering.
+        @par
+            See RenderQueue for more details.
+        @param queueID Enumerated value of the queue group to use.
+        */
+        virtual void setRenderQueueGroup(uint8 queueID);
+
+        /** Gets the queue group for this entity, see setRenderQueueGroup for full details. */
+        virtual uint8 getRenderQueueGroup(void) const;
+		/// @copydoc MovableObject::visitRenderables
+		void visitRenderables(Renderable::Visitor* visitor, 
+			bool debugRenderables = false);
+		
+		/// Iterator for iterating over contained regions
+		typedef MapIterator<RegionMap> RegionIterator;
+		/// Get an iterator over the regions in this geometry
+		RegionIterator getRegionIterator(void);
+
+		/** Dump the contents of this StaticGeometry to a file for diagnostic
+		 	purposes.
+		*/
+		virtual void dump(const String& filename) const;
+
+
+	};
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreStdHeaders.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreStdHeaders.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreStdHeaders.h	(revision 148)
@@ -0,0 +1,123 @@
+#ifndef __StdHeaders_H__
+#define __StdHeaders_H__
+
+#ifdef __BORLANDC__
+    #define __STD_ALGORITHM
+#endif
+
+#if defined ( OGRE_GCC_VISIBILITY ) && ((OGRE_PLATFORM == OGRE_PLATFORM_APPLE && !__LP64__) && OGRE_PLATFORM != OGRE_PLATFORM_APPLE_IOS)
+/* Until libstdc++ for gcc 4.2 is released, we have to declare all
+ * symbols in libstdc++.so externally visible, otherwise we end up
+ * with them marked as hidden by -fvisible=hidden.
+ *
+ * See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=20218
+ *
+ * Due to a more strict linker included with Xcode 4, this is disabled on Mac OS X and iOS.
+ * The reason? It changes the visibility of Boost functions.  The mismatch between visibility Boost when used in Ogre (default)
+ * and Boost when compiled (hidden) results in mysterious link errors such as "Bad codegen, pointer diff".
+ */
+#   pragma GCC visibility push(default)
+#endif
+
+#include <cassert>
+#include <cstdio>
+#include <cstdlib>
+#include <ctime>
+#include <cstring>
+#include <cstdarg>
+#include <cmath>
+
+// STL containers
+#include <vector>
+#include <map>
+#include <string>
+#include <set>
+#include <list>
+#include <deque>
+#include <queue>
+#include <bitset>
+
+// Note - not in the original STL, but exists in SGI STL and STLport
+// For gcc 4.3 see http://gcc.gnu.org/gcc-4.3/changes.html
+#if (OGRE_COMPILER == OGRE_COMPILER_GNUC) && !defined(STLPORT)
+#   if OGRE_COMP_VER >= 430
+#       include <tr1/unordered_map>
+#       include <tr1/unordered_set> 
+#   else
+#       include <ext/hash_map>
+#       include <ext/hash_set>
+#   endif
+#elif (OGRE_COMPILER == OGRE_COMPILER_CLANG)
+#   if defined(_LIBCPP_VERSION)
+#       include <unordered_map>
+#       include <unordered_set>
+#   else
+#       include <tr1/unordered_map>
+#       include <tr1/unordered_set>
+#   endif
+#elif !defined(STLPORT)
+#   if (OGRE_COMPILER == OGRE_COMPILER_MSVC) && _MSC_FULL_VER >= 150030729 // VC++ 9.0 SP1+
+#    	include <unordered_map>
+#    	include <unordered_set>
+#   elif OGRE_THREAD_PROVIDER == 1
+#       include <boost/unordered_map.hpp>
+#       include <boost/unordered_set.hpp>
+#   else
+#   	error "Your compiler doesn't support unordered_set and unordered_map. Try to compile Ogre with Boost or STLPort."
+#	endif
+#endif 
+
+// STL algorithms & functions
+#include <algorithm>
+#include <functional>
+#include <limits>
+
+// C++ Stream stuff
+#include <fstream>
+#include <iostream>
+#include <iomanip>
+#include <sstream>
+
+#ifdef __BORLANDC__
+namespace Ogre
+{
+    using namespace std;
+}
+#endif
+
+extern "C" {
+
+#   include <sys/types.h>
+#   include <sys/stat.h>
+
+}
+
+#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WINRT
+#  undef min
+#  undef max
+#  if defined( __MINGW32__ )
+#    include <unistd.h>
+#  endif
+#endif
+
+#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX || OGRE_PLATFORM == OGRE_PLATFORM_ANDROID
+extern "C" {
+
+#   include <unistd.h>
+#   include <dlfcn.h>
+
+}
+#endif
+
+#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE || OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS
+extern "C" {
+#   include <unistd.h>
+#   include <sys/param.h>
+#   include <CoreFoundation/CoreFoundation.h>
+}
+#endif
+
+#if defined ( OGRE_GCC_VISIBILITY ) && ((OGRE_PLATFORM == OGRE_PLATFORM_APPLE && !__LP64__) && OGRE_PLATFORM != OGRE_PLATFORM_APPLE_IOS)
+#   pragma GCC visibility pop
+#endif
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreStreamSerialiser.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreStreamSerialiser.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreStreamSerialiser.h	(revision 148)
@@ -0,0 +1,396 @@
+/*
+-----------------------------------------------------------------------------
+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 __StreamSerialiser_H__
+#define __StreamSerialiser_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreDataStream.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre 
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Resources
+	*  @{
+	*/
+
+	/** Utility class providing helper methods for reading / writing 
+		structured data held in a DataStream.
+	@remarks
+		The structure of a file read / written by this class is a series of 
+		'chunks'. A chunk-based format has the advantage of being extensible later, 
+		and it's robust, in that a reader can skip chunks that they are not 
+		able (or willing) to process.
+	@par
+		Chunks are contained serially in the file, but they can also be 
+		nested in order both to provide context, and to group chunks together for 
+		potential skipping. 
+	@par
+		The data format of a chunk is as follows:
+		-# Chunk ID (32-bit uint). This can be any number unique in a context, except the numbers 0x0000, 0x0001 and 0x1000, which are reserved for Ogre's use
+		-# Chunk version (16-bit uint). Chunks can change over time so this version number reflects that
+		-# Length (32-bit uint). The length of the chunk data section, including nested chunks. Note that
+			this length excludes this header, but includes the header of any nested chunks. 
+		-# Checksum (32-bit uint). Checksum value generated from the above - basically lets us check this is a valid chunk.
+		-# Chunk data
+		The 'Chunk data' section will contain chunk-specific data, which may include
+		other nested chunks.
+	*/
+	class _OgreExport StreamSerialiser : public StreamAlloc
+	{
+	public:
+		/// The endianness of files
+		enum Endian
+		{
+			/// Automatically determine endianness
+			ENDIAN_AUTO,
+			/// Use big endian (0x1000 is serialised as 0x10 0x00)
+			ENDIAN_BIG,
+			/// Use little endian (0x1000 is serialised as 0x00 0x10)
+			ENDIAN_LITTLE
+		};
+
+		/// The storage format of Real values
+		enum RealStorageFormat
+		{
+			/// Real is stored as float, reducing precision if you're using OGRE_DOUBLE_PRECISION
+			REAL_FLOAT,
+			/// Real as stored as double, not useful unless you're using OGRE_DOUBLE_PRECISION
+			REAL_DOUBLE
+		};
+
+
+		/// Definition of a chunk of data in a file
+		struct Chunk : public StreamAlloc
+		{
+			/// Identifier of the chunk (for example from makeIdentifier)  (stored)
+			uint32 id;
+			/// Version of the chunk (stored)
+			uint16 version;
+			/// Length of the chunk data in bytes, excluding the header of this chunk (stored)
+			uint32 length;
+			/// Location of the chunk (header) in bytes from the start of a stream (derived)
+			uint32 offset;
+
+			Chunk() : id(0), version(1), length(0), offset(0) {}
+		};
+
+		/** Constructor.
+		@param stream The stream on which you will read / write data.
+		@param endianMode The endian mode in which to read / writedata. If left at
+			the default, when writing the endian mode will be the native platform mode, 
+			and when reading it's expected that the first chunk encountered will be 
+			the header chunk, which will determine the endian mode.
+		@param autoHeader If true, the first write or read to this stream will 
+			automatically read / write the header too. This is required if you
+			set endianMode to ENDIAN_AUTO, but if you manually set the endian mode, 
+			then you can skip writing / reading the header if you wish, if for example
+			this stream is midway through a file which has already included header
+			information.
+		@param realFormat Set the format you want to write reals in. Only useful for files that 
+			you're writing (since when reading this is picked up from the file), 
+			and can only be changed if autoHeader is true, since real format is stored in the header. 
+			Defaults to float unless you're using OGRE_DOUBLE_PRECISION.
+		*/
+		StreamSerialiser(const DataStreamPtr& stream, Endian endianMode = ENDIAN_AUTO, 
+			bool autoHeader = true, 
+#if OGRE_DOUBLE_PRECISION
+			RealStorageFormat realFormat = REAL_DOUBLE
+#else
+			RealStorageFormat realFormat = REAL_FLOAT
+#endif
+			);
+		virtual ~StreamSerialiser();
+
+		/** Get the endian mode.
+		@remarks
+			If the result is ENDIAN_AUTO, this mode will change when the first piece of
+			data is read / written. 
+		*/
+		virtual Endian getEndian() const { return mEndian; }
+
+		/** Pack a 4-character code into a 32-bit identifier.
+		@remarks
+			You can use this to generate id's for your chunks based on friendlier
+			4-character codes rather than assigning numerical IDs, if you like.
+		@param code String to pack - must be 4 characters.
+		*/
+		static uint32 makeIdentifier(const String& code);
+
+		/** Report the current depth of the chunk nesting, whether reading or writing. 
+		@remarks
+			Returns how many levels of nested chunks are currently being processed, 
+			either writing or reading. In order to tidily finish, you must call
+			read/writeChunkEnd this many times.
+		*/
+		size_t getCurrentChunkDepth() const { return mChunkStack.size(); }
+
+		/** Get the ID of the chunk that's currently being read/written, if any.
+		@return The id of the current chunk being read / written (at the tightest
+			level of nesting), or zero if no chunk is being processed.
+		*/
+		uint32 getCurrentChunkID() const;
+
+		/** Get the current byte position relative to the start of the data section
+			of the last chunk that was read or written. 
+		@return the offset. Note that a return value of 0 means that either the
+			position is at the start of the chunk data section (ie right after the
+			header), or that no chunk is currently active. Use getCurrentChunkID
+			or getCurrentChunkDepth to determine if a chunk is active.
+		*/
+		size_t getOffsetFromChunkStart() const;
+
+		/** Reads the start of the next chunk in the file.
+		@remarks
+			Files are serialised in a chunk-based manner, meaning that each section
+			of data is prepended by a chunk header. After reading this chunk header, 
+			the next set of data is available directly afterwards. 
+		@note
+			When you have finished with this chunk, you should call readChunkEnd. 
+			This will perform a bit of validation and clear the chunk from 
+			the stack. 
+		@return The Chunk that comes next
+		*/
+		virtual const Chunk* readChunkBegin();
+
+		/** Reads the start of the next chunk so long as it's of a given ID and version.
+		@remarks
+			This method operates like readChunkBegin, except it checks the ID and
+			version.
+		@param id The ID you're expecting. If the next chunk isn't of this ID, then
+			the chunk read is undone and the method returns null.
+		@param maxVersion The maximum version you're able to process. If the ID is correct
+			but the version	exceeds what is passed in here, the chunk is skipped over,
+			the problem logged and null is returned. 
+		@param msg Descriptive text added to the log if versions are not compatible
+		@return The chunk if it passes the validation.
+		*/
+		virtual const Chunk* readChunkBegin(uint32 id, uint16 maxVersion, const String& msg = StringUtil::BLANK);
+
+		/** Call this to 'rewind' the stream to just before the start of the current
+			chunk. 
+		@remarks
+			The most common case of wanting to use this is if you'd calledReadChunkBegin(), 
+			but the chunk you read wasn't one you wanted to process, and rather than
+			skipping over it (which readChunkEnd() would do), you want to backtrack
+			and give something else an opportunity to read it. 
+		@param id The id of the chunk that you were reading (for validation purposes)
+		*/
+		virtual void undoReadChunk(uint32 id);
+
+		/** Call this to 'peek' at the next chunk ID without permanently moving the stream pointer. */
+		virtual uint32 peekNextChunkID(); 
+
+		/** Finish the reading of a chunk.
+		@remarks
+			You can call this method at any point after calling readChunkBegin, even
+			if you didn't read all the rest of the data in the chunk. If you did 
+			not read to the end of a chunk, this method will automatically skip 
+			over the remainder of the chunk and position the stream just after it. 
+		@param id The id of the chunk that you were reading (for validation purposes)
+		*/
+		virtual void readChunkEnd(uint32 id);
+
+		/** Return whether the current data pointer is at the end of the current chunk.
+		@param id The id of the chunk that you were reading (for validation purposes)
+		*/
+		virtual bool isEndOfChunk(uint32 id);
+
+		/// Reports whether the stream is at the end of file
+		virtual bool eof() const;
+
+		/** Get the definition of the current chunk being read (if any). */
+		virtual const Chunk* getCurrentChunk() const;
+
+		/** Begin writing a new chunk.
+		@remarks
+			This starts the process of writing a new chunk to the stream. This will 
+			write the chunk header for you, and store a pointer so that the
+			class can automatically go back and fill in the size for you later
+			should you need it to. If you have already begun a chunk without ending
+			it, then this method will start a nested chunk within it. Once written, 
+			you can then start writing chunk-specific data into your stream.
+		@note If this is the first chunk in the file
+		@param id The identifier of the new chunk. Any value that's unique in the
+			file context is valid, except for the numbers 0x0001 and 0x1000 which are reserved
+			for internal header identification use. 
+		@param version The version of the chunk you're writing
+		*/
+		virtual void writeChunkBegin(uint32 id, uint16 version = 1);
+		/** End writing a chunk. 
+		@param id The identifier of the chunk - this is really just a safety check, 
+			since you can only end the chunk you most recently started.
+		*/
+		virtual void writeChunkEnd(uint32 id);
+
+		/** Write arbitrary data to a stream. 
+		@param buf Pointer to bytes
+		@param size The size of each element to write; each will be endian-flipped if
+			necessary
+		@param count The number of elements to write
+		*/
+		virtual void writeData(const void* buf, size_t size, size_t count);
+
+		/** Catch-all method to write primitive types. */
+		template <typename T>
+		void write(const T* pT, size_t count = 1)
+		{
+			writeData(pT, sizeof(T), count);
+		}
+
+		// Special-case Real since we need to deal with single/double precision
+		virtual void write(const Real* val, size_t count = 1);
+
+		virtual void write(const Vector2* vec, size_t count = 1);
+		virtual void write(const Vector3* vec, size_t count = 1);
+		virtual void write(const Vector4* vec, size_t count = 1);
+		virtual void write(const Quaternion* q, size_t count = 1);
+		virtual void write(const Matrix3* m, size_t count = 1);
+		virtual void write(const Matrix4* m, size_t count = 1);
+		virtual void write(const String* string);
+		virtual void write(const AxisAlignedBox* aabb, size_t count = 1);
+		virtual void write(const Sphere* sphere, size_t count = 1);
+		virtual void write(const Plane* plane, size_t count = 1);
+		virtual void write(const Ray* ray, size_t count = 1);
+		virtual void write(const Radian* angle, size_t count = 1);
+		virtual void write(const Node* node, size_t count = 1);
+		virtual void write(const bool* boolean, size_t count = 1);
+
+
+		/** Read arbitrary data from a stream. 
+		@param buf Pointer to bytes
+		@param size The size of each element to read; each will be endian-flipped if
+		necessary
+		@param count The number of elements to read
+		*/
+		virtual void readData(void* buf, size_t size, size_t count);
+
+		/** Catch-all method to read primitive types. */
+		template <typename T>
+		void read(T* pT, size_t count = 1)
+		{
+			readData(pT, sizeof(T), count);
+		}
+
+		// Special case Real, single/double-precision issues
+		virtual void read(Real* val, size_t count = 1);
+
+		/// read a Vector3
+		virtual void read(Vector2* vec, size_t count = 1);
+		virtual void read(Vector3* vec, size_t count = 1);
+		virtual void read(Vector4* vec, size_t count = 1);
+		virtual void read(Quaternion* q, size_t count = 1);
+		virtual void read(Matrix3* m, size_t count = 1);
+		virtual void read(Matrix4* m, size_t count = 1);
+		virtual void read(String* string);
+		virtual void read(AxisAlignedBox* aabb, size_t count = 1);
+		virtual void read(Sphere* sphere, size_t count = 1);
+		virtual void read(Plane* plane, size_t count = 1);
+		virtual void read(Ray* ray, size_t count = 1);
+		virtual void read(Radian* angle, size_t count = 1);
+		virtual void read(Node* node, size_t count = 1);
+		virtual void read(bool* val, size_t count = 1);
+
+		/** Start (un)compressing data
+		@param avail_in Available bytes for uncompressing
+		*/
+		virtual void startDeflate(size_t avail_in = 0);
+		/** Stop (un)compressing data
+		*/
+		virtual void stopDeflate();
+	protected:
+		DataStreamPtr mStream;
+		DataStreamPtr mOriginalStream;
+		Endian mEndian;
+		bool mFlipEndian;
+		bool mReadWriteHeader;
+		RealStorageFormat mRealFormat;
+		typedef deque<Chunk*>::type ChunkStack;
+		/// Current list of open chunks
+		ChunkStack mChunkStack;
+
+		static uint32 HEADER_ID;
+		static uint32 REVERSE_HEADER_ID;
+		static uint32 CHUNK_HEADER_SIZE;
+
+		virtual Chunk* readChunkImpl();
+		virtual void writeChunkImpl(uint32 id, uint16 version);
+		virtual void readHeader();
+		virtual void writeHeader();
+		virtual uint32 calculateChecksum(Chunk* c);
+		virtual void checkStream(bool failOnEof = false, 
+			bool validateReadable = false, bool validateWriteable = false) const;
+
+		virtual void flipEndian(void * pData, size_t size, size_t count);
+		virtual void flipEndian(void * pData, size_t size);
+		virtual void determineEndianness();
+		virtual Chunk* popChunk(uint id);
+
+		virtual void writeFloatsAsDoubles(const float* val, size_t count);
+		virtual void writeDoublesAsFloats(const double* val, size_t count);
+		virtual void readFloatsAsDoubles(double* val, size_t count);
+		virtual void readDoublesAsFloats(float* val, size_t count);
+		template <typename T, typename U>
+		void writeConverted(const T* src, U typeToWrite, size_t count)
+		{
+			U* tmp = OGRE_ALLOC_T(U, count, MEMCATEGORY_GENERAL);
+			U* pDst = tmp;
+			const T* pSrc = src;
+			for (size_t i = 0; i < count; ++i)
+				*pDst++ = static_cast<U>(*pSrc++);
+			
+			writeData(tmp, sizeof(U), count);
+
+			OGRE_FREE(tmp, MEMCATEGORY_GENERAL);
+		}
+		template <typename T, typename U>
+		void readConverted(T* dst, U typeToRead, size_t count)
+		{
+			U* tmp = OGRE_ALLOC_T(U, count, MEMCATEGORY_GENERAL);
+			readData(tmp, sizeof(U), count);
+
+			T* pDst = dst;
+			const U* pSrc = tmp;
+			for (size_t i = 0; i < count; ++i)
+				*pDst++ = static_cast<T>(*pSrc++);
+
+
+			OGRE_FREE(tmp, MEMCATEGORY_GENERAL);
+		}
+
+	};
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreString.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreString.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreString.h	(revision 148)
@@ -0,0 +1,238 @@
+/*
+-----------------------------------------------------------------------------
+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 _String_H__
+#define _String_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreHeaderPrefix.h"
+
+// If we're using the GCC 3.1 C++ Std lib
+#if OGRE_COMPILER == OGRE_COMPILER_GNUC && OGRE_COMP_VER >= 310 && !defined(STLPORT)
+
+// For gcc 4.3 see http://gcc.gnu.org/gcc-4.3/changes.html
+#   if OGRE_COMP_VER >= 430
+#       include <tr1/unordered_map> 
+#   else
+#       include <ext/hash_map>
+namespace __gnu_cxx
+{
+    template <> struct hash< Ogre::_StringBase >
+    {
+        size_t operator()( const Ogre::_StringBase _stringBase ) const
+        {
+            /* This is the PRO-STL way, but it seems to cause problems with VC7.1
+               and in some other cases (although I can't recreate it)
+            hash<const char*> H;
+            return H(_stringBase.c_str());
+            */
+            /** This is our custom way */
+            register size_t ret = 0;
+            for( Ogre::_StringBase::const_iterator it = _stringBase.begin(); it != _stringBase.end(); ++it )
+                ret = 5 * ret + *it;
+
+            return ret;
+        }
+    };
+}
+#   endif
+
+#endif
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+
+    /** Utility class for manipulating Strings.  */
+    class _OgreExport StringUtil
+    {
+	public:
+		typedef StringStream StrStreamType;
+
+        /** Removes any whitespace characters, be it standard space or
+            TABs and so on.
+            @remarks
+                The user may specify whether they want to trim only the
+                beginning or the end of the String ( the default action is
+                to trim both).
+        */
+        static void trim( String& str, bool left = true, bool right = true );
+
+        /** Returns a StringVector that contains all the substrings delimited
+            by the characters in the passed <code>delims</code> argument.
+            @param
+                delims A list of delimiter characters to split by
+            @param
+                maxSplits The maximum number of splits to perform (0 for unlimited splits). If this
+                parameters is > 0, the splitting process will stop after this many splits, left to right.
+            @param
+                preserveDelims Flag to determine if delimiters should be saved as substrings
+        */
+		static vector<String>::type split( const String& str, const String& delims = "\t\n ", unsigned int maxSplits = 0, bool preserveDelims = false);
+
+		/** Returns a StringVector that contains all the substrings delimited
+            by the characters in the passed <code>delims</code> argument, 
+			or in the <code>doubleDelims</code> argument, which is used to include (normal) 
+			delimeters in the tokenised string. For example, "strings like this".
+            @param
+                delims A list of delimiter characters to split by
+			@param
+                doubleDelims A list of double delimeters characters to tokenise by
+            @param
+                maxSplits The maximum number of splits to perform (0 for unlimited splits). If this
+                parameters is > 0, the splitting process will stop after this many splits, left to right.
+        */
+		static vector<String>::type tokenise( const String& str, const String& delims = "\t\n ", const String& doubleDelims = "\"", unsigned int maxSplits = 0);
+
+		/** Lower-cases all the characters in the string.
+        */
+        static void toLowerCase( String& str );
+
+        /** Upper-cases all the characters in the string.
+        */
+        static void toUpperCase( String& str );
+
+
+        /** Returns whether the string begins with the pattern passed in.
+        @param pattern The pattern to compare with.
+        @param lowerCase If true, the start of the string will be lower cased before
+            comparison, pattern should also be in lower case.
+        */
+        static bool startsWith(const String& str, const String& pattern, bool lowerCase = true);
+
+        /** Returns whether the string ends with the pattern passed in.
+        @param pattern The pattern to compare with.
+        @param lowerCase If true, the end of the string will be lower cased before
+            comparison, pattern should also be in lower case.
+        */
+        static bool endsWith(const String& str, const String& pattern, bool lowerCase = true);
+
+        /** Method for standardising paths - use forward slashes only, end with slash.
+        */
+        static String standardisePath( const String &init);
+		/** Returns a normalized version of a file path
+		This method can be used to make file path strings which point to the same directory  
+		but have different texts to be normalized to the same text. The function:
+		- Transforms all backward slashes to forward slashes.
+		- Removes repeating slashes.
+		- Removes initial slashes from the beginning of the path.
+		- Removes ".\" and "..\" meta directories.
+		- Sets all characters to lowercase (if requested)
+		@param init The file path to normalize.
+		@param makeLowerCase If true, transforms all characters in the string to lowercase.
+		*/
+       static String normalizeFilePath(const String& init, bool makeLowerCase = true);
+
+
+        /** Method for splitting a fully qualified filename into the base name
+            and path.
+        @remarks
+            Path is standardised as in standardisePath
+        */
+        static void splitFilename(const String& qualifiedName,
+            String& outBasename, String& outPath);
+
+		/** Method for splitting a fully qualified filename into the base name,
+		extension and path.
+		@remarks
+		Path is standardised as in standardisePath
+		*/
+		static void splitFullFilename(const Ogre::String& qualifiedName, 
+			Ogre::String& outBasename, Ogre::String& outExtention, 
+			Ogre::String& outPath);
+
+		/** Method for splitting a filename into the base name
+		and extension.
+		*/
+		static void splitBaseFilename(const Ogre::String& fullName, 
+			Ogre::String& outBasename, Ogre::String& outExtention);
+
+
+        /** Simple pattern-matching routine allowing a wildcard pattern.
+        @param str String to test
+        @param pattern Pattern to match against; can include simple '*' wildcards
+        @param caseSensitive Whether the match is case sensitive or not
+        */
+        static bool match(const String& str, const String& pattern, bool caseSensitive = true);
+
+
+		/** replace all instances of a sub-string with a another sub-string.
+		@param source Source string
+		@param replaceWhat Sub-string to find and replace
+		@param replaceWithWhat Sub-string to replace with (the new sub-string)
+		@return An updated string with the sub-string replaced
+		*/
+		static const String replaceAll(const String& source, const String& replaceWhat, const String& replaceWithWhat);
+
+        /// Constant blank string, useful for returning by ref where local does not exist
+        static const String BLANK;
+    };
+
+
+#if OGRE_COMPILER == OGRE_COMPILER_GNUC && OGRE_COMP_VER >= 310 && !defined(STLPORT)
+#   if OGRE_COMP_VER < 430
+	typedef ::__gnu_cxx::hash< _StringBase > _StringHash;
+#   else
+	typedef ::std::tr1::hash< _StringBase > _StringHash;
+#   endif
+#elif OGRE_COMPILER == OGRE_COMPILER_CLANG
+#   if defined(_LIBCPP_VERSION)
+	typedef ::std::hash< _StringBase > _StringHash;
+#   else
+	typedef ::std::tr1::hash< _StringBase > _StringHash;
+#   endif
+#elif OGRE_COMPILER == OGRE_COMPILER_MSVC && OGRE_COMP_VER >= 1600 && !defined(STLPORT) // VC++ 10.0
+	typedef ::std::tr1::hash< _StringBase > _StringHash;
+#elif !defined( _STLP_HASH_FUN_H )
+	typedef stdext::hash_compare< _StringBase, std::less< _StringBase > > _StringHash;
+#else
+	typedef std::hash< _StringBase > _StringHash;
+#endif 
+	/** @} */
+	/** @} */
+
+} // namespace Ogre
+
+#include "OgreHeaderSuffix.h"
+
+#if OGRE_DEBUG_MODE && (OGRE_PLATFORM == OGRE_PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WINRT)
+#   pragma push_macro("NOMINMAX")
+#   define NOMINMAX
+#   include <windows.h>
+#   pragma pop_macro("NOMINMAX")
+#	define Ogre_OutputCString(str) ::OutputDebugStringA(str)
+#	define Ogre_OutputWString(str) ::OutputDebugStringW(str)
+#else
+#	define Ogre_OutputCString(str) std::cerr << str
+#	define Ogre_OutputWString(str) std::cerr << str
+#endif
+
+#endif // _String_H__
Index: /ogre_src_v1-9-0/OgreMain/include/OgreStringConverter.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreStringConverter.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreStringConverter.h	(revision 148)
@@ -0,0 +1,304 @@
+/*
+-----------------------------------------------------------------------------
+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 __StringConverter_H__
+#define __StringConverter_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreStringVector.h"
+#include "OgreColourValue.h"
+#include "OgreMath.h"
+#include "OgreMatrix3.h"
+#include "OgreMatrix4.h"
+#include "OgreQuaternion.h"
+#include "OgreVector2.h"
+#include "OgreVector3.h"
+#include "OgreVector4.h"
+
+namespace Ogre {
+
+    /** \addtogroup Core
+    *  @{
+    */
+    /** \addtogroup General
+    *  @{
+    */
+    /** Class for converting the core Ogre data types to/from Strings.
+    @remarks
+        The code for converting values to and from strings is here as a separate
+        class to avoid coupling String to other datatypes (and vice-versa) which reduces
+        compilation dependency: important given how often the core types are used.
+    @par
+        This class is mainly used for parsing settings in text files. External applications
+        can also use it to interface with classes which use the StringInterface template
+        class.
+    @par
+        The String formats of each of the major types is listed with the methods. The basic types
+        like int and Real just use the underlying C runtime library atof and atoi family methods,
+        however custom types like Vector3, ColourValue and Matrix4 are also supported by this class
+        using custom formats.
+    @author
+        Steve Streeting
+    */
+    class _OgreExport StringConverter
+    {
+    public:
+
+        /** Converts a Real to a String. */
+        static String toString(Real val, unsigned short precision = 6, 
+            unsigned short width = 0, char fill = ' ', 
+            std::ios::fmtflags flags = std::ios::fmtflags(0));
+#if OGRE_DOUBLE_PRECISION == 1
+        /** Converts a float to a String. */
+        static String toString(float val, unsigned short precision = 6,
+                               unsigned short width = 0, char fill = ' ',
+                               std::ios::fmtflags flags = std::ios::fmtflags(0));
+#else
+        /** Converts a double to a String. */
+        static String toString(double val, unsigned short precision = 6,
+                               unsigned short width = 0, char fill = ' ',
+                               std::ios::fmtflags flags = std::ios::fmtflags(0));
+#endif
+        /** Converts a Radian to a String. */
+        static String toString(Radian val, unsigned short precision = 6, 
+            unsigned short width = 0, char fill = ' ', 
+            std::ios::fmtflags flags = std::ios::fmtflags(0))
+        {
+            return toString(val.valueAngleUnits(), precision, width, fill, flags);
+        }
+        /** Converts a Degree to a String. */
+        static String toString(Degree val, unsigned short precision = 6, 
+            unsigned short width = 0, char fill = ' ', 
+            std::ios::fmtflags flags = std::ios::fmtflags(0))
+        {
+            return toString(val.valueAngleUnits(), precision, width, fill, flags);
+        }
+        /** Converts an int to a String. */
+        static String toString(int val, unsigned short width = 0, 
+            char fill = ' ', 
+            std::ios::fmtflags flags = std::ios::fmtflags(0));
+#if OGRE_PLATFORM != OGRE_PLATFORM_NACL &&  ( OGRE_ARCH_TYPE == OGRE_ARCHITECTURE_64 || OGRE_PLATFORM == OGRE_PLATFORM_APPLE || OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS )
+        /** Converts an unsigned int to a String. */
+        static String toString(unsigned int val, 
+            unsigned short width = 0, char fill = ' ', 
+            std::ios::fmtflags flags = std::ios::fmtflags(0));
+        /** Converts a size_t to a String. */
+        static String toString(size_t val, 
+            unsigned short width = 0, char fill = ' ', 
+            std::ios::fmtflags flags = std::ios::fmtflags(0));
+        #if OGRE_COMPILER == OGRE_COMPILER_MSVC
+        /** Converts an unsigned long to a String. */
+        static String toString(unsigned long val, 
+            unsigned short width = 0, char fill = ' ', 
+            std::ios::fmtflags flags = std::ios::fmtflags(0));
+        #endif
+#else
+        /** Converts a size_t to a String. */
+        static String toString(size_t val, 
+            unsigned short width = 0, char fill = ' ', 
+            std::ios::fmtflags flags = std::ios::fmtflags(0));
+        /** Converts an unsigned long to a String. */
+        static String toString(unsigned long val, 
+            unsigned short width = 0, char fill = ' ', 
+            std::ios::fmtflags flags = std::ios::fmtflags(0));
+#endif
+        /** Converts a long to a String. */
+        static String toString(long val, 
+            unsigned short width = 0, char fill = ' ', 
+            std::ios::fmtflags flags = std::ios::fmtflags(0));
+        /** Converts a boolean to a String. 
+        @param yesNo If set to true, result is 'yes' or 'no' instead of 'true' or 'false'
+        */
+        static String toString(bool val, bool yesNo = false);
+        /** Converts a Vector2 to a String. 
+        @remarks
+            Format is "x y" (i.e. 2x Real values, space delimited)
+        */
+        static String toString(const Vector2& val);
+        /** Converts a Vector3 to a String. 
+        @remarks
+            Format is "x y z" (i.e. 3x Real values, space delimited)
+        */
+        static String toString(const Vector3& val);
+        /** Converts a Vector4 to a String. 
+        @remarks
+            Format is "x y z w" (i.e. 4x Real values, space delimited)
+        */
+        static String toString(const Vector4& val);
+        /** Converts a Matrix3 to a String. 
+        @remarks
+            Format is "00 01 02 10 11 12 20 21 22" where '01' means row 0 column 1 etc.
+        */
+        static String toString(const Matrix3& val);
+        /** Converts a Matrix4 to a String. 
+        @remarks
+            Format is "00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33" where 
+            '01' means row 0 column 1 etc.
+        */
+        static String toString(const Matrix4& val);
+        /** Converts a Quaternion to a String. 
+        @remarks
+            Format is "w x y z" (i.e. 4x Real values, space delimited)
+        */
+        static String toString(const Quaternion& val);
+        /** Converts a ColourValue to a String. 
+        @remarks
+            Format is "r g b a" (i.e. 4x Real values, space delimited). 
+        */
+        static String toString(const ColourValue& val);
+        /** Converts a StringVector to a string.
+        @remarks
+            Strings must not contain spaces since space is used as a delimiter in
+            the output.
+        */
+        static String toString(const StringVector& val);
+
+        /** Converts a String to a Real. 
+        @return
+            0.0 if the value could not be parsed, otherwise the Real version of the String.
+        */
+        static Real parseReal(const String& val, Real defaultValue = 0);
+        /** Converts a String to a Angle. 
+        @return
+            0.0 if the value could not be parsed, otherwise the Angle version of the String.
+        */
+        static inline Radian parseAngle(const String& val, Radian defaultValue = Radian(0)) {
+            return Angle(parseReal(val, defaultValue.valueRadians()));
+        }
+        /** Converts a String to a whole number. 
+        @return
+            0.0 if the value could not be parsed, otherwise the numeric version of the String.
+        */
+        static int parseInt(const String& val, int defaultValue = 0);
+        /** Converts a String to a whole number. 
+        @return
+            0.0 if the value could not be parsed, otherwise the numeric version of the String.
+        */
+        static unsigned int parseUnsignedInt(const String& val, unsigned int defaultValue = 0);
+        /** Converts a String to a whole number. 
+        @return
+            0.0 if the value could not be parsed, otherwise the numeric version of the String.
+        */
+        static long parseLong(const String& val, long defaultValue = 0);
+        /** Converts a String to a whole number. 
+        @return
+            0.0 if the value could not be parsed, otherwise the numeric version of the String.
+        */
+        static unsigned long parseUnsignedLong(const String& val, unsigned long defaultValue = 0);
+        /** Converts a String to size_t. 
+        @return
+            defaultValue if the value could not be parsed, otherwise the numeric version of the String.
+        */
+        static size_t parseSizeT(const String& val, size_t defaultValue = 0);
+        /** Converts a String to a boolean. 
+        @remarks
+            Returns true if case-insensitive match of the start of the string
+            matches "true", "yes" or "1", false otherwise.
+        */
+        static bool parseBool(const String& val, bool defaultValue = 0);
+        /** Parses a Vector2 out of a String.
+        @remarks
+            Format is "x y" ie. 2 Real components, space delimited. Failure to parse returns
+            Vector2::ZERO.
+        */
+        static Vector2 parseVector2(const String& val, const Vector2& defaultValue = Vector2::ZERO);
+        /** Parses a Vector3 out of a String.
+        @remarks
+            Format is "x y z" ie. 3 Real components, space delimited. Failure to parse returns
+            Vector3::ZERO.
+        */
+        static Vector3 parseVector3(const String& val, const Vector3& defaultValue = Vector3::ZERO);
+        /** Parses a Vector4 out of a String.
+        @remarks
+            Format is "x y z w" ie. 4 Real components, space delimited. Failure to parse returns
+            Vector4::ZERO.
+        */
+        static Vector4 parseVector4(const String& val, const Vector4& defaultValue = Vector4::ZERO);
+        /** Parses a Matrix3 out of a String.
+        @remarks
+            Format is "00 01 02 10 11 12 20 21 22" where '01' means row 0 column 1 etc.
+            Failure to parse returns Matrix3::IDENTITY.
+        */
+        static Matrix3 parseMatrix3(const String& val, const Matrix3& defaultValue = Matrix3::IDENTITY);
+        /** Parses a Matrix4 out of a String.
+        @remarks
+            Format is "00 01 02 03 10 11 12 13 20 21 22 23 30 31 32 33" where 
+            '01' means row 0 column 1 etc. Failure to parse returns Matrix4::IDENTITY.
+        */
+        static Matrix4 parseMatrix4(const String& val, const Matrix4& defaultValue = Matrix4::IDENTITY);
+        /** Parses a Quaternion out of a String. 
+        @remarks
+            Format is "w x y z" (i.e. 4x Real values, space delimited). 
+            Failure to parse returns Quaternion::IDENTITY.
+        */
+        static Quaternion parseQuaternion(const String& val, const Quaternion& defaultValue = Quaternion::IDENTITY);
+        /** Parses a ColourValue out of a String. 
+        @remarks
+            Format is "r g b a" (i.e. 4x Real values, space delimited), or "r g b" which implies
+            an alpha value of 1.0 (opaque). Failure to parse returns ColourValue::Black.
+        */
+        static ColourValue parseColourValue(const String& val, const ColourValue& defaultValue = ColourValue::Black);
+
+        /** Parses a StringVector from a string.
+        @remarks
+            Strings must not contain spaces since space is used as a delimiter in
+            the output.
+        */
+        static StringVector parseStringVector(const String& val);
+        /** Checks the String is a valid number value. */
+        static bool isNumber(const String& val);
+
+        //-----------------------------------------------------------------------
+        static void setDefaultStringLocale(String loc)
+        {
+            msDefaultStringLocale = loc;
+            msLocale = std::locale(msDefaultStringLocale.c_str());
+        }
+        //-----------------------------------------------------------------------
+        static String getDefaultStringLocale(void) { return msDefaultStringLocale; }
+        //-----------------------------------------------------------------------
+        static void setUseLocale(bool useLocale) { msUseLocale = useLocale; }
+        //-----------------------------------------------------------------------
+        static bool isUseLocale() { return msUseLocale; }
+        //-----------------------------------------------------------------------
+
+    protected:
+        static String msDefaultStringLocale;
+        static std::locale msLocale;
+        static bool msUseLocale;
+    };
+
+    /** @} */
+    /** @} */
+
+}
+
+
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreStringInterface.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreStringInterface.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreStringInterface.h	(revision 148)
@@ -0,0 +1,339 @@
+/*
+-----------------------------------------------------------------------------
+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 __StringInterface_H__
+#define __StringInterface_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreString.h"
+#include "OgreCommon.h"
+#include "Threading/OgreThreadHeaders.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+
+    /// List of parameter types available
+    enum ParameterType
+    {
+        PT_BOOL,
+        PT_REAL,
+        PT_INT,
+        PT_UNSIGNED_INT,
+        PT_SHORT,
+        PT_UNSIGNED_SHORT,
+        PT_LONG,
+        PT_UNSIGNED_LONG,
+        PT_STRING,
+        PT_VECTOR3,
+        PT_MATRIX3,
+        PT_MATRIX4,
+        PT_QUATERNION,
+        PT_COLOURVALUE
+    };
+
+    /// Definition of a parameter supported by a StringInterface class, for introspection
+    class _OgreExport ParameterDef
+    {
+    public:
+        String name;
+        String description;
+        ParameterType paramType;
+        ParameterDef(const String& newName, const String& newDescription, ParameterType newType)
+            : name(newName), description(newDescription), paramType(newType) {}
+    };
+    typedef vector<ParameterDef>::type ParameterList;
+
+    /** Abstract class which is command object which gets/sets parameters.*/
+    class _OgreExport ParamCommand
+    {
+    public:
+        virtual String doGet(const void* target) const = 0;
+        virtual void doSet(void* target, const String& val) = 0;
+
+        virtual ~ParamCommand() { }
+    };
+    typedef map<String, ParamCommand* >::type ParamCommandMap;
+
+    /** Class to hold a dictionary of parameters for a single class. */
+    class _OgreExport ParamDictionary
+    {
+        friend class StringInterface;
+    protected:
+        /// Definitions of parameters
+        ParameterList mParamDefs;
+
+        /// Command objects to get/set
+        ParamCommandMap mParamCommands;
+
+        /** Retrieves the parameter command object for a named parameter. */
+        ParamCommand* getParamCommand(const String& name)
+        {
+            ParamCommandMap::iterator i = mParamCommands.find(name);
+            if (i != mParamCommands.end())
+            {
+                return i->second;
+            }
+            else
+            {
+                return 0;
+            }
+        }
+
+		const ParamCommand* getParamCommand(const String& name) const
+        {
+            ParamCommandMap::const_iterator i = mParamCommands.find(name);
+            if (i != mParamCommands.end())
+            {
+                return i->second;
+            }
+            else
+            {
+                return 0;
+            }
+        }
+    public:
+        ParamDictionary()  {}
+        /** Method for adding a parameter definition for this class. 
+        @param paramDef A ParameterDef object defining the parameter
+        @param paramCmd Pointer to a ParamCommand subclass to handle the getting / setting of this parameter.
+            NB this class will not destroy this on shutdown, please ensure you do
+
+        */
+        void addParameter(const ParameterDef& paramDef, ParamCommand* paramCmd)
+        {
+            mParamDefs.push_back(paramDef);
+            mParamCommands[paramDef.name] = paramCmd;
+        }
+        /** Retrieves a list of parameters valid for this object. 
+        @return
+            A reference to a static list of ParameterDef objects.
+
+        */
+        const ParameterList& getParameters(void) const
+        {
+            return mParamDefs;
+        }
+
+
+
+    };
+    typedef map<String, ParamDictionary>::type ParamDictionaryMap;
+    
+    /** Class defining the common interface which classes can use to 
+        present a reflection-style, self-defining parameter set to callers.
+    @remarks
+        This class also holds a static map of class name to parameter dictionaries
+        for each subclass to use. See ParamDictionary for details. 
+    @remarks
+        In order to use this class, each subclass must call createParamDictionary in their constructors
+        which will create a parameter dictionary for the class if it does not exist yet.
+    */
+    class _OgreExport StringInterface 
+    {
+    private:
+        OGRE_STATIC_MUTEX( msDictionaryMutex );
+
+        /// Dictionary of parameters
+        static ParamDictionaryMap msDictionary;
+
+        /// Class name for this instance to be used as a lookup (must be initialised by subclasses)
+        String mParamDictName;
+		ParamDictionary* mParamDict;
+
+	protected:
+        /** Internal method for creating a parameter dictionary for the class, if it does not already exist.
+        @remarks
+            This method will check to see if a parameter dictionary exist for this class yet,
+            and if not will create one. NB you must supply the name of the class (RTTI is not 
+            used or performance).
+        @param
+            className the name of the class using the dictionary
+        @return
+            true if a new dictionary was created, false if it was already there
+        */
+        bool createParamDictionary(const String& className)
+        {
+            OGRE_LOCK_MUTEX( msDictionaryMutex );
+
+			ParamDictionaryMap::iterator it = msDictionary.find(className);
+
+			if ( it == msDictionary.end() )
+			{
+				mParamDict = &msDictionary.insert( std::make_pair( className, ParamDictionary() ) ).first->second;
+				mParamDictName = className;
+				return true;
+			}
+			else
+			{
+				mParamDict = &it->second;
+				mParamDictName = className;
+				return false;
+			}
+        }
+
+    public:
+		StringInterface() : mParamDict(NULL) { }
+
+        /** Virtual destructor, see Effective C++ */
+        virtual ~StringInterface() {}
+
+        /** Retrieves the parameter dictionary for this class. 
+        @remarks
+            Only valid to call this after createParamDictionary.
+        @return
+            Pointer to ParamDictionary shared by all instances of this class
+            which you can add parameters to, retrieve parameters etc.
+        */
+        ParamDictionary* getParamDictionary(void)
+        {
+			return mParamDict;
+        }
+
+		const ParamDictionary* getParamDictionary(void) const
+        {
+			return mParamDict;
+        }
+
+        /** Retrieves a list of parameters valid for this object. 
+        @return
+            A reference to a static list of ParameterDef objects.
+
+        */
+        const ParameterList& getParameters(void) const;
+
+        /** Generic parameter setting method.
+        @remarks
+            Call this method with the name of a parameter and a string version of the value
+            to set. The implementor will convert the string to a native type internally.
+            If in doubt, check the parameter definition in the list returned from 
+            StringInterface::getParameters.
+        @param
+            name The name of the parameter to set
+        @param
+            value String value. Must be in the right format for the type specified in the parameter definition.
+            See the StringConverter class for more information.
+        @return
+            true if set was successful, false otherwise (NB no exceptions thrown - tolerant method)
+        */
+        virtual bool setParameter(const String& name, const String& value);
+        /** Generic multiple parameter setting method.
+        @remarks
+            Call this method with a list of name / value pairs
+            to set. The implementor will convert the string to a native type internally.
+            If in doubt, check the parameter definition in the list returned from 
+            StringInterface::getParameters.
+        @param
+            paramList Name/value pair list
+        */
+        virtual void setParameterList(const NameValuePairList& paramList);
+        /** Generic parameter retrieval method.
+        @remarks
+            Call this method with the name of a parameter to retrieve a string-format value of
+            the parameter in question. If in doubt, check the parameter definition in the
+            list returned from getParameters for the type of this parameter. If you
+            like you can use StringConverter to convert this string back into a native type.
+        @param
+            name The name of the parameter to get
+        @return
+            String value of parameter, blank if not found
+        */
+        virtual String getParameter(const String& name) const
+        {
+            // Get dictionary
+            const ParamDictionary* dict = getParamDictionary();
+
+            if (dict)
+            {
+                // Look up command object
+                const ParamCommand* cmd = dict->getParamCommand(name);
+
+                if (cmd)
+                {
+                    return cmd->doGet(this);
+                }
+            }
+
+            // Fallback
+            return "";
+        }
+        /** Method for copying this object's parameters to another object.
+        @remarks
+            This method takes the values of all the object's parameters and tries to set the
+            same values on the destination object. This provides a completely type independent
+            way to copy parameters to other objects. Note that because of the String manipulation 
+            involved, this should not be regarded as an efficient process and should be saved for
+            times outside of the rendering loop.
+        @par
+            Any unrecognised parameters will be ignored as with setParameter method.
+        @param dest Pointer to object to have it's parameters set the same as this object.
+
+        */
+        virtual void copyParametersTo(StringInterface* dest) const
+        {
+            // Get dictionary
+            const ParamDictionary* dict = getParamDictionary();
+
+            if (dict)
+            {
+                // Iterate through own parameters
+                ParameterList::const_iterator i;
+            
+                for (i = dict->mParamDefs.begin(); 
+                i != dict->mParamDefs.end(); ++i)
+                {
+                    dest->setParameter(i->name, getParameter(i->name));
+                }
+            }
+
+
+        }
+
+        /** Cleans up the static 'msDictionary' required to reset Ogre,
+        otherwise the containers are left with invalid pointers, which will lead to a crash
+        as soon as one of the ResourceManager implementers (e.g. MaterialManager) initializes.*/
+        static void cleanupDictionary () ;
+
+    };
+
+	/** @} */
+	/** @} */
+
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreStringVector.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreStringVector.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreStringVector.h	(revision 148)
@@ -0,0 +1,53 @@
+/*
+-----------------------------------------------------------------------------
+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 _StringVector_H__
+#define _StringVector_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreString.h"
+#include "OgreSharedPtr.h"
+
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+
+    typedef vector<String>::type StringVector;
+    typedef SharedPtr<StringVector> StringVectorPtr;
+
+	/** @} */
+	/** @} */
+
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreSubEntity.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreSubEntity.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreSubEntity.h	(revision 148)
@@ -0,0 +1,318 @@
+/*
+-----------------------------------------------------------------------------
+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 __SubEntity_H__
+#define __SubEntity_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreString.h"
+#include "OgreRenderable.h"
+#include "OgreHardwareBufferManager.h"
+#include "OgreResourceGroupManager.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Scene
+	*  @{
+	*/
+	/** Utility class which defines the sub-parts of an Entity.
+        @remarks
+            Just as meshes are split into submeshes, an Entity is made up of
+            potentially multiple SubMeshes. These are mainly here to provide the
+            link between the Material which the SubEntity uses (which may be the
+            default Material for the SubMesh or may have been changed for this
+            object) and the SubMesh data.
+        @par
+            The SubEntity also allows the application some flexibility in the
+            material properties for this section of a particular instance of this
+            Mesh, e.g. tinting the windows on a car model.
+        @par
+            SubEntity instances are never created manually. They are created at
+            the same time as their parent Entity by the SceneManager method
+            createEntity.
+    */
+    class _OgreExport SubEntity: public Renderable, public SubEntityAlloc
+    {
+        // Note no virtual functions for efficiency
+        friend class Entity;
+        friend class SceneManager;
+    protected:
+        /** Private constructor - don't allow creation by anybody else.
+        */
+        SubEntity(Entity* parent, SubMesh* subMeshBasis);
+
+        /** Private destructor.
+        */
+        virtual ~SubEntity();
+
+        /// Pointer to parent.
+        Entity* mParentEntity;
+
+        /// Cached pointer to material.
+        MaterialPtr mMaterialPtr;
+
+        /// Pointer to the SubMesh defining geometry.
+        SubMesh* mSubMesh;
+
+		/// override the start index for the RenderOperation
+        size_t mIndexStart;
+
+        /// override the end index for the RenderOperation
+        size_t mIndexEnd;
+
+        /// Is this SubEntity visible?
+        bool mVisible;
+
+        /// The render queue to use when rendering this renderable
+        uint8 mRenderQueueID;
+        /// Flags whether the RenderQueue's default should be used.
+        bool mRenderQueueIDSet;
+        /// The render queue priority to use when rendering this renderable
+        ushort mRenderQueuePriority;
+        /// Flags whether the RenderQueue's default should be used.
+        bool mRenderQueuePrioritySet;
+
+		/// The LOD number of the material to use, calculated by Entity::_notifyCurrentCamera
+		unsigned short mMaterialLodIndex;
+
+        /// Blend buffer details for dedicated geometry
+        VertexData* mSkelAnimVertexData;
+        /// Quick lookup of buffers
+        TempBlendedBufferInfo mTempSkelAnimInfo;
+		/// Temp buffer details for software Vertex anim geometry
+		TempBlendedBufferInfo mTempVertexAnimInfo;
+		/// Vertex data details for software Vertex anim of shared geometry
+		VertexData* mSoftwareVertexAnimVertexData;
+		/// Vertex data details for hardware Vertex anim of shared geometry
+		/// - separate since we need to s/w anim for shadows whilst still altering
+		///   the vertex data for hardware morphing (pos2 binding)
+		VertexData* mHardwareVertexAnimVertexData;
+		/// Have we applied any vertex animation to geometry?
+		bool mVertexAnimationAppliedThisFrame;
+		/// Number of hardware blended poses supported by material
+		ushort mHardwarePoseCount;
+		/// Cached distance to last camera for getSquaredViewDepth
+		mutable Real mCachedCameraDist;
+		/// The camera for which the cached distance is valid
+		mutable const Camera *mCachedCamera;
+
+        /** Internal method for preparing this Entity for use in animation. */
+        void prepareTempBlendBuffers(void);
+
+    public:
+        /** Gets the name of the Material in use by this instance.
+        */
+        const String& getMaterialName() const;
+
+        /** Sets the name of the Material to be used.
+            @remarks
+                By default a SubEntity uses the default Material that the SubMesh
+                uses. This call can alter that so that the Material is different
+                for this instance.
+        */
+        void setMaterialName( const String& name, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME );
+
+		/** Sets a Material to be used.
+			@remarks
+				By default a SubEntity uses the default Material that the SubMesh
+				uses. This call can alter that so that the Material is different
+				for this instance.
+		*/
+		void setMaterial( const MaterialPtr& material );
+
+        /** Tells this SubEntity whether to be visible or not. */
+        virtual void setVisible(bool visible);
+
+        /** Returns whether or not this SubEntity is supposed to be visible. */
+        virtual bool isVisible(void) const;
+
+        /** Sets the render queue group this SubEntity will be rendered through.
+        @remarks
+            Render queues are grouped to allow you to more tightly control the ordering
+            of rendered objects. If you do not call this method, the SubEntity will use
+            either the Entity's queue or it will use the default
+            (RenderQueue::getDefaultQueueGroup).
+        @par
+            See Entity::setRenderQueueGroup for more details.
+        @param queueID Enumerated value of the queue group to use. See the
+            enum RenderQueueGroupID for what kind of values can be used here.
+        */
+        virtual void setRenderQueueGroup(uint8 queueID);
+
+        /** Sets the render queue group and group priority this SubEntity will be rendered through.
+        @remarks
+            Render queues are grouped to allow you to more tightly control the ordering
+            of rendered objects. Within a single render group there another type of grouping
+            called priority which allows further control.  If you do not call this method, 
+            all Entity objects default to the default queue and priority 
+            (RenderQueue::getDefaultQueueGroup, RenderQueue::getDefaultRenderablePriority).
+        @par
+            See Entity::setRenderQueueGroupAndPriority for more details.
+        @param queueID Enumerated value of the queue group to use. See the
+            enum RenderQueueGroupID for what kind of values can be used here.
+        @param priority The priority within a group to use.
+        */
+        virtual void setRenderQueueGroupAndPriority(uint8 queueID, ushort priority);
+
+        /** Gets the queue group for this entity, see setRenderQueueGroup for full details. */
+        virtual uint8 getRenderQueueGroup(void) const;
+
+        /** Gets the queue group for this entity, see setRenderQueueGroup for full details. */
+        virtual ushort getRenderQueuePriority(void) const;
+
+        /** Gets the queue group for this entity, see setRenderQueueGroup for full details. */
+        virtual bool isRenderQueueGroupSet(void) const;
+
+        /** Gets the queue group for this entity, see setRenderQueueGroup for full details. */
+        virtual bool isRenderQueuePrioritySet(void) const;
+
+        /** Accessor method to read mesh data.
+        */
+        SubMesh* getSubMesh(void);
+
+		/** Accessor to get parent Entity */
+		Entity* getParent(void) const { return mParentEntity; }
+
+        /** Overridden - see Renderable.
+        */
+        const MaterialPtr& getMaterial(void) const;
+
+        /** Overridden - see Renderable.
+        */
+        Technique* getTechnique(void) const;
+
+        /** Overridden - see Renderable.
+        */
+        void getRenderOperation(RenderOperation& op);
+
+		/** Tells this SubEntity to draw a subset of the SubMesh by adjusting the index buffer extents.
+         * Default value is zero so that the entire index buffer is used when drawing.
+         * Valid values are zero to getIndexDataEndIndex()
+        */
+        void setIndexDataStartIndex(size_t start_index);
+
+        /** Returns the current value of the start index used for drawing.
+         * \see setIndexDataStartIndex
+        */
+        size_t getIndexDataStartIndex() const;
+
+        /** Tells this SubEntity to draw a subset of the SubMesh by adjusting the index buffer extents.
+         * Default value is SubMesh::indexData::indexCount so that the entire index buffer is used when drawing.
+         * Valid values are mStartIndex to SubMesh::indexData::indexCount
+        */
+        void setIndexDataEndIndex(size_t end_index);
+
+        /** Returns the current value of the start index used for drawing.
+		*/
+        size_t getIndexDataEndIndex() const;
+
+		/** Reset the custom start/end index to the default values.
+		*/
+        void resetIndexDataStartEndIndex();
+
+        /** Overridden - see Renderable.
+        */
+        void getWorldTransforms(Matrix4* xform) const;
+        /** Overridden - see Renderable.
+        */
+        unsigned short getNumWorldTransforms(void) const;
+        /** Overridden, see Renderable */
+        Real getSquaredViewDepth(const Camera* cam) const;
+        /** @copydoc Renderable::getLights */
+        const LightList& getLights(void) const;
+        /** @copydoc Renderable::getCastsShadows */
+        bool getCastsShadows(void) const;
+		/** Advanced method to get the temporarily blended vertex information
+		for entities which are software skinned. 
+        @remarks
+            Internal engine will eliminate software animation if possible, this
+            information is unreliable unless added request for software animation
+            via Entity::addSoftwareAnimationRequest.
+        @note
+            The positions/normals of the returned vertex data is in object space.
+		*/
+		VertexData* _getSkelAnimVertexData(void);
+		/** Advanced method to get the temporarily blended software morph vertex information
+        @remarks
+            Internal engine will eliminate software animation if possible, this
+            information is unreliable unless added request for software animation
+            via Entity::addSoftwareAnimationRequest.
+        @note
+            The positions/normals of the returned vertex data is in object space.
+		*/
+		VertexData* _getSoftwareVertexAnimVertexData(void);
+		/** Advanced method to get the hardware morph vertex information
+        @note
+            The positions/normals of the returned vertex data is in object space.
+		*/
+		VertexData* _getHardwareVertexAnimVertexData(void);
+		/** Advanced method to get the temp buffer information for software 
+		skeletal animation.
+		*/
+		TempBlendedBufferInfo* _getSkelAnimTempBufferInfo(void);
+		/** Advanced method to get the temp buffer information for software 
+		morph animation.
+		*/
+		TempBlendedBufferInfo* _getVertexAnimTempBufferInfo(void);
+		/// Retrieve the VertexData which should be used for GPU binding
+		VertexData* getVertexDataForBinding(void);
+
+		/** Mark all vertex data as so far unanimated. 
+		*/
+		void _markBuffersUnusedForAnimation(void);
+		/** Mark all vertex data as animated. 
+		*/
+		void _markBuffersUsedForAnimation(void);
+		/** Are buffers already marked as vertex animated? */
+		bool _getBuffersMarkedForAnimation(void) const { return mVertexAnimationAppliedThisFrame; }
+		/** Internal method to copy original vertex data to the morph structures
+		should there be no active animation in use.
+		*/
+		void _restoreBuffersForUnusedAnimation(bool hardwareAnimation);
+
+		/** Overridden from Renderable to provide some custom behaviour. */
+		void _updateCustomGpuParameter(
+			const GpuProgramParameters::AutoConstantEntry& constantEntry,
+			GpuProgramParameters* params) const;
+
+		/** Invalidate the camera distance cache */
+		void _invalidateCameraCache ()
+		{ mCachedCamera = 0; }
+    };
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreSubMesh.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreSubMesh.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreSubMesh.h	(revision 148)
@@ -0,0 +1,305 @@
+/*
+-----------------------------------------------------------------------------
+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 __SubMesh_H_
+#define __SubMesh_H_
+
+#include "OgrePrerequisites.h"
+
+#include "OgreVertexIndexData.h"
+#include "OgreMaterial.h"
+#include "OgreRenderOperation.h"
+#include "OgreVertexBoneAssignment.h"
+#include "OgreAnimationTrack.h"
+#include "OgreResourceGroupManager.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Resources
+	*  @{
+	*/
+	/** Defines a part of a complete mesh.
+        @remarks
+            Meshes which make up the definition of a discrete 3D object
+            are made up of potentially multiple parts. This is because
+            different parts of the mesh may use different materials or
+            use different vertex formats, such that a rendering state
+            change is required between them.
+        @par
+            Like the Mesh class, instantiations of 3D objects in the scene
+            share the SubMesh instances, and have the option of overriding
+            their material differences on a per-object basis if required.
+            See the SubEntity class for more information.
+    */
+	class _OgreExport SubMesh : public SubMeshAlloc
+    {
+        friend class Mesh;
+        friend class MeshSerializerImpl;
+        friend class MeshSerializerImpl_v1_2;
+        friend class MeshSerializerImpl_v1_1;
+    public:
+        SubMesh();
+        ~SubMesh();
+
+
+        /// Indicates if this submesh shares vertex data with other meshes or whether it has it's own vertices.
+        bool useSharedVertices;
+
+        /// The render operation type used to render this submesh
+        RenderOperation::OperationType operationType;
+
+        /** Dedicated vertex data (only valid if useSharedVertices = false).
+            @remarks
+                This data is completely owned by this submesh.
+            @par
+                The use of shared or non-shared buffers is determined when
+                model data is converted to the OGRE .mesh format.
+        */
+        VertexData *vertexData;
+
+        /// Face index data
+        IndexData *indexData;
+
+        /** Dedicated index map for translate blend index to bone index (only valid if useSharedVertices = false).
+            @remarks
+                This data is completely owned by this submesh.
+            @par
+                We collect actually used bones of all bone assignments, and build the
+                blend index in 'packed' form, then the range of the blend index in vertex
+                data VES_BLEND_INDICES element is continuous, with no gaps. Thus, by
+                minimising the world matrix array constants passing to GPU, we can support
+                more bones for a mesh when hardware skinning is used. The hardware skinning
+                support limit is applied to each set of vertex data in the mesh, in other words, the
+                hardware skinning support limit is applied only to the actually used bones of each
+                SubMeshes, not all bones across the entire Mesh.
+            @par
+                Because the blend index is different to the bone index, therefore, we use
+                the index map to translate the blend index to bone index.
+            @par
+                The use of shared or non-shared index map is determined when
+                model data is converted to the OGRE .mesh format.
+        */
+        typedef vector<unsigned short>::type IndexMap;
+        IndexMap blendIndexToBoneIndexMap;
+
+		typedef vector<IndexData*>::type LODFaceList;
+		LODFaceList mLodFaceList;
+
+        /** A list of extreme points on the submesh (optional).
+            @remarks
+                These points are some arbitrary points on the mesh that are used
+                by engine to better sort submeshes by depth. This doesn't matter
+                much for non-transparent submeshes, as Z-buffer takes care of invisible
+                surface culling anyway, but is pretty useful for semi-transparent
+                submeshes because the order in which transparent submeshes must be
+                rendered cannot be always correctly deduced from entity position.
+            @par
+                These points are intelligently chosen from the points that make up
+                the submesh, the criteria for choosing them should be that these points
+                somewhat characterize the submesh outline, e.g. they should not be
+                close to each other, and they should be on the outer hull of the submesh.
+                They can be stored in the .mesh file, or generated at runtime
+                (see generateExtremes ()).
+            @par
+                If this array is empty, submesh sorting is done like in older versions -
+                by comparing the positions of the owning entity.
+         */
+        vector<Vector3>::type extremityPoints;
+
+        /// Reference to parent Mesh (not a smart pointer so child does not keep parent alive).
+        Mesh* parent;
+
+        /// Sets the name of the Material which this SubMesh will use
+        void setMaterialName(const String& matName, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME );
+        const String& getMaterialName(void) const;
+
+        /** Returns true if a material has been assigned to the submesh, otherwise returns false.
+        */
+        bool isMatInitialised(void) const;
+
+        /** Returns a RenderOperation structure required to render this mesh.
+            @param 
+                rend Reference to a RenderOperation structure to populate.
+            @param
+                lodIndex The index of the LOD to use. 
+        */
+        void _getRenderOperation(RenderOperation& rend, ushort lodIndex = 0);
+
+        /** Assigns a vertex to a bone with a given weight, for skeletal animation. 
+        @remarks    
+            This method is only valid after calling setSkeletonName.
+            Since this is a one-off process there exists only 'addBoneAssignment' and
+            'clearBoneAssignments' methods, no 'editBoneAssignment'. You should not need
+            to modify bone assignments during rendering (only the positions of bones) and OGRE
+            reserves the right to do some internal data reformatting of this information, depending
+            on render system requirements.
+        @par
+            This method is for assigning weights to the dedicated geometry of the SubMesh. To assign
+            weights to the shared Mesh geometry, see the equivalent methods on Mesh.
+        */
+        void addBoneAssignment(const VertexBoneAssignment& vertBoneAssign);
+
+        /** Removes all bone assignments for this mesh. 
+        @par
+            This method is for assigning weights to the dedicated geometry of the SubMesh. To assign
+            weights to the shared Mesh geometry, see the equivalent methods on Mesh.
+        */
+        void clearBoneAssignments(void);
+
+        /// Multimap of verex bone assignments (orders by vertex index)
+        typedef multimap<size_t, VertexBoneAssignment>::type VertexBoneAssignmentList;
+        typedef MapIterator<VertexBoneAssignmentList> BoneAssignmentIterator;
+
+        /** Gets an iterator for access all bone assignments. 
+        @remarks
+            Only valid if this SubMesh has dedicated geometry.
+        */
+        BoneAssignmentIterator getBoneAssignmentIterator(void);
+
+		/** Gets a const reference to the list of bone assignments
+		*/
+		const VertexBoneAssignmentList& getBoneAssignments() { return mBoneAssignments; }
+
+
+        /** Must be called once to compile bone assignments into geometry buffer. */
+        void _compileBoneAssignments(void);
+
+        typedef ConstMapIterator<AliasTextureNamePairList> AliasTextureIterator;
+        /** Gets an constant iterator to access all texture alias names assigned to this submesh. 
+
+        */
+        AliasTextureIterator getAliasTextureIterator(void) const;
+        /** Adds the alias or replaces an existing one and associates the texture name to it.
+        @remarks
+          The submesh uses the texture alias to replace textures used in the material applied
+          to the submesh.
+        @param
+            aliasName is the name of the alias.
+        @param
+            textureName is the name of the texture to be associated with the alias
+
+        */
+        void addTextureAlias(const String& aliasName, const String& textureName);
+        /** Remove a specific texture alias name from the sub mesh
+        @param
+            aliasName is the name of the alias to be removed.  If it is not found 
+            then it is ignored.
+        */
+        void removeTextureAlias(const String& aliasName);
+        /** removes all texture aliases from the sub mesh
+        */
+        void removeAllTextureAliases(void);
+        /** returns true if the sub mesh has texture aliases
+        */
+        bool hasTextureAliases(void) const { return !mTextureAliases.empty(); }
+        /** Gets the number of texture aliases assigned to the sub mesh.
+        */
+        size_t getTextureAliasCount(void) const { return mTextureAliases.size(); }
+
+        /**  The current material used by the submesh is copied into a new material
+            and the submesh's texture aliases are applied if the current texture alias
+            names match those found in the original material.
+        @remarks
+            The submesh's texture aliases must be setup prior to calling this method.
+            If a new material has to be created, the subMesh autogenerates the new name.
+            The new name is the old name + "_" + number.
+        @return 
+            True if texture aliases were applied and a new material was created.
+        */
+        bool updateMaterialUsingTextureAliases(void);
+
+		/** Get the type of any vertex animation used by dedicated geometry.
+		*/
+		VertexAnimationType getVertexAnimationType(void) const;
+		
+		/// Returns whether animation on dedicated vertex data includes normals
+		bool getVertexAnimationIncludesNormals() const { return mVertexAnimationIncludesNormals; }
+
+
+        /** Generate the submesh extremes (@see extremityPoints).
+        @param count
+            Number of extreme points to compute for the submesh.
+        */
+        void generateExtremes(size_t count);
+
+		/** Returns true(by default) if the submesh should be included in the mesh EdgeList, otherwise returns false.
+        */		
+		bool isBuildEdgesEnabled(void) const { return mBuildEdgesEnabled; }
+		void setBuildEdgesEnabled(bool b);
+        /** Makes a copy of this submesh object and gives it a new name.
+         @param newName
+         The name to give the clone.
+         @param parentMesh
+         Optional mesh to make the parent of the newly created clone.
+         If you leave this blank, the clone will be parented to the same Mesh as the original.
+         */
+        SubMesh * clone(const String& newName, Mesh *parentMesh = 0);
+
+    protected:
+
+        /// Name of the material this SubMesh uses.
+        String mMaterialName;
+
+        /// Is there a material yet?
+        bool mMatInitialised;
+
+        /// paired list of texture aliases and texture names
+        AliasTextureNamePairList mTextureAliases;
+
+        VertexBoneAssignmentList mBoneAssignments;
+
+        /// Flag indicating that bone assignments need to be recompiled
+        bool mBoneAssignmentsOutOfDate;
+
+		/// Type of vertex animation for dedicated vertex data (populated by Mesh)
+		mutable VertexAnimationType mVertexAnimationType;
+
+		/// Whether normals are included in vertex animation keyframes
+		mutable bool mVertexAnimationIncludesNormals;
+
+		/// Is Build Edges Enabled
+		bool mBuildEdgesEnabled;
+
+        /// Internal method for removing LOD data
+        void removeLodLevels(void);
+
+
+    };
+	/** @} */
+	/** @} */
+
+} // namespace
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreTagPoint.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreTagPoint.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreTagPoint.h	(revision 148)
@@ -0,0 +1,123 @@
+/*
+-----------------------------------------------------------------------------
+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 __TagPoint_H_
+#define __TagPoint_H_
+
+#include "OgrePrerequisites.h"
+
+#include "OgreBone.h"
+#include "OgreMatrix4.h"
+
+namespace Ogre	{
+
+
+	
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Animation
+	*  @{
+	*/
+	/** A tagged point on a skeleton, which can be used to attach entities to on specific
+        other entities.
+    @remarks
+        A Skeleton, like a Mesh, is shared between Entity objects and simply updated as required
+        when it comes to rendering. However there are times when you want to attach another object
+        to an animated entity, and make sure that attachment follows the parent entity's animation
+        (for example, a character holding a gun in his / her hand). This class simply identifies
+        attachment points on a skeleton which can be used to attach child objects. 
+    @par
+        The child objects themselves are not physically attached to this class; as it's name suggests
+        this class just 'tags' the area. The actual child objects are attached to the Entity using the
+        skeleton which has this tag point. Use the Entity::attachMovableObjectToBone method to attach
+        the objects, which creates a new TagPoint on demand.
+    */
+    class _OgreExport TagPoint : public Bone
+	{
+
+	public:
+		TagPoint(unsigned short handle, Skeleton* creator);
+		virtual ~TagPoint();
+
+		Entity *getParentEntity(void) const;
+        MovableObject* getChildObject(void) const;
+		
+		void setParentEntity(Entity *pEntity);
+		void setChildObject(MovableObject *pObject);
+
+        /** Tells the TagPoint whether it should inherit orientation from it's parent entity.
+        @param inherit If true, this TagPoint's orientation will be affected by
+            its parent entity's orientation. If false, it will not be affected.
+        */
+        void setInheritParentEntityOrientation(bool inherit);
+
+        /** Returns true if this TagPoint is affected by orientation applied to the parent entity. 
+        */
+        bool getInheritParentEntityOrientation(void) const;
+
+        /** Tells the TagPoint whether it should inherit scaling factors from it's parent entity.
+        @param inherit If true, this TagPoint's scaling factors will be affected by
+            its parent entity's scaling factors. If false, it will not be affected.
+        */
+        void setInheritParentEntityScale(bool inherit);
+
+        /** Returns true if this TagPoint is affected by scaling factors applied to the parent entity. 
+        */
+        bool getInheritParentEntityScale(void) const;
+
+		/** Gets the transform of parent entity. */
+		const Matrix4& getParentEntityTransform(void) const;
+
+        /** Gets the transform of this node just for the skeleton (not entity) */
+		const Matrix4& _getFullLocalTransform(void) const;
+
+        /** @copydoc Node::needUpdate */
+        void needUpdate(bool forceParentUpdate = false);
+
+        /** Overridden from Node in order to include parent Entity transform. */
+        void updateFromParentImpl(void) const;
+        /** @copydoc Renderable::getLights */
+        const LightList& getLights(void) const;
+
+
+
+	private:
+		Entity *mParentEntity;
+		MovableObject *mChildObject;
+        mutable Matrix4 mFullLocalTransform;
+        bool mInheritParentEntityOrientation;
+        bool mInheritParentEntityScale;
+	};
+
+	/** @} */
+	/** @} */
+
+} //namespace
+
+
+#endif//__TagPoint_H_
Index: /ogre_src_v1-9-0/OgreMain/include/OgreTangentSpaceCalc.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreTangentSpaceCalc.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreTangentSpaceCalc.h	(revision 148)
@@ -0,0 +1,270 @@
+/*
+-----------------------------------------------------------------------------
+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 _OgreTangentSpaceCalc_H_
+#define _OgreTangentSpaceCalc_H_
+
+#include "OgrePrerequisites.h"
+#include "OgreRenderOperation.h"
+#include "OgreVector2.h"
+#include "OgreVector3.h"
+#include "OgreVertexIndexData.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre
+{
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Math
+	*  @{
+	*/
+	/** Class for calculating a tangent space basis.
+	*/
+	class _OgreExport TangentSpaceCalc
+	{
+	public:
+		TangentSpaceCalc();
+		virtual ~TangentSpaceCalc();
+
+		typedef std::pair<size_t, size_t> VertexSplit;
+
+		/// Information about a remapped index
+		struct IndexRemap
+		{
+			/// Index data set (can be >0 if more than one index data was added)
+			size_t indexSet;
+			/// The position in the index buffer that's affected
+			size_t faceIndex;
+			/// The old and new vertex index
+			VertexSplit splitVertex;
+		
+			IndexRemap() {} // to keep container happy
+			IndexRemap(size_t i, size_t f, const VertexSplit& s) : indexSet(i), faceIndex(f), splitVertex(s) {}
+		};
+		/** List of indexes that were remapped (split vertices).
+		*/
+		typedef list<IndexRemap>::type IndexRemapList;
+
+		typedef list<VertexSplit>::type VertexSplits;
+
+		/// The result of having built a tangent space basis
+		struct Result
+		{
+			/** A list of vertex indices which were split off into new vertices
+				because of mirroring. First item in each pair is the source vertex 
+				index, the second value is the split vertex index.
+			*/
+			VertexSplits vertexSplits;
+			/** A list of indexes which were affected by splits. You can use this if you have other
+				triangle-based data which you will need to alter to match. */
+			IndexRemapList indexesRemapped;
+		};
+
+		/// Reset the calculation object
+		void clear();
+
+		/** Set the incoming vertex data (which will be modified) */
+		void setVertexData(VertexData* v_in);
+
+		/** Add a set of index data that references the vertex data.
+			This might be modified if there are vertex splits.
+		*/
+		void addIndexData(IndexData* i_in, RenderOperation::OperationType opType = RenderOperation::OT_TRIANGLE_LIST);
+
+		/** Sets whether to store tangent space parity in the W of a 4-component tangent or not.
+		@remarks
+			The default element format to use is VET_FLOAT3 which is enough to accurately 
+			deal with tangents that do not involve any texture coordinate mirroring. 
+			If you wish to allow UV mirroring in your model, you must enable 4-component
+			tangents using this method, and the 'w' co-ordinate will be populated
+			with the parity of the triangle (+1 or -1), which will allow you to generate
+			the bitangent properly.
+		@param enabled true to enable 4-component tangents (default false). If you enable
+			this, you will probably also want to enable mirror splitting (see setSplitMirrored), 
+			and your shader must understand how to deal with the parity.
+		*/
+		void setStoreParityInW(bool enabled) { mStoreParityInW = enabled; }
+
+		/**  Gets whether to store tangent space parity in the W of a 4-component tangent or not. */
+		bool getStoreParityInW() const { return mStoreParityInW; }
+
+		/** Sets whether or not to split vertices when a mirrored tangent space
+			transition is detected (matrix parity differs).
+		@remarks
+			This defaults to 'off' because it's the safest option; tangents will be
+			interpolated in all cases even if they don't agree around a vertex, so
+			artefacts will be smoothed out. When you're using art assets of 
+			unknown quality this can avoid extra seams on the visible surface. 
+			However, if your artists are good, they will be hiding texture seams
+			in folds of the model and thus you can turn this option on, which will
+			prevent the results of those seams from getting smoothed into other
+			areas, which is exactly what you want.
+		@note This option is automatically disabled if you provide any strip or
+			fan based geometry.
+		*/
+		void setSplitMirrored(bool split) { mSplitMirrored = split; }
+		
+		/** Gets whether or not to split vertices when a mirrored tangent space
+			transition is detected.
+		*/
+		bool getSplitMirrored() const { return mSplitMirrored; }
+
+		/** Sets whether or not to split vertices when tangent space rotates
+			more than 90 degrees around a vertex.
+		@remarks
+			This defaults to 'off' because it's the safest option; tangents will be
+			interpolated in all cases even if they don't agree around a vertex, so
+			artefacts will be smoothed out. When you're using art assets of 
+			unknown quality this can avoid extra seams on the visible surface. 
+			However, if your artists are good, they will be hiding texture inconsistencies
+			in folds of the model and thus you can turn this option on, which will
+			prevent the results of those seams from getting smoothed into other
+			areas, which is exactly what you want.
+		@note This option is automatically disabled if you provide any strip or
+			fan based geometry.
+		*/
+		void setSplitRotated(bool split) { mSplitRotated = split; }
+		/** Sets whether or not to split vertices when tangent space rotates
+		more than 90 degrees around a vertex.
+		*/
+		bool getSplitRotated() const { return mSplitRotated; }
+
+		/** Build a tangent space basis from the provided data.
+		@remarks
+			Only indexed triangle lists are allowed. Strips and fans cannot be
+			supported because it may be necessary to split the geometry up to 
+			respect deviances in the tangent space basis better.
+		@param targetSemantic The semantic to store the tangents in. Defaults to 
+			the explicit tangent binding, but note that this is only usable on more
+			modern hardware (Shader Model 2), so if you need portability with older
+			cards you should change this to a texture coordinate binding instead.
+        @param sourceTexCoordSet The texture coordinate index which should be used as the source
+            of 2D texture coordinates, with which to calculate the tangents.
+        @param index The element index, ie the texture coordinate set which should be used to store the 3D
+            coordinates representing a tangent vector per vertex, if targetSemantic is 
+			VES_TEXTURE_COORDINATES. If this already exists, it will be overwritten.
+		@return
+			A structure containing the results of the tangent space build. Vertex data
+			will always be modified but it's also possible that the index data
+			could be adjusted. This happens when mirroring is used on a mesh, which
+			causes the tangent space to be inverted on opposite sides of an edge.
+			This is discontinuous, therefore the vertices have to be split along
+			this edge, resulting in new vertices.
+		*/
+		Result build(VertexElementSemantic targetSemantic = VES_TANGENT,
+			unsigned short sourceTexCoordSet = 0, unsigned short index = 1);
+
+
+	protected:
+
+		VertexData* mVData;
+		typedef vector<IndexData*>::type IndexDataList;
+		typedef vector<RenderOperation::OperationType>::type OpTypeList;
+		IndexDataList mIDataList;
+		OpTypeList mOpTypes;
+		bool mSplitMirrored;
+		bool mSplitRotated;
+		bool mStoreParityInW;
+
+
+		struct VertexInfo
+		{
+			Vector3 pos;
+			Vector3 norm;
+			Vector2 uv;
+			Vector3 tangent;
+			Vector3 binormal;
+			// Which way the tangent space is oriented (+1 / -1) (set on first time found)
+			int parity;
+			// What index the opposite parity vertex copy is at (0 if not created yet)
+			size_t oppositeParityIndex;
+
+			VertexInfo() : tangent(Vector3::ZERO), binormal(Vector3::ZERO), 
+				parity(0), oppositeParityIndex(0) {}
+		};
+		typedef vector<VertexInfo>::type VertexInfoArray;
+		VertexInfoArray mVertexArray;
+
+		void extendBuffers(VertexSplits& splits);
+		void insertTangents(Result& res,
+			VertexElementSemantic targetSemantic, 
+			unsigned short sourceTexCoordSet, unsigned short index);
+
+		void populateVertexArray(unsigned short sourceTexCoordSet);
+		void processFaces(Result& result);
+		/// Calculate face tangent space, U and V are weighted by UV area, N is normalised
+		void calculateFaceTangentSpace(const size_t* vertInd, Vector3& tsU, Vector3& tsV, Vector3& tsN);
+		Real calculateAngleWeight(size_t v0, size_t v1, size_t v2);
+		int calculateParity(const Vector3& u, const Vector3& v, const Vector3& n);
+		void addFaceTangentSpaceToVertices(size_t indexSet, size_t faceIndex, size_t *localVertInd, 
+			const Vector3& faceTsU, const Vector3& faceTsV, const Vector3& faceNorm, Result& result);
+		void normaliseVertices();
+		void remapIndexes(Result& res);
+		template <typename T>
+		void remapIndexes(T* ibuf, size_t indexSet, Result& res)
+		{
+			for (IndexRemapList::iterator i = res.indexesRemapped.begin();
+				i != res.indexesRemapped.end(); ++i)
+			{
+				IndexRemap& remap = *i;
+
+				// Note that because this is a vertex split situation, and vertex
+				// split is only for some faces, it's not a case of replacing all
+				// instances of vertex index A with vertex index B
+				// It actually matters which triangle we're talking about, so drive
+				// the update from the face index
+
+				if (remap.indexSet == indexSet)
+				{
+					T* pBuf;
+					pBuf = ibuf + remap.faceIndex * 3;
+
+					for (int v = 0; v < 3; ++v, ++pBuf)
+					{
+						if (*pBuf == remap.splitVertex.first)
+						{
+							*pBuf = (T)remap.splitVertex.second;
+						}
+					}
+				}
+
+
+			}
+		}
+		
+
+	};
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreTechnique.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreTechnique.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreTechnique.h	(revision 148)
@@ -0,0 +1,716 @@
+/*
+-----------------------------------------------------------------------------
+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 __Technique_H__
+#define __Technique_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreBlendMode.h"
+#include "OgreCommon.h"
+#include "OgrePass.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreRenderSystemCapabilities.h"
+#include "OgreUserObjectBindings.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Materials
+	*  @{
+	*/
+	/** Class representing an approach to rendering this particular Material. 
+    @remarks
+        Ogre will attempt to use the best technique supported by the active hardware, 
+        unless you specifically request a lower detail technique (say for distant
+        rendering).
+    */
+	class _OgreExport Technique : public TechniqueAlloc
+    {
+    protected:
+        /// Illumination pass state type
+        enum IlluminationPassesState
+        {
+            IPS_COMPILE_DISABLED = -1,
+            IPS_NOT_COMPILED = 0,
+            IPS_COMPILED = 1
+        };
+
+        typedef vector<Pass*>::type Passes;
+        /// List of primary passes
+        Passes mPasses;
+        /// List of derived passes, categorised into IlluminationStage (ordered)
+        IlluminationPassList mIlluminationPasses;
+        // Raw pointer since we don't want child to stop parent's destruction
+        Material* mParent;
+        bool mIsSupported;
+        IlluminationPassesState mIlluminationPassesCompilationPhase;
+		/// LOD level
+        unsigned short mLodIndex;
+		/** Scheme index, derived from scheme name but the names are held on
+			MaterialManager, for speed an index is used here.
+		*/
+		unsigned short mSchemeIndex;
+        /// Optional name for the technique
+        String mName;
+
+        /// Internal method for clearing illumination pass list
+        void clearIlluminationPasses(void);
+		/// Internal method - check for manually assigned illumination passes
+		bool checkManuallyOrganisedIlluminationPasses();
+
+
+		/** When casting shadow, if not using default Ogre shadow casting material, or 
+		* nor using fixed function casting, mShadowCasterMaterial let you customize per material
+		* shadow caster behavior
+		*/
+		MaterialPtr mShadowCasterMaterial;
+		/** When casting shadow, if not using default Ogre shadow casting material, or 
+		* nor using fixed function casting, mShadowCasterMaterial let you customize per material
+		* shadow caster behavior.There only material name is stored so that it can be loaded once all file parsed in a resource group.
+		*/
+		String mShadowCasterMaterialName;
+		/** When receiving shadow, if not using default Ogre shadow receiving material, or 
+		* nor using fixed function texture projection receiving, mShadowReceiverMaterial let you customize per material
+		* shadow caster behavior
+		*/
+		MaterialPtr mShadowReceiverMaterial;
+		/** When receiving shadow, if not using default Ogre shadow receiving material, or 
+		* nor using fixed function texture projection receiving, mShadowReceiverMaterial let you customize per material
+		* shadow caster behavior. There only material name is stored so that it can be loaded once all file parsed in a resource group.
+		*/
+		String mShadowReceiverMaterialName;	
+
+		// User objects binding.
+		UserObjectBindings	mUserObjectBindings;
+
+	public:
+		/** Directive used to manually control technique support based on the
+			inclusion or exclusion of some factor.
+		*/
+		enum IncludeOrExclude
+		{
+			/// Inclusive - only support if present
+			INCLUDE = 0,
+			/// Exclusive - do not support if present
+			EXCLUDE = 1
+		};
+		/// Rule controlling whether technique is deemed supported based on GPU vendor
+		struct GPUVendorRule
+		{
+			GPUVendor vendor;
+			IncludeOrExclude includeOrExclude;
+			GPUVendorRule()
+				: vendor(GPU_UNKNOWN), includeOrExclude(EXCLUDE) {}
+			GPUVendorRule(GPUVendor v, IncludeOrExclude ie)
+				: vendor(v), includeOrExclude(ie) {}
+		};
+		/// Rule controlling whether technique is deemed supported based on GPU device name
+		struct GPUDeviceNameRule
+		{
+			String devicePattern;
+			IncludeOrExclude includeOrExclude;
+			bool caseSensitive;
+			GPUDeviceNameRule()
+				: includeOrExclude(EXCLUDE), caseSensitive(false) {}
+			GPUDeviceNameRule(const String& pattern, IncludeOrExclude ie, bool caseSen)
+				: devicePattern(pattern), includeOrExclude(ie), caseSensitive(caseSen) {}
+		};
+		typedef vector<GPUVendorRule>::type GPUVendorRuleList;
+		typedef vector<GPUDeviceNameRule>::type GPUDeviceNameRuleList;
+	protected:
+		GPUVendorRuleList mGPUVendorRules;
+		GPUDeviceNameRuleList mGPUDeviceNameRules;
+	public:
+        /// Constructor
+        Technique(Material* parent);
+        /// Copy constructor
+        Technique(Material* parent, const Technique& oth);
+        ~Technique();
+        /** Indicates if this technique is supported by the current graphics card.
+        @remarks
+            This will only be correct after the Technique has been compiled, which is
+            usually done from Material::compile.
+        */
+        bool isSupported(void) const;
+        /** Internal compilation method; see Material::compile. 
+		@return Any information explaining problems with the compile.
+		*/
+        String _compile(bool autoManageTextureUnits);
+		/// Internal method for checking GPU vendor / device rules
+		bool checkGPURules(StringUtil::StrStreamType& errors);
+		/// Internal method for checking hardware support
+		bool checkHardwareSupport(bool autoManageTextureUnits, StringUtil::StrStreamType& compileErrors);
+        /** Internal method for splitting the passes into illumination passes. */        
+        void _compileIlluminationPasses(void);
+		size_t calculateSize(void) const;
+
+        /** Creates a new Pass for this Technique.
+        @remarks
+            A Pass is a single rendering pass, i.e. a single draw of the given material.
+            Note that if you create a pass without a fragment program, during compilation of the
+            material the pass may be split into multiple passes if the graphics card cannot
+            handle the number of texture units requested. For passes with fragment programs, however, 
+            the number of passes you create will never be altered, so you have to make sure 
+            that you create an alternative fallback Technique for if a card does not have 
+            enough facilities for what you're asking for.
+        */
+        Pass* createPass(void);
+        /** Retrieves the Pass with the given index. */
+        Pass* getPass(unsigned short index);
+        /** Retrieves the Pass matching name.
+            Returns 0 if name match is not found.
+        */
+        Pass* getPass(const String& name);
+        /** Retrieves the number of passes. */
+        unsigned short getNumPasses(void) const;
+        /** Removes the Pass with the given index. */
+        void removePass(unsigned short index);
+        /** Removes all Passes from this Technique. */
+        void removeAllPasses(void);
+        /** Move a pass from source index to destination index.
+            If successful then returns true.
+        */
+        bool movePass(const unsigned short sourceIndex, const unsigned short destinationIndex);
+        typedef VectorIterator<Passes> PassIterator;
+        /** Gets an iterator over the passes in this Technique. */
+        const PassIterator getPassIterator(void);
+        typedef VectorIterator<IlluminationPassList> IlluminationPassIterator;
+        /** Gets an iterator over the illumination-stage categorised passes. */
+        const IlluminationPassIterator getIlluminationPassIterator(void);
+        /// Gets the parent Material
+        Material* getParent(void) const { return mParent; }
+
+        /** Overloaded operator to copy on Technique to another. */
+        Technique& operator=(const Technique& rhs);
+
+		/// Gets the resource group of the ultimate parent Material
+		const String& getResourceGroup(void) const;
+
+		/** Returns true if this Technique involves transparency. 
+		@remarks
+			This basically boils down to whether the first pass
+			has a scene blending factor. Even if the other passes 
+			do not, the base colour, including parts of the original 
+			scene, may be used for blending, therefore we have to treat
+			the whole Technique as transparent.
+		*/
+		bool isTransparent(void) const;
+
+		/** Returns true if this Technique has transparent sorting enabled. 
+		@remarks
+			This basically boils down to whether the first pass
+			has transparent sorting enabled or not
+		*/
+		bool isTransparentSortingEnabled(void) const;
+
+		/** Returns true if this Technique has transparent sorting forced. 
+		@remarks
+			This basically boils down to whether the first pass
+			has transparent sorting forced or not
+		*/
+		bool isTransparentSortingForced(void) const;
+
+        /** Internal prepare method, derived from call to Material::prepare. */
+        void _prepare(void);
+        /** Internal unprepare method, derived from call to Material::unprepare. */
+        void _unprepare(void);
+        /** Internal load method, derived from call to Material::load. */
+        void _load(void);
+        /** Internal unload method, derived from call to Material::unload. */
+        void _unload(void);
+
+        /// Is this loaded?
+        bool isLoaded(void) const;
+
+        /** Tells the technique that it needs recompilation. */
+        void _notifyNeedsRecompile(void);
+
+		/** return this material specific  shadow casting specific material
+		*/
+		Ogre::MaterialPtr getShadowCasterMaterial() const;
+		/** set this material specific  shadow casting specific material
+		*/
+		void setShadowCasterMaterial(Ogre::MaterialPtr val);
+		/** set this material specific  shadow casting specific material
+		*/
+		void setShadowCasterMaterial(const Ogre::String &name);
+		/** return this material specific shadow receiving specific material
+		*/
+		Ogre::MaterialPtr getShadowReceiverMaterial() const;
+		/** set this material specific  shadow receiving specific material
+		*/
+		void setShadowReceiverMaterial(Ogre::MaterialPtr val);
+		/** set this material specific  shadow receiving specific material
+		*/
+		void setShadowReceiverMaterial(const Ogre::String &name);
+
+        // -------------------------------------------------------------------------------
+        // The following methods are to make migration from previous versions simpler
+        // and to make code easier to write when dealing with simple materials
+        // They set the properties which have been moved to Pass for all Techniques and all Passes
+
+        /** Sets the point size properties for every Pass in this Technique.
+        @note
+            This property actually exists on the Pass class. For simplicity, this method allows 
+            you to set these properties for every current Pass within this Technique. If 
+            you need more precision, retrieve the Pass instance and set the
+            property there.
+        @see Pass::setPointSize
+        */
+        void setPointSize(Real ps);
+
+        /** Sets the ambient colour reflectance properties for every Pass in every Technique.
+        @note
+            This property actually exists on the Pass class. For simplicity, this method allows 
+            you to set these properties for every current Pass within this Technique. If 
+            you need more precision, retrieve the Pass instance and set the
+            property there.
+        @see Pass::setAmbient
+        */
+        void setAmbient(Real red, Real green, Real blue);
+
+        /** Sets the ambient colour reflectance properties for every Pass in every Technique.
+        @note
+            This property actually exists on the Pass class. For simplicity, this method allows 
+            you to set these properties for every current Pass within this Technique. If 
+            you need more precision, retrieve the Pass instance and set the
+            property there.
+        @see Pass::setAmbient
+        */
+        void setAmbient(const ColourValue& ambient);
+
+        /** Sets the diffuse colour reflectance properties of every Pass in every Technique.
+        @note
+            This property actually exists on the Pass class. For simplicity, this method allows 
+            you to set these properties for every current Pass within this Technique. If 
+            you need more precision, retrieve the Pass instance and set the
+            property there.
+        @see Pass::setDiffuse
+        */
+        void setDiffuse(Real red, Real green, Real blue, Real alpha);
+
+        /** Sets the diffuse colour reflectance properties of every Pass in every Technique.
+        @note
+            This property actually exists on the Pass class. For simplicity, this method allows 
+            you to set these properties for every current Pass within this Technique. If 
+            you need more precision, retrieve the Pass instance and set the
+            property there.
+        @see Pass::setDiffuse
+        */
+        void setDiffuse(const ColourValue& diffuse);
+
+        /** Sets the specular colour reflectance properties of every Pass in every Technique.
+        @note
+            This property actually exists on the Pass class. For simplicity, this method allows 
+            you to set these properties for every current Pass within this Technique. If 
+            you need more precision, retrieve the Pass instance and set the
+            property there.
+        @see Pass::setSpecular
+        */
+        void setSpecular(Real red, Real green, Real blue, Real alpha);
+
+        /** Sets the specular colour reflectance properties of every Pass in every Technique.
+        @note
+            This property actually exists on the Pass class. For simplicity, this method allows 
+            you to set these properties for every current Pass within this Technique. If 
+            you need more precision, retrieve the Pass instance and set the
+            property there.
+        @see Pass::setSpecular
+        */
+        void setSpecular(const ColourValue& specular);
+
+        /** Sets the shininess properties of every Pass in every Technique.
+        @note
+            This property actually exists on the Pass class. For simplicity, this method allows 
+            you to set these properties for every current Pass within this Technique. If 
+            you need more precision, retrieve the Pass instance and set the
+            property there.
+        @see Pass::setShininess
+        */
+        void setShininess(Real val);
+
+        /** Sets the amount of self-illumination of every Pass in every Technique.
+        @note
+            This property actually exists on the Pass class. For simplicity, this method allows 
+            you to set these properties for every current Pass within this Technique. If 
+            you need more precision, retrieve the Pass instance and set the
+            property there.
+        @see Pass::setSelfIllumination
+        */
+        void setSelfIllumination(Real red, Real green, Real blue);
+
+        /** Sets the amount of self-illumination of every Pass in every Technique.
+        @note
+            This property actually exists on the Pass class. For simplicity, this method allows 
+            you to set these properties for every current Pass within this Technique. If 
+            you need more precision, retrieve the Pass instance and set the
+            property there.
+        @see Pass::setSelfIllumination
+        */
+        void setSelfIllumination(const ColourValue& selfIllum);
+
+		/** Sets whether or not each Pass renders with depth-buffer checking on or not.
+        @note
+            This property actually exists on the Pass class. For simplicity, this method allows 
+            you to set these properties for every current Pass within this Technique. If 
+            you need more precision, retrieve the Pass instance and set the
+            property there.
+        @see Pass::setDepthCheckEnabled
+        */
+        void setDepthCheckEnabled(bool enabled);
+
+        /** Sets whether or not each Pass renders with depth-buffer writing on or not.
+        @note
+            This property actually exists on the Pass class. For simplicity, this method allows 
+            you to set these properties for every current Pass within this Technique. If 
+            you need more precision, retrieve the Pass instance and set the
+            property there.
+        @see Pass::setDepthWriteEnabled
+        */
+        void setDepthWriteEnabled(bool enabled);
+
+        /** Sets the function used to compare depth values when depth checking is on.
+        @note
+            This property actually exists on the Pass class. For simplicity, this method allows 
+            you to set these properties for every current Pass within this Technique. If 
+            you need more precision, retrieve the Pass instance and set the
+            property there.
+        @see Pass::setDepthFunction
+        */
+        void setDepthFunction( CompareFunction func );
+
+		/** Sets whether or not colour buffer writing is enabled for each Pass.
+        @note
+            This property actually exists on the Pass class. For simplicity, this method allows 
+            you to set these properties for every current Pass within this Technique. If 
+            you need more precision, retrieve the Pass instance and set the
+            property there.
+        @see Pass::setColourWriteEnabled
+		*/
+		void setColourWriteEnabled(bool enabled);
+
+        /** Sets the culling mode for each pass  based on the 'vertex winding'.
+        @note
+            This property actually exists on the Pass class. For simplicity, this method allows 
+            you to set these properties for every current Pass within this Technique. If 
+            you need more precision, retrieve the Pass instance and set the
+            property there.
+        @see Pass::setCullingMode
+        */
+        void setCullingMode( CullingMode mode );
+
+        /** Sets the manual culling mode, performed by CPU rather than hardware.
+        @note
+            This property actually exists on the Pass class. For simplicity, this method allows 
+            you to set these properties for every current Pass within this Technique. If 
+            you need more precision, retrieve the Pass instance and set the
+            property there.
+        @see Pass::setManualCullingMode
+        */
+        void setManualCullingMode( ManualCullingMode mode );
+
+        /** Sets whether or not dynamic lighting is enabled for every Pass.
+        @note
+            This property actually exists on the Pass class. For simplicity, this method allows 
+            you to set these properties for every current Pass within this Technique. If 
+            you need more precision, retrieve the Pass instance and set the
+            property there.
+        @see Pass::setLightingEnabled
+        */
+        void setLightingEnabled(bool enabled);
+
+        /** Sets the type of light shading required
+        @note
+            This property actually exists on the Pass class. For simplicity, this method allows 
+            you to set these properties for every current Pass within this Technique. If 
+            you need more precision, retrieve the Pass instance and set the
+            property there.
+        @see Pass::setShadingMode
+        */
+        void setShadingMode( ShadeOptions mode );
+
+        /** Sets the fogging mode applied to each pass.
+        @note
+            This property actually exists on the Pass class. For simplicity, this method allows 
+            you to set these properties for every current Pass within this Technique. If 
+            you need more precision, retrieve the Pass instance and set the
+            property there.
+        @see Pass::setFog
+        */
+        void setFog(
+            bool overrideScene,
+            FogMode mode = FOG_NONE,
+            const ColourValue& colour = ColourValue::White,
+            Real expDensity = 0.001, Real linearStart = 0.0, Real linearEnd = 1.0 );
+
+        /** Sets the depth bias to be used for each Pass.
+        @note
+            This property actually exists on the Pass class. For simplicity, this method allows 
+            you to set these properties for every current Pass within this Technique. If 
+            you need more precision, retrieve the Pass instance and set the
+            property there.
+        @see Pass::setDepthBias
+        */
+        void setDepthBias(float constantBias, float slopeScaleBias);
+
+        /** Set texture filtering for every texture unit in every Pass
+        @note
+            This property actually exists on the TextureUnitState class
+            For simplicity, this method allows you to set these properties for 
+            every current TeextureUnitState, If you need more precision, retrieve the  
+            Pass and TextureUnitState instances and set the property there.
+        @see TextureUnitState::setTextureFiltering
+        */
+        void setTextureFiltering(TextureFilterOptions filterType);
+        /** Sets the anisotropy level to be used for all textures.
+        @note
+            This property has been moved to the TextureUnitState class, which is accessible via the 
+            Technique and Pass. For simplicity, this method allows you to set these properties for 
+            every current TeextureUnitState, If you need more precision, retrieve the Technique, 
+            Pass and TextureUnitState instances and set the property there.
+        @see TextureUnitState::setTextureAnisotropy
+        */
+        void setTextureAnisotropy(unsigned int maxAniso);
+
+        /** Sets the kind of blending every pass has with the existing contents of the scene.
+        @note
+            This property actually exists on the Pass class. For simplicity, this method allows 
+            you to set these properties for every current Pass within this Technique. If 
+            you need more precision, retrieve the Pass instance and set the
+            property there.
+        @see Pass::setSceneBlending
+        */
+        void setSceneBlending( const SceneBlendType sbt );
+
+        /** Sets the kind of blending every pass has with the existing contents of the scene, using individual factors both color and alpha channels
+        @note
+            This property actually exists on the Pass class. For simplicity, this method allows 
+            you to set these properties for every current Pass within this Technique. If 
+            you need more precision, retrieve the Pass instance and set the
+            property there.
+        @see Pass::setSeparateSceneBlending
+        */
+        void setSeparateSceneBlending( const SceneBlendType sbt, const SceneBlendType sbta );
+
+        /** Allows very fine control of blending every Pass with the existing contents of the scene.
+        @note
+            This property actually exists on the Pass class. For simplicity, this method allows 
+            you to set these properties for every current Pass within this Technique. If 
+            you need more precision, retrieve the Pass instance and set the
+            property there.
+        @see Pass::setSceneBlending
+        */
+        void setSceneBlending( const SceneBlendFactor sourceFactor, const SceneBlendFactor destFactor);
+
+        /** Allows very fine control of blending every Pass with the existing contents of the scene, using individual factors both color and alpha channels
+        @note
+            This property actually exists on the Pass class. For simplicity, this method allows 
+            you to set these properties for every current Pass within this Technique. If 
+            you need more precision, retrieve the Pass instance and set the
+            property there.
+        @see Pass::setSeparateSceneBlending
+        */
+        void setSeparateSceneBlending( const SceneBlendFactor sourceFactor, const SceneBlendFactor destFactor, const SceneBlendFactor sourceFactorAlpha, const SceneBlendFactor destFactorAlpha);
+
+        /** Assigns a level-of-detail (LOD) index to this Technique.
+        @remarks
+            As noted previously, as well as providing fallback support for various
+            graphics cards, multiple Technique objects can also be used to implement
+            material LOD, where the detail of the material diminishes with distance to 
+            save rendering power.
+        @par
+            By default, all Techniques have a LOD index of 0, which means they are the highest
+            level of detail. Increasing LOD indexes are lower levels of detail. You can 
+            assign more than one Technique to the same LOD index, meaning that the best 
+            Technique that is supported at that LOD index is used. 
+        @par
+            You should not leave gaps in the LOD sequence; Ogre will allow you to do this
+            and will continue to function as if the LODs were sequential, but it will 
+            confuse matters.
+        */
+        void setLodIndex(unsigned short index);
+        /** Gets the level-of-detail index assigned to this Technique. */
+        unsigned short getLodIndex(void) const { return mLodIndex; }
+
+		/** Set the 'scheme name' for this technique. 
+		@remarks
+			Material schemes are used to control top-level switching from one
+			set of techniques to another. For example, you might use this to 
+			define 'high', 'medium' and 'low' complexity levels on materials
+		    to allow a user to pick a performance / quality ratio. Another
+			possibility is that you have a fully HDR-enabled pipeline for top
+			machines, rendering all objects using unclamped shaders, and a 
+			simpler pipeline for others; this can be implemented using 
+			schemes.
+		@par
+			Every technique belongs to a scheme - if you don't specify one, the
+			Technique belongs to the scheme called 'Default', which is also the
+			scheme used to render by default. The active scheme is set one of
+			two ways - either by calling Viewport::setMaterialScheme, or
+			by manually calling MaterialManager::setActiveScheme.
+		*/
+		void setSchemeName(const String& schemeName);
+		/** Returns the scheme to which this technique is assigned.
+			@see Technique::setSchemeName
+		*/
+		const String& getSchemeName(void) const;
+		
+		/// Internal method for getting the scheme index
+		unsigned short _getSchemeIndex(void) const;
+		   	
+        /** Is depth writing going to occur on this technique? */
+        bool isDepthWriteEnabled(void) const;
+
+        /** Is depth checking going to occur on this technique? */
+        bool isDepthCheckEnabled(void) const;
+
+        /** Exists colour writing disabled pass on this technique? */
+        bool hasColourWriteDisabled(void) const;
+
+        /** Set the name of the technique.
+        @remarks
+		The use of technique name is optional.  Its useful in material scripts where a material could inherit
+		from another material and only want to modify a particular technique.
+        */
+        void setName(const String& name);
+        /// Gets the name of the technique
+        const String& getName(void) const { return mName; }
+
+        /** Applies texture names to Texture Unit State with matching texture name aliases.
+            All passes, and Texture Unit States within the technique are checked.
+            If matching texture aliases are found then true is returned.
+
+        @param
+            aliasList is a map container of texture alias, texture name pairs
+        @param
+            apply set true to apply the texture aliases else just test to see if texture alias matches are found.
+        @return
+            True if matching texture aliases were found in the Technique.
+        */
+        bool applyTextureAliases(const AliasTextureNamePairList& aliasList, const bool apply = true) const;
+
+
+		/** Add a rule which manually influences the support for this technique based
+			on a GPU vendor.
+		@remarks
+			You can use this facility to manually control whether a technique is
+			considered supported, based on a GPU vendor. You can add inclusive
+			or exclusive rules, and you can add as many of each as you like. If
+			at least one inclusive rule is added, a	technique is considered 
+			unsupported if it does not match any of those inclusive rules. If exclusive rules are
+			added, the technique is considered unsupported if it matches any of
+			those inclusive rules. 
+		@note
+			Any rule for the same vendor will be removed before adding this one.
+		@param vendor The GPU vendor
+		@param includeOrExclude Whether this is an inclusive or exclusive rule
+		*/
+		void addGPUVendorRule(GPUVendor vendor, IncludeOrExclude includeOrExclude);
+		/** Add a rule which manually influences the support for this technique based
+			on a GPU vendor.
+		@remarks
+			You can use this facility to manually control whether a technique is
+			considered supported, based on a GPU vendor. You can add inclusive
+			or exclusive rules, and you can add as many of each as you like. If
+			at least one inclusive rule is added, a	technique is considered 
+			unsupported if it does not match any of those inclusive rules. If exclusive rules are
+			added, the technique is considered unsupported if it matches any of
+			those inclusive rules. 
+		@note
+			Any rule for the same vendor will be removed before adding this one.
+		*/
+		void addGPUVendorRule(const GPUVendorRule& rule);
+		/** Removes a matching vendor rule.
+		@see addGPUVendorRule
+		*/
+		void removeGPUVendorRule(GPUVendor vendor);
+		typedef ConstVectorIterator<GPUVendorRuleList> GPUVendorRuleIterator;
+		/// Get an iterator over the currently registered vendor rules.
+		GPUVendorRuleIterator getGPUVendorRuleIterator() const;
+
+		/** Add a rule which manually influences the support for this technique based
+			on a pattern that matches a GPU device name (e.g. '*8800*').
+		@remarks
+			You can use this facility to manually control whether a technique is
+			considered supported, based on a GPU device name pattern. You can add inclusive
+			or exclusive rules, and you can add as many of each as you like. If
+			at least one inclusive rule is added, a	technique is considered 
+			unsupported if it does not match any of those inclusive rules. If exclusive rules are
+			added, the technique is considered unsupported if it matches any of
+			those inclusive rules. The pattern you supply can include wildcard
+			characters ('*') if you only want to match part of the device name.
+		@note
+			Any rule for the same device pattern will be removed before adding this one.
+		@param devicePattern The GPU vendor
+		@param includeOrExclude Whether this is an inclusive or exclusive rule
+		@param caseSensitive Whether the match is case sensitive or not
+		*/
+		void addGPUDeviceNameRule(const String& devicePattern, IncludeOrExclude includeOrExclude, bool caseSensitive = false);
+		/** Add a rule which manually influences the support for this technique based
+			on a pattern that matches a GPU device name (e.g. '*8800*').
+		@remarks
+			You can use this facility to manually control whether a technique is
+			considered supported, based on a GPU device name pattern. You can add inclusive
+			or exclusive rules, and you can add as many of each as you like. If
+			at least one inclusive rule is added, a	technique is considered 
+			unsupported if it does not match any of those inclusive rules. If exclusive rules are
+			added, the technique is considered unsupported if it matches any of
+			those inclusive rules. The pattern you supply can include wildcard
+			characters ('*') if you only want to match part of the device name.
+		@note
+			Any rule for the same device pattern will be removed before adding this one.
+		*/
+		void addGPUDeviceNameRule(const GPUDeviceNameRule& rule);
+		/** Removes a matching device name rule.
+		@see addGPUDeviceNameRule
+		*/
+		void removeGPUDeviceNameRule(const String& devicePattern);
+		typedef ConstVectorIterator<GPUDeviceNameRuleList> GPUDeviceNameRuleIterator;
+		/// Get an iterator over the currently registered device name rules.
+		GPUDeviceNameRuleIterator getGPUDeviceNameRuleIterator() const;
+
+		/** Return an instance of user objects binding associated with this class.
+		You can use it to associate one or more custom objects with this class instance.
+		@see UserObjectBindings::setUserAny.
+		*/
+		UserObjectBindings&	getUserObjectBindings() { return mUserObjectBindings; }
+
+		/** Return an instance of user objects binding associated with this class.
+		You can use it to associate one or more custom objects with this class instance.
+		@see UserObjectBindings::setUserAny.		
+		*/
+		const UserObjectBindings& getUserObjectBindings() const { return mUserObjectBindings; }
+
+    };
+
+	/** @} */
+	/** @} */
+
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreTexture.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreTexture.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreTexture.h	(revision 148)
@@ -0,0 +1,443 @@
+/*
+-----------------------------------------------------------------------------
+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 _Texture_H__
+#define _Texture_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreHardwareBuffer.h"
+#include "OgreResource.h"
+#include "OgreImage.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Resources
+	*  @{
+	*/
+	/** Enum identifying the texture usage
+    */
+    enum TextureUsage
+    {
+		/// @copydoc HardwareBuffer::Usage
+		TU_STATIC = HardwareBuffer::HBU_STATIC,
+		TU_DYNAMIC = HardwareBuffer::HBU_DYNAMIC,
+		TU_WRITE_ONLY = HardwareBuffer::HBU_WRITE_ONLY,
+		TU_STATIC_WRITE_ONLY = HardwareBuffer::HBU_STATIC_WRITE_ONLY, 
+		TU_DYNAMIC_WRITE_ONLY = HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY,
+		TU_DYNAMIC_WRITE_ONLY_DISCARDABLE = HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY_DISCARDABLE,
+		/// Mipmaps will be automatically generated for this texture
+		TU_AUTOMIPMAP = 16,
+		/** This texture will be a render target, i.e. used as a target for render to texture
+		    setting this flag will ignore all other texture usages except TU_AUTOMIPMAP */
+		TU_RENDERTARGET = 32,
+		/// Default to automatic mipmap generation static textures
+		TU_DEFAULT = TU_AUTOMIPMAP | TU_STATIC_WRITE_ONLY
+    };
+
+    /** Enum identifying the texture type
+    */
+    enum TextureType
+    {
+        /// 1D texture, used in combination with 1D texture coordinates
+        TEX_TYPE_1D = 1,
+        /// 2D texture, used in combination with 2D texture coordinates (default)
+        TEX_TYPE_2D = 2,
+        /// 3D volume texture, used in combination with 3D texture coordinates
+        TEX_TYPE_3D = 3,
+        /// 3D cube map, used in combination with 3D texture coordinates
+        TEX_TYPE_CUBE_MAP = 4,
+        /// 2D texture array
+        TEX_TYPE_2D_ARRAY = 5,
+        /// 2D non-square texture, used in combination with 2D texture coordinates
+        TEX_TYPE_2D_RECT = 6
+    };
+
+	/** Enum identifying special mipmap numbers
+    */
+	enum TextureMipmap
+	{
+		/// Generate mipmaps up to 1x1
+		MIP_UNLIMITED = 0x7FFFFFFF,
+		/// Use TextureManager default
+		MIP_DEFAULT = -1
+	};
+
+    /** Abstract class representing a Texture resource.
+        @remarks
+            The actual concrete subclass which will exist for a texture
+            is dependent on the rendering system in use (Direct3D, OpenGL etc).
+            This class represents the commonalities, and is the one 'used'
+            by programmers even though the real implementation could be
+            different in reality. Texture objects are created through
+            the 'create' method of the TextureManager concrete subclass.
+     */
+    class _OgreExport Texture : public Resource
+    {
+    public:
+        Texture(ResourceManager* creator, const String& name, ResourceHandle handle,
+            const String& group, bool isManual = false, ManualResourceLoader* loader = 0);
+
+        virtual ~Texture() {}
+        
+        /** Sets the type of texture; can only be changed before load() 
+        */
+        virtual void setTextureType(TextureType ttype ) { mTextureType = ttype; }
+
+        /** Gets the type of texture 
+        */
+        virtual TextureType getTextureType(void) const { return mTextureType; }
+
+        /** Gets the number of mipmaps to be used for this texture.
+        */
+        virtual uint8 getNumMipmaps(void) const {return mNumMipmaps;}
+
+		/** Sets the number of mipmaps to be used for this texture.
+            @note
+                Must be set before calling any 'load' method.
+        */
+        virtual void setNumMipmaps(uint8 num) {mNumRequestedMipmaps = mNumMipmaps = num;}
+
+		/** Are mipmaps hardware generated?
+		@remarks
+			Will only be accurate after texture load, or createInternalResources
+		*/
+		virtual bool getMipmapsHardwareGenerated(void) const { return mMipmapsHardwareGenerated; }
+
+        /** Returns the gamma adjustment factor applied to this texture on loading.
+        */
+        virtual float getGamma(void) const { return mGamma; }
+
+        /** Sets the gamma adjustment factor applied to this texture on loading the
+			data.
+            @note
+                Must be called before any 'load' method. This gamma factor will
+				be premultiplied in and may reduce the precision of your textures.
+				You can use setHardwareGamma if supported to apply gamma on 
+				sampling the texture instead.
+        */
+        virtual void setGamma(float g) { mGamma = g; }
+
+		/** Sets whether this texture will be set up so that on sampling it, 
+			hardware gamma correction is applied.
+		@remarks
+			24-bit textures are often saved in gamma colour space; this preserves
+			precision in the 'darks'. However, if you're performing blending on 
+			the sampled colours, you really want to be doing it in linear space. 
+			One way is to apply a gamma correction value on loading (see setGamma),
+			but this means you lose precision in those dark colours. An alternative
+			is to get the hardware to do the gamma correction when reading the 
+			texture and converting it to a floating point value for the rest of
+			the pipeline. This option allows you to do that; it's only supported
+			in relatively recent hardware (others will ignore it) but can improve
+			the quality of colour reproduction.
+		@note
+			Must be called before any 'load' method since it may affect the
+			construction of the underlying hardware resources.
+			Also note this only useful on textures using 8-bit colour channels.
+		*/
+		virtual void setHardwareGammaEnabled(bool enabled) { mHwGamma = enabled; }
+
+		/** Gets whether this texture will be set up so that on sampling it, 
+		hardware gamma correction is applied.
+		*/
+		virtual bool isHardwareGammaEnabled() const { return mHwGamma; }
+
+		/** Set the level of multisample AA to be used if this texture is a 
+			rendertarget.
+		@note This option will be ignored if TU_RENDERTARGET is not part of the
+			usage options on this texture, or if the hardware does not support it. 
+		@param fsaa The number of samples
+		@param fsaaHint Any hinting text (@see Root::createRenderWindow)
+		*/
+		virtual void setFSAA(uint fsaa, const String& fsaaHint) { mFSAA = fsaa; mFSAAHint = fsaaHint; }
+
+		/** Get the level of multisample AA to be used if this texture is a 
+		rendertarget.
+		*/
+		virtual uint getFSAA() const { return mFSAA; }
+
+		/** Get the multisample AA hint if this texture is a rendertarget.
+		*/
+		virtual const String& getFSAAHint() const { return mFSAAHint; }
+
+		/** Returns the height of the texture.
+        */
+        virtual uint32 getHeight(void) const { return mHeight; }
+
+        /** Returns the width of the texture.
+        */
+        virtual uint32 getWidth(void) const { return mWidth; }
+
+        /** Returns the depth of the texture (only applicable for 3D textures).
+        */
+        virtual uint32 getDepth(void) const { return mDepth; }
+
+        /** Returns the height of the original input texture (may differ due to hardware requirements).
+        */
+        virtual uint32 getSrcHeight(void) const { return mSrcHeight; }
+
+        /** Returns the width of the original input texture (may differ due to hardware requirements).
+        */
+        virtual uint32 getSrcWidth(void) const { return mSrcWidth; }
+
+        /** Returns the original depth of the input texture (only applicable for 3D textures).
+        */
+        virtual uint32 getSrcDepth(void) const { return mSrcDepth; }
+
+        /** Set the height of the texture; can only do this before load();
+        */
+        virtual void setHeight(uint32 h) { mHeight = mSrcHeight = h; }
+
+        /** Set the width of the texture; can only do this before load();
+        */
+        virtual void setWidth(uint32 w) { mWidth = mSrcWidth = w; }
+
+        /** Set the depth of the texture (only applicable for 3D textures);
+            can only do this before load();
+        */
+        virtual void setDepth(uint32 d)  { mDepth = mSrcDepth = d; }
+
+        /** Returns the TextureUsage identifier for this Texture
+        */
+        virtual int getUsage() const
+        {
+            return mUsage;
+        }
+
+        /** Sets the TextureUsage identifier for this Texture; only useful before load()
+			
+			@param u is a combination of TU_STATIC, TU_DYNAMIC, TU_WRITE_ONLY 
+				TU_AUTOMIPMAP and TU_RENDERTARGET (see TextureUsage enum). You are
+            	strongly advised to use HBU_STATIC_WRITE_ONLY wherever possible, if you need to 
+            	update regularly, consider HBU_DYNAMIC_WRITE_ONLY.
+        */
+        virtual void setUsage(int u) { mUsage = u; }
+
+        /** Creates the internal texture resources for this texture. 
+        @remarks
+            This method creates the internal texture resources (pixel buffers, 
+            texture surfaces etc) required to begin using this texture. You do
+            not need to call this method directly unless you are manually creating
+            a texture, in which case something must call it, after having set the
+            size and format of the texture (e.g. the ManualResourceLoader might
+            be the best one to call it). If you are not defining a manual texture,
+            or if you use one of the self-contained load...() methods, then it will be
+            called for you.
+        */
+        virtual void createInternalResources(void);
+
+        /** Frees internal texture resources for this texture. 
+        */
+        virtual void freeInternalResources(void);
+        
+		/** Copies (and maybe scales to fit) the contents of this texture to
+			another texture. */
+		virtual void copyToTexture( TexturePtr& target );
+
+        /** Loads the data from an image.
+		@note Important: only call this from outside the load() routine of a 
+			Resource. Don't call it within (including ManualResourceLoader) - use
+			_loadImages() instead. This method is designed to be external, 
+			performs locking and checks the load status before loading.
+        */
+        virtual void loadImage( const Image &img );
+			
+		/** Loads the data from a raw stream.
+		@note Important: only call this from outside the load() routine of a 
+			Resource. Don't call it within (including ManualResourceLoader) - use
+			_loadImages() instead. This method is designed to be external, 
+			performs locking and checks the load status before loading.
+		@param stream Data stream containing the raw pixel data
+		@param uWidth Width of the image
+		@param uHeight Height of the image
+		@param eFormat The format of the pixel data
+		*/
+		virtual void loadRawData( DataStreamPtr& stream, 
+			ushort uWidth, ushort uHeight, PixelFormat eFormat);
+
+		/** Internal method to load the texture from a set of images. 
+		@note Do NOT call this method unless you are inside the load() routine
+			already, e.g. a ManualResourceLoader. It is not threadsafe and does
+			not check or update resource loading status.
+		*/
+        virtual void _loadImages( const ConstImagePtrList& images );
+
+		/** Returns the pixel format for the texture surface. */
+		virtual PixelFormat getFormat() const
+		{
+			return mFormat;
+		}
+
+        /** Returns the desired pixel format for the texture surface. */
+        virtual PixelFormat getDesiredFormat(void) const
+        {
+            return mDesiredFormat;
+        }
+
+        /** Returns the pixel format of the original input texture (may differ due to
+            hardware requirements and pixel format conversion).
+        */
+        virtual PixelFormat getSrcFormat(void) const
+        {
+            return mSrcFormat;
+        }
+
+        /** Sets the pixel format for the texture surface; can only be set before load(). */
+        virtual void setFormat(PixelFormat pf);
+
+        /** Returns true if the texture has an alpha layer. */
+        virtual bool hasAlpha(void) const;
+
+        /** Sets desired bit depth for integer pixel format textures.
+        @note
+            Available values: 0, 16 and 32, where 0 (the default) means keep original format
+            as it is. This value is number of bits for the pixel.
+        */
+        virtual void setDesiredIntegerBitDepth(ushort bits);
+
+        /** gets desired bit depth for integer pixel format textures.
+        */
+        virtual ushort getDesiredIntegerBitDepth(void) const;
+
+        /** Sets desired bit depth for float pixel format textures.
+        @note
+            Available values: 0, 16 and 32, where 0 (the default) means keep original format
+            as it is. This value is number of bits for a channel of the pixel.
+        */
+        virtual void setDesiredFloatBitDepth(ushort bits);
+
+        /** gets desired bit depth for float pixel format textures.
+        */
+        virtual ushort getDesiredFloatBitDepth(void) const;
+
+        /** Sets desired bit depth for integer and float pixel format.
+        */
+        virtual void setDesiredBitDepths(ushort integerBits, ushort floatBits);
+
+        /** Sets whether luminace pixel format will treated as alpha format when load this texture.
+        */
+        virtual void setTreatLuminanceAsAlpha(bool asAlpha);
+
+        /** Gets whether luminace pixel format will treated as alpha format when load this texture.
+        */
+        virtual bool getTreatLuminanceAsAlpha(void) const;
+
+        /** Return the number of faces this texture has. This will be 6 for a cubemap
+        	texture and 1 for a 1D, 2D or 3D one.
+        */
+        virtual size_t getNumFaces() const;
+
+		/** Return hardware pixel buffer for a surface. This buffer can then
+			be used to copy data from and to a particular level of the texture.
+			@param face 	Face number, in case of a cubemap texture. Must be 0
+							for other types of textures.
+                            For cubemaps, this is one of 
+                            +X (0), -X (1), +Y (2), -Y (3), +Z (4), -Z (5)
+			@param mipmap	Mipmap level. This goes from 0 for the first, largest
+							mipmap level to getNumMipmaps()-1 for the smallest.
+			@return	A shared pointer to a hardware pixel buffer
+			@remarks	The buffer is invalidated when the resource is unloaded or destroyed.
+						Do not use it after the lifetime of the containing texture.
+		*/
+		virtual HardwarePixelBufferSharedPtr getBuffer(size_t face=0, size_t mipmap=0) = 0;
+
+
+		/** Populate an Image with the contents of this texture. 
+		@param destImage The target image (contents will be overwritten)
+		@param includeMipMaps Whether to embed mipmaps in the image
+		*/
+		virtual void convertToImage(Image& destImage, bool includeMipMaps = false);
+		
+		/** Retrieve a platform or API-specific piece of information from this texture.
+		 This method of retrieving information should only be used if you know what you're doing.
+		 @param name The name of the attribute to retrieve
+		 @param pData Pointer to memory matching the type of data you want to retrieve.
+		*/
+		virtual void getCustomAttribute(const String& name, void* pData) {}
+		
+
+
+    protected:
+        uint32 mHeight;
+        uint32 mWidth;
+        uint32 mDepth;
+
+        uint8 mNumRequestedMipmaps;
+		uint8 mNumMipmaps;
+		bool mMipmapsHardwareGenerated;
+        float mGamma;
+		bool mHwGamma;
+		uint mFSAA;
+		String mFSAAHint;
+
+        TextureType mTextureType;
+		PixelFormat mFormat;
+        int mUsage; /// Bit field, so this can't be TextureUsage
+
+        PixelFormat mSrcFormat;
+        uint32 mSrcWidth, mSrcHeight, mSrcDepth;
+
+        PixelFormat mDesiredFormat;
+        unsigned short mDesiredIntegerBitDepth;
+        unsigned short mDesiredFloatBitDepth;
+        bool mTreatLuminanceAsAlpha;
+
+		bool mInternalResourcesCreated;
+
+		/// @copydoc Resource::calculateSize
+		size_t calculateSize(void) const;
+		
+
+		/** Implementation of creating internal texture resources 
+		*/
+		virtual void createInternalResourcesImpl(void) = 0;
+
+		/** Implementation of freeing internal texture resources 
+		*/
+		virtual void freeInternalResourcesImpl(void) = 0;
+
+		/** Default implementation of unload which calls freeInternalResources */
+		void unloadImpl(void);
+
+		/** Identify the source file type as a string, either from the extension
+			or from a magic number.
+		*/
+		String getSourceFileType() const;
+
+    };
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreTextureManager.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreTextureManager.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreTextureManager.h	(revision 148)
@@ -0,0 +1,525 @@
+/*
+-----------------------------------------------------------------------------
+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 _TextureManager_H__
+#define _TextureManager_H__
+
+
+#include "OgrePrerequisites.h"
+
+#include "OgreResourceManager.h"
+#include "OgreTexture.h"
+#include "OgreSingleton.h"
+
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Resources
+	*  @{
+	*/
+	/** Class for loading & managing textures.
+        @remarks
+            Note that this class is abstract - the particular
+            RenderSystem that is in use at the time will create
+            a concrete subclass of this. Note that the concrete
+            class will be available via the abstract singleton
+            obtained from TextureManager::getSingleton(), but
+            you should not assume that it is available until you
+            have a) initialised Ogre (after selecting a RenderSystem
+            and calling initialise from the Root object), and b)
+            created at least one window - this may be done at the
+            same time as part a if you allow Ogre to autocreate one.
+     */
+    class _OgreExport TextureManager : public ResourceManager, public Singleton<TextureManager>
+    {
+    public:
+
+        TextureManager(void);
+        virtual ~TextureManager();
+
+
+		/// Create a new texture
+		/// @see ResourceManager::createResource
+		TexturePtr create (const String& name, const String& group,
+							bool isManual = false, ManualResourceLoader* loader = 0,
+							const NameValuePairList* createParams = 0);
+		/// Get a resource by name
+		/// @see ResourceManager::getResourceByName
+		TexturePtr getByName(const String& name, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME);
+
+        /** Create a new texture, or retrieve an existing one with the same
+            name if it already exists.
+            @param
+                texType The type of texture to load/create, defaults to normal 2D textures
+            @param
+                numMipmaps The number of pre-filtered mipmaps to generate. If left to MIP_DEFAULT then
+                the TextureManager's default number of mipmaps will be used (see setDefaultNumMipmaps())
+                If set to MIP_UNLIMITED mipmaps will be generated until the lowest possible
+                level, 1x1x1.
+            @param
+                gamma The gamma adjustment factor to apply to this texture (brightening/darkening)
+            @param 
+                isAlpha Only applicable to greyscale images. If true, specifies that
+                the image should be loaded into an alpha texture rather than a
+                single channel colour texture - useful for fixed-function systems.
+            @param 
+                desiredFormat The format you would like to have used instead of
+                the format being based on the contents of the texture
+			@param hwGammaCorrection Pass 'true' to enable hardware gamma correction
+				(sRGB) on this texture. The hardware will convert from gamma space
+				to linear space when reading from this texture. Only applicable for 
+				8-bits per channel textures, will be ignored for other types. Has the advantage
+				over pre-applied gamma that the texture precision is maintained.
+            @see ResourceManager::createOrRetrieve
+        */
+        virtual ResourceCreateOrRetrieveResult createOrRetrieve(
+            const String &name, const String& group, bool isManual = false,
+            ManualResourceLoader* loader = 0, const NameValuePairList* createParams = 0,
+            TextureType texType = TEX_TYPE_2D, int numMipmaps = MIP_DEFAULT, 
+            Real gamma = 1.0f, bool isAlpha = false,
+            PixelFormat desiredFormat = PF_UNKNOWN, bool hwGammaCorrection = false);
+
+        /** Prepares to loads a texture from a file.
+            @param
+                name The file to load, or a String identifier in some cases
+            @param
+                group The name of the resource group to assign the texture to
+            @param
+                texType The type of texture to load/create, defaults to normal 2D textures
+            @param
+                numMipmaps The number of pre-filtered mipmaps to generate. If left to MIP_DEFAULT then
+                the TextureManager's default number of mipmaps will be used (see setDefaultNumMipmaps())
+                If set to MIP_UNLIMITED mipmaps will be generated until the lowest possible
+                level, 1x1x1.
+            @param
+                gamma The gamma adjustment factor to apply to this texture (brightening/darkening)
+            @param 
+                isAlpha Only applicable to greyscale images. If true, specifies that
+                the image should be loaded into an alpha texture rather than a
+                single channel colour texture - useful for fixed-function systems.
+            @param 
+                desiredFormat The format you would like to have used instead of
+                the format being based on the contents of the texture
+			@param hwGammaCorrection Pass 'true' to enable hardware gamma correction
+				(sRGB) on this texture. The hardware will convert from gamma space
+				to linear space when reading from this texture. Only applicable for 
+				8-bits per channel textures, will be ignored for other types. Has the advantage
+				over pre-applied gamma that the texture precision is maintained.
+        */
+        virtual TexturePtr prepare( 
+            const String& name, const String& group, 
+            TextureType texType = TEX_TYPE_2D, int numMipmaps = MIP_DEFAULT, 
+            Real gamma = 1.0f, bool isAlpha = false,
+            PixelFormat desiredFormat = PF_UNKNOWN, bool hwGammaCorrection = false);
+
+        /** Loads a texture from a file.
+            @param
+                name The file to load, or a String identifier in some cases
+            @param
+                group The name of the resource group to assign the texture to
+            @param
+                texType The type of texture to load/create, defaults to normal 2D textures
+            @param
+                numMipmaps The number of pre-filtered mipmaps to generate. If left to MIP_DEFAULT then
+                the TextureManager's default number of mipmaps will be used (see setDefaultNumMipmaps())
+				If set to MIP_UNLIMITED mipmaps will be generated until the lowest possible
+				level, 1x1x1.
+            @param
+                gamma The gamma adjustment factor to apply to this texture (brightening/darkening)
+					during loading
+			@param 
+				isAlpha Only applicable to greyscale images. If true, specifies that
+				the image should be loaded into an alpha texture rather than a
+				single channel colour texture - useful for fixed-function systems.
+			@param 
+				desiredFormat The format you would like to have used instead of
+				the format being based on the contents of the texture. Pass PF_UNKNOWN
+				to default.
+			@param hwGammaCorrection Pass 'true' to enable hardware gamma correction
+				(sRGB) on this texture. The hardware will convert from gamma space
+				to linear space when reading from this texture. Only applicable for 
+				8-bits per channel textures, will be ignored for other types. Has the advantage
+				over pre-applied gamma that the texture precision is maintained.
+        */
+        virtual TexturePtr load( 
+            const String& name, const String& group, 
+            TextureType texType = TEX_TYPE_2D, int numMipmaps = MIP_DEFAULT, 
+            Real gamma = 1.0f, bool isAlpha = false,
+            PixelFormat desiredFormat = PF_UNKNOWN, 
+			bool hwGammaCorrection = false);
+
+        /** Loads a texture from an Image object.
+            @note
+                The texture will create as manual texture without loader.
+            @param
+                name The name to give the resulting texture
+            @param
+                group The name of the resource group to assign the texture to
+            @param
+                img The Image object which contains the data to load
+            @param
+                texType The type of texture to load/create, defaults to normal 2D textures
+            @param
+                numMipmaps The number of pre-filtered mipmaps to generate. If left to MIP_DEFAULT then
+                the TextureManager's default number of mipmaps will be used (see setDefaultNumMipmaps())
+				If set to MIP_UNLIMITED mipmaps will be generated until the lowest possible
+				level, 1x1x1.
+            @param
+                gamma The gamma adjustment factor to apply to this texture (brightening/darkening)
+			@param 
+				isAlpha Only applicable to greyscale images. If true, specifies that
+				the image should be loaded into an alpha texture rather than a
+				single channel colour texture - useful for fixed-function systems.
+			@param 
+				desiredFormat The format you would like to have used instead of
+				the format being based on the contents of the texture
+			@param hwGammaCorrection Pass 'true' to enable hardware gamma correction
+				(sRGB) on this texture. The hardware will convert from gamma space
+				to linear space when reading from this texture. Only applicable for 
+				8-bits per channel textures, will be ignored for other types. Has the advantage
+				over pre-applied gamma that the texture precision is maintained.
+        */
+        virtual TexturePtr loadImage( 
+            const String &name, const String& group, const Image &img, 
+            TextureType texType = TEX_TYPE_2D,
+            int numMipmaps = MIP_DEFAULT, Real gamma = 1.0f, bool isAlpha = false,
+            PixelFormat desiredFormat = PF_UNKNOWN, bool hwGammaCorrection = false);
+			
+        /** Loads a texture from a raw data stream.
+            @note
+                The texture will create as manual texture without loader.
+            @param name
+                The name to give the resulting texture
+            @param group
+                The name of the resource group to assign the texture to
+            @param stream
+                Incoming data stream
+            @param width
+                The width of the texture
+            @param height
+                The height of the texture
+            @param format
+                The format of the data being passed in; the manager reserves
+                the right to create a different format for the texture if the 
+                original format is not available in this context.
+            @param texType
+                The type of texture to load/create, defaults to normal 2D textures
+            @param numMipmaps
+                The number of pre-filtered mipmaps to generate. If left to MIP_DEFAULT then
+                the TextureManager's default number of mipmaps will be used (see setDefaultNumMipmaps())
+				If set to MIP_UNLIMITED mipmaps will be generated until the lowest possible
+				level, 1x1x1.
+            @param gamma
+                The gamma adjustment factor to apply to this texture (brightening/darkening)
+				while loading
+			@param hwGammaCorrection Pass 'true' to enable hardware gamma correction
+				 (sRGB) on this texture. The hardware will convert from gamma space
+				 to linear space when reading from this texture. Only applicable for 
+				 8-bits per channel textures, will be ignored for other types. Has the advantage
+				 over pre-applied gamma that the texture precision is maintained.
+        */
+        virtual TexturePtr loadRawData(const String &name, const String& group,
+            DataStreamPtr& stream, ushort width, ushort height, 
+            PixelFormat format, TextureType texType = TEX_TYPE_2D, 
+            int numMipmaps = MIP_DEFAULT, Real gamma = 1.0f, bool hwGammaCorrection = false);
+
+		/** Create a manual texture with specified width, height and depth (not loaded from a file).
+            @param
+                name The name to give the resulting texture
+            @param
+                group The name of the resource group to assign the texture to
+            @param
+                texType The type of texture to load/create, defaults to normal 2D textures
+            @param width
+                The width of the texture
+            @param height
+                The height of the texture
+            @param depth
+                The depth of the texture
+            @param
+                numMipmaps The number of pre-filtered mipmaps to generate. If left to MIP_DEFAULT then
+                the TextureManager's default number of mipmaps will be used (see setDefaultNumMipmaps())
+				If set to MIP_UNLIMITED mipmaps will be generated until the lowest possible
+				level, 1x1x1.
+            @param
+                format The internal format you wish to request; the manager reserves
+                the right to create a different format if the one you select is
+                not available in this context.
+			@param 
+				usage The kind of usage this texture is intended for. It 
+				is a combination of TU_STATIC, TU_DYNAMIC, TU_WRITE_ONLY, 
+				TU_AUTOMIPMAP and TU_RENDERTARGET (see TextureUsage enum). You are
+            	strongly advised to use HBU_STATIC_WRITE_ONLY wherever possible, if you need to 
+            	update regularly, consider HBU_DYNAMIC_WRITE_ONLY.
+            @param
+                loader If you intend the contents of the manual texture to be 
+                regularly updated, to the extent that you don't need to recover 
+                the contents if the texture content is lost somehow, you can leave
+                this parameter as 0. However, if you intend to populate the
+                texture only once, then you should implement ManualResourceLoader
+                and pass a pointer to it in this parameter; this means that if the
+                manual texture ever needs to be reloaded, the ManualResourceLoader
+                will be called to do it.
+			@param hwGammaCorrection Pass 'true' to enable hardware gamma correction
+				(sRGB) on this texture. The hardware will convert from gamma space
+				to linear space when reading from this texture. Only applicable for 
+				8-bits per channel textures, will be ignored for other types. Has the advantage
+				over pre-applied gamma that the texture precision is maintained.
+			@param fsaa The level of multisampling to use if this is a render target. Ignored
+				if usage does not include TU_RENDERTARGET or if the device does
+				not support it.
+        */
+        virtual TexturePtr createManual(const String & name, const String& group,
+            TextureType texType, uint width, uint height, uint depth, 
+			int numMipmaps, PixelFormat format, int usage = TU_DEFAULT, ManualResourceLoader* loader = 0,
+			bool hwGammaCorrection = false, uint fsaa = 0, const String& fsaaHint = StringUtil::BLANK);
+			
+        /** Create a manual texture with a depth of 1 (not loaded from a file).
+            @param
+                name The name to give the resulting texture
+            @param
+                group The name of the resource group to assign the texture to
+            @param
+                texType The type of texture to load/create, defaults to normal 2D textures
+            @param width
+                The width of the texture
+            @param height
+                The height of the texture
+            @param
+                numMipmaps The number of pre-filtered mipmaps to generate. If left to MIP_DEFAULT then
+                the TextureManager's default number of mipmaps will be used (see setDefaultNumMipmaps()).
+				If set to MIP_UNLIMITED mipmaps will be generated until the lowest possible
+				level, 1x1x1.
+            @param
+                format The internal format you wish to request; the manager reserves
+                the right to create a different format if the one you select is
+                not available in this context.
+			@param 
+				usage The kind of usage this texture is intended for. It 
+				is a combination of TU_STATIC, TU_DYNAMIC, TU_WRITE_ONLY, 
+				TU_AUTOMIPMAP and TU_RENDERTARGET (see TextureUsage enum). You are
+            	strongly advised to use HBU_STATIC_WRITE_ONLY wherever possible, if you need to 
+            	update regularly, consider HBU_DYNAMIC_WRITE_ONLY.
+            @param
+                loader If you intend the contents of the manual texture to be 
+                regularly updated, to the extent that you don't need to recover 
+                the contents if the texture content is lost somehow, you can leave
+                this parameter as 0. However, if you intend to populate the
+                texture only once, then you should implement ManualResourceLoader
+                and pass a pointer to it in this parameter; this means that if the
+                manual texture ever needs to be reloaded, the ManualResourceLoader
+                will be called to do it.
+			 @param hwGammaCorrection Pass 'true' to enable hardware gamma correction
+				 (sRGB) on this texture. The hardware will convert from gamma space
+				 to linear space when reading from this texture. Only applicable for 
+				 8-bits per channel textures, will be ignored for other types. Has the advantage
+				 over pre-applied gamma that the texture precision is maintained.
+			@param fsaa The level of multisampling to use if this is a render target. Ignored
+				if usage does not include TU_RENDERTARGET or if the device does
+				not support it.
+        */
+        TexturePtr createManual(const String & name, const String& group,
+            TextureType texType, uint width, uint height, int numMipmaps,
+            PixelFormat format, int usage = TU_DEFAULT, ManualResourceLoader* loader = 0,
+			bool hwGammaCorrection = false, uint fsaa = 0, const String& fsaaHint = StringUtil::BLANK)
+		{
+			return createManual(name, group, texType, width, height, 1, 
+				numMipmaps, format, usage, loader, hwGammaCorrection, fsaa, fsaaHint);
+		}
+
+        /** Sets preferred bit depth for integer pixel format textures.
+        @param
+            bits Number of bits. Available values: 0, 16 and 32, where 0 (the default) means keep
+            original format as it is. This value is number of bits for the pixel.
+        @param
+            reloadTextures If true (the default), will reloading all reloadable textures.
+        */
+        virtual void setPreferredIntegerBitDepth(ushort bits, bool reloadTextures = true);
+
+        /** Gets preferred bit depth for integer pixel format textures.
+        */
+        virtual ushort getPreferredIntegerBitDepth(void) const;
+
+        /** Sets preferred bit depth for float pixel format textures.
+        @param
+            bits Number of bits. Available values: 0, 16 and 32, where 0 (the default) means keep
+            original format as it is. This value is number of bits for a channel of the pixel.
+        @param
+            reloadTextures If true (the default), will reloading all reloadable textures.
+        */
+        virtual void setPreferredFloatBitDepth(ushort bits, bool reloadTextures = true);
+
+        /** Gets preferred bit depth for float pixel format textures.
+        */
+        virtual ushort getPreferredFloatBitDepth(void) const;
+
+        /** Sets preferred bit depth for integer and float pixel format.
+        @param
+            integerBits Number of bits. Available values: 0, 16 and 32, where 0 (the default) means keep
+            original format as it is. This value is number of bits for the pixel.
+        @param
+            floatBits Number of bits. Available values: 0, 16 and 32, where 0 (the default) means keep
+            original format as it is. This value is number of bits for a channel of the pixel.
+        @param
+            reloadTextures If true (the default), will reloading all reloadable textures.
+        */
+        virtual void setPreferredBitDepths(ushort integerBits, ushort floatBits, bool reloadTextures = true);
+
+		/** Returns whether this render system can natively support the precise texture 
+			format requested with the given usage options.
+		@remarks
+			You can still create textures with this format even if this method returns
+			false; the texture format will just be altered to one which the device does
+			support.
+		@note
+			Sometimes the device may just slightly change the format, such as reordering the 
+			channels or packing the channels differently, without it making and qualitative 
+			differences to the texture. If you want to just detect whether the quality of a
+			given texture will be reduced, use isEquivalentFormatSupport instead.
+		@param format The pixel format requested
+		@param usage The kind of usage this texture is intended for, a combination of 
+			the TextureUsage flags.
+		@return true if the format is natively supported, false if a fallback would be used.
+		*/
+		virtual bool isFormatSupported(TextureType ttype, PixelFormat format, int usage);
+
+		/** Returns whether this render system can support the texture format requested
+			with the given usage options, or another format with no quality reduction.
+		*/
+		virtual bool isEquivalentFormatSupported(TextureType ttype, PixelFormat format, int usage);
+
+		/** Gets the format which will be natively used for a requested format given the
+			constraints of the current device.
+		*/
+		virtual PixelFormat getNativeFormat(TextureType ttype, PixelFormat format, int usage) = 0;
+
+        /** Returns whether this render system has hardware filtering supported for the
+            texture format requested with the given usage options.
+        @remarks
+            Not all texture format are supports filtering by the hardware, i.e. some
+            cards support floating point format, but it doesn't supports filtering on
+            the floating point texture at all, or only a subset floating point formats
+            have flitering supported.
+        @par
+            In the case you want to write shader to work with floating point texture, and
+            you want to produce better visual quality, it's necessary to flitering the
+            texture manually in shader (potential requires four or more texture fetch
+            instructions, plus several arithmetic instructions) if filtering doesn't
+            supported by hardware. But in case on the hardware that supports floating
+            point filtering natively, it had better to adopt this capability for
+            performance (because only one texture fetch instruction are required) and
+            doesn't loss visual quality.
+        @par
+            This method allow you queries hardware texture filtering capability to deciding
+            which verion of the shader to be used. Note it's up to you to write multi-version
+            shaders for support various hardware, internal engine can't do that for you
+            automatically.
+        @note
+            Under GL, texture filtering are always supported by driver, but if it's not
+            supported by hardware natively, software simulation will be used, and you
+            will end up with very slow speed (less than 0.1 fps for example). To slove
+            this performance problem, you must disable filtering manually (by use
+            <b>filtering none</b> in the material script's texture_unit section, or
+            call TextureUnitState::setTextureFiltering with TFO_NONE if populate
+            material in code).
+		@param ttype The texture type requested
+		@param format The pixel format requested
+		@param usage The kind of usage this texture is intended for, a combination of 
+			the TextureUsage flags.
+        @param preciseFormatOnly Whether precise or fallback format mode is used to detecting.
+            In case the pixel format doesn't supported by device, false will be returned
+            if in precise mode, and natively used pixel format will be actually use to
+            check if in fallback mode.
+		@return true if the texture filtering is supported.
+        */
+        virtual bool isHardwareFilteringSupported(TextureType ttype, PixelFormat format, int usage,
+            bool preciseFormatOnly = false) = 0;
+
+        /** Sets the default number of mipmaps to be used for loaded textures, for when textures are
+            loaded automatically (e.g. by Material class) or when 'load' is called with the default
+            parameters by the application.
+			If set to MIP_UNLIMITED mipmaps will be generated until the lowest possible
+				level, 1x1x1.
+            @note
+                The default value is 0.
+        */
+        virtual void setDefaultNumMipmaps(size_t num);
+
+        /** Gets the default number of mipmaps to be used for loaded textures.
+        */
+        virtual size_t getDefaultNumMipmaps()
+        {
+            return mDefaultNumMipmaps;
+        }
+
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static TextureManager& getSingleton(void);
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static TextureManager* getSingletonPtr(void);
+
+    protected:
+
+        ushort mPreferredIntegerBitDepth;
+        ushort mPreferredFloatBitDepth;
+        size_t mDefaultNumMipmaps;
+    };
+	/** @} */
+	/** @} */
+}// Namespace
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreTextureUnitState.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreTextureUnitState.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreTextureUnitState.h	(revision 148)
@@ -0,0 +1,1320 @@
+/*
+-----------------------------------------------------------------------------
+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 __TextureUnitState_H__
+#define __TextureUnitState_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreCommon.h"
+#include "OgreBlendMode.h"
+#include "OgreMatrix4.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreString.h"
+#include "OgreTexture.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+    /** \addtogroup Core
+    *  @{
+    */
+    /** \addtogroup Materials
+    *  @{
+    */
+    /** Class representing the state of a single texture unit during a Pass of a
+        Technique, of a Material.
+    @remarks
+        Texture units are pipelines for retrieving texture data for rendering onto
+        your objects in the world. Using them is common to both the fixed-function and 
+        the programmable (vertex and fragment program) pipeline, but some of the 
+        settings will only have an effect in the fixed-function pipeline (for example, 
+        setting a texture rotation will have no effect if you use the programmable
+        pipeline, because this is overridden by the fragment program). The effect
+        of each setting as regards the 2 pipelines is commented in each setting.
+    @par
+        When I use the term 'fixed-function pipeline' I mean traditional rendering
+        where you do not use vertex or fragment programs (shaders). Programmable 
+        pipeline means that for this pass you are using vertex or fragment programs.
+    */
+    class _OgreExport TextureUnitState : public TextureUnitStateAlloc
+    {
+        friend class RenderSystem;
+    public:
+        /** Definition of the broad types of texture effect you can apply to a texture unit.
+        @note
+            Note that these have no effect when using the programmable pipeline, since their
+            effect is overridden by the vertex / fragment programs.
+        */
+        enum TextureEffectType
+        {
+            /// Generate all texture coords based on angle between camera and vertex.
+            ET_ENVIRONMENT_MAP,
+            /// Generate texture coords based on a frustum.
+            ET_PROJECTIVE_TEXTURE,
+            /// Constant u/v scrolling effect.
+            ET_UVSCROLL,
+            /// Constant u scrolling effect.
+            ET_USCROLL,
+            /// Constant u/v scrolling effect.
+            ET_VSCROLL,
+            /// Constant rotation.
+            ET_ROTATE,
+            /// More complex transform.
+            ET_TRANSFORM
+
+        };
+
+        /** Enumeration to specify type of envmap.
+        @note
+            Note that these have no effect when using the programmable pipeline, since their
+            effect is overridden by the vertex / fragment programs.
+        */
+        enum EnvMapType
+        {
+            /// Envmap based on vector from camera to vertex position, good for planar geometry.
+            ENV_PLANAR,
+            /// Envmap based on dot of vector from camera to vertex and vertex normal, good for curves.
+            ENV_CURVED,
+            /// Envmap intended to supply reflection vectors for cube mapping.
+            ENV_REFLECTION,
+            /// Envmap intended to supply normal vectors for cube mapping.
+            ENV_NORMAL
+        };
+
+        /** Useful enumeration when dealing with procedural transforms.
+        @note
+            Note that these have no effect when using the programmable pipeline, since their
+            effect is overridden by the vertex / fragment programs.
+        */
+        enum TextureTransformType
+        {
+            TT_TRANSLATE_U,
+            TT_TRANSLATE_V,
+            TT_SCALE_U,
+            TT_SCALE_V,
+            TT_ROTATE
+        };
+
+        /** Texture addressing modes - default is TAM_WRAP.
+        @note
+            These settings are relevant in both the fixed-function and the
+            programmable pipeline.
+        */
+        enum TextureAddressingMode
+        {
+            /// Texture wraps at values over 1.0.
+            TAM_WRAP,
+            /// Texture mirrors (flips) at joins over 1.0.
+            TAM_MIRROR,
+            /// Texture clamps at 1.0.
+            TAM_CLAMP,
+            /// Texture coordinates outside the range [0.0, 1.0] are set to the border colour.
+            TAM_BORDER,
+            /// Unknown
+            TAM_UNKNOWN = 99
+        };
+
+        /** Texture addressing mode for each texture coordinate. */
+        struct UVWAddressingMode
+        {
+            TextureAddressingMode u, v, w;
+        };
+
+        /** Enum identifying the frame indexes for faces of a cube map (not the composite 3D type.
+        */
+        enum TextureCubeFace
+        {
+            CUBE_FRONT = 0,
+            CUBE_BACK = 1,
+            CUBE_LEFT = 2,
+            CUBE_RIGHT = 3,
+            CUBE_UP = 4,
+            CUBE_DOWN = 5
+        };
+
+        /** Internal structure defining a texture effect.
+        */
+        struct TextureEffect {
+            TextureEffectType type;
+            int subtype;
+            Real arg1, arg2;
+            WaveformType waveType;
+            Real base;
+            Real frequency;
+            Real phase;
+            Real amplitude;
+            Controller<Real>* controller;
+            const Frustum* frustum;
+        };
+
+        /** Texture effects in a multimap paired array.
+        */
+        typedef multimap<TextureEffectType, TextureEffect>::type EffectMap;
+
+        /** Default constructor.
+        */
+        TextureUnitState(Pass* parent);
+
+        TextureUnitState(Pass* parent, const TextureUnitState& oth );
+
+        TextureUnitState & operator = ( const TextureUnitState& oth );
+
+        /** Default destructor.
+        */
+        ~TextureUnitState();
+
+        /** Name-based constructor.
+        @param texName
+            The basic name of the texture e.g. brickwall.jpg, stonefloor.png.
+        @param texCoordSet
+            The index of the texture coordinate set to use.
+        */
+        TextureUnitState( Pass* parent, const String& texName, unsigned int texCoordSet = 0);
+
+        /** Get the name of current texture image for this layer.
+        @remarks
+            This will either always be a single name for this layer,
+            or will be the name of the current frame for an animated
+            or otherwise multi-frame texture.
+        @note
+            Applies to both fixed-function and programmable pipeline.
+        */
+        const String& getTextureName(void) const;
+
+        /** Sets this texture layer to use a single texture, given the
+            name of the texture to use on this layer.
+        @note
+            Applies to both fixed-function and programmable pipeline.
+        */
+        void setTextureName( const String& name, TextureType ttype = TEX_TYPE_2D);
+
+        /** Sets this texture layer to use a single texture, given the
+            pointer to the texture to use on this layer.
+        @note
+            Applies to both fixed-function and programmable pipeline.
+        */
+        void setTexture( const TexturePtr& texPtr);
+
+        /** Sets this texture layer to use a combination of 6 texture maps, each one relating to a face of a cube.
+        @remarks
+            Cubic textures are made up of 6 separate texture images. Each one of these is an orthogonal view of the
+            world with a FOV of 90 degrees and an aspect ratio of 1:1. You can generate these from 3D Studio by
+            rendering a scene to a reflection map of a transparent cube and saving the output files.
+        @par
+            Cubic maps can be used either for skyboxes (complete wrap-around skies, like space) or as environment
+            maps to simulate reflections. The system deals with these 2 scenarios in different ways:
+            <ol>
+            <li>
+            <p>
+            for cubic environment maps, the 6 textures are combined into a single 'cubic' texture map which
+            is then addressed using 3D texture coordinates. This is required because you don't know what
+            face of the box you're going to need to address when you render an object, and typically you
+            need to reflect more than one face on the one object, so all 6 textures are needed to be
+            'active' at once. Cubic environment maps are enabled by calling this method with the forUVW
+            parameter set to true, and then calling setEnvironmentMap(true).
+            </p>
+            <p>
+            Note that not all cards support cubic environment mapping.
+            </p>
+            </li>
+            <li>
+            <p>
+            for skyboxes, the 6 textures are kept separate and used independently for each face of the skybox.
+            This is done because not all cards support 3D cubic maps and skyboxes do not need to use 3D
+            texture coordinates so it is simpler to render each face of the box with 2D coordinates, changing
+            texture between faces.
+            </p>
+            <p>
+            Skyboxes are created by calling SceneManager::setSkyBox.
+            </p>
+            </li>
+            </ol>
+        @note
+            Applies to both fixed-function and programmable pipeline.
+        @param name
+            The basic name of the texture e.g. brickwall.jpg, stonefloor.png. There must be 6 versions
+            of this texture with the suffixes _fr, _bk, _up, _dn, _lf, and _rt (before the extension) which
+            make up the 6 sides of the box. The textures must all be the same size and be powers of 2 in width & height.
+            If you can't make your texture names conform to this, use the alternative method of the same name which takes
+            an array of texture names instead.
+        @param forUVW
+            Set to @c true if you want a single 3D texture addressable with 3D texture coordinates rather than
+            6 separate textures. Useful for cubic environment mapping.
+        */
+        void setCubicTextureName( const String& name, bool forUVW = false );
+
+        /** Sets this texture layer to use a combination of 6 texture maps, each one relating to a face of a cube.
+        @remarks
+            Cubic textures are made up of 6 separate texture images. Each one of these is an orthogonal view of the
+            world with a FOV of 90 degrees and an aspect ratio of 1:1. You can generate these from 3D Studio by
+            rendering a scene to a reflection map of a transparent cube and saving the output files.
+        @par
+            Cubic maps can be used either for skyboxes (complete wrap-around skies, like space) or as environment
+            maps to simulate reflections. The system deals with these 2 scenarios in different ways:
+            <ol>
+            <li>
+            <p>
+            For cubic environment maps, the 6 textures are combined into a single 'cubic' texture map which
+            is then addressed using 3D texture coordinates. This is required because you don't know what
+            face of the box you're going to need to address when you render an object, and typically you
+            need to reflect more than one face on the one object, so all 6 textures are needed to be
+            'active' at once. Cubic environment maps are enabled by calling this method with the forUVW
+            parameter set to @c true, and then calling setEnvironmentMap(true).
+            </p>
+            <p>
+            Note that not all cards support cubic environment mapping.
+            </p>
+            </li>
+            <li>
+            <p>
+            For skyboxes, the 6 textures are kept separate and used independently for each face of the skybox.
+            This is done because not all cards support 3D cubic maps and skyboxes do not need to use 3D
+            texture coordinates so it is simpler to render each face of the box with 2D coordinates, changing
+            texture between faces.
+            </p>
+            <p>
+            Skyboxes are created by calling SceneManager::setSkyBox.
+            </p>
+            </li>
+            </ol>
+        @note
+            Applies to both fixed-function and programmable pipeline.
+        @param names
+            The 6 names of the textures which make up the 6 sides of the box. The textures must all 
+            be the same size and be powers of 2 in width & height.
+            Must be an Ogre::String array with a length of 6 unless forUVW is set to @c true.
+        @param forUVW
+            Set to @c true if you want a single 3D texture addressable with 3D texture coordinates rather than
+            6 separate textures. Useful for cubic environment mapping.
+        */
+        void setCubicTextureName( const String* const names, bool forUVW = false );
+
+        /** Sets this texture layer to use a combination of 6 texture maps, each one relating to a face of a cube.
+        @remarks
+            Cubic textures are made up of 6 separate texture images. Each one of these is an orthogonal view of the
+            world with a FOV of 90 degrees and an aspect ratio of 1:1. You can generate these from 3D Studio by
+            rendering a scene to a reflection map of a transparent cube and saving the output files.
+        @par
+            Cubic maps can be used either for skyboxes (complete wrap-around skies, like space) or as environment
+            maps to simulate reflections. The system deals with these 2 scenarios in different ways:
+            <ol>
+            <li>
+            <p>
+            for cubic environment maps, the 6 textures are combined into a single 'cubic' texture map which
+            is then addressed using 3D texture coordinates. This is required because you don't know what
+            face of the box you're going to need to address when you render an object, and typically you
+            need to reflect more than one face on the one object, so all 6 textures are needed to be
+            'active' at once. Cubic environment maps are enabled by calling this method with the forUVW
+            parameter set to true, and then calling setEnvironmentMap(true).
+            </p>
+            <p>
+            Note that not all cards support cubic environment mapping.
+            </p>
+            </li>
+            <li>
+            <p>
+            for skyboxes, the 6 textures are kept separate and used independently for each face of the skybox.
+            This is done because not all cards support 3D cubic maps and skyboxes do not need to use 3D
+            texture coordinates so it is simpler to render each face of the box with 2D coordinates, changing
+            texture between faces.
+            </p>
+            <p>
+            Skyboxes are created by calling SceneManager::setSkyBox.
+            </p>
+            </li>
+            </ol>
+        @note
+            Applies to both fixed-function and programmable pipeline.
+        @param texPtrs
+            The 6 pointers to the textures which make up the 6 sides of the box. The textures must all 
+            be the same size and be powers of 2 in width & height.
+            Must be an Ogre::TexturePtr array with a length of 6 unless forUVW is set to @c true.
+        @param forUVW
+            Set to @c true if you want a single 3D texture addressable with 3D texture coordinates rather than
+            6 separate textures. Useful for cubic environment mapping.
+        */
+        void setCubicTexture( const TexturePtr* const texPtrs, bool forUVW = false );
+
+        /** Sets the names of the texture images for an animated texture.
+        @remarks
+            Animated textures are just a series of images making up the frames of the animation. All the images
+            must be the same size, and their names must have a frame number appended before the extension, e.g.
+            if you specify a name of "wall.jpg" with 3 frames, the image names must be "wall_0.jpg", "wall_1.jpg"
+            and "wall_2.jpg".
+        @par
+            You can change the active frame on a texture layer by calling the setCurrentFrame method.
+        @note
+            If you can't make your texture images conform to the naming standard laid out here, you
+            can call the alternative setAnimatedTextureName method which takes an array of names instead.
+        @note
+            Applies to both fixed-function and programmable pipeline.
+        @param name
+            The base name of the textures to use e.g. wall.jpg for frames wall_0.jpg, wall_1.jpg etc.
+        @param numFrames
+            The number of frames in the sequence.
+        @param duration
+            The length of time it takes to display the whole animation sequence, in seconds.
+            If 0, no automatic transition occurs.
+        */
+        void setAnimatedTextureName( const String& name, unsigned int numFrames, Real duration = 0 );
+
+        /** Sets the names of the texture images for an animated texture.
+        @remarks
+            This an alternative method to the one where you specify a single name and let the system derive
+            the names of each frame, incase your images can't conform to this naming standard.
+        @par
+            Animated textures are just a series of images making up the frames of the animation. All the images
+            must be the same size, and you must provide their names as an array in the first parameter.
+            You can change the active frame on a texture layer by calling the setCurrentFrame method.
+        @note
+            If you can make your texture images conform to a naming standard of basicName_frame.ext, you
+            can call the alternative setAnimatedTextureName method which just takes a base name instead.
+        @note
+            Applies to both fixed-function and programmable pipeline.
+        @param names
+            Pointer to array of names of the textures to use, in frame order.
+        @param numFrames
+            The number of frames in the sequence.
+        @param duration
+            The length of time it takes to display the whole animation sequence, in seconds.
+            If 0, no automatic transition occurs.
+        */
+        void setAnimatedTextureName( const String* const names, unsigned int numFrames, Real duration = 0 );
+
+        /** Returns the width and height of the texture in the given frame.
+        */
+        std::pair< size_t, size_t > getTextureDimensions( unsigned int frame = 0 ) const;
+
+        /** Changes the active frame in an animated or multi-image texture.
+        @remarks
+            An animated texture (or a cubic texture where the images are not combined for 3D use) is made up of
+            a number of frames. This method sets the active frame.
+        @note
+            Applies to both fixed-function and programmable pipeline.
+        */
+        void setCurrentFrame( unsigned int frameNumber );
+
+        /** Gets the active frame in an animated or multi-image texture layer.
+        @note
+            Applies to both fixed-function and programmable pipeline.
+        */
+        unsigned int getCurrentFrame(void) const;
+
+        /** Gets the name of the texture associated with a frame number.
+            Throws an exception if frameNumber exceeds the number of stored frames.
+        @note
+            Applies to both fixed-function and programmable pipeline.
+        */
+        const String& getFrameTextureName(unsigned int frameNumber) const;
+
+        /** Sets the name of the texture associated with a frame.
+        @param name
+            The name of the texture.
+        @param frameNumber
+            The frame the texture name is to be placed in.
+        @note
+            Throws an exception if frameNumber exceeds the number of stored frames.
+            Applies to both fixed-function and programmable pipeline.
+        */
+        void setFrameTextureName(const String& name, unsigned int frameNumber);
+
+        /** Add a Texture name to the end of the frame container.
+        @param name
+            The name of the texture.
+        @note
+            Applies to both fixed-function and programmable pipeline.
+        */
+        void addFrameTextureName(const String& name);
+        /** Deletes a specific texture frame.  The texture used is not deleted but the
+            texture will no longer be used by the Texture Unit.  An exception is raised
+            if the frame number exceeds the number of actual frames.
+        @param frameNumber
+            The frame number of the texture to be deleted.
+        @note
+            Applies to both fixed-function and programmable pipeline.
+        */
+        void deleteFrameTextureName(const size_t frameNumber);
+        /** Gets the number of frames for a texture.
+        @note
+            Applies to both fixed-function and programmable pipeline.
+        */
+        unsigned int getNumFrames(void) const;
+
+
+        /** The type of unit to bind the texture settings to. */
+        enum BindingType
+        {
+            /** Regular fragment processing unit - the default. */
+            BT_FRAGMENT = 0,
+            /** Vertex processing unit - indicates this unit will be used for 
+                a vertex texture fetch.
+            */
+            BT_VERTEX = 1,			
+			/// Geometry processing unit		
+			BT_GEOMETRY = 2,
+			/// Tesselation control processing unit
+			BT_TESSELATION_HULL = 3,
+			/// Tesselation evaluation processing unit
+			BT_TESSELATION_DOMAIN = 4,
+			/// Compute processing unit
+			BT_COMPUTE = 5
+        };
+        /** Enum identifying the type of content this texture unit contains.
+        */
+        enum ContentType
+        {
+            /// Normal texture identified by name
+            CONTENT_NAMED = 0,
+            /// A shadow texture, automatically bound by engine
+            CONTENT_SHADOW = 1,
+            /// A compositor texture, automatically linked to active viewport's chain
+            CONTENT_COMPOSITOR = 2
+        };
+
+        /** Sets the type of unit these texture settings should be bound to. 
+        @remarks
+            Some render systems, when implementing vertex texture fetch, separate
+            the binding of textures for use in the vertex program versus those
+            used in fragment programs. This setting allows you to target the
+            vertex processing unit with a texture binding, in those cases. For
+            rendersystems which have a unified binding for the vertex and fragment
+            units, this setting makes no difference.
+        */
+        void setBindingType(BindingType bt);
+
+        /** Gets the type of unit these texture settings should be bound to.  
+        */
+        BindingType getBindingType(void) const;
+
+        /** Set the type of content this TextureUnitState references.
+        @remarks
+            The default is to reference a standard named texture, but this unit
+            can also reference automated content like a shadow texture.
+        */
+        void setContentType(ContentType ct);
+        /** Get the type of content this TextureUnitState references. */
+        ContentType getContentType(void) const;
+
+        /** Returns true if this texture unit is either a series of 6 2D textures, each
+            in it's own frame, or is a full 3D cube map. You can tell which by checking
+            getTextureType.
+        @note
+            Applies to both fixed-function and programmable pipeline.
+        */
+        bool isCubic(void) const;
+
+        /** Returns true if this texture layer uses a composite 3D cubic texture.
+        @note
+            Applies to both fixed-function and programmable pipeline.
+        */
+        bool is3D(void) const;
+
+        /** Returns the type of this texture.
+        @note
+            Applies to both fixed-function and programmable pipeline.
+        */
+        TextureType getTextureType(void) const;
+
+        /** Sets the desired pixel format when load the texture.
+        */
+        void setDesiredFormat(PixelFormat desiredFormat);
+
+        /** Gets the desired pixel format when load the texture.
+        */
+        PixelFormat getDesiredFormat(void) const;
+
+        /** Sets how many mipmaps have been requested for the texture.
+        */
+        void setNumMipmaps(int numMipmaps);
+
+        /** Gets how many mipmaps have been requested for the texture.
+        */
+        int getNumMipmaps(void) const;
+
+        /** Sets whether this texture is requested to be loaded as alpha if single channel
+        */
+        void setIsAlpha(bool isAlpha);
+
+        /** Gets whether this texture is requested to be loaded as alpha if single channel
+        */
+        bool getIsAlpha(void) const;
+
+        /// @copydoc Texture::getGamma
+        Real getGamma() const { return mGamma; }
+        /// @copydoc Texture::setGamma
+        void setGamma(Real gamma) { mGamma = gamma; }
+
+        /// @copydoc Texture::setHardwareGammaEnabled
+        void setHardwareGammaEnabled(bool enabled);
+        /// @copydoc Texture::isHardwareGammaEnabled
+        bool isHardwareGammaEnabled() const;
+
+        /** Gets the index of the set of texture co-ords this layer uses.
+        @note
+        Only applies to the fixed function pipeline and has no effect if a fragment program is used.
+        */
+        unsigned int getTextureCoordSet(void) const;
+
+        /** Sets the index of the set of texture co-ords this layer uses.
+        @note
+            Default is 0 for all layers. Only change this if you have provided multiple texture co-ords per
+            vertex.
+        @note
+        Only applies to the fixed function pipeline and has no effect if a fragment program is used.
+        */
+        void setTextureCoordSet(unsigned int set);
+
+        /** Sets a matrix used to transform any texture coordinates on this layer.
+        @remarks
+            Texture coordinates can be modified on a texture layer to create effects like scrolling
+            textures. A texture transform can either be applied to a layer which takes the source coordinates
+            from a fixed set in the geometry, or to one which generates them dynamically (e.g. environment mapping).
+        @par
+            It's obviously a bit impractical to create scrolling effects by calling this method manually since you
+            would have to call it every framw with a slight alteration each time, which is tedious. Instead
+            you can use the ControllerManager class to create a Controller object which will manage the
+            effect over time for you. See the ControllerManager::createTextureScroller and it's sibling methods for details.<BR>
+            In addition, if you want to set the individual texture transformations rather than concatenating them
+            yourself, use setTextureScroll, setTextureScale and setTextureRotate.
+        @note
+            Has no effect in the programmable pipeline.
+        */
+        void setTextureTransform(const Matrix4& xform);
+
+        /** Gets the current texture transformation matrix.
+        @remarks
+            Causes a reclaculation of the matrix if any parameters have been changed via
+            setTextureScroll, setTextureScale and setTextureRotate.
+        @note
+            Has no effect in the programmable pipeline.
+        */
+        const Matrix4& getTextureTransform(void) const;
+
+        /** Sets the translation offset of the texture, ie scrolls the texture.
+        @remarks
+            This method sets the translation element of the texture transformation, and is easier to use than setTextureTransform if
+            you are combining translation, scaling and rotation in your texture transformation. Again if you want
+            to animate these values you need to use a Controller
+        @note
+            Has no effect in the programmable pipeline.
+        @param u
+            The amount the texture should be moved horizontally (u direction).
+        @param v
+            The amount the texture should be moved vertically (v direction).
+        @see
+            ControllerManager, Controller
+        */
+        void setTextureScroll(Real u, Real v);
+
+        /** As setTextureScroll, but sets only U value.
+        @note
+            Has no effect in the programmable pipeline.
+        */
+        void setTextureUScroll(Real value);
+        /// Get texture uscroll value.
+        Real getTextureUScroll(void) const;
+
+        /** As setTextureScroll, but sets only V value.
+        @note
+            Has no effect in the programmable pipeline.
+        */
+        void setTextureVScroll(Real value);
+        /// Get texture vscroll value.
+        Real getTextureVScroll(void) const;
+
+        /** As setTextureScale, but sets only U value.
+        @note
+            Has no effect in the programmable pipeline.
+        */
+        void setTextureUScale(Real value);
+        /// Get texture uscale value.
+        Real getTextureUScale(void) const;
+
+        /** As setTextureScale, but sets only V value.
+        @note
+            Has no effect in the programmable pipeline.
+        */
+        void setTextureVScale(Real value);
+        /// Get texture vscale value.
+        Real getTextureVScale(void) const;
+
+        /** Sets the scaling factor applied to texture coordinates.
+        @remarks
+            This method sets the scale element of the texture transformation, and is easier to use than
+            setTextureTransform if you are combining translation, scaling and rotation in your texture transformation. Again if you want
+            to animate these values you need to use a Controller (see ControllerManager and it's methods for
+            more information).
+        @note
+            Has no effect in the programmable pipeline.
+        @param uScale
+            The value by which the texture is to be scaled horizontally.
+        @param vScale
+            The value by which the texture is to be scaled vertically.
+        */
+        void setTextureScale(Real uScale, Real vScale);
+
+        /** Sets the anticlockwise rotation factor applied to texture coordinates.
+        @remarks
+            This sets a fixed rotation angle - if you wish to animate this, see the
+            ControllerManager::createTextureRotater method.
+        @note
+            Has no effect in the programmable pipeline.
+        @param angle
+            The angle of rotation (anticlockwise).
+        */
+        void setTextureRotate(const Radian& angle);
+        /// Get texture rotation effects angle value.
+        const Radian& getTextureRotate(void) const;
+
+        /** Gets the texture addressing mode for a given coordinate, 
+            i.e. what happens at uv values above 1.0.
+        @note
+            The default is TAM_WRAP i.e. the texture repeats over values of 1.0.
+        */
+        const UVWAddressingMode& getTextureAddressingMode(void) const;
+
+        /** Sets the texture addressing mode, i.e. what happens at uv values above 1.0.
+        @note
+            The default is TAM_WRAP i.e. the texture repeats over values of 1.0.
+		@note This is a shortcut method which sets the addressing mode for all
+			coordinates at once; you can also call the more specific method
+			to set the addressing mode per coordinate.
+        @note
+            This is a shortcut method which sets the addressing mode for all
+            coordinates at once; you can also call the more specific method
+            to set the addressing mode per coordinate.
+        @note
+            This applies for both the fixed-function and programmable pipelines.
+        */
+        void setTextureAddressingMode( TextureAddressingMode tam);
+
+        /** Sets the texture addressing mode, i.e. what happens at uv values above 1.0.
+        @note
+            The default is TAM_WRAP i.e. the texture repeats over values of 1.0.
+        @note
+            This applies for both the fixed-function and programmable pipelines.
+        */
+        void setTextureAddressingMode( TextureAddressingMode u, 
+            TextureAddressingMode v, TextureAddressingMode w);
+
+        /** Sets the texture addressing mode, i.e. what happens at uv values above 1.0.
+        @note
+            The default is TAM_WRAP i.e. the texture repeats over values of 1.0.
+        @note
+            This applies for both the fixed-function and programmable pipelines.
+        */
+        void setTextureAddressingMode( const UVWAddressingMode& uvw);
+
+        /** Sets the texture border colour.
+        @note
+            The default is ColourValue::Black, and this value only used when addressing mode
+            is TAM_BORDER.
+        @note
+            This applies for both the fixed-function and programmable pipelines.
+        */
+        void setTextureBorderColour(const ColourValue& colour);
+
+        /** Sets the texture border colour.
+        @note
+            The default is ColourValue::Black, and this value only used when addressing mode
+            is TAM_BORDER.
+        */
+        const ColourValue& getTextureBorderColour(void) const;
+
+        /** Setting advanced blending options.
+        @remarks
+            This is an extended version of the TextureUnitState::setColourOperation method which allows
+            extremely detailed control over the blending applied between this and earlier layers.
+            See the IMPORTANT note below about the issues between mulitpass and multitexturing that
+            using this method can create.
+        @par
+            Texture colour operations determine how the final colour of the surface appears when
+            rendered. Texture units are used to combine colour values from various sources (ie. the
+            diffuse colour of the surface from lighting calculations, combined with the colour of
+            the texture). This method allows you to specify the 'operation' to be used, ie. the
+            calculation such as adds or multiplies, and which values to use as arguments, such as
+            a fixed value or a value from a previous calculation.
+        @par
+            The defaults for each layer are:
+            <ul>
+            <li>op = LBX_MODULATE</li>
+            <li>source1 = LBS_TEXTURE</li>
+            <li>source2 = LBS_CURRENT</li>
+            </ul>
+            ie. each layer takes the colour results of the previous layer, and multiplies them
+            with the new texture being applied. Bear in mind that colours are RGB values from
+            0.0 - 1.0 so multiplying them together will result in values in the same range,
+            'tinted' by the multiply. Note however that a straight multiply normally has the
+            effect of darkening the textures - for this reason there are brightening operations
+            like LBO_MODULATE_X2. See the LayerBlendOperation and LayerBlendSource enumerated
+            types for full details.
+        @note
+            Because of the limitations on some underlying APIs (Direct3D included)
+            the LBS_TEXTURE argument can only be used as the first argument, not the second.
+        @par
+            The final 3 parameters are only required if you decide to pass values manually
+            into the operation, i.e. you want one or more of the inputs to the colour calculation
+            to come from a fixed value that you supply. Hence you only need to fill these in if
+            you supply LBS_MANUAL to the corresponding source, or use the LBX_BLEND_MANUAL
+            operation.
+        @warning
+            Ogre tries to use multitexturing hardware to blend texture layers
+            together. However, if it runs out of texturing units (e.g. 2 of a GeForce2, 4 on a
+            GeForce3) it has to fall back on multipass rendering, i.e. rendering the same object
+            multiple times with different textures. This is both less efficient and there is a smaller
+            range of blending operations which can be performed. For this reason, if you use this method
+            you MUST also call TextureUnitState::setColourOpMultipassFallback to specify which effect you
+            want to fall back on if sufficient hardware is not available.
+        @note
+            This has no effect in the programmable pipeline.
+        @par
+            If you wish to avoid having to do this, use the simpler TextureUnitState::setColourOperation method
+            which allows less flexible blending options but sets up the multipass fallback automatically,
+            since it only allows operations which have direct multipass equivalents.
+        @param op
+            The operation to be used, e.g. modulate (multiply), add, subtract.
+        @param source1
+            The source of the first colour to the operation e.g. texture colour.
+        @param source2
+            The source of the second colour to the operation e.g. current surface colour.
+        @param arg1
+            Manually supplied colour value (only required if source1 = LBS_MANUAL).
+        @param arg2
+            Manually supplied colour value (only required if source2 = LBS_MANUAL).
+        @param manualBlend
+            Manually supplied 'blend' value - only required for operations
+            which require manual blend e.g. LBX_BLEND_MANUAL.
+        */
+        void setColourOperationEx(
+            LayerBlendOperationEx op,
+            LayerBlendSource source1 = LBS_TEXTURE,
+            LayerBlendSource source2 = LBS_CURRENT,
+
+            const ColourValue& arg1 = ColourValue::White,
+            const ColourValue& arg2 = ColourValue::White,
+
+            Real manualBlend = 0.0);
+
+        /** Determines how this texture layer is combined with the one below it (or the diffuse colour of
+            the geometry if this is layer 0).
+        @remarks
+            This method is the simplest way to blend tetxure layers, because it requires only one parameter,
+            gives you the most common blending types, and automatically sets up 2 blending methods: one for
+            if single-pass multitexturing hardware is available, and another for if it is not and the blending must
+            be achieved through multiple rendering passes. It is, however, quite limited and does not expose
+            the more flexible multitexturing operations, simply because these can't be automatically supported in
+            multipass fallback mode. If want to use the fancier options, use TextureUnitState::setColourOperationEx,
+            but you'll either have to be sure that enough multitexturing units will be available, or you should
+            explicitly set a fallback using TextureUnitState::setColourOpMultipassFallback.
+        @note
+            The default method is LBO_MODULATE for all layers.
+        @note
+            This option has no effect in the programmable pipeline.
+        @param op
+            One of the LayerBlendOperation enumerated blending types.
+        */
+        void setColourOperation( const LayerBlendOperation op);
+
+        /** Sets the multipass fallback operation for this layer, if you used TextureUnitState::setColourOperationEx
+            and not enough multitexturing hardware is available.
+        @remarks
+            Because some effects exposed using TextureUnitState::setColourOperationEx are only supported under
+            multitexturing hardware, if the hardware is lacking the system must fallback on multipass rendering,
+            which unfortunately doesn't support as many effects. This method is for you to specify the fallback
+            operation which most suits you.
+        @par
+            You'll notice that the interface is the same as the Material::setSceneBlending method; this is
+            because multipass rendering IS effectively scene blending, since each layer is rendered on top
+            of the last using the same mechanism as making an object transparent, it's just being rendered
+            in the same place repeatedly to get the multitexture effect.
+        @par
+            If you use the simpler (and hence less flexible) TextureUnitState::setColourOperation method you
+            don't need to call this as the system sets up the fallback for you.
+        @note
+            This option has no effect in the programmable pipeline, because there is no multipass fallback
+            and multitexture blending is handled by the fragment shader.
+        */
+        void setColourOpMultipassFallback( const SceneBlendFactor sourceFactor, const SceneBlendFactor destFactor);
+
+        /** Get multitexturing colour blending mode.
+        */
+        const LayerBlendModeEx& getColourBlendMode(void) const;
+
+        /** Get multitexturing alpha blending mode.
+        */
+        const LayerBlendModeEx& getAlphaBlendMode(void) const;
+
+        /** Get the multipass fallback for colour blending operation source factor.
+        */
+        SceneBlendFactor getColourBlendFallbackSrc(void) const;
+
+        /** Get the multipass fallback for colour blending operation destination factor.
+        */
+        SceneBlendFactor getColourBlendFallbackDest(void) const;
+
+        /** Sets the alpha operation to be applied to this texture.
+        @remarks
+            This works in exactly the same way as setColourOperation, except
+            that the effect is applied to the level of alpha (i.e. transparency)
+            of the texture rather than its colour. When the alpha of a texel (a pixel
+            on a texture) is 1.0, it is opaque, whereas it is fully transparent if the
+            alpha is 0.0. Please refer to the setColourOperation method for more info.
+        @param op
+            The operation to be used, e.g. modulate (multiply), add, subtract
+        @param source1
+            The source of the first alpha value to the operation e.g. texture alpha
+        @param source2
+            The source of the second alpha value to the operation e.g. current surface alpha
+        @param arg1
+            Manually supplied alpha value (only required if source1 = LBS_MANUAL)
+        @param arg2
+            Manually supplied alpha value (only required if source2 = LBS_MANUAL)
+        @param manualBlend
+            Manually supplied 'blend' value - only required for operations
+            which require manual blend e.g. LBX_BLEND_MANUAL
+        @see
+            setColourOperation
+        @note
+            This option has no effect in the programmable pipeline.
+        */
+        void setAlphaOperation(LayerBlendOperationEx op,
+            LayerBlendSource source1 = LBS_TEXTURE,
+            LayerBlendSource source2 = LBS_CURRENT,
+            Real arg1 = 1.0,
+            Real arg2 = 1.0,
+            Real manualBlend = 0.0);
+
+        /** Generic method for setting up texture effects.
+        @remarks
+            Allows you to specify effects directly by using the TextureEffectType enumeration. The
+            arguments that go with it depend on the effect type. Only one effect of
+            each type can be applied to a texture layer.
+        @par
+            This method is used internally by Ogre but it is better generally for applications to use the
+            more intuitive specialised methods such as setEnvironmentMap and setScroll.
+        @note
+            This option has no effect in the programmable pipeline.
+        */
+        void addEffect(TextureEffect& effect);
+
+        /** Turns on/off texture coordinate effect that makes this layer an environment map.
+        @remarks
+            Environment maps make an object look reflective by using the object's vertex normals relative
+            to the camera view to generate texture coordinates.
+        @par
+            The vectors generated can either be used to address a single 2D texture which
+            is a 'fish-eye' lens view of a scene, or a 3D cubic environment map which requires 6 textures
+            for each side of the inside of a cube. The type depends on what texture you set up - if you use the
+            setTextureName method then a 2D fisheye lens texture is required, whereas if you used setCubicTextureName
+            then a cubic environment map will be used.
+        @par
+            This effect works best if the object has lots of gradually changing normals. The texture also
+            has to be designed for this effect - see the example spheremap.png included with the sample
+            application for a 2D environment map; a cubic map can be generated by rendering 6 views of a
+            scene to each of the cube faces with orthogonal views.
+        @note
+            Enabling this disables any other texture coordinate generation effects.
+            However it can be combined with texture coordinate modification functions, which then operate on the
+            generated coordinates rather than static model texture coordinates.
+        @param enable
+            True to enable, false to disable
+        @param envMapType
+            The type of environment mapping to perform. Planar, curved, reflection or normal. @see EnvMapType
+        @note
+            This option has no effect in the programmable pipeline.
+        */
+        void setEnvironmentMap(bool enable, EnvMapType envMapType = ENV_CURVED);
+
+        /** Sets up an animated scroll for the texture layer.
+        @note
+            Useful for creating constant scrolling effects on a texture layer (for varying scrolls, see setTransformAnimation).
+        @param uSpeed
+            The number of horizontal loops per second (+ve=moving right, -ve = moving left).
+        @param vSpeed
+            The number of vertical loops per second (+ve=moving up, -ve= moving down).
+        @note
+            This option has no effect in the programmable pipeline.
+        */
+        void setScrollAnimation(Real uSpeed, Real vSpeed);
+
+        /** Sets up an animated texture rotation for this layer.
+        @note
+            Useful for constant rotations (for varying rotations, see setTransformAnimation).
+        @param speed
+            The number of complete anticlockwise revolutions per second (use -ve for clockwise)
+        @note
+            This option has no effect in the programmable pipeline.
+        */
+        void setRotateAnimation(Real speed);
+
+        /** Sets up a general time-relative texture modification effect.
+        @note
+            This can be called multiple times for different values of ttype, but only the latest effect
+            applies if called multiple time for the same ttype.
+        @param ttype
+            The type of transform, either translate (scroll), scale (stretch) or rotate (spin).
+        @param waveType
+            The shape of the wave, see WaveformType enum for details.
+        @param base
+            The base value for the function (range of output = {base, base + amplitude}).
+        @param frequency
+            The speed of the wave in cycles per second.
+        @param phase
+            The offset of the start of the wave, e.g. 0.5 to start half-way through the wave.
+        @param amplitude
+            Scales the output so that instead of lying within 0..1 it lies within 0..1*amplitude for exaggerated effects.
+        @note
+            This option has no effect in the programmable pipeline.
+        */
+        void setTransformAnimation( const TextureTransformType ttype,
+            const WaveformType waveType, Real base = 0, Real frequency = 1, Real phase = 0, Real amplitude = 1 );
+
+
+        /** Enables or disables projective texturing on this texture unit.
+        @remarks
+            Projective texturing allows you to generate texture coordinates 
+            based on a Frustum, which gives the impression that a texture is
+            being projected onto the surface. Note that once you have called
+            this method, the texture unit continues to monitor the Frustum you 
+            passed in and the projection will change if you can alter it. It also
+            means that you must ensure that the Frustum object you pass a pointer
+            to remains in existence for as long as this TextureUnitState does.
+        @par
+            This effect cannot be combined with other texture generation effects, 
+            such as environment mapping. It also has no effect on passes which 
+            have a vertex program enabled - projective texturing has to be done
+            in the vertex program instead.
+        @param enabled
+            Whether to enable / disable.
+        @param projectionSettings
+            The Frustum which will be used to derive the 
+            projection parameters.
+        */
+        void setProjectiveTexturing(bool enabled, const Frustum* projectionSettings = 0);
+
+        /** Removes all effects applied to this texture layer.
+        */
+        void removeAllEffects(void);
+
+        /** Removes a single effect applied to this texture layer.
+        @note
+            Because you can only have 1 effect of each type (e.g. 1 texture coordinate generation) applied
+            to a layer, only the effect type is required.
+        */
+        void removeEffect( const TextureEffectType type );
+
+        /** Determines if this texture layer is currently blank.
+        @note
+            This can happen if a texture fails to load or some other non-fatal error. Worth checking after
+            setting texture name.
+        */
+        bool isBlank(void) const;
+
+        /** Sets this texture layer to be blank.
+        */
+        void setBlank(void);
+
+        /** Tests if the texture associated with this unit has failed to load.
+        */
+        bool isTextureLoadFailing() const { return mTextureLoadFailed; }
+
+        /** Tells the unit to retry loading the texture if it had failed to load.
+        */
+        void retryTextureLoad() { mTextureLoadFailed = false; }
+
+        /// Get texture effects in a multimap paired array.
+        const EffectMap& getEffects(void) const;
+        /// Get the animated-texture animation duration.
+        Real getAnimationDuration(void) const;
+
+        /** Set the texture filtering for this unit, using the simplified interface.
+        @remarks
+            You also have the option of specifying the minification, magnification
+            and mip filter individually if you want more control over filtering
+            options. See the alternative setTextureFiltering methods for details.
+        @note
+            This option applies in both the fixed function and the programmable pipeline.
+        @param filterType
+            The high-level filter type to use.
+        */
+        void setTextureFiltering(TextureFilterOptions filterType);
+        /** Set a single filtering option on this texture unit. 
+        @param ftype
+            The filtering type to set.
+        @param opts
+            The filtering option to set.
+        */
+        void setTextureFiltering(FilterType ftype, FilterOptions opts);
+        /** Set a the detailed filtering options on this texture unit. 
+        @param minFilter
+            The filtering to use when reducing the size of the texture. 
+            Can be FO_POINT, FO_LINEAR or FO_ANISOTROPIC.
+        @param magFilter
+            The filtering to use when increasing the size of the texture.
+            Can be FO_POINT, FO_LINEAR or FO_ANISOTROPIC.
+        @param mipFilter
+            The filtering to use between mip levels.
+            Can be FO_NONE (turns off mipmapping), FO_POINT or FO_LINEAR (trilinear filtering).
+        */
+        void setTextureFiltering(FilterOptions minFilter, FilterOptions magFilter, FilterOptions mipFilter);
+        /// Get the texture filtering for the given type.
+        FilterOptions getTextureFiltering(FilterType ftpye) const;
+
+		void setTextureCompareEnabled(bool enabled);
+		bool getTextureCompareEnabled() const;
+	
+		void setTextureCompareFunction(CompareFunction function);
+		CompareFunction getTextureCompareFunction() const;
+
+        /** Sets the anisotropy level to be used for this texture level.
+        @param maxAniso
+            The maximal anisotropy level, should be between 2 and the maximum
+            supported by hardware (1 is the default, ie. no anisotrophy).
+        @note
+            This option applies in both the fixed function and the programmable pipeline.
+        */
+        void setTextureAnisotropy(unsigned int maxAniso);
+        /// Get this layer texture anisotropy level.
+        unsigned int getTextureAnisotropy() const;
+
+        /** Sets the bias value applied to the mipmap calculation.
+        @remarks
+            You can alter the mipmap calculation by biasing the result with a 
+            single floating point value. After the mip level has been calculated,
+            this bias value is added to the result to give the final mip level.
+            Lower mip levels are larger (higher detail), so a negative bias will
+            force the larger mip levels to be used, and a positive bias
+            will cause smaller mip levels to be used. The bias values are in 
+            mip levels, so a -1 bias will force mip levels one larger than by the
+            default calculation.
+        @param bias
+            The bias value as described above, can be positive or negative.
+        */
+        void setTextureMipmapBias(float bias) { mMipmapBias = bias; }
+        /** Gets the bias value applied to the mipmap calculation.
+        @see TextureUnitState::setTextureMipmapBias
+        */
+        float getTextureMipmapBias(void) const { return mMipmapBias; }
+
+        /** Set the compositor reference for this texture unit state.
+        @remarks 
+            Only valid when content type is compositor.
+        @param compositorName
+            The name of the compositor to reference.
+        @param textureName
+            The name of the texture to reference.
+        @param mrtIndex
+            The index of the wanted texture, if referencing an MRT.
+        */
+        void setCompositorReference(const String& compositorName, const String& textureName, size_t mrtIndex = 0);
+
+        /** Gets the name of the compositor that this texture referneces. */
+        const String& getReferencedCompositorName() const { return mCompositorRefName; }
+        /** Gets the name of the texture in the compositor that this texture references. */
+        const String& getReferencedTextureName() const { return mCompositorRefTexName; }
+        /** Gets the MRT index of the texture in the compositor that this texture references. */ 
+        size_t getReferencedMRTIndex() const { return mCompositorRefMrtIndex; }
+    
+        /// Gets the parent Pass object.
+        Pass* getParent(void) const { return mParent; }
+
+        /** Internal method for preparing this object for load, as part of Material::prepare. */
+        void _prepare(void);
+        /** Internal method for undoing the preparation this object as part of Material::unprepare. */
+        void _unprepare(void);
+        /** Internal method for loading this object as part of Material::load. */
+        void _load(void);
+        /** Internal method for unloading this object as part of Material::unload. */
+        void _unload(void);
+        /// Returns whether this unit has texture coordinate generation that depends on the camera.
+        bool hasViewRelativeTextureCoordinateGeneration(void) const;
+
+        /// Is this loaded?
+        bool isLoaded(void) const;
+        /** Tells the class that it needs recompilation. */
+        void _notifyNeedsRecompile(void);
+
+        /** Set the name of the Texture Unit State.
+        @remarks
+            The name of the Texture Unit State is optional.  Its useful in material scripts where a material could inherit
+            from another material and only want to modify a particalar Texture Unit State.
+        */
+        void setName(const String& name);
+        /// Get the name of the Texture Unit State.
+        const String& getName(void) const { return mName; }
+
+        /** Set the alias name used for texture frame names.
+        @param name
+            Can be any sequence of characters and does not have to be unique.
+        */
+        void setTextureNameAlias(const String& name);
+        /** Gets the Texture Name Alias of the Texture Unit.
+        */
+        const String& getTextureNameAlias(void) const { return mTextureNameAlias;}
+
+        /** Applies texture names to Texture Unit State with matching texture name aliases.
+            If no matching aliases are found then the TUS state does not change.
+        @remarks
+            Cubic, 1d, 2d, and 3d textures are determined from current state of the Texture Unit.
+            Assumes animated frames are sequentially numbered in the name.
+            If matching texture aliases are found then true is returned.
+
+        @param aliasList
+            A map container of texture alias, texture name pairs.
+        @param apply
+            Set @c true to apply the texture aliases else just test to see if texture alias matches are found.
+        @return
+            True if matching texture aliases were found in the Texture Unit State.
+        */
+        bool applyTextureAliases(const AliasTextureNamePairList& aliasList, const bool apply = true);
+
+        /** Notify this object that its parent has changed. */
+        void _notifyParent(Pass* parent);
+
+        /** Get the texture pointer for the current frame. */
+        const TexturePtr& _getTexturePtr(void) const;
+        /** Get the texture pointer for a given frame. */
+        const TexturePtr& _getTexturePtr(size_t frame) const;
+    
+        /** Set the texture pointer for the current frame (internal use only!). */
+        void _setTexturePtr(const TexturePtr& texptr);
+        /** Set the texture pointer for a given frame (internal use only!). */
+        void _setTexturePtr(const TexturePtr& texptr, size_t frame);
+
+		size_t calculateSize(void) const;
+
+        /** Gets the animation controller (as created because of setAnimatedTexture)
+            if it exists.
+        */
+        Controller<Real>* _getAnimController() const { return mAnimController; }
+protected:
+        // State
+        /// The current animation frame.
+        unsigned int mCurrentFrame;
+
+        /// Duration of animation in seconds.
+        Real mAnimDuration;
+        bool mCubic; /// Is this a series of 6 2D textures to make up a cube?
+        
+        TextureType mTextureType; 
+        PixelFormat mDesiredFormat;
+        int mTextureSrcMipmaps; /// Request number of mipmaps.
+
+        unsigned int mTextureCoordSetIndex;
+        UVWAddressingMode mAddressMode;
+        ColourValue mBorderColour;
+
+        LayerBlendModeEx mColourBlendMode;
+        SceneBlendFactor mColourBlendFallbackSrc;
+        SceneBlendFactor mColourBlendFallbackDest;
+
+        LayerBlendModeEx mAlphaBlendMode;
+        mutable bool mTextureLoadFailed;
+        bool mIsAlpha;
+        bool mHwGamma;
+        Real mGamma;
+
+        mutable bool mRecalcTexMatrix;
+        Real mUMod, mVMod;
+        Real mUScale, mVScale;
+        Radian mRotate;
+        mutable Matrix4 mTexModMatrix;
+
+        /// Texture filtering - minification.
+        FilterOptions mMinFilter;
+        /// Texture filtering - magnification.
+        FilterOptions mMagFilter;
+        /// Texture filtering - mipmapping.
+        FilterOptions mMipFilter;
+
+		bool mCompareEnabled;
+		CompareFunction mCompareFunc;
+
+        /// Texture anisotropy.
+        unsigned int mMaxAniso;
+        /// Mipmap bias (always float, not Real).
+        float mMipmapBias;
+
+        bool mIsDefaultAniso;
+        bool mIsDefaultFiltering;
+        /// Binding type (fragment or vertex pipeline).
+        BindingType mBindingType;
+        /// Content type of texture (normal loaded texture, auto-texture).
+        ContentType mContentType;
+        /// The index of the referenced texture if referencing an MRT in a compositor.
+        size_t mCompositorRefMrtIndex;
+
+        //-----------------------------------------------------------------------------
+        // Complex members (those that can't be copied using memcpy) are at the end to 
+        // allow for fast copying of the basic members.
+        //
+        vector<String>::type mFrames;
+        mutable vector<TexturePtr>::type mFramePtrs;
+        String mName;               ///< Optional name for the TUS.
+        String mTextureNameAlias;   ///< Optional alias for texture frames.
+        EffectMap mEffects;
+        /// The data that references the compositor.
+        String mCompositorRefName;
+        String mCompositorRefTexName;
+        //-----------------------------------------------------------------------------
+
+        //-----------------------------------------------------------------------------
+        // Pointer members (those that can't be copied using memcpy), and MUST
+        // preserving even if assign from others
+        //
+        Pass* mParent;
+        Controller<Real>* mAnimController;
+        //-----------------------------------------------------------------------------
+
+
+        /** Internal method for calculating texture matrix.
+        */
+        void recalcTextureMatrix(void) const;
+
+        /** Internal method for creating animation controller.
+        */
+        void createAnimController(void);
+
+        /** Internal method for creating texture effect controller.
+        */
+        void createEffectController(TextureEffect& effect);
+
+        /** Internal method for ensuring the texture for a given frame is prepared. */
+        void ensurePrepared(size_t frame) const;
+        /** Internal method for ensuring the texture for a given frame is loaded. */
+        void ensureLoaded(size_t frame) const;
+
+
+    };
+
+    /** @} */
+    /** @} */
+
+} // namespace Ogre
+
+#include "OgreHeaderSuffix.h"
+
+#endif // __TextureUnitState_H__
Index: /ogre_src_v1-9-0/OgreMain/include/OgreTimer.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreTimer.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreTimer.h	(revision 148)
@@ -0,0 +1,51 @@
+/*
+-----------------------------------------------------------------------------
+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 __OgreCommonTimer_H__
+#define __OgreCommonTimer_H__
+
+#include "OgrePrerequisites.h"
+#include "OgrePlatform.h"
+
+//Bring in the specific platform's header file
+#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WINRT
+# include "WIN32/OgreTimerImp.h"
+#elif OGRE_PLATFORM == OGRE_PLATFORM_LINUX
+# include "GLX/OgreTimerImp.h"
+#elif OGRE_PLATFORM == OGRE_PLATFORM_NACL  
+# include "NaCl/OgreTimerImp.h"
+#elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+# include "OSX/OgreTimerImp.h"
+#elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE_IOS
+# include "iOS/OgreTimerImp.h"
+#elif OGRE_PLATFORM == OGRE_PLATFORM_ANDROID
+# include "Android/OgreTimerImp.h"
+#elif OGRE_PLATFORM == OGRE_PLATFORM_FLASHCC
+# include "FlashCC/OgreTimerImp.h"
+#endif
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreUTFString.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreUTFString.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreUTFString.h	(revision 148)
@@ -0,0 +1,1116 @@
+// Modified from OpenGUI under lenient license
+// Original copyright details and licensing below:
+// OpenGUI (http://opengui.sourceforge.net)
+// This source code is released under the BSD License
+
+// Permission is given to the Ogre project to use the contents of file within its
+// source and binary applications, as well as any derivative works, in accordance
+// with the terms of any license under which Ogre is or will be distributed.
+//
+// Ogre may relicense its copy of this file, as well as any OpenGUI released updates
+// to this file, under any terms that it deems fit, and is not required to maintain
+// the original BSD licensing terms of this file, however OpenGUI retains the right
+// to present its copy of this file under the terms of any license under which
+// OpenGUI is distributed.
+//
+// Ogre is not required to release to OpenGUI any future changes that it makes to
+// this file, and understands and agrees that any such changes that are released
+// back to OpenGUI will become available under the terms of any license under which
+// OpenGUI is distributed.
+//
+// For brevity, this permission text may be removed from this file if desired.
+// The original record kept within the SourceForge (http://sourceforge.net/) tracker
+// is sufficient.
+//
+// - Eric Shorkey (zero/zeroskill) <opengui@rightbracket.com> [January 20th, 2007]
+
+#ifndef __OGRE_UTFSTRING_H__
+#define __OGRE_UTFSTRING_H__
+
+
+#include "OgrePrerequisites.h"
+#include "OgreHeaderPrefix.h"
+
+#if OGRE_UNICODE_SUPPORT 
+
+// these are explained later
+#include <iterator>
+#include <string>
+#include <stdexcept>
+
+// Workaround for VC7/7.1/8.0/9.0 (2003 - 2008):
+//      when build with /MD or /MDd, VC have both std::basic_string<unsigned short> and
+// basic_string<__wchar_t> instantiated in msvcprt[d].lib/MSVCP71[D].dll, but the header
+// files tells compiler that only one of them is over there (based on /Zc:wchar_t compile
+// option). And since this file used both of them, causing compiler instantiating another
+// one in user object code, which lead to duplicate symbols with msvcprt.lib/MSVCP71[D].dll.
+//
+#if OGRE_COMPILER == OGRE_COMPILER_MSVC && (OGRE_COMP_VER >= 1300 && OGRE_COMP_VER < 1600)
+
+# if defined(_DLL_CPPLIB)
+
+namespace std
+{
+    template class _CRTIMP2 basic_string<unsigned short, char_traits<unsigned short>,
+	    allocator<unsigned short> >;
+
+    template class _CRTIMP2 basic_string<__wchar_t, char_traits<__wchar_t>,
+	    allocator<__wchar_t> >;
+}
+
+# endif // defined(_DLL_CPPLIB)
+
+#endif  // OGRE_COMPILER == OGRE_COMPILER_MSVC && OGRE_COMP_VER == 1300
+
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Overlays
+	*  @{
+	*/
+
+	/* READ THIS NOTICE BEFORE USING IN YOUR OWN APPLICATIONS
+	=NOTICE=
+	This class is not a complete Unicode solution. It purposefully does not
+	provide certain functionality, such as proper lexical sorting for
+	Unicode values. It does provide comparison operators for the sole purpose
+	of using UTFString as an index with std::map and other operator< sorted
+	containers, but it should NOT be relied upon for meaningful lexical
+	operations, such as alphabetical sorts. If you need this type of
+	functionality, look into using ICU instead (http://icu.sourceforge.net/).
+
+	=REQUIREMENTS=
+	There are a few requirements for proper operation. They are fairly small,
+	and shouldn't restrict usage on any reasonable target.
+	* Compiler must support unsigned 16-bit integer types
+	* Compiler must support signed 32-bit integer types
+	* wchar_t must be either UTF-16 or UTF-32 encoding, and specified as such
+	    using the WCHAR_UTF16 macro as outlined below.
+	* You must include <iterator>, <string>, and <wchar>. Probably more, but
+	    these are the most obvious.
+
+	=REQUIRED PREPROCESSOR MACROS=
+	This class requires two preprocessor macros to be defined in order to
+	work as advertised.
+	INT32 - must be mapped to a signed 32 bit integer (ex. #define INT32 int)
+	UINT16 - must be mapped to an unsigned 16 bit integer (ex. #define UINT32 unsigned short)
+
+	Additionally, a third macro should be defined to control the evaluation of wchar_t:
+	WCHAR_UTF16 - should be defined when wchar_t represents UTF-16 code points,
+	    such as in Windows. Otherwise it is assumed that wchar_t is a 32-bit
+		integer representing UTF-32 code points.
+	*/
+
+	// THIS IS A VERY BRIEF AUTO DETECTION. YOU MAY NEED TO TWEAK THIS
+#ifdef __STDC_ISO_10646__
+// for any compiler that provides this, wchar_t is guaranteed to hold any Unicode value with a single code point (32-bit or larger)
+// so we can safely skip the rest of the testing
+#else // #ifdef __STDC_ISO_10646__
+#if defined( __WIN32__ ) || defined( _WIN32 ) || !defined(ANDROID)
+#define WCHAR_UTF16 // All currently known Windows platforms utilize UTF-16 encoding in wchar_t
+#else // #if defined( __WIN32__ ) || defined( _WIN32 )
+#if OGRE_COMPILER != OGRE_COMPILER_GCCE
+#if WCHAR_MAX <= 0xFFFF // this is a last resort fall back test; WCHAR_MAX is defined in <wchar.h>
+#define WCHAR_UTF16 // best we can tell, wchar_t is not larger than 16-bit
+#endif // #if WCHAR_MAX <= 0xFFFF
+#endif
+#endif // #if defined( __WIN32__ ) || defined( _WIN32 )
+#endif // #ifdef __STDC_ISO_10646__
+
+
+// OGRE_IS_NATIVE_WCHAR_T means that wchar_t isn't a typedef of
+// uint16 or uint32.
+#if OGRE_COMPILER == OGRE_COMPILER_MSVC
+
+// Don't define wchar_t related functions since it'll duplicate
+// with UTFString::code_point related functions when compile
+// without /Zc:wchar_t, because in this case both of them are
+// a typedef of uint16.
+# if defined(_NATIVE_WCHAR_T_DEFINED)
+#   define OGRE_IS_NATIVE_WCHAR_T      1
+# else
+#   define OGRE_IS_NATIVE_WCHAR_T      0
+# endif
+#else   // OGRE_COMPILER != OGRE_COMPILER_MSVC
+
+// Assumed wchar_t is natively for other compilers
+#   define OGRE_IS_NATIVE_WCHAR_T     1
+
+#endif  // OGRE_COMPILER == OGRE_COMPILER_MSVC
+
+	//! A UTF-16 string with implicit conversion to/from std::string and std::wstring
+	/*! This class provides a complete 1 to 1 map of most std::string functions (at least to my
+	knowledge). Implicit conversions allow this string class to work with all common C++ string
+	formats, with specialty functions defined where implicit conversion would cause potential
+	problems or is otherwise unavailable.
+
+	Some additional functionality is present to assist in working with characters using the
+	32-bit UTF-32 encoding. (Which is guaranteed to fit any Unicode character into a single
+	code point.) \b Note: Reverse iterators do not have this functionality due to the
+	ambiguity that surrounds working with UTF-16 in reverse. (Such as, where should an
+	iterator point to represent the beginning of a surrogate pair?)
+
+
+	\par Supported Input Types
+	The supported string types for input, and their assumed encoding schemes, are:
+	- std::string (UTF-8)
+	- char* (UTF-8)
+	- std::wstring (autodetected UTF-16 / UTF-32 based on compiler)
+	- wchar_t* (autodetected UTF-16 / UTF-32 based on compiler)
+
+
+	\see
+	- For additional information on UTF-16 encoding: http://en.wikipedia.org/wiki/UTF-16
+	- For additional information on UTF-8 encoding: http://en.wikipedia.org/wiki/UTF-8
+	- For additional information on UTF-32 encoding: http://en.wikipedia.org/wiki/UTF-32
+	*/
+	class _OgreExport UTFString {
+		// constants used in UTF-8 conversions
+		static const unsigned char _lead1 = 0xC0;      //110xxxxx
+		static const unsigned char _lead1_mask = 0x1F; //00011111
+		static const unsigned char _lead2 = 0xE0;      //1110xxxx
+		static const unsigned char _lead2_mask = 0x0F; //00001111
+		static const unsigned char _lead3 = 0xF0;      //11110xxx
+		static const unsigned char _lead3_mask = 0x07; //00000111
+		static const unsigned char _lead4 = 0xF8;      //111110xx
+		static const unsigned char _lead4_mask = 0x03; //00000011
+		static const unsigned char _lead5 = 0xFC;      //1111110x
+		static const unsigned char _lead5_mask = 0x01; //00000001
+		static const unsigned char _cont = 0x80;       //10xxxxxx
+		static const unsigned char _cont_mask = 0x3F;  //00111111
+
+	public:
+		//! size type used to indicate string size and character positions within the string
+		typedef size_t size_type;
+		//! the usual constant representing: not found, no limit, etc
+		static const size_type npos = static_cast<size_type>(~0);
+
+		//! a single 32-bit Unicode character
+		typedef uint32 unicode_char;
+
+		//! a single UTF-16 code point
+		typedef uint16 code_point;
+
+		//! value type typedef for use in iterators
+		typedef code_point value_type;
+
+		typedef std::basic_string<code_point> dstring; // data string
+
+		//! string type used for returning UTF-32 formatted data
+		typedef std::basic_string<unicode_char> utf32string;
+
+		//! This exception is used when invalid data streams are encountered
+	class _OgreExport invalid_data: public std::runtime_error { /* i don't know why the beautifier is freaking out on this line */
+		public:
+			//! constructor takes a string message that can be later retrieved by the what() function
+			explicit invalid_data( const std::string& _Message ): std::runtime_error( _Message ) {
+				/* The thing is, Bob, it's not that I'm lazy, it's that I just don't care. */
+			}
+		};
+
+		//#########################################################################
+		//! base iterator class for UTFString
+	class _OgreExport _base_iterator: public std::iterator<std::random_access_iterator_tag, value_type> { /* i don't know why the beautifier is freaking out on this line */
+			friend class UTFString;
+		protected:
+			_base_iterator();
+
+			void _seekFwd( size_type c );
+			void _seekRev( size_type c );
+			void _become( const _base_iterator& i );
+			bool _test_begin() const;
+			bool _test_end() const;
+			size_type _get_index() const;
+			void _jump_to( size_type index );
+
+			unicode_char _getCharacter() const;
+			int _setCharacter( unicode_char uc );
+
+			void _moveNext();
+			void _movePrev();
+
+			dstring::iterator mIter;
+			UTFString* mString;
+		};
+
+		//#########################################################################
+		// FORWARD ITERATORS
+		//#########################################################################
+		class _const_fwd_iterator; // forward declaration
+
+		//! forward iterator for UTFString
+	class _OgreExport _fwd_iterator: public _base_iterator { /* i don't know why the beautifier is freaking out on this line */
+			friend class _const_fwd_iterator;
+		public:
+			_fwd_iterator();
+			_fwd_iterator( const _fwd_iterator& i );
+
+			//! pre-increment
+			_fwd_iterator& operator++();
+			//! post-increment
+			_fwd_iterator operator++( int );
+
+			//! pre-decrement
+			_fwd_iterator& operator--();
+			//! post-decrement
+			_fwd_iterator operator--( int );
+
+			//! addition operator
+			_fwd_iterator operator+( difference_type n );
+			//! subtraction operator
+			_fwd_iterator operator-( difference_type n );
+
+			//! addition assignment operator
+			_fwd_iterator& operator+=( difference_type n );
+			//! subtraction assignment operator
+			_fwd_iterator& operator-=( difference_type n );
+
+			//! dereference operator
+			value_type& operator*() const;
+
+			//! dereference at offset operator
+			value_type& operator[]( difference_type n ) const;
+
+			//! advances to the next Unicode character, honoring surrogate pairs in the UTF-16 stream
+			_fwd_iterator& moveNext();
+			//! rewinds to the previous Unicode character, honoring surrogate pairs in the UTF-16 stream
+			_fwd_iterator& movePrev();
+			//! Returns the Unicode value of the character at the current position (decodes surrogate pairs if needed)
+			unicode_char getCharacter() const;
+			//! Sets the Unicode value of the character at the current position (adding a surrogate pair if needed); returns the amount of string length change caused by the operation
+			int setCharacter( unicode_char uc );
+		};
+
+
+
+		//#########################################################################
+		//! const forward iterator for UTFString
+	class _OgreExport _const_fwd_iterator: public _base_iterator { /* i don't know why the beautifier is freaking out on this line */
+		public:
+			_const_fwd_iterator();
+			_const_fwd_iterator( const _const_fwd_iterator& i );
+			_const_fwd_iterator( const _fwd_iterator& i );
+
+			//! pre-increment
+			_const_fwd_iterator& operator++();
+			//! post-increment
+			_const_fwd_iterator operator++( int );
+
+			//! pre-decrement
+			_const_fwd_iterator& operator--();
+			//! post-decrement
+			_const_fwd_iterator operator--( int );
+
+			//! addition operator
+			_const_fwd_iterator operator+( difference_type n );
+			//! subtraction operator
+			_const_fwd_iterator operator-( difference_type n );
+
+			//! addition assignment operator
+			_const_fwd_iterator& operator+=( difference_type n );
+			//! subtraction assignment operator
+			_const_fwd_iterator& operator-=( difference_type n );
+
+			//! dereference operator
+			const value_type& operator*() const;
+
+			//! dereference at offset operator
+			const value_type& operator[]( difference_type n ) const;
+
+			//! advances to the next Unicode character, honoring surrogate pairs in the UTF-16 stream
+			_const_fwd_iterator& moveNext();
+			//! rewinds to the previous Unicode character, honoring surrogate pairs in the UTF-16 stream
+			_const_fwd_iterator& movePrev();
+			//! Returns the Unicode value of the character at the current position (decodes surrogate pairs if needed)
+			unicode_char getCharacter() const;
+
+			//! difference operator
+			friend size_type operator-( const _const_fwd_iterator& left, const _const_fwd_iterator& right );
+			//! equality operator
+			friend bool operator==( const _const_fwd_iterator& left, const _const_fwd_iterator& right );
+			//! inequality operator
+			friend bool operator!=( const _const_fwd_iterator& left, const _const_fwd_iterator& right );
+			//! less than
+			friend bool operator<( const _const_fwd_iterator& left, const _const_fwd_iterator& right );
+			//! less than or equal
+			friend bool operator<=( const _const_fwd_iterator& left, const _const_fwd_iterator& right );
+			//! greater than
+			friend bool operator>( const _const_fwd_iterator& left, const _const_fwd_iterator& right );
+			//! greater than or equal
+			friend bool operator>=( const _const_fwd_iterator& left, const _const_fwd_iterator& right );
+
+		};
+
+		//#########################################################################
+		// REVERSE ITERATORS
+		//#########################################################################
+		class _const_rev_iterator; // forward declaration
+		//! forward iterator for UTFString
+	class _OgreExport _rev_iterator: public _base_iterator { /* i don't know why the beautifier is freaking out on this line */
+			friend class _const_rev_iterator;
+		public:
+			_rev_iterator();
+			_rev_iterator( const _rev_iterator& i );
+
+			//! pre-increment
+			_rev_iterator& operator++();
+			//! post-increment
+			_rev_iterator operator++( int );
+
+			//! pre-decrement
+			_rev_iterator& operator--();
+			//! post-decrement
+			_rev_iterator operator--( int );
+
+			//! addition operator
+			_rev_iterator operator+( difference_type n );
+			//! subtraction operator
+			_rev_iterator operator-( difference_type n );
+
+			//! addition assignment operator
+			_rev_iterator& operator+=( difference_type n );
+			//! subtraction assignment operator
+			_rev_iterator& operator-=( difference_type n );
+
+			//! dereference operator
+			value_type& operator*() const;
+
+			//! dereference at offset operator
+			value_type& operator[]( difference_type n ) const;
+		};
+		//#########################################################################
+		//! const reverse iterator for UTFString
+	class _OgreExport _const_rev_iterator: public _base_iterator { /* i don't know why the beautifier is freaking out on this line */
+		public:
+			_const_rev_iterator();
+			_const_rev_iterator( const _const_rev_iterator& i );
+			_const_rev_iterator( const _rev_iterator& i );
+			//! pre-increment
+			_const_rev_iterator& operator++();
+			//! post-increment
+			_const_rev_iterator operator++( int );
+
+			//! pre-decrement
+			_const_rev_iterator& operator--();
+			//! post-decrement
+			_const_rev_iterator operator--( int );
+
+			//! addition operator
+			_const_rev_iterator operator+( difference_type n );
+			//! subtraction operator
+			_const_rev_iterator operator-( difference_type n );
+
+			//! addition assignment operator
+			_const_rev_iterator& operator+=( difference_type n );
+			//! subtraction assignment operator
+			_const_rev_iterator& operator-=( difference_type n );
+
+			//! dereference operator
+			const value_type& operator*() const;
+
+			//! dereference at offset operator
+			const value_type& operator[]( difference_type n ) const;
+
+			//! difference operator
+			friend size_type operator-( const _const_rev_iterator& left, const _const_rev_iterator& right );
+			//! equality operator
+			friend bool operator==( const _const_rev_iterator& left, const _const_rev_iterator& right );
+			//! inequality operator
+			friend bool operator!=( const _const_rev_iterator& left, const _const_rev_iterator& right );
+			//! less than
+			friend bool operator<( const _const_rev_iterator& left, const _const_rev_iterator& right );
+			//! less than or equal
+			friend bool operator<=( const _const_rev_iterator& left, const _const_rev_iterator& right );
+			//! greater than
+			friend bool operator>( const _const_rev_iterator& left, const _const_rev_iterator& right );
+			//! greater than or equal
+			friend bool operator>=( const _const_rev_iterator& left, const _const_rev_iterator& right );
+		};
+		//#########################################################################
+
+		typedef _fwd_iterator iterator;                     //!< iterator
+		typedef _rev_iterator reverse_iterator;             //!< reverse iterator
+		typedef _const_fwd_iterator const_iterator;         //!< const iterator
+		typedef _const_rev_iterator const_reverse_iterator; //!< const reverse iterator
+
+
+		//!\name Constructors/Destructor
+		//@{
+		//! default constructor, creates an empty string
+		UTFString();
+		//! copy constructor
+		UTFString( const UTFString& copy );
+		//! \a length copies of \a ch
+		UTFString( size_type length, const code_point& ch );
+		//! duplicate of nul-terminated sequence \a str
+		UTFString( const code_point* str );
+		//! duplicate of \a str, \a length code points long
+		UTFString( const code_point* str, size_type length );
+		//! substring of \a str starting at \a index and \a length code points long
+		UTFString( const UTFString& str, size_type index, size_type length );
+#if OGRE_IS_NATIVE_WCHAR_T
+		//! duplicate of nul-terminated \c wchar_t array
+		UTFString( const wchar_t* w_str );
+		//! duplicate of \a w_str, \a length characters long
+		UTFString( const wchar_t* w_str, size_type length );
+#endif
+		//! duplicate of \a wstr
+		UTFString( const std::wstring& wstr );
+		//! duplicate of nul-terminated C-string \a c_str (UTF-8 encoding)
+		UTFString( const char* c_str );
+		//! duplicate of \a c_str, \a length characters long (UTF-8 encoding)
+		UTFString( const char* c_str, size_type length );
+		//! duplicate of \a str (UTF-8 encoding)
+		UTFString( const std::string& str );
+#if OGRE_STRING_USE_CUSTOM_MEMORY_ALLOCATOR
+		UTFString( const Ogre::String& str );
+#endif
+
+		//! destructor
+		~UTFString();
+		//@}
+
+		//////////////////////////////////////////////////////////////////////////
+
+		//!\name Utility functions
+		//@{
+		//! Returns the number of code points in the current string
+		size_type size() const;
+		//! Returns the number of code points in the current string
+		size_type length() const;
+		//! Returns the number of Unicode characters in the string
+		/*! Executes in linear time. */
+		size_type length_Characters() const;
+		//! returns the maximum number of UTF-16 code points that the string can hold
+		size_type max_size() const;
+		//! sets the capacity of the string to at least \a size code points
+		void reserve( size_type size );
+		//! changes the size of the string to \a size, filling in any new area with \a val
+		void resize( size_type num, const code_point& val = 0 );
+		//! exchanges the elements of the current string with those of \a from
+		void swap( UTFString& from );
+		//! returns \c true if the string has no elements, \c false otherwise
+		bool empty() const;
+		//! returns a pointer to the first character in the current string
+		const code_point* c_str() const;
+		//! returns a pointer to the first character in the current string
+		const code_point* data() const;
+		//! returns the number of elements that the string can hold before it will need to allocate more space
+		size_type capacity() const;
+		//! deletes all of the elements in the string
+		void clear();
+		//! returns a substring of the current string, starting at \a index, and \a num characters long.
+		/*! If \a num is omitted, it will default to \c UTFString::npos, and the substr() function will simply return the remainder of the string starting at \a index. */
+		UTFString substr( size_type index, size_type num = npos ) const;
+		//! appends \a val to the end of the string
+		void push_back( unicode_char val );
+#if OGRE_IS_NATIVE_WCHAR_T
+		//! appends \a val to the end of the string
+		void push_back( wchar_t val );
+#endif
+		//! appends \a val to the end of the string
+		/*! This can be used to push surrogate pair code points, you'll just need to push them
+		one after the other. */
+		void push_back( code_point val );
+		//! appends \a val to the end of the string
+		/*! Limited to characters under the 127 value barrier. */
+		void push_back( char val );
+		//! returns \c true if the given Unicode character \a ch is in this string
+		bool inString( unicode_char ch ) const;
+		//@}
+
+		//////////////////////////////////////////////////////////////////////////
+
+		//!\name Stream variations
+		//@{
+		//! returns the current string in UTF-8 form within a std::string
+		const std::string& asUTF8() const;
+		//! returns the current string in UTF-8 form as a nul-terminated char array
+		const char* asUTF8_c_str() const;
+		//! returns the current string in UTF-32 form within a utf32string
+		const utf32string& asUTF32() const;
+		//! returns the current string in UTF-32 form as a nul-terminated unicode_char array
+		const unicode_char* asUTF32_c_str() const;
+		//! returns the current string in the native form of std::wstring
+		const std::wstring& asWStr() const;
+		//! returns the current string in the native form of a nul-terminated wchar_t array
+		const wchar_t* asWStr_c_str() const;
+		//@}
+
+		//////////////////////////////////////////////////////////////////////////
+
+		//!\name Single Character Access
+		//@{
+		//! returns a reference to the element in the string at index \c loc
+		code_point& at( size_type loc );
+		//! returns a reference to the element in the string at index \c loc
+		const code_point& at( size_type loc ) const;
+		//! returns the data point \a loc evaluated as a UTF-32 value
+		/*! This function will will only properly decode surrogate pairs when \a loc points to the index
+		of a lead code point that is followed by a trailing code point. Evaluating the trailing code point
+		itself, or pointing to a code point that is a sentinel value (part of a broken pair) will return
+		the value of just that code point (not a valid Unicode value, but useful as a sentinel value). */
+		unicode_char getChar( size_type loc ) const;
+		//! sets the value of the character at \a loc to the Unicode value \a ch (UTF-32)
+		/*! Providing sentinel values (values between U+D800-U+DFFF) are accepted, but you should be aware
+		that you can also unwittingly create a valid surrogate pair if you don't pay attention to what you
+		are doing. @note This operation may also lengthen the string if a surrogate pair is needed to
+		represent the value given, but one is not available to replace; or alternatively shorten the string
+		if an existing surrogate pair is replaced with a character that is representable without a surrogate
+		pair. The return value will signify any lengthening or shortening performed, returning 0 if no change
+		was made, -1 if the string was shortened, or 1 if the string was lengthened. Any single call can
+		only change the string length by + or - 1. */
+		int setChar( size_type loc, unicode_char ch );
+		//@}
+
+		//////////////////////////////////////////////////////////////////////////
+
+		//!\name iterator acquisition
+		//@{
+		//! returns an iterator to the first element of the string
+		iterator begin();
+		//! returns an iterator to the first element of the string
+		const_iterator begin() const;
+		//! returns an iterator just past the end of the string
+		iterator end();
+		//! returns an iterator just past the end of the string
+		const_iterator end() const;
+		//! returns a reverse iterator to the last element of the string
+		reverse_iterator rbegin();
+		//! returns a reverse iterator to the last element of the string
+		const_reverse_iterator rbegin() const;
+		//! returns a reverse iterator just past the beginning of the string
+		reverse_iterator rend();
+		//! returns a reverse iterator just past the beginning of the string
+		const_reverse_iterator rend() const;
+		//@}
+
+		//////////////////////////////////////////////////////////////////////////
+
+		//!\name assign
+		//@{
+		//! gives the current string the values from \a start to \a end
+		UTFString& assign( iterator start, iterator end );
+		//! assign \a str to the current string
+		UTFString& assign( const UTFString& str );
+		//! assign the nul-terminated \a str to the current string
+		UTFString& assign( const code_point* str );
+		//! assign the first \a num characters of \a str to the current string
+		UTFString& assign( const code_point* str, size_type num );
+		//! assign \a len entries from \a str to the current string, starting at \a index
+		UTFString& assign( const UTFString& str, size_type index, size_type len );
+		//! assign \a num copies of \a ch to the current string
+		UTFString& assign( size_type num, const code_point& ch );
+		//! assign \a wstr to the current string (\a wstr is treated as a UTF-16 stream)
+		UTFString& assign( const std::wstring& wstr );
+#if OGRE_IS_NATIVE_WCHAR_T
+		//! assign \a w_str to the current string
+		UTFString& assign( const wchar_t* w_str );
+		//! assign the first \a num characters of \a w_str to the current string
+		UTFString& assign( const wchar_t* w_str, size_type num );
+#endif
+		//! assign \a str to the current string (\a str is treated as a UTF-8 stream)
+		UTFString& assign( const std::string& str );
+		//! assign \a c_str to the current string (\a c_str is treated as a UTF-8 stream)
+		UTFString& assign( const char* c_str );
+		//! assign the first \a num characters of \a c_str to the current string (\a c_str is treated as a UTF-8 stream)
+		UTFString& assign( const char* c_str, size_type num );
+		//@}
+
+		//////////////////////////////////////////////////////////////////////////
+
+		//!\name append
+		//@{
+		//! appends \a str on to the end of the current string
+		UTFString& append( const UTFString& str );
+		//! appends \a str on to the end of the current string
+		UTFString& append( const code_point* str );
+		//! appends a substring of \a str starting at \a index that is \a len characters long on to the end of the current string
+		UTFString& append( const UTFString& str, size_type index, size_type len );
+		//! appends \a num characters of \a str on to the end of the current string
+		UTFString& append( const code_point* str, size_type num );
+		//! appends \a num repetitions of \a ch on to the end of the current string
+		UTFString& append( size_type num, code_point ch );
+		//! appends the sequence denoted by \a start and \a end on to the end of the current string
+		UTFString& append( iterator start, iterator end );
+#if OGRE_IS_NATIVE_WCHAR_T
+		//! appends \a num characters of \a str on to the end of the current string
+		UTFString& append( const wchar_t* w_str, size_type num );
+		//! appends \a num repetitions of \a ch on to the end of the current string
+		UTFString& append( size_type num, wchar_t ch );
+#endif
+		//! appends \a num characters of \a str on to the end of the current string  (UTF-8 encoding)
+		UTFString& append( const char* c_str, size_type num );
+		//! appends \a num repetitions of \a ch on to the end of the current string (Unicode values less than 128)
+		UTFString& append( size_type num, char ch );
+		//! appends \a num repetitions of \a ch on to the end of the current string (Full Unicode spectrum)
+		UTFString& append( size_type num, unicode_char ch );
+		//@}
+
+		//////////////////////////////////////////////////////////////////////////
+
+		//!\name insert
+		//@{
+		//! inserts \a ch before the code point denoted by \a i
+		iterator insert( iterator i, const code_point& ch );
+		//! inserts \a str into the current string, at location \a index
+		UTFString& insert( size_type index, const UTFString& str );
+		//! inserts \a str into the current string, at location \a index
+		UTFString& insert( size_type index, const code_point* str ) {
+			mData.insert( index, str );
+			return *this;
+		}
+		//! inserts a substring of \a str (starting at \a index2 and \a num code points long) into the current string, at location \a index1
+		UTFString& insert( size_type index1, const UTFString& str, size_type index2, size_type num );
+		//! inserts the code points denoted by \a start and \a end into the current string, before the code point specified by \a i
+		void insert( iterator i, iterator start, iterator end );
+		//! inserts \a num code points of \a str into the current string, at location \a index
+		UTFString& insert( size_type index, const code_point* str, size_type num );
+#if OGRE_IS_NATIVE_WCHAR_T
+		//! inserts \a num code points of \a str into the current string, at location \a index
+		UTFString& insert( size_type index, const wchar_t* w_str, size_type num );
+#endif
+		//! inserts \a num code points of \a str into the current string, at location \a index
+		UTFString& insert( size_type index, const char* c_str, size_type num );
+		//! inserts \a num copies of \a ch into the current string, at location \a index
+		UTFString& insert( size_type index, size_type num, code_point ch );
+#if OGRE_IS_NATIVE_WCHAR_T
+		//! inserts \a num copies of \a ch into the current string, at location \a index
+		UTFString& insert( size_type index, size_type num, wchar_t ch );
+#endif
+		//! inserts \a num copies of \a ch into the current string, at location \a index
+		UTFString& insert( size_type index, size_type num, char ch );
+		//! inserts \a num copies of \a ch into the current string, at location \a index
+		UTFString& insert( size_type index, size_type num, unicode_char ch );
+		//! inserts \a num copies of \a ch into the current string, before the code point denoted by \a i
+		void insert( iterator i, size_type num, const code_point& ch );
+#if OGRE_IS_NATIVE_WCHAR_T
+		//! inserts \a num copies of \a ch into the current string, before the code point denoted by \a i
+		void insert( iterator i, size_type num, const wchar_t& ch );
+#endif
+		//! inserts \a num copies of \a ch into the current string, before the code point denoted by \a i
+		void insert( iterator i, size_type num, const char& ch );
+		//! inserts \a num copies of \a ch into the current string, before the code point denoted by \a i
+		void insert( iterator i, size_type num, const unicode_char& ch );
+		//@}
+
+		//////////////////////////////////////////////////////////////////////////
+
+		//!\name erase
+		//@{
+		//! removes the code point pointed to by \a loc, returning an iterator to the next character
+		iterator erase( iterator loc );
+		//! removes the code points between \a start and \a end (including the one at \a start but not the one at \a end), returning an iterator to the code point after the last code point removed
+		iterator erase( iterator start, iterator end );
+		//! removes \a num code points from the current string, starting at \a index
+		UTFString& erase( size_type index = 0, size_type num = npos );
+		//@}
+
+		//////////////////////////////////////////////////////////////////////////
+
+		//!\name replace
+		//@{
+		//! replaces up to \a num1 code points of the current string (starting at \a index1) with \a str
+		UTFString& replace( size_type index1, size_type num1, const UTFString& str );
+		//! replaces up to \a num1 code points of the current string (starting at \a index1) with up to \a num2 code points from \a str
+		UTFString& replace( size_type index1, size_type num1, const UTFString& str, size_type num2 );
+		//! replaces up to \a num1 code points of the current string (starting at \a index1) with up to \a num2 code points from \a str beginning at \a index2
+		UTFString& replace( size_type index1, size_type num1, const UTFString& str, size_type index2, size_type num2 );
+		//! replaces code points in the current string from \a start to \a end with \a num code points from \a str
+		UTFString& replace( iterator start, iterator end, const UTFString& str, size_type num = npos );
+		//! replaces up to \a num1 code points in the current string (beginning at \a index) with \c num2 copies of \c ch
+		UTFString& replace( size_type index, size_type num1, size_type num2, code_point ch );
+		//! replaces the code points in the current string from \a start to \a end with \a num copies of \a ch
+		UTFString& replace( iterator start, iterator end, size_type num, code_point ch );
+		//@}
+
+		//////////////////////////////////////////////////////////////////////////
+
+		//!\name compare
+		//@{
+		//! compare \a str to the current string
+		int compare( const UTFString& str ) const;
+		//! compare \a str to the current string
+		int compare( const code_point* str ) const;
+		//! compare \a str to a substring of the current string, starting at \a index for \a length characters
+		int compare( size_type index, size_type length, const UTFString& str ) const;
+		//! compare a substring of \a str to a substring of the current string, where \a index2 and \a length2 refer to \a str and \a index and \a length refer to the current string
+		int compare( size_type index, size_type length, const UTFString& str, size_type index2, size_type length2 ) const;
+		//! compare a substring of \a str to a substring of the current string, where the substring of \a str begins at zero and is \a length2 characters long, and the substring of the current string begins at \a index and is \a length  characters long
+		int compare( size_type index, size_type length, const code_point* str, size_type length2 ) const;
+#if OGRE_IS_NATIVE_WCHAR_T
+		//! compare a substring of \a str to a substring of the current string, where the substring of \a str begins at zero and is \a length2 elements long, and the substring of the current string begins at \a index and is \a length characters long
+		int compare( size_type index, size_type length, const wchar_t* w_str, size_type length2 ) const;
+#endif
+		//! compare a substring of \a str to a substring of the current string, where the substring of \a str begins at zero and is \a length2 <b>UTF-8 code points</b> long, and the substring of the current string begins at \a index and is \a length characters long
+		int compare( size_type index, size_type length, const char* c_str, size_type length2 ) const;
+		//@}
+
+		//////////////////////////////////////////////////////////////////////////
+
+		//!\name find & rfind
+		//@{
+		//! returns the index of the first occurrence of \a str within the current string, starting at \a index; returns \c UTFString::npos if nothing is found
+		/*! \a str is a UTF-16 encoded string, but through implicit casting can also be a UTF-8 encoded string (const char* or std::string) */
+		size_type find( const UTFString& str, size_type index = 0 ) const;
+		//! returns the index of the first occurrence of \a str within the current string and within \a length code points, starting at \a index; returns \c UTFString::npos if nothing is found
+		/*! \a cp_str is a UTF-16 encoded string */
+		size_type find( const code_point* cp_str, size_type index, size_type length ) const;
+		//! returns the index of the first occurrence of \a str within the current string and within \a length code points, starting at \a index; returns \c UTFString::npos if nothing is found
+		/*! \a cp_str is a UTF-8 encoded string */
+		size_type find( const char* c_str, size_type index, size_type length ) const;
+#if OGRE_IS_NATIVE_WCHAR_T
+		//! returns the index of the first occurrence of \a str within the current string and within \a length code points, starting at \a index; returns \c UTFString::npos if nothing is found
+		/*! \a cp_str is a UTF-16 encoded string */
+		size_type find( const wchar_t* w_str, size_type index, size_type length ) const;
+#endif
+		//! returns the index of the first occurrence \a ch within the current string, starting at \a index; returns \c UTFString::npos if nothing is found
+		/*! \a ch is only capable of representing Unicode values up to U+007F (127) */
+		size_type find( char ch, size_type index = 0 ) const;
+		//! returns the index of the first occurrence \a ch within the current string, starting at \a index; returns \c UTFString::npos if nothing is found
+		/*! \a ch is only capable of representing Unicode values up to U+FFFF (65535) */
+		size_type find( code_point ch, size_type index = 0 ) const;
+#if OGRE_IS_NATIVE_WCHAR_T
+		//! returns the index of the first occurrence \a ch within the current string, starting at \a index; returns \c UTFString::npos if nothing is found
+		/*! \a ch is only capable of representing Unicode values up to U+FFFF (65535) */
+		size_type find( wchar_t ch, size_type index = 0 ) const;
+#endif
+		//! returns the index of the first occurrence \a ch within the current string, starting at \a index; returns \c UTFString::npos if nothing is found
+		/*! \a ch can fully represent any Unicode character */
+		size_type find( unicode_char ch, size_type index = 0 ) const;
+
+		//! returns the location of the first occurrence of \a str in the current string, doing a reverse search from \a index; returns \c UTFString::npos if nothing is found
+		size_type rfind( const UTFString& str, size_type index = 0 ) const;
+		//! returns the location of the first occurrence of \a str in the current string, doing a reverse search from \a index, searching at most \a num characters; returns \c UTFString::npos if nothing is found
+		size_type rfind( const code_point* cp_str, size_type index, size_type num ) const;
+		//! returns the location of the first occurrence of \a str in the current string, doing a reverse search from \a index, searching at most \a num characters; returns \c UTFString::npos if nothing is found
+		size_type rfind( const char* c_str, size_type index, size_type num ) const;
+#if OGRE_IS_NATIVE_WCHAR_T
+		//! returns the location of the first occurrence of \a str in the current string, doing a reverse search from \a index, searching at most \a num characters; returns \c UTFString::npos if nothing is found
+		size_type rfind( const wchar_t* w_str, size_type index, size_type num ) const;
+#endif
+		//! returns the location of the first occurrence of \a ch in the current string, doing a reverse search from \a index; returns \c UTFString::npos if nothing is found
+		size_type rfind( char ch, size_type index = 0 ) const;
+		//! returns the location of the first occurrence of \a ch in the current string, doing a reverse search from \a index; returns \c UTFString::npos if nothing is found
+		size_type rfind( code_point ch, size_type index ) const;
+#if OGRE_IS_NATIVE_WCHAR_T
+		//! returns the location of the first occurrence of \a ch in the current string, doing a reverse search from \a index; returns \c UTFString::npos if nothing is found
+		size_type rfind( wchar_t ch, size_type index = 0 ) const;
+#endif
+		//! returns the location of the first occurrence of \a ch in the current string, doing a reverse search from \a index; returns \c UTFString::npos if nothing is found
+		size_type rfind( unicode_char ch, size_type index = 0 ) const;
+		//@}
+
+		//////////////////////////////////////////////////////////////////////////
+
+		//!\name find_first/last_(not)_of
+		//@{
+		//! Returns the index of the first character within the current string that matches \b any character in \a str, beginning the search at \a index and searching at most \a num characters; returns \c UTFString::npos if nothing is found
+		size_type find_first_of( const UTFString &str, size_type index = 0, size_type num = npos ) const;
+		//! returns the index of the first occurrence of \a ch in the current string, starting the search at \a index; returns \c UTFString::npos if nothing is found
+		size_type find_first_of( code_point ch, size_type index = 0 ) const;
+		//! returns the index of the first occurrence of \a ch in the current string, starting the search at \a index; returns \c UTFString::npos if nothing is found
+		size_type find_first_of( char ch, size_type index = 0 ) const;
+#if OGRE_IS_NATIVE_WCHAR_T
+		//! returns the index of the first occurrence of \a ch in the current string, starting the search at \a index; returns \c UTFString::npos if nothing is found
+		size_type find_first_of( wchar_t ch, size_type index = 0 ) const;
+#endif
+		//! returns the index of the first occurrence of \a ch in the current string, starting the search at \a index; returns \c UTFString::npos if nothing is found
+		size_type find_first_of( unicode_char ch, size_type index = 0 ) const;
+
+		//! returns the index of the first character within the current string that does not match any character in \a str, beginning the search at \a index and searching at most \a num characters; returns \c UTFString::npos if nothing is found
+		size_type find_first_not_of( const UTFString& str, size_type index = 0, size_type num = npos ) const;
+		//! returns the index of the first character within the current string that does not match \a ch, starting the search at \a index; returns \c UTFString::npos if nothing is found
+		size_type find_first_not_of( code_point ch, size_type index = 0 ) const;
+		//! returns the index of the first character within the current string that does not match \a ch, starting the search at \a index; returns \c UTFString::npos if nothing is found
+		size_type find_first_not_of( char ch, size_type index = 0 ) const;
+#if OGRE_IS_NATIVE_WCHAR_T
+		//! returns the index of the first character within the current string that does not match \a ch, starting the search at \a index; returns \c UTFString::npos if nothing is found
+		size_type find_first_not_of( wchar_t ch, size_type index = 0 ) const;
+#endif
+		//! returns the index of the first character within the current string that does not match \a ch, starting the search at \a index; returns \c UTFString::npos if nothing is found
+		size_type find_first_not_of( unicode_char ch, size_type index = 0 ) const;
+
+		//! returns the index of the first character within the current string that matches any character in \a str, doing a reverse search from \a index and searching at most \a num characters; returns \c UTFString::npos if nothing is found
+		size_type find_last_of( const UTFString& str, size_type index = npos, size_type num = npos ) const;
+		//! returns the index of the first occurrence of \a ch in the current string, doing a reverse search from \a index; returns \c UTFString::npos if nothing is found
+		size_type find_last_of( code_point ch, size_type index = npos ) const;
+		//! returns the index of the first occurrence of \a ch in the current string, doing a reverse search from \a index; returns \c UTFString::npos if nothing is found
+		size_type find_last_of( char ch, size_type index = npos ) const {
+			return find_last_of( static_cast<code_point>( ch ), index );
+		}
+#if OGRE_IS_NATIVE_WCHAR_T
+		//! returns the index of the first occurrence of \a ch in the current string, doing a reverse search from \a index; returns \c UTFString::npos if nothing is found
+		size_type find_last_of( wchar_t ch, size_type index = npos ) const;
+#endif
+		//! returns the index of the first occurrence of \a ch in the current string, doing a reverse search from \a index; returns \c UTFString::npos if nothing is found
+		size_type find_last_of( unicode_char ch, size_type index = npos ) const;
+
+		//! returns the index of the last character within the current string that does not match any character in \a str, doing a reverse search from \a index; returns \c UTFString::npos if nothing is found
+		size_type find_last_not_of( const UTFString& str, size_type index = npos, size_type num = npos ) const;
+		//! returns the index of the last occurrence of a character that does not match \a ch in the current string, doing a reverse search from \a index; returns \c UTFString::npos if nothing is found
+		size_type find_last_not_of( code_point ch, size_type index = npos ) const;
+		//! returns the index of the last occurrence of a character that does not match \a ch in the current string, doing a reverse search from \a index; returns \c UTFString::npos if nothing is found
+		size_type find_last_not_of( char ch, size_type index = npos ) const;
+#if OGRE_IS_NATIVE_WCHAR_T
+		//! returns the index of the last occurrence of a character that does not match \a ch in the current string, doing a reverse search from \a index; returns \c UTFString::npos if nothing is found
+		size_type find_last_not_of( wchar_t ch, size_type index = npos ) const;
+#endif
+		//! returns the index of the last occurrence of a character that does not match \a ch in the current string, doing a reverse search from \a index; returns \c UTFString::npos if nothing is found
+		size_type find_last_not_of( unicode_char ch, size_type index = npos ) const;
+		//@}
+
+		//////////////////////////////////////////////////////////////////////////
+
+		//!\name Operators
+		//@{
+		//! less than operator
+		bool operator<( const UTFString& right ) const;
+		//! less than or equal operator
+		bool operator<=( const UTFString& right ) const;
+		//! greater than operator
+		bool operator>( const UTFString& right ) const;
+		//! greater than or equal operator
+		bool operator>=( const UTFString& right ) const;
+		//! equality operator
+		bool operator==( const UTFString& right ) const;
+		//! inequality operator
+		bool operator!=( const UTFString& right ) const;
+		//! assignment operator, implicitly casts all compatible types
+		UTFString& operator=( const UTFString& s );
+		//! assignment operator
+		UTFString& operator=( code_point ch );
+		//! assignment operator
+		UTFString& operator=( char ch );
+#if OGRE_IS_NATIVE_WCHAR_T
+		//! assignment operator
+		UTFString& operator=( wchar_t ch );
+#endif
+		//! assignment operator
+		UTFString& operator=( unicode_char ch );
+		//! code point dereference operator
+		code_point& operator[]( size_type index );
+		//! code point dereference operator
+		const code_point& operator[]( size_type index ) const;
+		//@}
+
+		//////////////////////////////////////////////////////////////////////////
+
+		//!\name Implicit Cast Operators
+		//@{
+		//! implicit cast to std::string
+		operator std::string() const;
+		//! implicit cast to std::wstring
+		operator std::wstring() const;
+#if OGRE_STRING_USE_CUSTOM_MEMORY_ALLOCATOR
+		//! implicit cast to Ogre::String
+		operator Ogre::String() const;
+#endif
+		//@}
+
+		//////////////////////////////////////////////////////////////////////////
+
+		//!\name UTF-16 character encoding/decoding
+		//@{
+		//! returns \c true if \a cp does not match the signature for the lead of follow code point of a surrogate pair in a UTF-16 sequence
+		static bool _utf16_independent_char( code_point cp );
+		//! returns \c true if \a cp matches the signature of a surrogate pair lead character
+		static bool _utf16_surrogate_lead( code_point cp );
+		//! returns \c true if \a cp matches the signature of a surrogate pair following character
+		static bool _utf16_surrogate_follow( code_point cp );
+		//! estimates the number of UTF-16 code points in the sequence starting with \a cp
+		static size_t _utf16_char_length( code_point cp );
+		//! returns the number of UTF-16 code points needed to represent the given UTF-32 character \a cp
+		static size_t _utf16_char_length( unicode_char uc );
+		//! converts the given UTF-16 character buffer \a in_cp to a single UTF-32 Unicode character \a out_uc, returns the number of code points used to create the output character (2 for surrogate pairs, otherwise 1)
+		/*! This function does it's best to prevent error conditions, verifying complete
+		surrogate pairs before applying the algorithm. In the event that half of a pair
+		is found it will happily generate a value in the 0xD800 - 0xDFFF range, which is
+		normally an invalid Unicode value but we preserve them for use as sentinel values. */
+		static size_t _utf16_to_utf32( const code_point in_cp[2], unicode_char& out_uc );
+		//! writes the given UTF-32 \a uc_in to the buffer location \a out_cp using UTF-16 encoding, returns the number of code points used to encode the input (always 1 or 2)
+		/*! This function, like its counterpart, will happily create invalid UTF-16 surrogate pairs. These
+		invalid entries will be created for any value of \c in_uc that falls in the range U+D800 - U+DFFF.
+		These are generally useful as sentinel values to represent various program specific conditions.
+		@note This function will also pass through any single UTF-16 code point without modification,
+		making it a safe method of ensuring a stream that is unknown UTF-32 or UTF-16 is truly UTF-16.*/
+		static size_t _utf32_to_utf16( const unicode_char& in_uc, code_point out_cp[2] );
+		//@}
+
+		//////////////////////////////////////////////////////////////////////////
+
+		//!\name UTF-8 character encoding/decoding
+		//@{
+		//! returns \c true if \a cp is the beginning of a UTF-8 sequence
+		static bool _utf8_start_char( unsigned char cp );
+		//! estimates the number of UTF-8 code points in the sequence starting with \a cp
+		static size_t _utf8_char_length( unsigned char cp );
+		//! returns the number of UTF-8 code points needed to represent the given UTF-32 character \a cp
+		static size_t _utf8_char_length( unicode_char uc );
+
+		//! converts the given UTF-8 character buffer to a single UTF-32 Unicode character, returns the number of bytes used to create the output character (maximum of 6)
+		static size_t _utf8_to_utf32( const unsigned char in_cp[6], unicode_char& out_uc );
+		//! writes the given UTF-32 \a uc_in to the buffer location \a out_cp using UTF-8 encoding, returns the number of bytes used to encode the input
+		static size_t _utf32_to_utf8( const unicode_char& in_uc, unsigned char out_cp[6] );
+
+		//! verifies a UTF-8 stream, returning the total number of Unicode characters found
+		static size_type _verifyUTF8( const unsigned char* c_str );
+		//! verifies a UTF-8 stream, returning the total number of Unicode characters found
+		static size_type _verifyUTF8( const std::string& str );
+		//@}
+
+	private:
+		//template<class ITER_TYPE> friend class _iterator;
+		dstring mData;
+
+		//! buffer data type identifier
+		enum BufferType {
+			bt_none,
+			bt_string,
+			bt_wstring,
+			bt_utf32string
+		};
+
+		//! common constructor operations
+		void _init();
+
+		///////////////////////////////////////////////////////////////////////
+		// Scratch buffer
+		//! auto cleans the scratch buffer using the proper delete for the stored type
+		void _cleanBuffer() const;
+
+		//! create a std::string in the scratch buffer area
+		void _getBufferStr() const;
+		//! create a std::wstring in the scratch buffer area
+		void _getBufferWStr() const;
+		//! create a utf32string in the scratch buffer area
+		void _getBufferUTF32Str() const;
+
+		void _load_buffer_UTF8() const;
+		void _load_buffer_WStr() const;
+		void _load_buffer_UTF32() const;
+
+		mutable BufferType mBufferType; // identifies the data type held in mBuffer
+		mutable size_t mBufferSize; // size of the CString buffer
+
+		// multi-purpose buffer used everywhere we need a throw-away buffer
+		union {
+			mutable void* mVoidBuffer;
+			mutable std::string* mStrBuffer;
+			mutable std::wstring* mWStrBuffer;
+			mutable utf32string* mUTF32StrBuffer;
+		}
+		mBuffer;
+	};
+
+	//! string addition operator \relates UTFString
+	inline UTFString operator+( const UTFString& s1, const UTFString& s2 ) {
+		return UTFString( s1 ).append( s2 );
+	}
+	//! string addition operator \relates UTFString
+	inline UTFString operator+( const UTFString& s1, UTFString::code_point c ) {
+		return UTFString( s1 ).append( 1, c );
+	}
+	//! string addition operator \relates UTFString
+	inline UTFString operator+( const UTFString& s1, UTFString::unicode_char c ) {
+		return UTFString( s1 ).append( 1, c );
+	}
+	//! string addition operator \relates UTFString
+	inline UTFString operator+( const UTFString& s1, char c ) {
+		return UTFString( s1 ).append( 1, c );
+	}
+#if OGRE_IS_NATIVE_WCHAR_T
+	//! string addition operator \relates UTFString
+	inline UTFString operator+( const UTFString& s1, wchar_t c ) {
+		return UTFString( s1 ).append( 1, c );
+	}
+#endif
+	//! string addition operator \relates UTFString
+	inline UTFString operator+( UTFString::code_point c, const UTFString& s2 ) {
+		return UTFString().append( 1, c ).append( s2 );
+	}
+	//! string addition operator \relates UTFString
+	inline UTFString operator+( UTFString::unicode_char c, const UTFString& s2 ) {
+		return UTFString().append( 1, c ).append( s2 );
+	}
+	//! string addition operator \relates UTFString
+	inline UTFString operator+( char c, const UTFString& s2 ) {
+		return UTFString().append( 1, c ).append( s2 );
+	}
+#if OGRE_IS_NATIVE_WCHAR_T
+	//! string addition operator \relates UTFString
+	inline UTFString operator+( wchar_t c, const UTFString& s2 ) {
+		return UTFString().append( 1, c ).append( s2 );
+	}
+#endif
+
+	// (const) forward iterator common operators
+	inline UTFString::size_type operator-( const UTFString::_const_fwd_iterator& left, const UTFString::_const_fwd_iterator& right ) {
+		return ( left.mIter - right.mIter );
+	}
+	inline bool operator==( const UTFString::_const_fwd_iterator& left, const UTFString::_const_fwd_iterator& right ) {
+		return left.mIter == right.mIter;
+	}
+	inline bool operator!=( const UTFString::_const_fwd_iterator& left, const UTFString::_const_fwd_iterator& right ) {
+		return left.mIter != right.mIter;
+	}
+	inline bool operator<( const UTFString::_const_fwd_iterator& left, const UTFString::_const_fwd_iterator& right ) {
+		return left.mIter < right.mIter;
+	}
+	inline bool operator<=( const UTFString::_const_fwd_iterator& left, const UTFString::_const_fwd_iterator& right ) {
+		return left.mIter <= right.mIter;
+	}
+	inline bool operator>( const UTFString::_const_fwd_iterator& left, const UTFString::_const_fwd_iterator& right ) {
+		return left.mIter > right.mIter;
+	}
+	inline bool operator>=( const UTFString::_const_fwd_iterator& left, const UTFString::_const_fwd_iterator& right ) {
+		return left.mIter >= right.mIter;
+	}
+
+	// (const) reverse iterator common operators
+	// NB: many of these operations are evaluated in reverse because this is a reverse iterator wrapping a forward iterator
+	inline UTFString::size_type operator-( const UTFString::_const_rev_iterator& left, const UTFString::_const_rev_iterator& right ) {
+		return ( right.mIter - left.mIter );
+	}
+	inline bool operator==( const UTFString::_const_rev_iterator& left, const UTFString::_const_rev_iterator& right ) {
+		return left.mIter == right.mIter;
+	}
+	inline bool operator!=( const UTFString::_const_rev_iterator& left, const UTFString::_const_rev_iterator& right ) {
+		return left.mIter != right.mIter;
+	}
+	inline bool operator<( const UTFString::_const_rev_iterator& left, const UTFString::_const_rev_iterator& right ) {
+		return right.mIter < left.mIter;
+	}
+	inline bool operator<=( const UTFString::_const_rev_iterator& left, const UTFString::_const_rev_iterator& right ) {
+		return right.mIter <= left.mIter;
+	}
+	inline bool operator>( const UTFString::_const_rev_iterator& left, const UTFString::_const_rev_iterator& right ) {
+		return right.mIter > left.mIter;
+	}
+	inline bool operator>=( const UTFString::_const_rev_iterator& left, const UTFString::_const_rev_iterator& right ) {
+		return right.mIter >= left.mIter;
+	}
+
+	//! std::ostream write operator \relates UTFString
+	inline std::ostream& operator << ( std::ostream& os, const UTFString& s ) {
+		return os << s.asUTF8();
+	}
+
+	//! std::wostream write operator \relates UTFString
+	inline std::wostream& operator << ( std::wostream& os, const UTFString& s ) {
+		return os << s.asWStr();
+	}
+
+	/** @} */
+	/** @} */
+
+
+} // namespace Ogre{
+
+#endif // OGRE_UNICODE_SUPPORT
+
+#include "OgreHeaderSuffix.h"
+
+#endif 
Index: /ogre_src_v1-9-0/OgreMain/include/OgreUnifiedHighLevelGpuProgram.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreUnifiedHighLevelGpuProgram.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreUnifiedHighLevelGpuProgram.h	(revision 148)
@@ -0,0 +1,178 @@
+/*
+-----------------------------------------------------------------------------
+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 __UnifiedHighLevelGpuProgram_H__
+#define __UnifiedHighLevelGpuProgram_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreHighLevelGpuProgram.h"
+#include "OgreHighLevelGpuProgramManager.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Resources
+	*  @{
+	*/
+	/** Specialisation of HighLevelGpuProgram which just delegates its implementation
+		to one other high level program, allowing a single program definition
+		to represent one supported program from a number of options
+	@remarks
+		Whilst you can use Technique to implement several ways to render an object
+		depending on hardware support, if the only reason to need multiple paths is
+		because of the high-level shader language supported, this can be 
+		cumbersome. For example you might want to implement the same shader 
+		in HLSL and	GLSL for portability but apart from the implementation detail,
+		the shaders do the same thing and take the same parameters. If the materials
+		in question are complex, duplicating the techniques just to switch language
+		is not optimal, so instead you can define high-level programs with a 
+		syntax of 'unified', and list the actual implementations in order of
+		preference via repeated use of the 'delegate' parameter, which just points
+		at another program name. The first one which has a supported syntax 
+		will be used.
+	*/
+	class _OgreExport UnifiedHighLevelGpuProgram : public HighLevelGpuProgram
+	{
+	public:
+		/// Command object for setting delegate (can set more than once)
+		class CmdDelegate : public ParamCommand
+		{
+		public:
+			String doGet(const void* target) const;
+			void doSet(void* target, const String& val);
+		};
+
+	protected:
+		static CmdDelegate msCmdDelegate;
+
+		/// Ordered list of potential delegates
+		StringVector mDelegateNames;
+		/// The chosen delegate
+		mutable HighLevelGpuProgramPtr mChosenDelegate;
+
+		/// Choose the delegate to use
+		void chooseDelegate() const;
+
+		void createLowLevelImpl(void);
+		void unloadHighLevelImpl(void);
+		void buildConstantDefinitions() const;
+		void loadFromSource(void);
+
+	public:
+		/** Constructor, should be used only by factory classes. */
+		UnifiedHighLevelGpuProgram(ResourceManager* creator, const String& name, ResourceHandle handle,
+			const String& group, bool isManual = false, ManualResourceLoader* loader = 0);
+		~UnifiedHighLevelGpuProgram();
+
+		virtual size_t calculateSize(void) const;
+
+		/** Adds a new delegate program to the list.
+		@remarks
+			Delegates are tested in order so earlier ones are preferred.
+		*/
+		void addDelegateProgram(const String& name);
+
+		/// Remove all delegate programs
+		void clearDelegatePrograms();
+
+		/// Get the chosen delegate
+		const HighLevelGpuProgramPtr& _getDelegate() const;
+
+		/** @copydoc GpuProgram::getLanguage */
+        const String& getLanguage(void) const;
+
+		/** Creates a new parameters object compatible with this program definition. 
+		@remarks
+		Unlike low-level assembly programs, parameters objects are specific to the
+		program and therefore must be created from it rather than by the 
+		HighLevelGpuProgramManager. This method creates a new instance of a parameters
+		object containing the definition of the parameters this program understands.
+		*/
+		GpuProgramParametersSharedPtr createParameters(void);
+		/** @copydoc GpuProgram::_getBindingDelegate */
+		GpuProgram* _getBindingDelegate(void);
+
+		// All the following methods must delegate to the implementation
+
+		/** @copydoc GpuProgram::isSupported */
+		bool isSupported(void) const;
+		
+		/** @copydoc GpuProgram::isSkeletalAnimationIncluded */
+		bool isSkeletalAnimationIncluded(void) const;
+
+		bool isMorphAnimationIncluded(void) const;
+
+		bool isPoseAnimationIncluded(void) const;
+
+		bool isVertexTextureFetchRequired(void) const;
+		GpuProgramParametersSharedPtr getDefaultParameters(void);
+		bool hasDefaultParameters(void) const;
+		bool getPassSurfaceAndLightStates(void) const;
+		bool getPassFogStates(void) const;
+		bool getPassTransformStates(void) const;
+		bool hasCompileError(void) const;
+		void resetCompileError(void);
+
+		void load(bool backgroundThread = false);
+		void reload(void);
+		bool isReloadable(void) const;
+		bool isLoaded(void) const;
+		bool isLoading() const;
+		LoadingState getLoadingState() const;
+		void unload(void);
+		size_t getSize(void) const;
+		void touch(void);
+		bool isBackgroundLoaded(void) const;
+		void setBackgroundLoaded(bool bl);
+		void escalateLoading();
+		void addListener(Listener* lis);
+		void removeListener(Listener* lis);
+
+	};
+
+	/** Factory class for Unified programs. */
+	class UnifiedHighLevelGpuProgramFactory : public HighLevelGpuProgramFactory
+	{
+	public:
+		UnifiedHighLevelGpuProgramFactory();
+		~UnifiedHighLevelGpuProgramFactory();
+		/// Get the name of the language this factory creates programs for
+		const String& getLanguage(void) const;
+		HighLevelGpuProgram* create(ResourceManager* creator, 
+			const String& name, ResourceHandle handle,
+			const String& group, bool isManual, ManualResourceLoader* loader);
+		void destroy(HighLevelGpuProgram* prog);
+
+	};
+
+	/** @} */
+	/** @} */
+
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreUserObjectBindings.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreUserObjectBindings.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreUserObjectBindings.h	(revision 148)
@@ -0,0 +1,143 @@
+/*
+-----------------------------------------------------------------------------
+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 _UserObjectsBinding_H__
+#define _UserObjectsBinding_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreAny.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Scene
+	*  @{
+	*/
+
+	/** Class that provides convenient interface to establish a linkage between
+	custom user application objects and Ogre core classes.
+	Any instance of Ogre class that will derive from this class could be associated with custom 
+	application object using this class interface.
+	*/
+	class _OgreExport UserObjectBindings : public GeneralAllocatedObject
+	{
+	public:	
+		/** Class constructor. */
+		UserObjectBindings();
+
+		/** Class destructor. */
+		virtual ~UserObjectBindings();
+
+		/** Sets any kind of user object on this class instance.
+		@remarks
+		This method allows you to associate any user object you like with 
+		this class. This can be a pointer back to one of your own
+		classes for instance.
+		@note This method is key less meaning that each call for it will override
+		previous object that were set. If you need to associate multiple objects
+		with this class use the extended version that takes key.
+		*/
+		void setUserAny(const Any& anything);
+
+		/** Retrieves the custom key less user object associated with this class.
+		*/
+		const Any& getUserAny(void) const;
+
+		/** Sets any kind of user object on this class instance.
+		@remarks
+		This method allows you to associate multiple object with this class. 
+		This can be a pointer back to one of your own classes for instance.
+		Use a unique key to distinguish between each of these objects. 
+		@param key The key that this data is associate with.
+		@param anything The data to associate with the given key.
+		*/
+		void setUserAny(const String& key, const Any& anything);
+
+		/** Retrieves the custom user object associated with this class and key.
+		@param key The key that the requested user object is associated with.
+		@remarks
+		In case no object associated with this key the returned Any object will be empty.
+		*/
+		const Any& getUserAny(const String& key) const;
+
+		/** Erase the custom user object associated with this class and key from this binding.
+		@param key The key that the requested user object is associated with.		
+		*/
+		void eraseUserAny(const String& key);
+
+		/** Clear all user objects from this binding.	*/
+		void clear() const;
+
+		/** Returns empty user any object.
+		*/
+		static const Any& getEmptyUserAny() { return msEmptyAny; }
+
+	// Types.
+	protected:		
+		typedef map<String, Any>::type			UserObjectsMap;
+		typedef UserObjectsMap::iterator		UserObjectsMapIterator;
+		typedef UserObjectsMap::const_iterator	UserObjectsMapConstIterator;
+
+		/** Internal class that uses as data storage container.
+		*/
+		class Attributes : public GeneralAllocatedObject
+		{
+		public:
+			/** Attribute storage ctor. */
+			Attributes() : mUserObjectsMap(NULL) {}
+
+			/** Attribute storage dtor. */
+			~Attributes()
+			{
+				if (mUserObjectsMap != NULL)
+				{
+					OGRE_DELETE mUserObjectsMap;
+					mUserObjectsMap = NULL;
+				}				
+			}
+
+			Any					mKeylessAny;		// Will hold key less associated user object for fast access. 	
+			UserObjectsMap*		mUserObjectsMap;	// Will hold a map between user keys to user objects.
+		};
+
+	// Attributes.
+	private:
+		static Any				msEmptyAny;			// Shared empty any object.
+		mutable Attributes*		mAttributes;		// Class attributes - will be allocated on demand.
+		
+	};
+
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreVector2.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreVector2.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreVector2.h	(revision 148)
@@ -0,0 +1,605 @@
+/*
+-----------------------------------------------------------------------------
+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 __Vector2_H__
+#define __Vector2_H__
+
+
+#include "OgrePrerequisites.h"
+#include "OgreMath.h"
+
+namespace Ogre
+{
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Math
+	*  @{
+	*/
+	/** Standard 2-dimensional vector.
+        @remarks
+            A direction in 2D space represented as distances along the 2
+            orthogonal axes (x, y). Note that positions, directions and
+            scaling factors can be represented by a vector, depending on how
+            you interpret the values.
+    */
+    class _OgreExport Vector2
+    {
+    public:
+        Real x, y;
+
+    public:
+        /** Default constructor.
+            @note
+                It does <b>NOT</b> initialize the vector for efficiency.
+        */
+        inline Vector2()
+        {
+        }
+
+        inline Vector2(const Real fX, const Real fY )
+            : x( fX ), y( fY )
+        {
+        }
+
+        inline explicit Vector2( const Real scaler )
+            : x( scaler), y( scaler )
+        {
+        }
+
+        inline explicit Vector2( const Real afCoordinate[2] )
+            : x( afCoordinate[0] ),
+              y( afCoordinate[1] )
+        {
+        }
+
+        inline explicit Vector2( const int afCoordinate[2] )
+        {
+            x = (Real)afCoordinate[0];
+            y = (Real)afCoordinate[1];
+        }
+
+        inline explicit Vector2( Real* const r )
+            : x( r[0] ), y( r[1] )
+        {
+        }
+
+		/** Exchange the contents of this vector with another. 
+		*/
+		inline void swap(Vector2& other)
+		{
+			std::swap(x, other.x);
+			std::swap(y, other.y);
+		}
+
+		inline Real operator [] ( const size_t i ) const
+        {
+            assert( i < 2 );
+
+            return *(&x+i);
+        }
+
+		inline Real& operator [] ( const size_t i )
+        {
+            assert( i < 2 );
+
+            return *(&x+i);
+        }
+
+		/// Pointer accessor for direct copying
+		inline Real* ptr()
+		{
+			return &x;
+		}
+		/// Pointer accessor for direct copying
+		inline const Real* ptr() const
+		{
+			return &x;
+		}
+
+        /** Assigns the value of the other vector.
+            @param
+                rkVector The other vector
+        */
+        inline Vector2& operator = ( const Vector2& rkVector )
+        {
+            x = rkVector.x;
+            y = rkVector.y;
+
+            return *this;
+        }
+
+		inline Vector2& operator = ( const Real fScalar)
+		{
+			x = fScalar;
+			y = fScalar;
+
+			return *this;
+		}
+
+        inline bool operator == ( const Vector2& rkVector ) const
+        {
+            return ( x == rkVector.x && y == rkVector.y );
+        }
+
+        inline bool operator != ( const Vector2& rkVector ) const
+        {
+            return ( x != rkVector.x || y != rkVector.y  );
+        }
+
+        // arithmetic operations
+        inline Vector2 operator + ( const Vector2& rkVector ) const
+        {
+            return Vector2(
+                x + rkVector.x,
+                y + rkVector.y);
+        }
+
+        inline Vector2 operator - ( const Vector2& rkVector ) const
+        {
+            return Vector2(
+                x - rkVector.x,
+                y - rkVector.y);
+        }
+
+        inline Vector2 operator * ( const Real fScalar ) const
+        {
+            return Vector2(
+                x * fScalar,
+                y * fScalar);
+        }
+
+        inline Vector2 operator * ( const Vector2& rhs) const
+        {
+            return Vector2(
+                x * rhs.x,
+                y * rhs.y);
+        }
+
+        inline Vector2 operator / ( const Real fScalar ) const
+        {
+            assert( fScalar != 0.0 );
+
+            Real fInv = 1.0f / fScalar;
+
+            return Vector2(
+                x * fInv,
+                y * fInv);
+        }
+
+        inline Vector2 operator / ( const Vector2& rhs) const
+        {
+            return Vector2(
+                x / rhs.x,
+                y / rhs.y);
+        }
+
+        inline const Vector2& operator + () const
+        {
+            return *this;
+        }
+
+        inline Vector2 operator - () const
+        {
+            return Vector2(-x, -y);
+        }
+
+        // overloaded operators to help Vector2
+        inline friend Vector2 operator * ( const Real fScalar, const Vector2& rkVector )
+        {
+            return Vector2(
+                fScalar * rkVector.x,
+                fScalar * rkVector.y);
+        }
+
+        inline friend Vector2 operator / ( const Real fScalar, const Vector2& rkVector )
+        {
+            return Vector2(
+                fScalar / rkVector.x,
+                fScalar / rkVector.y);
+        }
+
+        inline friend Vector2 operator + (const Vector2& lhs, const Real rhs)
+        {
+            return Vector2(
+                lhs.x + rhs,
+                lhs.y + rhs);
+        }
+
+        inline friend Vector2 operator + (const Real lhs, const Vector2& rhs)
+        {
+            return Vector2(
+                lhs + rhs.x,
+                lhs + rhs.y);
+        }
+
+        inline friend Vector2 operator - (const Vector2& lhs, const Real rhs)
+        {
+            return Vector2(
+                lhs.x - rhs,
+                lhs.y - rhs);
+        }
+
+        inline friend Vector2 operator - (const Real lhs, const Vector2& rhs)
+        {
+            return Vector2(
+                lhs - rhs.x,
+                lhs - rhs.y);
+        }
+
+        // arithmetic updates
+        inline Vector2& operator += ( const Vector2& rkVector )
+        {
+            x += rkVector.x;
+            y += rkVector.y;
+
+            return *this;
+        }
+
+        inline Vector2& operator += ( const Real fScaler )
+        {
+            x += fScaler;
+            y += fScaler;
+
+            return *this;
+        }
+
+        inline Vector2& operator -= ( const Vector2& rkVector )
+        {
+            x -= rkVector.x;
+            y -= rkVector.y;
+
+            return *this;
+        }
+
+        inline Vector2& operator -= ( const Real fScaler )
+        {
+            x -= fScaler;
+            y -= fScaler;
+
+            return *this;
+        }
+
+        inline Vector2& operator *= ( const Real fScalar )
+        {
+            x *= fScalar;
+            y *= fScalar;
+
+            return *this;
+        }
+
+        inline Vector2& operator *= ( const Vector2& rkVector )
+        {
+            x *= rkVector.x;
+            y *= rkVector.y;
+
+            return *this;
+        }
+
+        inline Vector2& operator /= ( const Real fScalar )
+        {
+            assert( fScalar != 0.0 );
+
+            Real fInv = 1.0f / fScalar;
+
+            x *= fInv;
+            y *= fInv;
+
+            return *this;
+        }
+
+        inline Vector2& operator /= ( const Vector2& rkVector )
+        {
+            x /= rkVector.x;
+            y /= rkVector.y;
+
+            return *this;
+        }
+
+        /** Returns the length (magnitude) of the vector.
+            @warning
+                This operation requires a square root and is expensive in
+                terms of CPU operations. If you don't need to know the exact
+                length (e.g. for just comparing lengths) use squaredLength()
+                instead.
+        */
+        inline Real length () const
+        {
+            return Math::Sqrt( x * x + y * y );
+        }
+
+        /** Returns the square of the length(magnitude) of the vector.
+            @remarks
+                This  method is for efficiency - calculating the actual
+                length of a vector requires a square root, which is expensive
+                in terms of the operations required. This method returns the
+                square of the length of the vector, i.e. the same as the
+                length but before the square root is taken. Use this if you
+                want to find the longest / shortest vector without incurring
+                the square root.
+        */
+        inline Real squaredLength () const
+        {
+            return x * x + y * y;
+        }
+
+        /** Returns the distance to another vector.
+            @warning
+                This operation requires a square root and is expensive in
+                terms of CPU operations. If you don't need to know the exact
+                distance (e.g. for just comparing distances) use squaredDistance()
+                instead.
+        */
+        inline Real distance(const Vector2& rhs) const
+        {
+            return (*this - rhs).length();
+        }
+
+        /** Returns the square of the distance to another vector.
+            @remarks
+                This method is for efficiency - calculating the actual
+                distance to another vector requires a square root, which is
+                expensive in terms of the operations required. This method
+                returns the square of the distance to another vector, i.e.
+                the same as the distance but before the square root is taken.
+                Use this if you want to find the longest / shortest distance
+                without incurring the square root.
+        */
+        inline Real squaredDistance(const Vector2& rhs) const
+        {
+            return (*this - rhs).squaredLength();
+        }
+
+        /** Calculates the dot (scalar) product of this vector with another.
+            @remarks
+                The dot product can be used to calculate the angle between 2
+                vectors. If both are unit vectors, the dot product is the
+                cosine of the angle; otherwise the dot product must be
+                divided by the product of the lengths of both vectors to get
+                the cosine of the angle. This result can further be used to
+                calculate the distance of a point from a plane.
+            @param
+                vec Vector with which to calculate the dot product (together
+                with this one).
+            @return
+                A float representing the dot product value.
+        */
+        inline Real dotProduct(const Vector2& vec) const
+        {
+            return x * vec.x + y * vec.y;
+        }
+
+        /** Normalises the vector.
+            @remarks
+                This method normalises the vector such that it's
+                length / magnitude is 1. The result is called a unit vector.
+            @note
+                This function will not crash for zero-sized vectors, but there
+                will be no changes made to their components.
+            @return The previous length of the vector.
+        */
+
+        inline Real normalise()
+        {
+            Real fLength = Math::Sqrt( x * x + y * y);
+
+            // Will also work for zero-sized vectors, but will change nothing
+			// We're not using epsilons because we don't need to.
+            // Read http://www.ogre3d.org/forums/viewtopic.php?f=4&t=61259
+            if ( fLength > Real(0.0f) )
+            {
+                Real fInvLength = 1.0f / fLength;
+                x *= fInvLength;
+                y *= fInvLength;
+            }
+
+            return fLength;
+        }
+
+        /** Returns a vector at a point half way between this and the passed
+            in vector.
+        */
+        inline Vector2 midPoint( const Vector2& vec ) const
+        {
+            return Vector2(
+                ( x + vec.x ) * 0.5f,
+                ( y + vec.y ) * 0.5f );
+        }
+
+        /** Returns true if the vector's scalar components are all greater
+            that the ones of the vector it is compared against.
+        */
+        inline bool operator < ( const Vector2& rhs ) const
+        {
+            if( x < rhs.x && y < rhs.y )
+                return true;
+            return false;
+        }
+
+        /** Returns true if the vector's scalar components are all smaller
+            that the ones of the vector it is compared against.
+        */
+        inline bool operator > ( const Vector2& rhs ) const
+        {
+            if( x > rhs.x && y > rhs.y )
+                return true;
+            return false;
+        }
+
+        /** Sets this vector's components to the minimum of its own and the
+            ones of the passed in vector.
+            @remarks
+                'Minimum' in this case means the combination of the lowest
+                value of x, y and z from both vectors. Lowest is taken just
+                numerically, not magnitude, so -1 < 0.
+        */
+        inline void makeFloor( const Vector2& cmp )
+        {
+            if( cmp.x < x ) x = cmp.x;
+            if( cmp.y < y ) y = cmp.y;
+        }
+
+        /** Sets this vector's components to the maximum of its own and the
+            ones of the passed in vector.
+            @remarks
+                'Maximum' in this case means the combination of the highest
+                value of x, y and z from both vectors. Highest is taken just
+                numerically, not magnitude, so 1 > -3.
+        */
+        inline void makeCeil( const Vector2& cmp )
+        {
+            if( cmp.x > x ) x = cmp.x;
+            if( cmp.y > y ) y = cmp.y;
+        }
+
+        /** Generates a vector perpendicular to this vector (eg an 'up' vector).
+            @remarks
+                This method will return a vector which is perpendicular to this
+                vector. There are an infinite number of possibilities but this
+                method will guarantee to generate one of them. If you need more
+                control you should use the Quaternion class.
+        */
+        inline Vector2 perpendicular(void) const
+        {
+            return Vector2 (-y, x);
+        }
+
+        /** Calculates the 2 dimensional cross-product of 2 vectors, which results
+			in a single floating point value which is 2 times the area of the triangle.
+        */
+        inline Real crossProduct( const Vector2& rkVector ) const
+        {
+            return x * rkVector.y - y * rkVector.x;
+        }
+
+        /** Generates a new random vector which deviates from this vector by a
+            given angle in a random direction.
+            @remarks
+                This method assumes that the random number generator has already
+                been seeded appropriately.
+            @param angle
+                The angle at which to deviate in radians
+            @return
+                A random vector which deviates from this vector by angle. This
+                vector will not be normalised, normalise it if you wish
+                afterwards.
+        */
+        inline Vector2 randomDeviant(Radian angle) const
+        {
+            angle *= Math::RangeRandom(-1, 1);
+            Real cosa = Math::Cos(angle);
+            Real sina = Math::Sin(angle);
+            return Vector2(cosa * x - sina * y,
+                           sina * x + cosa * y);
+        }
+
+        /** Returns true if this vector is zero length. */
+        inline bool isZeroLength(void) const
+        {
+            Real sqlen = (x * x) + (y * y);
+            return (sqlen < (1e-06 * 1e-06));
+
+        }
+
+        /** As normalise, except that this vector is unaffected and the
+            normalised vector is returned as a copy. */
+        inline Vector2 normalisedCopy(void) const
+        {
+            Vector2 ret = *this;
+            ret.normalise();
+            return ret;
+        }
+
+        /** Calculates a reflection vector to the plane with the given normal .
+        @remarks NB assumes 'this' is pointing AWAY FROM the plane, invert if it is not.
+        */
+        inline Vector2 reflect(const Vector2& normal) const
+        {
+            return Vector2( *this - ( 2 * this->dotProduct(normal) * normal ) );
+        }
+
+		/// Check whether this vector contains valid values
+		inline bool isNaN() const
+		{
+			return Math::isNaN(x) || Math::isNaN(y);
+		}
+
+		/**	 Gets the angle between 2 vectors.
+		@remarks
+			Vectors do not have to be unit-length but must represent directions.
+		*/
+		inline Ogre::Radian angleBetween(const Ogre::Vector2& other) const
+		{		
+			Ogre::Real lenProduct = length() * other.length();
+			// Divide by zero check
+			if(lenProduct < 1e-6f)
+				lenProduct = 1e-6f;
+		
+			Ogre::Real f = dotProduct(other) / lenProduct;
+	
+			f = Ogre::Math::Clamp(f, (Ogre::Real)-1.0, (Ogre::Real)1.0);
+			return Ogre::Math::ACos(f);
+		}
+
+		/**	 Gets the oriented angle between 2 vectors.
+		@remarks
+			Vectors do not have to be unit-length but must represent directions.
+			The angle is comprised between 0 and 2 PI.
+		*/
+		inline Ogre::Radian angleTo(const Ogre::Vector2& other) const
+		{
+			Ogre::Radian angle = angleBetween(other);
+		
+			if (crossProduct(other)<0)			
+				angle = (Ogre::Radian)Ogre::Math::TWO_PI - angle;		
+
+			return angle;
+		}
+
+        // special points
+        static const Vector2 ZERO;
+        static const Vector2 UNIT_X;
+        static const Vector2 UNIT_Y;
+        static const Vector2 NEGATIVE_UNIT_X;
+        static const Vector2 NEGATIVE_UNIT_Y;
+        static const Vector2 UNIT_SCALE;
+
+        /** Function for writing to a stream.
+        */
+        inline _OgreExport friend std::ostream& operator <<
+            ( std::ostream& o, const Vector2& v )
+        {
+            o << "Vector2(" << v.x << ", " << v.y <<  ")";
+            return o;
+        }
+    };
+	/** @} */
+	/** @} */
+
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreVector3.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreVector3.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreVector3.h	(revision 148)
@@ -0,0 +1,822 @@
+/*
+-----------------------------------------------------------------------------
+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 __Vector3_H__
+#define __Vector3_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreMath.h"
+#include "OgreQuaternion.h"
+
+namespace Ogre
+{
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Math
+	*  @{
+	*/
+	/** Standard 3-dimensional vector.
+        @remarks
+            A direction in 3D space represented as distances along the 3
+            orthogonal axes (x, y, z). Note that positions, directions and
+            scaling factors can be represented by a vector, depending on how
+            you interpret the values.
+    */
+    class _OgreExport Vector3
+    {
+    public:
+		Real x, y, z;
+
+    public:
+        /** Default constructor.
+            @note
+                It does <b>NOT</b> initialize the vector for efficiency.
+        */
+        inline Vector3()
+        {
+        }
+
+        inline Vector3( const Real fX, const Real fY, const Real fZ )
+            : x( fX ), y( fY ), z( fZ )
+        {
+        }
+
+        inline explicit Vector3( const Real afCoordinate[3] )
+            : x( afCoordinate[0] ),
+              y( afCoordinate[1] ),
+              z( afCoordinate[2] )
+        {
+        }
+
+        inline explicit Vector3( const int afCoordinate[3] )
+        {
+            x = (Real)afCoordinate[0];
+            y = (Real)afCoordinate[1];
+            z = (Real)afCoordinate[2];
+        }
+
+        inline explicit Vector3( Real* const r )
+            : x( r[0] ), y( r[1] ), z( r[2] )
+        {
+        }
+
+        inline explicit Vector3( const Real scaler )
+            : x( scaler )
+            , y( scaler )
+            , z( scaler )
+        {
+        }
+
+
+		/** Exchange the contents of this vector with another. 
+		*/
+		inline void swap(Vector3& other)
+		{
+			std::swap(x, other.x);
+			std::swap(y, other.y);
+			std::swap(z, other.z);
+		}
+
+		inline Real operator [] ( const size_t i ) const
+        {
+            assert( i < 3 );
+
+            return *(&x+i);
+        }
+
+		inline Real& operator [] ( const size_t i )
+        {
+            assert( i < 3 );
+
+            return *(&x+i);
+        }
+		/// Pointer accessor for direct copying
+		inline Real* ptr()
+		{
+			return &x;
+		}
+		/// Pointer accessor for direct copying
+		inline const Real* ptr() const
+		{
+			return &x;
+		}
+
+        /** Assigns the value of the other vector.
+            @param
+                rkVector The other vector
+        */
+        inline Vector3& operator = ( const Vector3& rkVector )
+        {
+            x = rkVector.x;
+            y = rkVector.y;
+            z = rkVector.z;
+
+            return *this;
+        }
+
+        inline Vector3& operator = ( const Real fScaler )
+        {
+            x = fScaler;
+            y = fScaler;
+            z = fScaler;
+
+            return *this;
+        }
+
+        inline bool operator == ( const Vector3& rkVector ) const
+        {
+            return ( x == rkVector.x && y == rkVector.y && z == rkVector.z );
+        }
+
+        inline bool operator != ( const Vector3& rkVector ) const
+        {
+            return ( x != rkVector.x || y != rkVector.y || z != rkVector.z );
+        }
+
+        // arithmetic operations
+        inline Vector3 operator + ( const Vector3& rkVector ) const
+        {
+            return Vector3(
+                x + rkVector.x,
+                y + rkVector.y,
+                z + rkVector.z);
+        }
+
+        inline Vector3 operator - ( const Vector3& rkVector ) const
+        {
+            return Vector3(
+                x - rkVector.x,
+                y - rkVector.y,
+                z - rkVector.z);
+        }
+
+        inline Vector3 operator * ( const Real fScalar ) const
+        {
+            return Vector3(
+                x * fScalar,
+                y * fScalar,
+                z * fScalar);
+        }
+
+        inline Vector3 operator * ( const Vector3& rhs) const
+        {
+            return Vector3(
+                x * rhs.x,
+                y * rhs.y,
+                z * rhs.z);
+        }
+
+        inline Vector3 operator / ( const Real fScalar ) const
+        {
+            assert( fScalar != 0.0 );
+
+            Real fInv = 1.0f / fScalar;
+
+            return Vector3(
+                x * fInv,
+                y * fInv,
+                z * fInv);
+        }
+
+        inline Vector3 operator / ( const Vector3& rhs) const
+        {
+            return Vector3(
+                x / rhs.x,
+                y / rhs.y,
+                z / rhs.z);
+        }
+
+        inline const Vector3& operator + () const
+        {
+            return *this;
+        }
+
+        inline Vector3 operator - () const
+        {
+            return Vector3(-x, -y, -z);
+        }
+
+        // overloaded operators to help Vector3
+        inline friend Vector3 operator * ( const Real fScalar, const Vector3& rkVector )
+        {
+            return Vector3(
+                fScalar * rkVector.x,
+                fScalar * rkVector.y,
+                fScalar * rkVector.z);
+        }
+
+        inline friend Vector3 operator / ( const Real fScalar, const Vector3& rkVector )
+        {
+            return Vector3(
+                fScalar / rkVector.x,
+                fScalar / rkVector.y,
+                fScalar / rkVector.z);
+        }
+
+        inline friend Vector3 operator + (const Vector3& lhs, const Real rhs)
+        {
+            return Vector3(
+                lhs.x + rhs,
+                lhs.y + rhs,
+                lhs.z + rhs);
+        }
+
+        inline friend Vector3 operator + (const Real lhs, const Vector3& rhs)
+        {
+            return Vector3(
+                lhs + rhs.x,
+                lhs + rhs.y,
+                lhs + rhs.z);
+        }
+
+        inline friend Vector3 operator - (const Vector3& lhs, const Real rhs)
+        {
+            return Vector3(
+                lhs.x - rhs,
+                lhs.y - rhs,
+                lhs.z - rhs);
+        }
+
+        inline friend Vector3 operator - (const Real lhs, const Vector3& rhs)
+        {
+            return Vector3(
+                lhs - rhs.x,
+                lhs - rhs.y,
+                lhs - rhs.z);
+        }
+
+        // arithmetic updates
+        inline Vector3& operator += ( const Vector3& rkVector )
+        {
+            x += rkVector.x;
+            y += rkVector.y;
+            z += rkVector.z;
+
+            return *this;
+        }
+
+        inline Vector3& operator += ( const Real fScalar )
+        {
+            x += fScalar;
+            y += fScalar;
+            z += fScalar;
+            return *this;
+        }
+
+        inline Vector3& operator -= ( const Vector3& rkVector )
+        {
+            x -= rkVector.x;
+            y -= rkVector.y;
+            z -= rkVector.z;
+
+            return *this;
+        }
+
+        inline Vector3& operator -= ( const Real fScalar )
+        {
+            x -= fScalar;
+            y -= fScalar;
+            z -= fScalar;
+            return *this;
+        }
+
+        inline Vector3& operator *= ( const Real fScalar )
+        {
+            x *= fScalar;
+            y *= fScalar;
+            z *= fScalar;
+            return *this;
+        }
+
+        inline Vector3& operator *= ( const Vector3& rkVector )
+        {
+            x *= rkVector.x;
+            y *= rkVector.y;
+            z *= rkVector.z;
+
+            return *this;
+        }
+
+        inline Vector3& operator /= ( const Real fScalar )
+        {
+            assert( fScalar != 0.0 );
+
+            Real fInv = 1.0f / fScalar;
+
+            x *= fInv;
+            y *= fInv;
+            z *= fInv;
+
+            return *this;
+        }
+
+        inline Vector3& operator /= ( const Vector3& rkVector )
+        {
+            x /= rkVector.x;
+            y /= rkVector.y;
+            z /= rkVector.z;
+
+            return *this;
+        }
+
+
+        /** Returns the length (magnitude) of the vector.
+            @warning
+                This operation requires a square root and is expensive in
+                terms of CPU operations. If you don't need to know the exact
+                length (e.g. for just comparing lengths) use squaredLength()
+                instead.
+        */
+        inline Real length () const
+        {
+            return Math::Sqrt( x * x + y * y + z * z );
+        }
+
+        /** Returns the square of the length(magnitude) of the vector.
+            @remarks
+                This  method is for efficiency - calculating the actual
+                length of a vector requires a square root, which is expensive
+                in terms of the operations required. This method returns the
+                square of the length of the vector, i.e. the same as the
+                length but before the square root is taken. Use this if you
+                want to find the longest / shortest vector without incurring
+                the square root.
+        */
+        inline Real squaredLength () const
+        {
+            return x * x + y * y + z * z;
+        }
+
+        /** Returns the distance to another vector.
+            @warning
+                This operation requires a square root and is expensive in
+                terms of CPU operations. If you don't need to know the exact
+                distance (e.g. for just comparing distances) use squaredDistance()
+                instead.
+        */
+        inline Real distance(const Vector3& rhs) const
+        {
+            return (*this - rhs).length();
+        }
+
+        /** Returns the square of the distance to another vector.
+            @remarks
+                This method is for efficiency - calculating the actual
+                distance to another vector requires a square root, which is
+                expensive in terms of the operations required. This method
+                returns the square of the distance to another vector, i.e.
+                the same as the distance but before the square root is taken.
+                Use this if you want to find the longest / shortest distance
+                without incurring the square root.
+        */
+        inline Real squaredDistance(const Vector3& rhs) const
+        {
+            return (*this - rhs).squaredLength();
+        }
+
+        /** Calculates the dot (scalar) product of this vector with another.
+            @remarks
+                The dot product can be used to calculate the angle between 2
+                vectors. If both are unit vectors, the dot product is the
+                cosine of the angle; otherwise the dot product must be
+                divided by the product of the lengths of both vectors to get
+                the cosine of the angle. This result can further be used to
+                calculate the distance of a point from a plane.
+            @param
+                vec Vector with which to calculate the dot product (together
+                with this one).
+            @return
+                A float representing the dot product value.
+        */
+        inline Real dotProduct(const Vector3& vec) const
+        {
+            return x * vec.x + y * vec.y + z * vec.z;
+        }
+
+        /** Calculates the absolute dot (scalar) product of this vector with another.
+            @remarks
+                This function work similar dotProduct, except it use absolute value
+                of each component of the vector to computing.
+            @param
+                vec Vector with which to calculate the absolute dot product (together
+                with this one).
+            @return
+                A Real representing the absolute dot product value.
+        */
+        inline Real absDotProduct(const Vector3& vec) const
+        {
+            return Math::Abs(x * vec.x) + Math::Abs(y * vec.y) + Math::Abs(z * vec.z);
+        }
+
+        /** Normalises the vector.
+            @remarks
+                This method normalises the vector such that it's
+                length / magnitude is 1. The result is called a unit vector.
+            @note
+                This function will not crash for zero-sized vectors, but there
+                will be no changes made to their components.
+            @return The previous length of the vector.
+        */
+        inline Real normalise()
+        {
+            Real fLength = Math::Sqrt( x * x + y * y + z * z );
+
+            // Will also work for zero-sized vectors, but will change nothing
+			// We're not using epsilons because we don't need to.
+            // Read http://www.ogre3d.org/forums/viewtopic.php?f=4&t=61259
+            if ( fLength > Real(0.0f) )
+            {
+                Real fInvLength = 1.0f / fLength;
+                x *= fInvLength;
+                y *= fInvLength;
+                z *= fInvLength;
+            }
+
+            return fLength;
+        }
+
+        /** Calculates the cross-product of 2 vectors, i.e. the vector that
+            lies perpendicular to them both.
+            @remarks
+                The cross-product is normally used to calculate the normal
+                vector of a plane, by calculating the cross-product of 2
+                non-equivalent vectors which lie on the plane (e.g. 2 edges
+                of a triangle).
+            @param rkVector
+                Vector which, together with this one, will be used to
+                calculate the cross-product.
+            @return
+                A vector which is the result of the cross-product. This
+                vector will <b>NOT</b> be normalised, to maximise efficiency
+                - call Vector3::normalise on the result if you wish this to
+                be done. As for which side the resultant vector will be on, the
+                returned vector will be on the side from which the arc from 'this'
+                to rkVector is anticlockwise, e.g. UNIT_Y.crossProduct(UNIT_Z)
+                = UNIT_X, whilst UNIT_Z.crossProduct(UNIT_Y) = -UNIT_X.
+				This is because OGRE uses a right-handed coordinate system.
+            @par
+                For a clearer explanation, look a the left and the bottom edges
+                of your monitor's screen. Assume that the first vector is the
+                left edge and the second vector is the bottom edge, both of
+                them starting from the lower-left corner of the screen. The
+                resulting vector is going to be perpendicular to both of them
+                and will go <i>inside</i> the screen, towards the cathode tube
+                (assuming you're using a CRT monitor, of course).
+        */
+        inline Vector3 crossProduct( const Vector3& rkVector ) const
+        {
+            return Vector3(
+                y * rkVector.z - z * rkVector.y,
+                z * rkVector.x - x * rkVector.z,
+                x * rkVector.y - y * rkVector.x);
+        }
+
+        /** Returns a vector at a point half way between this and the passed
+            in vector.
+        */
+        inline Vector3 midPoint( const Vector3& vec ) const
+        {
+            return Vector3(
+                ( x + vec.x ) * 0.5f,
+                ( y + vec.y ) * 0.5f,
+                ( z + vec.z ) * 0.5f );
+        }
+
+        /** Returns true if the vector's scalar components are all greater
+            that the ones of the vector it is compared against.
+        */
+        inline bool operator < ( const Vector3& rhs ) const
+        {
+            if( x < rhs.x && y < rhs.y && z < rhs.z )
+                return true;
+            return false;
+        }
+
+        /** Returns true if the vector's scalar components are all smaller
+            that the ones of the vector it is compared against.
+        */
+        inline bool operator > ( const Vector3& rhs ) const
+        {
+            if( x > rhs.x && y > rhs.y && z > rhs.z )
+                return true;
+            return false;
+        }
+
+        /** Sets this vector's components to the minimum of its own and the
+            ones of the passed in vector.
+            @remarks
+                'Minimum' in this case means the combination of the lowest
+                value of x, y and z from both vectors. Lowest is taken just
+                numerically, not magnitude, so -1 < 0.
+        */
+        inline void makeFloor( const Vector3& cmp )
+        {
+            if( cmp.x < x ) x = cmp.x;
+            if( cmp.y < y ) y = cmp.y;
+            if( cmp.z < z ) z = cmp.z;
+        }
+
+        /** Sets this vector's components to the maximum of its own and the
+            ones of the passed in vector.
+            @remarks
+                'Maximum' in this case means the combination of the highest
+                value of x, y and z from both vectors. Highest is taken just
+                numerically, not magnitude, so 1 > -3.
+        */
+        inline void makeCeil( const Vector3& cmp )
+        {
+            if( cmp.x > x ) x = cmp.x;
+            if( cmp.y > y ) y = cmp.y;
+            if( cmp.z > z ) z = cmp.z;
+        }
+
+        /** Generates a vector perpendicular to this vector (eg an 'up' vector).
+            @remarks
+                This method will return a vector which is perpendicular to this
+                vector. There are an infinite number of possibilities but this
+                method will guarantee to generate one of them. If you need more
+                control you should use the Quaternion class.
+        */
+        inline Vector3 perpendicular(void) const
+        {
+            static const Real fSquareZero = (Real)(1e-06 * 1e-06);
+
+            Vector3 perp = this->crossProduct( Vector3::UNIT_X );
+
+            // Check length
+            if( perp.squaredLength() < fSquareZero )
+            {
+                /* This vector is the Y axis multiplied by a scalar, so we have
+                   to use another axis.
+                */
+                perp = this->crossProduct( Vector3::UNIT_Y );
+            }
+			perp.normalise();
+
+            return perp;
+        }
+        /** Generates a new random vector which deviates from this vector by a
+            given angle in a random direction.
+            @remarks
+                This method assumes that the random number generator has already
+                been seeded appropriately.
+            @param
+                angle The angle at which to deviate
+            @param
+                up Any vector perpendicular to this one (which could generated
+                by cross-product of this vector and any other non-colinear
+                vector). If you choose not to provide this the function will
+                derive one on it's own, however if you provide one yourself the
+                function will be faster (this allows you to reuse up vectors if
+                you call this method more than once)
+            @return
+                A random vector which deviates from this vector by angle. This
+                vector will not be normalised, normalise it if you wish
+                afterwards.
+        */
+        inline Vector3 randomDeviant(
+            const Radian& angle,
+            const Vector3& up = Vector3::ZERO ) const
+        {
+            Vector3 newUp;
+
+            if (up == Vector3::ZERO)
+            {
+                // Generate an up vector
+                newUp = this->perpendicular();
+            }
+            else
+            {
+                newUp = up;
+            }
+
+            // Rotate up vector by random amount around this
+            Quaternion q;
+            q.FromAngleAxis( Radian(Math::UnitRandom() * Math::TWO_PI), *this );
+            newUp = q * newUp;
+
+            // Finally rotate this by given angle around randomised up
+            q.FromAngleAxis( angle, newUp );
+            return q * (*this);
+        }
+
+		/** Gets the angle between 2 vectors.
+		@remarks
+			Vectors do not have to be unit-length but must represent directions.
+		*/
+		inline Radian angleBetween(const Vector3& dest) const
+		{
+			Real lenProduct = length() * dest.length();
+
+			// Divide by zero check
+			if(lenProduct < 1e-6f)
+				lenProduct = 1e-6f;
+
+			Real f = dotProduct(dest) / lenProduct;
+
+			f = Math::Clamp(f, (Real)-1.0, (Real)1.0);
+			return Math::ACos(f);
+
+		}
+        /** Gets the shortest arc quaternion to rotate this vector to the destination
+            vector.
+        @remarks
+            If you call this with a dest vector that is close to the inverse
+            of this vector, we will rotate 180 degrees around the 'fallbackAxis'
+			(if specified, or a generated axis if not) since in this case
+			ANY axis of rotation is valid.
+        */
+        Quaternion getRotationTo(const Vector3& dest,
+			const Vector3& fallbackAxis = Vector3::ZERO) const
+        {
+            // Based on Stan Melax's article in Game Programming Gems
+            Quaternion q;
+            // Copy, since cannot modify local
+            Vector3 v0 = *this;
+            Vector3 v1 = dest;
+            v0.normalise();
+            v1.normalise();
+
+            Real d = v0.dotProduct(v1);
+            // If dot == 1, vectors are the same
+            if (d >= 1.0f)
+            {
+                return Quaternion::IDENTITY;
+            }
+			if (d < (1e-6f - 1.0f))
+			{
+				if (fallbackAxis != Vector3::ZERO)
+				{
+					// rotate 180 degrees about the fallback axis
+					q.FromAngleAxis(Radian(Math::PI), fallbackAxis);
+				}
+				else
+				{
+					// Generate an axis
+					Vector3 axis = Vector3::UNIT_X.crossProduct(*this);
+					if (axis.isZeroLength()) // pick another if colinear
+						axis = Vector3::UNIT_Y.crossProduct(*this);
+					axis.normalise();
+					q.FromAngleAxis(Radian(Math::PI), axis);
+				}
+			}
+			else
+			{
+                Real s = Math::Sqrt( (1+d)*2 );
+	            Real invs = 1 / s;
+
+				Vector3 c = v0.crossProduct(v1);
+
+    	        q.x = c.x * invs;
+        	    q.y = c.y * invs;
+            	q.z = c.z * invs;
+            	q.w = s * 0.5f;
+				q.normalise();
+			}
+            return q;
+        }
+
+        /** Returns true if this vector is zero length. */
+        inline bool isZeroLength(void) const
+        {
+            Real sqlen = (x * x) + (y * y) + (z * z);
+            return (sqlen < (1e-06 * 1e-06));
+
+        }
+
+        /** As normalise, except that this vector is unaffected and the
+            normalised vector is returned as a copy. */
+        inline Vector3 normalisedCopy(void) const
+        {
+            Vector3 ret = *this;
+            ret.normalise();
+            return ret;
+        }
+
+        /** Calculates a reflection vector to the plane with the given normal .
+        @remarks NB assumes 'this' is pointing AWAY FROM the plane, invert if it is not.
+        */
+        inline Vector3 reflect(const Vector3& normal) const
+        {
+            return Vector3( *this - ( 2 * this->dotProduct(normal) * normal ) );
+        }
+
+		/** Returns whether this vector is within a positional tolerance
+			of another vector.
+		@param rhs The vector to compare with
+		@param tolerance The amount that each element of the vector may vary by
+			and still be considered equal
+		*/
+		inline bool positionEquals(const Vector3& rhs, Real tolerance = 1e-03) const
+		{
+			return Math::RealEqual(x, rhs.x, tolerance) &&
+				Math::RealEqual(y, rhs.y, tolerance) &&
+				Math::RealEqual(z, rhs.z, tolerance);
+
+		}
+
+		/** Returns whether this vector is within a positional tolerance
+			of another vector, also take scale of the vectors into account.
+		@param rhs The vector to compare with
+		@param tolerance The amount (related to the scale of vectors) that distance
+            of the vector may vary by and still be considered close
+		*/
+		inline bool positionCloses(const Vector3& rhs, Real tolerance = 1e-03f) const
+		{
+			return squaredDistance(rhs) <=
+                (squaredLength() + rhs.squaredLength()) * tolerance;
+		}
+
+		/** Returns whether this vector is within a directional tolerance
+			of another vector.
+		@param rhs The vector to compare with
+		@param tolerance The maximum angle by which the vectors may vary and
+			still be considered equal
+		@note Both vectors should be normalised.
+		*/
+		inline bool directionEquals(const Vector3& rhs,
+			const Radian& tolerance) const
+		{
+			Real dot = dotProduct(rhs);
+			Radian angle = Math::ACos(dot);
+
+			return Math::Abs(angle.valueRadians()) <= tolerance.valueRadians();
+
+		}
+
+		/// Check whether this vector contains valid values
+		inline bool isNaN() const
+		{
+			return Math::isNaN(x) || Math::isNaN(y) || Math::isNaN(z);
+		}
+
+		/// Extract the primary (dominant) axis from this direction vector
+		inline Vector3 primaryAxis() const
+		{
+			Real absx = Math::Abs(x);
+			Real absy = Math::Abs(y);
+			Real absz = Math::Abs(z);
+			if (absx > absy)
+				if (absx > absz)
+					return x > 0 ? Vector3::UNIT_X : Vector3::NEGATIVE_UNIT_X;
+				else
+					return z > 0 ? Vector3::UNIT_Z : Vector3::NEGATIVE_UNIT_Z;
+			else // absx <= absy
+				if (absy > absz)
+					return y > 0 ? Vector3::UNIT_Y : Vector3::NEGATIVE_UNIT_Y;
+				else
+					return z > 0 ? Vector3::UNIT_Z : Vector3::NEGATIVE_UNIT_Z;
+
+
+		}
+
+		// special points
+        static const Vector3 ZERO;
+        static const Vector3 UNIT_X;
+        static const Vector3 UNIT_Y;
+        static const Vector3 UNIT_Z;
+        static const Vector3 NEGATIVE_UNIT_X;
+        static const Vector3 NEGATIVE_UNIT_Y;
+        static const Vector3 NEGATIVE_UNIT_Z;
+        static const Vector3 UNIT_SCALE;
+
+        /** Function for writing to a stream.
+        */
+        inline _OgreExport friend std::ostream& operator <<
+            ( std::ostream& o, const Vector3& v )
+        {
+            o << "Vector3(" << v.x << ", " << v.y << ", " << v.z << ")";
+            return o;
+        }
+    };
+	/** @} */
+	/** @} */
+
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreVector4.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreVector4.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreVector4.h	(revision 148)
@@ -0,0 +1,418 @@
+/*
+-----------------------------------------------------------------------------
+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 __Vector4_H__
+#define __Vector4_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreVector3.h"
+
+namespace Ogre
+{
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Math
+	*  @{
+	*/
+	/** 4-dimensional homogeneous vector.
+    */
+    class _OgreExport Vector4
+    {
+    public:
+        Real x, y, z, w;
+
+    public:
+        /** Default constructor.
+            @note
+                It does <b>NOT</b> initialize the vector for efficiency.
+        */
+        inline Vector4()
+        {
+        }
+
+        inline Vector4( const Real fX, const Real fY, const Real fZ, const Real fW )
+            : x( fX ), y( fY ), z( fZ ), w( fW )
+        {
+        }
+
+        inline explicit Vector4( const Real afCoordinate[4] )
+            : x( afCoordinate[0] ),
+              y( afCoordinate[1] ),
+              z( afCoordinate[2] ),
+              w( afCoordinate[3] )
+        {
+        }
+
+        inline explicit Vector4( const int afCoordinate[4] )
+        {
+            x = (Real)afCoordinate[0];
+            y = (Real)afCoordinate[1];
+            z = (Real)afCoordinate[2];
+            w = (Real)afCoordinate[3];
+        }
+
+        inline explicit Vector4( Real* const r )
+            : x( r[0] ), y( r[1] ), z( r[2] ), w( r[3] )
+        {
+        }
+
+        inline explicit Vector4( const Real scaler )
+            : x( scaler )
+            , y( scaler )
+            , z( scaler )
+            , w( scaler )
+        {
+        }
+
+        inline explicit Vector4(const Vector3& rhs)
+            : x(rhs.x), y(rhs.y), z(rhs.z), w(1.0f)
+        {
+        }
+
+		/** Exchange the contents of this vector with another. 
+		*/
+		inline void swap(Vector4& other)
+		{
+			std::swap(x, other.x);
+			std::swap(y, other.y);
+			std::swap(z, other.z);
+			std::swap(w, other.w);
+		}
+	
+		inline Real operator [] ( const size_t i ) const
+        {
+            assert( i < 4 );
+
+            return *(&x+i);
+        }
+
+		inline Real& operator [] ( const size_t i )
+        {
+            assert( i < 4 );
+
+            return *(&x+i);
+        }
+
+		/// Pointer accessor for direct copying
+		inline Real* ptr()
+		{
+			return &x;
+		}
+		/// Pointer accessor for direct copying
+		inline const Real* ptr() const
+		{
+			return &x;
+		}
+
+        /** Assigns the value of the other vector.
+            @param
+                rkVector The other vector
+        */
+        inline Vector4& operator = ( const Vector4& rkVector )
+        {
+            x = rkVector.x;
+            y = rkVector.y;
+            z = rkVector.z;
+            w = rkVector.w;
+
+            return *this;
+        }
+
+		inline Vector4& operator = ( const Real fScalar)
+		{
+			x = fScalar;
+			y = fScalar;
+			z = fScalar;
+			w = fScalar;
+			return *this;
+		}
+
+        inline bool operator == ( const Vector4& rkVector ) const
+        {
+            return ( x == rkVector.x &&
+                y == rkVector.y &&
+                z == rkVector.z &&
+                w == rkVector.w );
+        }
+
+        inline bool operator != ( const Vector4& rkVector ) const
+        {
+            return ( x != rkVector.x ||
+                y != rkVector.y ||
+                z != rkVector.z ||
+                w != rkVector.w );
+        }
+
+        inline Vector4& operator = (const Vector3& rhs)
+        {
+            x = rhs.x;
+            y = rhs.y;
+            z = rhs.z;
+            w = 1.0f;
+            return *this;
+        }
+
+        // arithmetic operations
+        inline Vector4 operator + ( const Vector4& rkVector ) const
+        {
+            return Vector4(
+                x + rkVector.x,
+                y + rkVector.y,
+                z + rkVector.z,
+                w + rkVector.w);
+        }
+
+        inline Vector4 operator - ( const Vector4& rkVector ) const
+        {
+            return Vector4(
+                x - rkVector.x,
+                y - rkVector.y,
+                z - rkVector.z,
+                w - rkVector.w);
+        }
+
+        inline Vector4 operator * ( const Real fScalar ) const
+        {
+            return Vector4(
+                x * fScalar,
+                y * fScalar,
+                z * fScalar,
+                w * fScalar);
+        }
+
+        inline Vector4 operator * ( const Vector4& rhs) const
+        {
+            return Vector4(
+                rhs.x * x,
+                rhs.y * y,
+                rhs.z * z,
+                rhs.w * w);
+        }
+
+        inline Vector4 operator / ( const Real fScalar ) const
+        {
+            assert( fScalar != 0.0 );
+
+            Real fInv = 1.0f / fScalar;
+
+            return Vector4(
+                x * fInv,
+                y * fInv,
+                z * fInv,
+                w * fInv);
+        }
+
+        inline Vector4 operator / ( const Vector4& rhs) const
+        {
+            return Vector4(
+                x / rhs.x,
+                y / rhs.y,
+                z / rhs.z,
+                w / rhs.w);
+        }
+
+        inline const Vector4& operator + () const
+        {
+            return *this;
+        }
+
+        inline Vector4 operator - () const
+        {
+            return Vector4(-x, -y, -z, -w);
+        }
+
+        inline friend Vector4 operator * ( const Real fScalar, const Vector4& rkVector )
+        {
+            return Vector4(
+                fScalar * rkVector.x,
+                fScalar * rkVector.y,
+                fScalar * rkVector.z,
+                fScalar * rkVector.w);
+        }
+
+        inline friend Vector4 operator / ( const Real fScalar, const Vector4& rkVector )
+        {
+            return Vector4(
+                fScalar / rkVector.x,
+                fScalar / rkVector.y,
+                fScalar / rkVector.z,
+                fScalar / rkVector.w);
+        }
+
+        inline friend Vector4 operator + (const Vector4& lhs, const Real rhs)
+        {
+            return Vector4(
+                lhs.x + rhs,
+                lhs.y + rhs,
+                lhs.z + rhs,
+                lhs.w + rhs);
+        }
+
+        inline friend Vector4 operator + (const Real lhs, const Vector4& rhs)
+        {
+            return Vector4(
+                lhs + rhs.x,
+                lhs + rhs.y,
+                lhs + rhs.z,
+                lhs + rhs.w);
+        }
+
+        inline friend Vector4 operator - (const Vector4& lhs, Real rhs)
+        {
+            return Vector4(
+                lhs.x - rhs,
+                lhs.y - rhs,
+                lhs.z - rhs,
+                lhs.w - rhs);
+        }
+
+        inline friend Vector4 operator - (const Real lhs, const Vector4& rhs)
+        {
+            return Vector4(
+                lhs - rhs.x,
+                lhs - rhs.y,
+                lhs - rhs.z,
+                lhs - rhs.w);
+        }
+
+        // arithmetic updates
+        inline Vector4& operator += ( const Vector4& rkVector )
+        {
+            x += rkVector.x;
+            y += rkVector.y;
+            z += rkVector.z;
+            w += rkVector.w;
+
+            return *this;
+        }
+
+        inline Vector4& operator -= ( const Vector4& rkVector )
+        {
+            x -= rkVector.x;
+            y -= rkVector.y;
+            z -= rkVector.z;
+            w -= rkVector.w;
+
+            return *this;
+        }
+
+        inline Vector4& operator *= ( const Real fScalar )
+        {
+            x *= fScalar;
+            y *= fScalar;
+            z *= fScalar;
+            w *= fScalar;
+            return *this;
+        }
+
+        inline Vector4& operator += ( const Real fScalar )
+        {
+            x += fScalar;
+            y += fScalar;
+            z += fScalar;
+            w += fScalar;
+            return *this;
+        }
+
+        inline Vector4& operator -= ( const Real fScalar )
+        {
+            x -= fScalar;
+            y -= fScalar;
+            z -= fScalar;
+            w -= fScalar;
+            return *this;
+        }
+
+        inline Vector4& operator *= ( const Vector4& rkVector )
+        {
+            x *= rkVector.x;
+            y *= rkVector.y;
+            z *= rkVector.z;
+            w *= rkVector.w;
+
+            return *this;
+        }
+
+        inline Vector4& operator /= ( const Real fScalar )
+        {
+            assert( fScalar != 0.0 );
+
+            Real fInv = 1.0f / fScalar;
+
+            x *= fInv;
+            y *= fInv;
+            z *= fInv;
+            w *= fInv;
+
+            return *this;
+        }
+
+        inline Vector4& operator /= ( const Vector4& rkVector )
+        {
+            x /= rkVector.x;
+            y /= rkVector.y;
+            z /= rkVector.z;
+            w /= rkVector.w;
+
+            return *this;
+        }
+
+        /** Calculates the dot (scalar) product of this vector with another.
+            @param
+                vec Vector with which to calculate the dot product (together
+                with this one).
+            @return
+                A float representing the dot product value.
+        */
+        inline Real dotProduct(const Vector4& vec) const
+        {
+            return x * vec.x + y * vec.y + z * vec.z + w * vec.w;
+        }
+		/// Check whether this vector contains valid values
+		inline bool isNaN() const
+		{
+			return Math::isNaN(x) || Math::isNaN(y) || Math::isNaN(z) || Math::isNaN(w);
+		}
+        /** Function for writing to a stream.
+        */
+        inline _OgreExport friend std::ostream& operator <<
+            ( std::ostream& o, const Vector4& v )
+        {
+            o << "Vector4(" << v.x << ", " << v.y << ", " << v.z << ", " << v.w << ")";
+            return o;
+        }
+        // special
+        static const Vector4 ZERO;
+    };
+	/** @} */
+	/** @} */
+
+}
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreVertexBoneAssignment.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreVertexBoneAssignment.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreVertexBoneAssignment.h	(revision 148)
@@ -0,0 +1,63 @@
+/*
+-----------------------------------------------------------------------------
+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 __VertexBoneAssignment_H__
+#define __VertexBoneAssignment_H__
+
+#include "OgrePrerequisites.h"
+
+
+namespace Ogre 
+{
+    
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Animation
+	*  @{
+	*/
+	/** Records the assignment of a single vertex to a single bone with the corresponding weight.
+    @remarks
+        This simple struct simply holds a vertex index, bone index and weight representing the
+        assignment of a vertex to a bone for skeletal animation. There may be many of these
+        per vertex if blended vertex assignments are allowed.
+    */
+    typedef struct VertexBoneAssignment_s
+    {
+        unsigned int vertexIndex;
+        unsigned short boneIndex;
+        Real weight;
+
+    } VertexBoneAssignment;
+
+	/** @} */
+	/** @} */
+
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreVertexIndexData.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreVertexIndexData.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreVertexIndexData.h	(revision 148)
@@ -0,0 +1,326 @@
+/*
+-----------------------------------------------------------------------------
+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 __VertexIndexData_H__
+#define __VertexIndexData_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreHardwareVertexBuffer.h"
+#include "OgreHardwareIndexBuffer.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup RenderSystem
+	*  @{
+	*/
+
+	/// Define a list of usage flags
+	typedef vector<HardwareBuffer::Usage>::type BufferUsageList;
+
+
+	/** Summary class collecting together vertex source information. */
+	class _OgreExport VertexData : public VertexDataAlloc
+	{
+    private:
+        /// Protected copy constructor, to prevent misuse
+        VertexData(const VertexData& rhs); /* do nothing, should not use */
+        /// Protected operator=, to prevent misuse
+        VertexData& operator=(const VertexData& rhs); /* do not use */
+
+		HardwareBufferManagerBase* mMgr;
+    public:
+		/** Constructor.
+		@note 
+			This constructor creates the VertexDeclaration and VertexBufferBinding
+			automatically, and arranges for their deletion afterwards.
+		@param mgr Optional HardwareBufferManager from which to create resources
+		*/
+        VertexData(HardwareBufferManagerBase* mgr = 0);
+		/** Constructor.
+		@note 
+		This constructor receives the VertexDeclaration and VertexBufferBinding
+		from the caller, and as such does not arrange for their deletion afterwards, 
+		the caller remains responsible for that.
+		@param dcl The VertexDeclaration to use
+		@param bind The VertexBufferBinding to use
+		*/
+		VertexData(VertexDeclaration* dcl, VertexBufferBinding* bind);
+        ~VertexData();
+
+		/** Declaration of the vertex to be used in this operation. 
+		@remarks Note that this is created for you on construction.
+		*/
+		VertexDeclaration* vertexDeclaration;
+		/** The vertex buffer bindings to be used. 
+		@remarks Note that this is created for you on construction.
+		*/
+		VertexBufferBinding* vertexBufferBinding;
+		/// Whether this class should delete the declaration and binding
+		bool mDeleteDclBinding;
+		/// The base vertex index to start from
+		size_t vertexStart;
+		/// The number of vertices used in this operation
+		size_t vertexCount;
+
+
+		/// Struct used to hold hardware morph / pose vertex data information
+		struct HardwareAnimationData
+		{
+			unsigned short targetBufferIndex;
+			Real parametric;
+		};
+		typedef vector<HardwareAnimationData>::type HardwareAnimationDataList;
+		/// VertexElements used for hardware morph / pose animation
+		HardwareAnimationDataList hwAnimationDataList;
+		/// Number of hardware animation data items used
+		size_t hwAnimDataItemsUsed;
+		
+		/** Clones this vertex data, potentially including replicating any vertex buffers.
+		@param copyData Whether to create new vertex buffers too or just reference the existing ones
+		@param mgr If supplied, the buffer manager through which copies should be made
+		@remarks The caller is expected to delete the returned pointer when ready
+		*/
+		VertexData* clone(bool copyData = true, HardwareBufferManagerBase* mgr = 0) const;
+
+        /** Modifies the vertex data to be suitable for use for rendering shadow geometry.
+        @remarks
+            Preparing vertex data to generate a shadow volume involves firstly ensuring that the 
+            vertex buffer containing the positions is a standalone vertex buffer,
+            with no other components in it. This method will therefore break apart any existing
+            vertex buffers if position is sharing a vertex buffer. 
+            Secondly, it will double the size of this vertex buffer so that there are 2 copies of 
+            the position data for the mesh. The first half is used for the original, and the second 
+            half is used for the 'extruded' version. The vertex count used to render will remain 
+            the same though, so as not to add any overhead to regular rendering of the object.
+            Both copies of the position are required in one buffer because shadow volumes stretch 
+            from the original mesh to the extruded version. 
+        @par
+            It's important to appreciate that this method can fundamentally change the structure of your
+            vertex buffers, although in reality they will be new buffers. As it happens, if other 
+            objects are using the original buffers then they will be unaffected because the reference
+            counting will keep them intact. However, if you have made any assumptions about the 
+            structure of the vertex data in the buffers of this object, you may have to rethink them.
+        */
+        void prepareForShadowVolume(void);
+
+        /** Additional shadow volume vertex buffer storage. 
+        @remarks
+            This additional buffer is only used where we have prepared this VertexData for
+            use in shadow volume construction, and where the current render system supports
+            vertex programs. This buffer contains the 'w' vertex position component which will
+            be used by that program to differentiate between extruded and non-extruded vertices.
+            This 'w' component cannot be included in the original position buffer because
+            DirectX does not allow 4-component positions in the fixed-function pipeline, and the original
+            position buffer must still be usable for fixed-function rendering.
+        @par    
+            Note that we don't store any vertex declaration or vertex buffer binding here because this
+            can be reused in the shadow algorithm.
+        */
+        HardwareVertexBufferSharedPtr hardwareShadowVolWBuffer;
+
+
+		/** Reorganises the data in the vertex buffers according to the 
+			new vertex declaration passed in. Note that new vertex buffers
+			are created and written to, so if the buffers being referenced 
+			by this vertex data object are also used by others, then the 
+			original buffers will not be damaged by this operation.
+			Once this operation has completed, the new declaration 
+			passed in will overwrite the current one.
+		@param newDeclaration The vertex declaration which will be used
+			for the reorganised buffer state. Note that the new declaration
+			must not include any elements which do not already exist in the 
+			current declaration; you can drop elements by 
+			excluding them from the declaration if you wish, however.
+		@param bufferUsage Vector of usage flags which indicate the usage options
+			for each new vertex buffer created. The indexes of the entries must correspond
+			to the buffer binding values referenced in the declaration.
+		@param mgr Optional pointer to the manager to use to create new declarations
+			and buffers etc. If not supplied, the HardwareBufferManager singleton will be used
+		*/
+		void reorganiseBuffers(VertexDeclaration* newDeclaration, const BufferUsageList& bufferUsage, 
+			HardwareBufferManagerBase* mgr = 0);
+
+		/** Reorganises the data in the vertex buffers according to the 
+			new vertex declaration passed in. Note that new vertex buffers
+			are created and written to, so if the buffers being referenced 
+			by this vertex data object are also used by others, then the 
+			original buffers will not be damaged by this operation.
+			Once this operation has completed, the new declaration 
+			passed in will overwrite the current one.
+            This version of the method derives the buffer usages from the existing
+            buffers, by using the 'most flexible' usage from the equivalent sources.
+		@param newDeclaration The vertex declaration which will be used
+			for the reorganised buffer state. Note that the new delcaration
+			must not include any elements which do not already exist in the 
+			current declaration; you can drop elements by 
+			excluding them from the declaration if you wish, however.
+		@param mgr Optional pointer to the manager to use to create new declarations
+			and buffers etc. If not supplied, the HardwareBufferManager singleton will be used
+		*/
+		void reorganiseBuffers(VertexDeclaration* newDeclaration, HardwareBufferManagerBase* mgr = 0);
+
+        /** Remove any gaps in the vertex buffer bindings.
+        @remarks
+            This is useful if you've removed elements and buffers from this vertex
+            data and want to remove any gaps in the vertex buffer bindings. This
+            method is mainly useful when reorganising vertex data manually.
+        @note
+            This will cause binding index of the elements in the vertex declaration
+            to be altered to new binding index.
+        */
+        void closeGapsInBindings(void);
+
+        /** Remove all vertex buffers that never used by the vertex declaration.
+        @remarks
+            This is useful if you've removed elements from the vertex declaration
+            and want to unreference buffers that never used any more. This method
+            is mainly useful when reorganising vertex data manually.
+        @note
+            This also remove any gaps in the vertex buffer bindings.
+        */
+        void removeUnusedBuffers(void);
+
+		/** Convert all packed colour values (VET_COLOUR_*) in buffers used to
+			another type.
+		@param srcType The source colour type to assume if the ambiguous VET_COLOUR
+			is encountered.
+		@param destType The destination colour type, must be VET_COLOUR_ABGR or
+			VET_COLOUR_ARGB.
+		*/
+		void convertPackedColour(VertexElementType srcType, VertexElementType destType);
+
+
+		/** Allocate elements to serve a holder of morph / pose target data 
+			for hardware morphing / pose blending.
+		@remarks
+			This method will allocate the given number of 3D texture coordinate 
+			sets for use as a morph target or target pose offset (3D position).
+			These elements will be saved in hwAnimationDataList.
+			It will also assume that the source of these new elements will be new
+			buffers which are not bound at this time, so will start the sources to 
+			1 higher than the current highest binding source. The caller is
+			expected to bind these new buffers when appropriate. For morph animation
+			the original position buffer will be the 'from' keyframe data, whilst
+			for pose animation it will be the original vertex data.
+			If normals are animated, then twice the number of 3D texture coordinates are required
+		 @return The number of sets that were supported
+		*/
+		ushort allocateHardwareAnimationElements(ushort count, bool animateNormals);
+
+
+
+	};
+
+	/** Summary class collecting together index data source information. */
+	class _OgreExport IndexData : public IndexDataAlloc
+	{
+    protected:
+        /// Protected copy constructor, to prevent misuse
+        IndexData(const IndexData& rhs); /* do nothing, should not use */
+        /// Protected operator=, to prevent misuse
+        IndexData& operator=(const IndexData& rhs); /* do not use */
+    public:
+        IndexData();
+        ~IndexData();
+		/// Pointer to the HardwareIndexBuffer to use, must be specified if useIndexes = true
+		HardwareIndexBufferSharedPtr indexBuffer;
+
+		/// Index in the buffer to start from for this operation
+		size_t indexStart;
+
+		/// The number of indexes to use from the buffer
+		size_t indexCount;
+
+		/** Clones this index data, potentially including replicating the index buffer.
+		@param copyData Whether to create new buffers too or just reference the existing ones
+		@param mgr If supplied, the buffer manager through which copies should be made
+		@remarks The caller is expected to delete the returned pointer when finished
+		*/
+		IndexData* clone(bool copyData = true, HardwareBufferManagerBase* mgr = 0) const;
+
+		/** Re-order the indexes in this index data structure to be more
+			vertex cache friendly; that is to re-use the same vertices as close
+			together as possible. 
+		@remarks
+			Can only be used for index data which consists of triangle lists.
+			It would in fact be pointless to use it on triangle strips or fans
+			in any case.
+		*/
+		void optimiseVertexCacheTriList(void);
+	
+	};
+
+	/** Vertex cache profiler.
+	@remarks
+		Utility class for evaluating the effectiveness of the use of the vertex
+		cache by a given index buffer.
+	*/
+	class _OgreExport VertexCacheProfiler : public BufferAlloc
+    {
+		public:
+			enum CacheType {
+				FIFO, LRU
+			};
+
+			VertexCacheProfiler(unsigned int cachesize = 16, CacheType cachetype = FIFO )
+				: size ( cachesize ), tail (0), buffersize (0), hit (0), miss (0)
+			{
+				cache = OGRE_ALLOC_T(uint32, size, MEMCATEGORY_GEOMETRY);
+			}
+
+			~VertexCacheProfiler()
+			{
+				OGRE_FREE(cache, MEMCATEGORY_GEOMETRY);
+			}
+
+			void profile(const HardwareIndexBufferSharedPtr& indexBuffer);
+			void reset() { hit = 0; miss = 0; tail = 0; buffersize = 0; }
+			void flush() { tail = 0; buffersize = 0; }
+
+			unsigned int getHits() { return hit; }
+			unsigned int getMisses() { return miss; }
+			unsigned int getSize() { return size; }
+		private:
+			unsigned int size;
+			uint32 *cache;
+
+			unsigned int tail, buffersize;
+			unsigned int hit, miss;
+
+			bool inCache(unsigned int index);
+	};
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreViewport.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreViewport.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreViewport.h	(revision 148)
@@ -0,0 +1,430 @@
+/*
+-----------------------------------------------------------------------------
+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 __Viewport_H__
+#define __Viewport_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreCommon.h"
+#include "OgreColourValue.h"
+#include "OgreFrustum.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup RenderSystem
+	*  @{
+	*/
+	/** An abstraction of a viewport, i.e. a rendering region on a render
+        target.
+        @remarks
+            A viewport is the meeting of a camera and a rendering surface -
+            the camera renders the scene from a viewpoint, and places its
+            results into some subset of a rendering target, which may be the
+            whole surface or just a part of the surface. Each viewport has a
+            single camera as source and a single target as destination. A
+            camera only has 1 viewport, but a render target may have several.
+            A viewport also has a Z-order, i.e. if there is more than one
+            viewport on a single render target and they overlap, one must
+            obscure the other in some predetermined way.
+    */
+	class _OgreExport Viewport : public ViewportAlloc
+    {
+    public:
+		/** Listener interface so you can be notified of Viewport changes. */
+		class _OgreExport Listener
+		{
+		public:
+			virtual ~Listener() {}
+
+			/** Notification of when a new camera is set to target listening Viewport. */
+			virtual void viewportCameraChanged(Viewport* viewport) {}
+
+			/** Notification of when target listening Viewport's dimensions changed. */
+			virtual void viewportDimensionsChanged(Viewport* viewport) {}
+
+			/** Notification of when target listening Viewport's is destroyed. */
+			virtual void viewportDestroyed(Viewport* viewport) {}
+		};
+
+        /** The usual constructor.
+            @param camera
+                Pointer to a camera to be the source for the image.
+            @param target
+                Pointer to the render target to be the destination
+                for the rendering.
+            @param left, top, width, height
+                Dimensions of the viewport, expressed as a value between
+                0 and 1. This allows the dimensions to apply irrespective of
+                changes in the target's size: e.g. to fill the whole area,
+                values of 0,0,1,1 are appropriate.
+            @param ZOrder
+                Relative Z-order on the target. Lower = further to
+                the front.
+        */
+        Viewport(
+            Camera* camera,
+            RenderTarget* target,
+            Real left, Real top,
+            Real width, Real height,
+            int ZOrder);
+
+        /** Default destructor.
+        */
+        virtual ~Viewport();
+
+        /** Notifies the viewport of a possible change in dimensions.
+            @remarks
+                Used by the target to update the viewport's dimensions
+                (usually the result of a change in target size).
+            @note
+                Internal use by Ogre only.
+        */
+        void _updateDimensions(void);
+
+        /** Instructs the viewport to updates its contents.
+        */
+        void update(void);
+		
+		/** Instructs the viewport to clear itself, without performing an update.
+		 @remarks
+			You would not normally call this method when updating the viewport, 
+			since the viewport usually clears itself when updating anyway (@see 
+		    Viewport::setClearEveryFrame). However, if you wish you have the
+			option of manually clearing the frame buffer (or elements of it)
+		    using this method.
+		 @param buffers Bitmask identifying which buffer elements to clear
+		 @param colour The colour value to clear to, if FBT_COLOUR is included
+		 @param depth The depth value to clear to, if FBT_DEPTH is included
+		 @param stencil The stencil value to clear to, if FBT_STENCIL is included
+		*/
+		void clear(unsigned int buffers = FBT_COLOUR | FBT_DEPTH,
+				   const ColourValue& colour = ColourValue::Black, 
+				   Real depth = 1.0f, unsigned short stencil = 0);
+
+        /** Retrieves a pointer to the render target for this viewport.
+        */
+        RenderTarget* getTarget(void) const;
+
+        /** Retrieves a pointer to the camera for this viewport.
+        */
+        Camera* getCamera(void) const;
+
+        /** Sets the camera to use for rendering to this viewport. */
+        void setCamera(Camera* cam);
+
+        /** Gets the Z-Order of this viewport. */
+		int getZOrder(void) const;
+		/** Gets one of the relative dimensions of the viewport,
+            a value between 0.0 and 1.0.
+        */
+        Real getLeft(void) const;
+
+        /** Gets one of the relative dimensions of the viewport, a value
+            between 0.0 and 1.0.
+        */
+        Real getTop(void) const;
+
+        /** Gets one of the relative dimensions of the viewport, a value
+            between 0.0 and 1.0.
+        */
+
+        Real getWidth(void) const;
+        /** Gets one of the relative dimensions of the viewport, a value
+            between 0.0 and 1.0.
+        */
+
+        Real getHeight(void) const;
+        /** Gets one of the actual dimensions of the viewport, a value in
+            pixels.
+        */
+
+        int getActualLeft(void) const;
+        /** Gets one of the actual dimensions of the viewport, a value in
+            pixels.
+        */
+
+        int getActualTop(void) const;
+        /** Gets one of the actual dimensions of the viewport, a value in
+            pixels.
+        */
+        int getActualWidth(void) const;
+        /** Gets one of the actual dimensions of the viewport, a value in
+            pixels.
+        */
+
+        int getActualHeight(void) const;
+
+        /** Sets the dimensions (after creation).
+            @param
+                left Left point of viewport.
+            @param
+                top Top point of the viewport.
+            @param
+                width Width of the viewport.
+            @param
+                height Height of the viewport.
+            @note Dimensions relative to the size of the target,
+                represented as real values between 0 and 1. i.e. the full
+                target area is 0, 0, 1, 1.
+        */
+        void setDimensions(Real left, Real top, Real width, Real height);
+
+        /** Set the orientation mode of the viewport.
+        */
+        void setOrientationMode(OrientationMode orientationMode, bool setDefault = true);
+
+        /** Get the orientation mode of the viewport.
+        */
+        OrientationMode getOrientationMode() const;
+
+        /** Set the initial orientation mode of viewports.
+        */
+        static void setDefaultOrientationMode(OrientationMode orientationMode);
+
+        /** Get the initial orientation mode of viewports.
+        */
+        static OrientationMode getDefaultOrientationMode();
+
+        /** Sets the initial background colour of the viewport (before
+            rendering).
+        */
+        void setBackgroundColour(const ColourValue& colour);
+
+        /** Gets the background colour.
+        */
+        const ColourValue& getBackgroundColour(void) const;
+
+		/** Sets the initial depth buffer value of the viewport (before
+            rendering). Default is 1
+        */
+        void setDepthClear( Real depth );
+
+        /** Gets the default depth buffer value to which the viewport is cleared.
+        */
+        Real getDepthClear(void) const;
+
+        /** Determines whether to clear the viewport before rendering.
+		@remarks
+			You can use this method to set which buffers are cleared
+			(if any) before rendering every frame.
+        @param clear Whether or not to clear any buffers
+		@param buffers One or more values from FrameBufferType denoting
+			which buffers to clear, if clear is set to true. Note you should
+			not clear the stencil buffer here unless you know what you're doing.
+         */
+        void setClearEveryFrame(bool clear, unsigned int buffers = FBT_COLOUR | FBT_DEPTH);
+
+        /** Determines if the viewport is cleared before every frame.
+        */
+        bool getClearEveryFrame(void) const;
+
+		/** Gets which buffers are to be cleared each frame. */
+        unsigned int getClearBuffers(void) const;
+
+		/** Sets whether this viewport should be automatically updated 
+			if Ogre's rendering loop or RenderTarget::update is being used.
+        @remarks
+            By default, if you use Ogre's own rendering loop (Root::startRendering)
+            or call RenderTarget::update, all viewports are updated automatically.
+            This method allows you to control that behaviour, if for example you 
+			have a viewport which you only want to update periodically.
+        @param autoupdate If true, the viewport is updated during the automatic
+            render loop or when RenderTarget::update() is called. If false, the 
+            viewport is only updated when its update() method is called explicitly.
+        */
+		void setAutoUpdated(bool autoupdate);
+		/** Gets whether this viewport is automatically updated if 
+			Ogre's rendering loop or RenderTarget::update is being used.
+        */
+		bool isAutoUpdated() const;
+
+		/** Set the material scheme which the viewport should use.
+		@remarks
+			This allows you to tell the system to use a particular
+			material scheme when rendering this viewport, which can 
+			involve using different techniques to render your materials.
+		@see Technique::setSchemeName
+		*/
+		void setMaterialScheme(const String& schemeName)
+		{ mMaterialSchemeName = schemeName; }
+		
+		/** Get the material scheme which the viewport should use.
+		*/
+		const String& getMaterialScheme(void) const
+		{ return mMaterialSchemeName; }
+
+		/** Access to actual dimensions (based on target size).
+        */
+        void getActualDimensions(
+            int &left, int &top, int &width, int &height ) const;
+
+        bool _isUpdated(void) const;
+        void _clearUpdatedFlag(void);
+
+        /** Gets the number of rendered faces in the last update.
+        */
+        unsigned int _getNumRenderedFaces(void) const;
+
+        /** Gets the number of rendered batches in the last update.
+        */
+        unsigned int _getNumRenderedBatches(void) const;
+
+        /** Tells this viewport whether it should display Overlay objects.
+        @remarks
+            Overlay objects are layers which appear on top of the scene. They are created via
+            SceneManager::createOverlay and every viewport displays these by default.
+            However, you probably don't want this if you're using multiple viewports,
+            because one of them is probably a picture-in-picture which is not supposed to
+            have overlays of it's own. In this case you can turn off overlays on this viewport
+            by calling this method.
+        @param enabled If true, any overlays are displayed, if false they are not.
+        */
+        void setOverlaysEnabled(bool enabled);
+
+        /** Returns whether or not Overlay objects (created in the SceneManager) are displayed in this
+            viewport. */
+        bool getOverlaysEnabled(void) const;
+
+        /** Tells this viewport whether it should display skies.
+        @remarks
+            Skies are layers which appear on background of the scene. They are created via
+            SceneManager::setSkyBox, SceneManager::setSkyPlane and SceneManager::setSkyDome and
+            every viewport displays these by default. However, you probably don't want this if
+            you're using multiple viewports, because one of them is probably a picture-in-picture
+            which is not supposed to have skies of it's own. In this case you can turn off skies
+            on this viewport by calling this method.
+        @param enabled If true, any skies are displayed, if false they are not.
+        */
+        void setSkiesEnabled(bool enabled);
+
+        /** Returns whether or not skies (created in the SceneManager) are displayed in this
+            viewport. */
+        bool getSkiesEnabled(void) const;
+
+        /** Tells this viewport whether it should display shadows.
+        @remarks
+            This setting enables you to disable shadow rendering for a given viewport. The global
+			shadow technique set on SceneManager still controls the type and nature of shadows,
+			but this flag can override the setting so that no shadows are rendered for a given
+			viewport to save processing time where they are not required.
+        @param enabled If true, any shadows are displayed, if false they are not.
+        */
+        void setShadowsEnabled(bool enabled);
+
+        /** Returns whether or not shadows (defined in the SceneManager) are displayed in this
+            viewport. */
+        bool getShadowsEnabled(void) const;
+
+
+		/** Sets a per-viewport visibility mask.
+		@remarks
+			The visibility mask is a way to exclude objects from rendering for
+			a given viewport. For each object in the frustum, a check is made
+			between this mask and the objects visibility flags 
+			(@see MovableObject::setVisibilityFlags), and if a binary 'and'
+			returns zero, the object will not be rendered.
+		*/
+		void setVisibilityMask(uint32 mask) { mVisibilityMask = mask; }
+
+		/** Gets a per-viewport visibility mask.
+		@see Viewport::setVisibilityMask
+		*/
+		uint getVisibilityMask(void) const { return mVisibilityMask; }
+
+		/** Sets the use of a custom RenderQueueInvocationSequence for
+			rendering this target.
+		@remarks
+			RenderQueueInvocationSequence instances are managed through Root. By
+			setting this, you are indicating that you wish this RenderTarget to
+			be updated using a custom sequence of render queue invocations, with
+			potentially customised ordering and render state options. You should
+			create the named sequence through Root first, then set the name here.
+		@param sequenceName The name of the RenderQueueInvocationSequence to use. If you
+			specify a blank string, behaviour will return to the default render
+			queue management.
+		*/
+		virtual void setRenderQueueInvocationSequenceName(const String& sequenceName);
+		/** Gets the name of the render queue invocation sequence for this target. */
+		virtual const String& getRenderQueueInvocationSequenceName(void) const;
+		/// Get the invocation sequence - will return null if using standard
+		RenderQueueInvocationSequence* _getRenderQueueInvocationSequence(void);
+
+        /** Convert oriented input point coordinates to screen coordinates. */
+        void pointOrientedToScreen(const Vector2 &v, int orientationMode, Vector2 &outv);
+        void pointOrientedToScreen(Real orientedX, Real orientedY, int orientationMode,
+                                   Real &screenX, Real &screenY);
+
+		/// Add a listener to this camera
+		void addListener(Listener* l);
+		/// Remove a listener to this camera
+		void removeListener(Listener* l);
+
+    protected:
+        Camera* mCamera;
+        RenderTarget* mTarget;
+        /// Relative dimensions, irrespective of target dimensions (0..1)
+        float mRelLeft, mRelTop, mRelWidth, mRelHeight;
+        /// Actual dimensions, based on target dimensions
+        int mActLeft, mActTop, mActWidth, mActHeight;
+        /// Z-order
+        int mZOrder;
+        /// Background options
+        ColourValue mBackColour;
+		Real mDepthClearValue;
+        bool mClearEveryFrame;
+		unsigned int mClearBuffers;
+        bool mUpdated;
+        bool mShowOverlays;
+        bool mShowSkies;
+		bool mShowShadows;
+		uint32 mVisibilityMask;
+		// Render queue invocation sequence name
+		String mRQSequenceName;
+		RenderQueueInvocationSequence* mRQSequence;
+		/// Material scheme
+		String mMaterialSchemeName;
+        /// Viewport orientation mode
+        OrientationMode mOrientationMode;
+        static OrientationMode mDefaultOrientationMode;
+
+		/// Automatic rendering on/off
+		bool mIsAutoUpdated;
+
+		typedef vector<Listener*>::type ListenerList;
+		ListenerList mListeners;
+    };
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreWindowEventUtilities.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreWindowEventUtilities.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreWindowEventUtilities.h	(revision 148)
@@ -0,0 +1,191 @@
+/*
+-----------------------------------------------------------------------------
+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 __OgreWindowEventUtils_H__
+#define __OgreWindowEventUtils_H__
+
+#include "OgrePrerequisites.h"
+#include "OgrePlatform.h"
+#include "OgreCommon.h"
+#include "OgreHeaderPrefix.h"
+
+#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
+#  if !defined(WIN32_LEAN_AND_MEAN)
+#   define WIN32_LEAN_AND_MEAN
+#  endif
+#  if !defined(NOMINMAX) && defined(_MSC_VER)
+#	define NOMINMAX // required to stop windows.h messing up std::min
+#  endif
+#  include <windows.h>
+#elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE && !defined(__LP64__)
+#  include <Carbon/Carbon.h>
+#endif
+
+
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup RenderSystem
+	*  @{
+	*/
+	/**
+	@remarks
+		Callback class used to send out window events to client app
+	*/
+	class _OgreExport WindowEventListener
+	{
+	public:
+		virtual ~WindowEventListener() {}
+
+		/**
+		@remarks
+			Window has moved position
+		@param rw
+			The RenderWindow which created this events
+		*/
+		virtual void windowMoved(RenderWindow* rw)
+                { (void)rw; }
+
+		/**
+		@remarks
+			Window has resized
+		@param rw
+			The RenderWindow which created this events
+		*/
+		virtual void windowResized(RenderWindow* rw)
+                { (void)rw; }
+
+		/**
+		@remarks
+			Window is closing (Only triggered if user pressed the [X] button)
+		@param rw
+			The RenderWindow which created this events
+		@return True will close the window(default).
+		*/
+		virtual bool windowClosing(RenderWindow* rw)
+		{ (void)rw; return true; }
+
+		/**
+		@remarks
+			Window has been closed (Only triggered if user pressed the [X] button)
+		@param rw
+			The RenderWindow which created this events
+		@note
+			The window has not actually close yet when this event triggers. It's only closed after
+			all windowClosed events are triggered. This allows apps to deinitialise properly if they
+			have services that needs the window to exist when deinitialising.
+		*/
+		virtual void windowClosed(RenderWindow* rw)
+                { (void)rw; }
+
+		/**
+		@remarks
+			Window has lost/gained focus
+		@param rw
+			The RenderWindow which created this events
+		*/
+		virtual void windowFocusChange(RenderWindow* rw)
+                { (void)rw; }
+	};
+
+	/**
+	@remarks
+		Utility class to handle Window Events/Pumping/Messages
+	*/
+	class _OgreExport WindowEventUtilities
+	{
+	public:
+		/**
+		@remarks
+			Call this once per frame if not using Root:startRendering(). This will update all registered
+			RenderWindows (If using external Windows, you can optionally register those yourself)
+		*/
+		static void messagePump();
+
+		/**
+		@remarks
+			Add a listener to listen to renderwindow events (multiple listener's per renderwindow is fine)
+			The same listener can listen to multiple windows, as the Window Pointer is sent along with
+			any messages.
+		@param window
+			The RenderWindow you are interested in monitoring
+		@param listener
+			Your callback listener
+		*/
+		static void addWindowEventListener( RenderWindow* window, WindowEventListener* listener );
+
+		/**
+		@remarks
+			Remove previously added listener
+		@param window
+			The RenderWindow you registered with
+		@param listener
+			The listener registered
+		*/
+		static void removeWindowEventListener( RenderWindow* window, WindowEventListener* listener );
+
+		/**
+		@remarks
+			Called by RenderWindows upon creation for Ogre generated windows. You are free to add your
+			external windows here too if needed.
+		@param window
+			The RenderWindow to monitor
+		*/
+		static void _addRenderWindow(RenderWindow* window);
+
+		/**
+		@remarks
+			Called by RenderWindows upon creation for Ogre generated windows. You are free to add your
+			external windows here too if needed.
+		@param window
+			The RenderWindow to remove from list
+		*/
+		static void _removeRenderWindow(RenderWindow* window);
+
+#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
+		//! Internal winProc (RenderWindow's use this when creating the Win32 Window)
+		static LRESULT CALLBACK _WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
+#elif OGRE_PLATFORM == OGRE_PLATFORM_APPLE && !defined __OBJC__ && !defined(__LP64__)
+        //! Internal UPP Window Handler (RenderWindow's use this when creating the OS X Carbon Window
+        static OSStatus _CarbonWindowHandler(EventHandlerCallRef nextHandler, EventRef event, void* wnd);
+#endif
+
+		//These are public only so GLXProc can access them without adding Xlib headers header
+		typedef multimap<RenderWindow*, WindowEventListener*>::type WindowEventListeners;
+		static WindowEventListeners _msListeners;
+		static RenderWindowList _msWindows;
+	};
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/OgreWireBoundingBox.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreWireBoundingBox.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreWireBoundingBox.h	(revision 148)
@@ -0,0 +1,87 @@
+/*
+-----------------------------------------------------------------------------
+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 _WireBoundingBox_H__
+#define _WireBoundingBox_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreSimpleRenderable.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Scene
+	*  @{
+	*/
+	/** Allows the rendering of a wireframe bounding box.
+        @remarks
+            This class builds a wireframe renderable from a given aabb. A pointer to this class can be
+			added to a render queue to display the bounding box of an object.
+    */
+	class _OgreExport WireBoundingBox : public SimpleRenderable
+	{
+    protected:
+        /** Override this method to prevent parent transforms (rotation,translation,scale)
+        */
+		void getWorldTransforms( Matrix4* xform ) const;
+		
+        /** Builds the wireframe line list.
+        */
+		void setupBoundingBoxVertices(const AxisAlignedBox& aab);
+
+        Real mRadius;
+
+		void _initWireBoundingBox();
+
+	public:
+			
+		WireBoundingBox();
+		WireBoundingBox(const String& name);
+		~WireBoundingBox();
+
+        /** Builds the wireframe line list.
+            @param
+                aabb bounding box to build a wireframe from.
+        */
+		void setupBoundingBox(const AxisAlignedBox& aabb);
+
+		Real getSquaredViewDepth(const Camera* cam) const;
+
+        Real getBoundingRadius(void) const { return mRadius; }
+
+	};
+	/** @} */
+	/** @} */
+
+}// namespace
+
+#endif
+
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreWorkQueue.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreWorkQueue.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreWorkQueue.h	(revision 148)
@@ -0,0 +1,587 @@
+/*
+-----------------------------------------------------------------------------
+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 __OgreWorkQueue_H__
+#define __OgreWorkQueue_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreAny.h"
+#include "OgreSharedPtr.h"
+#include "Threading/OgreThreadHeaders.h"
+#include "OgreHeaderPrefix.h"
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+
+	/** Interface to a general purpose request / response style background work queue.
+	@remarks
+		A work queue is a simple structure, where requests for work are placed
+		onto the queue, then removed by a worker for processing, then finally
+		a response is placed on the result queue for the originator to pick up
+		at their leisure. The typical use for this is in a threaded environment, 
+		although any kind of deferred processing could use this approach to 
+		decouple and distribute work over a period of time even 
+		if it was single threaded.
+	@par
+		WorkQueues also incorporate thread pools. One or more background worker threads
+		can wait on the queue and be notified when a request is waiting to be
+		processed. For maximal thread usage, a WorkQueue instance should be shared
+		among many sources of work, rather than many work queues being created.
+		This way, you can share a small number of hardware threads among a large 
+		number of background tasks. This doesn't mean you have to implement all the
+		request processing in one class, you can plug in many handlers in order to
+		process the requests.
+	@par
+		This is an abstract interface definition; users can subclass this and 
+		provide their own implementation if required to centralise task management
+		in their own subsystems. We also provide a default implementation in the
+		form of DefaultWorkQueue.
+	*/
+	class _OgreExport WorkQueue : public UtilityAlloc
+	{
+	protected:
+		typedef map<String, uint16>::type ChannelMap;
+		ChannelMap mChannelMap;
+		uint16 mNextChannel;
+		OGRE_MUTEX(mChannelMapMutex);
+	public:
+		/// Numeric identifier for a request
+		typedef unsigned long long int RequestID;
+
+		/** General purpose request structure. 
+		*/
+		class _OgreExport Request : public UtilityAlloc
+		{
+			friend class WorkQueue;
+		protected:
+			/// The request channel, as an integer 
+			uint16 mChannel;
+			/// The request type, as an integer within the channel (user can define enumerations on this)
+			uint16 mType;
+			/// The details of the request (user defined)
+			Any mData;
+			/// Retry count - set this to non-zero to have the request try again on failure
+			uint8 mRetryCount;
+			/// Identifier (assigned by the system)
+			RequestID mID;
+			/// Abort Flag
+			mutable bool mAborted;
+
+		public:
+			/// Constructor 
+			Request(uint16 channel, uint16 rtype, const Any& rData, uint8 retry, RequestID rid);
+			~Request();
+			/// Set the abort flag
+			void abortRequest() const { mAborted = true; }
+			/// Get the request channel (top level categorisation)
+			uint16 getChannel() const { return mChannel; }
+			/// Get the type of this request within the given channel
+			uint16 getType() const { return mType; }
+			/// Get the user details of this request
+			const Any& getData() const { return mData; }
+			/// Get the remaining retry count
+			uint8 getRetryCount() const { return mRetryCount; }
+			/// Get the identifier of this request
+			RequestID getID() const { return mID; }
+			/// Get the abort flag
+			bool getAborted() const { return mAborted; }
+		};
+
+		/** General purpose response structure. 
+		*/
+		struct _OgreExport Response : public UtilityAlloc
+		{
+			/// Pointer to the request that this response is in relation to
+			const Request* mRequest;
+			/// Whether the work item succeeded or not
+			bool mSuccess;
+			/// Any diagnostic messages
+			String mMessages;
+			/// Data associated with the result of the process
+			Any mData;
+
+		public:
+			Response(const Request* rq, bool success, const Any& data, const String& msg = StringUtil::BLANK);
+			~Response();
+			/// Get the request that this is a response to (NB destruction destroys this)
+			const Request* getRequest() const { return mRequest; }
+			/// Return whether this is a successful response
+			bool succeeded() const { return mSuccess; }
+			/// Get any diagnostic messages about the process
+			const String& getMessages() const { return mMessages; }
+			/// Return the response data (user defined, only valid on success)
+			const Any& getData() const { return mData; }
+			/// Abort the request
+			void abortRequest() { mRequest->abortRequest(); mData.destroy(); }
+		};
+
+		/** Interface definition for a handler of requests. 
+		@remarks
+		User classes are expected to implement this interface in order to
+		process requests on the queue. It's important to realise that
+		the calls to this class may be in a separate thread to the main
+		render context, and as such it may not be possible to make
+		rendersystem or other GPU-dependent calls in this handler. You can only
+		do so if the queue was created with 'workersCanAccessRenderSystem'
+		set to true, and OGRE_THREAD_SUPPORT=1, but this puts extra strain
+		on the thread safety of the render system and is not recommended.
+		It is best to perform CPU-side work in these handlers and let the
+		response handler transfer results to the GPU in the main render thread.
+		*/
+		class _OgreExport RequestHandler
+		{
+		public:
+			RequestHandler() {}
+			virtual ~RequestHandler() {}
+
+			/** Return whether this handler can process a given request. 
+			@remarks
+			Defaults to true, but if you wish to add several handlers each of
+			which deal with different types of request, you can override
+			this method. 
+			*/
+			virtual bool canHandleRequest(const Request* req, const WorkQueue* srcQ) 
+			{ (void)srcQ; return !req->getAborted(); }
+
+			/** The handler method every subclass must implement. 
+			If a failure is encountered, return a Response with a failure
+			result rather than raise an exception.
+			@param req The Request structure, which is effectively owned by the
+			handler during this call. It must be attached to the returned
+			Response regardless of success or failure.
+			@param srcQ The work queue that this request originated from
+			@return Pointer to a Response object - the caller is responsible
+			for deleting the object.
+			*/
+			virtual Response* handleRequest(const Request* req, const WorkQueue* srcQ) = 0;
+		};
+
+		/** Interface definition for a handler of responses. 
+		@remarks
+		User classes are expected to implement this interface in order to
+		process responses from the queue. All calls to this class will be 
+		in the main render thread and thus all GPU resources will be
+		available. 
+		*/
+		class _OgreExport ResponseHandler
+		{
+		public:
+			ResponseHandler() {}
+			virtual ~ResponseHandler() {}
+
+			/** Return whether this handler can process a given response. 
+			@remarks
+			Defaults to true, but if you wish to add several handlers each of
+			which deal with different types of response, you can override
+			this method. 
+			*/
+			virtual bool canHandleResponse(const Response* res, const WorkQueue* srcQ) 
+			{ (void)srcQ; return !res->getRequest()->getAborted(); }
+
+			/** The handler method every subclass must implement. 
+			@param res The Response structure. The caller is responsible for
+			deleting this after the call is made, none of the data contained
+			(except pointers to structures in user Any data) will persist
+			after this call is returned.
+			@param srcQ The work queue that this request originated from
+			*/
+			virtual void handleResponse(const Response* res, const WorkQueue* srcQ) = 0;
+		};
+
+		WorkQueue() : mNextChannel(0) {}
+		virtual ~WorkQueue() {}
+
+		/** Start up the queue with the options that have been set.
+		@param forceRestart If the queue is already running, whether to shut it
+			down and restart.
+		*/
+		virtual void startup(bool forceRestart = true) = 0;
+		/** Add a request handler instance to the queue. 
+		@remarks
+			Every queue must have at least one request handler instance for each 
+			channel in which requests are raised. If you 
+			add more than one handler per channel, then you must implement canHandleRequest 
+			differently	in each if you wish them to respond to different requests.
+		@param channel The channel for requests you want to handle
+		@param rh Your handler
+		*/
+		virtual void addRequestHandler(uint16 channel, RequestHandler* rh) = 0;
+		/** Remove a request handler. */
+		virtual void removeRequestHandler(uint16 channel, RequestHandler* rh) = 0;
+
+		/** Add a response handler instance to the queue. 
+		@remarks
+			Every queue must have at least one response handler instance for each 
+			channel in which requests are raised. If you add more than one, then you 
+			must implement canHandleResponse differently in each if you wish them 
+			to respond to different responses.
+		@param channel The channel for responses you want to handle
+		@param rh Your handler
+		*/
+		virtual void addResponseHandler(uint16 channel, ResponseHandler* rh) = 0;
+		/** Remove a Response handler. */
+		virtual void removeResponseHandler(uint16 channel, ResponseHandler* rh) = 0;
+
+		/** Add a new request to the queue.
+		@param channel The channel this request will go into = 0; the channel is the top-level
+			categorisation of the request
+		@param requestType An identifier that's unique within this queue which
+			identifies the type of the request (user decides the actual value)
+		@param rData The data required by the request process. 
+		@param retryCount The number of times the request should be retried
+			if it fails.
+		@param forceSynchronous Forces the request to be processed immediately
+			even if threading is enabled.
+		@param idleThread Request should be processed on the idle thread.
+		    Idle requests will be processed on a single worker thread. You should use this in the following situations:
+			1. If a request handler can't process multiple requests in parallel.
+			2. If you add lot of requests, but you want to keep the game fast.
+			3. If you have lot of more important threads. (example: physics).
+		@return The ID of the request that has been added
+		*/
+		virtual RequestID addRequest(uint16 channel, uint16 requestType, const Any& rData, uint8 retryCount = 0, 
+			bool forceSynchronous = false, bool idleThread = false) = 0;
+
+		/** Abort a previously issued request.
+		If the request is still waiting to be processed, it will be 
+		removed from the queue.
+		@param id The ID of the previously issued request.
+		*/
+		virtual void abortRequest(RequestID id) = 0;
+
+		/** Abort all previously issued requests in a given channel.
+		Any requests still waiting to be processed of the given channel, will be 
+		removed from the queue.
+		Requests which are processed, but response handler is not called will also be removed.
+		@param channel The type of request to be aborted
+		*/
+		virtual void abortRequestsByChannel(uint16 channel) = 0;
+
+		/** Abort all previously issued requests in a given channel.
+		Any requests still waiting to be processed of the given channel, will be 
+		removed from the queue.
+		It will not remove requests, where the request handler is already called.
+		@param channel The type of request to be aborted
+		*/
+		virtual void abortPendingRequestsByChannel(uint16 channel) = 0;
+
+		/** Abort all previously issued requests.
+		Any requests still waiting to be processed will be removed from the queue.
+		Any requests that are being processed will still complete.
+		*/
+		virtual void abortAllRequests() = 0;
+		
+		/** Set whether to pause further processing of any requests. 
+		If true, any further requests will simply be queued and not processed until
+		setPaused(false) is called. Any requests which are in the process of being
+		worked on already will still continue. 
+		*/
+		virtual void setPaused(bool pause) = 0;
+		/// Return whether the queue is paused ie not sending more work to workers
+		virtual bool isPaused() const = 0;
+
+		/** Set whether to accept new requests or not. 
+		If true, requests are added to the queue as usual. If false, requests
+		are silently ignored until setRequestsAccepted(true) is called. 
+		*/
+		virtual void setRequestsAccepted(bool accept) = 0;
+		/// Returns whether requests are being accepted right now
+		virtual bool getRequestsAccepted() const = 0;
+
+		/** Process the responses in the queue.
+		@remarks
+			This method is public, and must be called from the main render
+			thread to 'pump' responses through the system. The method will usually
+			try to clear all responses before returning = 0; however, you can specify
+			a time limit on the response processing to limit the impact of
+			spikes in demand by calling setResponseProcessingTimeLimit.
+		*/
+		virtual void processResponses() = 0; 
+
+		/** Get the time limit imposed on the processing of responses in a
+			single frame, in milliseconds (0 indicates no limit).
+		*/
+		virtual unsigned long getResponseProcessingTimeLimit() const = 0;
+
+		/** Set the time limit imposed on the processing of responses in a
+			single frame, in milliseconds (0 indicates no limit).
+			This sets the maximum time that will be spent in processResponses() in 
+			a single frame. The default is 8ms.
+		*/
+		virtual void setResponseProcessingTimeLimit(unsigned long ms) = 0;
+
+		/** Shut down the queue.
+		*/
+		virtual void shutdown() = 0;
+
+		/** Get a channel ID for a given channel name. 
+		@remarks
+			Channels are assigned on a first-come, first-served basis and are
+			not persistent across application instances. This method allows 
+			applications to not worry about channel clashes through manually
+			assigned channel numbers.
+		*/
+		virtual uint16 getChannel(const String& channelName);
+
+	};
+
+	/** Base for a general purpose request / response style background work queue.
+	*/
+	class _OgreExport DefaultWorkQueueBase : public WorkQueue
+	{
+	public:
+
+		/** Constructor.
+			Call startup() to initialise.
+		@param name Optional name, just helps to identify logging output
+		*/
+		DefaultWorkQueueBase(const String& name = StringUtil::BLANK);
+		virtual ~DefaultWorkQueueBase();
+		/// Get the name of the work queue
+		const String& getName() const;
+		/** Get the number of worker threads that this queue will start when 
+			startup() is called. 
+		*/
+		virtual size_t getWorkerThreadCount() const;
+
+		/** Set the number of worker threads that this queue will start
+			when startup() is called (default 1).
+			Calling this will have no effect unless the queue is shut down and
+			restarted.
+		*/
+		virtual void setWorkerThreadCount(size_t c);
+
+		/** Get whether worker threads will be allowed to access render system
+			resources. 
+			Accessing render system resources from a separate thread can require that
+			a context is maintained for that thread. Also, it requires that the
+			render system is running in threadsafe mode, which only happens
+			when OGRE_THREAD_SUPPORT=1. This option defaults to false, which means
+			that threads can not use GPU resources, and the render system can 
+			work in non-threadsafe mode, which is more efficient.
+		*/
+		virtual bool getWorkersCanAccessRenderSystem() const;
+
+
+		/** Set whether worker threads will be allowed to access render system
+			resources. 
+			Accessing render system resources from a separate thread can require that
+			a context is maintained for that thread. Also, it requires that the
+			render system is running in threadsafe mode, which only happens
+			when OGRE_THREAD_SUPPORT=1. This option defaults to false, which means
+			that threads can not use GPU resources, and the render system can 
+			work in non-threadsafe mode, which is more efficient.
+			Calling this will have no effect unless the queue is shut down and
+			restarted.
+		*/
+		virtual void setWorkersCanAccessRenderSystem(bool access);
+
+		/** Process the next request on the queue. 
+		@remarks
+			This method is public, but only intended for advanced users to call. 
+			The only reason you would call this, is if you were using your 
+			own thread to drive the worker processing. The thread calling this
+			method will be the thread used to call the RequestHandler.
+		*/
+		virtual void _processNextRequest();
+
+		/// Main function for each thread spawned.
+		virtual void _threadMain() = 0;
+
+		/** Returns whether the queue is trying to shut down. */
+		virtual bool isShuttingDown() const { return mShuttingDown; }
+
+		/// @copydoc WorkQueue::addRequestHandler
+		virtual void addRequestHandler(uint16 channel, RequestHandler* rh);
+		/// @copydoc WorkQueue::removeRequestHandler
+		virtual void removeRequestHandler(uint16 channel, RequestHandler* rh);
+		/// @copydoc WorkQueue::addResponseHandler
+		virtual void addResponseHandler(uint16 channel, ResponseHandler* rh);
+		/// @copydoc WorkQueue::removeResponseHandler
+		virtual void removeResponseHandler(uint16 channel, ResponseHandler* rh);
+
+		/// @copydoc WorkQueue::addRequest
+		virtual RequestID addRequest(uint16 channel, uint16 requestType, const Any& rData, uint8 retryCount = 0, 
+			bool forceSynchronous = false, bool idleThread = false);
+		/// @copydoc WorkQueue::abortRequest
+		virtual void abortRequest(RequestID id);
+		/// @copydoc WorkQueue::abortRequestsByChannel
+		virtual void abortRequestsByChannel(uint16 channel);
+		/// @copydoc WorkQueue::abortPendingRequestsByChannel
+		virtual void abortPendingRequestsByChannel(uint16 channel);
+		/// @copydoc WorkQueue::abortAllRequests
+		virtual void abortAllRequests();
+		/// @copydoc WorkQueue::setPaused
+		virtual void setPaused(bool pause);
+		/// @copydoc WorkQueue::isPaused
+		virtual bool isPaused() const;
+		/// @copydoc WorkQueue::setRequestsAccepted
+		virtual void setRequestsAccepted(bool accept);
+		/// @copydoc WorkQueue::getRequestsAccepted
+		virtual bool getRequestsAccepted() const;
+		/// @copydoc WorkQueue::processResponses
+		virtual void processResponses(); 
+		/// @copydoc WorkQueue::getResponseProcessingTimeLimit
+		virtual unsigned long getResponseProcessingTimeLimit() const { return mResposeTimeLimitMS; }
+		/// @copydoc WorkQueue::setResponseProcessingTimeLimit
+		virtual void setResponseProcessingTimeLimit(unsigned long ms) { mResposeTimeLimitMS = ms; }
+	protected:
+		String mName;
+		size_t mWorkerThreadCount;
+		bool mWorkerRenderSystemAccess;
+		bool mIsRunning;
+		unsigned long mResposeTimeLimitMS;
+
+		typedef deque<Request*>::type RequestQueue;
+		typedef deque<Response*>::type ResponseQueue;
+		RequestQueue mRequestQueue; // Guarded by mRequestMutex
+		RequestQueue mProcessQueue; // Guarded by mProcessMutex
+		ResponseQueue mResponseQueue; // Guarded by mResponseMutex
+
+		/// Thread function
+		struct _OgreExport WorkerFunc OGRE_THREAD_WORKER_INHERIT
+		{
+			DefaultWorkQueueBase* mQueue;
+
+			WorkerFunc(DefaultWorkQueueBase* q) 
+				: mQueue(q) {}
+
+			void operator()();
+			
+			void operator()() const;
+
+			void run();
+		};
+		WorkerFunc* mWorkerFunc;
+
+		/** Intermediate structure to hold a pointer to a request handler which 
+			provides insurance against the handler itself being disconnected
+			while the list remains unchanged.
+		*/
+		class _OgreExport RequestHandlerHolder : public UtilityAlloc
+		{
+		protected:
+			OGRE_RW_MUTEX(mRWMutex);
+			RequestHandler* mHandler;
+		public:
+			RequestHandlerHolder(RequestHandler* handler)
+				: mHandler(handler)	{}
+
+			// Disconnect the handler to allow it to be destroyed
+			void disconnectHandler()
+			{
+				// write lock - must wait for all requests to finish
+				OGRE_LOCK_RW_MUTEX_WRITE(mRWMutex);
+				mHandler = 0;
+			}
+
+			/** Get handler pointer - note, only use this for == comparison or similar,
+				do not attempt to call it as it is not thread safe. 
+			*/
+			RequestHandler* getHandler() { return mHandler; }
+
+			/** Process a request if possible.
+			@return Valid response if processed, null otherwise
+			*/
+			Response* handleRequest(const Request* req, const WorkQueue* srcQ)
+			{
+				// Read mutex so that multiple requests can be processed by the
+				// same handler in parallel if required
+				OGRE_LOCK_RW_MUTEX_READ(mRWMutex);
+				Response* response = 0;
+				if (mHandler)
+				{
+					if (mHandler->canHandleRequest(req, srcQ))
+					{
+						response = mHandler->handleRequest(req, srcQ);
+					}
+				}
+				return response;
+			}
+
+		};
+		// Hold these by shared pointer so they can be copied keeping same instance
+		typedef SharedPtr<RequestHandlerHolder> RequestHandlerHolderPtr;
+
+		typedef list<RequestHandlerHolderPtr>::type RequestHandlerList;
+		typedef list<ResponseHandler*>::type ResponseHandlerList;
+		typedef map<uint16, RequestHandlerList>::type RequestHandlerListByChannel;
+		typedef map<uint16, ResponseHandlerList>::type ResponseHandlerListByChannel;
+
+		RequestHandlerListByChannel mRequestHandlers;
+		ResponseHandlerListByChannel mResponseHandlers;
+		RequestID mRequestCount; // Guarded by mRequestMutex
+		bool mPaused;
+		bool mAcceptRequests;
+		bool mShuttingDown;
+
+		//NOTE: If you lock multiple mutexes at the same time, the order is important!
+		// For example if threadA locks mIdleMutex first then tries to lock mProcessMutex,
+		// and threadB locks mProcessMutex first, then mIdleMutex. In this case you can get livelock and the system is dead!
+		//RULE: Lock mProcessMutex before other mutex, to prevent livelocks
+		OGRE_MUTEX(mIdleMutex);
+		OGRE_MUTEX(mRequestMutex);
+		OGRE_MUTEX(mProcessMutex);
+		OGRE_MUTEX(mResponseMutex);
+		OGRE_RW_MUTEX(mRequestHandlerMutex);
+
+
+		void processRequestResponse(Request* r, bool synchronous);
+		Response* processRequest(Request* r);
+		void processResponse(Response* r);
+		/// Notify workers about a new request. 
+		virtual void notifyWorkers() = 0;
+		/// Put a Request on the queue with a specific RequestID.
+		void addRequestWithRID(RequestID rid, uint16 channel, uint16 requestType, const Any& rData, uint8 retryCount);
+		
+		RequestQueue mIdleRequestQueue; // Guarded by mIdleMutex
+		bool mIdleThreadRunning; // Guarded by mIdleMutex
+		Request* mIdleProcessed; // Guarded by mProcessMutex
+		
+
+		bool processIdleRequests();
+	};
+
+
+
+
+
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/OgreZip.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/OgreZip.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/OgreZip.h	(revision 148)
@@ -0,0 +1,205 @@
+/*
+-----------------------------------------------------------------------------
+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 __Zip_H__
+#define __Zip_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreArchive.h"
+#include "OgreArchiveFactory.h"
+#if OGRE_THREAD_SUPPORT
+#include "Threading/OgreThreadHeaders.h"
+#endif
+#include "OgreHeaderPrefix.h"
+
+// Forward declaration for zziplib to avoid header file dependency.
+typedef struct zzip_dir		ZZIP_DIR;
+typedef struct zzip_file	ZZIP_FILE;
+typedef union _zzip_plugin_io zzip_plugin_io_handlers;
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Resources
+	*  @{
+	*/
+	/** Specialisation of the Archive class to allow reading of files from a zip
+        format source archive.
+    @remarks
+        This archive format supports all archives compressed in the standard
+        zip format, including iD pk3 files.
+    */
+    class _OgreExport ZipArchive : public Archive 
+    {
+    protected:
+        /// Handle to root zip file
+        ZZIP_DIR* mZzipDir;
+        /// Handle any errors from zzip
+        void checkZzipError(int zzipError, const String& operation) const;
+        /// File list (since zziplib seems to only allow scanning of dir tree once)
+        FileInfoList mFileList;
+        /// A pointer to file io alternative implementation 
+        zzip_plugin_io_handlers* mPluginIo;
+
+        OGRE_AUTO_MUTEX;
+    public:
+        ZipArchive(const String& name, const String& archType, zzip_plugin_io_handlers* pluginIo = NULL);
+        ~ZipArchive();
+        /// @copydoc Archive::isCaseSensitive
+        bool isCaseSensitive(void) const { return false; }
+
+        /// @copydoc Archive::load
+        void load();
+        /// @copydoc Archive::unload
+        void unload();
+
+        /// @copydoc Archive::open
+        DataStreamPtr open(const String& filename, bool readOnly = true) const;
+
+		/// @copydoc Archive::create
+		DataStreamPtr create(const String& filename) const;
+
+		/// @copydoc Archive::remove
+		void remove(const String& filename) const;
+
+        /// @copydoc Archive::list
+        StringVectorPtr list(bool recursive = true, bool dirs = false);
+
+        /// @copydoc Archive::listFileInfo
+        FileInfoListPtr listFileInfo(bool recursive = true, bool dirs = false);
+
+        /// @copydoc Archive::find
+        StringVectorPtr find(const String& pattern, bool recursive = true,
+            bool dirs = false);
+
+        /// @copydoc Archive::findFileInfo
+        FileInfoListPtr findFileInfo(const String& pattern, bool recursive = true,
+            bool dirs = false) const;
+
+        /// @copydoc Archive::exists
+        bool exists(const String& filename);
+
+		/// @copydoc Archive::getModifiedTime
+		time_t getModifiedTime(const String& filename);
+    };
+
+    /** Specialisation of ArchiveFactory for Zip files. */
+    class _OgrePrivate ZipArchiveFactory : public ArchiveFactory
+    {
+    public:
+        virtual ~ZipArchiveFactory() {}
+        /// @copydoc FactoryObj::getType
+        const String& getType(void) const;
+        /// @copydoc FactoryObj::createInstance
+        Archive *createInstance( const String& name, bool readOnly ) 
+        {
+			if(!readOnly)
+				return NULL;
+
+            return OGRE_NEW ZipArchive(name, "Zip");
+        }
+        /// @copydoc FactoryObj::destroyInstance
+        void destroyInstance( Archive* ptr) { OGRE_DELETE ptr; }
+    };
+
+    /** Specialisation of ZipArchiveFactory for embedded Zip files. */
+    class _OgreExport EmbeddedZipArchiveFactory : public ZipArchiveFactory
+    {
+    protected:
+        /// A static pointer to file io alternative implementation for the embedded files
+        static zzip_plugin_io_handlers* mPluginIo; 
+    public:
+        EmbeddedZipArchiveFactory();
+        virtual ~EmbeddedZipArchiveFactory();
+        /// @copydoc FactoryObj::getType
+        const String& getType(void) const;
+        /// @copydoc FactoryObj::createInstance
+        Archive *createInstance( const String& name, bool readOnly ) 
+        {
+            ZipArchive * resZipArchive = OGRE_NEW ZipArchive(name, "EmbeddedZip", mPluginIo);
+            return resZipArchive;
+        }
+        
+        /** a function type to decrypt embedded zip file
+        @param pos pos in file
+        @param buf current buffer to decrypt
+        @param len - length of buffer
+        @return success
+        */  
+        typedef bool (*DecryptEmbeddedZipFileFunc)(size_t pos, void* buf, size_t len);
+
+        /// Add an embedded file to the embedded file list
+        static void addEmbbeddedFile(const String& name, const uint8 * fileData, 
+                        size_t fileSize, DecryptEmbeddedZipFileFunc decryptFunc);
+
+        /// Remove an embedded file to the embedded file list
+        static void removeEmbbeddedFile(const String& name);
+
+    };
+
+    /** Specialisation of DataStream to handle streaming data from zip archives. */
+    class _OgrePrivate ZipDataStream : public DataStream
+    {
+    protected:
+        ZZIP_FILE* mZzipFile;
+		/// We need caching because sometimes serializers step back in data stream and zziplib behaves slow
+		StaticCache<2 * OGRE_STREAM_TEMP_SIZE> mCache;
+    public:
+        /// Unnamed constructor
+        ZipDataStream(ZZIP_FILE* zzipFile, size_t uncompressedSize);
+        /// Constructor for creating named streams
+        ZipDataStream(const String& name, ZZIP_FILE* zzipFile, size_t uncompressedSize);
+		~ZipDataStream();
+        /// @copydoc DataStream::read
+        size_t read(void* buf, size_t count);
+		/// @copydoc DataStream::write
+		size_t write(void* buf, size_t count);
+        /// @copydoc DataStream::skip
+        void skip(long count);
+        /// @copydoc DataStream::seek
+        void seek( size_t pos );
+        /// @copydoc DataStream::seek
+        size_t tell(void) const;
+        /// @copydoc DataStream::eof
+        bool eof(void) const;
+        /// @copydoc DataStream::close
+        void close(void);
+
+
+    };
+
+	/** @} */
+	/** @} */
+
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreBorderPanelOverlayElement.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreBorderPanelOverlayElement.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreBorderPanelOverlayElement.h	(revision 148)
@@ -0,0 +1,352 @@
+/*
+-----------------------------------------------------------------------------
+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 __BorderPanelOverlayElement_H__
+#define __BorderPanelOverlayElement_H__
+
+#include "OgrePanelOverlayElement.h"
+
+namespace Ogre {
+    /** \addtogroup Core
+    *  @{
+    */
+    /** \addtogroup Overlays
+    *  @{
+    */
+
+    class BorderRenderable;
+    
+    /** A specialisation of the PanelOverlayElement to provide a panel with a border.
+    @remarks
+        Whilst the standard panel can use a single tiled material, this class allows
+        panels with a tileable backdrop plus a border texture. This is handy for large
+        panels that are too big to use a single large texture with a border, or
+        for multiple different size panels where you want the border a constant width
+        but the center to repeat.
+    @par
+        In addition to the usual PanelOverlayElement properties, this class has a 'border
+        material', which specifies the material used for the edges of the panel,
+        a border width (which can either be constant all the way around, or specified
+        per edge), and the texture coordinates for each of the border sections.
+    */
+    class _OgreOverlayExport BorderPanelOverlayElement : public PanelOverlayElement
+    {
+        friend class BorderRenderable;
+    public:
+        /** Constructor */
+        BorderPanelOverlayElement(const String& name);
+        virtual ~BorderPanelOverlayElement();
+
+        virtual void initialise(void);
+
+        const String& getTypeName(void) const;
+        /** Sets the size of the border.
+        @remarks
+            This method sets a constant size for all borders. There are also alternative
+            methods which allow you to set border widths for individual edges separately.
+            Remember that the dimensions specified here are in relation to the size of
+            the screen, so 0.1 is 1/10th of the screen width or height. Also note that because
+            most screen resolutions are 1.333:1 width:height ratio that using the same
+            border size will look slightly bigger across than up.
+        @param size The size of the border as a factor of the screen dimensions ie 0.2 is one-fifth
+            of the screen size.
+        */
+        void setBorderSize(Real size);
+
+        /** Sets the size of the border, with different sizes for vertical and horizontal borders.
+        @remarks
+            This method sets a size for the side and top / bottom borders separately. 
+            Remember that the dimensions specified here are in relation to the size of
+            the screen, so 0.1 is 1/10th of the screen width or height. Also note that because
+            most screen resolutions are 1.333:1 width:height ratio that using the same
+            border size will look slightly bigger across than up.
+        @param sides The size of the side borders as a factor of the screen dimensions ie 0.2 is one-fifth
+            of the screen size.
+        @param topAndBottom The size of the top and bottom borders as a factor of the screen dimensions.
+        */
+        void setBorderSize(Real sides, Real topAndBottom);
+
+        /** Sets the size of the border separately for all borders.
+        @remarks
+            This method sets a size all borders separately. 
+            Remember that the dimensions specified here are in relation to the size of
+            the screen, so 0.1 is 1/10th of the screen width or height. Also note that because
+            most screen resolutions are 1.333:1 width:height ratio that using the same
+            border size will look slightly bigger across than up.
+        @param left The size of the left border as a factor of the screen dimensions ie 0.2 is one-fifth
+            of the screen size.
+        @param right The size of the left border as a factor of the screen dimensions.
+        @param top The size of the top border as a factor of the screen dimensions.
+        @param bottom The size of the bottom border as a factor of the screen dimensions.
+        */
+        void setBorderSize(Real left, Real right, Real top, Real bottom);
+
+        /** Gets the size of the left border. */
+        Real getLeftBorderSize(void) const;
+        /** Gets the size of the right border. */
+        Real getRightBorderSize(void) const;
+        /** Gets the size of the top border. */
+        Real getTopBorderSize(void) const;
+        /** Gets the size of the bottom border. */
+        Real getBottomBorderSize(void) const;
+
+        /** Sets the texture coordinates for the left edge of the border.
+        @remarks
+            The border panel uses 8 panels for the border (9 including the center). 
+            Imagine a table with 3 rows and 3 columns. The corners are always the same size,
+            but the edges stretch depending on how big the panel is. Those who have done
+            resizable HTML tables will be familiar with this approach.
+        @par
+            We only require 2 sets of uv coordinates, one for the top-left and one for the
+            bottom-right of the panel, since it is assumed the sections are aligned on the texture.
+        */
+        void setLeftBorderUV(Real u1, Real v1, Real u2, Real v2);
+        /** Sets the texture coordinates for the right edge of the border. 
+        @remarks See setLeftBorderUV.
+        */
+        void setRightBorderUV(Real u1, Real v1, Real u2, Real v2);
+        /** Sets the texture coordinates for the top edge of the border. 
+        @remarks See setLeftBorderUV.
+        */
+        void setTopBorderUV(Real u1, Real v1, Real u2, Real v2);
+        /** Sets the texture coordinates for the bottom edge of the border. 
+        @remarks See setLeftBorderUV.
+        */
+        void setBottomBorderUV(Real u1, Real v1, Real u2, Real v2);
+        /** Sets the texture coordinates for the top-left corner of the border. 
+        @remarks See setLeftBorderUV.
+        */
+        void setTopLeftBorderUV(Real u1, Real v1, Real u2, Real v2);
+        /** Sets the texture coordinates for the top-right corner of the border. 
+        @remarks See setLeftBorderUV.
+        */
+        void setTopRightBorderUV(Real u1, Real v1, Real u2, Real v2);
+        /** Sets the texture coordinates for the bottom-left corner of the border. 
+        @remarks See setLeftBorderUV.
+        */
+        void setBottomLeftBorderUV(Real u1, Real v1, Real u2, Real v2);
+        /** Sets the texture coordinates for the bottom-right corner of the border. 
+        @remarks See setLeftBorderUV.
+        */
+        void setBottomRightBorderUV(Real u1, Real v1, Real u2, Real v2);
+
+        String getLeftBorderUVString() const;
+        String getRightBorderUVString() const;
+        String getTopBorderUVString() const;
+        String getBottomBorderUVString() const;
+        String getTopLeftBorderUVString() const;
+        String getTopRightBorderUVString() const;
+        String getBottomLeftBorderUVString() const;
+        String getBottomRightBorderUVString() const;
+
+
+
+
+        /** Sets the name of the material to use for the borders. */
+        void setBorderMaterialName(const String& name);
+        /** Gets the name of the material to use for the borders. */
+        const String& getBorderMaterialName(void) const;
+
+        /** @copydoc OverlayContainer::_updateRenderQueue */
+        void _updateRenderQueue(RenderQueue* queue);
+        /// @copydoc OverlayElement::visitRenderables
+        void visitRenderables(Renderable::Visitor* visitor, 
+            bool debugRenderables = false);
+
+        /** @copydoc OverlayElement::setMetricsMode */
+        void setMetricsMode(GuiMetricsMode gmm);
+
+        /** @copydoc OverlayElement::_update */
+        void _update(void);
+
+
+        /** Command object for specifying border sizes (see ParamCommand).*/
+        class _OgrePrivate CmdBorderSize : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /** Command object for specifying the Material for the border (see ParamCommand).*/
+        class _OgrePrivate CmdBorderMaterial : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /** Command object for specifying texture coordinates for the border (see ParamCommand).*/
+        class _OgrePrivate CmdBorderLeftUV : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /** Command object for specifying texture coordinates for the border (see ParamCommand).*/
+        class _OgrePrivate CmdBorderTopUV : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /** Command object for specifying texture coordinates for the border (see ParamCommand).*/
+        class _OgrePrivate CmdBorderRightUV : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /** Command object for specifying texture coordinates for the border (see ParamCommand).*/
+        class _OgrePrivate CmdBorderBottomUV : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /** Command object for specifying texture coordinates for the border (see ParamCommand).*/
+        class _OgrePrivate CmdBorderTopLeftUV : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /** Command object for specifying texture coordinates for the border (see ParamCommand).*/
+        class _OgrePrivate CmdBorderBottomLeftUV : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /** Command object for specifying texture coordinates for the border (see ParamCommand).*/
+        class _OgrePrivate CmdBorderBottomRightUV : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /** Command object for specifying texture coordinates for the border (see ParamCommand).*/
+        class _OgrePrivate CmdBorderTopRightUV : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+    protected:
+        Real mLeftBorderSize;
+        Real mRightBorderSize;
+        Real mTopBorderSize;
+        Real mBottomBorderSize;
+        struct CellUV {
+            Real u1, v1, u2, v2;
+        };
+        CellUV mBorderUV[8];
+
+        ushort mPixelLeftBorderSize;
+        ushort mPixelRightBorderSize;
+        ushort mPixelTopBorderSize;
+        ushort mPixelBottomBorderSize;
+
+        String mBorderMaterialName;
+        MaterialPtr mBorderMaterial;
+
+        /// Render operation for the border area
+        RenderOperation mRenderOp2;
+
+        static String msTypeName;
+
+        /// internal method for setting up geometry, called by OverlayElement::update
+        void updatePositionGeometry(void);
+        /// internal method for setting up geometry, called by OverlayElement::update
+        void updateTextureGeometry(void);
+        /// Internal method for setting up parameters
+        void addBaseParameters(void);
+
+        enum BorderCellIndex {
+            BCELL_TOP_LEFT = 0,
+            BCELL_TOP = 1,
+            BCELL_TOP_RIGHT = 2,
+            BCELL_LEFT = 3,
+            BCELL_RIGHT = 4,
+            BCELL_BOTTOM_LEFT = 5,
+            BCELL_BOTTOM = 6,
+            BCELL_BOTTOM_RIGHT = 7
+        };
+        String getCellUVString(BorderCellIndex idx) const;
+
+        // Command objects
+        static CmdBorderSize msCmdBorderSize;
+        static CmdBorderMaterial msCmdBorderMaterial;
+        static CmdBorderLeftUV msCmdBorderLeftUV;
+        static CmdBorderTopUV msCmdBorderTopUV;
+        static CmdBorderBottomUV msCmdBorderBottomUV;
+        static CmdBorderRightUV msCmdBorderRightUV;
+        static CmdBorderTopLeftUV msCmdBorderTopLeftUV;
+        static CmdBorderBottomLeftUV msCmdBorderBottomLeftUV;
+        static CmdBorderTopRightUV msCmdBorderTopRightUV;
+        static CmdBorderBottomRightUV msCmdBorderBottomRightUV;
+
+        BorderRenderable* mBorderRenderable;
+    };
+
+    /** Class for rendering the border of a BorderPanelOverlayElement.
+    @remarks
+        We need this because we have to render twice, once with the inner panel's repeating
+        material (handled by superclass) and once for the border's separate material. 
+    */
+    class _OgreOverlayExport BorderRenderable : public Renderable, public OverlayAlloc
+    {
+    protected:
+        BorderPanelOverlayElement* mParent;
+    public:
+        /** Constructed with pointers to parent. */
+        BorderRenderable(BorderPanelOverlayElement* parent) : mParent(parent)
+        {
+            mUseIdentityProjection = true;
+            mUseIdentityView = true;
+        }
+        const MaterialPtr& getMaterial(void) const { return mParent->mBorderMaterial; }
+        void getRenderOperation(RenderOperation& op) { op = mParent->mRenderOp2; }
+        void getWorldTransforms(Matrix4* xform) const { mParent->getWorldTransforms(xform); }
+        unsigned short getNumWorldTransforms(void) const { return 1; }
+        Real getSquaredViewDepth(const Camera* cam) const { return mParent->getSquaredViewDepth(cam); }
+        const LightList& getLights(void) const
+        {
+            // N/A, panels are not lit
+            static LightList ll;
+            return ll;
+        }
+        bool getPolygonModeOverrideable(void) const
+        {
+            return mParent->getPolygonModeOverrideable();
+        }
+    };
+    /** @} */
+    /** @} */
+
+} // namespace Ogre
+
+#endif // __BorderPanelOverlayElement_H__
Index: /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreFont.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreFont.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreFont.h	(revision 148)
@@ -0,0 +1,423 @@
+/*-------------------------------------------------------------------------
+This source file is a 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 _Font_H__
+#define _Font_H__
+
+#include "OgreOverlayPrerequisites.h"
+#include "OgreResource.h"
+#include "OgreTexture.h"
+#include "OgreMaterial.h"
+#include "OgreCommon.h"
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Resources
+	*  @{
+	*/
+	/** Enumerates the types of Font usable in the engine. */
+    enum FontType
+    {
+        /// Generated from a truetype (.ttf) font
+        FT_TRUETYPE = 1,
+        /// Loaded from an image created by an artist
+        FT_IMAGE = 2
+    };
+
+
+    /** Class representing a font in the system.
+    @remarks
+    This class is simply a way of getting a font texture into the OGRE system and
+    to easily retrieve the texture coordinates required to accurately render them.
+    Fonts can either be loaded from precreated textures, or the texture can be generated
+    using a truetype font. You can either create the texture manually in code, or you
+    can use a .fontdef script to define it (probably more practical since you can reuse
+    the definition more easily)
+	@note
+	This class extends both Resource and ManualResourceLoader since it is
+	both a resource in it's own right, but it also provides the manual load
+	implementation for the Texture it creates.
+    */
+	class _OgreOverlayExport Font : public Resource, public ManualResourceLoader
+    {
+    protected:
+		/// Command object for Font - see ParamCommand 
+		class _OgreOverlayExport CmdType : public ParamCommand
+		{
+		public:
+			String doGet(const void* target) const;
+			void doSet(void* target, const String& val);
+		};
+		/// Command object for Font - see ParamCommand 
+		class _OgreOverlayExport CmdSource : public ParamCommand
+		{
+		public:
+			String doGet(const void* target) const;
+			void doSet(void* target, const String& val);
+		};
+ 		class _OgreOverlayExport CmdCharSpacer : public ParamCommand
+ 		{
+ 		public:
+ 			String doGet(const void* target) const;
+ 			void doSet(void* target, const String& val);
+ 		};
+        /// Command object for Font - see ParamCommand 
+		class _OgreOverlayExport CmdSize : public ParamCommand
+		{
+		public:
+			String doGet(const void* target) const;
+			void doSet(void* target, const String& val);
+		};
+		/// Command object for Font - see ParamCommand 
+		class _OgreOverlayExport CmdResolution : public ParamCommand
+		{
+		public:
+			String doGet(const void* target) const;
+			void doSet(void* target, const String& val);
+		};
+		/// Command object for Font - see ParamCommand 
+		class _OgreOverlayExport CmdCodePoints : public ParamCommand
+		{
+		public:
+			String doGet(const void* target) const;
+			void doSet(void* target, const String& val);
+		};
+
+		// Command object for setting / getting parameters
+		static CmdType msTypeCmd;
+		static CmdSource msSourceCmd;
+ 		static CmdCharSpacer msCharacterSpacerCmd;
+		static CmdSize msSizeCmd;
+		static CmdResolution msResolutionCmd;
+		static CmdCodePoints msCodePointsCmd;
+
+		/// The type of font
+        FontType mType;
+
+        /// Source of the font (either an image name or a truetype font)
+        String mSource;
+
+        /** Add a gap between letters vertically and horizonally
+            prevents nasty artifacts caused by fonts atypically wide or tall characters. */
+        uint mCharacterSpacer;
+
+        /// Size of the truetype font, in points
+        Real mTtfSize;
+        /// Resolution (dpi) of truetype font
+        uint mTtfResolution;
+		/// Max distance to baseline of this (truetype) font
+		int mTtfMaxBearingY;
+
+
+	public:
+		typedef Ogre::uint32 CodePoint;
+		typedef Ogre::FloatRect UVRect;
+		/// Information about the position and size of a glyph in a texture
+		struct GlyphInfo 
+		{
+			CodePoint codePoint;
+			UVRect uvRect;
+			Real aspectRatio;
+
+			GlyphInfo(CodePoint id, const UVRect& rect, Real aspect)
+				: codePoint(id), uvRect(rect), aspectRatio(aspect)
+			{
+
+			}
+		};
+		/// A range of code points, inclusive on both ends
+		typedef std::pair<CodePoint, CodePoint> CodePointRange;
+		typedef vector<CodePointRange>::type CodePointRangeList;
+	protected:
+		/// Map from unicode code point to texture coordinates
+		typedef map<CodePoint, GlyphInfo>::type CodePointMap;
+		CodePointMap mCodePointMap;
+
+        /// The material which is generated for this font
+        MaterialPtr mMaterial;
+
+		/// Texture pointer
+		TexturePtr mTexture;
+
+        /// for TRUE_TYPE font only
+        bool mAntialiasColour;
+
+		/// Range of code points to generate glyphs for (truetype only)
+		CodePointRangeList mCodePointRangeList;
+
+        /// Internal method for loading from ttf
+        void createTextureFromFont(void);
+
+		/// @copydoc Resource::loadImpl
+		virtual void loadImpl();
+		/// @copydoc Resource::unloadImpl
+		virtual void unloadImpl();
+		/// @copydoc Resource::calculateSize
+		size_t calculateSize(void) const { return 0; } // permanent resource is in the texture 
+    public:
+
+        /** Constructor.
+		@see Resource
+        */
+		Font(ResourceManager* creator, const String& name, ResourceHandle handle,
+			const String& group, bool isManual = false, ManualResourceLoader* loader = 0);
+        virtual ~Font();
+
+        /** Sets the type of font. Must be set before loading. */
+        void setType(FontType ftype);
+
+        /** Gets the type of font. */
+        FontType getType(void) const;
+
+        /** Sets the source of the font.
+        @remarks
+            If you have created a font of type FT_IMAGE, this method tells the
+            Font which image to use as the source for the characters. So the parameter 
+            should be the name of an appropriate image file. Note that when using an image
+            as a font source, you will also need to tell the font where each character is
+            located using setGlyphTexCoords (for each character).
+        @par
+            If you have created a font of type FT_TRUETYPE, this method tells the
+            Font which .ttf file to use to generate the text. You will also need to call 
+            setTrueTypeSize and setTrueTypeResolution, and call addCodePointRange
+			as many times as required to define the range of glyphs you want to be
+			available.
+        @param source An image file or a truetype font, depending on the type of this font
+        */
+        void setSource(const String& source);
+
+        /** Gets the source this font (either an image or a truetype font).
+        */
+        const String& getSource(void) const;
+
+        /** Sets the spacing to allocate for font characters to overlap each other.
+        @param charSpacer The size of the character spacer, in points.  Increasing it
+            allows for more stretched-out fonts; decreasing it reduces memory and processing
+            time.  The default is "5".
+        */
+        void setCharacterSpacer(uint charSpacer);
+ 
+        /** Gets the spacing to allocate for font characters to overlap each other.
+        @remarks Returns the size of the character spacer, in points.  A higher value
+            allows for more stretched-out fonts.  A low value reduces memory and processing
+            time.  The default is "5".
+        */
+        uint getCharacterSpacer(void) const;
+
+        /** Sets the size of a truetype font (only required for FT_TRUETYPE). 
+        @param ttfSize The size of the font in points. Note that the
+            size of the font does not affect how big it is on the screen, just how large it is in
+            the texture and thus how detailed it is.
+        */
+        void setTrueTypeSize(Real ttfSize);
+        /** Gets the resolution (dpi) of the font used to generate the texture
+        (only required for FT_TRUETYPE).
+        @param ttfResolution The resolution in dpi
+        */
+        void setTrueTypeResolution(uint ttfResolution);
+
+        /** Gets the point size of the font used to generate the texture.
+        @remarks
+            Only applicable for FT_TRUETYPE Font objects.
+            Note that the size of the font does not affect how big it is on the screen, 
+            just how large it is in the texture and thus how detailed it is.            
+        */
+        Real getTrueTypeSize(void) const;
+        /** Gets the resolution (dpi) of the font used to generate the texture.
+        @remarks
+            Only applicable for FT_TRUETYPE Font objects.
+        */
+        uint getTrueTypeResolution(void) const;
+		/** Gets the maximum baseline distance of all glyphs used in the texture.
+		@remarks
+			Only applicable for FT_TRUETYPE Font objects.
+			The baseline is the vertical origin of horizontal based glyphs.  The bearingY
+			attribute is the distance from the baseline (origin) to the top of the glyph's 
+			bounding box.
+		@note
+			This value is only available after the font has been loaded.
+		*/
+		int getTrueTypeMaxBearingY() const;
+
+
+        /** Returns the texture coordinates of the associated glyph. 
+            @remarks Parameter is a short to allow both ASCII and wide chars.
+            @param id The code point (unicode)
+            @return A rectangle with the UV coordinates, or null UVs if the
+				code point was not present
+        */
+        inline const UVRect& getGlyphTexCoords(CodePoint id) const
+        {
+			CodePointMap::const_iterator i = mCodePointMap.find(id);
+			if (i != mCodePointMap.end())
+			{
+				return i->second.uvRect;
+			}
+			else
+			{
+				static UVRect nullRect(0.0, 0.0, 0.0, 0.0);
+				return nullRect;
+			}
+        }
+
+        /** Sets the texture coordinates of a glyph.
+        @remarks
+            You only need to call this if you're setting up a font loaded from a texture manually.
+        @note
+            Also sets the aspect ratio (width / height) of this character. textureAspect
+			is the width/height of the texture (may be non-square)
+        */
+        inline void setGlyphTexCoords(CodePoint id, Real u1, Real v1, Real u2, Real v2, Real textureAspect)
+        {
+			CodePointMap::iterator i = mCodePointMap.find(id);
+			if (i != mCodePointMap.end())
+			{
+				i->second.uvRect.left = u1;
+				i->second.uvRect.top = v1;
+				i->second.uvRect.right = u2;
+				i->second.uvRect.bottom = v2;
+				i->second.aspectRatio = textureAspect * (u2 - u1)  / (v2 - v1);
+			}
+			else
+			{
+				mCodePointMap.insert(
+					CodePointMap::value_type(id, 
+						GlyphInfo(id, UVRect(u1, v1, u2, v2), 
+							textureAspect * (u2 - u1)  / (v2 - v1))));
+			}
+
+        }
+        /** Gets the aspect ratio (width / height) of this character. */
+        inline Real getGlyphAspectRatio(CodePoint id) const
+        {
+			CodePointMap::const_iterator i = mCodePointMap.find(id);
+			if (i != mCodePointMap.end())
+			{
+				return i->second.aspectRatio;
+			}
+			else
+			{
+				return 1.0;
+			}
+        }
+        /** Sets the aspect ratio (width / height) of this character.
+        @remarks
+            You only need to call this if you're setting up a font loaded from a 
+			texture manually.
+        */
+        inline void setGlyphAspectRatio(CodePoint id, Real ratio)
+        {
+			CodePointMap::iterator i = mCodePointMap.find(id);
+			if (i != mCodePointMap.end())
+			{
+				i->second.aspectRatio = ratio;
+			}
+        }
+
+		/** Gets the information available for a glyph corresponding to a
+			given code point, or throws an exception if it doesn't exist;
+		*/
+		const GlyphInfo& getGlyphInfo(CodePoint id) const;
+
+		/** Adds a range of code points to the list of code point ranges to generate
+			glyphs for, if this is a truetype based font.
+		@remarks
+			In order to save texture space, only the glyphs which are actually
+			needed by the application are generated into the texture. Before this
+			object is loaded you must call this method as many times as necessary
+			to define the code point range that you need.
+		*/
+		void addCodePointRange(const CodePointRange& range)
+		{
+			mCodePointRangeList.push_back(range);
+		}
+
+		/** Clear the list of code point ranges.
+		*/
+		void clearCodePointRanges()
+		{
+			mCodePointRangeList.clear();
+		}
+		/** Get a const reference to the list of code point ranges to be used to
+			generate glyphs from a truetype font.
+		*/
+		const CodePointRangeList& getCodePointRangeList() const
+		{
+			return mCodePointRangeList;
+		}
+        /** Gets the material generated for this font, as a weak reference. 
+        @remarks
+            This will only be valid after the Font has been loaded. 
+        */
+        inline const MaterialPtr& getMaterial() const
+        {
+            return mMaterial;
+        }
+        /** Gets the material generated for this font, as a weak reference. 
+        @remarks
+            This will only be valid after the Font has been loaded. 
+        */
+        inline const MaterialPtr& getMaterial()
+        {
+            return mMaterial;
+        }
+        /** Sets whether or not the colour of this font is antialiased as it is generated
+            from a true type font.
+        @remarks
+        	This is valid only for a FT_TRUETYPE font. If you are planning on using 
+            alpha blending to draw your font, then it is a good idea to set this to
+            false (which is the default), otherwise the darkening of the font will combine
+            with the fading out of the alpha around the edges and make your font look thinner
+            than it should. However, if you intend to blend your font using a colour blending
+            mode (add or modulate for example) then it's a good idea to set this to true, in
+            order to soften your font edges.
+        */
+        inline void setAntialiasColour(bool enabled)
+        {
+        	mAntialiasColour = enabled;
+        }
+
+		/** Gets whether or not the colour of this font is antialiased as it is generated
+		from a true type font.
+		*/
+        inline bool getAntialiasColour(void) const
+        {
+            return mAntialiasColour;
+        }
+
+		/** Implementation of ManualResourceLoader::loadResource, called
+			when the Texture that this font creates needs to (re)load.
+		*/
+		void loadResource(Resource* resource);
+    };
+	/** @} */
+	/** @} */
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreFontManager.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreFontManager.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreFontManager.h	(revision 148)
@@ -0,0 +1,113 @@
+/*-------------------------------------------------------------------------
+This source file is a 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 _FontManager_H__
+#define _FontManager_H__
+
+#include "OgreOverlayPrerequisites.h"
+#include "OgreSingleton.h"
+#include "OgreResourceManager.h"
+#include "OgreFont.h"
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Resources
+	*  @{
+	*/
+	/** Manages Font resources, parsing .fontdef files and generally organising them.*/
+    class _OgreOverlayExport FontManager : public ResourceManager, public Singleton< FontManager >
+    {
+    public:
+
+		FontManager();
+		~FontManager();
+
+		/// Create a new font
+		/// @see ResourceManager::createResource
+		FontPtr create (const String& name, const String& group,
+							bool isManual = false, ManualResourceLoader* loader = 0,
+							const NameValuePairList* createParams = 0);
+
+		/// Get a resource by name
+		/// @see ResourceManager::getResourceByName
+		FontPtr getByName(const String& name, const String& groupName = ResourceGroupManager::AUTODETECT_RESOURCE_GROUP_NAME);
+
+
+        /** @copydoc ScriptLoader::parseScript */
+        void parseScript(DataStreamPtr& stream, const String& groupName);
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static FontManager& getSingleton(void);
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static FontManager* getSingletonPtr(void);
+
+    protected:
+
+        /// Internal methods
+		Resource* createImpl(const String& name, ResourceHandle handle, 
+			const String& group, bool isManual, ManualResourceLoader* loader, 
+            const NameValuePairList* params);
+		void parseAttribute(const String& line, FontPtr& pFont);
+
+        void logBadAttrib(const String& line, FontPtr& pFont);
+
+
+    };
+	/** @} */
+	/** @} */
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreOverlay.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreOverlay.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreOverlay.h	(revision 148)
@@ -0,0 +1,281 @@
+/*
+-----------------------------------------------------------------------------
+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 __Overlay_H__
+#define __Overlay_H__
+
+#include "OgreOverlayPrerequisites.h"
+#include "OgreSceneNode.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreMatrix4.h"
+
+namespace Ogre {
+
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Overlays
+	*  @{
+	*/
+	/** Represents a layer which is rendered on top of the 'normal' scene contents.
+    @remarks
+        An overlay is a container for visual components (2D and 3D) which will be 
+        rendered after the main scene in order to composite heads-up-displays, menus
+        or other layers on top of the contents of the scene.
+    @par
+        An overlay always takes up the entire size of the viewport, although the 
+        components attached to it do not have to. An overlay has no visual element
+        in itself, it it merely a container for visual elements.
+    @par
+        Overlays are created by calling OverlayManager::create, or by defining them
+        in special text scripts (.overlay files). As many overlays
+        as you like can be defined; after creation an overlay is hidden i.e. not
+        visible until you specifically enable it by calling 'show'. This allows you to have multiple
+        overlays predefined (menus etc) which you make visible only when you want.
+        It is possible to have multiple overlays enabled at once; in this case the
+        relative 'zorder' parameter of the overlays determine which one is displayed
+        on top.
+    @par
+        By default overlays are rendered into all viewports. This is fine when you only
+        have fullscreen viewports, but if you have picture-in-picture views, you probably
+        don't want the overlay displayed in the smaller viewports. You turn this off for 
+        a specific viewport by calling the Viewport::setDisplayOverlays method.
+    */
+	class _OgreOverlayExport Overlay : public OverlayAlloc
+    {
+
+    public:
+              typedef list<OverlayContainer*>::type OverlayContainerList;
+    protected:
+        String mName;
+        /// Internal root node, used as parent for 3D objects
+        SceneNode* mRootNode;
+        /** 2D elements
+            OverlayContainers, linked list for easy sorting by zorder later
+            Not a map because sort can be saved since changes infrequent (unlike render queue) */
+        OverlayContainerList m2DElements;
+
+        /// Degrees of rotation around center
+        Radian mRotate;
+        /// Scroll values, offsets
+        Real mScrollX, mScrollY;
+        /// Scale values
+        Real mScaleX, mScaleY;
+
+        mutable Matrix4 mTransform;
+        mutable bool mTransformOutOfDate;
+        bool mTransformUpdated;
+        ulong mZOrder;
+        bool mVisible;
+		bool mInitialised;
+		String mOrigin;
+        /** Internal lazy update method. */
+        void updateTransform(void) const;
+		/** Internal method for initialising an overlay */
+		void initialise(void);
+		/** Internal method for updating container elements' Z-ordering */
+		void assignZOrders(void);
+
+    public:
+        /// Constructor: do not call direct, use OverlayManager::create
+        Overlay(const String& name);
+        virtual ~Overlay();
+
+
+	    OverlayContainer* getChild(const String& name);
+
+        /** Gets the name of this overlay. */
+        const String& getName(void) const;
+        
+        /** Alters the Z-order of this overlay. 
+        @remarks
+            Values between 0 and 650 are valid here.
+        */
+        void setZOrder(ushort zorder);
+        /** Gets the Z-order of this overlay. */
+        ushort getZOrder(void) const;
+
+        /** Gets whether the overlay is displayed or not. */
+        bool isVisible(void) const;
+
+		/** Gets whether the overlay is initialised or not. */
+		bool isInitialised(void) const { return mInitialised; }
+
+		/** Shows the overlay if it was hidden. */
+        void show(void);
+
+        /** Hides the overlay if it was visible. */
+        void hide(void);
+
+        /** Adds a 2D 'container' to the overlay.
+        @remarks
+            Containers are created and managed using the OverlayManager. A container
+            could be as simple as a square panel, or something more complex like
+            a grid or tree view. Containers group collections of other elements,
+            giving them a relative coordinate space and a common z-order.
+            If you want to attach a GUI widget to an overlay, you have to do it via
+            a container.
+        @param cont Pointer to a container to add, created using OverlayManager.
+        */
+        void add2D(OverlayContainer* cont);
+
+
+        /** Removes a 2D container from the overlay. 
+        @remarks
+            NOT FAST. Consider OverlayElement::hide.
+        */
+        void remove2D(OverlayContainer* cont);
+
+        /** Adds a node capable of holding 3D objects to the overlay.
+        @remarks    
+            Although overlays are traditionally associated with 2D elements, there 
+            are reasons why you might want to attach 3D elements to the overlay too.
+            For example, if you wanted to have a 3D cockpit, which was overlaid with a
+            HUD, then you would create 2 overlays, one with a 3D object attached for the
+            cockpit, and one with the HUD elements attached (the zorder of the HUD 
+            overlay would be higher than the cockpit to ensure it was always on top).
+        @par    
+            A SceneNode can have any number of 3D objects attached to it. SceneNodes
+            are usually created using SceneManager::createSceneNode, but in this case
+			you should create a standard SceneNode instance <b>manually</b>; this is
+			because these scene nodes are not managed by the SceneManager and some custom
+			SceneManager plugins will rely on specialist behaviour the overlay does not
+			support. By attaching a SceneNode to an overlay, you indicate that:<OL>
+            <LI>You want the contents of this node to only appear when the overlay is active</LI>
+            <LI>You want the node to inherit a coordinate space relative to the camera,
+                rather than relative to the root scene node</LI>
+            <LI>You want these objects to be rendered after the contents of the main scene
+                to ensure they are rendered on top</LI>
+            </OL>
+            One major consideration when using 3D objects in overlays is the behaviour of 
+            the depth buffer. Overlays should use materials with depth checking off, to ensure
+            that their contents are always displayed on top of the main scene (to do 
+            otherwise would result in objects 'poking through' the overlay). The problem
+            with using 3D objects is that if they are concave, or self-overlap, then you
+            can get artefacts because of the lack of depth buffer checking. So you should 
+            ensure that any 3D objects you us in the overlay are convex, and don't overlap
+            each other. If they must overlap, split them up and put them in 2 overlays.
+			Alternatively, use a 2D element underneath them which will clear the depth buffer
+			values underneath ready for the 3D element to be rendered correctly.
+        */
+        void add3D(SceneNode* node);
+
+        /** Removes a 3D element from the overlay. */
+        void remove3D(SceneNode* node);
+
+        /** Clears the overlay of all attached items. */
+        void clear();
+
+        /** Sets the scrolling factor of this overlay.
+        @remarks
+            You can use this to set an offset to be used to scroll an 
+            overlay around the screen.
+        @param x Horizontal scroll value, where 0 = normal, -0.5 = scroll so that only
+            the right half the screen is visible etc
+        @param y Vertical scroll value, where 0 = normal, 0.5 = scroll down by half 
+            a screen etc.
+        */
+        void setScroll(Real x, Real y);
+
+        /** Gets the current X scroll value */
+        Real getScrollX(void) const;
+
+        /** Gets the current Y scroll value */
+        Real getScrollY(void) const;
+
+        /** Scrolls the overlay by the offsets provided.
+        @remarks
+            This method moves the overlay by the amounts provided. As with
+            other methods on this object, a full screen width / height is represented
+            by the value 1.0.
+        */
+        void scroll(Real xoff, Real yoff);
+
+        /** Sets the rotation applied to this overlay.*/
+        void setRotate(const Radian& angle);
+
+        /** Gets the rotation applied to this overlay, in degrees.*/
+        const Radian &getRotate(void) const { return mRotate; }
+
+        /** Adds the passed in angle to the rotation applied to this overlay. */
+        void rotate(const Radian& angle);
+
+        /** Sets the scaling factor of this overlay.
+        @remarks
+            You can use this to set an scale factor to be used to zoom an 
+            overlay.
+        @param x Horizontal scale value, where 1.0 = normal, 0.5 = half size etc
+        @param y Vertical scale value, where 1.0 = normal, 0.5 = half size etc
+        */
+        void setScale(Real x, Real y);
+
+        /** Gets the current X scale value */
+        Real getScaleX(void) const;
+
+        /** Gets the current Y scale value */
+        Real getScaleY(void) const;
+
+        /** Used to transform the overlay when scrolling, scaling etc. */
+        void _getWorldTransforms(Matrix4* xform) const;
+
+        /** Internal method to put the overlay contents onto the render queue. */
+        void _findVisibleObjects(Camera* cam, RenderQueue* queue);
+
+        /** This returns a OverlayElement at position x,y. */
+		virtual OverlayElement* findElementAt(Real x, Real y);
+
+        /** Returns an iterator over all 2D elements in this manager.
+        @remarks
+            VectorIterator is actually a too generic name, since it also works for lists.
+        */
+        typedef VectorIterator<OverlayContainerList> Overlay2DElementsIterator ;
+        Overlay2DElementsIterator get2DElementsIterator ()
+        {
+            return Overlay2DElementsIterator (m2DElements.begin(), m2DElements.end());
+        }
+		/** Get the origin of this overlay, e.g. a script file name.
+		@remarks
+			This property will only contain something if the creator of
+			this overlay chose to populate it. Script loaders are advised
+			to populate it.
+		*/
+		const String& getOrigin(void) const { return mOrigin; }
+		/// Notify this overlay of it's origin
+		void _notifyOrigin(const String& origin) { mOrigin = origin; }
+
+
+    };
+	/** @} */
+	/** @} */
+
+}
+
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreOverlayContainer.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreOverlayContainer.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreOverlayContainer.h	(revision 148)
@@ -0,0 +1,152 @@
+/*
+-----------------------------------------------------------------------------
+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 __OverlayContainer_H__
+#define __OverlayContainer_H__
+
+#include "OgreOverlayPrerequisites.h"
+#include "OgreOverlayElement.h"
+#include "OgreIteratorWrappers.h"
+
+
+namespace Ogre {
+
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Overlays
+	*  @{
+	*/
+	/** A 2D element which contains other OverlayElement instances.
+    @remarks
+        This is a specialisation of OverlayElement for 2D elements that contain other
+        elements. These are also the smallest elements that can be attached directly
+        to an Overlay.
+    @remarks
+        OverlayContainers should be managed using OverlayManager. This class is responsible for
+        instantiating / deleting elements, and also for accepting new types of element
+        from plugins etc.
+    */
+    class _OgreOverlayExport OverlayContainer : public OverlayElement
+    {
+    public:
+        typedef map<String, OverlayElement*>::type ChildMap;
+        typedef MapIterator<ChildMap> ChildIterator;
+        typedef map<String, OverlayContainer*>::type ChildContainerMap;
+        typedef MapIterator<ChildContainerMap> ChildContainerIterator;
+    protected:
+        /// Map of all children
+        ChildMap mChildren;
+        /// Map of container children (subset of mChildren)
+        ChildContainerMap mChildContainers;
+
+		bool mChildrenProcessEvents;
+ 
+    public:
+        /// Constructor: do not call direct, use OverlayManager::createOverlayElement
+        OverlayContainer(const String& name);
+        virtual ~OverlayContainer();
+
+        /** Adds another OverlayElement to this container. */
+        virtual void addChild(OverlayElement* elem);
+        /** Adds another OverlayElement to this container. */
+        virtual void addChildImpl(OverlayElement* elem);
+        /** Add a nested container to this container. */
+        virtual void addChildImpl(OverlayContainer* cont);
+        /** Removes a named element from this container. */
+        virtual void removeChild(const String& name);
+        /** Gets the named child of this container. */
+        virtual OverlayElement* getChild(const String& name);
+
+		/** @copydoc OverlayElement::initialise */
+		void initialise(void);
+
+        void _addChild(OverlayElement* elem);
+        void _removeChild(OverlayElement* elem) { _removeChild(elem->getName()); }
+        void _removeChild(const String& name);
+
+        /** Gets an object for iterating over all the children of this object. */
+        virtual ChildIterator getChildIterator(void);
+
+        /** Gets an iterator for just the container children of this object.
+        @remarks
+            Good for cascading updates without having to use RTTI
+        */
+        virtual ChildContainerIterator getChildContainerIterator(void);
+
+		/** Tell the object and its children to recalculate */
+		virtual void _positionsOutOfDate(void);
+
+        /** Overridden from OverlayElement. */
+        virtual void _update(void);
+
+        /** Overridden from OverlayElement. */
+        virtual ushort _notifyZOrder(ushort newZOrder);
+
+        /** Overridden from OverlayElement. */
+        virtual void _notifyViewport();
+
+        /** Overridden from OverlayElement. */
+        virtual void _notifyWorldTransforms(const Matrix4& xform);
+
+        /** Overridden from OverlayElement. */
+	    virtual void _notifyParent(OverlayContainer* parent, Overlay* overlay);
+
+        /** Overridden from OverlayElement. */
+        virtual void _updateRenderQueue(RenderQueue* queue);
+
+        /** Overridden from OverlayElement. */
+		inline bool isContainer() const
+		{ return true; }
+
+		/** Should this container pass events to their children */
+		virtual inline bool isChildrenProcessEvents() const
+		{ return true; }
+
+		/** Should this container pass events to their children */
+		virtual inline void setChildrenProcessEvents(bool val)
+		{ mChildrenProcessEvents = val; }
+
+        /** This returns a OverlayElement at position x,y. */
+		virtual OverlayElement* findElementAt(Real x, Real y);		// relative to parent
+
+	    void copyFromTemplate(OverlayElement* templateOverlay);
+        virtual OverlayElement* clone(const String& instanceName);
+
+    };
+
+
+	/** @} */
+	/** @} */
+
+}
+
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreOverlayElement.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreOverlayElement.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreOverlayElement.h	(revision 148)
@@ -0,0 +1,500 @@
+/*
+-----------------------------------------------------------------------------
+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 __OverlayElement_H__
+#define __OverlayElement_H__
+
+#include "OgreOverlayPrerequisites.h"
+#include "OgreString.h"
+#include "OgreRenderable.h"
+#include "OgreUTFString.h"
+#include "OgreStringInterface.h"
+#include "OgreOverlayElementCommands.h"
+
+#include "OgreColourValue.h"
+
+namespace Ogre {
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Overlays
+	*  @{
+	*/
+
+#if OGRE_UNICODE_SUPPORT
+	typedef UTFString DisplayString;
+#	define OGRE_DEREF_DISPLAYSTRING_ITERATOR(it) it.getCharacter()
+#else
+	typedef String DisplayString;
+#	define OGRE_DEREF_DISPLAYSTRING_ITERATOR(it) *it
+#endif
+    /** Enum describing how the position / size of an element is to be recorded. 
+    */
+    enum GuiMetricsMode
+    {
+        /// 'left', 'top', 'height' and 'width' are parametrics from 0.0 to 1.0
+        GMM_RELATIVE,
+        /// Positions & sizes are in absolute pixels
+        GMM_PIXELS,
+        /// Positions & sizes are in virtual pixels
+        GMM_RELATIVE_ASPECT_ADJUSTED
+    };
+
+    /** Enum describing where '0' is in relation to the parent in the horizontal dimension.
+    @remarks Affects how 'left' is interpreted.
+    */
+    enum GuiHorizontalAlignment
+    {
+        GHA_LEFT,
+        GHA_CENTER,
+        GHA_RIGHT
+    };
+    /** Enum describing where '0' is in relation to the parent in the vertical dimension.
+    @remarks Affects how 'top' is interpreted.
+    */
+    enum GuiVerticalAlignment
+    {
+        GVA_TOP,
+        GVA_CENTER,
+        GVA_BOTTOM
+    };
+
+    /** Abstract definition of a 2D element to be displayed in an Overlay.
+    @remarks
+    This class abstracts all the details of a 2D element which will appear in
+    an overlay. In fact, not all OverlayElement instances can be directly added to an
+    Overlay, only those which are OverlayContainer instances (a subclass of this class).
+    OverlayContainer objects can contain any OverlayElement however. This is just to 
+    enforce some level of grouping on widgets.
+    @par
+    OverlayElements should be managed using OverlayManager. This class is responsible for
+    instantiating / deleting elements, and also for accepting new types of element
+    from plugins etc.
+    @par
+    Note that positions / dimensions of 2D screen elements are expressed as parametric
+    values (0.0 - 1.0) because this makes them resolution-independent. However, most
+    screen resolutions have an aspect ratio of 1.3333:1 (width : height) so note that
+    in physical pixels 0.5 is wider than it is tall, so a 0.5x0.5 panel will not be
+    square on the screen (but it will take up exactly half the screen in both dimensions).
+    @par
+    Because this class is designed to be extensible, it subclasses from StringInterface
+    so its parameters can be set in a generic way.
+    */
+    class _OgreOverlayExport OverlayElement : public StringInterface, public Renderable, public OverlayAlloc
+    {
+    public:
+
+    protected:
+        // Command object for setting / getting parameters
+        static OverlayElementCommands::CmdLeft msLeftCmd;
+        static OverlayElementCommands::CmdTop msTopCmd;
+        static OverlayElementCommands::CmdWidth msWidthCmd;
+        static OverlayElementCommands::CmdHeight msHeightCmd;
+        static OverlayElementCommands::CmdMaterial msMaterialCmd;
+        static OverlayElementCommands::CmdCaption msCaptionCmd;
+        static OverlayElementCommands::CmdMetricsMode msMetricsModeCmd;
+        static OverlayElementCommands::CmdHorizontalAlign msHorizontalAlignCmd;
+        static OverlayElementCommands::CmdVerticalAlign msVerticalAlignCmd;
+        static OverlayElementCommands::CmdVisible msVisibleCmd;
+
+
+        String mName;
+        bool mVisible;
+        bool mCloneable;
+        Real mLeft;
+        Real mTop;
+        Real mWidth;
+        Real mHeight;
+        String mMaterialName;
+        MaterialPtr mMaterial;
+        DisplayString mCaption;
+        ColourValue mColour;
+        RealRect mClippingRegion;
+
+        GuiMetricsMode mMetricsMode;
+        GuiHorizontalAlignment mHorzAlign;
+        GuiVerticalAlignment mVertAlign;
+
+        // metric-mode positions, used in GMM_PIXELS & GMM_RELATIVE_ASPECT_ADJUSTED mode.
+        Real mPixelTop;
+        Real mPixelLeft;
+        Real mPixelWidth;
+        Real mPixelHeight;
+        Real mPixelScaleX;
+        Real mPixelScaleY;
+
+        /// Parent pointer
+        OverlayContainer* mParent;
+        /// Overlay attached to
+        Overlay* mOverlay;
+
+        // Derived positions from parent
+        Real mDerivedLeft;
+        Real mDerivedTop;
+        bool mDerivedOutOfDate;
+
+        /// Flag indicating if the vertex positions need recalculating
+        bool mGeomPositionsOutOfDate;
+		/// Flag indicating if the vertex uvs need recalculating
+		bool mGeomUVsOutOfDate;
+
+        /** Zorder for when sending to render queue.
+            Derived from parent */
+        ushort mZOrder;
+
+        /// World transforms
+        Matrix4 mXForm;
+
+        /// Is element enabled?
+        bool mEnabled;
+
+		/// Is element initialised?
+		bool mInitialised;
+
+        /// Used to see if this element is created from a Template
+        OverlayElement* mSourceTemplate ;
+
+        /** Internal method which is triggered when the positions of the element get updated,
+        meaning the element should be rebuilding it's mesh positions. Abstract since
+        subclasses must implement this.
+        */
+        virtual void updatePositionGeometry(void) = 0;
+		/** Internal method which is triggered when the UVs of the element get updated,
+		meaning the element should be rebuilding it's mesh UVs. Abstract since
+		subclasses must implement this.
+		*/
+		virtual void updateTextureGeometry(void) = 0;
+
+        /** Internal method for setting up the basic parameter definitions for a subclass. 
+        @remarks
+        Because StringInterface holds a dictionary of parameters per class, subclasses need to
+        call this to ask the base class to add it's parameters to their dictionary as well.
+        Can't do this in the constructor because that runs in a non-virtual context.
+        @par
+        The subclass must have called it's own createParamDictionary before calling this method.
+        */
+        virtual void addBaseParameters(void);
+
+    public:
+        /// Constructor: do not call direct, use OverlayManager::createElement
+        OverlayElement(const String& name);
+        virtual ~OverlayElement();
+
+        /** Initialise gui element */
+        virtual void initialise(void) = 0;
+
+        /** Gets the name of this overlay. */
+        const String& getName(void) const;
+
+
+        /** Shows this element if it was hidden. */
+        virtual void show(void);
+
+        /** Hides this element if it was visible. */
+        virtual void hide(void);
+
+        /** Returns whether or not the element is visible. */
+        bool isVisible(void) const;
+
+        bool isEnabled() const;
+        virtual void setEnabled(bool b);
+
+
+        /** Sets the dimensions of this element in relation to the screen (1.0 = screen width/height). */
+        void setDimensions(Real width, Real height);
+
+        /** Sets the position of the top-left corner of the element, relative to the screen size
+        (1.0 = screen width / height) */
+        void setPosition(Real left, Real top);
+
+        /** Sets the width of this element in relation to the screen (where 1.0 = screen width) */
+        void setWidth(Real width);
+        /** Gets the width of this element in relation to the screen (where 1.0 = screen width) */
+        Real getWidth(void) const;
+
+        /** Sets the height of this element in relation to the screen (where 1.0 = screen height) */
+        void setHeight(Real height);
+        /** Gets the height of this element in relation to the screen (where 1.0 = screen height) */
+        Real getHeight(void) const;
+
+        /** Sets the left of this element in relation to the screen (where 0 = far left, 1.0 = far right) */
+        void setLeft(Real left);
+        /** Gets the left of this element in relation to the screen (where 0 = far left, 1.0 = far right)  */
+        Real getLeft(void) const;
+
+        /** Sets the top of this element in relation to the screen (where 0 = top, 1.0 = bottom) */
+        void setTop(Real Top);
+        /** Gets the top of this element in relation to the screen (where 0 = top, 1.0 = bottom)  */
+        Real getTop(void) const;
+
+        /** Gets the left of this element in relation to the screen (where 0 = far left, 1.0 = far right)  */
+        Real _getLeft(void) const { return mLeft; }
+        /** Gets the top of this element in relation to the screen (where 0 = far left, 1.0 = far right)  */
+        Real _getTop(void) const { return mTop; }
+        /** Gets the width of this element in relation to the screen (where 1.0 = screen width)  */
+        Real _getWidth(void) const { return mWidth; }
+        /** Gets the height of this element in relation to the screen (where 1.0 = screen height)  */
+        Real _getHeight(void) const { return mHeight; }
+        /** Sets the left of this element in relation to the screen (where 1.0 = screen width) */
+        void _setLeft(Real left);
+        /** Sets the top of this element in relation to the screen (where 1.0 = screen width) */
+        void _setTop(Real top);
+        /** Sets the width of this element in relation to the screen (where 1.0 = screen width) */
+        void _setWidth(Real width);
+        /** Sets the height of this element in relation to the screen (where 1.0 = screen width) */
+        void _setHeight(Real height);
+        /** Sets the left and top of this element in relation to the screen (where 1.0 = screen width) */
+        void _setPosition(Real left, Real top);
+        /** Sets the width and height of this element in relation to the screen (where 1.0 = screen width) */
+        void _setDimensions(Real width, Real height);
+
+        /** Gets the name of the material this element uses. */
+        virtual const String& getMaterialName(void) const;
+
+        /** Sets the name of the material this element will use. 
+        @remarks
+        Different elements will use different materials. One constant about them
+        all though is that a Material used for a OverlayElement must have it's depth
+        checking set to 'off', which means it always gets rendered on top. OGRE
+        will set this flag for you if necessary. What it does mean though is that 
+        you should not use the same Material for rendering OverlayElements as standard 
+        scene objects. It's fine to use the same textures, just not the same
+        Material.
+        */
+        virtual void setMaterialName(const String& matName);
+
+
+        // --- Renderable Overrides ---
+        /** See Renderable */
+        const MaterialPtr& getMaterial(void) const;
+
+        // NB getRenderOperation not implemented, still abstract here
+
+        /** See Renderable */
+        void getWorldTransforms(Matrix4* xform) const;
+
+        /** Tell the object to recalculate */
+        virtual void _positionsOutOfDate(void);
+
+        /** Internal method to update the element based on transforms applied. */
+        virtual void _update(void);
+
+        /** Updates this elements transform based on it's parent. */
+        virtual void _updateFromParent(void);
+
+        /** Internal method for notifying the GUI element of it's parent and ultimate overlay. */
+        virtual void _notifyParent(OverlayContainer* parent, Overlay* overlay);
+
+        /** Gets the 'left' position as derived from own left and that of parents. */
+        virtual Real _getDerivedLeft(void);
+
+        /** Gets the 'top' position as derived from own left and that of parents. */
+        virtual Real _getDerivedTop(void);
+
+		/** Gets the 'width' as derived from own width and metrics mode. */
+		virtual Real _getRelativeWidth(void);
+		/** Gets the 'height' as derived from own height and metrics mode. */
+		virtual Real _getRelativeHeight(void);
+
+
+        /** Gets the clipping region of the element */
+        virtual void _getClippingRegion(RealRect &clippingRegion);
+
+        /** Internal method to notify the element when Z-order of parent overlay
+        has changed.
+        @remarks
+        Overlays have explicit Z-orders. OverlayElements do not, they inherit the 
+        Z-order of the overlay, and the Z-order is incremented for every container
+        nested within this to ensure that containers are displayed behind contained
+        items. This method is used internally to notify the element of a change in
+        final Z-order which is used to render the element.
+		@return Return the next Z-ordering number available. For single elements, this
+		is simply 'newZOrder + 1', except for containers. They increment it once for each
+		child (or even more if those children are also containers with their own elements).
+        */
+        virtual ushort _notifyZOrder(ushort newZOrder);
+
+        /** Internal method to notify the element when it's world transform
+         of parent overlay has changed.
+        */
+        virtual void _notifyWorldTransforms(const Matrix4& xform);
+
+        /** Internal method to notify the element when the viewport
+         of parent overlay has changed.
+        */
+        virtual void _notifyViewport();
+
+        /** Internal method to put the contents onto the render queue. */
+        virtual void _updateRenderQueue(RenderQueue* queue);
+
+		/// @copydoc MovableObject::visitRenderables
+		void visitRenderables(Renderable::Visitor* visitor, 
+			bool debugRenderables = false);
+
+        /** Gets the type name of the element. All concrete subclasses must implement this. */
+        virtual const String& getTypeName(void) const = 0;
+
+        /** Sets the caption on elements that support it. 
+        @remarks
+        This property doesn't do something on all elements, just those that support it.
+        However, being a common requirement it is in the top-level interface to avoid
+        having to set it via the StringInterface all the time.
+        */
+		virtual void setCaption(const DisplayString& text);
+        /** Gets the caption for this element. */
+        virtual const DisplayString& getCaption(void) const;
+        /** Sets the colour on elements that support it. 
+        @remarks
+        This property doesn't do something on all elements, just those that support it.
+        However, being a common requirement it is in the top-level interface to avoid
+        having to set it via the StringInterface all the time.
+        */
+        virtual void setColour(const ColourValue& col);
+
+        /** Gets the colour for this element. */
+        virtual const ColourValue& getColour(void) const;
+
+        /** Tells this element how to interpret the position and dimension values it is given.
+        @remarks
+        By default, OverlayElements are positioned and sized according to relative dimensions
+        of the screen. This is to ensure portability between different resolutions when you
+        want things to be positioned and sized the same way across all resolutions. However, 
+        sometimes you want things to be sized according to fixed pixels. In order to do this,
+        you can call this method with the parameter GMM_PIXELS. Note that if you then want
+        to place your element relative to the center, right or bottom of it's parent, you will
+        need to use the setHorizontalAlignment and setVerticalAlignment methods.
+        */
+        virtual void setMetricsMode(GuiMetricsMode gmm);
+        /** Retrieves the current settings of how the element metrics are interpreted. */
+        virtual GuiMetricsMode getMetricsMode(void) const;
+        /** Sets the horizontal origin for this element.
+        @remarks
+        By default, the horizontal origin for a OverlayElement is the left edge of the parent container
+        (or the screen if this is a root element). You can alter this by calling this method, which is
+        especially useful when you want to use pixel-based metrics (see setMetricsMode) since in this
+        mode you can't use relative positioning.
+        @par
+        For example, if you were using GMM_PIXELS metrics mode, and you wanted to place a 30x30 pixel
+        crosshair in the center of the screen, you would use GHA_CENTER with a 'left' property of -15.
+        @par
+        Note that neither GHA_CENTER or GHA_RIGHT alter the position of the element based
+        on it's width, you have to alter the 'left' to a negative number to do that; all this
+        does is establish the origin. This is because this way you can align multiple things
+        in the center and right with different 'left' offsets for maximum flexibility.
+        */
+        virtual void setHorizontalAlignment(GuiHorizontalAlignment gha);
+        /** Gets the horizontal alignment for this element. */
+        virtual GuiHorizontalAlignment getHorizontalAlignment(void) const;
+        /** Sets the vertical origin for this element. 
+        @remarks
+        By default, the vertical origin for a OverlayElement is the top edge of the parent container
+        (or the screen if this is a root element). You can alter this by calling this method, which is
+        especially useful when you want to use pixel-based metrics (see setMetricsMode) since in this
+        mode you can't use relative positioning.
+        @par
+        For example, if you were using GMM_PIXELS metrics mode, and you wanted to place a 30x30 pixel
+        crosshair in the center of the screen, you would use GHA_CENTER with a 'top' property of -15.
+        @par
+        Note that neither GVA_CENTER or GVA_BOTTOM alter the position of the element based
+        on it's height, you have to alter the 'top' to a negative number to do that; all this
+        does is establish the origin. This is because this way you can align multiple things
+        in the center and bottom with different 'top' offsets for maximum flexibility.
+        */
+        virtual void setVerticalAlignment(GuiVerticalAlignment gva);
+        /** Gets the vertical alignment for this element. */
+        virtual GuiVerticalAlignment getVerticalAlignment(void) const;
+
+
+
+
+        /** Returns true if xy is within the constraints of the component */
+        virtual bool contains(Real x, Real y) const;
+
+        /** Returns true if xy is within the constraints of the component */
+        virtual OverlayElement* findElementAt(Real x, Real y);		// relative to parent
+
+        /**
+        * returns false as this class is not a container type 
+        */
+        inline virtual bool isContainer() const
+        { return false; }
+
+        inline virtual bool isKeyEnabled() const
+        { return false; }
+
+        inline virtual bool isCloneable() const
+        { return mCloneable; }
+
+        inline virtual void setCloneable(bool c)
+        { mCloneable = c; }
+
+        /**
+        * Returns the parent container.
+        */
+        OverlayContainer* getParent() ;
+        void _setParent(OverlayContainer* parent) { mParent = parent; }
+
+        /**
+        * Returns the zOrder of the element
+        */
+        inline ushort getZOrder() const
+        { return mZOrder; }
+
+        /** Overridden from Renderable */
+        Real getSquaredViewDepth(const Camera* cam) const 
+        { 
+            (void)cam;
+            return 10000.0f - (Real)getZOrder(); 
+        }
+
+        /** @copydoc Renderable::getLights */
+        const LightList& getLights(void) const
+        {
+            // Overlayelements should not be lit by the scene, this will not get called
+            static LightList ll;
+            return ll;
+        }
+
+        virtual void copyFromTemplate(OverlayElement* templateOverlay);
+        virtual OverlayElement* clone(const String& instanceName);
+
+        /// Returns the SourceTemplate for this element
+        const OverlayElement* getSourceTemplate () const {
+          return mSourceTemplate ;
+        }
+    };
+
+
+	/** @} */
+	/** @} */
+
+}
+
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreOverlayElementCommands.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreOverlayElementCommands.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreOverlayElementCommands.h	(revision 148)
@@ -0,0 +1,122 @@
+/*
+-----------------------------------------------------------------------------
+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 __OverlayElementEmitterCommands_H__
+#define __OverlayElementEmitterCommands_H__
+
+#include "OgreOverlayPrerequisites.h"
+#include "OgreStringInterface.h"
+
+namespace Ogre  {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Overlays
+	*  @{
+	*/
+
+    namespace OverlayElementCommands {
+        /// Command object for OverlayElement  - see ParamCommand 
+        class _OgreOverlayExport CmdLeft : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for OverlayElement  - see ParamCommand 
+        class _OgreOverlayExport CmdTop : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for OverlayElement  - see ParamCommand 
+        class _OgreOverlayExport CmdWidth : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for OverlayElement  - see ParamCommand 
+        class _OgreOverlayExport CmdHeight : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for OverlayElement  - see ParamCommand 
+        class _OgreOverlayExport CmdMaterial : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for OverlayElement  - see ParamCommand 
+        class _OgreOverlayExport CmdCaption : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for OverlayElement  - see ParamCommand 
+        class _OgreOverlayExport CmdMetricsMode : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for OverlayElement  - see ParamCommand 
+        class _OgreOverlayExport CmdHorizontalAlign : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for OverlayElement  - see ParamCommand 
+        class _OgreOverlayExport CmdVerticalAlign : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for OverlayElement  - see ParamCommand 
+        class _OgreOverlayExport CmdVisible : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+
+    }
+	/** @} */
+	/** @} */
+}
+
+#endif
+
+
Index: /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreOverlayElementFactory.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreOverlayElementFactory.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreOverlayElementFactory.h	(revision 148)
@@ -0,0 +1,116 @@
+/*
+-----------------------------------------------------------------------------
+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 __OverlayElementFactory_H__
+#define __OverlayElementFactory_H__
+
+#include "OgreOverlayPrerequisites.h"
+#include "OgreOverlayElement.h"
+#include "OgrePanelOverlayElement.h"
+#include "OgreBorderPanelOverlayElement.h"
+#include "OgreTextAreaOverlayElement.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Overlays
+	*  @{
+	*/
+	/** Defines the interface which all components wishing to 
+        supply OverlayElement subclasses must implement.
+    @remarks
+        To allow the OverlayElement types available for inclusion on 
+        overlays to be extended, OGRE allows external apps or plugins
+        to register their ability to create custom OverlayElements with
+        the OverlayManager, using the addOverlayElementFactory method. Classes
+        wanting to do this must implement this interface.
+    @par
+        Each OverlayElementFactory creates a single type of OverlayElement, 
+        identified by a 'type name' which must be unique.
+    */
+	class _OgreOverlayExport OverlayElementFactory : public OverlayAlloc
+    {
+    public:
+        /** Destroy the overlay element factory */
+        virtual ~OverlayElementFactory () {}
+        /** Creates a new OverlayElement instance with the name supplied. */
+        virtual OverlayElement* createOverlayElement(const String& instanceName) = 0;
+        /** Destroys a OverlayElement which this factory created previously. */
+        virtual void destroyOverlayElement(OverlayElement* pElement) { delete pElement; }
+        /** Gets the string uniquely identifying the type of element this factory creates. */
+        virtual const String& getTypeName(void) const = 0;
+    };
+
+
+    /** Factory for creating PanelOverlayElement instances. */
+    class _OgreOverlayExport PanelOverlayElementFactory: public OverlayElementFactory
+    {
+    public:
+        /** See OverlayElementFactory */
+        OverlayElement* createOverlayElement(const String& instanceName)
+        {
+            return OGRE_NEW PanelOverlayElement(instanceName);
+        }
+        /** See OverlayElementFactory */
+        virtual const String& getTypeName(void) const;
+    };
+
+    /** Factory for creating BorderPanelOverlayElement instances. */
+    class _OgreOverlayExport BorderPanelOverlayElementFactory: public OverlayElementFactory
+    {
+    public:
+        /** See OverlayElementFactory */
+        OverlayElement* createOverlayElement(const String& instanceName)
+        {
+            return OGRE_NEW BorderPanelOverlayElement(instanceName);
+        }
+        /** See OverlayElementFactory */
+        virtual const String& getTypeName(void) const;
+    };
+
+    /** Factory for creating TextAreaOverlayElement instances. */
+    class _OgreOverlayExport TextAreaOverlayElementFactory: public OverlayElementFactory
+    {
+    public:
+        /** See OverlayElementFactory */
+        OverlayElement* createOverlayElement(const String& instanceName)
+        {
+            return OGRE_NEW TextAreaOverlayElement(instanceName);
+        }
+        /** See OverlayElementFactory */
+        virtual const String& getTypeName(void) const;
+    };
+	/** @} */
+	/** @} */
+
+}
+
+
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreOverlayManager.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreOverlayManager.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreOverlayManager.h	(revision 148)
@@ -0,0 +1,256 @@
+/*
+-----------------------------------------------------------------------------
+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 __OverlayManager_H__
+#define __OverlayManager_H__
+
+#include "OgreOverlayPrerequisites.h"
+#include "OgreSingleton.h"
+#include "OgreStringVector.h"
+#include "OgreOverlay.h"
+#include "OgreScriptLoader.h"
+#include "OgreFrustum.h"
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Overlays
+	*  @{
+	*/
+	/** Manages Overlay objects, parsing them from .overlay files and
+        storing a lookup library of them. Also manages the creation of 
+		OverlayContainers and OverlayElements, used for non-interactive 2D 
+		elements such as HUDs.
+    */
+    class _OgreOverlayExport OverlayManager : public Singleton<OverlayManager>, public ScriptLoader, public OverlayAlloc
+    {
+    public:
+        typedef map<String, Overlay*>::type OverlayMap;
+		typedef map<String, OverlayElement*>::type ElementMap;
+		typedef map<String, OverlayElementFactory*>::type FactoryMap;
+    protected:
+        OverlayMap mOverlayMap;
+        StringVector mScriptPatterns;
+
+        void parseNewElement( DataStreamPtr& chunk, String& elemType, String& elemName, 
+            bool isContainer, Overlay* pOverlay, bool isTemplate, String templateName = String(""), OverlayContainer* container = 0);
+        void parseAttrib( const String& line, Overlay* pOverlay);
+        void parseElementAttrib( const String& line, Overlay* pOverlay, OverlayElement* pElement );
+        void skipToNextCloseBrace(DataStreamPtr& chunk);
+        void skipToNextOpenBrace(DataStreamPtr& chunk);
+        
+        int mLastViewportWidth, mLastViewportHeight;
+        bool mViewportDimensionsChanged;
+        OrientationMode mLastViewportOrientationMode;
+
+	    bool parseChildren( DataStreamPtr& chunk, const String& line,
+            Overlay* pOverlay, bool isTemplate, OverlayContainer* parent = NULL);
+
+		FactoryMap mFactories;
+
+		ElementMap mInstances;
+		ElementMap mTemplates;
+
+		typedef set<String>::type LoadedScripts;
+		LoadedScripts mLoadedScripts;
+
+
+
+
+		ElementMap& getElementMap(bool isTemplate);
+
+		OverlayElement* createOverlayElementImpl(const String& typeName, const String& instanceName, ElementMap& elementMap);
+
+		OverlayElement* getOverlayElementImpl(const String& name, ElementMap& elementMap);
+		
+		bool hasOverlayElementImpl(const String& name, ElementMap& elementMap);
+
+		void destroyOverlayElementImpl(const String& instanceName, ElementMap& elementMap);
+
+		void destroyOverlayElementImpl(OverlayElement* pInstance, ElementMap& elementMap);
+
+		void destroyAllOverlayElementsImpl(ElementMap& elementMap);
+
+    public:
+        OverlayManager();
+        virtual ~OverlayManager();
+
+        /// @copydoc ScriptLoader::getScriptPatterns
+        const StringVector& getScriptPatterns(void) const;
+        /// @copydoc ScriptLoader::parseScript
+        void parseScript(DataStreamPtr& stream, const String& groupName);
+        /// @copydoc ScriptLoader::getLoadingOrder
+        Real getLoadingOrder(void) const;
+
+        /** Create a new Overlay. */
+        Overlay* create(const String& name);
+        /** Retrieve an Overlay by name 
+        @return A pointer to the Overlay, or 0 if not found
+        */
+        Overlay* getByName(const String& name);
+        /** Destroys an existing overlay by name */
+        void destroy(const String& name);
+        /** Destroys an existing overlay */
+        void destroy(Overlay* overlay);
+        /** Destroys all existing overlays */
+        void destroyAll(void);
+        typedef MapIterator<OverlayMap> OverlayMapIterator;
+        OverlayMapIterator getOverlayIterator(void);
+
+        /** Internal method for queueing the visible overlays for rendering. */
+        void _queueOverlaysForRendering(Camera* cam, RenderQueue* pQueue, Viewport *vp);
+
+        /** Method for determining if the viewport has changed dimensions. 
+        @remarks This is used by pixel-based OverlayElements to work out if they need to
+            recalculate their sizes.
+        */
+        bool hasViewportChanged(void) const;
+
+        /** Gets the height of the destination viewport in pixels. */
+        int getViewportHeight(void) const;
+        
+        /** Gets the width of the destination viewport in pixels. */
+        int getViewportWidth(void) const;
+        Real getViewportAspectRatio(void) const;
+
+        /** Gets the orientation mode of the destination viewport. */
+        OrientationMode getViewportOrientationMode(void) const;
+
+		/** Creates a new OverlayElement of the type requested.
+		@remarks
+		The type of element to create is passed in as a string because this
+		allows plugins to register new types of component.
+		@param typeName The type of element to create.
+		@param instanceName The name to give the new instance.
+		*/
+		OverlayElement* createOverlayElement(const String& typeName, const String& instanceName, bool isTemplate = false);
+
+		/** Gets a reference to an existing element. */
+		OverlayElement* getOverlayElement(const String& name, bool isTemplate = false);
+
+		/** Tests if an element exists. */
+		bool hasOverlayElement(const String& name, bool isTemplate = false);
+		
+		/** Destroys a OverlayElement. 
+		@remarks
+		Make sure you're not still using this in an Overlay. If in
+		doubt, let OGRE destroy elements on shutdown.
+		*/
+		void destroyOverlayElement(const String& instanceName, bool isTemplate = false);
+
+		/** Destroys a OverlayElement. 
+		@remarks
+		Make sure you're not still using this in an Overlay. If in
+		doubt, let OGRE destroy elements on shutdown.
+		*/
+		void destroyOverlayElement(OverlayElement* pInstance, bool isTemplate = false);
+
+		/** Destroys all the OverlayElement  created so far.
+		@remarks
+		Best to leave this to the engine to call internally, there
+		should rarely be a need to call it yourself.
+		*/
+		void destroyAllOverlayElements(bool isTemplate = false);
+
+		/** Registers a new OverlayElementFactory with this manager.
+		@remarks
+		Should be used by plugins or other apps wishing to provide
+		a new OverlayElement subclass.
+		*/
+		void addOverlayElementFactory(OverlayElementFactory* elemFactory);
+		
+		/** Get const access to the list of registered OverlayElement factories. */
+		const FactoryMap& getOverlayElementFactoryMap() const {
+			return mFactories;
+		}
+
+		OverlayElement* createOverlayElementFromTemplate(const String& templateName, const String& typeName, const String& instanceName, bool isTemplate = false);
+		/**
+		*  @remarks
+		*  Creates a new OverlayElement object from the specified template name.  The new
+		*  object's name, and all of it's children, will be instanceName/orignalName.
+		*/
+		OverlayElement* cloneOverlayElementFromTemplate(const String& templateName, const String& instanceName);
+
+		OverlayElement* createOverlayElementFromFactory(const String& typeName, const String& instanceName);
+
+		typedef MapIterator<ElementMap> TemplateIterator;
+		/** Returns an iterator over all templates in this manager.*/
+		TemplateIterator getTemplateIterator ()
+		{
+			return TemplateIterator (mTemplates.begin (), mTemplates.end ()) ;
+		}
+		/* Returns whether the Element with the given name is a Template */
+		bool isTemplate (String strName) const {
+			return (mTemplates.find (strName) != mTemplates.end()) ;
+		}
+
+
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static OverlayManager& getSingleton(void);
+        /** Override standard Singleton retrieval.
+        @remarks
+        Why do we do this? Well, it's because the Singleton
+        implementation is in a .h file, which means it gets compiled
+        into anybody who includes it. This is needed for the
+        Singleton template to work, but we actually only want it
+        compiled into the implementation of the class based on the
+        Singleton, not all of them. If we don't change this, we get
+        link errors when trying to use the Singleton-based class from
+        an outside dll.
+        @par
+        This method just delegates to the template version anyway,
+        but the implementation stays in this single compilation unit,
+        preventing link errors.
+        */
+        static OverlayManager* getSingletonPtr(void);
+    };
+
+
+	/** @} */
+	/** @} */
+
+}
+
+
+#endif 
Index: /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreOverlayPrerequisites.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreOverlayPrerequisites.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreOverlayPrerequisites.h	(revision 148)
@@ -0,0 +1,70 @@
+/*
+-----------------------------------------------------------------------------
+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 __Ogre_Overlay_Prereq_H__
+#define __Ogre_Overlay_Prereq_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre
+{
+	// forward decls
+	class Font;
+    class FontManager;
+	class Overlay;
+    class OverlayContainer;
+    class OverlayElement;
+    class OverlayElementFactory;
+    class OverlayManager;
+
+    typedef SharedPtr<Font> FontPtr;
+}
+
+#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32 || OGRE_PLATFORM == OGRE_PLATFORM_WINRT
+#	if defined( OGRE_STATIC_LIB )
+#   	define _OgreOverlayExport
+#   else
+#   	if defined( OGRE_OVERLAY_EXPORTS )
+#       	define _OgreOverlayExport __declspec( dllexport )
+#   	else
+#           if defined( __MINGW32__ )
+#               define _OgreOverlayExport
+#           else
+#       	    define _OgreOverlayExport __declspec( dllimport )
+#           endif
+#   	endif
+#	endif
+#elif defined ( OGRE_GCC_VISIBILITY )
+#   define _OgreOverlayExport __attribute__ ((visibility("default")))
+#else
+#	define _OgreOverlayExport
+#endif 
+
+
+
+#endif 
Index: /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreOverlayProfileSessionListener.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreOverlayProfileSessionListener.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreOverlayProfileSessionListener.h	(revision 148)
@@ -0,0 +1,135 @@
+/*
+-----------------------------------------------------------------------------
+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 __OverlayProfileSessionListener_H__
+#define __OverlayProfileSessionListener_H__
+
+#include "OgreOverlayPrerequisites.h"
+#include "OgreProfiler.h"
+#include "OgreOverlay.h"
+
+namespace Ogre  {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Overlays
+	*  @{
+	*/
+
+	/** Concrete impl. of the ProfileSessionListener which visualizes
+		the profling results using overlays.
+	*/
+	class _OgreOverlayExport OverlayProfileSessionListener : public ProfileSessionListener
+	{
+	public:
+		OverlayProfileSessionListener();
+		virtual ~OverlayProfileSessionListener();
+
+		/// @see ProfileSessionListener::initializeSession
+		virtual void initializeSession();
+
+		/// @see ProfileSessionListener::finializeSession
+		virtual void finializeSession();
+
+		/// @see ProfileSessionListener::displayResults
+		virtual void displayResults(const ProfileInstance& instance, ulong maxTotalFrameTime);
+
+		/// @see ProfileSessionListener::changeEnableState
+		virtual void changeEnableState(bool enabled);
+
+		/** Set the size of the profiler overlay, in pixels. */
+		void setOverlayDimensions(Real width, Real height);
+
+		/** Set the position of the profiler overlay, in pixels. */
+		void setOverlayPosition(Real left, Real top);
+
+		Real getOverlayWidth() const;
+		Real getOverlayHeight() const;
+		Real getOverlayLeft() const;
+		Real getOverlayTop() const;
+
+	private:
+		typedef list<OverlayElement*>::type ProfileBarList;
+
+		/** Prints the profiling results of each frame 
+		@remarks Recursive, for all the little children. */
+		void displayResults(ProfileInstance* instance, ProfileBarList::const_iterator& bIter, Real& maxTimeMillisecs, Real& newGuiHeight, int& profileCount);
+
+		/** An internal function to create the container which will hold our display elements*/
+        OverlayContainer* createContainer();
+
+        /** An internal function to create a text area */
+        OverlayElement* createTextArea(const String& name, Real width, Real height, Real top, Real left, 
+                                    uint fontSize, const String& caption, bool show = true);
+
+        /** An internal function to create a panel */
+        OverlayElement* createPanel(const String& name, Real width, Real height, Real top, Real left, 
+                                const String& materialName, bool show = true);
+
+        /// Holds the display bars for each profile results
+        ProfileBarList mProfileBars;
+
+		/// The overlay which contains our profiler results display
+        Overlay* mOverlay;
+
+        /// The window that displays the profiler results
+        OverlayContainer* mProfileGui;
+
+        /// The height of each bar
+        Real mBarHeight;
+
+        /// The height of the stats window
+        Real mGuiHeight;
+
+        /// The width of the stats window
+        Real mGuiWidth;
+
+		/// The horz position of the stats window
+		Real mGuiLeft;
+
+		/// The vertical position of the stats window
+		Real mGuiTop;
+
+		/// The size of the indent for each profile display bar
+        Real mBarIndent;
+
+        /// The width of the border between the profile window and each bar
+        Real mGuiBorderWidth;
+
+        /// The width of the min, avg, and max lines in a profile display
+        Real mBarLineWidth;
+
+		/// The distance between bars
+		Real mBarSpacing;
+
+        /// The max number of profiles we can display
+        uint mMaxDisplayProfiles;
+	};
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreOverlaySystem.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreOverlaySystem.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreOverlaySystem.h	(revision 148)
@@ -0,0 +1,82 @@
+/*
+-----------------------------------------------------------------------------
+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 __OverlaySystem_H__
+#define __OverlaySystem_H__
+
+#include "OgreOverlay.h"
+#include "OgreOverlayContainer.h"
+#include "OgreOverlayElement.h"
+#include "OgreOverlayManager.h"
+#include "OgreFontManager.h"
+#include "OgreBorderPanelOverlayElement.h"
+#include "OgreTextAreaOverlayElement.h"
+#include "OgreOverlayElementFactory.h"
+#include "OgreRenderQueueListener.h"
+
+#if OGRE_PROFILING
+#include "OgreOverlayProfileSessionListener.h"
+#endif
+
+namespace Ogre {
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Overlays
+	*  @{
+	*/
+	/** This class simplify initialization / finalization of the overlay system. 
+		OGRE root did this steps before the overlay system transformed into a component.
+    @remarks
+        Before you create a concrete instance of the OverlaySystem the OGRE::Root must be created
+		but not initialized. In the ctor all relevant systems are created and registered. The dtor
+		must be called before you delete OGRE::Root.
+		To make the overlays visible (= render into your viewports) you have to register this
+		instance as a RenderQueueListener in your scenemanager(s).
+    */
+	class _OgreOverlayExport OverlaySystem : public OverlayAlloc , public Ogre::RenderQueueListener
+	{
+	public:
+		OverlaySystem();
+		virtual ~OverlaySystem();
+
+		/// @see RenderQueueListener
+		virtual void renderQueueStarted(uint8 queueGroupId, const String& invocation, 
+			bool& skipThisInvocation);
+	private:
+        OverlayManager* mOverlayManager;
+        FontManager* mFontManager;
+
+#if OGRE_PROFILING
+		OverlayProfileSessionListener* mProfileListener;
+#endif
+	};
+
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/Overlay/OgrePanelOverlayElement.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Overlay/OgrePanelOverlayElement.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Overlay/OgrePanelOverlayElement.h	(revision 148)
@@ -0,0 +1,161 @@
+/*
+-----------------------------------------------------------------------------
+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 __PanelOverlayElement_H__
+#define __PanelOverlayElement_H__
+
+#include "OgreOverlayContainer.h"
+
+namespace Ogre {
+
+
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Overlays
+	*  @{
+	*/
+	/** OverlayElement representing a flat, single-material (or transparent) panel which can contain other elements.
+    @remarks
+        This class subclasses OverlayContainer because it can contain other elements. Like other
+        containers, if hidden it's contents are also hidden, if moved it's contents also move etc. 
+        The panel itself is a 2D rectangle which is either completely transparent, or is rendered 
+        with a single material. The texture(s) on the panel can be tiled depending on your requirements.
+    @par
+        This component is suitable for backgrounds and grouping other elements. Note that because
+        it has a single repeating material it cannot have a discrete border (unless the texture has one and
+        the texture is tiled only once). For a bordered panel, see it's subclass BorderPanelOverlayElement.
+    @par
+        Note that the material can have all the usual effects applied to it like multiple texture
+        layers, scrolling / animated textures etc. For multiple texture layers, you have to set 
+        the tiling level for each layer.
+    */
+    class _OgreOverlayExport PanelOverlayElement : public OverlayContainer
+    {
+    public:
+        /** Constructor. */
+        PanelOverlayElement(const String& name);
+        virtual ~PanelOverlayElement();
+
+        /** Initialise */
+        virtual void initialise(void);
+
+        /** Sets the number of times textures should repeat. 
+        @param x The number of times the texture should repeat horizontally
+        @param y The number of times the texture should repeat vertically
+        @param layer The texture layer to specify (only needs to be altered if 
+            you're using a multi-texture layer material)
+        */
+        void setTiling(Real x, Real y, ushort layer = 0);
+
+        Real getTileX(ushort layer = 0) const;
+        /** Gets the number of times the texture should repeat vertically. 
+        @param layer The texture layer to specify (only needs to be altered if 
+            you're using a multi-texture layer material)
+        */
+        Real getTileY(ushort layer = 0) const;
+
+        /** Sets the texture coordinates for the panel. */
+        void setUV(Real u1, Real v1, Real u2, Real v2);
+
+        /** Get the uv coordinates for the panel*/
+        void getUV(Real& u1, Real& v1, Real& u2, Real& v2) const;
+
+        /** Sets whether this panel is transparent (used only as a grouping level), or 
+            if it is actually rendered.
+        */
+        void setTransparent(bool isTransparent);
+
+        /** Returns whether this panel is transparent. */
+        bool isTransparent(void) const;
+
+        /** See OverlayElement. */
+        virtual const String& getTypeName(void) const;
+        /** See Renderable. */
+        void getRenderOperation(RenderOperation& op);
+        /** Overridden from OverlayElement */
+        void setMaterialName(const String& matName);
+        /** Overridden from OverlayContainer */
+        void _updateRenderQueue(RenderQueue* queue);
+
+
+        /** Command object for specifying tiling (see ParamCommand).*/
+        class _OgrePrivate CmdTiling : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /** Command object for specifying transparency (see ParamCommand).*/
+        class _OgrePrivate CmdTransparent : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /** Command object for specifying UV coordinates (see ParamCommand).*/
+        class _OgrePrivate CmdUVCoords : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+    protected:
+        /// Flag indicating if this panel should be visual or just group things
+        bool mTransparent;
+        // Texture tiling
+        Real mTileX[OGRE_MAX_TEXTURE_LAYERS];
+        Real mTileY[OGRE_MAX_TEXTURE_LAYERS];
+        size_t mNumTexCoordsInBuffer;
+        Real mU1, mV1, mU2, mV2;
+
+        RenderOperation mRenderOp;
+
+        /// Internal method for setting up geometry, called by OverlayElement::update
+        virtual void updatePositionGeometry(void);
+
+        /// Called to update the texture coords when layers change
+        virtual void updateTextureGeometry(void);
+
+        /// Method for setting up base parameters for this class
+        void addBaseParameters(void);
+
+        static String msTypeName;
+
+        // Command objects
+        static CmdTiling msCmdTiling;
+        static CmdTransparent msCmdTransparent;
+        static CmdUVCoords msCmdUVCoords;
+
+    };
+	/** @} */
+	/** @} */
+
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreTextAreaOverlayElement.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreTextAreaOverlayElement.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Overlay/OgreTextAreaOverlayElement.h	(revision 148)
@@ -0,0 +1,258 @@
+/*-------------------------------------------------------------------------
+This source file is a 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 _TextAreaOverlayElement_H__
+#define _TextAreaOverlayElement_H__
+
+#include "OgreOverlayElement.h"
+#include "OgreFont.h"
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup Overlays
+	*  @{
+	*/
+	/** This class implements an overlay element which contains simple unformatted text.
+    */
+    class _OgreOverlayExport TextAreaOverlayElement : public OverlayElement
+    {
+    public:
+        enum Alignment
+        {
+            Left,
+            Right,
+            Center
+        };
+
+    public:
+        /** Constructor. */
+        TextAreaOverlayElement(const String& name);
+        virtual ~TextAreaOverlayElement();
+
+        virtual void initialise(void);
+		virtual void setCaption(const DisplayString& text);
+
+        void setCharHeight( Real height );
+        Real getCharHeight() const;
+
+        void setSpaceWidth( Real width );
+        Real getSpaceWidth() const;
+
+        void setFontName( const String& font );
+        const String& getFontName() const;
+
+        /** See OverlayElement. */
+        virtual const String& getTypeName(void) const;
+        /** See Renderable. */
+		const MaterialPtr& getMaterial(void) const;
+        /** See Renderable. */
+        void getRenderOperation(RenderOperation& op);
+        /** Overridden from OverlayElement */
+        void setMaterialName(const String& matName);
+
+        /** Sets the colour of the text. 
+        @remarks
+            This method establishes a constant colour for 
+            the entire text. Also see setColourBottom and 
+            setColourTop which allow you to set a colour gradient.
+        */
+        void setColour(const ColourValue& col);
+
+        /** Gets the colour of the text. */
+        const ColourValue& getColour(void) const;
+        /** Sets the colour of the bottom of the letters.
+        @remarks
+            By setting a separate top and bottom colour, you
+            can create a text area which has a graduated colour
+            effect to it.
+        */
+        void setColourBottom(const ColourValue& col);
+        /** Gets the colour of the bottom of the letters. */
+        const ColourValue& getColourBottom(void) const;
+        /** Sets the colour of the top of the letters.
+        @remarks
+            By setting a separate top and bottom colour, you
+            can create a text area which has a graduated colour
+            effect to it.
+        */
+        void setColourTop(const ColourValue& col);
+        /** Gets the colour of the top of the letters. */
+        const ColourValue& getColourTop(void) const;
+
+        inline void setAlignment( Alignment a )
+        {
+            mAlignment = a;
+			mGeomPositionsOutOfDate = true;
+        }
+        inline Alignment getAlignment() const
+        {
+            return mAlignment;
+        }
+
+        /** Overridden from OverlayElement */
+        void setMetricsMode(GuiMetricsMode gmm);
+
+        /** Overridden from OverlayElement */
+        void _update(void);
+
+        //-----------------------------------------------------------------------------------------
+        /** Command object for setting the caption.
+                @see ParamCommand
+        */
+        class _OgrePrivate CmdCaption : public ParamCommand
+        {
+        public:
+            String doGet( const void* target ) const;
+            void doSet( void* target, const String& val );
+        };
+        //-----------------------------------------------------------------------------------------
+        /** Command object for setting the char height.
+                @see ParamCommand
+        */
+        class _OgrePrivate CmdCharHeight : public ParamCommand
+        {
+        public:
+            String doGet( const void* target ) const;
+            void doSet( void* target, const String& val );
+        };
+        //-----------------------------------------------------------------------------------------
+        /** Command object for setting the width of a space.
+                @see ParamCommand
+        */
+        class _OgrePrivate CmdSpaceWidth : public ParamCommand
+        {
+        public:
+            String doGet( const void* target ) const;
+            void doSet( void* target, const String& val );
+        };
+        //-----------------------------------------------------------------------------------------
+        /** Command object for setting the caption.
+                @see ParamCommand
+        */
+        class _OgrePrivate CmdFontName : public ParamCommand
+        {
+        public:
+            String doGet( const void* target ) const;
+            void doSet( void* target, const String& val );
+        };
+        //-----------------------------------------------------------------------------------------
+        /** Command object for setting the top colour.
+                @see ParamCommand
+        */
+        class _OgrePrivate CmdColourTop : public ParamCommand
+        {
+        public:
+            String doGet( const void* target ) const;
+            void doSet( void* target, const String& val );
+        };
+        //-----------------------------------------------------------------------------------------
+        /** Command object for setting the bottom colour.
+                @see ParamCommand
+        */
+        class _OgrePrivate CmdColourBottom : public ParamCommand
+        {
+        public:
+            String doGet( const void* target ) const;
+            void doSet( void* target, const String& val );
+        };
+        //-----------------------------------------------------------------------------------------
+        /** Command object for setting the constant colour.
+                @see ParamCommand
+        */
+        class _OgrePrivate CmdColour : public ParamCommand
+        {
+        public:
+            String doGet( const void* target ) const;
+            void doSet( void* target, const String& val );
+        };
+        //-----------------------------------------------------------------------------------------
+        /** Command object for setting the alignment.
+                @see ParamCommand
+        */
+        class _OgrePrivate CmdAlignment : public ParamCommand
+        {
+        public:
+            String doGet( const void* target ) const;
+            void doSet( void* target, const String& val );
+        };
+
+    protected:
+        /// The text alignment
+        Alignment mAlignment;
+
+        /// Flag indicating if this panel should be visual or just group things
+        bool mTransparent;
+
+        /// Render operation
+        RenderOperation mRenderOp;
+
+        /// Method for setting up base parameters for this class
+        void addBaseParameters(void);
+
+        static String msTypeName;
+
+        // Command objects
+        static CmdCharHeight msCmdCharHeight;
+        static CmdSpaceWidth msCmdSpaceWidth;
+        static CmdFontName msCmdFontName;
+        static CmdColour msCmdColour;
+        static CmdColourTop msCmdColourTop;
+        static CmdColourBottom msCmdColourBottom;
+        static CmdAlignment msCmdAlignment;
+
+
+        FontPtr mFont;
+        Real mCharHeight;
+        ushort mPixelCharHeight;
+        Real mSpaceWidth;
+        ushort mPixelSpaceWidth;
+        size_t mAllocSize;
+		Real mViewportAspectCoef;
+
+        /// Colours to use for the vertices
+        ColourValue mColourBottom;
+        ColourValue mColourTop;
+        bool mColoursChanged;
+
+
+        /// Internal method to allocate memory, only reallocates when necessary
+        void checkMemoryAllocation( size_t numChars );
+        /// Inherited function
+        virtual void updatePositionGeometry();
+		/// Inherited function
+		virtual void updateTextureGeometry();
+        /// Updates vertex colours
+        virtual void updateColours(void);
+    };
+	/** @} */
+	/** @} */
+}
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/Threading/OgreDefaultWorkQueue.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Threading/OgreDefaultWorkQueue.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Threading/OgreDefaultWorkQueue.h	(revision 148)
@@ -0,0 +1,42 @@
+/*-------------------------------------------------------------------------
+This source file is a 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 __OgreDefaultWorkQueue_H__
+#define __OgreDefaultWorkQueue_H__
+
+#if OGRE_THREAD_PROVIDER == 0
+	#include "OgreDefaultWorkQueueStandard.h"
+#elif OGRE_THREAD_PROVIDER == 1
+	#include "OgreDefaultWorkQueueStandard.h"
+#elif OGRE_THREAD_PROVIDER == 2
+	#include "OgreDefaultWorkQueueStandard.h"
+#elif OGRE_THREAD_PROVIDER == 3
+	#include "OgreDefaultWorkQueueTBB.h"
+#endif
+
+#endif
+
+
+
Index: /ogre_src_v1-9-0/OgreMain/include/Threading/OgreDefaultWorkQueueStandard.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Threading/OgreDefaultWorkQueueStandard.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Threading/OgreDefaultWorkQueueStandard.h	(revision 148)
@@ -0,0 +1,82 @@
+/*-------------------------------------------------------------------------
+This source file is a 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 __OgreDefaultWorkQueueStandard_H__
+#define __OgreDefaultWorkQueueStandard_H__
+
+#include "../OgreWorkQueue.h"
+
+namespace Ogre
+{
+	/** Implementation of a general purpose request / response style background work queue.
+	@remarks
+		This default implementation of a work queue starts a thread pool and 
+		provides queues to process requests. 
+	*/
+	class _OgreExport DefaultWorkQueue : public DefaultWorkQueueBase
+	{
+	public:
+
+		DefaultWorkQueue(const String& name = StringUtil::BLANK);
+		virtual ~DefaultWorkQueue(); 
+
+		/// Main function for each thread spawned.
+		virtual void _threadMain();
+
+		/// @copydoc WorkQueue::shutdown
+		virtual void shutdown();
+
+		/// @copydoc WorkQueue::startup
+		virtual void startup(bool forceRestart = true);
+
+	protected:
+		/** To be called by a separate thread; will return immediately if there
+			are items in the queue, or suspend the thread until new items are added
+			otherwise.
+		*/
+		virtual void waitForNextRequest();
+
+		/// Notify that a thread has registered itself with the render system
+		virtual void notifyThreadRegistered();
+
+		virtual void notifyWorkers();
+
+		size_t mNumThreadsRegisteredWithRS;
+		/// Init notification mutex (must lock before waiting on initCondition)
+		OGRE_MUTEX(mInitMutex);
+		/// Synchroniser token to wait / notify on thread init 
+		OGRE_THREAD_SYNCHRONISER(mInitSync);
+
+		OGRE_THREAD_SYNCHRONISER(mRequestCondition);
+#if OGRE_THREAD_SUPPORT
+		typedef vector<OGRE_THREAD_TYPE*>::type WorkerThreadList;
+		WorkerThreadList mWorkers;
+#endif
+
+	};
+
+}
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/Threading/OgreDefaultWorkQueueTBB.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Threading/OgreDefaultWorkQueueTBB.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Threading/OgreDefaultWorkQueueTBB.h	(revision 148)
@@ -0,0 +1,78 @@
+/*-------------------------------------------------------------------------
+This source file is a 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 __OgreDefaultWorkQueueTBB_H__
+#define __OgreDefaultWorkQueueTBB_H__
+
+#include "../OgreWorkQueue.h"
+#include <set>
+
+namespace Ogre
+{
+	/** Implementation of a general purpose request / response style background work queue.
+	@remarks
+		This implementation utilises tbb's task system for the WorkQueue implementation.
+	*/
+	class _OgreExport DefaultWorkQueue : public DefaultWorkQueueBase
+	{
+	public:
+		DefaultWorkQueue(const String& name = StringUtil::BLANK);
+		virtual ~DefaultWorkQueue();
+		/** Process the next request on the queue. 
+		@remarks
+			This method is public, but only intended for advanced users to call. 
+			The only reason you would call this, is if you were using your 
+			own thread to drive the worker processing. The thread calling this
+			method will be the thread used to call the RequestHandler.
+		*/
+
+		/// Main function for each thread spawned.
+		virtual void _threadMain();
+
+		/// @copydoc WorkQueue::shutdown
+		virtual void shutdown();
+
+		/// @copydoc WorkQueue::startup
+		virtual void startup(bool forceRestart = true);
+
+		/// Register the current thread with the rendersystem
+		void _registerThreadWithRenderSystem();
+
+	protected:
+		virtual void notifyWorkers();
+
+	private:
+		tbb::task_scheduler_init mTaskScheduler;
+		tbb::task_group mTaskGroup;
+		/// Synchronise registering threads with the RenderSystem
+		OGRE_MUTEX(mRegisterRSMutex);
+		std::set<tbb::tbb_thread::id> mRegisteredThreads;
+	};
+
+
+}
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/Threading/OgreThreadDefines.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Threading/OgreThreadDefines.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Threading/OgreThreadDefines.h	(revision 148)
@@ -0,0 +1,41 @@
+/*-------------------------------------------------------------------------
+This source file is a 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 __OgreThreadDefines_H__
+#define __OgreThreadDefines_H__
+
+#define OGRE_AUTO_MUTEX_NAME mutex
+#if OGRE_THREAD_PROVIDER == 0
+	#include "OgreThreadDefinesNone.h"
+#elif OGRE_THREAD_PROVIDER == 1
+	#include "OgreThreadDefinesBoost.h"
+#elif OGRE_THREAD_PROVIDER == 2
+	#include "OgreThreadDefinesPoco.h"
+#elif OGRE_THREAD_PROVIDER == 3
+	#include "OgreThreadDefinesTBB.h"
+#endif
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/Threading/OgreThreadDefinesBoost.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Threading/OgreThreadDefinesBoost.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Threading/OgreThreadDefinesBoost.h	(revision 148)
@@ -0,0 +1,83 @@
+/*-------------------------------------------------------------------------
+This source file is a 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 __OgreThreadDefinesBoost_H__
+#define __OgreThreadDefinesBoost_H__
+
+#define OGRE_TOKEN_PASTE(x, y) x ## y
+#define OGRE_TOKEN_PASTE_EXTRA(x, y) OGRE_TOKEN_PASTE(x, y)
+
+#if BOOST_THREAD_VERSION < 4
+#define OGRE_LOCK_AUTO_MUTEX boost::recursive_mutex::scoped_lock ogreAutoMutexLock(OGRE_AUTO_MUTEX_NAME)
+#define OGRE_LOCK_MUTEX(name) boost::recursive_mutex::scoped_lock OGRE_TOKEN_PASTE_EXTRA(ogrenameLock, __LINE__) (name)
+#define OGRE_LOCK_MUTEX_NAMED(mutexName, lockName) boost::recursive_mutex::scoped_lock lockName(mutexName)
+#define OGRE_THREAD_SYNCHRONISER(sync) boost::condition sync
+#define OGRE_THREAD_SLEEP(ms) boost::this_thread::sleep(boost::posix_time::millisec(ms))
+#else
+#define OGRE_LOCK_AUTO_MUTEX boost::unique_lock<boost::recursive_mutex> ogreAutoMutexLock(OGRE_AUTO_MUTEX_NAME)
+#define OGRE_LOCK_MUTEX(name) boost::unique_lock<boost::recursive_mutex> OGRE_TOKEN_PASTE_EXTRA(ogrenameLock, __LINE__) (name)
+#define OGRE_LOCK_MUTEX_NAMED(mutexName, lockName) boost::unique_lock<boost::recursive_mutex> lockName(mutexName)
+#define OGRE_THREAD_SYNCHRONISER(sync) boost::condition_variable_any sync
+#define OGRE_THREAD_SLEEP(ms) boost::this_thread::sleep_for(boost::chrono::milliseconds(ms))
+#endif
+
+#define OGRE_AUTO_MUTEX mutable boost::recursive_mutex OGRE_AUTO_MUTEX_NAME
+#define OGRE_MUTEX(name) mutable boost::recursive_mutex name
+#define OGRE_STATIC_MUTEX(name) static boost::recursive_mutex name
+#define OGRE_STATIC_MUTEX_INSTANCE(name) boost::recursive_mutex name
+// like OGRE_AUTO_MUTEX but mutex held by pointer
+#define OGRE_AUTO_SHARED_MUTEX mutable boost::recursive_mutex *OGRE_AUTO_MUTEX_NAME
+#define OGRE_LOCK_AUTO_SHARED_MUTEX assert(OGRE_AUTO_MUTEX_NAME); boost::recursive_mutex::scoped_lock ogreAutoMutexLock(*OGRE_AUTO_MUTEX_NAME)
+#define OGRE_NEW_AUTO_SHARED_MUTEX assert(!OGRE_AUTO_MUTEX_NAME); OGRE_AUTO_MUTEX_NAME = new boost::recursive_mutex()
+#define OGRE_DELETE_AUTO_SHARED_MUTEX do { assert(OGRE_AUTO_MUTEX_NAME); delete OGRE_AUTO_MUTEX_NAME; } while (0)
+#define OGRE_COPY_AUTO_SHARED_MUTEX(from) assert(!OGRE_AUTO_MUTEX_NAME); OGRE_AUTO_MUTEX_NAME = from
+#define OGRE_SET_AUTO_SHARED_MUTEX_NULL OGRE_AUTO_MUTEX_NAME = 0
+#define OGRE_MUTEX_CONDITIONAL(mutex) if (mutex)
+#define OGRE_THREAD_WAIT(sync, mutex, lock) sync.wait(lock)
+#define OGRE_THREAD_NOTIFY_ONE(sync) sync.notify_one()
+#define OGRE_THREAD_NOTIFY_ALL(sync) sync.notify_all()
+// Read-write mutex
+#define OGRE_RW_MUTEX(name) mutable boost::shared_mutex name
+#define OGRE_LOCK_RW_MUTEX_READ(name) boost::shared_lock<boost::shared_mutex> ogrenameLock(name)
+#define OGRE_LOCK_RW_MUTEX_WRITE(name) boost::unique_lock<boost::shared_mutex> ogrenameLock(name)
+// Thread-local pointer
+#define OGRE_THREAD_POINTER(T, var) boost::thread_specific_ptr<T> var
+#define OGRE_THREAD_POINTER_INIT(var) var(&deletePtr)
+#define OGRE_THREAD_POINTER_VAR(T, var) boost::thread_specific_ptr<T> var (&deletePtr<T>)
+#define OGRE_THREAD_POINTER_SET(var, expr) var.reset(expr)
+#define OGRE_THREAD_POINTER_GET(var) var.get()
+#define OGRE_THREAD_POINTER_DELETE(var) var.reset(0)
+// Thread objects and related functions
+#define OGRE_THREAD_TYPE boost::thread
+#define OGRE_THREAD_CREATE(name, worker) boost::thread* name = OGRE_NEW_T(boost::thread, MEMCATEGORY_GENERAL)(worker)
+#define OGRE_THREAD_DESTROY(name) OGRE_DELETE_T(name, thread, MEMCATEGORY_GENERAL)
+#define OGRE_THREAD_HARDWARE_CONCURRENCY boost::thread::hardware_concurrency()
+#define OGRE_THREAD_CURRENT_ID boost::this_thread::get_id()
+#define OGRE_THREAD_WORKER_INHERIT
+// Utility
+#define OGRE_THREAD_ID_TYPE boost::thread::id
+#define OGRE_THREAD_YIELD boost::this_thread::yield()
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/Threading/OgreThreadDefinesNone.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Threading/OgreThreadDefinesNone.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Threading/OgreThreadDefinesNone.h	(revision 148)
@@ -0,0 +1,60 @@
+/*-------------------------------------------------------------------------
+This source file is a 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 __OgreThreadDefinesNone_H__
+#define __OgreThreadDefinesNone_H__
+
+#define OGRE_AUTO_MUTEX
+#define OGRE_LOCK_AUTO_MUTEX
+#define OGRE_MUTEX(name)
+#define OGRE_STATIC_MUTEX(name)
+#define OGRE_STATIC_MUTEX_INSTANCE(name)
+#define OGRE_LOCK_MUTEX(name)
+#define OGRE_LOCK_MUTEX_NAMED(mutexName, lockName)
+#define OGRE_AUTO_SHARED_MUTEX
+#define OGRE_LOCK_AUTO_SHARED_MUTEX
+#define OGRE_NEW_AUTO_SHARED_MUTEX
+#define OGRE_DELETE_AUTO_SHARED_MUTEX
+#define OGRE_COPY_AUTO_SHARED_MUTEX(from)
+#define OGRE_SET_AUTO_SHARED_MUTEX_NULL
+#define OGRE_MUTEX_CONDITIONAL(name) if(true)
+#define OGRE_RW_MUTEX(name)
+#define OGRE_LOCK_RW_MUTEX_READ(name)
+#define OGRE_LOCK_RW_MUTEX_WRITE(name)
+#define OGRE_THREAD_SYNCHRONISER(sync) 
+#define OGRE_THREAD_WAIT(sync, lock) 
+#define OGRE_THREAD_NOTIFY_ONE(sync) 
+#define OGRE_THREAD_NOTIFY_ALL(sync) 
+#define OGRE_THREAD_POINTER(T, var) T* var
+#define OGRE_THREAD_POINTER_INIT(var) var(0)
+#define OGRE_THREAD_POINTER_VAR(T, var) T* var = 0
+#define OGRE_THREAD_POINTER_SET(var, expr) var = expr
+#define OGRE_THREAD_POINTER_GET(var) var
+#define OGRE_THREAD_POINTER_DELETE(var) do { OGRE_DELETE var; var = 0; } while (0)
+#define OGRE_THREAD_SLEEP(ms)
+#define OGRE_THREAD_WORKER_INHERIT
+#define OGRE_THREAD_YIELD
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/Threading/OgreThreadDefinesPoco.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Threading/OgreThreadDefinesPoco.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Threading/OgreThreadDefinesPoco.h	(revision 148)
@@ -0,0 +1,74 @@
+/*-------------------------------------------------------------------------
+This source file is a 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 __OgreThreadDefinesPoco_H__
+#define __OgreThreadDefinesPoco_H__
+
+#define OGRE_TOKEN_PASTE(x, y) x ## y
+#define OGRE_TOKEN_PASTE_EXTRA(x, y) OGRE_TOKEN_PASTE(x, y)
+#define OGRE_AUTO_MUTEX mutable Poco::Mutex OGRE_AUTO_MUTEX_NAME
+#define OGRE_LOCK_AUTO_MUTEX Poco::Mutex::ScopedLock ogreAutoMutexLock(OGRE_AUTO_MUTEX_NAME)
+#define OGRE_MUTEX(name) mutable Poco::Mutex name
+#define OGRE_STATIC_MUTEX(name) static Poco::Mutex name
+#define OGRE_STATIC_MUTEX_INSTANCE(name) Poco::Mutex name
+#define OGRE_LOCK_MUTEX(name) Poco::Mutex::ScopedLock OGRE_TOKEN_PASTE_EXTRA(ogrenameLock, __LINE__) (name)
+#define OGRE_LOCK_MUTEX_NAMED(mutexName, lockName) Poco::Mutex::ScopedLock lockName(mutexName)
+// like OGRE_AUTO_MUTEX but mutex held by pointer
+#define OGRE_AUTO_SHARED_MUTEX mutable Poco::Mutex *OGRE_AUTO_MUTEX_NAME
+#define OGRE_LOCK_AUTO_SHARED_MUTEX assert(OGRE_AUTO_MUTEX_NAME); Poco::Mutex::ScopedLock ogreAutoMutexLock(*OGRE_AUTO_MUTEX_NAME)
+#define OGRE_NEW_AUTO_SHARED_MUTEX assert(!OGRE_AUTO_MUTEX_NAME); OGRE_AUTO_MUTEX_NAME = new Poco::Mutex()
+#define OGRE_DELETE_AUTO_SHARED_MUTEX assert(OGRE_AUTO_MUTEX_NAME); delete OGRE_AUTO_MUTEX_NAME
+#define OGRE_COPY_AUTO_SHARED_MUTEX(from) assert(!OGRE_AUTO_MUTEX_NAME); OGRE_AUTO_MUTEX_NAME = from
+#define OGRE_SET_AUTO_SHARED_MUTEX_NULL OGRE_AUTO_MUTEX_NAME = 0
+#define OGRE_MUTEX_CONDITIONAL(mutex) if (mutex)
+#define OGRE_THREAD_SYNCHRONISER(sync) Poco::Condition sync
+#define OGRE_THREAD_WAIT(sync, mutex, lock) sync.wait(mutex)
+#define OGRE_THREAD_NOTIFY_ONE(sync) sync.signal()
+#define OGRE_THREAD_NOTIFY_ALL(sync) sync.broadcast()
+// Read-write mutex
+#define OGRE_RW_MUTEX(name) mutable Poco::RWLock name
+#define OGRE_LOCK_RW_MUTEX_READ(name) Poco::RWLock::ScopedLock ogrenameLock(name, false)
+#define OGRE_LOCK_RW_MUTEX_WRITE(name) Poco::RWLock::ScopedLock ogrenameLock(name, true)
+// Thread-local pointer
+#define OGRE_THREAD_POINTER(T, var) Poco::ThreadLocal<SharedPtr<T> > var
+#define OGRE_THREAD_POINTER_INIT(var) var()
+#define OGRE_THREAD_POINTER_VAR(T, var) Poco::ThreadLocal<SharedPtr<T> > var
+#define OGRE_THREAD_POINTER_GET(var) var.get().get()
+#define OGRE_THREAD_POINTER_SET(var, expr) do { var.get().setNull(); var.get().bind(expr); } while (0)
+#define OGRE_THREAD_POINTER_DELETE(var) var.get().setNull()
+// Thread objects and related functions
+#define OGRE_THREAD_TYPE Poco::Thread
+#define OGRE_THREAD_CREATE(name, worker) Poco::Thread* name = OGRE_NEW_T(Poco::Thread, MEMCATEGORY_GENERAL)(); name->start(worker)
+#define OGRE_THREAD_DESTROY(name) OGRE_DELETE_T(name, Thread, MEMCATEGORY_GENERAL)
+#define OGRE_THREAD_HARDWARE_CONCURRENCY Poco::Environment::processorCount()
+#define OGRE_THREAD_CURRENT_ID (size_t)Poco::Thread::current()
+#define OGRE_THREAD_WORKER_INHERIT : public Poco::Runnable
+// (hardware concurrency is not accessible via POCO atm)
+// Utility
+#define OGRE_THREAD_SLEEP(ms) Poco::Thread::sleep(ms)
+#define OGRE_THREAD_ID_TYPE size_t
+#define OGRE_THREAD_YIELD Poco::Thread::yield()
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/Threading/OgreThreadDefinesTBB.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Threading/OgreThreadDefinesTBB.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Threading/OgreThreadDefinesTBB.h	(revision 148)
@@ -0,0 +1,67 @@
+/*-------------------------------------------------------------------------
+This source file is a 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 __OgreThreadDefinesTBB_H__
+#define __OgreThreadDefinesTBB_H__
+
+#define OGRE_TOKEN_PASTE(x, y) x ## y
+#define OGRE_TOKEN_PASTE_EXTRA(x, y) OGRE_TOKEN_PASTE(x, y)
+#define OGRE_AUTO_MUTEX mutable tbb::recursive_mutex OGRE_AUTO_MUTEX_NAME
+#define OGRE_LOCK_AUTO_MUTEX tbb::recursive_mutex::scoped_lock ogreAutoMutexLock(OGRE_AUTO_MUTEX_NAME)
+#define OGRE_MUTEX(name) mutable tbb::recursive_mutex name
+#define OGRE_STATIC_MUTEX(name) static tbb::recursive_mutex name
+#define OGRE_STATIC_MUTEX_INSTANCE(name) tbb::recursive_mutex name
+#define OGRE_LOCK_MUTEX(name) tbb::recursive_mutex::scoped_lock OGRE_TOKEN_PASTE_EXTRA(ogrenameLock, __LINE__) (name)
+#define OGRE_LOCK_MUTEX_NAMED(mutexName, lockName) tbb::recursive_mutex::scoped_lock lockName(mutexName)
+// like OGRE_AUTO_MUTEX but mutex held by pointer
+#define OGRE_AUTO_SHARED_MUTEX mutable tbb::recursive_mutex *OGRE_AUTO_MUTEX_NAME
+#define OGRE_LOCK_AUTO_SHARED_MUTEX assert(OGRE_AUTO_MUTEX_NAME); tbb::recursive_mutex::scoped_lock ogreAutoMutexLock(*OGRE_AUTO_MUTEX_NAME)
+#define OGRE_NEW_AUTO_SHARED_MUTEX assert(!OGRE_AUTO_MUTEX_NAME); OGRE_AUTO_MUTEX_NAME = new tbb::recursive_mutex()
+#define OGRE_DELETE_AUTO_SHARED_MUTEX assert(OGRE_AUTO_MUTEX_NAME); delete OGRE_AUTO_MUTEX_NAME
+#define OGRE_COPY_AUTO_SHARED_MUTEX(from) assert(!OGRE_AUTO_MUTEX_NAME); OGRE_AUTO_MUTEX_NAME = from
+#define OGRE_SET_AUTO_SHARED_MUTEX_NULL OGRE_AUTO_MUTEX_NAME = 0
+#define OGRE_MUTEX_CONDITIONAL(mutex) if (mutex)
+// Read-write mutex
+#define OGRE_RW_MUTEX(name) mutable tbb::queuing_rw_mutex name
+#define OGRE_LOCK_RW_MUTEX_READ(name) tbb::queuing_rw_mutex::scoped_lock ogrenameLock(name, false)
+#define OGRE_LOCK_RW_MUTEX_WRITE(name) tbb::queuing_rw_mutex::scoped_lock ogrenameLock(name, true)
+// Thread-local pointer
+#define OGRE_THREAD_POINTER(T, var) tbb::enumerable_thread_specific<SharedPtr<T> > var
+#define OGRE_THREAD_POINTER_INIT(var) var()
+#define OGRE_THREAD_POINTER_VAR(T, var) tbb::enumerable_thread_specific<SharedPtr<T> > var
+#define OGRE_THREAD_POINTER_GET(var) var.local().get()
+#define OGRE_THREAD_POINTER_SET(var, expr) do { var.local().setNull(); var.local().bind(expr); } while (0)
+#define OGRE_THREAD_POINTER_DELETE(var) var.local().setNull()
+// Utility
+#define OGRE_THREAD_HARDWARE_CONCURRENCY tbb::task_scheduler_init::default_num_threads()
+#define OGRE_THREAD_CURRENT_ID tbb::this_tbb_thread::get_id() 
+#define OGRE_THREAD_SLEEP(ms) tbb::this_tbb_thread::sleep(tbb::tick_count::interval_t(double(ms)/1000))
+#define OGRE_THREAD_WORKER_INHERIT
+#define OGRE_THREAD_ID_TYPE tbb::tbb_thread::id
+#define OGRE_THREAD_YIELD tbb::this_tbb_thread::yield()
+
+#endif
+
+
Index: /ogre_src_v1-9-0/OgreMain/include/Threading/OgreThreadHeaders.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Threading/OgreThreadHeaders.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Threading/OgreThreadHeaders.h	(revision 148)
@@ -0,0 +1,45 @@
+/*-------------------------------------------------------------------------
+This source file is a 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 __OgreThreadHeaders_H__
+#define __OgreThreadHeaders_H__
+
+#if !defined(NOMINMAX) && defined(_MSC_VER)
+#	define NOMINMAX // required to stop windows.h messing up std::min
+#endif
+
+#if OGRE_THREAD_PROVIDER == 1
+	#include "OgreThreadHeadersBoost.h"
+#elif OGRE_THREAD_PROVIDER == 2
+	#include "OgreThreadHeadersPoco.h"
+#elif OGRE_THREAD_PROVIDER == 3
+	#include "OgreThreadHeadersTBB.h"
+#endif
+
+#include "OgreThreadDefines.h"
+
+#endif
+
+
Index: /ogre_src_v1-9-0/OgreMain/include/Threading/OgreThreadHeadersBoost.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Threading/OgreThreadHeadersBoost.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Threading/OgreThreadHeadersBoost.h	(revision 148)
@@ -0,0 +1,57 @@
+/*-------------------------------------------------------------------------
+This source file is a 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 __OgreThreadHeadersBoost_H__
+#define __OgreThreadHeadersBoost_H__
+
+#if OGRE_COMPILER == OGRE_COMPILER_CLANG || OGRE_COMPILER == OGRE_COMPILER_GNUC
+#   pragma GCC diagnostic push
+#if OGRE_COMPILER == OGRE_COMPILER_GNUC
+#   pragma GCC diagnostic ignored "-Wpragmas"
+#elif OGRE_COMPILER == OGRE_COMPILER_CLANG
+#   pragma GCC diagnostic ignored "-Wdocumentation"
+#endif
+#   pragma GCC diagnostic ignored "-Wshadow"
+#   pragma GCC diagnostic ignored "-Wpadded"
+#   pragma GCC diagnostic ignored "-Wweak-vtables"
+#   pragma GCC diagnostic ignored "-Wall"
+#   pragma GCC diagnostic ignored "-Wshorten-64-to-32"
+#   pragma GCC diagnostic ignored "-Wunused-local-typedefs"
+#   pragma GCC diagnostic ignored "-Wunused-variable"
+#   pragma GCC diagnostic ignored "-Wundef"
+#endif
+
+#include <boost/thread/tss.hpp>
+#include <boost/thread/recursive_mutex.hpp>
+#include <boost/thread/condition.hpp>
+#include <boost/thread/thread.hpp>
+#include <boost/thread/shared_mutex.hpp>
+#include <boost/thread/locks.hpp>
+
+#if OGRE_COMPILER == OGRE_COMPILER_CLANG || OGRE_COMPILER == OGRE_COMPILER_GNUC
+#   pragma GCC diagnostic pop
+#endif
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/Threading/OgreThreadHeadersPoco.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Threading/OgreThreadHeadersPoco.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Threading/OgreThreadHeadersPoco.h	(revision 148)
@@ -0,0 +1,42 @@
+/*-------------------------------------------------------------------------
+This source file is a 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 __OgreThreadHeadersPoco_H__
+#define __OgreThreadHeadersPoco_H__
+
+#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
+#define POCO_NO_UNWINDOWS
+#endif
+
+#include <Poco/ThreadLocal.h>
+#include <Poco/Mutex.h>
+#include <Poco/Condition.h>
+#include <Poco/Thread.h>
+#include <Poco/Runnable.h>
+#include <Poco/RWLock.h>
+#include <Poco/Environment.h>
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/Threading/OgreThreadHeadersTBB.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/Threading/OgreThreadHeadersTBB.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/Threading/OgreThreadHeadersTBB.h	(revision 148)
@@ -0,0 +1,39 @@
+/*-------------------------------------------------------------------------
+This source file is a 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 __OgreThreadHeadersTBB_H__
+#define __OgreThreadHeadersTBB_H__
+
+#include <tbb/recursive_mutex.h>
+#include <tbb/task_group.h>
+#include <tbb/task_scheduler_init.h>
+#include <tbb/queuing_rw_mutex.h>
+#include <tbb/enumerable_thread_specific.h>
+#include <tbb/tbb_thread.h>
+
+
+#endif
+
+
Index: /ogre_src_v1-9-0/OgreMain/include/WIN32/OgreConfigDialogImp.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/WIN32/OgreConfigDialogImp.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/WIN32/OgreConfigDialogImp.h	(revision 148)
@@ -0,0 +1,95 @@
+/*
+-----------------------------------------------------------------------------
+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 __Win32ConfigDialog_H__
+#define __Win32ConfigDialog_H__
+
+#include "../OgrePrerequisites.h"
+
+#define WIN32_LEAN_AND_MEAN
+#if !defined(NOMINMAX) && defined(_MSC_VER)
+#	define NOMINMAX // required to stop windows.h messing up std::min
+#endif
+#include <windows.h>
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+
+	/** Defines the behaviour of an automatic renderer configuration dialog.
+	@remarks
+		OGRE comes with it's own renderer configuration dialog, which
+		applications can use to easily allow the user to configure the
+		settings appropriate to their machine. This class defines the
+		interface to this standard dialog. Because dialogs are inherently
+		tied to a particular platform's windowing system, there will be a
+		different subclass for each platform.
+	@author
+		Steven J. Streeting
+	*/
+	class _OgreExport ConfigDialog : public UtilityAlloc
+    {
+    public:
+        ConfigDialog();
+		~ConfigDialog();
+        
+		/** Displays the dialog.
+		@remarks
+			This method displays the dialog and from then on the dialog
+			interacts with the user independently. The dialog will be
+			calling the relevant OGRE rendering systems to query them for
+			options and to set the options the user selects. The method
+			returns when the user closes the dialog.
+		@returns
+			If the user accepted the dialog, <b>true</b> is returned.
+		@par
+			If the user cancelled the dialog (indicating the application
+			should probably terminate), <b>false</b> is returned.
+		@see
+			RenderSystem
+		*/
+        bool display();
+
+    protected:
+        /** Callback to process window events */
+#if OGRE_ARCHITECTURE_64 == OGRE_ARCH_TYPE
+        static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam);
+#else
+        static BOOL CALLBACK DlgProc(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam);
+#endif
+		RenderSystem* mSelectedRenderSystem;
+        HINSTANCE mHInstance; // HInstance of application, for dialog
+    };
+	/** @} */
+	/** @} */
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/WIN32/OgreConfigDialogImpWinRT.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/WIN32/OgreConfigDialogImpWinRT.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/WIN32/OgreConfigDialogImpWinRT.h	(revision 148)
@@ -0,0 +1,88 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2011 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 __Win32ConfigDialog_H__
+#define __Win32ConfigDialog_H__
+
+#include "../OgrePrerequisites.h"
+
+#define WIN32_LEAN_AND_MEAN
+#if !defined(NOMINMAX) && defined(_MSC_VER)
+#	define NOMINMAX // required to stop windows.h messing up std::min
+#endif
+#include "windows.h"
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+
+	/** Defines the behaviour of an automatic renderer configuration dialog.
+	@remarks
+		OGRE comes with it's own renderer configuration dialog, which
+		applications can use to easily allow the user to configure the
+		settings appropriate to their machine. This class defines the
+		interface to this standard dialog. Because dialogs are inherently
+		tied to a particular platform's windowing system, there will be a
+		different subclass for each platform.
+	@author
+		Steven J. Streeting
+	*/
+	class _OgreExport ConfigDialog : public UtilityAlloc
+    {
+    public:
+        ConfigDialog();
+		~ConfigDialog();
+        
+		/** Displays the dialog.
+		@remarks
+			This method displays the dialog and from then on the dialog
+			interacts with the user independently. The dialog will be
+			calling the relevant OGRE rendering systems to query them for
+			options and to set the options the user selects. The method
+			returns when the user closes the dialog.
+		@returns
+			If the user accepted the dialog, <b>true</b> is returned.
+		@par
+			If the user cancelled the dialog (indicating the application
+			should probably terminate), <b>false</b> is returned.
+		@see
+			RenderSystem
+		*/
+        bool display();
+
+    protected:
+		RenderSystem* mSelectedRenderSystem;
+	};
+	/** @} */
+	/** @} */
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/WIN32/OgreErrorDialogImp.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/WIN32/OgreErrorDialogImp.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/WIN32/OgreErrorDialogImp.h	(revision 148)
@@ -0,0 +1,82 @@
+/*
+-----------------------------------------------------------------------------
+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 __WIN32ERRORDIALOG_H__
+#define __WIN32ERRORDIALOG_H__
+
+#include "OgreHeaderPrefix.h"
+
+#define WIN32_LEAN_AND_MEAN
+#if !defined(NOMINMAX) && defined(_MSC_VER)
+#	define NOMINMAX // required to stop windows.h messing up std::min
+#endif
+#include <windows.h>
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+	/** Class for displaying the error dialog if Ogre fails badly. */
+    class _OgreExport ErrorDialog
+    {
+    public:
+        ErrorDialog();
+		~ErrorDialog() {}
+
+		/**
+		@remarks
+			Displays the error dialog.
+		@param
+			errorMessage The error message which has caused the failure.
+		@param
+			logName Optional name of the log to display in the detail pane.
+		*/
+        void display(const String& errorMessage, String logName = "");
+
+    protected:
+        String mErrorMsg;
+        /** Callback to process window events */
+#if OGRE_ARCHITECTURE_64 == OGRE_ARCH_TYPE
+        static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam);
+#else
+        static BOOL CALLBACK DlgProc(HWND hDlg, UINT iMsg, WPARAM wParam, LPARAM lParam);
+#endif
+
+        HINSTANCE mHInstance; // HInstance of application, for dialog
+
+    };
+	/** @} */
+	/** @} */
+}
+
+#include "OgreHeaderSuffix.h"
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/WIN32/OgreErrorDialogImpWinRT.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/WIN32/OgreErrorDialogImpWinRT.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/WIN32/OgreErrorDialogImpWinRT.h	(revision 148)
@@ -0,0 +1,60 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2011 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 __WIN32ERRORDIALOG_H__
+#define __WIN32ERRORDIALOG_H__
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+	/** Class for displaying the error dialog if Ogre fails badly. */
+    class _OgreExport ErrorDialog
+    {
+    public:
+        ErrorDialog();
+		~ErrorDialog() {}
+
+		/**
+		@remarks
+			Displays the error dialog.
+		@param
+			errorMessage The error message which has caused the failure.
+		@param
+			logName Optional name of the log to display in the detail pane.
+		*/
+        void display(const String& errorMessage, String logName = "");
+
+    };
+	/** @} */
+	/** @} */
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/WIN32/OgreMinGWSupport.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/WIN32/OgreMinGWSupport.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/WIN32/OgreMinGWSupport.h	(revision 148)
@@ -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 __Win32MinGWSupport_H__
+#define __Win32MinGWSupport_H__
+
+// This header provides a compatibility layer for some MSVC symbols
+// for MinGW. They may be needed when using MSVC libraries, most
+// notably the DirectX SDK.
+
+#ifdef __MINGW32__
+#include <stdint.h>
+
+// define a number of symbols MSVC uses for annotation.
+#include <specstrings.h>
+#define __in_z
+#define __in_z_opt
+#ifdef __MINGW64_VERSION_MAJOR
+#   define __in
+#endif
+#define UINT8 uint8_t
+#define WINAPI_INLINE inline
+#define __uuidof(Object) IID_##Object
+
+#endif
+
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/WIN32/OgreTimerImp.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/WIN32/OgreTimerImp.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/WIN32/OgreTimerImp.h	(revision 148)
@@ -0,0 +1,110 @@
+/*
+-----------------------------------------------------------------------------
+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 __Win32Timer_H__
+#define __Win32Timer_H__
+
+#ifndef WIN32_LEAN_AND_MEAN
+#	define WIN32_LEAN_AND_MEAN
+#endif
+#if !defined(NOMINMAX) && defined(_MSC_VER)
+#	define NOMINMAX // required to stop windows.h messing up std::min
+#endif
+#include <windows.h>
+
+namespace Ogre
+{
+	/** \addtogroup Core
+	*  @{
+	*/
+	/** \addtogroup General
+	*  @{
+	*/
+
+	class _OgreExport Timer : public TimerAlloc
+    {
+    private:
+		clock_t mZeroClock;
+
+        DWORD mStartTick;
+		LONGLONG mLastTime;
+        LARGE_INTEGER mStartTime;
+        LARGE_INTEGER mFrequency;
+
+#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
+		DWORD_PTR mTimerMask;
+#endif
+#if OGRE_PLATFORM == OGRE_PLATFORM_WINRT
+		DWORD GetTickCount() { return (DWORD)GetTickCount64(); }
+#endif
+
+    public:
+		/** Timer constructor.  MUST be called on same thread that calls getMilliseconds() */
+		Timer();
+		~Timer();
+
+		/** Method for setting a specific option of the Timer. These options are usually
+            specific for a certain implementation of the Timer class, and may (and probably
+            will) not exist across different implementations.  reset() must be called after
+			all setOption() calls.
+			@par
+			Current options supported are:
+			<ul><li>"QueryAffinityMask" (DWORD): Set the thread affinity mask to be used
+			to check the timer. If 'reset' has been called already this mask should
+			overlap with the process mask that was in force at that point, and should
+			be a power of two (a single core).</li></ul>
+            @param
+                strKey The name of the option to set
+            @param
+                pValue A pointer to the value - the size should be calculated by the timer
+                based on the key
+            @return
+                On success, true is returned.
+            @par
+                On failure, false is returned.
+        */
+        bool setOption( const String& strKey, const void* pValue );
+
+		/** Resets timer */
+		void reset();
+
+		/** Returns milliseconds since initialisation or last reset */
+		unsigned long getMilliseconds();
+
+		/** Returns microseconds since initialisation or last reset */
+		unsigned long getMicroseconds();
+
+		/** Returns milliseconds since initialisation or last reset, only CPU time measured */
+		unsigned long getMillisecondsCPU();
+
+		/** Returns microseconds since initialisation or last reset, only CPU time measured */
+		unsigned long getMicrosecondsCPU();
+    };
+	/** @} */
+	/** @} */
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/asm_math.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/asm_math.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/asm_math.h	(revision 148)
@@ -0,0 +1,377 @@
+#ifndef __asm_math_H__
+#define __asm_math_H__
+
+#include "OgrePrerequisites.h"
+#include "OgrePlatformInformation.h"
+
+#if  OGRE_COMPILER == OGRE_COMPILER_MSVC
+#  pragma warning (push)
+// disable "instruction may be inaccurate on some Pentiums"
+#  pragma warning (disable : 4725)
+#endif
+namespace Ogre
+{
+
+/*=============================================================================
+ ASM math routines posted by davepermen et al on flipcode forums
+=============================================================================*/
+const float pi = 4.0f * atan( 1.0f );
+const float half_pi = 0.5f * pi;
+
+/*=============================================================================
+	NO EXPLICIT RETURN REQUIRED FROM THESE METHODS!! 
+=============================================================================*/
+#if  OGRE_COMPILER == OGRE_COMPILER_MSVC && OGRE_ARCH_TYPE == OGRE_ARCHITECTURE_32 && OGRE_CPU == OGRE_CPU_X86
+#	pragma warning( push )
+#	pragma warning( disable: 4035 ) 
+#endif
+
+float asm_arccos( float r ) {
+    // return half_pi + arctan( r / -sqr( 1.f - r * r ) );
+	
+#if  OGRE_COMPILER == OGRE_COMPILER_MSVC &&  OGRE_ARCH_TYPE == OGRE_ARCHITECTURE_32 && OGRE_CPU == OGRE_CPU_X86
+
+    float asm_one = 1.f;
+    float asm_half_pi = half_pi;
+    __asm {
+        fld r // r0 = r
+        fld r // r1 = r0, r0 = r
+        fmul r // r0 = r0 * r
+        fsubr asm_one // r0 = r0 - 1.f
+        fsqrt // r0 = sqrtf( r0 )
+        fchs // r0 = - r0
+        fdiv // r0 = r1 / r0
+        fld1 // {{ r0 = atan( r0 )
+        fpatan // }}
+        fadd asm_half_pi // r0 = r0 + pi / 2
+    } // returns r0
+
+#else
+
+	return float( acos( r ) );
+
+#endif
+}
+
+float asm_arcsin( float r ) {
+    // return arctan( r / sqr( 1.f - r * r ) );
+
+#if  OGRE_COMPILER == OGRE_COMPILER_MSVC &&  OGRE_ARCH_TYPE == OGRE_ARCHITECTURE_32 && OGRE_CPU == OGRE_CPU_X86
+
+    const float asm_one = 1.f;
+    __asm {
+        fld r // r0 = r
+        fld r // r1 = r0, r0 = r
+        fmul r // r0 = r0 * r
+        fsubr asm_one // r0 = r0 - 1.f
+        fsqrt // r0 = sqrtf( r0 )
+        fdiv // r0 = r1 / r0
+        fld1 // {{ r0 = atan( r0 )
+        fpatan // }}
+    } // returns r0
+
+#else
+
+	return float( asin( r ) );
+
+#endif
+
+}
+
+float asm_arctan( float r ) {
+
+#if  OGRE_COMPILER == OGRE_COMPILER_MSVC &&  OGRE_ARCH_TYPE == OGRE_ARCHITECTURE_32 && OGRE_CPU == OGRE_CPU_X86
+
+    __asm {
+        fld r // r0 = r
+        fld1 // {{ r0 = atan( r0 )
+        fpatan // }}
+    } // returns r0
+
+#else
+
+	return float( atan( r ) );
+
+#endif
+
+}
+
+float asm_sin( float r ) {
+
+#if  OGRE_COMPILER == OGRE_COMPILER_MSVC &&  OGRE_ARCH_TYPE == OGRE_ARCHITECTURE_32 && OGRE_CPU == OGRE_CPU_X86
+
+    __asm {
+        fld r // r0 = r
+        fsin // r0 = sinf( r0 )
+    } // returns r0
+
+#else
+
+	return sin( r );
+
+#endif
+
+}
+
+float asm_cos( float r ) {
+
+#if  OGRE_COMPILER == OGRE_COMPILER_MSVC &&  OGRE_ARCH_TYPE == OGRE_ARCHITECTURE_32 && OGRE_CPU == OGRE_CPU_X86
+
+    __asm {
+        fld r // r0 = r
+        fcos // r0 = cosf( r0 )
+    } // returns r0
+
+#else
+	
+	return cos( r );
+
+#endif
+}
+
+float asm_tan( float r ) {
+
+#if  OGRE_COMPILER == OGRE_COMPILER_MSVC &&  OGRE_ARCH_TYPE == OGRE_ARCHITECTURE_32 && OGRE_CPU == OGRE_CPU_X86
+
+    // return sin( r ) / cos( r );
+    __asm {
+        fld r // r0 = r
+        fsin // r0 = sinf( r0 )
+        fld r // r1 = r0, r0 = r
+        fcos // r0 = cosf( r0 )
+        fdiv // r0 = r1 / r0
+    } // returns r0
+
+#else
+	
+	return tan( r );
+
+#endif
+}
+
+// returns a for a * a = r
+float asm_sqrt( float r )
+{
+#if  OGRE_COMPILER == OGRE_COMPILER_MSVC &&  OGRE_ARCH_TYPE == OGRE_ARCHITECTURE_32 && OGRE_CPU == OGRE_CPU_X86
+
+    __asm {
+        fld r // r0 = r
+        fsqrt // r0 = sqrtf( r0 )
+    } // returns r0
+
+#else
+
+	return sqrt( r );
+
+#endif
+}
+
+// returns 1 / a for a * a = r
+// -- Use this for Vector normalisation!!!
+float asm_rsq( float r )
+{
+#if  OGRE_COMPILER == OGRE_COMPILER_MSVC &&  OGRE_ARCH_TYPE == OGRE_ARCHITECTURE_32 && OGRE_CPU == OGRE_CPU_X86
+
+    __asm {
+        fld1 // r0 = 1.f
+        fld r // r1 = r0, r0 = r
+        fsqrt // r0 = sqrtf( r0 )
+        fdiv // r0 = r1 / r0
+    } // returns r0
+
+#else
+
+	return 1. / sqrt( r );
+
+#endif
+}
+
+// returns 1 / a for a * a = r
+// Another version
+float apx_rsq( float r ) {
+
+#if  OGRE_COMPILER == OGRE_COMPILER_MSVC &&  OGRE_ARCH_TYPE == OGRE_ARCHITECTURE_32 && OGRE_CPU == OGRE_CPU_X86
+
+    const float asm_dot5 = 0.5f;
+    const float asm_1dot5 = 1.5f;
+
+    __asm {
+        fld r // r0 = r
+        fmul asm_dot5 // r0 = r0 * .5f
+        mov eax, r // eax = r
+        shr eax, 0x1 // eax = eax >> 1
+        neg eax // eax = -eax
+        add eax, 0x5F400000 // eax = eax & MAGICAL NUMBER
+        mov r, eax // r = eax
+        fmul r // r0 = r0 * r
+        fmul r // r0 = r0 * r
+        fsubr asm_1dot5 // r0 = 1.5f - r0
+        fmul r // r0 = r0 * r
+    } // returns r0
+
+#else
+
+	return 1. / sqrt( r );
+
+#endif
+}
+
+/* very MS-specific, commented out for now
+   Finally the best InvSqrt implementation?
+   Use for vector normalisation instead of 1/length() * x,y,z
+*/
+#if  OGRE_COMPILER == OGRE_COMPILER_MSVC &&  OGRE_ARCH_TYPE == OGRE_ARCHITECTURE_32 && OGRE_CPU == OGRE_CPU_X86
+
+__declspec(naked) float __fastcall InvSqrt(float fValue)
+{
+    __asm
+    {
+        mov        eax, 0be6eb508h
+        mov        dword ptr[esp-12],03fc00000h
+        sub        eax, dword ptr[esp + 4]
+        sub        dword ptr[esp+4], 800000h
+        shr        eax, 1
+        mov        dword ptr[esp -  8], eax
+
+        fld        dword ptr[esp -  8]
+        fmul    st, st
+        fld        dword ptr[esp -  8]
+        fxch    st(1)
+        fmul    dword ptr[esp +  4]
+        fld        dword ptr[esp - 12]
+        fld        st(0)
+        fsub    st,st(2)
+
+        fld        st(1)
+        fxch    st(1)
+        fmul    st(3),st
+        fmul    st(3),st
+        fmulp    st(4),st
+        fsub    st,st(2)
+
+        fmul    st(2),st
+        fmul    st(3),st
+        fmulp    st(2),st
+        fxch    st(1)
+        fsubp    st(1),st
+
+        fmulp    st(1), st
+        ret 4
+    }
+}
+
+#endif
+
+// returns a random number
+FORCEINLINE float asm_rand()
+{
+
+#if  OGRE_COMPILER == OGRE_COMPILER_MSVC &&  OGRE_ARCH_TYPE == OGRE_ARCHITECTURE_32 && OGRE_CPU == OGRE_CPU_X86
+  #if 0
+    #if OGRE_COMP_VER >= 1300
+
+	static unsigned __int64 q = time( NULL );
+
+	_asm {
+		movq mm0, q
+
+		// do the magic MMX thing
+		pshufw mm1, mm0, 0x1E
+		paddd mm0, mm1
+
+		// move to integer memory location and free MMX
+		movq q, mm0
+		emms
+	}
+
+	return float( q );
+    #endif
+  #else
+    // VC6 does not support pshufw
+    return float( rand() );
+  #endif
+#else
+    // GCC etc
+
+	return float( rand() );
+
+#endif
+}
+
+// returns the maximum random number
+FORCEINLINE float asm_rand_max()
+{
+
+#if  OGRE_COMPILER == OGRE_COMPILER_MSVC &&  OGRE_ARCH_TYPE == OGRE_ARCHITECTURE_32 && OGRE_CPU == OGRE_CPU_X86
+  #if 0
+    #if OGRE_COMP_VER >= 1300
+
+	return (std::numeric_limits< unsigned __int64 >::max)();
+	return 9223372036854775807.0f;
+    #endif
+  #else
+    // VC6 does not support unsigned __int64
+    return float( RAND_MAX );
+  #endif
+
+#else
+    // GCC etc
+	return float( RAND_MAX );
+
+#endif
+}
+
+// returns log2( r ) / log2( e )
+float asm_ln( float r ) {    
+
+#if  OGRE_COMPILER == OGRE_COMPILER_MSVC &&  OGRE_ARCH_TYPE == OGRE_ARCHITECTURE_32 && OGRE_CPU == OGRE_CPU_X86
+
+    const float asm_1_div_log2_e = .693147180559f;
+    const float asm_neg1_div_3 = -.33333333333333333333333333333f;
+    const float asm_neg2_div_3 = -.66666666666666666666666666667f;
+    const float asm_2 = 2.f;
+
+    int log_2 = 0;
+
+    __asm {
+        // log_2 = ( ( r >> 0x17 ) & 0xFF ) - 0x80;
+        mov eax, r
+        sar eax, 0x17
+        and eax, 0xFF
+        sub eax, 0x80
+        mov log_2, eax
+
+        // r = ( r & 0x807fffff ) + 0x3f800000;
+        mov ebx, r
+        and ebx, 0x807FFFFF
+        add ebx, 0x3F800000
+        mov r, ebx
+
+        // r = ( asm_neg1_div_3 * r + asm_2 ) * r + asm_neg2_div_3;   // (1)
+        fld r
+        fmul asm_neg1_div_3
+        fadd asm_2
+        fmul r
+        fadd asm_neg2_div_3
+        fild log_2
+        fadd
+        fmul asm_1_div_log2_e
+    }
+
+#else
+
+	return log( r );
+
+#endif
+}
+
+#if  OGRE_COMPILER == OGRE_COMPILER_MSVC &&  OGRE_ARCH_TYPE == OGRE_ARCHITECTURE_32 && OGRE_CPU == OGRE_CPU_X86
+#	pragma warning( pop )
+#endif
+} // namespace
+
+#if  OGRE_COMPILER == OGRE_COMPILER_MSVC
+#  pragma warning (pop)
+#endif
+
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/gtk/OgreConfigDialogImp.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/gtk/OgreConfigDialogImp.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/gtk/OgreConfigDialogImp.h	(revision 148)
@@ -0,0 +1,97 @@
+/*
+-----------------------------------------------------------------------------
+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 __GLXCONFIGDIALOG_H__
+#define __GLXCONFIGDIALOG_H__
+
+#include "../OgrePrerequisites.h"
+#include "../OgreRoot.h"
+#include "../OgreRenderSystem.h"
+
+#include <gtk/gtk.h>
+
+namespace Ogre
+{
+    /**
+    Defines the behaviour of an automatic renderer configuration dialog.
+    @remarks
+        OGRE comes with it's own renderer configuration dialog, which
+        applications can use to easily allow the user to configure the
+        settings appropriate to their machine. This class defines the
+        interface to this standard dialog. Because dialogs are inherently
+        tied to a particular platform's windowing system, there will be a
+        different subclass for each platform.
+    @author
+        Andrew Zabolotny <zap@homelink.ru>
+    */
+    class _OgreExport ConfigDialog : public UtilityAlloc
+    {
+    public:
+        ConfigDialog();
+
+        /**
+        Displays the dialog.
+        @remarks
+            This method displays the dialog and from then on the dialog
+            interacts with the user independently. The dialog will be
+            calling the relevant OGRE rendering systems to query them for
+            options and to set the options the user selects. The method
+            returns when the user closes the dialog.
+        @returns
+            If the user accepted the dialog, <b>true</b> is returned.
+        @par
+            If the user cancelled the dialog (indicating the application
+            should probably terminate), <b>false</b> is returned.
+        @see
+            RenderSystem
+        */
+        bool display ();
+
+    protected:
+        /// The rendersystem selected by user
+        RenderSystem *mSelectedRenderSystem;
+        /// The dialog window
+        GtkWidget *mDialog;
+        /// The table with renderer parameters
+        GtkWidget *mParamTable;
+        /// The button used to accept the dialog
+        GtkWidget *mOKButton;
+
+        /// Create the gtk+ dialog window
+        bool createWindow ();
+        /// Get parameters from selected renderer and fill the dialog
+        void setupRendererParams ();
+        /// Callback function for renderer select combobox
+        static void rendererChanged (GtkComboBox *widget, gpointer data);
+        /// Callback function to change a renderer option
+        static void optionChanged (GtkComboBox *widget, gpointer data);
+	/// Idle function to refresh renderer parameters
+	static gboolean refreshParams (gpointer data);
+    };
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/gtk/OgreErrorDialogImp.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/gtk/OgreErrorDialogImp.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/gtk/OgreErrorDialogImp.h	(revision 148)
@@ -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 __OGRE_GLX_ERROR_DIALOG_H__
+#define __OGRE_GLX_ERROR_DIALOG_H__
+
+#include "../OgrePrerequisites.h"
+
+namespace Ogre
+{
+	/** Class for displaying the error dialog if Ogre fails badly. */
+	class _OgreExport ErrorDialog
+	{
+	public:
+		ErrorDialog();
+
+		/**
+		@remarks
+			Displays the error dialog.
+		@param
+			errorMessage The error message which has caused the failure.
+		@param
+			logName Optional name of the log to display in the detail pane.
+		*/
+        void display(const String& errorMessage, String logName = "");
+	};
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/iOS/OgreConfigDialogImp.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/iOS/OgreConfigDialogImp.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/iOS/OgreConfigDialogImp.h	(revision 148)
@@ -0,0 +1,56 @@
+/*
+ -----------------------------------------------------------------------------
+ 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 __iOSConfigDialog_H__
+#define __iOSConfigDialog_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreRoot.h"
+#include "OgreRenderSystem.h"
+
+namespace Ogre
+{
+	class _OgreExport ConfigDialog : public UtilityAlloc
+	{
+	public:
+		ConfigDialog();
+		~ConfigDialog();
+	
+	public:
+		void initialise();
+		void run();
+		void cancel();
+
+		bool display();
+
+	protected:
+		RenderSystem* iSelectedRenderSystem;
+		bool		iDisplayStatus;		
+	};
+}
+
+#endif // __iOS_CONFIG_DIALOG_H__
Index: /ogre_src_v1-9-0/OgreMain/include/iOS/OgreErrorDialogImp.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/iOS/OgreErrorDialogImp.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/iOS/OgreErrorDialogImp.h	(revision 148)
@@ -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 __iOSErrorDialog_H__
+#define __iOSErrorDialog_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre
+{
+	/** Class for displaying the error dialog if Ogre fails badly. */
+	class _OgreExport ErrorDialog
+	{
+	public:
+		ErrorDialog();
+
+		/**
+		@remarks
+			Displays the error dialog.
+		@param
+			errorMessage The error message which has caused the failure.
+		@param
+			logName Optional name of the log to display in the detail pane.
+		*/
+		void display(const String& errorMessage, String logName = "");
+	};
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/iOS/OgreOSXCocoaTouchView.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/iOS/OgreOSXCocoaTouchView.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/iOS/OgreOSXCocoaTouchView.h	(revision 148)
@@ -0,0 +1,55 @@
+/*
+-----------------------------------------------------------------------------
+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 __OSXCocoaView_H__
+#define __OSXCocoaView_H__
+
+#include "OgreRenderWindow.h"
+#include <UIKit/UIKit.h>
+
+@interface OgreView : UIView
+{
+	Ogre::RenderWindow *window;
+}
+
+- (id)initWithFrame:(CGRect)f;
+- (id)initWithGLiPhoneWindow:(Ogre::RenderWindow*)w;
+
+- (void)setOgreWindow:(Ogre::RenderWindow*)w;
+- (Ogre::RenderWindow*)ogreWindow;
+
+- (void)setFrameSize:(CGSize)s;
+
+@end
+
+@interface OgreWindow : UIWindow
+{}
+@end
+
+#endif
+
Index: /ogre_src_v1-9-0/OgreMain/include/iOS/OgreTimerImp.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/iOS/OgreTimerImp.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/iOS/OgreTimerImp.h	(revision 148)
@@ -0,0 +1,78 @@
+/*
+-----------------------------------------------------------------------------
+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 __iOSTimer_H__
+#define __iOSTimer_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre
+{
+	/** Timer class */
+	class _OgreExport Timer : public TimerAlloc
+	{
+	private:
+		struct timeval start;
+		clock_t zeroClock;
+	public:
+		Timer();
+		~Timer();
+
+		/** Method for setting a specific option of the Timer. These options are usually
+            specific for a certain implementation of the Timer class, and may (and probably
+            will) not exist across different implementations.  reset() must be called after
+			all setOption() calls.
+            @param
+                strKey The name of the option to set
+            @param
+                pValue A pointer to the value - the size should be calculated by the timer
+                based on the key
+            @return
+                On success, true is returned.
+            @par
+                On failure, false is returned.
+        */
+        bool setOption( const String& strKey, const void* pValue ) { return false; }
+
+		/** Resets timer */
+		void reset();
+
+		/** Returns milliseconds since initialisation or last reset */
+		unsigned long getMilliseconds();
+
+		/** Returns microseconds since initialisation or last reset */
+		unsigned long getMicroseconds();
+
+		/** Returns milliseconds since initialisation or last reset, only CPU time measured */	
+		unsigned long getMillisecondsCPU();
+
+		/** Returns microseconds since initialisation or last reset, only CPU time measured */	
+		unsigned long getMicrosecondsCPU();
+	};
+}
+#endif
Index: /ogre_src_v1-9-0/OgreMain/include/iOS/macUtils.h
===================================================================
--- /ogre_src_v1-9-0/OgreMain/include/iOS/macUtils.h	(revision 148)
+++ /ogre_src_v1-9-0/OgreMain/include/iOS/macUtils.h	(revision 148)
@@ -0,0 +1,38 @@
+/*
+-----------------------------------------------------------------------------
+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 <CoreFoundation/CoreFoundation.h>
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+    void* mac_loadDylib(const char* name);
+    _OgreExport String macCachePath();
+    _OgreExport String macBundlePath(void);
+    _OgreExport String macTempFileName(void);
+    _OgreExport String iOSDocumentsDirectory(void);
+}
