Index: /GTP/trunk/App/Demos/Geom/OgreStuff/media/overlays/Example-CubeMapping.overlay
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/media/overlays/Example-CubeMapping.overlay	(revision 1092)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/media/overlays/Example-CubeMapping.overlay	(revision 1812)
@@ -30,5 +30,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption [1/2] Displacement:
@@ -44,5 +44,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption [3/4] Noise density:
@@ -58,5 +58,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption [5/6] Time density:
@@ -73,5 +73,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption [N] Noise: _not_set_
@@ -87,5 +87,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption [M] Material: *UNIMPLEMENTED*
@@ -101,5 +101,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption [O] Object:
@@ -115,5 +115,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption [C] CubeMap:
@@ -129,5 +129,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption [SPACE] Go random!
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/media/overlays/Example-DynTex.overlay
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/media/overlays/Example-DynTex.overlay	(revision 1092)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/media/overlays/Example-DynTex.overlay	(revision 1812)
@@ -30,5 +30,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption Reaction parameters
@@ -44,5 +44,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption [1/2]K:
@@ -58,5 +58,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption [3/4]F:
@@ -72,5 +72,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption [5/6]Diffusion 1:
@@ -86,5 +86,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption [7/8]Diffusion 2:
@@ -100,5 +100,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption [0]Reset initial conditions
@@ -141,5 +141,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption Julia parameters
@@ -155,5 +155,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption [1/2]real:
@@ -169,5 +169,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption [3/4]imag:
@@ -183,5 +183,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption [5/6]theta:
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/media/overlays/DP3.overlay
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/media/overlays/DP3.overlay	(revision 1092)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/media/overlays/DP3.overlay	(revision 1812)
@@ -30,5 +30,5 @@
 			width 180
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption [1,2,3] toggle lights
@@ -44,5 +44,5 @@
 			width 180
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption [O] change objects
@@ -57,5 +57,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption Current:
@@ -71,5 +71,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption [M] Change material
@@ -84,5 +84,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption Current:
@@ -97,5 +97,5 @@
 			width 250
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			colour_top 0.5 0.7 0.5
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/media/overlays/Demo_LodStrips.overlay
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/media/overlays/Demo_LodStrips.overlay	(revision 1780)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/media/overlays/Demo_LodStrips.overlay	(revision 1812)
@@ -31,5 +31,5 @@
 			width 180
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			colour_top 0.5 0.7 0.5
@@ -43,5 +43,5 @@
 			width 180
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 18
 			colour_top    1 1 0.7
@@ -55,5 +55,5 @@
 			width 90
 			height 50
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			colour_top 0.5 0.7 0.5
@@ -67,5 +67,5 @@
 			width 90
 			height 50
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			colour_top 0.5 0.7 0.5
@@ -79,5 +79,5 @@
 			width 90
 			height 50
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			colour_top 0.5 0.7 0.5
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/media/overlays/Shadows.overlay
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/media/overlays/Shadows.overlay	(revision 1092)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/media/overlays/Shadows.overlay	(revision 1812)
@@ -31,5 +31,5 @@
 			width 180
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption [O] Shadow Technique
@@ -44,5 +44,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption Current:
@@ -58,5 +58,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption [M] Athene Material
@@ -71,5 +71,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption Current:
@@ -84,5 +84,5 @@
 			width 250
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			colour_top 0.5 0.7 0.5
@@ -91,67 +91,2 @@
 	}
 }
-
-Example/ShadowsOverlay2
-{
-	zorder 500
-	// Stats block
-	container BorderPanel(Core/ShadowsPanel2)
-	{
-		metrics_mode pixels
-		vert_align top
-		left 5 
-		top 5
-		width 500
-		height 55
-		material Core/StatsBlockCenter
-        	border_size 1 1 1 1
-        	border_material Core/StatsBlockBorder
-        	border_topleft_uv     0.0000 1.0000 0.0039 0.9961
-	    	border_top_uv         0.0039 1.0000 0.9961 0.9961
-	    	border_topright_uv    0.9961 1.0000 1.0000 0.9961
-	    	border_left_uv        0.0000 0.9961 0.0039 0.0039
-	    	border_right_uv       0.9961 0.9961 1.0000 0.0039
-	    	border_bottomleft_uv  0.0000 0.0039 0.0039 0.0000
-        	border_bottom_uv      0.0039 0.0039 0.9961 0.0000
-	    	border_bottomright_uv 0.9961 0.0039 1.0000 0.0000
-
-
-		element TextArea(Example/Shadows/Info_1)
-		{
-			metrics_mode pixels
-			left 5
-			top 5
-			width 180
-			height 30
-			font_name TrebuchetMSBold
-			char_height 16
-			colour_top 0.5 0.7 0.5
-			colour_bottom 0.3 0.5 0.3
-		}
-		element TextArea(Example/Shadows/Info_2)
-		{
-			metrics_mode pixels
-			left 5
-			top 20
-			width 90
-			height 30
-			font_name TrebuchetMSBold
-			char_height 16
-			colour_top 0.5 0.7 0.5
-			colour_bottom 0.3 0.5 0.3
-		}
-		element TextArea(Example/Shadows/Info_3)
-		{
-			metrics_mode pixels
-			left 5
-			top 35
-			width 250
-			height 30
-			font_name TrebuchetMSBold
-			char_height 16
-			colour_top 0.5 0.7 0.5
-			colour_bottom 0.3 0.5 0.3
-		}
-	}
-}
-
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/media/overlays/Example-Water.overlay
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/media/overlays/Example-Water.overlay	(revision 1092)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/media/overlays/Example-Water.overlay	(revision 1812)
@@ -31,5 +31,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption [N]Normals:
@@ -45,5 +45,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption [SPACE]Rain
@@ -59,5 +59,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption [B]SkyBox: 
@@ -73,5 +73,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption [U/J]Head depth:
@@ -87,5 +87,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption [M]Material:
@@ -101,5 +101,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption Careful with these values!
@@ -115,5 +115,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption [1/2]Ripple speed:
@@ -129,5 +129,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption [3/4]Distance:
@@ -143,5 +143,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption [5/6]Viscosity:
@@ -157,5 +157,5 @@
 			width 90
 			height 30
-			font_name TrebuchetMSBold
+			font_name BlueHighway
 			char_height 16
 			caption [7/8]Time period:
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/media/fonts/sample.fontdef
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/media/fonts/sample.fontdef	(revision 1092)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/media/fonts/sample.fontdef	(revision 1812)
@@ -1,11 +1,2 @@
-IronMaiden
-{
-	// Blame cearny for this one!
-	type 		truetype
-	source 		maiden.ttf
-	size 		48
-	resolution 	96
-}
-
 StarWars
 {
@@ -18,104 +9,3 @@
 }
 
-Ogre
-{
-	type	image
-	source 	font_matisse_itc.png
 
-glyph	!	0.0898438	0.125	0.0976563	0.1875
-glyph	 	0.152344	0.125	0.160156	0.1875
-glyph	#	0.205078	0.125	0.232422	0.1875
-glyph	$	0.273438	0.125	0.289063	0.1875
-glyph	%	0.330078	0.125	0.357422	0.1875
-glyph	&	0.396484	0.125	0.416016	0.1875
-glyph	'	0.464844	0.125	0.472656	0.1875
-glyph	(	0.523438	0.125	0.539063	0.1875
-glyph	)	0.585938	0.125	0.601563	0.1875
-glyph	*	0.650391	0.125	0.662109	0.1875
-glyph	+	0.705078	0.125	0.732422	0.1875
-glyph	,	0.777344	0.125	0.785156	0.1875
-glyph	-	0.835938	0.125	0.851563	0.1875
-glyph	.	0.902344	0.125	0.910156	0.1875
-glyph	/	0.957031	0.125	0.980469	0.1875
-glyph	0	0.0195313	0.1875	0.0429688	0.25
-glyph	1	0.0859375	0.1875	0.101563	0.25
-glyph	2	0.146484	0.1875	0.166016	0.25
-glyph	3	0.210938	0.1875	0.226563	0.25
-glyph	4	0.271484	0.1875	0.291016	0.25
-glyph	5	0.333984	0.1875	0.353516	0.25
-glyph	6	0.396484	0.1875	0.416016	0.25
-glyph	7	0.458984	0.1875	0.478516	0.25
-glyph	8	0.521484	0.1875	0.541016	0.25
-glyph	9	0.583984	0.1875	0.603516	0.25
-glyph	:	0.652344	0.1875	0.660156	0.25
-glyph	;	0.714844	0.1875	0.722656	0.25
-glyph	<	0.771484	0.1875	0.791016	0.25
-glyph	=	0.832031	0.1875	0.855469	0.25
-glyph	>	0.896484	0.1875	0.916016	0.25
-glyph	?	0.960938	0.1875	0.976563	0.25
-glyph	@	0.0195313	0.25	0.0429688	0.3125
-glyph	A	0.0839844	0.25	0.103516	0.3125
-glyph	B	0.146484	0.25	0.166016	0.3125
-glyph	C	0.210938	0.25	0.226563	0.3125
-glyph	D	0.271484	0.25	0.291016	0.3125
-glyph	E	0.335938	0.25	0.351563	0.3125
-glyph	F	0.396484	0.25	0.416016	0.3125
-glyph	G	0.458984	0.25	0.478516	0.3125
-glyph	H	0.521484	0.25	0.541016	0.3125
-glyph	I	0.589844	0.25	0.597656	0.3125
-glyph	J	0.646484	0.25	0.666016	0.3125
-glyph	K	0.705078	0.25	0.732422	0.3125
-glyph	L	0.771484	0.25	0.791016	0.3125
-glyph	M	0.824219	0.25	0.863281	0.3125
-glyph	N	0.892578	0.25	0.919922	0.3125
-glyph	O	0.958984	0.25	0.978516	0.3125
-glyph	P	0.0195313	0.3125	0.0429688	0.375
-glyph	Q	0.0820313	0.3125	0.105469	0.375
-glyph	R	0.144531	0.3125	0.167969	0.375
-glyph	S	0.210938	0.3125	0.226563	0.375
-glyph	T	0.269531	0.3125	0.292969	0.375
-glyph	U	0.333984	0.3125	0.353516	0.375
-glyph	V	0.396484	0.3125	0.416016	0.375
-glyph	W	0.453125	0.3125	0.484375	0.375
-glyph	X	0.517578	0.3125	0.544922	0.375
-glyph	Y	0.576172	0.3125	0.611328	0.375
-glyph	Z	0.646484	0.3125	0.666016	0.375
-glyph	[	0.708984	0.3125	0.728516	0.375
-glyph	\	0.767578	0.3125	0.794922	0.375
-glyph	]	0.833984	0.3125	0.853516	0.375
-glyph	^	0.896484	0.3125	0.916016	0.375
-glyph	_	0.957031	0.3125	0.980469	0.375
-glyph	`	0.0195313	0.375	0.0429688	0.4375
-glyph	a	0.0839844	0.375	0.103516	0.4375
-glyph	b	0.146484	0.375	0.166016	0.4375
-glyph	c	0.207031	0.375	0.230469	0.4375
-glyph	d	0.273438	0.375	0.289063	0.4375
-glyph	e	0.333984	0.375	0.353516	0.4375
-glyph	f	0.396484	0.375	0.416016	0.4375
-glyph	g	0.458984	0.375	0.478516	0.4375
-glyph	h	0.521484	0.375	0.541016	0.4375
-glyph	i	0.587891	0.375	0.599609	0.4375
-glyph	j	0.646484	0.375	0.666016	0.4375
-glyph	k	0.705078	0.375	0.732422	0.4375
-glyph	l	0.771484	0.375	0.791016	0.4375
-glyph	m	0.816406	0.375	0.871094	0.4375
-glyph	n	0.888672	0.375	0.923828	0.4375
-glyph	o	0.958984	0.375	0.978516	0.4375
-glyph	p	0.0195313	0.4375	0.0429688	0.5
-glyph	q	0.0839844	0.4375	0.103516	0.5
-glyph	r	0.146484	0.4375	0.166016	0.5
-glyph	s	0.208984	0.4375	0.228516	0.5
-glyph	t	0.271484	0.4375	0.291016	0.5
-glyph	u	0.332031	0.4375	0.355469	0.5
-glyph	v	0.386719	0.4375	0.425781	0.5
-glyph	w	0.445313	0.4375	0.492188	0.5
-glyph	x	0.521484	0.4375	0.541016	0.5
-glyph	y	0.583984	0.4375	0.603516	0.5
-glyph	z	0.646484	0.4375	0.666016	0.5
-glyph	{	0.710938	0.4375	0.726563	0.5
-glyph	|	0.773438	0.4375	0.789063	0.5
-glyph	}	0.835938	0.4375	0.851563	0.5
-glyph	~	0.884766	0.4375	0.927734	0.5
-
-}
-
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMovableObject.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMovableObject.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMovableObject.h	(revision 1812)
@@ -0,0 +1,436 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#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 "OgreUserDefinedObject.h"
+
+namespace Ogre {
+
+	// Forward declaration
+	class MovableObjectFactory;
+
+    /** Abstract class definining 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
+    {
+    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;
+		/// Upper distance to still render
+		Real mUpperDistance;
+		Real mSquaredUpperDistance;
+		/// Hidden because of distance?
+		bool mBeyondFarDistance;
+		/// User defined link to another object / value / whatever
+		Any mUserAny;
+        /// The render queue to use when rendering this object
+        uint8 mRenderQueueID;
+		/// Flags whether the RenderQueue's default should be used.
+		bool mRenderQueueIDSet;
+        /// 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;
+
+		// 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;
+
+        /** 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;
+
+        /** 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 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 incase 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 visbility 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 visbility
+			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.
+		@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; }
+
+        /** Call this to associate your own custom user object instance with this MovableObject.
+        @remarks
+            By simply making your game / application object a subclass of UserDefinedObject, you
+            can establish a link between an OGRE instance of MovableObject and your own application
+            classes. Call this method to establish the link.
+        */
+        virtual void setUserObject(UserDefinedObject* obj) { mUserAny = Any(obj); }
+        /** Retrieves a pointer to a custom application object associated with this movable by an earlier
+            call to setUserObject.
+        */
+        virtual UserDefinedObject* getUserObject(void) 
+		{ 
+			return mUserAny.isEmpty() ? 0 : any_cast<UserDefinedObject*>(mUserAny); 
+		}
+
+		/** 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.
+		@note This value is shared with setUserObject so don't use both!
+		*/
+		virtual void setUserAny(const Any& anything) { mUserAny = anything; }
+
+		/** Retrieves the custom user value associated with this object.
+		*/
+		virtual const Any& getUserAny(void) const { return mUserAny; }
+
+        /** 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.
+        */
+        virtual void setRenderQueueGroup(uint8 queueID);
+
+        /** 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(unsigned long 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(uint32 flags) { return msDefaultQueryFlags; }
+
+		
+        /** Sets the visiblity flags for this object.
+        @remarks
+			As well as a simple true/false value for visibility (as seen in setVisible), 
+			you can also set visiblity 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(uint32 flags) { return msDefaultVisibilityFlags; }
+
+		/// 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
+        ShadowRenderableListIterator getShadowVolumeRenderableIterator(
+            ShadowTechnique shadowTechnique, const Light* light, 
+            HardwareIndexBufferSharedPtr* indexBuffer, 
+            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; }
+        /** 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;
+
+
+
+
+
+    };
+
+	/** 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 
+	{
+	protected:
+		/// Type flag, allocated if requested
+		unsigned long 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(unsigned long 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.
+		*/
+		unsigned long getTypeFlags(void) const { return mTypeFlag; }
+
+	};
+
+}
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMemoryMacros.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMemoryMacros.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMemoryMacros.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+//---- ORIGINAL COPYRIGHT FOLLOWS -------------------------------------------
+// ---------------------------------------------------------------------------------------------------------------------------------
+// Copyright 2000, Paul Nettle. All rights reserved.
+//
+// You are free to use this source code in any commercial or non-commercial product.
+//
+// mmgr.cpp - Memory manager & tracking software
+//
+// The most recent version of this software can be found at: ftp://ftp.GraphicsPapers.com/pub/ProgrammingTools/MemoryManagers/
+//
+// [NOTE: Best when viewed with 8-character tabs]
+//
+// ---------------------------------------------------------------------------------------------------------------------------------
+
+//-----------------------------------------------------------------------------
+// How does this work?
+// Remember that before the compiler starts to process a source file, it runs
+// a neat tool called a preprocessor on it. What this preprocessor does in
+// this case is replace all the instances of *alloc/free with the expanded
+// macros - this way we cleverly replace all the calls to the standard C
+// memory (de)allocation functions. The same is done for new/delete
+//
+// Of course, we have the drawback that we can't name a member function of
+// a class *alloc or free and we can't overload the new/delete operators without
+// first undefining these macros - ah, a C++ preprocessor with RE replacement,
+// that would be a dream come true :)
+//
+#ifndef OGRE_MEMORY_MACROS
+#define OGRE_MEMORY_MACROS
+
+#if OGRE_DEBUG_MEMORY_MANAGER && OGRE_DEBUG_MODE
+#   define new    (::Ogre::MemoryManager::instance().setOwner(__FILE__,__LINE__,__FUNCTION__),false) ? NULL                                                 : new
+#   define delete (::Ogre::MemoryManager::instance().setOwner(__FILE__,__LINE__,__FUNCTION__),false) ? ::Ogre::MemoryManager::instance().setOwner("",0,"") : delete
+#   define malloc(sz)      ::Ogre::MemoryManager::instance().allocMem(__FILE__,__LINE__,__FUNCTION__, ::Ogre::m_alloc_malloc, sz,      gProcessID)
+#   define calloc(sz)      ::Ogre::MemoryManager::instance().allocMem(__FILE__,__LINE__,__FUNCTION__, ::Ogre::m_alloc_calloc, sz,      gProcessID)
+#   define realloc(ptr,sz) ::Ogre::MemoryManager::instance().rllocMem(__FILE__,__LINE__,__FUNCTION__, ::Ogre::m_alloc_realloc,sz, ptr, gProcessID)
+#   define free(ptr)       ::Ogre::MemoryManager::instance().dllocMem(__FILE__,__LINE__,__FUNCTION__, ::Ogre::m_alloc_free,       ptr, gProcessID)
+#endif // OGRE_DEBUG_MEMORY_MANAGER
+
+#endif // OGRE_MEMORY_MACROS
+//-----------------------------------------------------------------------------
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCodec.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCodec.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCodec.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _Codec_H__
+#define _Codec_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreSharedPtr.h"
+#include "OgreDataStream.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreStringVector.h"
+
+namespace Ogre {
+
+    /** 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
+    {
+    protected:
+        typedef std::map< String, Codec* > CodecList; 
+        /** A map that contains all the registered codecs.
+        */
+        static CodecList ms_mapCodecs;
+
+    public:
+        class _OgrePrivate CodecData 
+        {
+        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 )
+        {
+            ms_mapCodecs[pCodec->getType()] = pCodec;
+        }
+
+        /** Unregisters a codec from the database.
+        */
+        static void unRegisterCodec( Codec *pCodec )
+        {
+            ms_mapCodecs.erase(pCodec->getType());
+        }
+
+        /** Gets the iterator for the registered codecs. */
+        static CodecIterator getCodecIterator(void)
+        {
+            return CodecIterator(ms_mapCodecs.begin(), ms_mapCodecs.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);
+
+        /** Codes the data in the input stream and saves the result in the output
+            stream.
+        */
+        virtual DataStreamPtr code(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 codeToFile(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
+            @note
+                Has a variable number of arguments, which depend on the codec type.
+        */
+        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;
+    };
+
+} // namespace
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMaterialScriptCompiler.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMaterialScriptCompiler.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMaterialScriptCompiler.h	(revision 1812)
@@ -0,0 +1,307 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.stevestreeting.com/ogre/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/gpl.html.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __MaterialScriptScompiler_H__
+#define __MaterialScriptScompiler_H__
+
+#include "OgreCompiler2Pass.h"
+#include "OgrePrerequisites.h"
+#include "OgreTextureUnitState.h"
+#include "OgreMaterial.h"
+//#include "OgreBlendMode.h"
+//#include "OgreTextureUnitState.h"
+#include "OgreGpuProgram.h"
+#include "OgreStringVector.h"
+
+namespace Ogre {
+
+    class _OgreExport MaterialScriptCompiler : public Compiler2Pass
+    {
+
+    public:
+        MaterialScriptCompiler(void);
+        ~MaterialScriptCompiler(void);
+        /** gets BNF Grammer for Compositor script.
+        */
+        virtual const String& getClientBNFGrammer(void) { return materialScript_BNF; }
+
+        /** get the name of the BNF grammer.
+        */
+        virtual const String& getClientGrammerName(void) const { static const String grammerName("Material Script"); return grammerName; }
+        /** Compile a material script from a data stream using a specific resource group name.
+        @param stream Weak reference to a data stream which is the source of the material 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.
+        */
+        void parseScript(DataStreamPtr& stream, const String& groupName)
+        {
+            mScriptContext.groupName = groupName;
+            Compiler2Pass::compile(stream->getAsString(),  stream->getName());
+        }
+
+    protected:
+	    // Token ID enumeration
+	    enum TokenID {
+		    // Terminal Tokens section
+            ID_UNKOWN = 0, ID_OPENBRACE, ID_CLOSEBRACE,
+            // GPU Program
+            ID_VERTEX_PROGRAM, ID_FRAGMENT_PROGRAM, ID_SOURCE, ID_SYNTAX, ID_CUSTOM_PARAMETER,
+            ID_DEFAULT_PARAMS,
+            ID_INCLUDES_SKELETAL_ANIMATION, ID_INCLUDES_MORPH_ANIMATION, ID_INCLUDES_POSE_ANIMATION,
+            // material
+            ID_MATERIAL, ID_CLONE, ID_LOD_DISTANCES, ID_RECEIVE_SHADOWS,
+            ID_TRANSPARENCY_CASTS_SHADOWS, ID_SET_TEXTURE_ALIAS,
+            // technique
+            ID_TECHNIQUE, ID_SCHEME, ID_LOD_INDEX,
+            // pass
+            ID_PASS, ID_AMBIENT, ID_DIFFUSE, ID_SPECULAR, ID_EMISSIVE,
+            ID_VERTEXCOLOUR,
+            // scene blend
+            ID_SCENE_BLEND, ID_COLOUR_BLEND, 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,
+            // Depth
+            ID_DEPTH_CHECK, ID_DEPTH_WRITE, ID_DEPTH_FUNC, ID_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_CULL_HARDWARE, ID_CLOCKWISE, ID_ANTICLOCKWISE,
+            ID_CULL_SOFTWARE, ID_CULL_BACK, ID_CULL_FRONT,
+            ID_LIGHTING, ID_SHADING, ID_FLAT, ID_GOURAUD, ID_PHONG,
+            ID_POLYGON_MODE, ID_SOLID, ID_WIREFRAME, ID_POINTS,
+            ID_FOG_OVERRIDE, ID_EXP, ID_EXP2,
+            ID_COLOUR_WRITE, ID_MAX_LIGHTS,
+            ID_ITERATION, ID_ONCE, ID_ONCE_PER_LIGHT, ID_PER_LIGHT, ID_DIRECTIONAL, ID_SPOT,
+			ID_POINT_SIZE, ID_POINT_SPRITES, ID_POINT_SIZE_ATTENUATION,
+			ID_POINT_SIZE_MIN, ID_POINT_SIZE_MAX,
+
+            // texture unit state
+            ID_TEXTURE_UNIT, ID_TEXTURE_ALIAS, ID_TEXTURE, ID_1D, ID_2D, ID_3D, ID_CUBIC, ID_UNLIMITED,
+            ID_ALPHA, 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_MIRROR, ID_BORDER, ID_TEX_BORDER_COLOUR,
+            ID_FILTERING, ID_BILINEAR, ID_TRILINEAR, ID_ANISOTROPIC,
+            ID_MAX_ANISOTROPY, ID_COLOUR_OP, ID_REPLACE,
+            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_DOTPRODUCT,
+            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,
+            // GPU program references
+            ID_VERTEX_PROGRAM_REF, ID_FRAGMENT_PROGRAM_REF, ID_SHADOW_CASTER_VERTEX_PROGRAM_REF,
+            ID_SHADOW_RECEIVER_VERTEX_PROGRAM_REF, ID_SHADOW_RECEIVER_FRAGMENT_PROGRAM_REF,
+            // GPU Parameters
+            ID_PARAM_INDEXED_AUTO, ID_PARAM_INDEXED, ID_PARAM_NAMED_AUTO, ID_PARAM_NAMED,
+
+            // general
+            ID_ON, ID_OFF, ID_TRUE, ID_FALSE, ID_NONE, ID_POINT, ID_LINEAR, ID_ADD, ID_MODULATE, ID_ALPHA_BLEND,
+            ID_ONE, ID_ZERO
+        };
+
+        /** 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
+		    std::map<String, String> 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 isProgramShadowCaster; // 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;
+            // container of token que positions for default params that require pass 2 processing
+            std::vector<size_t> pendingDefaultParams;
+
+            AliasTextureNamePairList textureAliases;
+        };
+
+        MaterialScriptContext mScriptContext;
+
+	    // static library database for tokens and BNF rules
+	    static TokenRule materialScript_RulePath[];
+        // simplified Backus - Naur Form (BNF) grammer for material scripts
+        static String materialScript_BNF;
+
+        typedef void (MaterialScriptCompiler::* MSC_Action)(void);
+        typedef std::map<size_t, MSC_Action> TokenActionMap;
+        typedef TokenActionMap::iterator TokenActionIterator;
+        /** Map of Token value as key to an Action.  An Action converts tokens into
+            the final format.
+            All instances use the same Token Action Map.
+        */
+        static TokenActionMap mTokenActionMap;
+
+        /** Execute an Action associated with a token.  Gets called when the compiler finishes tokenizing a
+            section of the source that has been parsed.
+        **/
+        virtual void executeTokenAction(const size_t tokenID);
+        /** Associate all the lexemes used in a material script with their corresponding tokens and actions.
+        **/
+        virtual void setupTokenDefinitions(void);
+        void addLexemeTokenAction(const String& lexeme, const size_t token, const MSC_Action action = 0);
+
+        void logParseError(const String& error);
+
+        // support methods that convert tokens
+        ColourValue _parseColourValue(void);
+        CompareFunction convertCompareFunction(void);
+
+        // Token Actions which get called when tokens are created during parsing.
+        void parseOpenBrace(void);
+        void parseCloseBrace(void);
+        // material section Actions
+        void parseMaterial(void);
+        void parseLodDistances(void);
+        void parseReceiveShadows(void);
+        void parseTransparencyCastsShadows(void);
+        void parseSetTextureAlias(void);
+        // Technique related actions
+        void parseTechnique(void);
+        void parseScheme(void);
+        void parseLodIndex(void);
+        // Pass related Actions
+        void parsePass(void);
+        void parseAmbient(void);
+        void parseDiffuse(void);
+        void parseSpecular(void);
+        void parseEmissive(void);
+        void parseSceneBlend(void);
+        SceneBlendFactor convertBlendFactor(void);
+        void parseDepthCheck(void);
+        void parseDepthWrite(void);
+        void parseDepthFunc(void);
+        void parseDepthBias(void);
+        void parseAlphaRejection(void);
+        void parseCullHardware(void);
+        void parseCullSoftware(void);
+        void parseLighting(void);
+        void parseShading(void);
+        void parsePolygonMode(void);
+        void parseFogOverride(void);
+        void parseMaxLights(void);
+        void parseIteration(void);
+        void parseIterationLightTypes(void);
+        void parseColourWrite(void);
+        void parsePointSize(void);
+        void parsePointSprites(void);
+        void parsePointSizeMin(void);
+        void parsePointSizeMax(void);
+        void parsePointSizeAttenuation(void);
+        // Texture Unit related Actions
+        void parseTextureUnit(void);
+        void parseTextureAlias(void);
+        void parseTexture(void);
+        void parseAnimTexture(void);
+        void parseCubicTexture(void);
+        void parseTexCoord(void);
+        TextureUnitState::TextureAddressingMode convTexAddressMode(void);
+        void parseTexAddressMode(void);
+        void parseTexBorderColour(void);
+        void parseFiltering(void);
+        FilterOptions convertFiltering();
+        void parseMaxAnisotropy(void);
+        void parseColourOp(void);
+        void parseColourOpEx(void);
+        LayerBlendOperationEx convertBlendOpEx(void);
+        LayerBlendSource convertBlendSource(void);
+        void parseColourOpMultipassFallback(void);
+        void parseAlphaOpEx(void);
+        void parseEnvMap(void);
+        void parseScroll(void);
+        void parseScrollAnim(void);
+        void parseRotate(void);
+        void parseRotateAnim(void);
+        void parseScale(void);
+        void parseWaveXform(void);
+        void parseTransform(void);
+        void parseTextureCustomParameter(void);
+        // GPU Program
+        void parseGPUProgram(void);
+        void parseProgramSource(void);
+        void parseProgramSyntax(void);
+        void parseProgramCustomParameter(void);
+        void parseDefaultParams(void);
+        void parseProgramSkeletalAnimation(void);
+        void parseProgramMorphAnimation(void);
+        void parseProgramPoseAnimation(void);
+        void parseVertexProgramRef(void);
+        void parseFragmentProgramRef(void);
+        void parseShadowCasterVertexProgramRef(void);
+        void parseShadowReceiverVertexProgramRef(void);
+        void parseShadowReceiverFragmentProgramRef(void);
+        void parseParamIndexed(void);
+        void parseParamIndexedAuto(void);
+        void parseParamNamed(void);
+        void parseParamNamedAuto(void);
+        void processManualProgramParam(size_t index, const String& commandname, const String& paramName = "");
+        void processAutoProgramParam(size_t index, const String& commandname, const String& paramName = "");
+
+
+    	void finishProgramDefinition(void);
+
+    };
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreHardwareIndexBuffer.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreHardwareIndexBuffer.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreHardwareIndexBuffer.h	(revision 1812)
@@ -0,0 +1,74 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __HardwareIndexBuffer__
+#define __HardwareIndexBuffer__
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+#include "OgreHardwareBuffer.h"
+#include "OgreSharedPtr.h"
+
+namespace Ogre {
+
+    /** Specialisation of HardwareBuffer for vertex index buffers, still abstract. */
+    class _OgreExport HardwareIndexBuffer : public HardwareBuffer
+    {
+	    public:
+		    enum IndexType {
+			    IT_16BIT,
+			    IT_32BIT
+		    };
+
+	    protected:
+		    IndexType mIndexType;
+		    size_t mNumIndexes;
+            size_t mIndexSize;
+
+	    public:
+		    /// Should be called by HardwareBufferManager
+		    HardwareIndexBuffer(IndexType idxType, size_t numIndexes, HardwareBuffer::Usage usage,
+                bool useSystemMemory, bool useShadowBuffer);
+            ~HardwareIndexBuffer();
+    		/// 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);
+    };
+}
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreImage.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreImage.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreImage.h	(revision 1812)
@@ -0,0 +1,350 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _Image_H__
+#define _Image_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreCommon.h"
+#include "OgrePixelFormat.h"
+#include "OgreDataStream.h"
+
+namespace Ogre {
+
+    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:
+    	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().             
+            @param
+                The data pointer
+            @param
+				Width of image
+            @param
+				Height of image
+			@param
+                Image Depth (in 3d images, numbers of layers, otherwhise 1)
+            @param
+				Pixel Format
+            @param
+                if memory associated with this buffer is to be destroyed
+                with the Image object.
+			@param
+				the number of faces the image data has inside (6 for cubemaps, 1 otherwise)
+            @param
+                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* pData, size_t uWidth, size_t uHeight, 
+							size_t depth,
+							 PixelFormat eFormat, bool autoDelete = false, 
+							 size_t numFaces = 1, size_t 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().             
+            @param
+                The data pointer
+            @param
+				Width of image
+            @param
+				Height of image
+            @param
+				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(pData, width, height, depth, format, ...) to be compatible
+				with future Ogre versions.
+         */
+ 		Image& loadDynamicImage( uchar* pData, size_t uWidth,
+								 size_t uHeight, PixelFormat eFormat)
+		{
+			return loadDynamicImage(pData, uWidth, uHeight, 1, eFormat);
+		}
+		/** 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)
+        */
+        Image & loadRawData( 
+            DataStreamPtr& stream, 
+            size_t uWidth, size_t uHeight, size_t uDepth,
+            PixelFormat eFormat,
+			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.
+        */
+        Image & loadRawData( 
+            DataStreamPtr& stream, 
+            size_t uWidth, size_t uHeight, 
+            PixelFormat eFormat )
+		{
+			return loadRawData(stream, uWidth, uHeight, 1, eFormat);
+		}
+
+        /** Loads an image file.
+            @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().             
+            @param
+                strFileName Name of a file 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& strFileName, 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. 
+            @param
+                stream The source data.
+            @param
+                type The type of the image. Used to decide what decompression
+                codec to use.
+            @see
+                Image::load( const String& strFileName )
+        */
+        Image & load(DataStreamPtr& stream, const String& type );
+        
+        /** Save the image as a file. */
+        void save(const String& filename);
+
+        /** Returns a pointer to the internal image buffer.
+        */
+        uchar* getData(void);
+
+        /** Returns a const pointer to the internal image buffer.
+        */
+        const uchar * getData() const;       
+
+        /** Returns the size of the data buffer.
+        */
+        size_t getSize() const;
+
+        /** Returns the number of mipmaps contained in the image.
+        */
+        size_t 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.
+        */
+        size_t getWidth(void) const;
+
+        /** Gets the height of the image in pixels.
+        */
+        size_t getHeight(void) const;
+
+        /** Gets the depth of the image.
+        */
+        size_t getDepth(void) const;
+		
+		/** Get the numer 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(int x, int y, int z);
+        
+        /**
+         * Get a PixelBox encapsulating the image data of a mipmap
+         */
+        PixelBox getPixelBox(size_t face = 0, size_t mipmap = 0) const;
+
+		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, size_t width, size_t height, size_t depth, PixelFormat format);
+    private:
+        // The width of the image in pixels
+        size_t m_uWidth;
+        // The height of the image in pixels
+        size_t m_uHeight;
+        // The depth of the image
+        size_t m_uDepth;
+        // The size of the image buffer
+        size_t m_uSize;
+        // The number of mipmaps the image contains
+        size_t m_uNumMipmaps;
+        // Image specific flags.
+        int m_uFlags;
+
+        // The pixel format of the image
+        PixelFormat m_eFormat;
+
+        // The number of bytes per pixel
+        uchar m_ucPixelSize;
+        uchar* m_pBuffer;
+
+		// A bool to determine if we delete the buffer or the calling app does
+		bool m_bAutoDelete;
+    };
+
+} // namespace
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreBone.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreBone.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreBone.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __Bone_H__
+#define __Bone_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreNode.h"
+
+
+namespace Ogre 
+{
+    /** 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());
+        */
+        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: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSkeleton.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSkeleton.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSkeleton.h	(revision 1812)
@@ -0,0 +1,452 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __Skeleton_H__
+#define __Skeleton_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreResource.h"
+#include "OgreQuaternion.h"
+#include "OgreVector3.h"
+#include "OgreIteratorWrappers.h"
+
+namespace Ogre {
+
+    /**  */
+    enum SkeletonAnimationBlendMode {
+        /// Animations are applied by calculating a weighted average of all animations
+	    ANIMBLEND_AVERAGE,
+        /// Animations are applied by calculating a weighted cumulative total
+	    ANIMBLEND_CUMULATIVE
+    };
+
+#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
+    {
+		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 std::vector<Bone*> 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;
+
+        /** Sets the current position / orientation to be the 'binding pose' ie 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 = 0) 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);
+
+        /** 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.
+            @param 
+        */
+        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
+		*/
+		virtual void optimiseAllAnimations(void);
+
+		/** 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 std::vector<LinkedSkeletonAnimationSource> 
+			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(); }
+
+	protected:
+		SkeletonAnimationBlendMode mBlendState;
+        /// Storage of bones, indexed by bone handle
+        BoneList mBoneList;
+        /// Lookup by bone name
+        typedef std::map<String, Bone*> BoneListByName;
+        BoneListByName mBoneListByName;
+
+
+        /// Pointer to root bones (can now have multiple roots)
+        mutable BoneList mRootBones;
+        /// Bone automatic handles
+        unsigned short mNextAutoHandle;
+		typedef std::set<Bone*> BoneSet;
+		/// Manual bones
+		BoneSet mManualBones;
+		/// Manual bones dirty?
+		bool mManualBonesDirty;
+
+
+        /// Storage of animations, lookup by name
+        typedef std::map<String, Animation*> 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 { return 0; } // TODO 
+
+    };
+
+    /** Specialisation of SharedPtr to allow SharedPtr to be assigned to SkeletonPtr 
+    @note Has to be a subclass since we need operator=.
+    We could templatise this instead of repeating per Resource subclass, 
+    except to do so requires a form VC6 does not support i.e.
+    ResourceSubclassPtr<T> : public SharedPtr<T>
+    */
+    class _OgreExport SkeletonPtr : public SharedPtr<Skeleton> 
+    {
+    public:
+        SkeletonPtr() : SharedPtr<Skeleton>() {}
+        explicit SkeletonPtr(Skeleton* rep) : SharedPtr<Skeleton>(rep) {}
+        SkeletonPtr(const SkeletonPtr& r) : SharedPtr<Skeleton>(r) {} 
+        SkeletonPtr(const ResourcePtr& r) : SharedPtr<Skeleton>()
+        {
+			// lock & copy other mutex pointer
+            OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME)
+            {
+			    OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
+			    OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
+                pRep = static_cast<Skeleton*>(r.getPointer());
+                pUseCount = r.useCountPointer();
+                if (pUseCount)
+                {
+                    ++(*pUseCount);
+                }
+            }
+        }
+
+        /// Operator used to convert a ResourcePtr to a SkeletonPtr
+        SkeletonPtr& operator=(const ResourcePtr& r)
+        {
+            if (pRep == static_cast<Skeleton*>(r.getPointer()))
+                return *this;
+            release();
+			// lock & copy other mutex pointer
+            OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME)
+            {
+			    OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
+			    OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
+                pRep = static_cast<Skeleton*>(r.getPointer());
+                pUseCount = r.useCountPointer();
+                if (pUseCount)
+                {
+                    ++(*pUseCount);
+                }
+            }
+            return *this;
+        }
+    };
+
+	/// 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) {}
+	};
+}
+
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreEventQueue.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreEventQueue.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreEventQueue.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+/***************************************************************************
+OgreEventQueue.h  -  
+	The EventQueue holds InputEvents.
+	It doesn't create or delete the objects, just stores them.
+
+-------------------
+begin                : Nov 19 2002
+copyright            : (C) 2002 by Kenny Sabir
+email                : kenny@sparksuit.com
+***************************************************************************/
+
+#ifndef __EVENT_QUEUE_H__
+#define __EVENT_QUEUE_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+	/** This class holds InputEvents given to it by the EventProcessor in a FIFO queue. */
+    class _OgreExport EventQueue
+    {
+    protected:
+		std::queue<InputEvent*> mEventQueue;
+		bool mActivateEventQueue;
+
+    public:
+        EventQueue();
+        virtual ~EventQueue();
+		void push(InputEvent* e);
+		InputEvent* pop();
+
+
+		/**
+		 * Turn the queue on so it can pop and push InputEvents
+		 */
+		void activateEventQueue(bool set);
+
+        /* Adrian Cearnau - modified the return type from int to size_t and made the method const. */
+		size_t getSize() const;
+
+    };
+
+
+
+}
+
+
+#endif //__EVENT_QUEUE_H__
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSphere.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSphere.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSphere.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __Sphere_H_
+#define __Sphere_H_
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+
+#include "OgreVector3.h"
+
+namespace Ogre {
+
+
+    /** 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 interects another sphere. */
+		bool intersects(const Sphere& s) const
+		{
+            return (s.mCenter - mCenter).squaredLength() <=
+                Math::Sqr(s.mRadius + mRadius);
+		}
+		/** Returns whether or not this sphere interects a box. */
+		bool intersects(const AxisAlignedBox& box) const
+		{
+			return Math::intersects(*this, box);
+		}
+		/** Returns whether or not this sphere interects a plane. */
+		bool intersects(const Plane& plane) const
+		{
+			return Math::intersects(*this, plane);
+		}
+		/** Returns whether or not this sphere interects a point. */
+		bool intersects(const Vector3& v) const
+		{
+            return ((v - mCenter).squaredLength() <= Math::Sqr(mRadius));
+		}
+        
+
+    };
+
+}
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSubEntity.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSubEntity.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSubEntity.h	(revision 1812)
@@ -0,0 +1,215 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __SubEntity_H__
+#define __SubEntity_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreString.h"
+#include "OgreRenderable.h"
+#include "OgreHardwareBufferManager.h"
+
+namespace Ogre {
+
+    /** 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
+    {
+        // 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;
+
+        /// Name of Material in use by this SubEntity.
+        String mMaterialName;
+
+        /// Cached pointer to material.
+        MaterialPtr mpMaterial;
+
+        // Pointer to the SubMesh defining geometry.
+        SubMesh* mSubMesh;
+
+        /// Is this SubEntity visible?
+        bool mVisible;
+
+		/// 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;
+
+        /** 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 );
+
+        /** 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;
+
+        /** Accessor method to read mesh data.
+        */
+        SubMesh* getSubMesh(void);
+
+        /** Overridden - see Renderable.
+        */
+        const MaterialPtr& getMaterial(void) const;
+
+        /** Overridden - see Renderable.
+        */
+        Technique* getTechnique(void) const;
+
+        /** Overridden - see Renderable.
+        */
+        void getRenderOperation(RenderOperation& op);
+
+        /** Overridden - see Renderable.
+        */
+        void getWorldTransforms(Matrix4* xform) const;
+        /** @copydoc Renderable::getWorldOrientation */
+        const Quaternion& getWorldOrientation(void) const;
+        /** @copydoc Renderable::getWorldPosition */
+        const Vector3& getWorldPosition(void) const;
+        /** Overridden - see Renderable.
+        */
+        bool getNormaliseNormals(void) 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 Renderble to provide some custom behaviour. */
+		void _updateCustomGpuParameter(
+			const GpuProgramParameters::AutoConstantEntry& constantEntry,
+			GpuProgramParameters* params) const;
+    };
+
+}
+
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMaterialManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMaterialManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMaterialManager.h	(revision 1812)
@@ -0,0 +1,229 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __MATERIALMANAGER_H__
+#define __MATERIALMANAGER_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreSingleton.h"
+#include "OgreResourceManager.h"
+#include "OgreMaterial.h"
+#include "OgreStringVector.h"
+#include "OgreMaterialSerializer.h"
+
+namespace Ogre {
+
+
+    /** 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>
+    {
+    protected:
+
+        /// Default Texture filtering - minification
+        FilterOptions mDefaultMinFilter;
+        /// Default Texture filtering - magnification
+        FilterOptions mDefaultMagFilter;
+        /// Default Texture filtering - mipmapping
+        FilterOptions mDefaultMipFilter;
+        /// Default Texture anisotropy
+        unsigned int mDefaultMaxAniso;
+
+        /// Serializer
+        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 std::map<String, unsigned short> SchemeMap;
+		/// List of material schemes
+		SchemeMap mSchemes;
+		/// Current material scheme
+		String mActiveSchemeName;
+		/// Current material scheme
+		unsigned short mActiveSchemeIndex;
+
+    public:
+		/// Default material scheme
+		static String DEFAULT_SCHEME_NAME;
+		
+        /** Default constructor.
+        */
+        MaterialManager();
+
+        /** Default destructor.
+        */
+        virtual ~MaterialManager();
+
+		/** Intialises 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);
+
+        /** 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);
+
+    };
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRectangle2D.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRectangle2D.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRectangle2D.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _Rectangle2D_H__
+#define _Rectangle2D_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreSimpleRenderable.h"
+
+namespace Ogre {
+
+    /** 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;
+        /** @copydoc Renderable::getWorldOrientation */
+        const Quaternion& getWorldOrientation(void) const;
+        /** @copydoc Renderable::getWorldPosition */
+        const Vector3& getWorldPosition(void) const;
+
+    public:
+
+        Rectangle2D(bool includeTextureCoordinates = false);
+        ~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
+        top Top position in screen relative coordinates, 1 = top edge, -1 = bottom edge
+        right Right position in screen relative coordinates
+        bottom Bottom position in screen relative coordinates
+        */
+        void setCorners(Real left, Real top, Real right, Real bottom);
+
+        Real getSquaredViewDepth(const Camera* cam) const { return 0; }
+
+        Real getBoundingRadius(void) const { return 0; }
+        /// Identity view and projection
+        bool useIdentityProjection(void) const { return true; }
+        /// Identity view and projection
+        bool useIdentityView(void) const { return true; }
+
+    };
+
+}// namespace
+
+#endif
+
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderQueueListener.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderQueueListener.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderQueueListener.h	(revision 1812)
@@ -0,0 +1,85 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __RenderQueueListener_H__
+#define __RenderQueueListener_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreRenderQueue.h"
+
+namespace Ogre {
+
+    /** 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 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) = 0;
+
+        /** 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) = 0;
+    };
+
+}
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreConfigOptionMap.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreConfigOptionMap.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreConfigOptionMap.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _ConfigOptionMap_H__
+#define _ConfigOptionMap_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreStringVector.h"
+#include "OgreString.h"
+
+
+namespace Ogre {
+    /** 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 std::map< String, ConfigOption > ConfigOptionMap;
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSkeletonFileFormat.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSkeletonFileFormat.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSkeletonFileFormat.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __SkeletonFileFormat_H__
+#define __SkeletonFileFormat_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+/** 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_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_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: /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreBspLevel.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreBspLevel.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreBspLevel.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _BspLevel_H__
+#define _BspLevel_H__
+
+#include "OgreBspPrerequisites.h"
+#include "OgreResource.h"
+#include "OgreStaticFaceGroup.h"
+#include "OgreSceneManager.h"
+#include "OgreBspNode.h"
+#include "OgreHardwareBufferManager.h"
+#include "OgreDefaultHardwareBufferManager.h"
+#include "OgreQuake3Level.h"
+
+
+namespace Ogre {
+
+    /** Holds all the data associated with a Binary Space Parition
+        (BSP) based indoor level.
+        The data used here is populated by loading level files via
+        the BspLevelManager::load method, although application users
+        are more likely to call SceneManager::setWorldGeometry which will
+        automatically arrange the loading of the level. Note that this assumes
+        that you have asked for an indoor-specialised SceneManager (specify
+        ST_INDOOR when calling Root::getSceneManager).</p>
+        Ogre currently only supports loading from Quake3 Arena level files,
+        although any source that can be converted into this classes structure
+        could also be used. The Quake3 level load process is in a different
+        class called Quake3Level to keep the specifics separate.</p>
+    */
+    class BspLevel : public Resource
+    {
+        friend class BspSceneManager;
+    public:
+        /** Default constructor - used by BspResourceManager (do not call directly) */
+        BspLevel(ResourceManager* creator, const String& name, ResourceHandle handle,
+            const String& group, bool isManual = false, ManualResourceLoader* loader = 0);
+        ~BspLevel();
+
+        /** Determines if one leaf node is visible from another. */
+        bool isLeafVisible(const BspNode* from, const BspNode* to) const;
+
+        /** Returns a pointer to the root node (BspNode) of the BSP tree. */
+        const BspNode* getRootNode(void);
+
+        /** Walks the entire BSP tree and returns the leaf
+            which contains the given point.
+        */
+        BspNode* findLeaf(const Vector3& point) const;
+
+        /** Ensures that the MovableObject is attached to the right leaves of the 
+            BSP tree.
+        */
+        void _notifyObjectMoved(const MovableObject* mov, 
+            const Vector3& pos);
+		/** Internal method, makes sure an object is removed from the leaves when detached from a node. */
+		void _notifyObjectDetached(const MovableObject* mov);
+        /** Gets a pointer to the start of the leaf nodes. */
+        BspNode* getLeafStart(void) {return &mRootNode[mLeafStart]; }
+        /** Gets the number of leaf nodes */
+        int getNumLeaves(void) const { return mNumLeaves; }
+
+        /** Calculate the number of loading stages required for a given level */
+        static size_t calculateLoadingStages(const String& levelName);
+        /** Calculate the number of loading stages required for a given level */
+        static size_t calculateLoadingStages(DataStreamPtr& stream);
+
+		/** Load direct from stream */
+		void load(DataStreamPtr& stream);
+
+		/** Is sky enabled? */
+		bool isSkyEnabled(void) const;
+		/** Get Sky material name */
+		const String& getSkyMaterialName(void) const;
+		/** Get sky curvature */
+		Real getSkyCurvature(void) const;
+
+        /** Utility class just to enable queueing of patches */
+    protected:
+        /** @copydoc Resource::loadImpl. */
+        void loadImpl(void);
+        /** @copydoc Resource::unloadImpl. */
+        void unloadImpl(void);
+        /** @copydoc Resource::calculateSize. */
+        size_t calculateSize(void) const;
+        /** Pointer to the root node of the BSP tree;
+            This pointer actually has a dual purpose; to avoid allocating lots of small chunks of
+            memory, the BspLevel actually allocates all nodes required through this pointer. So this
+            pointer is the handle for the allocation of memory for all nodes. It also happens to point
+            to the root node, since the first one in the memory chunk is the root node.
+        */
+        BspNode* mRootNode;
+        int mNumNodes;
+        int mNumLeaves;
+        int mLeafStart; // the index at which leaf nodes begin
+
+        /** Vertex format for fixed geometry.
+            Note that in this case vertex components (position, normal, texture coords etc)
+            are held interleaved in the same buffer. However, the format here is different from 
+            the format used by Quake because older Direct3d drivers like the vertex elements
+            to be in a particular order within the buffer. See VertexDeclaration for full
+            details of this marvellous(not) feature.
+        */
+        struct BspVertex
+        {
+            float position[3];
+            float normal[3];
+            int colour;
+            float texcoords[2];
+            float lightmap[2];
+        };
+        /*
+        /// Array of vertices for whole level.
+        BspVertex* mVertices;
+        int mNumVertices;
+        */
+        /// Vertex data holding all the data for the level, but able to render parts of it
+        VertexData* mVertexData;
+
+        /** Array of indexes into the mFaceGroups array. This buffer is organised
+            by leaf node so leaves can just use contiguous chunks of it and
+            get repointed to the actual entries in mFaceGroups. */
+        int* mLeafFaceGroups;
+        int mNumLeafFaceGroups;
+
+        /** Array of face groups, indexed into by contents of mLeafFaceGroups. */
+        StaticFaceGroup* mFaceGroups;
+        int mNumFaceGroups;
+
+
+        /*
+        /// Array of elements i.e. vertex indexes as used by face groups.
+        int* mElements;
+        int mNumElements;
+        */
+
+        /// indexes for the whole level, will be copied to the real indexdata per frame
+        size_t mNumIndexes;
+        // system-memory buffer
+        HardwareIndexBufferSharedPtr mIndexes;
+
+        /// Brushes as used for collision, main memory is here
+        BspNode::Brush *mBrushes;
+
+        /** Vector of player start points */
+        std::vector<ViewPoint> mPlayerStarts;
+
+        /** Internal utility function for loading data from Quake3. */
+        void loadQuake3Level(const Quake3Level& q3lvl);
+        /** Internal lookup table to determine visibility between leaves.
+            Leaf nodes are assigned to 'clusters' of nodes, which are used to group nodes together for
+            visibility testing. This data holds a lookup table which is used to determine if one cluster of leaves
+            is visible from another cluster. Whilst it would be possible to expand all this out so that
+            each node had a list of pointers to other visible nodes, this would be very expensive in terms
+            of storage (using the cluster method there is a table which is 1-bit squared per cluster, rounded
+            up to the nearest byte obviously, which uses far less space than 4-bytes per linked node per source
+            node). Of course the limitation here is that you have to each leaf in turn to determine if it is visible
+            rather than just following a list, but since this is only done once per frame this is not such a big
+            overhead.</p>
+            Each row in the table is a 'from' cluster, with each bit in the row corresponding to a 'to' cluster,
+            both ordered based on cluster index. A 0 in the bit indicates the 'to' cluster is not visible from the
+            'from' cluster, whilst a 1 indicates it is.</p>
+            As many will notice, this is lifted directly from the Quake implementation of PVS.
+        */
+        struct VisData
+        {
+            unsigned char *tableData;
+            int numClusters;            // Number of clusters, therefore number of rows
+            int rowLength;                // Length in bytes of each row (num clusters / 8 rounded up)
+        };
+
+        VisData mVisData;
+
+
+        /** Internal method for parsing chosen entities. */
+        void loadEntities(const Quake3Level& q3lvl);
+
+        typedef std::map<const MovableObject*, std::list<BspNode*> > MovableToNodeMap;
+        /// Map for locating the nodes a movable is currently a member of
+        MovableToNodeMap mMovableToNodeMap;
+
+        void tagNodesWithMovable(BspNode* node, const MovableObject* mov, const Vector3& pos);
+
+        // Storage of patches 
+        typedef std::map<int, PatchSurface*> PatchMap;
+        PatchMap mPatches;
+        // Total number of vertices required for all patches
+        size_t mPatchVertexCount;
+        // Total number of indexes required for all patches
+        size_t mPatchIndexCount;
+		// Sky enabled?
+		bool mSkyEnabled;
+		// Sky material
+		String mSkyMaterial;
+		// Sky details
+		Real mSkyCurvature;
+
+
+        void initQuake3Patches(const Quake3Level & q3lvl, VertexDeclaration* decl);
+        void buildQuake3Patches(size_t vertOffset, size_t indexOffset);
+
+        void quakeVertexToBspVertex(const bsp_vertex_t* src, BspVertex* dest);
+
+
+    };
+    /** Specialisation of SharedPtr to allow SharedPtr to be assigned to BspLevelPtr 
+    @note Has to be a subclass since we need operator=.
+    We could templatise this instead of repeating per Resource subclass, 
+    except to do so requires a form VC6 does not support i.e.
+    ResourceSubclassPtr<T> : public SharedPtr<T>
+    */
+    class BspLevelPtr : public SharedPtr<BspLevel> 
+    {
+    public:
+        BspLevelPtr() : SharedPtr<BspLevel>() {}
+        explicit BspLevelPtr(BspLevel* rep) : SharedPtr<BspLevel>(rep) {}
+        BspLevelPtr(const BspLevelPtr& r) : SharedPtr<BspLevel>(r) {} 
+        BspLevelPtr(const ResourcePtr& r) : SharedPtr<BspLevel>()
+        {
+			// lock & copy other mutex pointer
+			OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
+			OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
+            pRep = static_cast<BspLevel*>(r.getPointer());
+            pUseCount = r.useCountPointer();
+            if (pUseCount)
+            {
+                ++(*pUseCount);
+            }
+        }
+
+        /// Operator used to convert a ResourcePtr to a BspLevelPtr
+        BspLevelPtr& operator=(const ResourcePtr& r)
+        {
+            if (pRep == static_cast<BspLevel*>(r.getPointer()))
+                return *this;
+            release();
+			// lock & copy other mutex pointer
+			OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
+			OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
+            pRep = static_cast<BspLevel*>(r.getPointer());
+            pUseCount = r.useCountPointer();
+            if (pUseCount)
+            {
+                ++(*pUseCount);
+            }
+            return *this;
+        }
+    };
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreTerrainSceneManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreTerrainSceneManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreTerrainSceneManager.h	(revision 1812)
@@ -0,0 +1,431 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+/***************************************************************************
+terrainscenemanager.h  -  description
+---------------------
+  begin                : Mon Sep 23 2002
+  copyright            : (C) 2002 by Jon Anderson
+  email                : janders@users.sf.net
+
+  Enhancements 2003 - 2004 (C) The OGRE Team
+
+***************************************************************************/
+
+#ifndef TERRAINSCENEMANAGER_H
+#define TERRAINSCENEMANAGER_H
+
+#include "OgreTerrainPrerequisites.h"
+#include "OgreOctreeSceneManager.h"
+#include "OgreOctreeSceneQuery.h"
+#include "OgreTerrainRenderable.h"
+#include "OgreTerrainPageSource.h"
+#include "OgreIteratorWrappers.h"
+
+
+namespace Ogre
+{
+
+class Image;
+
+typedef std::vector < TerrainPage * > TerrainPageRow;
+typedef std::vector < TerrainPageRow > TerrainPage2D;
+
+/** Default implementation of RaySceneQuery. */
+class _OgreTerrainExport TerrainRaySceneQuery : public OctreeRaySceneQuery
+{
+protected:
+	WorldFragment mWorldFrag;
+public:
+    TerrainRaySceneQuery(SceneManager* creator);
+    ~TerrainRaySceneQuery();
+
+    /** See RayScenQuery. */
+    void execute(RaySceneQueryListener* listener);
+};
+
+
+
+/** This is a basic SceneManager for organizing TerrainRenderables into a total landscape.
+  * It loads a terrain from a .cfg file that specifices what textures/scale/mipmaps/etc to use.
+  *@author Jon Anderson
+  */
+
+class _OgreTerrainExport TerrainSceneManager : public OctreeSceneManager
+{
+public:
+    TerrainSceneManager(const String& name);
+    virtual ~TerrainSceneManager( );
+
+	/// @copydoc SceneManager::getTypeName
+	const String& getTypeName(void) const;
+
+    /** Loads the terrain using parameters int he given config file. */
+    void setWorldGeometry( const String& filename );
+    /** Loads the terrain using parameters in the given config file (contained 
+		in a stream). */
+	virtual void setWorldGeometry(DataStreamPtr& stream, 
+		const String& typeName = StringUtil::BLANK);
+
+    /** Aligns TerrainRenderable neighbors, and renders them. */
+    virtual void _renderVisibleObjects( void );
+
+    /** Returns the height at the given terrain coordinates. */
+    float getHeightAt( float x, float y );
+
+
+    bool intersectSegment( const Vector3 & start, const Vector3 & end, Vector3 * result );
+
+    /** Sets the texture to use for the main world texture. */
+    void setWorldTexture(const String& textureName);
+    /** Sets the texture to use for the detail texture. */
+    void setDetailTexture(const String& textureName);
+    /** Sets the number of times per tile the detail texture should be repeated. */
+    void setDetailTextureRepeat(int repeat);
+    /** Sets the dimensions of each tile (must be power of 2 + 1) */
+    void setTileSize(int size); 
+    /** Sets the dimensions of each page (must be power of 2 + 1) */
+    void setPageSize(int size); 
+    /** Sets the maximum screen space pixel error.  */
+    void setMaxPixelError(int pixelError); 
+    /** Sets how to scale the terrain data. */
+    void setScale(const Vector3& scale);
+    /** Sets the maximum geomipmap level to allow. */
+    void setMaxGeoMipMapLevel(int maxMip);
+    
+    /** Gets the texture to use for the main world texture. */
+    const String& getWorldTexture(void) { return mWorldTextureName; }
+    /** Gets the texture to use for the detail texture. */
+    const String& getDetailTexture(void) { return mDetailTextureName; }
+    /** Gets the number of times per tile the detail texture should be repeated. */
+    int getDetailTextureRepeat(void);
+    /** Gets the dimensions of each tile (must be power of 2 + 1) */
+    int getTileSize(void); 
+    /** Gets the dimensions of each page (must be power of 2 + 1) */
+    int getPageSize(void); 
+    /** Gets the maximum screen space pixel error.  */
+    int getMaxPixelError(void); 
+    /** Gets how to scale the terrain data. */
+    const Vector3& getScale(void);
+    /** Gets the maximum geomipmap level to allow. */
+    int getMaxGeoMipMapLevel(void);
+
+
+
+    /** Sets whether the terrain should use triangle strips or not.
+    @remarks
+        The default is not, in which case it uses triangle lists. 
+    */
+    void setUseTriStrips(bool useStrips);
+    /** Sets whether or not terrain tiles should be morphed between LODs
+    (NB requires vertex program support). */
+    void setUseLODMorph(bool useMorph);
+    /** Sets whether vertex normals will be generated for the terrain. */
+    void setUseVertexNormals(bool useNormals);
+    /** Sets whether vertex colours will be used. */
+    void setUseVertexColours(bool useColours);
+
+    /** Sets the name of a custom material to use to shade the landcape.
+    @remarks
+        This method allows you to provide a custom material which will be
+        used to render the landscape instead of the standard internal 
+        material. This gives you a great deal of flexibility and allows you 
+        to perform special effects if you wish. Note that because you determine
+        every aspect of the material, this setting makes the use of setWorldTexture
+        and setDetailTexture redundant.
+    @par
+        In your custom material, you can use all the usual features of Ogre's
+        materials, including multiple passes if you wish. You can also use 
+        the programmable pipeline to hook vertex and fragment programs into the
+        terrain rendering. The plugin provides the following vertex components:
+        <ul>
+            <li>positions</li>
+            <li>2 sets of texture coordinates (index 0 is world texture, 
+            index 1 is detail texture)</li>
+            <li>Normals, if enabled</li>
+            <li>Per-vertex delta values, for morphing a higher LOD tile into 
+                a lower LOD tile. This is one float per vertex bound as 'blend
+                weight'. If you want to use this you also have to provide the
+                name or index of the parameter you wish to receive the morph factor
+                (@see setCustomMaterialMorphFactorParam)</li>
+        </ul>
+    */
+    void setCustomMaterial(const String& materialName);
+    /** Sets the name of the vertex program parameter to which to pass the
+        LOD morph factor.
+    @remarks
+        When LOD morphing is enabled, and you are using a custom material to 
+        shade the terrain, you need to inform this class of the parameter you
+        wish the current LOD morph factor to be passed to. This is a simple
+        float parameter value that the plugin will set from 0 to 1, depending on
+        the morph stage of a tile. 0 represents no morphing, ie the vertices are
+        all in the original position. 1 represents a complete morph such that
+        the height of the vertices is the same as they are at the next lower LOD
+        level. The vertex program must use this factor, in conjunction with the
+        per-vertex height delta values (bound as 'blend weight'), to displace
+        vertices.
+    @note This version of the method lets you specify a parameter name, compatible
+        with high-level vertex programs. There is an alternative signature method
+        which allows you to set the parameter index for low-level assembler programs.
+    @param paramName The name of the parameter which will receive the morph factor
+    */
+    void setCustomMaterialMorphFactorParam(const String& paramName);
+    /** Sets the index of the vertex program parameter to which to pass the
+        LOD morph factor.
+    @remarks
+        When LOD morphing is enabled, and you are using a custom material to 
+        shade the terrain, you need to inform this class of the parameter you
+        wish the current LOD morph factor to be passed to. This is a simple
+        float parameter value that the plugin will set from 0 to 1, depending on
+        the morph stage of a tile. 0 represents no morphing, ie the vertices are
+        all in the original position. 1 represents a complete morph such that
+        the height of the vertices is the same as they are at the next lower LOD
+        level. The vertex program must use this factor, in conjunction with the
+        per-vertex height delta values (bound as 'blend weight'), to displace
+        vertices.
+    @note This version of the method lets you specify a parameter index, compatible
+        with low-level assembler vertex programs. There is an alternative signature method
+        which allows you to set the parameter name for high-level programs.
+    @param paramName The name of the parameter which will receive the morph factor
+    */
+    void setCustomMaterialMorphFactorParam(size_t paramIndex);
+    /** Sets the distance at which the LOD will start to morph downwards, as
+    a proportion of the distance between the LODs. */
+    void setLODMorphStart(Real morphStart);
+
+    /** Returns the TerrainRenderable that contains the given pt.
+        If no tile exists at the point, it returns 0;
+    */
+    virtual TerrainRenderable * getTerrainTile( const Vector3 & pt );
+
+    /** Returns the TerrainPage that contains the given pt.
+    If no page exists at the point, it returns 0;
+    */
+    virtual TerrainPage* getTerrainPage( const Vector3 & pt );
+
+    /** 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.
+    */
+    RaySceneQuery* 
+        createRayQuery(const Ray& ray, unsigned long mask = 0xFFFFFFFF);
+
+    /** Overridden in order to store the first camera created as the primary
+        one, for determining error metrics and the 'home' terrain page.
+    */
+    Camera* createCamera( const String &name );
+    /// Gets the terrain options 
+    const TerrainOptions& getOptions(void) { return mOptions; }
+
+    /** Sets the given option for the SceneManager.
+    @remarks
+        Options are (in addition to those supported by superclasses):
+        "PageSize", int*;
+        "TileSize", int*; 
+        "PrimaryCamera, Camera*;
+        "MaxMipMapLevel", int*;
+        "Scale", Vector3 *;
+        "MaxPixelError", int*;
+        "UseTriStrips", bool*;
+        "VertexProgramMorph", bool*;
+        "DetailTile", int*;
+        "LodMorphStart", Real*;
+        "VertexNormals", bool*;
+        "VertexColours", bool*;
+        "MorphLODFactorParamName", String*;
+        "MorphLODFactorParamIndex", size_t*;
+        "CustomMaterialName", String*;
+        "WorldTexture", String*;
+        "DetailTexture", String*;
+    */
+    virtual bool setOption( const String &, const void * );
+
+    /** Sets the 'primary' camera, i.e. the one which will be used to determine
+        the 'home' terrain page, and to calculate the error metrics. 
+    */
+    virtual void setPrimaryCamera(const Camera* cam);
+    /// Internal map of page source name to page source
+    typedef std::map<String, TerrainPageSource*> PageSourceMap;
+
+    /// Iterator over all page sources
+    typedef ConstMapIterator<PageSourceMap> PageSourceIterator;
+    /// Get an iterator over all page sources
+    PageSourceIterator getPageSourceIterator(void);
+    /** Registers a TerrainPageSource class and associates it with a named type 
+        of source.
+    @remarks
+        This function allows external classes to register themselves as providers
+        of terrain pages of a particular type. Only one page source can be
+        active at once, and the active one is selected by calling 
+        selectPageSource(typeName), which is part of plugin configuration.
+    @note The terrain engine comes with a default page source which loads
+        greyscale heightmap images, registered under the type name "Heightmap".
+    @param typeName A unique String to associate with this type of source
+    @param source Pointer to the class which will implement this source.
+    */
+    virtual void registerPageSource(const String& typeName, TerrainPageSource* source);
+    /** Selects a given page source based on its type name.
+    @remarks
+        This method activates a single page source based on its typename, 
+        e.g. "Heightmap". It also passes to it a number of custom options
+        which the source is able to interpret however it likes.
+    @param typeName The type name of the page source to activate
+    @param optionList A list of string parameters, which are expected to begin
+        with 'typeName.' (e.g. "Heightmap.image"), with their appropriate
+        values.
+    */
+    virtual void selectPageSource(const String& typeName, 
+        TerrainPageSourceOptionList& optionList);
+
+    /** Attaches a previously built page to the list of available pages.
+    @remarks
+        TerrainPageSource subclasses will call this method once they have
+        pages available to be added to the working set. Note that whilst you
+        can build TerrainPage instances in another thread if you like, this
+        method must be called in the same thread as the main rendering loop 
+        in order to avoid concurrency issues. 
+    @param pageX, pageZ The page index at which to attach the page
+    @param page The page to attach
+    */
+    virtual void attachPage(ushort pageX, ushort pageZ, TerrainPage* page);
+    /// Get a pointer to the material being used for the terrain
+    MaterialPtr& getTerrainMaterial(void);
+    // Overridden from basic scene manager
+    void _renderScene(Camera *cam, Viewport *vp, bool includeOverlays);
+
+    /// Get the SceneNode under which all terrain nodes are attached.
+    SceneNode* getTerrainRootNode(void) const { return mTerrainRoot; }
+    /** Overridden from SceneManager */
+    void clearScene(void);
+	/** Overridden from SceneManager */
+	void setWorldGeometryRenderQueue(uint8 qid);
+
+	/// Get the shared list of indexes cached (internal use only)
+	TerrainBufferCache& _getIndexCache(void) {return mIndexCache;}
+
+	/// Get the shared level index list (internal use only)
+	LevelArray& _getLevelIndex(void) { return mLevelIndex; }
+
+	/// Get the current page count (internal use only)
+	size_t _getPageCount(void) { return mTerrainPages.size(); }
+
+	/// Shutdown cleanly before we get destroyed
+	void shutdown(void);
+
+
+protected:
+
+    /// Validates that the size picked for the terrain is acceptable
+    bool _checkSize( int s )
+    {
+        for ( int i = 0; i < 16; i++ )
+        {
+            printf( "Checking...%d\n", ( 1 << i ) + 1 );
+
+            if ( s == ( 1 << i ) + 1 )
+                return true;
+        }
+
+        return false;
+
+    }
+
+    /// The node to which all terrain tiles are attached
+    SceneNode * mTerrainRoot;
+    /// Terrain size, detail etc
+    TerrainOptions mOptions;
+    /// Should we use an externally-defined custom material?
+    bool mUseCustomMaterial;
+    /// The name of the custom material to use
+    String mCustomMaterialName;
+    /// The name of the world texture
+    String mWorldTextureName;
+    /// The name of the detail texture
+    String mDetailTextureName;
+    /// Are we using a named parameter to hook up LOD morph?
+    bool mUseNamedParameterLodMorph;
+    /// The name of the parameter to send the LOD morph to
+    String mLodMorphParamName;
+    /// The index of the parameter to send the LOD morph to
+    size_t mLodMorphParamIndex;
+    /// Whether paging is enabled, or whether a single page will be used
+    bool mPagingEnabled;
+    /// The number of pages to render outside the 'home' page
+    unsigned short mLivePageMargin;
+    /// The number of pages to keep loaded outside the 'home' page
+    unsigned short mBufferedPageMargin;
+    /// Grid of buffered pages
+    TerrainPage2D mTerrainPages;
+	//-- attributes to share across tiles
+	/// Shared list of index buffers
+	TerrainBufferCache mIndexCache;
+	/// Shared array of IndexData (reuse indexes across tiles)
+	LevelArray mLevelIndex;
+    
+    /// Internal method for loading configurations settings
+    void loadConfig(DataStreamPtr& stream);
+
+    /// Sets up the terrain material
+    void setupTerrainMaterial(void);
+    /// Sets up the terrain page slots
+    void setupTerrainPages(void);
+	/// Initialise level indexes
+	void initLevelIndexes(void);
+	/// Destroy level indexes
+	void destroyLevelIndexes(void);
+
+
+    /// Map of source type -> TerrainPageSource
+    PageSourceMap mPageSources;
+    /// The currently active page source
+    TerrainPageSource* mActivePageSource;
+
+};
+/// Factory for TerrainSceneManager
+class TerrainSceneManagerFactory : public SceneManagerFactory
+{
+protected:
+	typedef std::vector<TerrainPageSource*> TerrainPageSources;
+	TerrainPageSources mTerrainPageSources;
+	void initMetaData(void) const;
+public:
+	TerrainSceneManagerFactory();
+	~TerrainSceneManagerFactory();
+	/// Factory type name
+	static const String FACTORY_TYPE_NAME;
+	SceneManager* createInstance(const String& instanceName);
+	void destroyInstance(SceneManager* instance);
+};
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreQuake3Types.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreQuake3Types.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreQuake3Types.h	(revision 1812)
@@ -0,0 +1,250 @@
+// Quake 3 data definitions
+// Copyright (C) 1999-2000 Id Software, Inc.
+//
+// This file must be identical in the quake and utils directories
+
+// contents flags are seperate bits
+// a given brush can contribute multiple content bits
+
+// these definitions also need to be in q_shared.h!
+#ifndef __Quake3Types_H__
+#define __Quake3Types_H__
+
+
+#define BSP_HEADER_ID   (*(int*)"IBSP")
+#define BSP_HEADER_VER  (46)
+
+#define BSP_ENTITIES_LUMP   (0)
+#define BSP_SHADERS_LUMP    (1)
+#define BSP_PLANES_LUMP     (2)
+#define BSP_NODES_LUMP      (3)
+#define BSP_LEAVES_LUMP     (4)
+#define BSP_LFACES_LUMP     (5)
+#define BSP_LBRUSHES_LUMP   (6)
+#define BSP_MODELS_LUMP     (7)
+#define BSP_BRUSH_LUMP      (8)
+#define BSP_BRUSHSIDES_LUMP (9)
+#define BSP_VERTICES_LUMP   (10)
+#define BSP_ELEMENTS_LUMP   (11)
+#define BSP_FOG_LUMP        (12)
+#define BSP_FACES_LUMP      (13)
+#define BSP_LIGHTMAPS_LUMP  (14)
+#define BSP_LIGHTVOLS_LUMP  (15)
+#define BSP_VISIBILITY_LUMP (16)
+
+#define BSP_LIGHTMAP_BANKSIZE   (128*128*3)
+
+
+#define    CONTENTS_SOLID            1        // an eye is never valid in a solid
+#define    CONTENTS_LAVA            8
+#define    CONTENTS_SLIME            16
+#define    CONTENTS_WATER            32
+#define    CONTENTS_FOG            64
+
+#define    CONTENTS_AREAPORTAL        0x8000
+
+#define    CONTENTS_PLAYERCLIP        0x10000
+#define    CONTENTS_MONSTERCLIP    0x20000
+//bot specific contents types
+#define    CONTENTS_TELEPORTER        0x40000
+#define    CONTENTS_JUMPPAD        0x80000
+#define CONTENTS_CLUSTERPORTAL    0x100000
+#define CONTENTS_DONOTENTER        0x200000
+
+#define    CONTENTS_ORIGIN            0x1000000    // removed before bsping an entity
+
+#define    CONTENTS_BODY            0x2000000    // should never be on a brush, only in game
+#define    CONTENTS_CORPSE            0x4000000
+#define    CONTENTS_DETAIL            0x8000000    // brushes not used for the bsp
+#define    CONTENTS_STRUCTURAL        0x10000000    // brushes used for the bsp
+#define    CONTENTS_TRANSLUCENT    0x20000000    // don't consume surface fragments inside
+#define    CONTENTS_TRIGGER        0x40000000
+#define    CONTENTS_NODROP            0x80000000    // don't leave bodies or items (death fog, lava)
+
+#define    SURF_NODAMAGE            0x1        // never give falling damage
+#define    SURF_SLICK                0x2        // effects game physics
+#define    SURF_SKY                0x4        // lighting from environment map
+#define    SURF_LADDER                0x8
+#define    SURF_NOIMPACT            0x10    // don't make missile explosions
+#define    SURF_NOMARKS            0x20    // don't leave missile marks
+#define    SURF_FLESH                0x40    // make flesh sounds and effects
+#define    SURF_NODRAW                0x80    // don't generate a drawsurface at all
+#define    SURF_HINT                0x100    // make a primary bsp splitter
+#define    SURF_SKIP                0x200    // completely ignore, allowing non-closed brushes
+#define    SURF_NOLIGHTMAP            0x400    // surface doesn't need a lightmap
+#define    SURF_POINTLIGHT            0x800    // generate lighting info at vertexes
+#define    SURF_METALSTEPS            0x1000    // clanking footsteps
+#define    SURF_NOSTEPS            0x2000    // no footstep sounds
+#define    SURF_NONSOLID            0x4000    // don't collide against curves with this set
+#define SURF_LIGHTFILTER        0x8000    // act as a light filter during q3map -light
+#define    SURF_ALPHASHADOW        0x10000    // do per-pixel light shadow casting in q3map
+#define    SURF_NODLIGHT            0x20000    // don't dlight even if solid (solid lava, skies)
+
+/* Shader flags */
+enum
+{
+    SHADER_NOCULL        = 1 << 0,
+    SHADER_TRANSPARENT   = 1 << 1,
+    SHADER_DEPTHWRITE    = 1 << 2,
+    SHADER_SKY           = 1 << 3,
+    SHADER_NOMIPMAPS     = 1 << 4,
+    SHADER_NEEDCOLOURS   = 1 << 5,
+    SHADER_DEFORMVERTS   = 1 << 6
+};
+
+/* Shaderpass flags */
+enum
+{
+    SHADER_LIGHTMAP   = 1 << 0,
+    SHADER_BLEND      = 1 << 1,
+    SHADER_ALPHAFUNC  = 1 << 3,
+    SHADER_TCMOD      = 1 << 4,
+    SHADER_ANIMMAP    = 1 << 5,
+    SHADER_TCGEN_ENV  = 1 << 6
+};
+
+/* Transform functions */
+enum WaveType
+{
+    SHADER_FUNC_NONE            = 0,
+    SHADER_FUNC_SIN             = 1,
+    SHADER_FUNC_TRIANGLE        = 2,
+    SHADER_FUNC_SQUARE          = 3,
+    SHADER_FUNC_SAWTOOTH        = 4,
+    SHADER_FUNC_INVERSESAWTOOTH = 5
+};
+
+/* *Gen functions */
+enum GenFunc
+{
+    SHADER_GEN_IDENTITY = 0,
+    SHADER_GEN_WAVE     = 1,
+    SHADER_GEN_VERTEX   = 2
+};
+
+enum TexGen
+{
+    TEXGEN_BASE = 0,        // Coord set 0
+    TEXGEN_LIGHTMAP = 1,    // Coord set 1
+    TEXGEN_ENVIRONMENT = 2  // Neither, generated
+};
+
+enum DeformFunc
+{
+    DEFORM_FUNC_NONE = 0,
+    DEFORM_FUNC_BULGE = 1,
+    DEFORM_FUNC_WAVE = 2,
+    DEFORM_FUNC_NORMAL = 3,
+    DEFORM_FUNC_MOVE = 4,
+    DEFORM_FUNC_AUTOSPRITE = 5,
+    DEFORM_FUNC_AUTOSPRITE2 = 6
+
+};
+/////////////////////////////////////////////////////////
+//
+// bsp contents
+//
+
+struct bsp_plane_t {
+    float normal[3];
+    float dist;
+};
+
+struct bsp_model_t {
+    float bbox[6];
+    int face_start;
+    int face_count;
+    int brush_start;
+    int brush_count;
+};
+
+struct bsp_node_t {
+    int plane;          // dividing plane
+    //int children[2];    // left and right nodes,
+                        // negative are leaves
+    int front;
+    int back;
+    int bbox[6];
+};
+
+struct bsp_leaf_t {
+    int cluster;    // visibility cluster number
+    int area;
+    int bbox[6];
+    int face_start;
+    int face_count;
+    int brush_start;
+    int brush_count;
+};
+
+#define BSP_FACETYPE_NORMAL (1)
+#define BSP_FACETYPE_PATCH  (2)
+#define BSP_FACETYPE_MESH   (3)
+#define BSP_FACETYPE_FLARE  (4)
+
+struct bsp_face_t {
+    int shader;         // shader ref
+    int unknown;
+    int type;           // face type
+    int vert_start;
+    int vert_count;
+    int elem_start;
+    int elem_count;
+    int lm_texture;     // lightmap
+    int lm_offset[2];
+    int lm_size[2];
+    float org[3];       // facetype_normal only
+    float bbox[6];      // facetype_patch only
+    float normal[3];    // facetype_normal only
+    int mesh_cp[2];     // patch control point dims
+};
+
+struct bsp_shader_t {
+    char name[64];
+    int surface_flags;
+    int content_flags;
+};
+
+struct bsp_vertex_t {
+    float point[3];
+    float texture[2];
+    float lightmap[2];
+    float normal[3];
+    int color;
+};
+
+struct bsp_vis_t {
+    int cluster_count;
+    int row_size;
+    unsigned char data[1];
+};
+
+// OGRE additions
+struct bsp_lump_entry_t {
+    int offset;
+    int size;
+};
+struct bsp_header_t {
+    char magic[4];
+    int version;
+    bsp_lump_entry_t lumps[17];
+};
+
+//
+// Brushes sides in BSP tree
+//
+struct bsp_brushside_t {
+	int planenum;
+	int content;			// ¿?shader¿?
+};
+
+
+//
+// Brushes in BSP tree
+//
+struct bsp_brush_t {
+	int firstside;
+	int numsides;
+	int shaderIndex;
+};
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreQuake3Shader.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreQuake3Shader.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreQuake3Shader.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __QUAKE3SHADER_H__
+#define __QUAKE3SHADER_H__
+
+#include "OgreResource.h"
+#include "OgreBspPrerequisites.h"
+#include "OgreQuake3Types.h"
+#include "OgreCommon.h"
+#include "OgreColourValue.h"
+#include "OgreBlendMode.h"
+#include "OgreTextureUnitState.h"
+
+namespace Ogre {
+
+
+    /** Class for recording Quake3 shaders.
+        This is a temporary holding area since shaders are actually converted into
+        Material objects for use in the engine proper. However, because we have to read
+        in shader definitions en masse (because they are stored in shared .shader files)
+        without knowing which will actually be used, we store their definitions here
+        temporarily since their instantiations as Materials would use precious resources
+        because of the automatic loading of textures etc.
+    */
+    class Quake3Shader 
+    {
+    protected:
+        String getAlternateName(const String& texName);
+        String mName;
+
+    public:
+
+        /** Default constructor - used by Quake3ShaderManager (do not call directly) */
+        Quake3Shader(const String& name);
+        ~Quake3Shader();
+
+        /** Creates this shader as an OGRE material.
+            Creates a new material based on this shaders settings. 
+            Material name shader#lightmap.
+        */
+        MaterialPtr createAsMaterial(int lightmapNumber);
+
+        struct Pass {
+            unsigned int flags;
+            String textureName;
+            TexGen texGen;
+            // Multitexture blend
+            LayerBlendOperation blend;
+            // Multipass blends (Quake3 only supports multipass?? Surely not?)
+            SceneBlendFactor blendSrc;
+            SceneBlendFactor blendDest;
+            bool customBlend;
+            CompareFunction depthFunc;
+            TextureUnitState::TextureAddressingMode addressMode;
+            // TODO - alphaFunc
+            GenFunc rgbGenFunc;
+            WaveType rgbGenWave;
+            Real rgbGenParams[4];    // base, amplitude, phase, frequency
+            Real tcModScale[2];
+            Real tcModRotate;
+            Real tcModScroll[2];
+            Real tcModTransform[6];
+            bool tcModTurbOn;
+            Real tcModTurb[4];
+            WaveType tcModStretchWave;
+            Real tcModStretchParams[4];    // base, amplitude, phase, frequency
+            CompareFunction alphaFunc;
+            unsigned char alphaVal;
+
+            Real animFps;
+            unsigned int animNumFrames;
+            String frames[32];
+        };
+
+        unsigned int flags;
+        int numPasses;
+        typedef std::vector<Pass> PassList;
+        PassList pass;
+        bool farbox;            // Skybox
+        String farboxName;
+        bool skyDome;
+        Real cloudHeight;       // Skydome
+        DeformFunc deformFunc;
+        Real deformParams[5];
+        ManualCullingMode cullMode;
+
+        bool fog;
+        ColourValue fogColour;
+        Real fogDistance;
+
+    };
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreOctree.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreOctree.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreOctree.h	(revision 1812)
@@ -0,0 +1,163 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+/***************************************************************************
+octree.h  -  description
+-------------------
+begin                : Mon Sep 30 2002
+copyright            : (C) 2002 by Jon Anderson
+email                : janders@users.sf.net
+
+Enhancements 2003 - 2004 (C) The OGRE Team
+***************************************************************************/
+
+#ifndef OCTREE_H
+#define OCTREE_H
+
+#include <OgreAxisAlignedBox.h>
+#include <OgreWireBoundingBox.h>
+
+#include <list>
+
+namespace Ogre
+{
+
+class OctreeNode;
+
+typedef std::list < OctreeNode * > NodeList;
+
+
+/** Octree datastructure for managing scene nodes.
+@remarks
+This is a loose octree implementation, meaning that each
+octant child of the octree actually overlaps it's siblings by a factor
+of .5.  This guarantees that any thing that is half the size of the parent will
+fit completely into a child, with no splitting necessary.
+*/
+
+class Octree
+{
+public:
+    Octree( Octree * p );
+    ~Octree();
+
+    /** Adds an Octree scene node to this octree level.
+    @remarks
+    This is called by the OctreeSceneManager after
+    it has determined the correct Octree to insert the node into.
+    */
+    void _addNode( OctreeNode * );
+
+    /** Removes an Octree scene node to this octree level.
+    */
+    void _removeNode( OctreeNode * );
+
+    /** Returns the number of scene nodes attached to this octree
+    */
+    int numNodes()
+    {
+        return mNumNodes;
+    };
+
+    /** The bounding box of the octree
+    @remarks
+    This is used for octant index determination and rendering, but not culling
+    */
+    AxisAlignedBox mBox;
+    WireBoundingBox* mWireBoundingBox;
+    
+    /** Creats the wire frame bounding box for this octant
+    */
+    WireBoundingBox* getWireBoundingBox();
+
+    /** Vector containing the dimensions of this octree / 2
+    */
+    Vector3 mHalfSize;
+
+    /** 3D array of children of this octree.
+    @remarks
+    Children are dynamically created as needed when nodes are inserted in the Octree.
+    If, later, the all the nodes are removed from the child, it is still kept arround.
+    */
+    Octree * mChildren[ 2 ][ 2 ][ 2 ];
+
+    /** Determines if this octree is twice as big as the given box.
+    @remarks
+    This method is used by the OctreeSceneManager to determine if the given
+    box will fit into a child of this octree.
+    */
+    bool _isTwiceSize( const AxisAlignedBox &box ) const;
+
+    /**  Returns the appropriate indexes for the child of this octree into which the box will fit.
+    @remarks
+    This is used by the OCtreeSceneManager to determine which child to traverse next when
+    finding the appropriate octree to insert the box.  Since it is a loose octree, only the
+    center of the box is checked to determine the octant.
+    */
+    void _getChildIndexes( const AxisAlignedBox &, int *x, int *y, int *z ) const;
+
+    /** Creates the AxisAlignedBox used for culling this octree.
+    @remarks
+    Since it's a loose octree, the culling bounds can be different than the actual bounds of the octree.
+    */
+    void _getCullBounds( AxisAlignedBox * ) const;
+
+
+    /** Public list of SceneNodes attached to this particular octree
+    */
+    NodeList mNodes;
+
+protected:
+
+    /** Increments the overall node count of this octree and all it's parents
+    */
+    inline void _ref()
+    {
+        mNumNodes++;
+
+        if ( mParent != 0 ) mParent -> _ref();
+    };
+
+    /** Decrements the overall node count of this octree and all it's parents
+    */
+    inline void _unref()
+    {
+        mNumNodes--;
+
+        if ( mParent != 0 ) mParent -> _unref();
+    };
+
+    ///number of SceneNodes in this octree and all it's children.
+    int mNumNodes;
+
+    ///parent octree
+    Octree * mParent;
+
+};
+
+}
+
+#endif
+
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreQuake3Level.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreQuake3Level.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreQuake3Level.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __Quake3Level_H__
+#define __Quake3Level_H__
+
+#include "OgreBspPrerequisites.h"
+#include "OgreQuake3Types.h"
+#include "OgreDataStream.h"
+
+
+namespace Ogre {
+
+    /** Support for loading and extracting data from a Quake3 level file.
+    This class implements the required methods for opening Quake3 level files
+    and extracting the pertinent data within. Ogre supports BSP based levels
+    through it's own BspLevel class, which is not specific to any file format,
+    so this class is here to source that data from the Quake3 format.</p>
+    Quake3 levels include far more than just data for rendering - typically the
+    <strong>leaves</strong> of the tree are used for rendering, and <strong>brushes,</strong>
+    are used to    define convex hulls made of planes for collision detection. There are also
+    <strong>entities</strong> which define non-visual elements like player start
+    points, triggers etc and <strong>models</strong> which are used for movable
+    scenery like doors and platforms. <strong>Shaders</strong> meanwhile are textures
+    with extra effects and 'content flags' indicating special properties like
+    water or lava.</p>
+    I will try to support as much of this as I can in Ogre, but I won't duplicate
+    the structure or necesarily use the same terminology. Quake3 is designed for a very specific
+    purpose and code structure, whereas Ogre is designed to be more flexible,
+    so for example I'm likely to separate game-related properties like surface flags
+    from the generics of materials in my implementation.</p>
+    This is a utility class only - a single call to loadFromChunk should be
+    enough. You should not expect the state of this object to be consistent
+    between calls, since it uses pointers to memory which may no longer
+    be valid after the original call. This is why it has no accessor methods
+    for reading it's internal state.
+    */
+    class Quake3Level
+    {
+    public:
+        Quake3Level();
+
+        /** Load just the header information from a Quake3 file. 
+        @remarks
+            This method loads just the header information from the 
+            Quake3 file, in order to estimate the loading time.
+        */
+        void loadHeaderFromStream(DataStreamPtr& inStream);
+
+        /** Reads Quake3 bsp data from a stream as read from the file.
+            Since ResourceManagers generally locate data in a variety of
+            places they typically manipulate them as a chunk of data, rather than
+            a file pointer since this is unsupported through compressed archives.</p>
+            Quake3 files are made up of a header (which contains version info and
+            a table of the contents) and 17 'lumps' i.e. sections of data,
+            the offsets to which are kept in the table of contents. The 17 types
+            are predefined (You can find them in OgreQuake3Types.h)
+
+            @param inStream Stream containing Quake3 data
+        */
+        void loadFromStream(DataStreamPtr& inStream);
+
+        /* Extracts the embedded lightmap texture data and loads them as textures.
+           Calling this method makes the lightmap texture data embedded in
+           the .bsp file available to the renderer. Lightmaps are extracted
+           and loaded as Texture objects (subclass specific to RenderSystem
+           subclass) and are named "@lightmap1", "@lightmap2" etc.
+        */
+        void extractLightmaps(void) const;
+
+        /** Utility function read the header and set up pointers. */
+        void initialise(bool headerOnly = false);
+        /** Utility function read the header and set up counters. */
+        void initialiseCounts(void);
+        /** Utility function read the header and set up pointers. */
+        void initialisePointers(void);
+
+        /** Utility function to return a pointer to a lump. */
+        void* getLump(int lumpType);
+        int getLumpSize(int lumpType);
+
+        /** Debug method. */
+        void dumpContents(void);
+
+        // Internal storage
+        // This is ALL temporary. Don't rely on it being static
+        MemoryDataStreamPtr mChunk;
+
+        // NB no brushes, fog or local lightvolumes yet
+        bsp_header_t* mHeader;
+        unsigned char* mLumpStart;
+
+        int* mElements; // vertex indexes for faces
+        int mNumElements;
+
+        void* mEntities;
+        int mNumEntities;
+
+        bsp_model_t* mModels;
+        int mNumModels;
+
+        bsp_node_t* mNodes;
+        int mNumNodes;
+
+        bsp_leaf_t* mLeaves;
+        int mNumLeaves;
+
+        int* mLeafFaces;     // Indexes to face groups by leaf
+        int mNumLeafFaces;
+
+        bsp_plane_t* mPlanes;
+        int mNumPlanes;
+
+        bsp_face_t* mFaces;      // Groups of faces
+        int mNumFaces;
+
+        bsp_vertex_t* mVertices;
+        int mNumVertices;
+
+        bsp_shader_t* mShaders;
+        int mNumShaders;
+
+        unsigned char* mLightmaps;
+        int mNumLightmaps;
+
+        bsp_vis_t* mVis;
+
+        bsp_brush_t* mBrushes;
+        int mNumBrushes;
+
+        bsp_brushside_t* mBrushSides;
+        int mNumBrushSides;
+
+        int* mLeafBrushes;      // Groups of indexes to brushes by leaf
+        int mNumLeafBrushes;
+
+
+
+    };
+}
+
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreTerrainPageSource.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreTerrainPageSource.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreTerrainPageSource.h	(revision 1812)
@@ -0,0 +1,254 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __TerrainPageSource_H__
+#define __TerrainPageSource_H__
+
+#include "OgreTerrainPrerequisites.h"
+#include "OgreSingleton.h"
+
+namespace Ogre {
+
+    typedef std::pair<String, String> TerrainPageSourceOption;
+    typedef std::vector<TerrainPageSourceOption> TerrainPageSourceOptionList;
+
+    /** Abstract class which classes can override to receive notifications
+        when a page is ready to be added to the terrain manager.
+    */
+    class _OgreTerrainExport TerrainPageSourceListener
+    {
+    public:
+        /** Listener method called when a new page is about to be constructed. 
+		@param manager The manager in question
+        @param pagex, pagez The index of the page being constructed
+        @param heightData Array of normalised height data (0..1). The size of
+            this buffer will conform to the scene manager page size. The listener
+            may modify the data if it wishes.
+        */
+        virtual void pageConstructed(TerrainSceneManager* manager, size_t pagex, size_t pagez, Real* heightData) = 0;
+    };
+
+	/** Simple manager class to hold onto a list of page source listeners 
+	    across all sources.
+	*/
+	class _OgreTerrainExport TerrainPageSourceListenerManager :
+		public Singleton<TerrainPageSourceListenerManager>
+	{
+	protected:
+        typedef std::vector<TerrainPageSourceListener*> PageSourceListenerList;
+        PageSourceListenerList mPageSourceListeners;
+	public:
+        TerrainPageSourceListenerManager() {}
+        ~TerrainPageSourceListenerManager() {}
+
+        /** Register a class which will be called back whenever a new page is
+            available.
+        @remarks
+            Since this method is static, it applies to any page source which 
+            is in active use; there is no need to register one per source.
+        */
+        void addListener(TerrainPageSourceListener* pl);
+        /** Unregister a class which will be called back whenever a new page is
+        available.
+        */
+        void removeListener(TerrainPageSourceListener* pl);
+		
+        /// Fire pageContructed events
+        void firePageConstructed(TerrainSceneManager* manager, size_t pagex, size_t pagez, Real* heightData);
+
+       /** Override standard Singleton retrieval.
+        */
+        static TerrainPageSourceListenerManager& getSingleton(void);
+        /** Override standard Singleton retrieval.
+        */
+        static TerrainPageSourceListenerManager* getSingletonPtr(void);	
+	
+	};
+
+
+    /** Abstract class which describes the interface which a source of terrain 
+        pages must implement.
+    @remarks
+        The TerrainSceneManager can accept external classes as providers of
+        terrain data, to allow terrain height data to come from anywhere the
+        user application may choose, and additionally to support on-demand
+        loading an unloading of terrain data. Providers must suclass this class, 
+        and implement the abstract methods (details are described within each method)
+    @par
+        The overall sequence of events is this:
+        <ol>
+        <li>TerrainSceneManager is created as usual, and options such as tile
+        size etc are set.</li>
+        <li>CustomTerrainPageSource is registered with TerrainSceneManager by 
+        calling registerPageSource(), registering a particular named type of source 
+        data with this tile source. <li>
+        <li>TerrainSceneManager::setWorldGeometry is called. Depending on the
+        configuration, this will call one of the page source classes 
+        initialise methods, when the scene manager will communicate it's 
+        preferred options. It does not have to load anything immediately on this 
+        call (especially if the terrain options include paging). It will 
+        also set this tile source as the primary.<li>
+        <li>As and when TerrainSceneManager requires more tiles (and this will
+        either be done all up-front, or progressively depending on paging settings)
+        it will call the primary tile source's requestPage() method, with the 
+        page it requires. </li>
+        <li>It is then the responsibility of the tile source to prepare
+        TerrainRenderable instances for the page(s) requested, and to attach them 
+        to the TerrainSceneManager. Note that preparing the tiles does not
+        involve modifying any shared data so may be done in an alternate thread,
+        if required. Attaching them must be done synchronously though.
+        <li>When paging, the TerrainSceneManager will request tiles in advance,
+        within it's 'buffer zone' so some delay in loading is acceptable. It
+        will also indicate when tiles are no longer required (and will detach
+        them); it is up to the tile source whether that memory is actually freed
+        or held for a while longer.
+        </ol>
+    @note The comments on paging above are in principle, the implementation of
+    paging in this manager is not present yet but the system is designed to 
+    extend to it. For now, all tiles are requested up-front.
+    */
+    class _OgreTerrainExport TerrainPageSource
+    {
+    protected:
+        /// Link back to parent manager
+        TerrainSceneManager* mSceneManager;
+        /// Has asynchronous loading been requested?
+        bool mAsyncLoading;
+        /// The expected size of the page in number of vertices
+        unsigned short mPageSize;
+        /// The expected size of a tile in number of vertices
+        unsigned short mTileSize;
+
+        /// Internal method for firing pageContructed events
+        void firePageConstructed(size_t pagex, size_t pagez, Real* heightData);
+
+        /** Utility method for building a page of tiles based on some source
+        data, wherever that may have come from.
+        @remarks
+            It is expected that this height data is represented in the range
+            [0..1], which will be duly scaled by the TerrainRenderables it
+            creates.
+        */
+        virtual TerrainPage* buildPage(Real* heightData, const MaterialPtr& pMaterial);
+
+
+    public:
+        TerrainPageSource(); 
+        virtual ~TerrainPageSource() { shutdown(); }
+
+        /** Initialise this tile source based on a series of options as
+            dictated by the scene manager. 
+        @param tsm The TerrainSceneManager doing the initialising. This should be 
+            allowed NULL, for use by external tools if they want to read data 
+            generically without necessarily having a real scene manager involved
+        @param tileSize The number of horizontal (and hence also vertical) 
+            vertices in a single tile (which is a TerrainRenderable). This will
+            always be (2^n)+1.
+        @param pageSize The number of horizontal (and hence also vertical) 
+            vertices in a single page. This will always be (2^n)+1.
+        @param asyncLoading
+            True if the scene manager would like the tile source to load tiles
+            asynchronously. It does not have to do this, although if it does not
+            when requested, it will likely result in stalls in the terrain rendering.
+        @param optionList 
+            A list of name/value pairs describing custom options for this particular
+            page source. The expected convention for option names is
+            "TypeName.OptionName", where TypeName is the type under which this
+            page source has been registered.
+        */
+        virtual void initialise(TerrainSceneManager* tsm, 
+            ushort tileSize, ushort pageSize, bool asyncLoading, 
+            TerrainPageSourceOptionList& optionList)
+        {
+            mSceneManager = tsm;
+            mTileSize = tileSize;
+            mPageSize = pageSize;
+            mAsyncLoading = asyncLoading;
+        }
+        /** Shut down this tile source, freeing all it's memory ready for 
+            decommissioning.
+        @remarks
+            This method will normally just be called on destruction; however
+            it may also be called by the TerrainSceneManager if another source
+            is provided for the same type of tile source.
+        */
+        virtual void shutdown(void) {}
+
+        /** Requests a new page of tiles from the source.
+        @remarks
+            The TerrainSceneManager will call this method when it needs new tiles.
+            In response, this class must prepare TerrainRenderable instances for
+            the page requested and attach the entire page when ready using 
+            TerrainSceneManager::attachTerrainPage.
+        @par
+            Now, the tile source does not necessarily need to do all that before the
+            return of this method. If it likes, and particularly if asynchronous 
+            loading is enabled, it can merely queue this request, and process it
+            either in another thread, or over a series of frames. The key thing
+            is that attaching the new page has to be done synchronously with 
+            the main rendering loop in order to avoid concurrency issues; 
+            other than that, you are free to load and prepare new tiles in 
+            a concurrent fashion if you like.
+        @par
+            Typically the scene manager will request at least one page up-front,
+            with the possibility of requesting more if paging is enabled.
+        @param x The x index of the page requested
+        @param z The z index of the page requested
+        */
+        virtual void requestPage(ushort x, ushort z) = 0;
+        /** This notifies the tile source that the specified page of tiles 
+            has been automatically detached.
+        @remarks
+            When paging is enabled, tiles go out of scope and the TerrainSceneManager
+            detaches them automatically, notifying the TerrainPageSource that 
+            this has happened. The tile source can choose to either keep these
+            tiles in memory (incase they are requested again) or can delete them
+            if it wishes to free memory. This freeing does not need to be done
+            before the return of this method - like requesting tiles, the
+            freeing of them can be done in another thread or across many frames
+            if required, since the shared data in TerrainSceneManager has already
+            been updated synchronously when the page was detached.
+        @param x The x index of the page expired
+        @param z The z index of the page expired
+        */
+        virtual void expirePage(ushort x, ushort z) = 0;
+        
+        /** Register a class which will be called back whenever a new page is
+            available.
+        @remarks
+            Since this method is static, it applies to any page source which 
+            is in active use; there is no need to register one per source.
+        */
+        static void addListener(TerrainPageSourceListener* pl);
+        /** Unregister a class which will be called back whenever a new page is
+        available.
+        */
+        static void removeListener(TerrainPageSourceListener* pl);
+
+    };
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreOctreeSceneQuery.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreOctreeSceneQuery.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreOctreeSceneQuery.h	(revision 1812)
@@ -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  2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+ 
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+ 
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ 
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+/***************************************************************************
+OgreOctreeSceneQuery.h  -  description
+-------------------
+begin                : Tues July 20, 2004
+copyright            : (C) 2004 by Jon Anderson
+email                : janders@users.sf.net
+***************************************************************************/
+
+#ifndef OCTREESCENEQUERY_H
+#define OCTREESCENEQUERY_H
+
+#include "OgreTerrainPrerequisites.h"
+#include <OgreSceneManager.h>
+
+
+namespace Ogre
+{
+/** Octree implementation of IntersectionSceneQuery. */
+class _OgreTerrainExport OctreeIntersectionSceneQuery :  public DefaultIntersectionSceneQuery
+{
+public:
+    OctreeIntersectionSceneQuery(SceneManager* creator);
+    ~OctreeIntersectionSceneQuery();
+
+    /** See IntersectionSceneQuery. */
+    void execute(IntersectionSceneQueryListener* listener);
+};
+
+/** Octree implementation of RaySceneQuery. */
+class _OgreTerrainExport OctreeRaySceneQuery : public DefaultRaySceneQuery
+{
+public:
+    OctreeRaySceneQuery(SceneManager* creator);
+    ~OctreeRaySceneQuery();
+
+    /** See RayScenQuery. */
+    void execute(RaySceneQueryListener* listener);
+};
+/** Octree implementation of SphereSceneQuery. */
+class _OgreTerrainExport OctreeSphereSceneQuery : public DefaultSphereSceneQuery
+{
+public:
+    OctreeSphereSceneQuery(SceneManager* creator);
+    ~OctreeSphereSceneQuery();
+
+    /** See SceneQuery. */
+    void execute(SceneQueryListener* listener);
+};
+/** Octree implementation of PlaneBoundedVolumeListSceneQuery. */
+class _OgreTerrainExport OctreePlaneBoundedVolumeListSceneQuery : public DefaultPlaneBoundedVolumeListSceneQuery
+{
+public:
+    OctreePlaneBoundedVolumeListSceneQuery(SceneManager* creator);
+    ~OctreePlaneBoundedVolumeListSceneQuery();
+
+    /** See SceneQuery. */
+    void execute(SceneQueryListener* listener);
+};
+/** Octree implementation of AxisAlignedBoxSceneQuery. */
+class _OgreTerrainExport OctreeAxisAlignedBoxSceneQuery : public DefaultAxisAlignedBoxSceneQuery
+{
+public:
+    OctreeAxisAlignedBoxSceneQuery(SceneManager* creator);
+    ~OctreeAxisAlignedBoxSceneQuery();
+
+    /** See RayScenQuery. */
+    void execute(SceneQueryListener* listener);
+};
+
+
+}
+
+#endif
+
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreBspResourceManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreBspResourceManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreBspResourceManager.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _BspLevelManager_H__
+#define _BspLevelManager_H__
+
+#include "OgreBspPrerequisites.h"
+#include "OgreResourceManager.h"
+#include "OgreSingleton.h"
+
+namespace Ogre {
+
+    /** Manages the locating and loading of BSP-based indoor levels.
+    Like other ResourceManager specialisations it manages the location and loading
+    of a specific type of resource, in this case files containing Binary
+    Space Partition (BSP) based level files e.g. Quake3 levels.</p>
+    However, note that unlike other ResourceManager implementations,
+    only 1 BspLevel resource is allowed to be loaded at one time. Loading
+    another automatically unloads the currently loaded level if any.
+    */
+    class BspResourceManager : public ResourceManager, public Singleton<BspResourceManager>
+    {
+    public:
+        BspResourceManager();
+        ~BspResourceManager();
+
+        /** Loads a BSP-based level from the named file.
+            Currently only supports loading of Quake3 .bsp files.
+        */
+        ResourcePtr load(const String& name, 
+            const String& group, bool isManual = false, 
+            ManualResourceLoader* loader = 0, const NameValuePairList* loadParams = 0);
+
+        /** Loads a BSP-based level from a stream.
+            Currently only supports loading of Quake3 .bsp files.
+        */
+        ResourcePtr load(DataStreamPtr& stream, const String& group);
+
+        /** 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 BspResourceManager& 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 BspResourceManager* getSingletonPtr(void);
+
+
+    protected:
+        /** @copydoc ResourceManager::createImpl. */
+        Resource* createImpl(const String& name, ResourceHandle handle, 
+            const String& group, bool isManual, ManualResourceLoader* loader, 
+            const NameValuePairList* createParams);
+
+        // Singleton managed by this class
+        Quake3ShaderManager *mShaderMgr;
+
+    };
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreOctreeNode.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreOctreeNode.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreOctreeNode.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+/***************************************************************************
+octreenode.h  -  description
+-------------------
+begin                : Fri Sep 27 2002
+copyright            : (C) 2002 by Jon Anderson
+email                : janders@users.sf.net
+
+Enhancements 2003 - 2004 (C) The OGRE Team
+***************************************************************************/
+
+#ifndef OCTREENODE_H
+#define OCTREENODE_H
+
+#include <OgreSceneNode.h>
+
+#include <OgreOctreeSceneManager.h>
+
+namespace Ogre
+{
+
+/** Specialized SceneNode that is customized for working within an Octree. Each node
+* maintains it's own bounding box, rather than merging it with all the children.
+*
+*/
+
+class OctreeNode : public SceneNode
+{
+public:
+    /** Standard constructor */
+    OctreeNode( SceneManager* creator );
+    /** Standard constructor */
+    OctreeNode( SceneManager* creator, const String& name );
+    /** Standard destructor */
+    ~OctreeNode();
+
+    /** Overridden from Node to remove any reference to octants */
+    Node * removeChild( unsigned short index );
+    
+    /** Overridden from Node to remove any reference to octants */
+    Node * removeChild( const String & name );
+
+    /** Overridden from Node to remove any reference to octants */
+    Node * removeChild( Node* child);
+
+    /** Returns the Octree in which this OctreeNode resides
+    */
+    Octree * getOctant()
+    {
+        return mOctant;
+    };
+
+    /** Sets the Octree in which this OctreeNode resides
+    */
+    void setOctant( Octree *o )
+    {
+        mOctant = o;
+    };
+
+    /** Determines if the center of this node is within the given box
+    */
+    bool _isIn( AxisAlignedBox &box );
+
+    /** Adds all the attached scenenodes to the render queue
+    */
+    virtual void _addToRenderQueue( Camera* cam, RenderQueue * q, bool onlyShadowCasters );
+
+    /** Sets up the LegacyRenderOperation for rendering this scene node as geometry.
+    @remarks
+    This will render the scenenode as a bounding box.
+    */
+    virtual void getRenderOperation( RenderOperation& op );
+
+    /** Returns the local bounding box of this OctreeNode.
+    @remarks
+    This is used to render the bounding box, rather then the global.
+    */
+    AxisAlignedBox & _getLocalAABB()
+    {
+        return mLocalAABB;
+    };
+
+
+
+
+protected:
+
+    /** Internal method for updating the bounds for this OctreeNode.
+    @remarks
+    This method determines the bounds solely from the attached objects, not
+    any children. If the node has changed it's bounds, it is removed from its
+    current octree, and reinserted into the tree.
+    */
+    void _updateBounds( void );
+
+    void _removeNodeAndChildren( );
+
+    ///local bounding box
+    AxisAlignedBox mLocalAABB;
+
+    ///Octree this node is attached to.
+    Octree *mOctant;
+
+    ///preallocated corners for rendering
+    Real mCorners[ 24 ];
+    ///shared colors for rendering
+    static unsigned long mColors[ 8 ];
+    ///shared indexes for rendering
+    static unsigned short mIndexes[ 24 ];
+
+
+};
+
+}
+
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreTerrainRenderable.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreTerrainRenderable.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreTerrainRenderable.h	(revision 1812)
@@ -0,0 +1,411 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+/***************************************************************************
+terrainrenderable.h  -  description
+-------------------
+begin                : Sat Oct 5 2002
+copyright            : (C) 2002 by Jon Anderson
+email                : janders@users.sf.net
+
+Enhancements 2003 - 2004 (C) The OGRE Team
+
+***************************************************************************/
+
+#ifndef TERRAINRENDERABLE_H
+#define TERRAINRENDERABLE_H
+
+#include "OgreTerrainPrerequisites.h"
+#include <OgreRenderable.h>
+#include <OgreMovableObject.h>
+#include <OgreAxisAlignedBox.h>
+#include <OgreString.h>
+#include <OgreHardwareBufferManager.h>
+
+#include <vector>
+
+#define MORPH_CUSTOM_PARAM_ID 77
+
+namespace Ogre
+{
+
+    typedef std::map <unsigned int, IndexData* > IndexMap;
+    typedef std::vector < IndexData* > IndexArray;
+    typedef std::vector < IndexMap* > LevelArray;
+
+    /**
+    * A cache of TerrainIndexBuffers.  Used to keep track of the buffers, and
+    * delete them when the program finishes.
+    */
+    class TerrainBufferCache
+    {
+    public:
+        void shutdown(void)
+        {
+            for( size_t i=0; i<mCache.size(); i++ )
+            {
+                delete mCache[i];
+            }
+            mCache.clear();
+        }
+        ~TerrainBufferCache()
+        {
+            shutdown();
+        }
+
+        IndexArray mCache;
+    };
+
+    inline Real _max( Real x, Real y )
+    {
+        return ( x > y ) ? x : y;
+    }
+
+    /** A simple class for encapsulating parameters which are commonly needed by 
+    both TerrainSceneManager and TerrainRenderable.
+    */
+    class TerrainOptions
+    {
+    public:
+        TerrainOptions()
+        {
+            pageSize = 0;
+            tileSize = 0;
+            tilesPerPage = 0;
+            maxGeoMipMapLevel = 0;
+            scale = Vector3::UNIT_SCALE;
+            maxPixelError = 4;
+            detailTile = 1;
+            lit = false;
+            coloured = false;
+            lodMorph = false;
+            lodMorphStart = 0.5;
+            useTriStrips = false;
+            primaryCamera = 0;
+            terrainMaterial.setNull();
+        };
+        /// The size of one edge of a terrain page, in vertices
+        size_t pageSize;
+        /// The size of one edge of a terrain tile, in vertices
+        size_t tileSize; 
+        /// Precalculated number of tiles per page
+        size_t tilesPerPage;
+        /// The primary camera, used for error metric calculation and page choice
+        const Camera* primaryCamera;
+        /// The maximum terrain geo-mipmap level
+        size_t maxGeoMipMapLevel;
+        /// The scale factor to apply to the terrain (each vertex is 1 unscaled unit
+        /// away from the next, and height is from 0 to 1)
+        Vector3 scale;
+        /// The maximum pixel error allowed
+        size_t maxPixelError;
+        /// Whether we should use triangle strips
+        bool useTriStrips;
+        /// The number of times to repeat a detail texture over a tile
+        size_t detailTile;
+        /// Whether LOD morphing is enabled
+        bool lodMorph;
+        /// At what point (parametric) should LOD morphing start
+        Real lodMorphStart;
+        /// Whether dynamic lighting is enabled
+        bool lit;
+        /// Whether vertex colours are enabled
+        bool coloured;
+        /// Pointer to the material to use to render the terrain
+        MaterialPtr terrainMaterial;
+
+    };
+
+#define STITCH_NORTH_SHIFT 0
+#define STITCH_SOUTH_SHIFT 8
+#define STITCH_WEST_SHIFT  16
+#define STITCH_EAST_SHIFT  24
+
+#define STITCH_NORTH  128 << STITCH_NORTH_SHIFT
+#define STITCH_SOUTH  128 << STITCH_SOUTH_SHIFT
+#define STITCH_WEST   128 << STITCH_WEST_SHIFT
+#define STITCH_EAST   128 << STITCH_EAST_SHIFT
+
+    /**
+    Represents a terrain tile.
+    @remarks
+    A TerrainRenderable represents a tile used to render a block of terrain using the geomipmap approach
+    for LOD.
+    *@author Jon Anderson
+    */
+
+    class _OgreTerrainExport TerrainRenderable : public Renderable, public MovableObject
+    {
+    public:
+
+        TerrainRenderable(const String& name, TerrainSceneManager* tsm);
+        ~TerrainRenderable();
+
+        void deleteGeometry();
+
+        enum Neighbor
+        {
+            NORTH = 0,
+            SOUTH = 1,
+            EAST = 2,
+            WEST = 3,
+            HERE = 4
+        };
+
+        /** Initializes the TerrainRenderable.
+        @param startx, startz 
+        The starting points of the top-left of this tile, in terms of the
+        number of vertices.
+        @param pageHeightData The source height data for the entire parent page
+        */
+        void initialise(int startx, int startz, Real* pageHeightData);
+
+        //movable object methods
+
+        /** Returns the type of the movable. */
+        virtual const String& getMovableType( void ) const
+        {
+            return mType;
+        };
+
+        /** Returns the bounding box of this TerrainRenderable */
+        const AxisAlignedBox& getBoundingBox( void ) const
+        {
+            return mBounds;
+        };
+
+        /** Updates the level of detail to be used for rendering this TerrainRenderable based on the passed in Camera */
+        virtual void _notifyCurrentCamera( Camera* cam );
+
+        virtual void _updateRenderQueue( RenderQueue* queue );
+
+        /**
+        Constructs a RenderOperation to render the TerrainRenderable.
+        @remarks
+        Each TerrainRenderable has a block of vertices that represent the terrain.  Index arrays are dynamically
+        created for mipmap level, and then cached.
+        */
+        virtual void getRenderOperation( RenderOperation& rend );
+
+        virtual const MaterialPtr& getMaterial( void ) const
+        {
+            return mMaterial;
+        };
+
+        virtual void getWorldTransforms( Matrix4* xform ) const;
+
+        virtual const Quaternion& getWorldOrientation(void) const;
+        virtual const Vector3& getWorldPosition(void) const;
+
+        /** Returns the mipmap level that will be rendered for this frame. */
+        inline int getRenderLevel() const
+        {
+            return mRenderLevel;
+        };
+
+        /** Forces the LOD to the given level from this point on. */
+        inline void setForcedRenderLevel( int i )
+        {
+            mForcedRenderLevel = i;
+        }
+
+        /** Calculates the normal at the given location */
+        void _getNormalAt( float x, float y, Vector3 * result );
+
+        /** Returns the terrain height at the given coordinates */
+        float getHeightAt( float x, float y );
+
+        /** Intersects the segment witht he terrain tile
+        */
+        bool intersectSegment( const Vector3 & start, const Vector3 & end, Vector3 * result );
+
+        /** Sets the appropriate neighbor for this TerrainRenderable.  Neighbors are necessary
+        to know when to bridge between LODs.
+        */
+        void _setNeighbor( Neighbor n, TerrainRenderable *t )
+        {
+            mNeighbors[ n ] = t;
+        };
+
+        /** Returns the neighbor TerrainRenderable.
+        */
+        TerrainRenderable * _getNeighbor( Neighbor n )
+        {
+            return mNeighbors[ n ];
+        }
+
+
+        void setMaterial(const MaterialPtr& m )
+        {
+            mMaterial = m;
+        };
+
+        /** Calculates static normals for lighting the terrain. */
+        void _calculateNormals();
+
+
+
+
+        /** Generates terrain shadows and lighting using vertex colors
+        */
+        void _generateVertexLighting( const Vector3 &sunlight, ColourValue ambient );
+
+
+        /** Overridden, see Renderable */
+        Real getSquaredViewDepth(const Camera* cam) const;
+
+        /** Overridden from MovableObject */
+        Real getBoundingRadius(void) const { return mBoundingRadius; }
+
+        /** @copydoc Renderable::getLights */
+        const LightList& getLights(void) const;
+
+        /// Overridden from Renderable to allow the morph LOD entry to be set
+        void _updateCustomGpuParameter(
+            const GpuProgramParameters::AutoConstantEntry& constantEntry,
+            GpuProgramParameters* params) const;
+		/// @see MovableObject
+		uint32 getTypeFlags(void) const;
+    protected:
+		/// Parent SceneManager
+		TerrainSceneManager* mSceneManager;
+        /// Link to shared options
+        const TerrainOptions* mOptions;
+
+        /** Returns the index into the height array for the given coords. */
+        inline size_t _index( int x, int z ) const
+        {
+            return ( x + z * mOptions->tileSize );
+        };
+
+        /** Returns the  vertex coord for the given coordinates */
+        inline float _vertex( int x, int z, int n )
+        {
+            return mPositionBuffer[x * 3 + z * mOptions->tileSize * 3 + n];
+        };
+
+
+        inline int _numNeighbors() const
+        {
+            int n = 0;
+
+            for ( int i = 0; i < 4; i++ )
+            {
+                if ( mNeighbors[ i ] != 0 )
+                    n++;
+            }
+
+            return n;
+        }
+
+        inline bool _hasNeighborRenderLevel( int i ) const
+        {
+            for ( int j = 0; j < 4; j++ )
+            {
+                if ( mNeighbors[ j ] != 0 && mNeighbors[ j ] ->mRenderLevel == i )
+                    return true;
+            }
+
+            return false;
+
+        }
+
+        void _adjustRenderLevel( int i );
+
+        bool _checkSize( int n );
+
+        void _calculateMinLevelDist2( Real C );
+
+        Real _calculateCFactor();
+
+        VertexData* mTerrain;
+
+        /// The current LOD level
+        int mRenderLevel;
+        /// The previous 'next' LOD level down, for frame coherency
+        int mLastNextLevel; 
+        /// The morph factor between this and the next LOD level down
+        Real mLODMorphFactor;
+        /// List of squared distances at which LODs change
+        Real *mMinLevelDistSqr;
+        /// Connection to tiles four neighbours
+        TerrainRenderable *mNeighbors [ 4 ];
+        /// Whether light list need to re-calculate
+        mutable bool mLightListDirty;
+        /// Cached light list
+        mutable LightList mLightList;
+        /// The bounding radius of this tile
+        Real mBoundingRadius;
+        /// Bounding box of this tile
+        AxisAlignedBox mBounds;
+        /// The center point of this tile
+        Vector3 mCenter;
+        /// The MovableObject type
+        static String mType;
+        /// Current material used by this tile
+        MaterialPtr mMaterial;    
+        /// Whether this tile has been initialised    
+        bool mInit;
+        /// The buffer with all the renderable geometry in it
+        HardwareVertexBufferSharedPtr mMainBuffer;
+        /// Optional set of delta buffers, used to morph from one LOD to the next
+        HardwareVertexBufferSharedPtr* mDeltaBuffers;
+        /// System-memory buffer with just positions in it, for CPU operations
+        float* mPositionBuffer;
+        /// Forced rendering LOD level, optional
+        int mForcedRenderLevel;
+        /// Array of LOD indexes specifying which LOD is the next one down
+        /// (deals with clustered error metrics which cause LODs to be skipped)
+        int mNextLevelDown[10];
+        /// Gets the index data for this tile based on current settings
+        IndexData* getIndexData(void);
+        /// Internal method for generating stripified terrain indexes
+        IndexData* generateTriStripIndexes(unsigned int stitchFlags);
+        /// Internal method for generating triangle list terrain indexes
+        IndexData* generateTriListIndexes(unsigned int stitchFlags);
+        /** Utility method to generate stitching indexes on the edge of a tile
+        @param neighbor The neighbor direction to stitch
+        @param hiLOD The LOD of this tile
+        @param loLOD The LOD of the neighbor
+        @param omitFirstTri Whether the first tri of the stitch (always clockwise
+        relative to the centre of this tile) is to be omitted because an 
+        adjoining edge is also being stitched
+        @param omitLastTri Whether the last tri of the stitch (always clockwise
+        relative to the centre of this tile) is to be omitted because an 
+        adjoining edge is also being stitched
+        @param pIdx Pointer to a pointer to the index buffer to push the results 
+        into (this pointer will be updated)
+        @returns The number of indexes added
+        */
+        int stitchEdge(Neighbor neighbor, int hiLOD, int loLOD, 
+            bool omitFirstTri, bool omitLastTri, unsigned short** ppIdx);
+
+        /// Create a blank delta buffer for usein morphing
+        HardwareVertexBufferSharedPtr createDeltaBuffer(void);
+
+    };
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreTerrainPrerequisites.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreTerrainPrerequisites.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreTerrainPrerequisites.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __TerrainPrerequisites_H__
+#define __TerrainPrerequisites_H__
+
+#include "OgrePrerequisites.h"
+
+//-----------------------------------------------------------------------
+// Forward declarations
+//-----------------------------------------------------------------------
+
+namespace Ogre
+{
+    class TerrainSceneManager;
+    class TerrainPageSource;
+    class TerrainRenderable;
+    class TerrainPage;
+}
+//-----------------------------------------------------------------------
+// Windows Settings
+//-----------------------------------------------------------------------
+
+#if (OGRE_PLATFORM == OGRE_PLATFORM_WIN32 ) && !defined(__MINGW32__)
+#   ifdef PLUGIN_TERRAIN_EXPORTS
+#       define _OgreTerrainExport __declspec(dllexport)
+#   else
+#       define _OgreTerrainExport __declspec(dllimport)
+#   endif
+#else
+#   define _OgreTerrainExport
+#endif
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreTerrainVertexProgram.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreTerrainVertexProgram.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreTerrainVertexProgram.h	(revision 1812)
@@ -0,0 +1,222 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __TERRAINVERTEXPROGRAM_H__
+#define __TERRAINVERTEXPROGRAM_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreCommon.h"
+#include "OgreString.h"
+
+namespace Ogre {
+
+    /*
+    Static class containing the source to vertex programs used to 
+    morph the terrain LOD levels. The programs are generated from 
+    the following Cg:
+    @code 	
+    // No fog morphing terrain
+    void terrain_vp(
+	    float4 position : POSITION,
+	    float2 uv1   	: TEXCOORD0,
+	    float2 uv2	 	: TEXCOORD1,
+	    float delta     : BLENDWEIGHT,
+
+	    out float4 oPosition : POSITION,
+	    out float2 oUv1		 : TEXCOORD0,
+	    out float2 oUv2		 : TEXCOORD1,
+	    out float4 colour    : COLOR,
+	    uniform float4x4 worldViewProj,
+	    uniform float morphFactor
+	    )
+    {
+	    // Apply morph
+	    position.y = position.y + (delta.x * morphFactor);
+	    // world / view / projection
+	    oPosition = mul(worldViewProj, position);
+	    // Main texture coords
+	    oUv1 = uv1;
+	    // Detail texture coords
+	    oUv2 = uv2;
+	    // Full bright (no lighting)
+	    colour = float4(1,1,1,1);
+    }
+
+
+    // Linear fogged morphing terrain
+    void terrain_vp_linear(
+	    float4 position : POSITION,
+	    float2 uv1   	: TEXCOORD0,
+	    float2 uv2	 	: TEXCOORD1,
+	    float delta     : BLENDWEIGHT,
+
+	    out float4 oPosition : POSITION,
+	    out float2 oUv1		 : TEXCOORD0,
+	    out float2 oUv2		 : TEXCOORD1,
+	    out float4 colour    : COLOR,
+	    out float fog		 : FOG,
+	    uniform float4x4 worldViewProj,
+	    uniform float morphFactor
+	    )
+    {
+	    // Apply morph
+	    position.y = position.y + (delta.x * morphFactor);
+	    // world / view / projection
+	    oPosition = mul(worldViewProj, position);
+	    // Main texture coords
+	    oUv1 = uv1;
+	    // Detail texture coords
+	    oUv2 = uv2;
+	    // Full bright (no lighting)
+	    colour = float4(1,1,1,1);
+	    // Fog 
+	    // f = end - camz / end - start
+	    // when start / end has been set, fog value is distance
+	    fog = oPosition.z;
+    }
+
+
+    // Exp fogged morphing terrain
+    void terrain_vp_exp(
+	    float4 position : POSITION,
+	    float2 uv1   	: TEXCOORD0,
+	    float2 uv2	 	: TEXCOORD1,
+	    float delta     : BLENDWEIGHT,
+
+	    out float4 oPosition : POSITION,
+	    out float2 oUv1		 : TEXCOORD0,
+	    out float2 oUv2		 : TEXCOORD1,
+	    out float4 colour    : COLOR,
+	    out float fog		 : FOG,
+	    uniform float4x4 worldViewProj,
+	    uniform float morphFactor,
+	    uniform float fogDensity)
+    {
+	    // Apply morph
+	    position.y = position.y + (delta.x * morphFactor);
+	    // world / view / projection
+	    oPosition = mul(worldViewProj, position);
+	    // Main texture coords
+	    oUv1 = uv1;
+	    // Detail texture coords
+	    oUv2 = uv2;
+	    // Full bright (no lighting)
+	    colour = float4(1,1,1,1);
+	    // Fog 
+	    // f = 1 / e ^ (camz x density)
+	    // note pow = exp(src1 * log(src0)).
+	    fog = 1 / (exp((oPosition.z * fogDensity) * log(2.718281828)));
+    }
+
+
+    // Exp2 fogged morphing terrain
+    void terrain_vp_exp2(
+	    float4 position : POSITION,
+	    float2 uv1   	: TEXCOORD0,
+	    float2 uv2	 	: TEXCOORD1,
+	    float delta     : BLENDWEIGHT,
+
+	    out float4 oPosition : POSITION,
+	    out float2 oUv1		 : TEXCOORD0,
+	    out float2 oUv2		 : TEXCOORD1,
+	    out float4 colour    : COLOR,
+	    out float fog		 : FOG,
+	    uniform float4x4 worldViewProj,
+	    uniform float morphFactor,
+	    uniform float fogDensity)
+    {
+	    // Apply morph
+	    position.y = position.y + (delta.x * morphFactor);
+	    // world / view / projection
+	    oPosition = mul(worldViewProj, position);
+	    // Main texture coords
+	    oUv1 = uv1;
+	    // Detail texture coords
+	    oUv2 = uv2;
+	    // Full bright (no lighting)
+	    colour = float4(1,1,1,1);
+	    // Fog 
+	    // f = 1 / e ^ (camz x density)^2
+	    // note pow = exp(src1 * log(src0)).
+	    float src1 = oPosition.z * 0.002;
+	    fog = 1 / (exp((src1*src1) * log(2.718281828f)));
+    }
+
+	// Shadow receiver vertex program
+    void terrain_shadow_receiver_vp(
+	    float4 position : POSITION,
+	    float2 uv1   	: TEXCOORD0,
+	    float2 uv2	 	: TEXCOORD1,
+	    float delta     : BLENDWEIGHT,
+
+	    out float4 oPosition : POSITION,
+	    out float2 oUv1		 : TEXCOORD0,
+	    out float4 colour    : COLOR,
+	    uniform float4x4 worldViewProj,
+		uniform float4x4 world,
+	    uniform float4x4 textureViewProj,
+	    uniform float morphFactor
+	    )
+    {
+	    // Apply morph
+	    position.y = position.y + (delta.x * morphFactor);
+	    // world / view / projection
+	    oPosition = mul(worldViewProj, position);
+		
+	    // Main texture coords
+		float4 worldpos = mul(world, position);
+	    float4 projuv = mul(textureViewProj, worldpos);
+		oUv1.xy = projuv.xy / projuv.w;
+	    // Full bright (no lighting)
+	    colour = float4(1,1,1,1);
+    }
+
+    @endcode
+    */
+    class TerrainVertexProgram
+    {
+    private:
+        static String mNoFogArbvp1;
+        static String mLinearFogArbvp1;
+        static String mExpFogArbvp1;
+        static String mExp2FogArbvp1;
+		static String mShadowReceiverArbvp1;
+
+        static String mNoFogVs_1_1;
+        static String mLinearFogVs_1_1;
+        static String mExpFogVs_1_1;
+        static String mExp2FogVs_1_1;
+		static String mShadowReceiverVs_1_1;
+
+    public:
+        /// General purpose method to get any of the program sources
+        static const String& getProgramSource(FogMode fogMode, 
+			const String syntax, bool shadowReceiver = false);
+
+
+    };
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreBspNode.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreBspNode.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreBspNode.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _BspNode_H__
+#define _BspNode_H__
+
+#include "OgreBspPrerequisites.h"
+#include "OgrePlane.h"
+#include "OgreAxisAlignedBox.h"
+#include "OgreSceneQuery.h"
+
+namespace Ogre {
+
+    /** Encapsulates a node in a BSP tree.
+        A BSP tree represents space partitioned by planes . The space which is
+        partitioned is either the world (in the case of the root node) or the space derived
+        from their parent node. Each node can have elements which are in front or behind it, which are
+        it's children and these elements can either be further subdivided by planes,
+        or they can be undivided spaces or 'leaf nodes' - these are the nodes which actually contain
+        objects and world geometry.The leaves of the tree are the stopping point of any tree walking algorithm,
+        both for rendering and collision detection etc.</p>
+        Ogre chooses not to represent splitting nodes and leaves as separate structures, but to merge the two for simplicity
+        of the walking algorithm. If a node is a leaf, the isLeaf() method returns true and both getFront() and
+        getBack() return null pointers. If the node is a partitioning plane isLeaf() returns false and getFront()
+        and getBack() will return the corresponding BspNode objects.
+    */
+    class BspNode
+    {
+        friend class BspLevel;
+
+    public:
+        /** Constructor, only to be used by BspLevel. */
+        BspNode(BspLevel* owner, bool isLeaf);
+
+        BspNode();
+        ~BspNode();
+
+        /** Returns true if this node is a leaf (i.e. contains geometry) or false if it is a splitting plane.
+            A BspNode can either be a splitting plane (the typical representation of a BSP node) or an undivided
+            region contining geometry (a leaf node). Ogre represents both using the same class for simplicity
+            of tree walking. However it is important that you use this method to determine which type you are dealing
+            with, since certain methods are only supported with one of the subtypes. Details are given in the individual methods.
+            Note that I could have represented splitting / leaf nodes as a class hierarchy but the
+            virtual methods / run-time type identification would have a performance hit, and it would not make the
+            code much (any?) simpler anyway. I think this is a fair trade-off in this case.
+        */
+        bool isLeaf(void) const;
+
+        /** Returns a pointer to a BspNode containing the subspace on the positive side of the splitting plane.
+            This method should only be called on a splitting node, i.e. where isLeaf() returns false. Calling this
+            method on a leaf node will throw an exception.
+        */
+        BspNode* getFront(void) const;
+
+        /** Returns a pointer to a BspNode containing the subspace on the negative side of the splitting plane.
+            This method should only be called on a splitting node, i.e. where isLeaf() returns false. Calling this
+            method on a leaf node will throw an exception.
+        */
+        BspNode* getBack(void) const;
+
+        /** Determines which side of the splitting plane a worldspace point is.
+            This method should only be called on a splitting node, i.e. where isLeaf() returns false. Calling this
+            method on a leaf node will throw an exception.
+        */
+        Plane::Side getSide (const Vector3& point) const;
+
+        /** Gets the next node down in the tree, with the intention of
+            locating the leaf containing the given point.
+            This method should only be called on a splitting node, i.e. where isLeaf() returns false. Calling this
+            method on a leaf node will throw an exception.
+        */
+        BspNode* getNextNode(const Vector3& point) const;
+
+
+        /** Returns details of the plane which is used to subdivide the space of his node's children.
+            This method should only be called on a splitting node, i.e. where isLeaf() returns false. Calling this
+            method on a leaf node will throw an exception.
+        */
+        const Plane& getSplitPlane(void) const;
+
+        /** Returns the axis-aligned box which contains this node if it is a leaf.
+            This method should only be called on a leaf node. It returns a box which can be used in calls like
+            Camera::isVisible to determine if the leaf node is visible in the view.
+        */
+        const AxisAlignedBox& getBoundingBox(void) const;
+
+        /** Returns the number of faces contained in this leaf node.
+            Should only be called on a leaf node.
+        */
+        int getNumFaceGroups(void) const;
+        /** Returns the index to the face group index list for this leaf node.
+            The contents of this buffer is a list of indexes which point to the
+            actual face groups held in a central buffer in the BspLevel class (in
+            actual fact for efficency the indexes themselves are also held in a single
+            buffer in BspLevel too). The reason for this indirection is that the buffer
+            of indexes to face groups is organised in chunks relative to nodes, whilst the
+            main buffer of face groups may not be.
+            Should only be called on a leaf node.
+        */
+        int getFaceGroupStart(void) const;
+
+        /** Determines if the passed in node (must also be a leaf) is visible from this leaf.
+            Must only be called on a leaf node, and the parameter must also be a leaf node. If
+            this method returns true, then the leaf passed in is visible from this leaf.
+            Note that internally this uses the Potentially Visible Set (PVS) which is precalculated
+            and stored with the BSP level.
+        */
+        bool isLeafVisible(const BspNode* leaf) const;
+
+        friend std::ostream& operator<< (std::ostream& o, BspNode& n);
+
+        /// Internal method for telling the node that a movable intersects it
+        void _addMovable(const MovableObject* mov);
+
+        /// Internal method for telling the node that a movable no longer intersects it
+        void _removeMovable(const MovableObject* mov);
+
+        /// Gets the signed distance to the dividing plane
+        Real getDistance(const Vector3& pos) const;
+
+        typedef std::set<const MovableObject*> IntersectingObjectSet;
+
+        struct Brush
+        {
+            std::list<Plane> planes;
+            SceneQuery::WorldFragment fragment; // For query reporting
+        };
+        typedef std::vector<Brush*> NodeBrushList; // Main brush memory held on level
+
+        /** Get the list of solid Brushes for this node.
+        @remarks Only applicable for leaf nodes. 
+        */
+        const NodeBrushList& getSolidBrushes(void) const;
+    protected:
+        BspLevel* mOwner; // Back-reference to containing level
+        bool mIsLeaf;
+
+        // Node-only members
+        /** The plane which splits space in a non-leaf node.
+            Note that nodes do not allocate the memory for other nodes - for simplicity and bulk-allocation
+            of memory the BspLevel is responsible for assigning enough memory for all nodes in one go.
+        */
+        Plane mSplitPlane;
+        /** Pointer to the node in front of this non-leaf node. */
+        BspNode* mFront;
+        /** Pointer to the node behind this non-leaf node. */
+        BspNode* mBack;
+
+        // Leaf-only members
+        /** The cluster number of this leaf.
+            Leaf nodes are assigned to 'clusters' of nodes, which are used to group nodes together for
+            visibility testing. There is a lookup table which is used to determine if one cluster of leaves
+            is visible from another cluster. Whilst it would be possible to expand all this out so that
+            each node had a list of pointers to other visible nodes, this would be very expensive in terms
+            of storage (using the cluster method there is a table which is 1-bit squared per cluster, rounded
+            up to the nearest byte obviously, which uses far less space than 4-bytes per linked node per source
+            node). Of course the limitation here is that you have to each leaf in turn to determine if it is visible
+            rather than just following a list, but since this is only done once per frame this is not such a big
+            overhead.
+        */
+        int mVisCluster;
+
+        /** The axis-aligned box which bounds node if it is a leaf. */
+        AxisAlignedBox mBounds;
+        /** Number of face groups in this node if it is a leaf. */
+        int mNumFaceGroups;
+        /** Index to the part of the main leaf facegroup index buffer(held in BspLevel) for this leaf.
+            This leaf uses mNumFaceGroups from this pointer onwards. From here you use the index
+            in this buffer to look up the actual face.
+            Note that again for simplicity and bulk memory allocation the face
+            group list itself is allocated by the BspLevel for all nodes, and each leaf node is given a section of it to
+            work on. This saves lots of small memory allocations / deallocations which limits memory fragmentation.
+        */
+        int mFaceGroupStart;
+
+        IntersectingObjectSet mMovables;
+
+        NodeBrushList mSolidBrushes;
+    public:
+        const IntersectingObjectSet& getObjects(void) const { return mMovables; }
+
+
+    };
+
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreOctreeCamera.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreOctreeCamera.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreOctreeCamera.h	(revision 1812)
@@ -0,0 +1,85 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+/***************************************************************************
+octreecamera.h  -  description
+-------------------
+begin                : Fri Sep 27 2002
+copyright            : (C) 2002 by Jon Anderson
+email                : janders@users.sf.net
+
+Enhancements 2003 - 2004 (C) The OGRE Team
+***************************************************************************/
+
+#ifndef OCTREECAMERA_H
+#define OCTREECAMERA_H
+
+#include <OgreCamera.h>
+#include <OgreHardwareBufferManager.h>
+#include <OgreSimpleRenderable.h>
+
+/**
+*@author Jon Anderson
+*/
+
+namespace Ogre
+{
+
+class Octree;
+
+
+/** Specialized viewpoint from which an Octree can be rendered.
+@remarks
+This class contains several speciliazations of the Ogre::Camera class. It
+implements the getRenderOperation method inorder to return displayable geometry
+for debuggin purposes. It also implements a visibility function that is more granular
+than the default.
+*/
+
+class OctreeCamera : public Camera
+{
+public:
+
+    /** Visibility types */
+    enum Visibility
+    {
+        NONE,
+        PARTIAL,
+        FULL
+    };
+
+    /* Standard Constructor */
+    OctreeCamera( const String& name, SceneManager* sm );
+    /* Standard destructor */
+    ~OctreeCamera();
+
+    /** Returns the visiblity of the box
+    */
+    OctreeCamera::Visibility getVisibility( const AxisAlignedBox &bound );
+
+};
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreOctreeSceneManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreOctreeSceneManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreOctreeSceneManager.h	(revision 1812)
@@ -0,0 +1,261 @@
+/***************************************************************************
+octreescenemanager.h  -  description
+-------------------
+begin                : Fri Sep 27 2002
+copyright            : (C) 2002 by Jon Anderson
+email                : janders@users.sf.net
+***************************************************************************/
+
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef OCTREESCENEMANAGER_H
+#define OCTREESCENEMANAGER_H
+
+#include "OgreSceneManager.h"
+#include "OgreRenderOperation.h"
+#include "OgreSphere.h"
+
+#include <list>
+#include <algorithm>
+
+#include <OgreOctree.h>
+
+
+namespace Ogre
+{
+
+class OctreeNode;
+
+class OctreeCamera;
+class OctreeIntersectionSceneQuery;
+class OctreeRaySceneQuery;
+class OctreeSphereSceneQuery;
+class OctreeAxisAlignedBoxSceneQuery;
+class OctreePlaneBoundedVolumeListSceneQuery;
+
+
+typedef std::list < WireBoundingBox * > BoxList;
+typedef std::list < unsigned long > ColorList;
+//typedef std::list < SceneNode * > SceneNodeList;
+
+
+/** Specialized SceneManager that divides the geometry into an octree in order to faciliate spatial queries.
+@remarks
+For debugging purposes, a special "CullCamera" can be defined.  To use it, call setUseCallCamera( true ),
+and create a camera named "CullCamera".  All culling will be performed using that camera, instead of the viewport
+camera, allowing you to fly around and examine culling.
+*/
+
+class OctreeSceneManager : public SceneManager
+{
+    friend class OctreeIntersectionSceneQuery;
+    friend class OctreeRaySceneQuery;
+    friend class OctreeSphereSceneQuery;
+    friend class OctreeAxisAlignedBoxSceneQuery;
+    friend class OctreePlaneBoundedVolumeListSceneQuery;
+
+public:
+    static int intersect_call;
+    /** Standard Constructor.  Initializes the octree to -500,-500,-500 to 500,500,500 with unlimited depth. */
+    OctreeSceneManager(const String& name);
+    /** Standard Constructor */
+    OctreeSceneManager(const String& name, AxisAlignedBox &box, int max_depth );
+    /** Standard desctructor */
+    ~OctreeSceneManager();
+
+	/// @copydoc SceneManager::getTypeName
+	const String& getTypeName(void) const;
+
+    /** Initializeds the manager to the given box and depth.
+    */
+    void init( AxisAlignedBox &box, int d );
+
+    /** Creates a specialized OctreeNode */
+    virtual	SceneNode * createSceneNode ( void );
+    /** Creates a specialized OctreeNode */
+    virtual SceneNode * createSceneNode ( const String &name );
+    /** Creates a specialized OctreeCamera */
+    virtual Camera * createCamera( const String &name );
+
+    /** Deletes a scene node */
+    virtual void destroySceneNode( const String &name );
+
+
+
+    /** Does nothing more */
+    virtual void _updateSceneGraph( Camera * cam );
+    /** Recurses through the octree determining which nodes are visible. */
+    virtual void _findVisibleObjects ( Camera * cam, bool onlyShadowCasters );
+
+    /** Alerts each unculled object, notifying it that it will be drawn.
+     * Useful for doing calculations only on nodes that will be drawn, prior
+     * to drawing them...
+     */
+    virtual void _alertVisibleObjects( void );
+
+    /** Walks through the octree, adding any visible objects to the render queue.
+    @remarks
+    If any octant in the octree if completely within the the view frustum,
+    all subchildren are automatically added with no visibility tests.
+    */
+    void walkOctree( OctreeCamera *, RenderQueue *, Octree *, bool foundvisible,
+                     bool onlyShadowCasters);
+
+    /** Checks the given OctreeNode, and determines if it needs to be moved
+    * to a different octant.
+    */
+    void _updateOctreeNode( OctreeNode * );
+    /** Removes the given octree node */
+    void _removeOctreeNode( OctreeNode * );
+    /** Adds the Octree Node, starting at the given octree, and recursing at max to the specified depth.
+    */
+    void _addOctreeNode( OctreeNode *, Octree *octree, int depth = 0 );
+
+    /** Recurses the octree, adding any nodes intersecting with the box into the given list.
+    It ignores the exclude scene node.
+    */
+    void findNodesIn( const AxisAlignedBox &box, std::list < SceneNode * > &list, SceneNode *exclude = 0 );
+
+    /** Recurses the octree, adding any nodes intersecting with the sphere into the given list.
+    It ignores the exclude scene node.
+    */
+    void findNodesIn( const Sphere &sphere, std::list < SceneNode * > &list, SceneNode *exclude = 0 );
+
+    /** Recurses the octree, adding any nodes intersecting with the volume into the given list.
+      It ignores the exclude scene node.
+      */
+    void findNodesIn( const PlaneBoundedVolume &volume, std::list < SceneNode * > &list, SceneNode *exclude=0 );
+
+    /** Recurses the octree, adding any nodes intersecting with the ray into the given list.
+      It ignores the exclude scene node.
+      */
+    void findNodesIn( const Ray &ray, std::list < SceneNode * > &list, SceneNode *exclude=0 );
+
+    /** Sets the box visibility flag */
+    void setShowBoxes( bool b )
+    {
+        mShowBoxes = b;
+    };
+
+    /** Sets the cull camera flag */
+    void setUseCullCamera( bool b )
+    {
+        mCullCamera = b;
+    };
+
+    void setLooseOctree( bool b )
+    {
+        mLoose = b;
+    };
+
+
+    /** Resizes the octree to the given size */
+    void resize( const AxisAlignedBox &box );
+
+    /** Sets the given option for the SceneManager
+               @remarks
+        Options are:
+        "Size", AxisAlignedBox *;
+        "CullCamera", bool *;
+        "Depth", int *;
+        "ShowOctree", bool *;
+    */
+
+    virtual bool setOption( const String &, const void * );
+    /** Gets the given option for the Scene Manager.
+        @remarks
+        See setOption
+    */
+    virtual bool getOption( const String &, void * );
+
+    bool getOptionValues( const String & key, StringVector &refValueList );
+    bool getOptionKeys( StringVector &refKeys );
+    /** Overridden from SceneManager */
+    void clearScene(void);
+
+    AxisAlignedBoxSceneQuery* createAABBQuery(const AxisAlignedBox& box, unsigned long mask);
+    SphereSceneQuery* createSphereQuery(const Sphere& sphere, unsigned long mask);
+    PlaneBoundedVolumeListSceneQuery* createPlaneBoundedVolumeQuery(const PlaneBoundedVolumeList& volumes, unsigned long mask);
+    RaySceneQuery* createRayQuery(const Ray& ray, unsigned long mask);
+    IntersectionSceneQuery* createIntersectionQuery(unsigned long mask);
+
+
+protected:
+
+
+    NodeList mVisible;
+
+    /// The root octree
+    Octree *mOctree;
+
+    /// list of boxes to be rendered
+    BoxList mBoxes;
+
+    /// number of rendered objs
+    int mNumObjects;
+
+    /// max depth for the tree.
+    int mMaxDepth;
+    /// Size of the octree
+    AxisAlignedBox mBox;
+
+    /// box visibility flag
+    bool mShowBoxes;
+
+    /// cull camera flag
+    bool mCullCamera;
+
+
+    bool mLoose;
+
+    Real mCorners[ 24 ];
+    static unsigned long mColors[ 8 ];
+    static unsigned short mIndexes[ 24 ];
+
+    Matrix4 mScaleFactor;
+
+};
+
+/// Factory for OctreeSceneManager
+class OctreeSceneManagerFactory : public SceneManagerFactory
+{
+protected:
+	void initMetaData(void) const;
+public:
+	OctreeSceneManagerFactory() {}
+	~OctreeSceneManagerFactory() {}
+	/// Factory type name
+	static const String FACTORY_TYPE_NAME;
+	SceneManager* createInstance(const String& instanceName);
+	void destroyInstance(SceneManager* instance);
+};
+
+
+
+}
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreBspSceneManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreBspSceneManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreBspSceneManager.h	(revision 1812)
@@ -0,0 +1,276 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://ogre.sourceforge.net/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __BspSceneManager_H__
+#define __BspSceneManager_H__
+
+
+#include "OgreBspPrerequisites.h"
+#include "OgreSceneManager.h"
+#include "OgreStaticFaceGroup.h"
+#include "OgreRenderOperation.h"
+#include "OgreBspLevel.h"
+#include <set>
+
+
+namespace Ogre {
+
+
+    /** Specialisation of the SceneManager class to deal with indoor scenes
+        based on a BSP tree.
+        This class refines the behaviour of the default SceneManager to manage
+        a scene whose bulk of geometry is made up of an indoor environment which
+        is organised by a Binary Space Partition (BSP) tree. </p>
+        A BSP tree progressively subdivides the space using planes which are the nodes of the tree.
+        At some point we stop subdividing and everything in the remaining space is part of a 'leaf' which
+        contains a number of polygons. Typically we traverse the tree to locate the leaf in which a
+        point in space is (say the camera origin) and work from there. A second structure, the
+        Potentially Visible Set, tells us which other leaves can been seen from this
+        leaf, and we test their bounding boxes against the camera frustum to see which
+        we need to draw. Leaves are also a good place to start for collision detection since
+        they divide the level into discrete areas for testing.</p>
+        This BSP and PVS technique has been made famous by engines such as Quake and Unreal. Ogre
+        provides support for loading Quake3 level files to populate your world through this class,
+        by calling the BspSceneManager::setWorldGeometry. Note that this interface is made
+        available at the top level of the SceneManager class so you don't have to write your code
+        specifically for this class - just call Root::getSceneManager passing a SceneType of ST_INTERIOR
+        and in the current implementation you will get a BspSceneManager silently disguised as a
+        standard SceneManager.
+    */
+    class BspSceneManager : public SceneManager
+    {
+    protected:
+
+        // World geometry
+        BspLevelPtr mLevel;
+
+        // State variables for rendering WIP
+        // Set of face groups (by index) already included
+        typedef std::set<int> FaceGroupSet;
+        FaceGroupSet mFaceGroupSet;
+        // Material -> face group hashmap
+        typedef std::map<Material*, std::vector<StaticFaceGroup*>, materialLess > MaterialFaceGroupMap;
+        MaterialFaceGroupMap mMatFaceGroupMap;
+
+        RenderOperation mRenderOp;
+
+        // Debugging features
+        bool mShowNodeAABs;
+        RenderOperation mAABGeometry;
+
+        /** Walks the BSP tree looking for the node which the camera
+            is in, and tags any geometry which is in a visible leaf for
+            later processing.
+            @param camera Pointer to the viewpoint.
+            @returns The BSP node the camera was found in, for info.
+        */
+        BspNode* walkTree(Camera* camera, bool onlyShadowCasters);
+        /** Tags geometry in the leaf specified for later rendering. */
+        void processVisibleLeaf(BspNode* leaf, Camera* cam, bool onlyShadowCasters);
+
+        /** Caches a face group for imminent rendering. */
+        unsigned int cacheGeometry(unsigned int* pIndexes, const StaticFaceGroup* faceGroup);
+
+        /** Frees up allocated memory for geometry caches. */
+        void freeMemory(void);
+
+        /** Adds a bounding box to draw if turned on. */
+        void addBoundingBox(const AxisAlignedBox& aab, bool visible);
+
+        /** Renders the static level geometry tagged in walkTree. */
+        void renderStaticGeometry(void);
+
+		/** @copydoc SceneManager::clearScene */
+		void clearScene(void);
+
+
+        typedef std::set<const MovableObject*> MovablesForRendering;
+        MovablesForRendering mMovablesForRendering;
+
+    public:
+        BspSceneManager(const String& name);
+        ~BspSceneManager();
+
+
+		/// @copydoc SceneManager::getTypeName
+		const String& getTypeName(void) const;
+
+        /** Specialised from SceneManager to support Quake3 bsp files. */
+        void setWorldGeometry(const String& filename);
+
+        /** Specialised from SceneManager to support Quake3 bsp files. */
+        size_t estimateWorldGeometry(const String& filename);
+        
+        /** Specialised from SceneManager to support Quake3 bsp files. */
+        void setWorldGeometry(DataStreamPtr& stream, 
+			const String& typeName = StringUtil::BLANK);
+
+        /** Specialised from SceneManager to support Quake3 bsp files. */
+        size_t estimateWorldGeometry(DataStreamPtr& stream, 
+			const String& typeName = StringUtil::BLANK);
+
+		/** Tells the manager whether to draw the axis-aligned boxes that surround
+            nodes in the Bsp tree. For debugging purposes.
+        */
+        void showNodeBoxes(bool show);
+
+        /** Specialised to suggest viewpoints. */
+        ViewPoint getSuggestedViewpoint(bool random = false);
+
+        const BspLevelPtr& getLevel(void) {return mLevel; }
+
+        /** Overriden from SceneManager. */
+        void _findVisibleObjects(Camera* cam, bool onlyShadowCasters);
+
+        /** Overriden from SceneManager. */
+        void _renderVisibleObjects(void);
+
+        /** Creates a specialized BspSceneNode */
+        SceneNode * createSceneNode ( void );
+        /** Creates a specialized BspSceneNode */
+        SceneNode * createSceneNode ( const String &name );
+
+        /** Internal method for tagging BspNodes with objects which intersect them. */
+        void _notifyObjectMoved(const MovableObject* mov, const Vector3& pos);
+		/** Internal method for notifying the level that an object has been detached from a node */
+		void _notifyObjectDetached(const MovableObject* mov);
+
+        /** 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, unsigned long 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, unsigned long 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, 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(unsigned long mask = 0xFFFFFFFF);
+
+    };
+
+    /** BSP specialisation of IntersectionSceneQuery */
+    class BspIntersectionSceneQuery : public DefaultIntersectionSceneQuery
+    {
+    public:
+        BspIntersectionSceneQuery(SceneManager* creator);
+
+        /** See IntersectionSceneQuery. */
+        void execute(IntersectionSceneQueryListener* listener);
+
+    };
+
+    /** BSP specialisation of RaySceneQuery */
+    class BspRaySceneQuery : public DefaultRaySceneQuery
+    {
+    public:
+        BspRaySceneQuery(SceneManager* creator);
+        ~BspRaySceneQuery();
+
+        /** See RaySceneQuery. */
+        void execute(RaySceneQueryListener* listener);
+    protected:
+        /// Set for eliminating duplicates since objects can be in > 1 node
+        std::set<MovableObject*> mObjsThisQuery;
+        /// list of the last single intersection world fragments (derived)
+        std::vector<SceneQuery::WorldFragment*> mSingleIntersections;
+
+        void clearTemporaries(void);
+        /** Internal processing of a single node.
+        @returns true if we should continue tracing, false otherwise
+        */
+        bool processNode(const BspNode* node, const Ray& tracingRay, RaySceneQueryListener* listener,
+            Real maxDistance = Math::POS_INFINITY, Real traceDistance = 0.0f);
+        /** Internal processing of a single leaf.
+        @returns true if we should continue tracing, false otherwise
+        */
+        bool processLeaf(const BspNode* node, const Ray& tracingRay, RaySceneQueryListener* listener,
+            Real maxDistance = Math::POS_INFINITY, Real traceDistance = 0.0f);
+
+    };
+
+	/// Factory for BspSceneManager
+	class BspSceneManagerFactory : public SceneManagerFactory
+	{
+	protected:
+		void initMetaData(void) const;
+	public:
+		BspSceneManagerFactory() {}
+		~BspSceneManagerFactory() {}
+		/// Factory type name
+		static const String FACTORY_TYPE_NAME;
+		SceneManager* createInstance(const String& instanceName);
+		void destroyInstance(SceneManager* instance);
+	};
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreTerrainPage.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreTerrainPage.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreTerrainPage.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __TerrainPage_H__
+#define __TerrainPage_H__
+
+#include "OgreTerrainPrerequisites.h"
+#include "OgreRenderQueue.h"
+
+namespace Ogre {
+
+    /** Groups a number of TerrainRenderables (tiles) into a page, which is
+        the unit of loading / unloading.
+    @remarks
+        Note that this class, whilst holding onto TerrainRenderable instances, 
+        does not actually process or initialise them itself - this is 
+        intentional so the TerrainPageSource which is providing the tiles
+        is able to load and prepare each renderable incrementally if required, 
+        thus avoiding any 'single hit' load methods for the page.
+    @par
+        All this class does do is pre-create a 2D vector of 'slots' in which 
+        to place the TerrainRenderable pointers, which it does on 
+        construction. Note that this structure is public to allow completely
+        free access to users of this class.
+    */
+    class _OgreTerrainExport TerrainPage
+    {
+    public:
+        typedef std::vector < TerrainRenderable * > TerrainRow;
+        typedef std::vector < TerrainRow > Terrain2D;
+        
+        /// 2-dimensional vector of tiles, pre-allocated to the correct size
+        Terrain2D tiles;
+        /// The number of tiles across a page
+        unsigned short tilesPerPage;
+        /// The scene node to which all the tiles for this page are attached
+        SceneNode* pageSceneNode;
+
+        /** The main constructor. 
+        @param numTiles The number of terrain tiles (TerrainRenderable)
+            across (and down) a page
+        */
+        TerrainPage(unsigned short numTiles);
+
+        /** Destructor, will organise the deletion of pages
+        */
+        virtual ~TerrainPage();
+        /** After TerrainRenderables have been populated, this method
+            adds the neighbour links. 
+        @remarks
+            Should be called before adding the page to the scene manager.
+        */
+        void linkNeighbours(void);
+
+        /** Returns the TerrainRenderable that contains the given pt.
+        If no tile exists at the point, it returns 0;
+        */
+        TerrainRenderable * getTerrainTile( const Vector3 & pt );
+
+		/** Sets the render queue group which the tiles should be rendered in. */
+		void setRenderQueue(uint8 qid);
+
+
+    };
+
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreBspSceneNode.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreBspSceneNode.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreBspSceneNode.h	(revision 1812)
@@ -0,0 +1,76 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __BSPSCENENODE_H__
+#define __BSPSCENENODE_H__
+
+#include "OgreBspPrerequisites.h"
+#include "OgreSceneNode.h"
+
+namespace Ogre {
+
+    /** Specialisation of SceneNode for the BspSceneManager.
+    @remarks
+        This specialisation of SceneNode is to enable information about the
+        leaf node in which any attached objects are held is stored for
+        use in the visibility determination. 
+    @par
+        Do not confuse this class with BspNode, which reflects nodes in the
+        BSP tree itself. This class is just like a regular SceneNode, except that
+        it should be locating BspNode leaf elements which objects should be included
+        in. Note that because objects are movable, and thus may very well be overlapping
+        the boundaries of more than one leaf, that it is possible that an object attached
+        to one BspSceneNode may actually be associated with more than one BspNode.
+    */
+    class BspSceneNode : public SceneNode
+    {
+	protected:
+		/// Overridden from SceneNode
+		void setInSceneGraph(bool inGraph);		
+    public:
+        BspSceneNode(SceneManager* creator) : SceneNode(creator) {}
+        BspSceneNode(SceneManager* creator, const String& name) 
+            : SceneNode(creator, name) {}
+        /// Overridden from Node
+        void _update(bool updateChildren, bool parentHasChanged);
+        /** 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.
+        */
+        MovableObject* detachObject(unsigned short index);
+
+        /** Detaches the named object from this node and returns a pointer to it. */
+        MovableObject* detachObject(const String& name);
+
+        /** Detaches all objects attached to this node.
+        */
+        void detachAllObjects(void);
+
+
+    };
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreHeightmapTerrainPageSource.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreHeightmapTerrainPageSource.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreHeightmapTerrainPageSource.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __HeightmapTerrainPageSource_H__
+#define __HeightmapTerrainPageSource_H__
+
+#include "OgreTerrainPrerequisites.h"
+#include "OgreTerrainPageSource.h"
+#include "OgreImage.h"
+
+namespace Ogre {
+
+    /** Specialisation of the TerrainPageSource class to provide tiles loaded
+        from a 2D greyscale image.
+    @remarks
+        This is a simple tile provider that does not support paging; it is
+        assumed that the entire heightmap is loaded as one page.
+    */
+    class _OgreTerrainExport HeightmapTerrainPageSource : public TerrainPageSource
+    {
+    protected:
+        /// Is this input RAW?
+        bool mIsRaw;
+        /// Should we flip terrain vertically?
+        bool mFlipTerrain;
+        /// Image containing the source heightmap if loaded from non-RAW
+        Image mImage;
+        /// Arbitrary data loaded from RAW
+        MemoryDataStreamPtr mRawData;
+        /// The (single) terrain page this source will provide
+        TerrainPage* mPage;
+        /// Source file name
+        String mSource;
+        /// Manual size if source is RAW
+        size_t mRawSize;
+        /// Manual bpp if source is RAW
+        uchar mRawBpp;
+        
+        /// Load a heightmap
+        void loadHeightmap(void);
+    public:
+        HeightmapTerrainPageSource();
+        ~HeightmapTerrainPageSource();
+        /// @see TerrainPageSource
+        void shutdown(void);
+        /// @see TerrainPageSource
+        void requestPage(ushort x, ushort y);
+        /// @see TerrainPageSource
+        void expirePage(ushort x, ushort y);
+        /// @see TerrainPageSource
+        void initialise(TerrainSceneManager* tsm, 
+            ushort tileSize, ushort pageSize, bool asyncLoading, 
+            TerrainPageSourceOptionList& optionList);
+    };
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreBspPrerequisites.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreBspPrerequisites.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreBspPrerequisites.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __BspPrerequisites_H__
+#define __BspPrerequisites_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+    // Predeclare classes
+
+    class BspLevel;
+    class BspNode;
+    class BspResourceManager;
+    class BspSceneManager;
+    class Quake3Level;
+    class Quake3ShaderManager;
+    class Quake3Shader;
+
+
+}
+
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreQuake3ShaderManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreQuake3ShaderManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/opt/OgreQuake3ShaderManager.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __QUAKE3SHADERMANAGER_H__
+#define __QUAKE3SHADERMANAGER_H__
+
+#include "OgreBspPrerequisites.h"
+#include "OgreSingleton.h"
+#include "OgreResourceManager.h"
+#include "OgreQuake3Shader.h"
+#include "OgreBlendMode.h"
+
+namespace Ogre {
+
+
+    /** Class for managing Quake3 custom shaders.
+        Quake3 uses .shader files to define custom shaders, or Materials in Ogre-speak.
+        When a surface texture is mentioned in a level file, it includes no file extension
+        meaning that it can either be a standard texture image (+lightmap) if there is only a .jpg or .tga
+        file, or it may refer to a custom shader if a shader with that name is included in one of the .shader
+        files in the scripts/ folder. Because there are multiple shaders per file you have to parse all the
+        .shader files available to know if there is a custom shader available. This class is designed to parse
+        all the .shader files available and save their settings for future use. </p>
+        I choose not to set up Material instances for shaders found since they may or may not be used by a level,
+        so it would be very wasteful to set up Materials since they load texture images for each layer (apart from the
+        lightmap). Once the usage of a shader is confirmed, a full Material instance can be set up from it.</p>
+        Because this is a subclass of ScriptLoader, any files mentioned will be searched for in any path or
+        archive added to the ResourceGroupManager::WORLD_GROUP_NAME group. See ResourceGroupManager for details.
+    */
+    class Quake3ShaderManager : public ScriptLoader, public Singleton<Quake3ShaderManager>
+    {
+    protected:
+        void parseNewShaderPass(DataStreamPtr& stream, Quake3Shader* pShader);
+        void parseShaderAttrib( const String& line, Quake3Shader* pShader);
+        void parseShaderPassAttrib( const String& line, Quake3Shader* pShader, Quake3Shader::Pass* pPass);
+        SceneBlendFactor convertBlendFunc( const String& q3func);
+
+        typedef std::map<String, Quake3Shader*> Quake3ShaderMap;
+        Quake3ShaderMap mShaderMap;
+        StringVector mScriptPatterns;
+
+
+    public:
+        Quake3ShaderManager();
+        virtual ~Quake3ShaderManager();
+
+        /** @copydoc ScriptLoader::getScriptPatterns */
+        const StringVector& getScriptPatterns(void) const;
+
+        /** @copydoc ScriptLoader::parseScript */
+        void parseScript(DataStreamPtr& stream, const String& groupName);
+
+        /** @copydoc ScriptLoader::parseScript */
+        Real getLoadingOrder(void) const;
+
+        /** Create implementation. */
+        Quake3Shader* create(const String& name);
+        /** Clear all the current shaders */
+        void clear(void);
+        /** Retrieve a Quake3Shader by name */
+        Quake3Shader* getByName(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 Quake3ShaderManager& 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 Quake3ShaderManager* getSingletonPtr(void);
+
+
+    };
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreVertexIndexData.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreVertexIndexData.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreVertexIndexData.h	(revision 1812)
@@ -0,0 +1,261 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __VertexIndexData_H__
+#define __VertexIndexData_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreHardwareVertexBuffer.h"
+#include "OgreHardwareIndexBuffer.h"
+
+namespace Ogre {
+	
+	/// Define a list of usage flags
+	typedef std::vector<HardwareBuffer::Usage> BufferUsageList;
+
+
+	/** Summary class collecting together vertex source information. */
+	class _OgreExport VertexData
+	{
+    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 */
+    public:
+        VertexData();
+        ~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;
+		/// 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
+		{
+			const VertexElement* targetVertexElement;
+			Real parametric;
+		};
+		typedef std::vector<HardwareAnimationData> 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.
+		@remarks The caller is expected to delete the returned pointer when ready
+		*/
+		VertexData* clone(bool copyData = true) 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 contruction, 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 becuase 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 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 bufferUsages 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.
+		*/
+		void reorganiseBuffers(VertexDeclaration* newDeclaration, const BufferUsageList& bufferUsage);
+
+		/** 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.
+		*/
+		void reorganiseBuffers(VertexDeclaration* newDeclaration);
+
+		/** 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.
+		*/
+		void allocateHardwareAnimationElements(ushort count);
+
+
+
+	};
+
+	/** Summary class collecting together index data source information. */
+	class _OgreExport IndexData 
+	{
+    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.
+		@remarks The caller is expected to delete the returned pointer when finished
+		*/
+		IndexData* clone(bool copyData = true) 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:
+			enum CacheType {
+				FIFO, LRU
+			};
+
+			VertexCacheProfiler(unsigned int cachesize = 16, CacheType cachetype = FIFO )
+				: size ( cachesize ), type ( cachetype ), tail (0), buffersize (0), hit (0), miss (0)
+			{
+				cache = new uint32[size];
+			};
+
+			~VertexCacheProfiler()
+			{
+				delete[] cache;
+			}
+
+			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;
+			CacheType type;
+
+			unsigned int tail, buffersize;
+			unsigned int hit, miss;
+
+			bool inCache(unsigned int index);
+	};
+}
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreResourceGroupManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreResourceGroupManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreResourceGroupManager.h	(revision 1812)
@@ -0,0 +1,821 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _ResourceGroupManager_H__
+#define _ResourceGroupManager_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreSingleton.h"
+#include "OgreCommon.h"
+#include "OgreDataStream.h"
+#include "OgreResource.h"
+#include "OgreArchive.h"
+
+namespace Ogre {
+
+    /** 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>
+		</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.
+		@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
+		*/
+		virtual void scriptParseStarted(const String& scriptName) = 0;
+		/** This event is fired when the script has been fully parsed.
+		*/
+		virtual void scriptParseEnded(void) = 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 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.
+        @param description Text description of what was just loaded
+        */
+        virtual void worldGeometryStageEnded(void) = 0;
+
+		/** This event is fired when a resource group finished loading. */
+		virtual void resourceGroupLoadEnded(const String& groupName) = 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:
+		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;
+		/// Bootstrap resource group name (min OGRE resources)
+		static String BOOTSTRAP_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 std::list<ResourceDeclaration> ResourceDeclarationList;
+    protected:
+		/// Map of resource types (strings) to ResourceManagers, used to notify them to load / unload group contents
+		typedef std::map<String, ResourceManager*> ResourceManagerMap;
+        ResourceManagerMap mResourceManagerMap;
+
+		/// Map of loading order (Real) to ScriptLoader, used to order script parsing
+		typedef std::multimap<Real, ScriptLoader*> ScriptLoaderOrderMap;
+		ScriptLoaderOrderMap mScriptLoaderOrderMap;
+
+		typedef std::vector<ResourceGroupListener*> ResourceGroupListenerList;
+        ResourceGroupListenerList mResourceGroupListenerList;
+
+        /// Resource index entry, resourcename->location 
+        typedef std::map<String, Archive*> ResourceLocationIndex;
+
+		/// 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 std::list<ResourceLocation*> LocationList;
+		/// List of resources which can be loaded / unloaded
+		typedef std::list<ResourcePtr> LoadUnloadResourceList;
+		/// Resource group entry
+		struct ResourceGroup
+		{
+			OGRE_AUTO_MUTEX
+			/// Group name
+			String name;
+			/// Whether group has been initialised
+			bool initialised;
+			/// 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 std::map<Real, LoadUnloadResourceList*> LoadResourceOrderMap;
+			LoadResourceOrderMap loadResourceOrderMap;
+            /// Linked world geometry, as passed to setWorldGeometry
+            String worldGeometry;
+            /// Scene manager to use with linked world geometry
+            SceneManager* worldGeometrySceneManager;
+		};
+        /// Map from resource group names to groups
+        typedef std::map<String, ResourceGroup*> 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);
+        /// Internal event firing method
+        void fireScriptEnded(void);
+		/// 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 fireResourceStarted(const ResourcePtr& resource);
+		/// Internal event firing method
+		void fireResourceEnded(void);
+		/// Internal event firing method
+		void fireResourceGroupLoadEnded(const String& groupName);
+
+
+
+		/// 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.
+        */
+        void createResourceGroup(const String& name);
+
+
+        /** 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);
+
+		/** 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 to 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);
+
+        /** 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);
+        /** Removes a resource location from the search path. */ 
+        void removeResourceLocation(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
+		@returns 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.
+		@returns 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 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
+        @returns A list of filenames matching the criteria, all are fully qualified
+        */
+        StringVectorPtr listResourceNames(const String& groupName);
+
+        /** List all files in a resource group with accompanying information.
+        @param groupName The name of the group
+        @returns A list of structures detailing quite a lot of information about
+        all the files in the archive.
+        */
+        FileInfoListPtr listResourceFileInfo(const String& groupName);
+
+        /** Find all file 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
+        @returns A list of filenames matching the criteria, all are fully qualified
+        */
+        StringVectorPtr findResourceNames(const String& groupName, const String& pattern);
+
+        /** 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 a group. 
+        @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);
+		/** Find the group in which a resource exists.
+		@param filename Fully qualified name of the file the resource should be
+			found as
+		@returns 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 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
+        @returns A list of file information structures for all files matching 
+        the criteria.
+        */
+        FileInfoListPtr findResourceFileInfo(const String& group, const String& pattern);
+
+        
+        /** 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;}
+
+        /// Sets 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);
+
+        /** 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);
+
+
+        /** 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);
+
+		/** 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);
+
+		/** Internale 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.
+		@returns 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
+		@returns A copy of list of currently defined resources.
+		*/
+		ResourceDeclarationList getResourceDeclarationList(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 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);
+
+    };
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreColourValue.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreColourValue.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreColourValue.h	(revision 1812)
@@ -0,0 +1,292 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _COLOURVALUE_H__
+#define _COLOURVALUE_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+    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;
+
+        union {
+            struct {
+	            float r,g,b,a;
+            };
+            float val[4];
+        };
+
+	    /** 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;
+        }
+
+        // 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 = rhs.r / r;
+            kProd.g = rhs.g / g;
+            kProd.b = rhs.b / b;
+            kProd.a = rhs.a / a;
+
+            return kProd;
+        }
+
+        inline ColourValue operator / (const float fScalar ) const
+        {
+            assert( fScalar != 0.0 );
+
+            ColourValue kDiv;
+
+            float fInv = 1.0 / 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.0 / 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);
+
+
+		/** 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: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreFrameListener.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreFrameListener.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreFrameListener.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __FrameListener_H__
+#define __FrameListener_H__
+
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+    /** 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.
+            Frame events only occur when Ogre is in continuous rendering mode,
+            ie. after Root::startRendering is called. If the application is
+            doing ad-hoc rendering without entering a rendering loop, frame
+            events are not generated. 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.
+            @return
+                True to go ahead, false to abort rendering and drop
+                out of the rendering loop.
+        */
+        virtual bool frameStarted(const FrameEvent& evt) { return true; }
+        /** Called just after a frame has been rendered.
+            @return
+                True to continue with the next frame, false to drop
+                out of the rendering loop.
+        */
+        virtual bool frameEnded(const FrameEvent& evt) { return true; }
+
+		virtual ~FrameListener() {}
+		
+    };
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCompositionTargetPass.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCompositionTargetPass.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCompositionTargetPass.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __CompositionTargetPass_H__
+#define __CompositionTargetPass_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreIteratorWrappers.h"
+
+namespace Ogre {
+	/** Object representing one render to a RenderTarget or Viewport in the Ogre Composition
+		framework.
+	 */
+    class _OgreExport CompositionTargetPass
+    {
+    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 std::vector<CompositionPass *> 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 visiblity mask used by this pass 
+        */
+        void setVisibilityMask(uint32 mask);
+        /** Get the scene visiblity 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 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 name
+        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;
+    };
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreILUtil.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreILUtil.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreILUtil.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _Ogre_ILUtil_H__
+#define _Ogre_ILUtil_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreCommon.h"
+#include "OgrePixelFormat.h"
+
+namespace Ogre {
+
+    /* 
+     * DevIL specific utility class
+     **/    
+    class _OgrePrivate ILUtil {
+    public:
+    	/// Structure that encapsulates a devIL image format definition
+		struct ILFormat {
+			/// Construct an invalidated ILFormat structure
+			ILFormat():
+				numberOfChannels(0), format(-1), type(-1) {};
+
+			/// Construct a ILFormat from parameters
+			ILFormat(int channels, int format, int type=-1):
+				numberOfChannels(channels), format(format), type(type) {}
+
+			/// Return wether this structure represents a valid DevIL format
+			bool isValid() { return format!=-1; }
+
+			/// Number of channels, usually 3 or 4
+			int numberOfChannels;
+			/// IL_RGBA,IL_BGRA,IL_DXTx, ...
+  			int format;
+			/// IL_UNSIGNED_BYTE, IL_UNSIGNED_SHORT, ... may be -1 for compressed formats
+  			int type;
+		};
+
+        /** Get OGRE format to which a given IL format can be most optimally converted.
+         */
+        static PixelFormat ilFormat2OgreFormat( int ImageFormat, int ImageType );
+        /**	Get IL format that matches a given OGRE format exactly in memory.
+        	@remarks	Returns an invalid ILFormat (.isValid()==false) when
+        		there is no IL format that matches this.
+         */
+        static ILFormat OgreFormat2ilFormat( PixelFormat format );      
+        /** Convert current IL image to an OGRE format. The size of the target will be
+          	PixelUtil::getNumElemBytes(fmt) * ilGetInteger( IL_IMAGE_WIDTH ) * ilGetInteger( IL_IMAGE_HEIGHT ) * ilGetInteger( IL_IMAGE_DEPTH )
+          	The IL image type must be IL(_UNSIGNED_)BYTE or IL_FLOAT.
+        	The IL image format must be IL_RGBA, IL_BGRA, IL_RGB, IL_BGR, IL_LUMINANCE or IL_LUMINANCE_ALPHA
+         
+         	@param tar       Target pointer
+         	@param ogrefmt   Ogre pixel format to employ
+        */
+        static void toOgre(const PixelBox &dst);
+
+        /** Convert an OGRE format image to current IL image.
+         	@param src       Pixelbox; encapsulates source pointer, width, height, 
+         					 depth and format
+        */
+        static void fromOgre(const PixelBox &src);
+    };
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreParticleSystemManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreParticleSystemManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreParticleSystemManager.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under 
+the terms of the GNU Lesser General Public License as published by the Free Software 
+Foundation; either version 2 of the License, or (at your option) any later 
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT 
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with 
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple 
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to 
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#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"
+
+namespace Ogre {
+
+	// Forward decl
+	class ParticleSystemFactory;
+	
+    /** 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
+    {
+		friend class ParticleSystemFactory;
+	public:
+        typedef std::map<String, ParticleSystem*> ParticleTemplateMap;
+		typedef std::map<String, ParticleAffectorFactory*> ParticleAffectorFactoryMap;
+		typedef std::map<String, ParticleEmitterFactory*> ParticleEmitterFactoryMap;
+		typedef std::map<String, ParticleSystemRendererFactory*> ParticleSystemRendererFactoryMap;
+    protected:
+        /// 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 allocted 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 allocted 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 allocted 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);
+
+        /** 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
+            effectorType 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);  
+
+	};
+	
+}
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreBitwise.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreBitwise.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreBitwise.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _Bitwise_H__
+#define _Bitwise_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+    /** 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;
+        }
+        /** Returns the number of bits a pattern must be shifted right by to
+            remove right-hand zeroes.
+        */
+		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 avaiable 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(const 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 ((uint8*)src)[0];
+                case 2:
+                    return ((uint16*)src)[0];
+                case 3:
+#if OGRE_ENDIAN == OGRE_ENDIAN_BIG      
+                    return ((uint32)((uint8*)src)[0]<<16)|
+                            ((uint32)((uint8*)src)[1]<<8)|
+                            ((uint32)((uint8*)src)[2]);
+#else
+                    return ((uint32)((uint8*)src)[0])|
+                            ((uint32)((uint8*)src)[1]<<8)|
+                            ((uint32)((uint8*)src)[2]<<16);
+#endif
+                case 4:
+                    return ((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 s | (m >> 13);
+            }
+            else if (e == 0xff - (127 - 15))
+            {
+                if (m == 0) // Inf
+                {
+                    return s | 0x7c00;
+                } 
+                else    // NAN
+                {
+                    m >>= 13;
+                    return s | 0x7c00 | m | (m == 0);
+                }
+            }
+            else
+            {
+                if (e > 30) // Overflow
+                {
+                    return s | 0x7c00;
+                }
+        
+                return 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: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSkeletonSerializer.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSkeletonSerializer.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSkeletonSerializer.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __SkeletonSerializer_H__
+#define __SkeletonSerializer_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreSkeleton.h"
+#include "OgreSerializer.h"
+
+namespace Ogre {
+
+    /** 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 instatiated 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,
+			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?
+
+    private:
+        // Internal export methods
+        void writeSkeleton(const Skeleton* pSkel);
+        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);
+        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 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: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreControllerManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreControllerManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreControllerManager.h	(revision 1812)
@@ -0,0 +1,283 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#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"
+
+namespace Ogre {
+
+    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>
+    {
+    protected:
+        typedef std::set<Controller<Real>*> 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 / rotaters.
+            @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 / rotaters.
+            @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 / rotaters.
+            @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 / rotaters.
+            @param
+                layer The texture layer to rotate.
+            @param
+                vSpeed 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 factor The factor by which to adjust the time elapsed by before passing it to the program
+        */
+        Controller<Real>* createGpuProgramTimerParam(GpuProgramParameters* 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);
+    };
+
+
+}
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSpotShadowFadePng.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSpotShadowFadePng.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSpotShadowFadePng.h	(revision 1812)
@@ -0,0 +1,644 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://ogre.sourceforge.net/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#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: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreImageCodec.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreImageCodec.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreImageCodec.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _ImageCodec_H__
+#define _ImageCodec_H__
+
+#include "OgreCodec.h"
+#include "OgrePixelFormat.h"
+
+namespace Ogre {
+
+    /** 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 imformation 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)
+			{
+			}
+            uint height;
+            uint width;
+			uint depth;
+            uint size;
+            
+            ushort num_mipmaps;
+            uint flags;
+
+            PixelFormat format;
+
+        public:
+            String dataType() const
+            {
+                return "ImageData";
+            }
+        };
+
+    public:
+        String getDataType() const
+        {
+            return "ImageData";
+        }
+    };
+
+} // namespace
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreLog.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreLog.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreLog.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __Log_H__
+#define __Log_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+    // 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
+    };
+
+    /** Log class for writing debug/log data to files.
+        @note
+            <br>Should not be used directly, but trough the LogManager class.
+    */
+    class _OgreExport Log
+    {
+    protected:
+        std::ofstream	mfpLog;
+        LoggingLevel	mLogLevel;
+        bool			mDebugOut;
+		bool			mSuppressFile;
+		String			mName;
+
+    public:
+        /** Usual constructor - called by LogManager.
+        */
+        Log( const String& name, bool debugOutput = true, bool suppressFileOutput = false);
+
+        /** Default destructor.
+        */
+        ~Log();
+
+        /** 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);
+
+        /** Sets the level of the log detail.
+        */
+        void setLogDetail(LoggingLevel ll);
+    };
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderQueue.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderQueue.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderQueue.h	(revision 1812)
@@ -0,0 +1,252 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __RenderQueue_H__
+#define __RenderQueue_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreIteratorWrappers.h"
+
+namespace Ogre {
+
+    /** 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
+    };
+
+    #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:
+        typedef std::map< uint8, RenderQueueGroup* > RenderQueueGroupMap;
+        /// Iterator over queue groups
+        typedef MapIterator<RenderQueueGroupMap> QueueGroupIterator;
+		/** 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).
+			@returns 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) = 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.
+        */
+        void setDefaultQueueGroup(uint8 grp);
+        
+        /** Internal method, returns an iterator for the queue groups. */
+        QueueGroupIterator _getQueueGroupIterator(void);
+        /** Sets whether or not the queue will split passes by their lighting type,
+            ie ambient, per-light and decal. 
+        */
+        void setSplitPassesByLightingType(bool 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);
+		/** Sets whether or not objects which cast shadows should be treated as
+		never receiving shadows. 
+		*/
+		void setShadowCastersCannotBeReceivers(bool ind);
+
+		/** 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; }
+
+    };
+
+
+}
+
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePlatform.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePlatform.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePlatform.h	(revision 1812)
@@ -0,0 +1,210 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#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_COMPILER_MSVC 1
+#define OGRE_COMPILER_GNUC 2
+#define OGRE_COMPILER_BORL 3
+
+#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( _MSC_VER )
+#   define OGRE_COMPILER OGRE_COMPILER_MSVC
+#   define OGRE_COMP_VER _MSC_VER
+
+#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__
+
+#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 )
+#   define OGRE_PLATFORM OGRE_PLATFORM_WIN32
+
+#elif defined( __APPLE_CC__)
+#   define OGRE_PLATFORM OGRE_PLATFORM_APPLE
+
+#else
+#   define OGRE_PLATFORM OGRE_PLATFORM_LINUX
+#endif
+
+    /* Find the arch type */
+#if defined(__x86_64__) || defined(_M_X64)
+#   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" )
+
+//----------------------------------------------------------------------------
+// Windows Settings
+#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
+
+// If we're not including this from a client build, specify that the stuff
+// should get exported. Otherwise, import it.
+#	if defined( __MINGW32__ )
+		// Linux compilers don't have symbol import/export directives.
+#   	define _OgreExport
+#   	define _OgrePrivate
+#   else
+#   	if defined( OGRE_NONCLIENT_BUILD )
+#       	define _OgreExport __declspec( dllexport )
+#   	else
+#       	define _OgreExport __declspec( dllimport )
+#   	endif
+#   	define _OgrePrivate
+#	endif
+// Win32 compilers use _DEBUG for specifying debug builds.
+#   ifdef _DEBUG
+#       define OGRE_DEBUG_MODE 1
+#   else
+#       define OGRE_DEBUG_MODE 0
+#   endif
+
+#if defined( __MINGW32__ )
+    #define EXT_HASH
+#else
+    #define snprintf _snprintf
+    #define vsnprintf _vsnprintf
+#endif
+
+#if OGRE_DEBUG_MODE
+    #define OGRE_PLATFORM_LIB "OgrePlatform_d.dll"
+#else
+    #define OGRE_PLATFORM_LIB "OgrePlatform.dll"
+#endif
+
+#endif
+//----------------------------------------------------------------------------
+
+//----------------------------------------------------------------------------
+// Linux/Apple Settings
+#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX || OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+
+// Enable GCC 4.0 symbol visibility
+#   if OGRE_COMP_VER >= 400
+#       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
+
+// Unlike the Win32 compilers, Linux compilers seem to use DEBUG for when
+// specifying a debug build.
+#   ifdef DEBUG
+#       define OGRE_DEBUG_MODE 1
+#   else
+#       define OGRE_DEBUG_MODE 0
+#   endif
+
+#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+    #define OGRE_PLATFORM_LIB "OgrePlatform.bundle"
+#else
+    //OGRE_PLATFORM_LINUX
+    #define OGRE_PLATFORM_LIB "libOgrePlatform.so"
+#endif
+
+#endif
+
+//For apple, we always have a custom config.h file
+#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+#    include "config.h"
+//SDL_main must be included in the file that contains
+//the application's main() function.
+#ifndef OGRE_NONCLIENT_BUILD
+#   include <SDL/SDL_main.h>
+#endif
+
+#endif
+
+//----------------------------------------------------------------------------
+
+//----------------------------------------------------------------------------
+// Endian Settings
+// check for BIG_ENDIAN config flag, set OGRE_ENDIAN correctly
+#ifdef CONFIG_BIG_ENDIAN
+#    define OGRE_ENDIAN OGRE_ENDIAN_BIG
+#else
+#    define OGRE_ENDIAN OGRE_ENDIAN_LITTLE
+#endif
+
+// Integer formats of fixed bit width
+typedef unsigned int uint32;
+typedef unsigned short uint16;
+typedef unsigned char uint8;
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderSystem.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderSystem.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderSystem.h	(revision 1812)
@@ -0,0 +1,1122 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://ogre.sourceforge.net/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __RenderSystem_H_
+#define __RenderSystem_H_
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+
+#include "OgreString.h"
+
+#include "OgreTextureUnitState.h"
+#include "OgreCommon.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"
+
+namespace Ogre
+{
+    typedef std::map< String, RenderTarget * > RenderTargetMap;
+	typedef std::multimap<uchar, RenderTarget * > 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 onthe 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 benefitting from Ogre's abstraction
+            of exactly which 3D API is in use.
+        @author
+            Steven Streeting
+        @version
+            1.0
+     */
+    class _OgreExport RenderSystem
+    {
+    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
+            @returns
+                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 RenderSystem::createRenderWindow
+                for the main render window.
+            @par
+                If an application has more specific window requirements,
+                however (e.g. a level design app), it should specify false
+                for this parameter and do it manually.
+            @returns
+                A pointer to the automatically created window, if requested, otherwise null.
+        */
+        virtual RenderWindow* initialise(bool autoCreateWindow, const String& windowTitle = "OGRE Render Window");
+
+        /** 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 avalible 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 avalible.  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 avalible.
+		*/
+		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 getRenderWindow.
+            @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 platorms unless
+					indicated otherwise:
+				**
+				Key: "title"
+				Description: The title of the window that will appear in the title bar
+				Values: string
+				Default: RenderTarget name
+				**
+				Key: "colourDepth"
+				Description: Colour depth of the resulting rendering window; only applies if fullScreen
+					is set.
+				Values: 16 or 32
+				Default: desktop depth
+				Notes: [W32 specific]
+				**
+				Key: "left"
+				Description: screen x coordinate from left
+				Values: positive integers
+				Default: 'center window on screen'
+				Notes: Ignored in case of full screen
+				**
+				Key: "top"
+				Description: screen y coordinate from top
+				Values: positive integers
+				Default: 'center window on screen'
+				Notes: Ignored in case of full screen
+				**
+				Key: "depthBuffer" [DX9 specific]
+				Description: Use depth buffer
+				Values: false or true
+				Default: true
+				**
+				Key: "externalWindowHandle" [API specific]
+				Description: External window handle, for embedding the OGRE context
+				Values: positive integer for W32 (HWND handle)
+				        poslong:posint:poslong (display*:screen:windowHandle) or
+				        poslong:posint:poslong:poslong (display*:screen:windowHandle:XVisualInfo*) for GLX
+				Default: 0 (None)
+				**
+				Key: "parentWindowHandle" [API specific]
+				Description: Parent window handle, for embedding the OGRE context
+				Values: positive integer for W32 (HWND handle)
+				        poslong:posint:poslong for GLX (display*:screen:windowHandle)
+				Default: 0 (None)
+				**
+				Key: "FSAA"
+				Description: Full screen antialiasing factor
+				Values: 0,2,4,6,...
+				Default: 0 
+				**
+				Key: "displayFrequency"
+				Description: Display frequency rate, for fullscreen mode
+				Values: 60...?
+				Default: Desktop vsync rate
+				**
+				Key: "vsync"
+				Description: Synchronize buffer swaps to vsync
+				Values: true, false
+				Default: 0
+				** 
+				Key: "border" 
+				Description: The type of window border (in windowed mode)
+				Values: none, fixed, resize
+				Default: resize
+				**
+				Key: "outerDimensions" 
+				Description: Whether the width/height is expressed as the size of the 
+				outer window, rather than the content area
+				Values: true, false
+				Default: false 
+				**
+				Key: "useNVPerfHUD" [DX9 specific]
+				Description: Enable the use of nVidia NVPerfHUD
+				Values: true, false
+				Default: false
+        */
+		virtual RenderWindow* createRenderWindow(const String &name, unsigned int width, unsigned int height, 
+			bool fullScreen, const NameValuePairList *miscParams = 0) = 0;
+
+		/** Creates and registers a render texture object.
+			@param name 
+				The name for the new render texture. Note that names must be unique.
+			@param width
+				The requested width for the render texture. See Remarks for more info.
+			@param height
+				The requested width for the render texture. See Remarks for more info.
+			@param texType
+				The type of texture; defaults to TEX_TYPE_2D
+			@param internalFormat
+				The internal format of the texture; defaults to PF_X8R8G8B8
+			@param miscParams This parameter is ignored.
+			@returns
+				On succes, a pointer to a new platform-dependernt, RenderTexture-derived
+				class is returned. On failiure, NULL is returned.
+			@remarks
+				Because a render texture is basically a wrapper around a texture object,
+				the width and height parameters of this method just hint the preferred
+				size for the texture. Depending on the hardware driver or the underlying
+				API, these values might change when the texture is created. The same applies
+				to the internalFormat parameter.
+            @deprecated
+                This method is deprecated, and exists only for backward compatibility. You can create
+                arbitrary rendertextures with the TextureManager::createManual call with usage
+                TU_RENDERTEXTURE.
+		*/
+		RenderTexture * createRenderTexture( const String & name, unsigned int width, unsigned int height,
+		 	TextureType texType = TEX_TYPE_2D, PixelFormat internalFormat = PF_X8R8G8B8, 
+			const NameValuePairList *miscParams = 0 ); 
+
+		/**	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->numMultiRenderTargets() 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;
+
+        /** Defines whether or now fullscreen render windows wait for the vertical blank before flipping buffers.
+            @remarks
+                By default, all rendering windows wait for a vertical blank (when the CRT beam turns off briefly to move
+                from the bottom right of the screen back to the top left) before flipping the screen buffers. This ensures
+                that the image you see on the screen is steady. However it restricts the frame rate to the refresh rate of
+                the monitor, and can slow the frame rate down. You can speed this up by not waiting for the blank, but
+                this has the downside of introducing 'tearing' artefacts where part of the previous frame is still displayed
+                as the buffers are switched. Speed vs quality, you choose.
+            @note
+                Has NO effect on windowed mode render targets. Only affects fullscreen mode.
+            @param
+                enabled If true, the system waits for vertical blanks - quality over speed. If false it doesn't - speed over quality.
+        */
+        void setWaitForVerticalBlank(bool enabled);
+
+        /** Returns true if the system is synchronising frames with the monitor vertical blank.
+        */
+        bool getWaitForVerticalBlank(void) const;
+
+        // ------------------------------------------------------------------------
+        //                     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;
+        /** 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 status of a single texture stage.
+
+          Sets the details of a texture stage, to be used for all primitives
+          rendered afterwards. User processes would
+          not normally call this direct unless rendering
+          primitives themselves - the SubEntity class
+          is designed to manage materials for objects.
+          Note that this method is called by _setMaterial.
+
+          @param unit The index of the texture unit to modify. Multitexturing hardware
+          can support multiple units (see RenderSystemCapabilites::numTextureUnits)
+          @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) = 0;
+
+        /**
+          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 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 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>
+            <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.
+        */
+        virtual void _setSceneBlending(SceneBlendFactor sourceFactor, SceneBlendFactor destFactor) = 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 val The value to compare each pixels alpha value to (0-255)
+        */
+        virtual void _setAlphaRejectSettings(CompareFunction func, unsigned char value) = 0;
+        /**
+         * Signifies the beginning of a frame, ie the start of rendering on a single viewport. Will occur
+         * several times per complete frame if multiple viewports exist.
+         */
+        virtual void _beginFrame(void) = 0;
+
+
+        /**
+         * 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 target 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.
+        @param bias The bias value, should be between 0 and 16.
+        */
+        virtual void _setDepthBias(ushort bias) = 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 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) canbe 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 mask The bitmask applied to both the stencil value and the reference value 
+            before comparison
+        @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 mask = 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 mCapabilities; }
+
+        /** 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 exsiting one.
+        */
+        virtual void bindGpuProgram(GpuProgram* prg);
+
+        /** Bind Gpu program parameters.
+        */
+        virtual void bindGpuProgramParameters(GpuProgramType gptype, GpuProgramParametersSharedPtr params) = 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);
+
+        /** sets the clipping region.
+        */
+        virtual void setClipPlanes(const PlaneList& clipPlanes) = 0;
+
+        /** 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, 
+            incase 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(void);
+
+        /** Set a clipping plane. */
+        virtual void setClipPlane (ushort index, const Plane &p);
+        /** Set a clipping plane. */
+        virtual void setClipPlane (ushort index, Real A, Real B, Real C, Real D) = 0;
+        /** Enable the clipping plane. */
+        virtual void enableClipPlane (ushort index, bool enable) = 0;
+
+        /** Sets whether or not vertex windings set should be inverted; this can be important
+            for rendering reflections. */
+        virtual void setInvertVertexWinding(bool invert);
+        /** Sets the 'scissor region' ie 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::useIdentityView, Renderable::useIdentityProjection
+        */
+        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::useIdentityView, Renderable::useIdentityProjection
+        */
+        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.
+        */
+        void setCurrentPassIterationCount(const size_t count) { mCurrentPassIterationCount = count; }
+
+		/** 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; }
+    protected:
+
+		
+        /** 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 mActiveFragmentGpuProgramParameters;
+
+        // Texture manager
+        // A concrete class of this will be created and
+        // made available under the TextureManager singleton,
+        // managed by the RenderSystem
+        TextureManager* mTextureManager;
+
+        /// Used to store the capabilities of the graphics card
+        RenderSystemCapabilities* mCapabilities;
+
+        // Active viewport (dest for future rendering operations)
+        Viewport* mActiveViewport;
+
+        CullingMode mCullingMode;
+
+        bool mVSync;
+		bool mWBuffer;
+
+        size_t mFaceCount;
+        size_t mVertexCount;
+
+        /// Saved set of world matrices
+        Matrix4 mWorldMatrices[256];
+
+		/// Saved manual colour blends
+		ColourValue mManualBlendColours[OGRE_MAX_TEXTURE_LAYERS][2];
+
+        bool mInvertVertexWinding;
+
+        /// number of times to render the current state
+        size_t mCurrentPassIterationCount;
+
+        /** updates pass iteration rendering state including bound gpu program parameter
+            pass iteration auto constant entry
+        @returns 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 std::list<Listener*> ListenerList;
+		ListenerList mEventListeners;
+
+		typedef std::list<HardwareOcclusionQuery*> HardwareOcclusionQueryList;
+		HardwareOcclusionQueryList mHwOcclusionQueries;
+		
+		bool mVertexProgramBound;
+		bool mFragmentProgramBound;
+		
+
+
+    };
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreHardwareVertexBuffer.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreHardwareVertexBuffer.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreHardwareVertexBuffer.h	(revision 1812)
@@ -0,0 +1,515 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __HardwareVertexBuffer__
+#define __HardwareVertexBuffer__
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+#include "OgreHardwareBuffer.h"
+#include "OgreSharedPtr.h"
+#include "OgreColourValue.h"
+
+namespace Ogre {
+    /** Specialisation of HardwareBuffer for a vertex buffer. */
+    class _OgreExport HardwareVertexBuffer : public HardwareBuffer
+    {
+	    protected:
+
+		    size_t mNumVertices;
+            size_t mVertexSize;
+
+	    public:
+		    /// Should be called by HardwareBufferManager
+		    HardwareVertexBuffer(size_t vertexSize, size_t numVertices,
+                HardwareBuffer::Usage usage, bool useSystemMemory, bool useShadowBuffer);
+            ~HardwareVertexBuffer();
+            /// 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; }
+
+
+
+		    // NB subclasses should override lock, unlock, readData, writeData
+
+    };
+
+    /** Shared pointer implementation used to share index buffers. */
+    class _OgreExport HardwareVertexBufferSharedPtr : public SharedPtr<HardwareVertexBuffer>
+    {
+    public:
+        HardwareVertexBufferSharedPtr() : SharedPtr<HardwareVertexBuffer>() {}
+        explicit HardwareVertexBufferSharedPtr(HardwareVertexBuffer* buf);
+
+
+    };
+
+    /// 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
+
+	};
+
+    /// 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
+    };
+
+    /** 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
+    {
+    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, 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*>(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:
+		/// Defines the list of vertex elements that makes up this declaration
+        typedef std::list<VertexElement> 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) { 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);
+
+        /** 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
+        */
+        VertexDeclaration* getAutoOrganisedDeclaration(bool skeletalAnimation,
+			bool vertexAnimation);
+
+        /** Gets the indeex 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 VertexBufferBindingState 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
+		@returns 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 VertexBufferBindingState 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
+        @returns 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);
+		/** 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);
+
+		/** Gets the vertex size defined by this declaration for a given source. */
+        virtual size_t getVertexSize(unsigned short source);
+
+        /** Clones this declaration. */
+        virtual VertexDeclaration* clone(void);
+
+        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:
+		/// Defines the vertex buffer bindings used as source for vertex declarations
+		typedef std::map<unsigned short, HardwareVertexBufferSharedPtr> 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, 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 HardwareVertexBufferSharedPtr getBuffer(unsigned short index);
+		/// Gets whether a buffer is bound to the given source index
+		virtual bool isBufferBound(unsigned short index);
+
+        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++; }
+
+
+
+
+	};
+
+
+
+}
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreDataStream.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreDataStream.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreDataStream.h	(revision 1812)
@@ -0,0 +1,438 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __DataStream_H__
+#define __DataStream_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreString.h"
+#include "OgreSharedPtr.h"
+#include <istream>
+
+namespace Ogre {
+
+	/** General purpose class used for encapsulating the reading 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 compatiblity 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
+	{
+	protected:
+		/// The name (e.g. resource name) that can be used to identify the source fot his data (optional)
+		String mName;		
+        /// Size of the data in the stream (may be 0 if size cannot be determined)
+        size_t mSize;
+        #define OGRE_STREAM_TEMP_SIZE 128
+	public:
+		/// Constructor for creating unnamed streams
+        DataStream() : mSize(0) {}
+		/// Constructor for creating named streams
+		DataStream(const String& name) : mName(name), mSize(0) {}
+		/// Returns the name of the stream, if it has one.
+		const String& getName(void) { return mName; }
+        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
+		@returns The number of bytes read
+		*/
+		virtual size_t read(void* buf, size_t count) = 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
+		@returns 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
+		@returns 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 std::list<DataStreamPtr> 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 exising 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.
+		*/
+		MemoryDataStream(void* pMem, size_t size, bool freeOnClose = false);
+		
+		/** Wrap an existing memory chunk in a named stream.
+		@param name The name to give the stream
+		@param pMem Pointer to the exising 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.
+		*/
+		MemoryDataStream(const String& name, void* pMem, size_t size, 
+				bool freeOnClose = 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.
+		*/
+		MemoryDataStream(DataStream& sourceStream, 
+				bool freeOnClose = true);
+		
+		/** 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 Weak reference to another DataStream which will provide the source
+			of data
+		@param freeOnClose If true, the memory associated will be destroyed
+			when the stream is destroyed.
+		*/
+		MemoryDataStream(DataStreamPtr& sourceStream, 
+				bool freeOnClose = true);
+
+		/** 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.
+		*/
+		MemoryDataStream(const String& name, DataStream& sourceStream, 
+				bool freeOnClose = true);
+
+        /** 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.
+        */
+        MemoryDataStream(const String& name, const DataStreamPtr& sourceStream, 
+            bool freeOnClose = true);
+
+        /** 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.
+		*/
+		MemoryDataStream(size_t size, bool freeOnClose = true);
+		/** 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.
+		*/
+		MemoryDataStream(const String& name, size_t size, 
+				bool freeOnClose = true);
+
+		~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::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
+		std::ifstream* mpStream;
+        bool mFreeOnClose;			
+	public:
+		/** Construct 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 named 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 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
+        */
+		FileStreamDataStream(const String& name, 
+            std::ifstream* s, 
+            size_t size, 
+            bool freeOnClose = true);
+
+        ~FileStreamDataStream();
+
+		/** @copydoc DataStream::read
+		*/
+		size_t read(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);
+		/// Create named stream from a C file handle
+		FileHandleDataStream(const String& name, FILE* handle);
+        ~FileHandleDataStream();
+
+		/** @copydoc DataStream::read
+		*/
+		size_t read(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);
+
+	};
+}
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreQuaternion.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreQuaternion.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreQuaternion.h	(revision 1812)
@@ -0,0 +1,230 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+// NOTE THAT THIS FILE IS BASED ON MATERIAL FROM:
+
+// Magic Software, Inc.
+// http://www.geometrictools.com/
+// Copyright (c) 2000, All Rights Reserved
+//
+// Source code from Magic Software is supplied under the terms of a license
+// agreement and may not be copied or disclosed except in accordance with the
+// terms of that agreement.  The various license agreements may be found at
+// the Magic Software web site.  This file is subject to the license
+//
+// FREE SOURCE CODE
+// http://www.geometrictools.com/License/WildMagic3License.pdf
+
+#ifndef __Quaternion_H__
+#define __Quaternion_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreMath.h"
+
+namespace Ogre {
+
+    /** Implementation of a Quaternion, i.e. a rotation around an axis.
+    */
+    class _OgreExport Quaternion
+    {
+    public:
+        inline Quaternion (
+            Real fW = 1.0,
+            Real fX = 0.0, Real fY = 0.0, Real fZ = 0.0)
+		{
+			w = fW;
+			x = fX;
+			y = fY;
+			z = fZ;
+		}
+        inline Quaternion (const Quaternion& rkQ)
+		{
+			w = rkQ.w;
+			x = rkQ.x;
+			y = rkQ.y;
+			z = rkQ.z;
+		}
+        /// 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);
+        }
+#ifndef OGRE_FORCE_ANGLE_TYPES
+        inline Quaternion(const Real& rfAngle, const Vector3& rkAxis)
+		{
+			this->FromAngleAxis(rfAngle, rkAxis);
+		}
+#endif//OGRE_FORCE_ANGLE_TYPES
+        /// 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(val, valptr, sizeof(Real)*4);
+		}
+
+        void FromRotationMatrix (const Matrix3& kRot);
+        void ToRotationMatrix (Matrix3& kRot) const;
+        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;
+        }
+#ifndef OGRE_FORCE_ANGLE_TYPES
+        inline void FromAngleAxis (const Real& rfAngle, const Vector3& rkAxis) {
+			FromAngleAxis ( Angle(rfAngle), rkAxis );
+		}
+        inline void ToAngleAxis (Real& rfAngle, Vector3& rkAxis) const {
+			Radian r;
+			ToAngleAxis ( r, rkAxis );
+			rfAngle = r.valueAngleUnits();
+		}
+#endif//OGRE_FORCE_ANGLE_TYPES
+        void FromAxes (const Vector3* akAxis);
+        void FromAxes (const Vector3& xAxis, const Vector3& yAxis, const Vector3& zAxis);
+        void ToAxes (Vector3* akAxis) const;
+        void ToAxes (Vector3& xAxis, Vector3& yAxis, Vector3& zAxis) const;
+        /// Get the local x-axis
+        Vector3 xAxis(void) const;
+        /// Get the local y-axis
+        Vector3 yAxis(void) const;
+        /// Get 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
+        Real Dot (const Quaternion& rkQ) const;  // dot product
+        Real Norm () const;  // squared-length
+        /// 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
+		Radian getRoll(void) const;
+   		/// Calculate the local pitch element of this quaternion
+		Radian getPitch(void) const;
+   		/// Calculate the local yaw element of this quaternion
+		Radian getYaw(void) const;		
+		/// Equality with tolerance (tolerance is max angle difference)
+		bool equals(const Quaternion& rhs, const Radian& tolerance) const;
+		
+	    // spherical linear interpolation
+        static Quaternion Slerp (Real fT, const Quaternion& rkP,
+            const Quaternion& rkQ, bool shortestPath = false);
+
+        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);
+
+        // normalised linear interpolation - faster but less accurate (non-constant rotation velocity)
+        static Quaternion nlerp(Real fT, const Quaternion& rkP, 
+            const Quaternion& rkQ, bool shortestPath = false);
+
+        // cutoff for sine near zero
+        static const Real ms_fEpsilon;
+
+        // special values
+        static const Quaternion ZERO;
+        static const Quaternion IDENTITY;
+
+        union
+		{
+			struct {
+				Real w, x, y, z;
+			};
+			Real val[4];
+		};
+
+        /** 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: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreStdHeaders.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreStdHeaders.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreStdHeaders.h	(revision 1812)
@@ -0,0 +1,89 @@
+#ifndef __StdHeaders_H__
+#define __StdHeaders_H__
+
+#ifdef __BORLANDC__
+    #define __STD_ALGORITHM
+#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
+#if (OGRE_COMPILER == OGRE_COMPILER_GNUC) && !defined(STLPORT)
+#   include <ext/hash_map>
+#   include <ext/hash_set>
+#else
+#   include <hash_set>
+#   include <hash_map>
+#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
+#  undef min
+#  undef max
+#  if defined( __MINGW32__ )
+#    include <unistd.h>
+#  endif
+#endif
+
+#if OGRE_PLATFORM == OGRE_PLATFORM_LINUX
+extern "C" {
+
+#   include <unistd.h>
+#   include <dlfcn.h>
+
+}
+#endif
+
+#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+extern "C" {
+#   include <unistd.h>
+#   include <sys/param.h>
+#   include <CoreFoundation/CoreFoundation.h>
+}
+#endif
+
+#if OGRE_THREAD_SUPPORT
+#	include <boost/thread/recursive_mutex.hpp>
+#endif
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreVector4.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreVector4.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreVector4.h	(revision 1812)
@@ -0,0 +1,386 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __Vector4_H__
+#define __Vector4_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreVector3.h"
+
+namespace Ogre
+{
+
+    /** 4-dimensional homogenous vector.
+    */
+    class _OgreExport Vector4
+    {
+    public:
+        union {
+            struct {
+                Real x, y, z, w;
+            };
+            Real val[4];
+        };
+
+    public:
+        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)
+        {
+        }
+
+        inline Vector4( const Vector4& rkVector )
+            : x( rkVector.x ), y( rkVector.y ), z( rkVector.z ), w (rkVector.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);
+        }
+
+        /** 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.0 / 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.0 / 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).
+            @returns
+                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;
+        }
+        /** 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: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMatrix3.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMatrix3.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMatrix3.h	(revision 1812)
@@ -0,0 +1,302 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#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
+{
+    /** 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;
+		}
+
+        // member access, allows use of construct mat[r][c]
+        inline Real* operator[] (size_t iRow) const
+		{
+			return (Real*)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;
+		}
+        bool operator== (const Matrix3& rkMatrix) const;
+        inline bool operator!= (const Matrix3& rkMatrix) const
+		{
+			return !operator==(rkMatrix);
+		}
+
+        // arithmetic operations
+        Matrix3 operator+ (const Matrix3& rkMatrix) const;
+        Matrix3 operator- (const Matrix3& rkMatrix) const;
+        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;
+
+        // matrix must be orthonormal
+        void ToAxisAngle (Vector3& rkAxis, Radian& rfAngle) const;
+		inline void ToAxisAngle (Vector3& rkAxis, Degree& rfAngle) const {
+			Radian r;
+			ToAxisAngle ( rkAxis, r );
+			rfAngle = r;
+		}
+        void FromAxisAngle (const Vector3& rkAxis, const Radian& fRadians);
+#ifndef OGRE_FORCE_ANGLE_TYPES
+        inline void ToAxisAngle (Vector3& rkAxis, Real& rfRadians) const {
+			Radian r;
+			ToAxisAngle ( rkAxis, r );
+			rfRadians = r.valueRadians();
+		}
+        inline void FromAxisAngle (const Vector3& rkAxis, Real fRadians) {
+			FromAxisAngle ( rkAxis, Radian(fRadians) );
+		}
+#endif//OGRE_FORCE_ANGLE_TYPES
+
+        // 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);
+#ifndef OGRE_FORCE_ANGLE_TYPES
+        inline bool ToEulerAnglesXYZ (float& rfYAngle, float& rfPAngle,
+            float& rfRAngle) const {
+			Radian y, p, r;
+			bool b = ToEulerAnglesXYZ(y,p,r);
+			rfYAngle = y.valueRadians();
+			rfPAngle = p.valueRadians();
+			rfRAngle = r.valueRadians();
+			return b;
+		}
+        inline bool ToEulerAnglesXZY (float& rfYAngle, float& rfPAngle,
+            float& rfRAngle) const {
+			Radian y, p, r;
+			bool b = ToEulerAnglesXZY(y,p,r);
+			rfYAngle = y.valueRadians();
+			rfPAngle = p.valueRadians();
+			rfRAngle = r.valueRadians();
+			return b;
+		}
+        inline bool ToEulerAnglesYXZ (float& rfYAngle, float& rfPAngle,
+            float& rfRAngle) const {
+			Radian y, p, r;
+			bool b = ToEulerAnglesYXZ(y,p,r);
+			rfYAngle = y.valueRadians();
+			rfPAngle = p.valueRadians();
+			rfRAngle = r.valueRadians();
+			return b;
+		}
+        inline bool ToEulerAnglesYZX (float& rfYAngle, float& rfPAngle,
+            float& rfRAngle) const {
+			Radian y, p, r;
+			bool b = ToEulerAnglesYZX(y,p,r);
+			rfYAngle = y.valueRadians();
+			rfPAngle = p.valueRadians();
+			rfRAngle = r.valueRadians();
+			return b;
+		}
+        inline bool ToEulerAnglesZXY (float& rfYAngle, float& rfPAngle,
+            float& rfRAngle) const {
+			Radian y, p, r;
+			bool b = ToEulerAnglesZXY(y,p,r);
+			rfYAngle = y.valueRadians();
+			rfPAngle = p.valueRadians();
+			rfRAngle = r.valueRadians();
+			return b;
+		}
+        inline bool ToEulerAnglesZYX (float& rfYAngle, float& rfPAngle,
+            float& rfRAngle) const {
+			Radian y, p, r;
+			bool b = ToEulerAnglesZYX(y,p,r);
+			rfYAngle = y.valueRadians();
+			rfPAngle = p.valueRadians();
+			rfRAngle = r.valueRadians();
+			return b;
+		}
+        inline void FromEulerAnglesXYZ (float fYAngle, float fPAngle, float fRAngle) {
+			FromEulerAnglesXYZ ( Radian(fYAngle), Radian(fPAngle), Radian(fRAngle) );
+		}
+        inline void FromEulerAnglesXZY (float fYAngle, float fPAngle, float fRAngle) {
+			FromEulerAnglesXZY ( Radian(fYAngle), Radian(fPAngle), Radian(fRAngle) );
+		}
+        inline void FromEulerAnglesYXZ (float fYAngle, float fPAngle, float fRAngle) {
+			FromEulerAnglesYXZ ( Radian(fYAngle), Radian(fPAngle), Radian(fRAngle) );
+		}
+        inline void FromEulerAnglesYZX (float fYAngle, float fPAngle, float fRAngle) {
+			FromEulerAnglesYZX ( Radian(fYAngle), Radian(fPAngle), Radian(fRAngle) );
+		}
+        inline void FromEulerAnglesZXY (float fYAngle, float fPAngle, float fRAngle) {
+			FromEulerAnglesZXY ( Radian(fYAngle), Radian(fPAngle), Radian(fRAngle) );
+		}
+        inline void FromEulerAnglesZYX (float fYAngle, float fPAngle, float fRAngle) {
+			FromEulerAnglesZYX ( Radian(fYAngle), Radian(fPAngle), Radian(fRAngle) );
+		}
+#endif//OGRE_FORCE_ANGLE_TYPES
+        // 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);
+
+        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 ms_fSvdEpsilon;
+        static const unsigned int ms_iSvdMaxIterations;
+        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: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRotationalSpline.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRotationalSpline.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRotationalSpline.h	(revision 1812)
@@ -0,0 +1,125 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __RotationalSpline_H__
+#define __RotationalSpline_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreQuaternion.h"
+
+namespace Ogre {
+
+    /** 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;
+
+
+
+        std::vector<Quaternion> mPoints;
+        std::vector<Quaternion> mTangents;
+
+    };
+
+
+}
+
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreEventDispatcher.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreEventDispatcher.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreEventDispatcher.h	(revision 1812)
@@ -0,0 +1,212 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+/***************************************************************************
+OgreEventDispatcher.h  -  
+	Handles the Dispatching of events to a EventTarget (mainly a PositionTarget for 
+	mouse moving). The EventTargets are managed by a target manager.
+
+	A EventDispatcher is needed for each TargetManager. ie 1 dispatcher for the OverlayManager,
+	for managing the 2D GUI components, and another EventDispatcher for a SceneManager 
+	managing the 3D objects.(NOTE currently the SceneManager isn't a TargetManager.. this is a TODO).
+
+-------------------
+begin                : Nov 19 2002
+copyright            : (C) 2002 by Kenny Sabir
+email                : kenny@sparksuit.com
+***************************************************************************/
+
+
+
+#ifndef __EventDispatcher_H__
+#define __EventDispatcher_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+	/**
+		Handles the Dispatching of events to a EventTarget (mainly a PositionTarget for 
+		mouse moving). 
+	@remarks
+		A EventDispatcher is needed for each TargetManager. ie 1 dispatcher for the OverlayManager,
+		for managing the 2D GUI components, and another EventDispatcher for a SceneManager 
+		managing the 3D objects.(NOTE currently the SceneManager isn't a TargetManager.. this is a TODO).
+	*/
+    class _OgreExport EventDispatcher
+    {
+    protected:
+	    TargetManager* mTargetManager;		
+
+	    /**
+	    * The current PositionTarget that has focus that is being
+	    * hosted by this GuiContainer.  If this is a null reference then 
+	    * there is currently no focus on a PositionTarget being 
+	    * hosted by this GuiContainer 
+	    */
+	    PositionTarget* mFocus;	// isn't implemented yet
+
+	    /**
+	    * The current PositionTarget, over which, the current drag operation originated.
+        * Only valid when mDragging is true.  May be null.
+	    */
+	    PositionTarget* mMouseDragSource;
+
+	    /**
+	    * PositionTarget the Keycursor is on 
+	    */
+	    PositionTarget* mKeyCursorOn;	
+
+	    /**
+	    * The last PositionTarget entered
+	    */
+            PositionTarget* mTargetLastEntered;
+
+        /**
+        *  Screen coordinates of the last (or current) mouse event.  Will eventually be
+        *  useful for managing mouse cursors.
+        */
+        Real mMouseX;
+        Real mMouseY;
+
+	    /**
+	    * Indicates if the mouse pointer is currently being dragged...
+	    * this is needed because we may receive exit events while dragging
+	    * and need to keep the current mouse target in this case.
+	    */
+	    bool mDragging;       // i.e. mouse grab
+
+	    /**
+	    * Indicates whether or not Drag/Drop event will be generated during the
+        * next drag sequence.
+        *
+        * @see setDragDrop
+	    */
+        bool mDragDropOn;
+
+        /**
+	    * Indicates whether or not Drag/Drop events are currently being generated.
+	    */
+        bool mDragDropActive;
+
+	    int mEventMask;
+
+	    //-------------------
+	    // protected methods	
+
+	    bool processKeyEvent(KeyEvent* e) ;
+
+	    /**
+	    * This method attempts to distribute a mouse event to a lightweight
+	    * PositionTarget.  It tries to avoid doing any unnecessary probes down
+	    * into the PositionTarget tree to minimize the overhead of determining
+	    * where to route the event, since mouse movement events tend to
+	    * come in large and frequent amounts.
+	    */
+
+	    bool processMouseEvent(MouseEvent* e) ;
+
+	    /**
+	    * Sends a mouse event to the current mouse event recipient using
+	    * the given event (sent to the windowed host) as a srcEvent.  If
+	    * the mouse event target is still in the PositionTarget tree, the 
+	    * coordinates of the event are translated to those of the target.
+	    * If the target has been removed, we don't bother to send the
+	    * message.
+	    */
+
+	    void retargetMouseEvent(PositionTarget* target, MouseEvent* e) ;
+
+	    /**
+	    * Sends a mouse event to the current mouse event recipient using
+	    * the given event (sent to the windowed host) as a srcEvent.  If
+	    * the mouse event target is still in the PositionTarget tree, the 
+	    * coordinates of the event are translated to those of the target.
+	    * If the target has been removed, we don't bother to send the
+	    * message.
+	    */
+
+	    void retargetMouseEvent(PositionTarget* target, int id, MouseEvent* e, bool consume = false) ;
+
+	    /**
+	    * Sends a key event to the current mouse event recipient using
+	    * the given event (sent to the windowed host) as a srcEvent.
+	    */
+
+	    void retargetKeyEvent(PositionTarget* target, int id, MouseEvent* e) ;
+
+	    /*
+	    * Generates enter/exit events as mouse moves over lw PositionTargets
+	    * @param targetOver	Target mouse is over (including native container)
+	    * @param e			Mouse event in native container
+	    */
+
+	    void trackMouseEnterExit(PositionTarget* targetOver, MouseEvent* e) ;
+
+        /*
+	    * Generates FocusIn/FocusOut events as the keyboard focus changes.
+	    * @param targetOver Target mouse is over (including native container)
+	    * @param e			 Mouse event in native container
+	    */
+        void trackKeyEnterExit(PositionTarget* targetOver, MouseEvent* e);
+
+    public:
+	    EventDispatcher(TargetManager* pTargetManager);
+        virtual ~EventDispatcher();       
+
+	    /**
+	    * Dispatches an event to a PositionTarget if necessary, and
+	    * returns whether or not the event was forwarded to a 
+	    * sub-PositionTarget.
+	    *
+	    * @param e the event
+	    */
+	    bool dispatchEvent(InputEvent* e);
+
+	    /**
+	    * Enables or disables the mouse drag/drop events on the next mouse
+        * drag sequence.   It has no effect on the current drag sequence, if any.
+        * Drag/drop events are typically enabled when the mouse enters the area
+        * of a particular PositionTarget.
+	    *
+	    * @param dragDropOn Indicates whether or not the drag/drop events should
+        * be enabled.
+	    */
+        void setDragDrop(bool dragDropOn);
+
+        /**
+	    * Returns the X screen coordinate of the current mouse position.
+	    */
+        inline Real getMouseX() const { return mMouseX; }
+        /**
+	    * Returns the Y screen coordinate of the current mouse position.
+	    */
+        inline Real getMouseY() const { return mMouseY; }
+    };
+
+}
+
+
+#endif 
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSceneManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSceneManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSceneManager.h	(revision 1812)
@@ -0,0 +1,2531 @@
+/*-------------------------------------------------------------------------
+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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License (LGPL) as 
+published by the Free Software Foundation; either version 2.1 of the 
+License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful, but 
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public 
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License 
+along with this library; if not, write to the Free Software Foundation, 
+Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA or go to
+http://www.gnu.org/copyleft/lesser.txt
+-------------------------------------------------------------------------*/
+#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"
+
+namespace Ogre {
+
+    /** Structure for holding a position & orientation pair. */
+    struct ViewPoint
+    {
+        Vector3 position;
+        Quaternion orientation;
+    };
+
+	// Forward declarations
+	class DefaultIntersectionSceneQuery;
+	class DefaultRaySceneQuery;
+	class DefaultSphereSceneQuery;
+	class DefaultAxisAlignedBoxSceneQuery;
+
+	/** Interface definition for classes which can listen in on the process
+		of rendering shadows, in order to implement custom behaviour.
+	*/
+	class _OgreExport ShadowListener
+	{
+	public:
+		ShadowListener() {}
+		virtual ~ShadowListener() {}
+
+		/** 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) = 0;
+
+		/** 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
+		*/
+		virtual void shadowTextureCasterPreViewProj(Light* light, 
+			Camera* camera) = 0;
+		/** 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) = 0;
+		
+	};
+
+    /** 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:
+        /// 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;
+		/// 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;
+		};
+
+    protected:
+		/// Instance name
+		String mName;
+
+        /// Queue of objects for rendering
+        RenderQueue* mRenderQueue;
+
+        /// Current ambient light, cached for RenderSystem
+        ColourValue mAmbientLight;
+
+        /// The rendering system to send the scene to
+        RenderSystem *mDestRenderSystem;
+
+        typedef std::map<String, Camera* > CameraList;
+
+        /** Central list of cameras - for easy memory management and lookup.
+        */
+        CameraList mCameras;
+
+		typedef std::map<String, StaticGeometry* > StaticGeometryList;
+		StaticGeometryList mStaticGeometryList;
+
+        typedef std::map<String, SceneNode*> 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 std::set<SceneNode*> AutoTrackingSceneNodes;
+        AutoTrackingSceneNodes mAutoTrackingSceneNodes;
+
+        // Sky params
+        // Sky plane
+        Entity* mSkyPlaneEntity;
+        Entity* mSkyDomeEntity[5];
+        Entity* mSkyBoxEntity[6];
+
+        SceneNode* mSkyPlaneNode;
+        SceneNode* mSkyDomeNode;
+        SceneNode* mSkyBoxNode;
+
+        // Sky plane
+        bool mSkyPlaneEnabled;
+        bool mSkyPlaneDrawFirst;
+        Plane mSkyPlane;
+        SkyPlaneGenParameters mSkyPlaneGenParameters;
+        // Sky box
+        bool mSkyBoxEnabled;
+        bool mSkyBoxDrawFirst;
+        Quaternion mSkyBoxOrientation;
+        SkyBoxGenParameters mSkyBoxGenParameters;
+        // Sky dome
+        bool mSkyDomeEnabled;
+        bool mSkyDomeDrawFirst;
+        Quaternion mSkyDomeOrientation;
+        SkyDomeGenParameters mSkyDomeGenParameters;
+
+        // Fog
+        FogMode mFogMode;
+        ColourValue mFogColour;
+        Real mFogStart;
+        Real mFogEnd;
+        Real mFogDensity;
+
+		typedef std::set<uint8> SpecialCaseRenderQueueList;
+		SpecialCaseRenderQueueList mSpecialCaseQueueList;
+		SpecialCaseRenderQueueMode mSpecialCaseQueueMode;
+		uint8 mWorldGeometryRenderQueue;
+		
+		unsigned long mLastFrameNumber;
+		Matrix4 mTempXform[256];
+		bool mResetIdentityView;
+		bool mResetIdentityProj;
+
+		typedef std::map<String, MovableObject*> MovableObjectMap;
+		typedef std::map<String, MovableObjectMap*> MovableObjectCollectionMap;
+		MovableObjectCollectionMap mMovableObjectCollectionMap;
+		MovableObjectMap* getMovableObjectMap(const String& typeName);
+
+        /** 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 AutpoParamDataSource to set black lighting for
+            passes with vertex programs. 
+        */
+        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. 
+        */
+        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. 
+        */
+        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. 
+        */
+        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.
+        */
+        MeshPtr createSkyboxPlane(
+            BoxPlane bp,
+            Real distance,
+            const Quaternion& orientation,
+            const String& groupName);
+
+        /* Internal utility method for creating the planes of a skydome.
+        */
+        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 std::map<String, Animation*> AnimationList;
+        AnimationList mAnimationsList;
+        AnimationStateSet mAnimationStates;
+
+        /** Internal method used by _renderSingleObject to deal with renderables
+            which override the camera's own view / projection materices. */
+        void useRenderableViewProjMode(const Renderable* pRend);
+        
+        /** Internal method used by _renderSingleObject to deal with renderables
+            which override the camera's own view / projection matrices. */
+        void resetViewProjMode(void);
+
+        typedef std::vector<RenderQueueListener*> RenderQueueListenerList;
+        RenderQueueListenerList mRenderQueueListeners;
+
+        typedef std::vector<ShadowListener*> ShadowListenerList;
+        ShadowListenerList mShadowListeners;
+        /// Internal method for firing the queue start event, returns true if queue is to be skipped
+        bool fireRenderQueueStarted(uint8 id, const String& invocation);
+        /// Internal method for firing the queue end event, returns true if queue is to be repeated
+        bool fireRenderQueueEnded(uint8 id, const String& invocation);
+
+		/// Internal method for firing the texture shadows updated event
+        void fireShadowTexturesUpdated(size_t numberOfShadowTextures);
+		/// Internal method for firing the pre caster texture shadows event
+        void fireShadowTexturesPreCaster(Light* light, Camera* camera);
+		/// Internal method for firing the pre receiver texture shadows event
+        void fireShadowTexturesPreReceiver(Light* light, Frustum* f);
+        /** 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 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(const Renderable* rend, const Pass* pass, 
+			bool doLightIteration, const LightList* manualLightList = 0);
+
+        /// Utility class for calculating automatic parameters for gpu programs
+        AutoParamDataSource mAutoParamDataSource;
+
+        ShadowTechnique mShadowTechnique;
+        bool mDebugShadows;
+        ColourValue mShadowColour;
+        Pass* mShadowDebugPass;
+        Pass* mShadowStencilPass;
+        Pass* mShadowModulativePass;
+		bool mShadowMaterialInitDone;
+        LightList mLightsAffectingFrustum;
+        HardwareIndexBufferSharedPtr mShadowIndexBuffer;
+		size_t mShadowIndexBufferSize;
+        Rectangle2D* mFullScreenQuad;
+        Real mShadowDirLightExtrudeDist;
+        IlluminationRenderStage mIlluminationStage;
+        unsigned short mShadowTextureSize;
+        unsigned short mShadowTextureCount;
+		PixelFormat mShadowTextureFormat;
+        typedef std::vector<TexturePtr> ShadowTextureList;
+        ShadowTextureList mShadowTextures;
+		typedef std::vector<Camera*> ShadowTextureCameraList;
+		ShadowTextureCameraList mShadowTextureCameras;
+        Texture* mCurrentShadowTexture;
+		bool mShadowUseInfiniteFarPlane;
+
+        /** 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 createShadowTextures(unsigned short size, unsigned short count, 
+			PixelFormat fmt);
+        /// Internal method for destroying shadow textures (texture-based shadows)
+        virtual void destroyShadowTextures(void);
+        /// Internal method for preparing shadow textures ready for use in a regular render
+        virtual void prepareShadowTextures(Camera* cam, Viewport* vp);
+
+        /** 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
+        */
+        virtual void renderShadowVolumesToStencil(const Light* light, const Camera* cam);
+        /** 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 std::vector<ShadowCaster*> ShadowCasterList;
+        ShadowCasterList mShadowCasterList;
+        SphereSceneQuery* mShadowCasterSphereQuery;
+        AxisAlignedBoxSceneQuery* mShadowCasterAABBQuery;
+        Real mShadowFarDist;
+        Real mShadowFarDistSquared;
+        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 mShadowTextureCustomReceiverVertexProgram;
+		String mShadowTextureCustomReceiverFragmentProgram;
+		GpuProgramParametersSharedPtr mShadowTextureCustomCasterVPParams;
+		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
+        {
+        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 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 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);
+
+		/** 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(const Renderable* r);
+			bool visit(const Pass* p);
+			void visit(const 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;
+
+		};
+		/// Allow visitor helper to access protected methods
+		friend class SceneMgrQueuedRenderableVisitor;
+		/// The active renderable visitor class - subclasses could override this
+		SceneMgrQueuedRenderableVisitor* mActiveQueuedRenderableVisitor;
+		/// Storage for default renderable visitor
+		SceneMgrQueuedRenderableVisitor mDefaultQueuedRenderableVisitor;
+
+    public:
+        /** Constructor.
+        */
+        SceneManager(const String& instanceName);
+
+        /** Default destructor.
+        */
+        virtual ~SceneManager();
+
+		/** 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);
+
+		/** 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);
+
+        /** 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);
+
+		/** Returns whether a light with the given name exists.
+		*/
+		virtual bool hasLight(const String& name) const;
+
+		/** 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);
+
+        /** 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.
+        @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.
+        */
+        virtual void _populateLightList(const Vector3& position, Real radius, LightList& destList);
+
+
+        /** 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);
+
+        /** 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) const;
+
+        /** 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);
+
+        /** Prefab shapes available without loading a model.
+            @note
+                Minimal implementation at present.
+            @todo
+                Add more prefabs (teapots, teapots!!!)
+        */
+        enum PrefabType {
+            PT_PLANE
+        };
+
+        /** 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);
+        /** Retrieves a pointer to the named Entity. 
+		@note Throws an exception if the named instance does not exist
+		*/
+        virtual Entity* getEntity(const String& name);
+		/** 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);
+        /** Retrieves a pointer to the named ManualObject. 
+		@note Throws an exception if the named instance does not exist
+		*/
+        virtual ManualObject* getManualObject(const String& name);
+		/** 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);
+        /** Retrieves a pointer to the named BillboardChain. 
+		@note Throws an exception if the named instance does not exist
+		*/
+        virtual BillboardChain* getBillboardChain(const String& name);
+		/** 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);
+        /** Retrieves a pointer to the named RibbonTrail. 
+		@note Throws an exception if the named instance does not exist
+		*/
+        virtual RibbonTrail* getRibbonTrail(const String& name);
+		/** 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);
+        /** Retrieves a pointer to the named ParticleSystem. 
+		@note Throws an exception if the named instance does not exist
+		*/
+        virtual ParticleSystem* getParticleSystem(const String& name);
+		/** 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.
+            @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 (setWorldGeomtry),
+            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) { 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) { 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 failiure, 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 failiure, false is returned.
+        */
+        virtual bool setOption( const String& strKey, const 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 failiure, false is returned and pDestValue is set to NULL.
+        */
+        virtual bool getOption( const String& strKey, void* pDestValue ) { return false; }
+
+        /** Method for verifying wether 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 { 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 ) { 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 failiure, false is returned.
+        */
+        virtual bool getOptionKeys( StringVector& 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, 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 compatable 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);
+
+		/** 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);
+
+		/** 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 apparant '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);
+
+		/** 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);
+
+        /** Retrieves a pointer to the named BillboardSet.
+		@note Throws an exception if the named instance does not exist
+        */
+        virtual BillboardSet* getBillboardSet(const String& name);
+		/** 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. </p>
+            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);
+		/** 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
+        @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) ;
+
+        /** 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);
+
+		/** 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
+		@returns 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, unsigned long 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, unsigned long 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, unsigned long 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, unsigned long 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(unsigned long 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 specialised MapIterator over all animations in the scene. */
+        AnimationIterator getAnimationIterator(void) {
+            return AnimationIterator(mAnimationsList.begin(), mAnimationsList.end());
+        }
+        /** 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, whcih 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 maximum distance away from the camera that shadows
+        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.
+        */
+        virtual void setShadowFarDistance(Real distance);
+        /** Gets the maximum distance away from the camera that shadows
+        will be visible.
+        */
+        virtual Real getShadowFarDistance(void) const
+        { return mShadowFarDist; }
+
+		/** 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 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.
+        */
+        virtual void setShadowTextureSize(unsigned short size);
+        /// Get the size of the texture used for texture based shadows
+        unsigned short getShadowTextureSize(void) const {return mShadowTextureSize; }
+        /** 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.
+        */
+        virtual void setShadowTexturePixelFormat(PixelFormat fmt);
+        /// Get the format of the textures used for texture based shadows
+        PixelFormat getShadowTexturePixelFormat(void) const {return mShadowTextureFormat; }
+        /** 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(unsigned short count);
+        /// Get the number of the textures allocated for texture based shadows
+        unsigned short getShadowTextureCount(void) const {return mShadowTextureCount; }
+        /** Sets the size and count of textures used in texture-based shadows. 
+        @remarks
+            @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.
+        */
+        virtual void setShadowTextureSettings(unsigned short size, unsigned short count, 
+			PixelFormat fmt = PF_X8R8G8B8);
+        /** 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;}
+        /** 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
+			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
+			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 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 there any shadowing technique in use? */
+		virtual bool isShadowTechniqueInUse(void) const 
+		{ return mShadowTechnique != SHADOWTYPE_NONE; }
+
+		/** Add a shadow listener which will get called back on shadow
+			events.
+		*/
+		virtual void addShadowListener(ShadowListener* s);
+		/** Remove a shadow listener
+		*/
+		virtual void removeShadowListener(ShadowListener* 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
+		@returns 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);
+
+
+		/** 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);
+		/** 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);
+		/** 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. */
+		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.
+		*/
+		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; }
+
+		/** 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; }
+
+		/** 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);
+
+		/** 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
+            @returns
+                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);
+
+
+		/** 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);
+
+		/** 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) { return mCurrentViewport; }
+
+    };
+
+    /** 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
+	{
+	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
+
+
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIFontManager_implData.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIFontManager_implData.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIFontManager_implData.h	(revision 1812)
@@ -0,0 +1,45 @@
+/************************************************************************
+	filename: 	CEGUIFontManager_implData.h
+	created:	23/6/2004
+	author:		Paul D Turner
+	
+	purpose:	Implementation data for FontManager to break 
+				dependency on FreeType2 for clients
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIFontManager_implData_h_
+#define _CEGUIFontManager_implData_h_
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+struct FontManager::FontManagerImplData
+{
+	FT_Library		d_ftlib;		//!< FreeType library;
+};
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIFontManager_implData_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIExceptions.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIExceptions.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIExceptions.h	(revision 1812)
@@ -0,0 +1,184 @@
+/************************************************************************
+	filename: 	CEGUIExceptions.h
+	created:	20/2/2004
+	author:		Paul D Turner
+	
+	purpose:	Defines exceptions used within the system
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIExceptions_h_
+#define _CEGUIExceptions_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIString.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Root exception class used within the GUI system.
+*/
+class  CEGUIEXPORT Exception
+{
+public:
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	Exception(const String& message);
+	virtual ~Exception(void);
+
+	/*!
+	\brief
+		Return a reference to the String object describing the reason for the exception being thrown.
+
+	\return
+		String object containing a message describing the reason for the exception.
+	*/
+	const String&	getMessage(void) const		{return d_message;}
+
+
+protected:
+	String	d_message;
+};
+
+/*!
+\brief
+	Exception class used when none of the other classes are applicable
+*/
+class CEGUIEXPORT GenericException : public Exception
+{
+public:
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	GenericException(const String& message) : Exception(message) {}
+};
+
+/*!
+\brief
+	Exception class used when a request was made using a name of an unknown object
+*/
+class CEGUIEXPORT UnknownObjectException : public Exception
+{
+public:
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	UnknownObjectException(const String& message) : Exception(message) {}
+};
+
+/*!
+\brief
+	Exception class used when some impossible request was made for the current system state
+*/
+class CEGUIEXPORT InvalidRequestException : public Exception
+{
+public:
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	InvalidRequestException(const String& message) : Exception(message) {}
+};
+
+/*!
+\brief
+	Exception class used when a file handling problem occurs
+*/
+class CEGUIEXPORT FileIOException : public Exception
+{
+public:
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	FileIOException(const String& message) : Exception(message) {}
+};
+
+/*!
+\brief
+	Exception class used when an problem is detected within the Renderer or related objects
+*/
+class CEGUIEXPORT RendererException : public Exception
+{
+public:
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	RendererException(const String& message) : Exception(message) {}
+};
+
+/*!
+\brief
+	Exception class used when an attempt is made to use an object name that is already in use within the system
+*/
+class CEGUIEXPORT AlreadyExistsException : public Exception
+{
+public:
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	AlreadyExistsException(const String& message) : Exception(message) {}
+};
+
+/*!
+\brief
+	Exception class used when a memory handling error is detected
+*/
+class CEGUIEXPORT MemoryException : public Exception
+{
+public:
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	MemoryException(const String& message) : Exception(message) {}
+};
+
+/*!
+\brief
+	Exception class used when some required object or parameter is null
+*/
+class CEGUIEXPORT NullObjectException : public Exception
+{
+public:
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	NullObjectException(const String& message) : Exception(message) {}
+};
+
+/*!
+\brief
+	Exception class used when some attempt to delete, remove, or otherwise invalidate some object that is still in use occurs.
+*/
+class CEGUIEXPORT ObjectInUseException : public Exception
+{
+public:
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	ObjectInUseException(const String& message) : Exception(message) {}
+};
+
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIExceptions_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIFont_implData.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIFont_implData.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIFont_implData.h	(revision 1812)
@@ -0,0 +1,49 @@
+/************************************************************************
+	filename: 	CEGUIFont_implData.h
+	created:	23/6/2004
+	author:		Paul D Turner
+	
+	purpose:	Implementation data used within the Font class
+				Used to break dependency on FreeType2 for clients
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIFont_implData_h_
+#define _CEGUIFont_implData_h_
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+#include "CEGUIDataContainer.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+struct Font::FontImplData
+{
+	FontImplData(FT_Library lib) : library(lib) {}
+
+	FT_Library	library;
+	FT_Face		fontFace;
+    RawDataContainer fontData;
+};
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIFont_implData_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIImage.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIImage.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIImage.h	(revision 1812)
@@ -0,0 +1,495 @@
+/************************************************************************
+	filename: 	CEGUIImage.h
+	created:	13/3/2004
+	author:		Paul D Turner
+	
+	purpose:	Defines interface for Image class
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIImage_h_
+#define _CEGUIImage_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIString.h"
+#include "CEGUIRect.h"
+#include "CEGUIColourRect.h"
+#include "CEGUIVector.h"
+#include "CEGUISize.h"
+#include "CEGUIRenderer.h"
+#include <map>
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Class that represents a single Image of an Imageset.
+*/
+class CEGUIEXPORT Image
+{
+public:
+	/*!
+	\brief
+		Return a Size object containing the dimensions of the Image.
+
+	\return
+		Size object holding the width and height of the Image.
+	*/
+	Size	getSize(void) const			{return Size(d_scaledWidth, d_scaledHeight);}
+	
+
+	/*!
+	\brief
+		Return the pixel width of the image.
+
+	\return
+		Width of this Image in pixels.
+	*/
+	float	getWidth(void) const		{return d_scaledWidth;}
+
+
+	/*!
+	\brief
+		Return the pixel height of the image.
+
+	\return
+		Height of this Image in pixels
+	*/
+	float	getHeight(void) const		{return d_scaledHeight;}
+
+
+	/*!
+	\brief
+		Return a Point object that contains the offset applied when rendering this Image
+
+	\return
+		Point object containing the offsets applied when rendering this Image
+	*/
+	Point	getOffsets(void) const		{return d_scaledOffset;}
+
+
+	/*!
+	\brief
+		Return the X rendering offset
+
+	\return
+		X rendering offset.  This is the number of pixels that the image is offset by when rendering at any given location.
+	*/
+	float	getOffsetX(void) const		{return	d_scaledOffset.d_x;}
+
+
+	/*!
+	\brief
+		Return the Y rendering offset
+
+	\return
+		Y rendering offset.  This is the number of pixels that the image is offset by when rendering at any given location.
+	*/
+	float	getOffsetY(void) const		{return d_scaledOffset.d_y;}
+
+
+	/*!
+	\brief
+		Return the name of this Image object.
+
+	\return
+		String object containing the name of this Image
+	*/
+	const String&	getName(void) const;
+
+
+	/*!
+	\brief
+		Return the name of the Imageset that contains this Image
+
+	\return
+		String object containing the name of the Imageset which this Image is a part of.
+	*/
+	const String&	getImagesetName(void) const;
+
+    /*!
+    \brief
+        Return Rect describing the source texture area used by this Image.
+
+    \return
+        Rect object that describes, in pixels, the area upon the source texture
+        which is used when rendering this Image.
+    */
+    const Rect& getSourceTextureArea(void) const;
+
+	/*!
+	\brief
+		Queue the image to be drawn. 
+		
+	\note
+		The final position of the Image will be adjusted by the offset values defined for this Image object.  If absolute positioning is
+		essential then these values should be taken into account prior to calling the draw() methods.  However, by doing this you take
+		away the ability of the Imageset designer to adjust the alignment and positioning of Images, therefore your component is far
+		less useful since it requires code changes to modify image positioning that could have been handled from a data file.
+
+	\param position
+		Vector3 object containing the location where the Image is to be drawn
+
+	\param size
+		Size object describing the size that the Image is to be drawn at.
+
+	\param clip_rect
+		Rect object that defines an on-screen area that the Image will be clipped to when drawing.
+
+	\param top_left_colour
+		Colour (as 0xAARRGGBB value) to be applied to the top-left corner of the Image.
+
+	\param top_right_colour
+		Colour (as 0xAARRGGBB value) to be applied to the top-right corner of the Image.
+
+	\param bottom_left_colour
+		Colour (as 0xAARRGGBB value) to be applied to the bottom-left corner of the Image.
+
+	\param bottom_right_colour
+		Colour (as 0xAARRGGBB value) to be applied to the bottom-right corner of the Image.
+	
+	\param quad_split_mode
+		One of the QuadSplitMode values specifying the way quads are split into triangles
+
+	\return
+		Nothing
+	*/
+	void	draw(const Vector3& position, const Size& size, const Rect& clip_rect, const colour& top_left_colour = 0xFFFFFFFF, const colour& top_right_colour = 0xFFFFFFFF, const colour& bottom_left_colour = 0xFFFFFFFF, const colour& bottom_right_colour = 0xFFFFFFFF, QuadSplitMode quad_split_mode = TopLeftToBottomRight) const
+	{
+		draw(Rect(position.d_x, position.d_y, position.d_x + size.d_width, position.d_y + size.d_height), position.d_z, clip_rect, 
+			ColourRect(top_left_colour, top_right_colour, bottom_left_colour, bottom_right_colour), quad_split_mode);
+	}
+
+
+	/*!
+	\brief
+		Queue the image to be drawn.
+
+	\note
+		The final position of the Image will be adjusted by the offset values defined for this Image object.  If absolute positioning is
+		essential then these values should be taken into account prior to calling the draw() methods.  However, by doing this you take
+		away the ability of the Imageset designer to adjust the alignment and positioning of Images, therefore your component is far
+		less useful since it requires code changes to modify image positioning that could have been handled from a data file.
+
+	\param dest_rect
+		Rect object defining the area on-screen where the Image is to be drawn.  The Image will be scaled to fit the area as required.
+
+	\param z
+		Z-order position for the image.  Positions increase "into the screen", so 0.0f is at the top of the z-order.
+
+	\param clip_rect
+		Rect object that defines an on-screen area that the Image will be clipped to when drawing.
+
+	\param top_left_colour
+		Colour (as 0xAARRGGBB value) to be applied to the top-left corner of the Image.
+
+	\param top_right_colour
+		Colour (as 0xAARRGGBB value) to be applied to the top-right corner of the Image.
+
+	\param bottom_left_colour
+		Colour (as 0xAARRGGBB value) to be applied to the bottom-left corner of the Image.
+
+	\param bottom_right_colour
+		Colour (as 0xAARRGGBB value) to be applied to the bottom-right corner of the Image.
+	
+	\param quad_split_mode
+		One of the QuadSplitMode values specifying the way quads are split into triangles
+
+	\return
+		Nothing
+	*/
+	void	draw(const Rect& dest_rect, float z, const Rect& clip_rect, const colour& top_left_colour = 0xFFFFFFFF, const colour& top_right_colour = 0xFFFFFFFF, const colour& bottom_left_colour = 0xFFFFFFFF, const colour& bottom_right_colour = 0xFFFFFFFF, QuadSplitMode quad_split_mode = TopLeftToBottomRight) const
+	{
+		draw(dest_rect, z, clip_rect, ColourRect(top_left_colour, top_right_colour, bottom_left_colour, bottom_right_colour), quad_split_mode);
+	}
+
+
+	/*!
+	\brief
+		Queue the image to be drawn. 
+		
+	\note
+		The final position of the Image will be adjusted by the offset values defined for this Image object.  If absolute positioning is
+		essential then these values should be taken into account prior to calling the draw() methods.  However, by doing this you take
+		away the ability of the Imageset designer to adjust the alignment and positioning of Images, therefore your component is far
+		less useful since it requires code changes to modify image positioning that could have been handled from a data file.
+
+	\param position
+		Vector3 object containing the location where the Image is to be drawn
+
+	\param size
+		Size object describing the size that the Image is to be drawn at.
+
+	\param clip_rect
+		Rect object that defines an on-screen area that the Image will be clipped to when drawing.
+
+	\param colours
+		ColourRect object that describes the colour values to use for each corner of the Image.
+	
+	\param quad_split_mode
+		One of the QuadSplitMode values specifying the way quads are split into triangles
+
+	\return
+		Nothing
+	*/
+	void	draw(const Vector3& position, const Size& size, const Rect& clip_rect, const ColourRect& colours, QuadSplitMode quad_split_mode = TopLeftToBottomRight) const
+	{
+		draw(Rect(position.d_x, position.d_y, position.d_x + size.d_width, position.d_y + size.d_height), position.d_z, clip_rect, colours, quad_split_mode);
+	}
+
+
+	/*!
+	\brief
+		Queue the image to be drawn.
+
+	\note
+		The final position of the Image will be adjusted by the offset values defined for this Image object.  If absolute positioning is
+		essential then these values should be taken into account prior to calling the draw() methods.  However, by doing this you take
+		away the ability of the Imageset designer to adjust the alignment and positioning of Images, therefore your component is far
+		less useful since it requires code changes to modify image positioning that could have been handled from a data file.
+
+	\param position
+		Vector3 object containing the location where the Image is to be drawn
+
+	\note
+		The image will be drawn at it's internally defined size.
+
+	\param clip_rect
+		Rect object that defines an on-screen area that the Image will be clipped to when drawing.
+
+	\param colours
+		ColourRect object that describes the colour values to use for each corner of the Image.
+	
+	\param quad_split_mode
+		One of the QuadSplitMode values specifying the way quads are split into triangles
+
+	\return
+		Nothing
+	*/
+	void	draw(const Vector3& position, const Rect& clip_rect, const ColourRect& colours, QuadSplitMode quad_split_mode = TopLeftToBottomRight) const
+	{
+		draw(Rect(position.d_x, position.d_y, position.d_x + getWidth(), position.d_y + getHeight()), position.d_z, clip_rect, colours, quad_split_mode);
+	}
+
+
+	/*!
+	\brief
+		Queue the image to be drawn.
+
+	\note
+		The final position of the Image will be adjusted by the offset values defined for this Image object.  If absolute positioning is
+		essential then these values should be taken into account prior to calling the draw() methods.  However, by doing this you take
+		away the ability of the Imageset designer to adjust the alignment and positioning of Images, therefore your component is far
+		less useful since it requires code changes to modify image positioning that could have been handled from a data file.
+
+	\param position
+		Vector3 object containing the location where the Image is to be drawn
+
+	\param clip_rect
+		Rect object that defines an on-screen area that the Image will be clipped to when drawing.
+
+	\param top_left_colour
+		Colour (as 0xAARRGGBB value) to be applied to the top-left corner of the Image.
+
+	\param top_right_colour
+		Colour (as 0xAARRGGBB value) to be applied to the top-right corner of the Image.
+
+	\param bottom_left_colour
+		Colour (as 0xAARRGGBB value) to be applied to the bottom-left corner of the Image.
+
+	\param bottom_right_colour
+		Colour (as 0xAARRGGBB value) to be applied to the bottom-right corner of the Image.
+	
+	\param quad_split_mode
+		One of the QuadSplitMode values specifying the way quads are split into triangles
+
+	\return
+		Nothing
+	*/
+	void	draw(const Vector3& position, const Rect& clip_rect, const colour& top_left_colour = 0xFFFFFFFF, const colour& top_right_colour = 0xFFFFFFFF, const colour& bottom_left_colour = 0xFFFFFFFF, const colour& bottom_right_colour = 0xFFFFFFFF, QuadSplitMode quad_split_mode = TopLeftToBottomRight) const
+	{
+		draw(Rect(position.d_x, position.d_y, position.d_x + getWidth(), position.d_y + getHeight()), position.d_z, clip_rect, ColourRect(top_left_colour, top_right_colour, bottom_left_colour, bottom_right_colour), quad_split_mode);
+	}
+
+
+	/*!
+	\brief
+		Queue the image to be drawn.
+
+	\note
+		The final position of the Image will be adjusted by the offset values defined for this Image object.  If absolute positioning is
+		essential then these values should be taken into account prior to calling the draw() methods.  However, by doing this you take
+		away the ability of the Imageset designer to adjust the alignment and positioning of Images, therefore your component is far
+		less useful since it requires code changes to modify image positioning that could have been handled from a data file.
+
+	\param dest_rect
+		Rect object defining the area on-screen where the Image is to be drawn.  The Image will be scaled to fit the area as required.
+
+	\param z
+		Z-order position for the image.  Positions increase "into the screen", so 0.0f is at the top of the z-order.
+
+	\param clip_rect
+		Rect object that defines an on-screen area that the Image will be clipped to when drawing.
+
+	\param colours
+		ColourRect object that describes the colour values to use for each corner of the Image.
+	
+	\param quad_split_mode
+		One of the QuadSplitMode values specifying the way quads are split into triangles
+
+	\return
+		Nothing
+	*/
+	void	draw(const Rect& dest_rect, float z, const Rect& clip_rect,const ColourRect& colours, QuadSplitMode quad_split_mode = TopLeftToBottomRight) const;
+
+
+    /*!
+    \brief
+        Writes an xml representation of this Image object to \a out_stream.
+
+    \param out_stream
+        Stream where xml data should be output.
+
+    \return
+        Nothing.
+    */
+    void writeXMLToStream(OutStream& out_stream) const;
+
+
+	friend class std::map<String, Image>;
+	friend struct std::pair<const String, Image>;
+
+
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Default constructor (only used by std::map)
+	*/
+	Image(void) {}
+
+
+	/*!
+	\brief
+		Constructor for Image objects.  This is not normally used directly by client code, use the Imageset interface instead.
+
+	\param owner
+		Pointer to a Imageset object that owns this Image.  This must not be NULL.
+		
+	\param name
+		String object describing the name of the image being created.
+		
+	\param area
+		Rect object describing an area that will be associated with this image.
+		
+	\param render_offset
+		Point object that describes the offset to be applied when rendering this image.
+		
+	\param horzScaling
+		float value indicating the initial horizontal scaling to be applied to this image.
+
+	\param vertScaling
+		float value indicating the initial vertical scaling to be applied to this image.
+
+	\exception NullObjectException	Thrown if \a owner was NULL.
+	*/
+	Image(const Imageset* owner, const String& name, const Rect& area, const Point& render_offset, float horzScaling = 1.0f, float vertScaling = 1.0f);
+
+
+
+	/*!
+	\brief
+		Copy constructor
+	*/
+	Image(const Image& image);
+
+
+	/*!
+	\brief
+		Destructor for Image objects.
+	*/
+	~Image(void);
+
+
+private:
+	/*************************************************************************
+		Friends
+	*************************************************************************/
+	friend class Imageset;
+
+		
+	/*************************************************************************
+		Implementation Methods
+	*************************************************************************/
+	/*!
+	\brief
+		set the horizontal scaling factor to be applied to this Image
+
+	\param factor
+		float value describing the scaling factor required.
+
+	\return
+		Nothing.
+	*/
+	void	setHorzScaling(float factor);
+
+
+	/*!
+	\brief
+		set the vertical scaling factor to be applied to this Image
+
+	\param factor
+		float value describing the scaling factor required.
+
+	\return
+		Nothing.
+	*/
+	void	setVertScaling(float factor);
+
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	const Imageset*	d_owner;		//!< Link back to Imageset that owns this image
+	Rect			d_area;			//!< Rect defining the area on the texture that makes up this image.
+	Point			d_offset;		//!< Offset to use when rendering
+
+	// image auto-scaling fields.
+	float	d_scaledWidth;		//!< scaled image width.
+	float	d_scaledHeight;		//!< scaled image height.
+	Point	d_scaledOffset;		//!< scaled rendering offset.
+	String	d_name;				//!< name of this image.
+};
+
+} // End of  CEGUI namespace section
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIImage_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIScheme_xmlHandler.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIScheme_xmlHandler.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIScheme_xmlHandler.h	(revision 1812)
@@ -0,0 +1,105 @@
+/************************************************************************
+    filename:   CEGUIScheme_xmlHandler.h
+    created:    21/2/2004
+    author:     Paul D Turner
+    
+    purpose:    Defines abstract base class for the GUI Scheme object.
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+    
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+    
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+    
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIScheme_xmlHandler_h_
+#define _CEGUIScheme_xmlHandler_h_
+
+#include "CEGUIScheme.h"
+#include "CEGUIXMLHandler.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+    /*!
+    \brief
+        Handler class used to parse the Scheme XML files using SAX2
+    */
+    class Scheme_xmlHandler : public XMLHandler
+    {
+    public:
+        /*************************************************************************
+        Construction & Destruction
+        *************************************************************************/
+        /*!
+        \brief
+            Constructor for Scheme::xmlHandler objects
+
+        \param scheme
+            Pointer to the Scheme object creating this xmlHandler object
+        */
+        Scheme_xmlHandler(Scheme* scheme) : d_scheme(scheme)
+        {}
+
+        /*!
+        \brief
+            Destructor for Scheme::xmlHandler objects
+        */
+        virtual ~Scheme_xmlHandler(void)
+        {}
+
+        /*************************************************************************
+        SAX2 Handler overrides
+        *************************************************************************/
+        /*!
+        \brief
+            document processing (only care about elements, schema validates format)
+        */
+        virtual void elementStart(const String& element, const XMLAttributes& attributes);
+        virtual void elementEnd(const String& element);
+
+    private:
+        /*************************************************************************
+        Implementation Constants
+        *************************************************************************/
+        // XML related strings
+        static const String GUISchemeElement;               //!< Root GUIScheme element.
+        static const String ImagesetElement;                //!< Element specifying an Imageset
+        static const String ImagesetFromImageElement;       //!< Element specifying an Imageset to be created directly via an image file.
+        static const String FontElement;                    //!< Element specifying a Font
+        static const String WindowSetElement;               //!< Element specifying a module and set of WindowFactory elements.
+        static const String WindowFactoryElement;           //!< Element specifying a WindowFactory type.
+        static const String WindowAliasElement;             //!< Element specifying a WindowFactory type alias
+        static const String FalagardMappingElement;         //!< Element specifying a Falagard window mapping
+        static const String LookNFeelElement;               //!< Element specifying a LookNFeel.
+        static const String NameAttribute;                  //!< Attribute specifying the name of some object.
+        static const String FilenameAttribute;              //!< Attribute specifying the name of some file.
+        static const String AliasAttribute;                 //!< Attribute specifying an alias name.
+        static const String TargetAttribute;                //!< Attribute specifying target for an alias.
+        static const String ResourceGroupAttribute;         //!< Attribute specifying resource group for some loadable resource.
+        static const String WindowTypeAttribute;            //!< Attribute specifying the type of a window being created via a mapping.
+        static const String TargetTypeAttribute;            //!< Attribute specifying the base target type of a falagard mapped window type.
+        static const String LookNFeelAttribute;             //!< Attribute specifying the name of a LookNFeel for a falagard mapping..
+
+
+        /*************************************************************************
+        Implementation Data
+        *************************************************************************/
+        Scheme* d_scheme;           //!< Scheme object that we are helping to build
+    };
+
+} // End of  CEGUI namespace section
+
+#endif  // end of guard _CEGUIScheme_xmlHandler_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIForwardRefs.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIForwardRefs.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIForwardRefs.h	(revision 1812)
@@ -0,0 +1,114 @@
+/************************************************************************
+	filename: 	CEGUIForwardRefs.h
+	created:	21/2/2004
+	author:		Paul D Turner
+	
+	purpose:	Forward declares all core system classes
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIForwardRefs_h_
+#define _CEGUIForwardRefs_h_
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*************************************************************************
+	Forward reference declarations of all core GUI system classes
+*************************************************************************/
+class String;
+class Vector3;
+class Size;
+class Exception;
+class Rect;
+class ColourRect;
+class colour;
+class Texture;
+class Renderer;
+class Image;
+class Imageset;
+class ImagesetManager;
+class MouseCursor;
+class Font;
+class FontManager;
+class EventArgs;
+class Event;
+class EventSet;
+class Property;
+class PropertySet;
+class Window;
+class WindowFactory;
+class WindowManager;
+class Scheme;
+class SchemeManager;
+class System;
+class FactoryModule;
+class ScriptModule;
+class ResourceProvider;
+class DefaultResourceProvider;
+class PropertyReceiver;
+class GlobalEventSet;
+class XMLAttributes;
+class XMLHandler;
+class XMLParser;
+
+/*************************************************************************
+	Forward reference declarations for GUI element base classes
+*************************************************************************/
+class ButtonBase;
+class RadioButton;
+class Checkbox;
+class PushButton;
+class Titlebar;
+class FrameWindow;
+class Editbox;
+class Listbox;
+class Combobox;
+class ListHeaderSegment;
+class ListHeader;
+class MultiColumnList;
+class ProgressBar;
+class Thumb;
+class Scrollbar;
+class Slider;
+class Static;
+class StaticText;
+class StaticImage;
+class ListboxItem;
+class ListboxTextItem;
+class ComboDropList;
+class MultiLineEditbox;
+class Spinner;
+class GUISheet;
+class DragContainer;
+class ScrollablePane;
+class ScrolledContainer;
+class Tooltip;
+class ItemEntry;
+class TextItem;
+class MenuItem;
+class ItemListBase;
+class MenuBase;
+class Menubar;
+class PopupMenu;
+
+} // End of  CEGUI namespace section
+
+#endif	// end of guard _CEGUIForwardRefs_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIRefPtr.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIRefPtr.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIRefPtr.h	(revision 1812)
@@ -0,0 +1,130 @@
+/************************************************************************
+	filename: 	CEGUIRefPtr.h
+	created:	15/10/2004
+	author:		Gerald Lindsly
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIRefPtr_h_
+#define _CEGUIRefPtr_h_
+
+#include "CEGUIBase.h"
+
+namespace CEGUI {
+
+class CEGUIEXPORT Referenced
+{
+public:
+  Referenced() : d_refCount(0) {}
+  Referenced(const Referenced&) : d_refCount(0) {}
+
+  Referenced& operator=(Referenced&) { return *this; }
+
+  /* Increment the reference count by one, indicating that 
+      a pointer to this object is referencing it. */
+  void addRef() const { ++d_refCount; }
+  
+  /* Decrement the reference count by one, indicating that 
+     a pointer to this object is no longer referencing it. 
+     if the count drops to zero, this is deleted. */
+  void release() const { if (!--d_refCount) delete this; }
+  
+  /* Decrement the reference count by one, indicating that 
+      a pointer to this object is no longer referencing it;
+      however, do not delete it, even if ref count goes to 0. */
+  void releaseButKeep() const { --d_refCount; }
+  
+  /** return the number pointers currently referencing this object. */
+  int refCount() const { return d_refCount; }
+ 
+protected:
+  virtual ~Referenced();
+  mutable int d_refCount;
+};
+
+
+template<class T> class RefPtr
+{
+  T* d_p;
+
+public:
+//  RefPtr()     : d_p(0) {}
+  
+  RefPtr()     : d_p(new T()) { d_p->addRef(); }
+
+  RefPtr(T* t) : d_p(t) { if (t)   d_p->addRef(); }
+  RefPtr(const RefPtr& r) : d_p(r.d_p)
+                        { if (r.d_p) d_p->addRef(); }
+  ~RefPtr()
+  { if (d_p) {
+      d_p->release();
+      d_p = 0;
+    }
+  }
+
+  RefPtr& operator=(T* q)
+  {
+    if (d_p != q) {
+      T* t = d_p;
+      d_p = q;
+      if (q) q->addRef();
+      if (t) t->release();
+    }
+    return *this;
+  }
+
+  RefPtr& operator=(const RefPtr& r) { return *this = r.d_p; }
+
+  bool operator==(const RefPtr& r) const { return d_p == r.d_p; }
+  bool operator!=(const RefPtr& r) const { return d_p != r.d_p; }
+  bool operator< (const RefPtr& r) const { return d_p <  r.d_p; }
+  bool operator> (const RefPtr& r) const { return d_p >  r.d_p; }
+
+  bool operator ==(const T* q) const { return d_p == q; }
+  bool operator !=(const T* q) const { return d_p != q; }
+  bool operator < (const T* q) const { return d_p <  q; }
+  bool operator > (const T* q) const { return d_p >  q; }
+
+
+        T& operator*()        { return *d_p; }
+  const T& operator*() const  { return *d_p; }
+
+        T* operator->()       { return d_p; }
+  const T* operator->() const { return d_p; }
+
+        T* get()              { return d_p; }
+  const T* get() const        { return d_p; }
+
+  bool operator!() const	    { return d_p == 0; }
+  bool valid() const	        { return d_p != 0; }
+
+  T* release()
+  {
+    T* t = d_p;
+    if (d_p) {
+      d_p->releaseButKeep();
+      d_p = 0;
+    } 
+    return t;
+  }
+};
+
+} // end namespace CEGUI
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIResourceProvider.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIResourceProvider.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIResourceProvider.h	(revision 1812)
@@ -0,0 +1,132 @@
+/************************************************************************
+	filename: 	CEGUIResourceProvider.h
+	created:	8/7/2004
+	author:		James '_mental_' O'Sullivan
+	
+	purpose:	Defines abstract base class for loading DataContainer objects
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIResourceProvider_h_
+#define _CEGUIResourceProvider_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIDataContainer.h"
+#include "CEGUIString.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Abstract class that defines the required interface for all resource provider sub-classes.
+
+	A ResourceProvider is used to load both XML and binary data from an external source.  This could be from a filesystem or the resource manager of a specific renderer.
+*/
+class CEGUIEXPORT ResourceProvider
+{
+public:
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+    /*!
+    \brief
+        Constructor for the ResourceProvider class
+    */
+	ResourceProvider() { }
+
+    /*!
+    \brief
+        Destructor for the ResourceProvider class
+    */
+	virtual ~ResourceProvider(void) { }
+
+    /*************************************************************************
+        Accessor functions
+    *************************************************************************/
+
+//    /*!
+//    \brief
+//        Load XML data using InputSource objects.
+//
+//    \param filename
+//        String containing a filename of the resource to be loaded.
+//
+//	\param output
+//		Reference to a InputSourceContainer object to load the data into.
+//   */
+//    virtual void loadInputSourceContainer(const String& filename, InputSourceContainer& output) = 0;
+
+    /*!
+    \brief
+        Load raw binary data.
+
+    \param filename
+        String containing a filename of the resource to be loaded.
+
+	\param output
+        Reference to a RawDataContainer object to load the data into.
+
+    \param resourceGroup
+        Optional String that may be used by implementations to identify the group from
+        which the resource should be loaded.
+    */
+    virtual void loadRawDataContainer(const String& filename, RawDataContainer& output, const String& resourceGroup) = 0;
+
+    /*!
+    \brief
+        Unload raw binary data. This gives the resource provider a change to unload the data
+        in its own way before the data container object is destroyed.  If it does nothing,
+        then the object will release its memory.
+
+	\param data
+        Reference to a RawDataContainer object that is about to be destroyed.
+
+    */
+    virtual void unloadRawDataContainer(RawDataContainer& data)  { }
+
+    /*!
+    \brief
+        Return the current default resource group identifier.
+
+    \return
+        String object containing the currently set default resource group identifier.
+    */
+    const String&   getDefaultResourceGroup(void) const     { return d_defaultResourceGroup; }
+    
+    /*!
+    \brief
+        Set the default resource group identifier.
+
+    \param resourceGroup
+        String object containing the default resource group identifier to be used.
+
+    \return
+        Nothing.
+    */
+    void    setDefaultResourceGroup(const String& resourceGroup)    { d_defaultResourceGroup = resourceGroup; }
+
+protected:
+    String  d_defaultResourceGroup;     //!< Default resource group identifier.
+};
+
+} // End of  CEGUI namespace section
+
+#endif	// end of guard _CEGUIResourceProvider_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIRenderCache.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIRenderCache.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIRenderCache.h	(revision 1812)
@@ -0,0 +1,208 @@
+/************************************************************************
+    filename:   CEGUIRenderCache.h
+    created:    Fri Jun 17 2005
+    author:     Paul D Turner <paul@cegui.org.uk>
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+ 
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+ 
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+ 
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIRenderCache_h_
+#define _CEGUIRenderCache_h_
+
+#include "CEGUIVector.h"
+#include "CEGUIRect.h"
+#include "CEGUIImage.h"
+#include "CEGUIFont.h"
+#include <vector>
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+    /*!
+    \brief
+        Class that acts as a cache for images that need to be rendered.
+
+        This is in many ways an optimisation cache, it allows a full image redraw
+        to occur while limiting the amount of information that needs to be re-calculated.
+    \par
+        Basically, unless the actual images (or their size) change, or the colours (or alpha) change
+        then imagery cached in here will suffice for a full redraw.  The reasoning behind this is that
+        when some window underneath window 'X' changes, a full image redraw is required by the
+        renderer, however, since window 'X' is unchanged, performing a total recalculation of all
+        imagery is very wasteful, and so we use this cache to limit such waste.
+    \par
+        As another example, when a window is simply moved, there is no need to perform a total imagery
+        recalculation; we can still use the imagery cached here since it is position independant.
+    */
+    class CEGUIEXPORT RenderCache
+    {
+    public:
+        /*!
+        \brief
+            Constructor
+        */
+        RenderCache();
+
+        /*!
+        \brief
+            Destructor
+        */
+        ~RenderCache();
+
+        /*!
+        \brief
+            Return whether the cache contains anything to draw.
+
+        \return
+            - true if the cache contains information about images to be drawn.
+            - false if the cache is empty.
+        */
+        bool hasCachedImagery() const;
+
+        /*!
+        \brief
+            Send the contents of the cache to the Renderer.
+
+        \param basePos
+            Point that describes a screen offset that cached imagery will be rendered relative to.
+
+        \param baseZ
+            Z value that cached imagery will use as a base figure when calculating final z values.
+
+        \param clipper
+            Rect object describing a rect to which imagery will be clipped.
+
+        \return
+            Nothing
+        */
+        void render(const Point& basePos, float baseZ, const Rect& clipper) const;
+
+        /*!
+        \brief
+            Erase any stored image information.
+        */
+        void clearCachedImagery();
+
+        /*!
+        \brief
+            Add an image to the cache.
+
+        \param image
+            Image object to be cached.
+
+        \param destArea
+            Destination area over which the Image object will be rendered.  This area should be position
+            independant; so position (0,0) will be to top-left corner of whatever it is you're rendering
+            (like a Window for example).
+
+        \param zOffset
+            Zero based z offset for this image.  Allows imagery to be layered.
+
+        \param cols
+            ColourRect object describing the colours to be applied when rendering this image.
+
+        \return
+            Nothing
+        */
+        void cacheImage(const Image& image, const Rect& destArea, float zOffset, const ColourRect& cols, const Rect* clipper = 0, bool clipToDisplay = false);
+
+        /*!
+        \brief
+            Add a text to the cache.
+
+        \param text
+            String object to be cached.
+
+        \param font
+            Font to be used when rendering.
+
+        \param format
+            TextFormatting value specifying the formatting to use when rendering.
+
+        \param destArea
+            Destination area over which the Image object will be rendered.  This area should be position
+            independant; so position (0,0) will be to top-left corner of whatever it is you're rendering
+            (like a Window for example).
+
+        \param zOffset
+            Zero based z offset for this image.  Allows imagery to be layered.
+
+        \param cols
+            ColourRect object describing the colours to be applied when rendering this image.
+
+        \return
+            Nothing
+        */
+        void cacheText(const String& text, const Font* font, TextFormatting format, const Rect& destArea, float zOffset, const ColourRect& cols, const Rect* clipper = 0, bool clipToDisplay = false);
+
+    private:
+        /*!
+        \brief
+            internal struct that holds info about a single image to be drawn.
+        */
+        struct ImageInfo
+        {
+            const Image* source_image;
+            Rect target_area;
+            float z_offset;
+            ColourRect colours;
+            Rect customClipper;
+            bool usingCustomClipper;
+            bool clipToDisplay;
+        };
+
+        /*!
+        \brief
+            internal struct that holds info about text to be drawn.
+        */
+        struct TextInfo
+        {
+            String text;
+            const Font* source_font;
+            TextFormatting formatting;
+            Rect target_area;
+            float z_offset;
+            ColourRect colours;
+            Rect customClipper;
+            bool usingCustomClipper;
+            bool clipToDisplay;
+        };
+
+        typedef std::vector<ImageInfo>  ImageryList;
+        typedef std::vector<TextInfo>   TextList;
+
+        ImageryList d_cachedImages;     //!< Collection of ImageInfo structs.
+        TextList d_cachedTexts;         //!< Collection of TextInfo structs.
+    };
+
+} // End of  CEGUI namespace section
+
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+
+#endif  // end of guard _CEGUIRenderCache_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIConfig.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIConfig.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIConfig.h	(revision 1812)
@@ -0,0 +1,110 @@
+/************************************************************************
+	filename: 	CEGUIConfig.h
+	created:	1/10/2004
+	author:		Paul D Turner
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+//////////////////////////////////////////////////////////////////////////
+/*************************************************************************
+
+This file can be used to set certain configuration options which are used
+when compiling Crazy Eddie's GUI System and associated components.
+
+Each item in here has a comment to describe what it's for.
+
+*************************************************************************/
+//////////////////////////////////////////////////////////////////////////
+#ifndef _CEGUIConfig_h_
+#define _CEGUIConfig_h_
+
+
+//////////////////////////////////////////////////////////////////////////
+// Uncomment this line if you are using the 0.14.x or earlier release of Ogre.
+//////////////////////////////////////////////////////////////////////////
+//#define CEGUI_USEOLDOGRESTRING 1
+
+
+//////////////////////////////////////////////////////////////////////////
+// comment this line to suppress the auto appending of '_d' to loaded module
+// names under Win32.
+//////////////////////////////////////////////////////////////////////////
+#define CEGUI_LOAD_MODULE_APPEND_SUFFIX_FOR_DEBUG 1
+
+
+//////////////////////////////////////////////////////////////////////////
+// this is what gets appended to module names when 
+// CEGUI_LOAD_MODULE_APPEND_FOR_DEBUG is defined
+//////////////////////////////////////////////////////////////////////////
+#define CEGUI_LOAD_MODULE_DEBUG_SUFFIX	"_d"
+
+
+//////////////////////////////////////////////////////////////////////////
+// Comment this line to remove the alignment of elements to pixel
+// boundaries.  This may give you a performance boost at the expense
+// of visual quality
+//////////////////////////////////////////////////////////////////////////
+#define CEGUI_ALIGN_ELEMENTS_TO_PIXELS 1
+
+//////////////////////////////////////////////////////////////////////////
+// The following are intended for MSVC++ and X-Code users.
+// 
+// The Linux build can both auto-configure itself, and also take
+// configure parameters which control the settings presented below.
+//////////////////////////////////////////////////////////////////////////
+#if defined(_MSC_VER) || defined(__APPLE__)
+
+//////////////////////////////////////////////////////////////////////////
+// Comment this line if you wish to remove the Xerces-C++ dependency.
+// The system will revert to using an embedded version of TinyXML instead.
+//////////////////////////////////////////////////////////////////////////
+//#define CEGUI_WITH_XERCES
+
+//////////////////////////////////////////////////////////////////////////
+// Comment/Uncomment these lines to control renderer use in samples where
+// MSVC/XCode are used (since they don't auto-detect such things).
+//////////////////////////////////////////////////////////////////////////
+#define CEGUI_SAMPLES_USE_OPENGL
+//#define CEGUI_SAMPLES_USE_OGRE
+//#define CEGUI_SAMPLES_USE_IRRLICHT
+
+#endif // defined(_MSC_VER) || defined(__APPLE__)
+
+
+//////////////////////////////////////////////////////////////////////////
+// The following are intended for MSVC++ users.
+//////////////////////////////////////////////////////////////////////////
+#if defined(_MSC_VER)
+
+//////////////////////////////////////////////////////////////////////////
+// Comment/Uncomment these lines to control renderer use in samples where
+// MSVC is used (since it can't auto-detect such things).
+//////////////////////////////////////////////////////////////////////////
+//#define CEGUI_SAMPLES_USE_DIRECTX_8
+#define CEGUI_SAMPLES_USE_DIRECTX_9
+
+//////////////////////////////////////////////////////////////////////////
+// It is expected by now you are running a recent PSDK and not one that is
+// seven years old.  If you wish to try your luck, comment this line!
+//////////////////////////////////////////////////////////////////////////
+#define _STLP_NEW_PLATFORM_SDK
+
+#endif // defined(_MSC_VER)
+
+#endif	// end of guard _CEGUIConfig_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIXercesParser.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIXercesParser.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIXercesParser.h	(revision 1812)
@@ -0,0 +1,98 @@
+/************************************************************************
+    filename:   CEGUIXercesParser.h
+    created:    Sat Mar 12 2005
+    author:     Paul D Turner
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+ 
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+ 
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+ 
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIXercesParser_h_
+#define _CEGUIXercesParser_h_
+
+#include "CEGUIXMLParser.h"
+
+// Xerces-C includes
+#include <xercesc/framework/MemBufInputSource.hpp>
+#include <xercesc/util/PlatformUtils.hpp>
+#include <xercesc/util/TransService.hpp>
+#include <xercesc/util/XMLString.hpp>
+#include <xercesc/sax2/Attributes.hpp>
+#include <xercesc/sax2/DefaultHandler.hpp>
+#include <xercesc/sax2/SAX2XMLReader.hpp>
+#include <xercesc/sax2/XMLReaderFactory.hpp>
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+    class XercesHandler : public XERCES_CPP_NAMESPACE::DefaultHandler
+    {
+    public:
+        XercesHandler(XMLHandler& handler);
+        ~XercesHandler(void);
+
+        // Implementation of methods in Xerces DefaultHandler.
+        void startElement(const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname, const XERCES_CPP_NAMESPACE::Attributes& attrs);
+        void endElement(const XMLCh* const uri, const XMLCh* const localname, const XMLCh* const qname);
+        void warning (const XERCES_CPP_NAMESPACE::SAXParseException &exc);
+        void error (const XERCES_CPP_NAMESPACE::SAXParseException &exc);
+        void fatalError (const XERCES_CPP_NAMESPACE::SAXParseException &exc);
+
+    protected:
+        XMLHandler& d_handler;      //!< This is the 'real' CEGUI based handler which we interface via.
+    };
+
+    /*!
+    \brief
+        Implementation of XMLParser using Xerces-C++
+     */
+    class XercesParser : public XMLParser
+    {
+    public:
+        XercesParser(void);
+        ~XercesParser(void);
+
+        // Implementation of public abstract interface
+        void parseXMLFile(XMLHandler& handler, const String& filename, const String& schemaName, const String& resourceGroup);
+
+        // Internal methods
+        /*!
+        \brief
+            Populate the CEGUI::XMLAttributes object with attribute data from the Xerces attributes block.
+         */
+        static void populateAttributesBlock(const XERCES_CPP_NAMESPACE::Attributes& src, XMLAttributes& dest);
+
+        /*!
+        \brief
+            Return a CEGUI::String containing the Xerces XMLChar string data in \a xmlch_str.
+         */
+        static String transcodeXmlCharToString(const XMLCh* const xmlch_str);
+
+    protected:
+        static void initialiseSchema(XERCES_CPP_NAMESPACE::SAX2XMLReader* reader, const String& schemaName, const String& xmlFilename, const String& resourceGroup);
+        static XERCES_CPP_NAMESPACE::SAX2XMLReader* createReader(XERCES_CPP_NAMESPACE::DefaultHandler& handler);
+        static void doParse(XERCES_CPP_NAMESPACE::SAX2XMLReader* parser, const String& xmlFilename, const String& resourceGroup);
+
+        // Implementation of abstract interface.
+        bool initialiseImpl(void);
+        void cleanupImpl(void);
+    };
+
+} // End of  CEGUI namespace section
+
+
+#endif  // end of guard _CEGUIXercesParser_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIXMLAttributes.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIXMLAttributes.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIXMLAttributes.h	(revision 1812)
@@ -0,0 +1,244 @@
+/************************************************************************
+    filename:   CEGUIXMLAttributes.h
+    created:    Sat Mar 12 2005
+    author:     Paul D Turner
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+ 
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+ 
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+ 
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIXMLAttributes_h_
+#define _CEGUIXMLAttributes_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIString.h"
+#include <map>
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+    /*!
+    \brief
+        Class representing a block of attributes associated with an XML element.
+     */
+    class CEGUIEXPORT XMLAttributes
+    {
+    public:
+        /*!
+        \brief
+            XMLAttributes constructor.
+         */
+        XMLAttributes(void);
+
+        /*!
+        \brief
+            XMLAttributes Destructor
+         */
+        virtual ~XMLAttributes(void);
+
+        /*!
+        \brief
+            Adds an attribute to the attribute block.  If the attribute value already exists, it is replaced with
+            the new value.
+
+        \param attrName
+            String object holding the name of the attribute to be added.
+
+        \param attrValue
+            String object holding a string representation of the attribute value.
+
+        \return
+            Nothing.
+         */
+        void add(const String& attrName, const String& attrValue);
+        
+        /*!
+        \brief
+            Removes an attribute from the attribute block.
+
+        \param attrName
+            String object holding the name of the attribute to be removed.
+
+        \return
+            Nothing.
+         */
+        void remove(const String& attrName);
+
+        /*!
+        \brief
+            Return whether the named attribute exists within the attribute block.
+
+        \param attrName
+            String object holding the name of the attribute to be checked.
+
+        \return
+            - true if an attribute with the name \a attrName is present in the attribute block.
+            - false if no attribute named \a attrName is present in the attribute block.
+        */
+        bool exists(const String& attrName) const;
+
+        /*!
+        \brief
+            Return the number of attributes in the attribute block.
+
+        \return
+            value specifying the number of attributes in this attribute block.
+         */
+        size_t getCount(void) const;
+
+        /*!
+        \brief
+            Return the name of an attribute based upon its index within the attribute block.
+
+        \note
+            Nothing is specified about the order of elements within the attribute block.  Elements
+            may not, for example, appear in the order they were specified in the XML file.
+
+        \param index
+            zero based index of the attribute whos name is to be returned.
+
+        \return
+            String object holding the name of the attribute at the requested index.
+
+        \exception IllegalRequestException  thrown if \a index is out of range for this attribute block.
+        */
+        const String& getName(size_t index) const;
+        
+        /*!
+        \brief
+            Return the value string of an attribute based upon its index within the attribute block.
+
+        \note
+            Nothing is specified about the order of elements within the attribute block.  Elements
+            may not, for example, appear in the order they were specified in the XML file.
+        
+        \param index
+            zero based index of the attribute whos value string is to be returned.
+
+        \return
+            String object holding the string value of the attribute at the requested index.
+
+        \exception IllegalRequestException  thrown if \a index is out of range for this attribute block.
+        */
+        const String& getValue(size_t index) const;
+
+        /*!
+        \brief
+            Return the value string for attribute \a attrName.
+
+        \param attrName
+            String object holding the name of the attribute whos value string is to be returned
+
+        \return
+            String object hilding the value string for attribute \a attrName.
+
+        \exception UnknownObjectException   thrown if no attribute named \a attrName is present in the attribute block.
+         */
+        const String& getValue(const String& attrName) const;
+
+        /*!
+        \brief
+            Return the value of attribute \a attrName as a string.
+
+        \param attrName
+            String object holding the name of the attribute whos value is to be returned.
+
+        \param def
+            String object holding the default value to be returned if \a attrName does not exist in the attribute block.
+            For some parsers, defaults can be gotten from schemas and such like, though for others this may not be desired
+            or possible, so this parameter is used to ensure a default is available in the abscence of other mechanisms.
+
+        \return
+            String object containing the value of attribute \a attrName if present, or \a def if not.
+         */
+        const String& getValueAsString(const String& attrName, const String& def = "") const;
+
+        /*!
+        \brief
+            Return the value of attribute \a attrName as a boolean value.
+
+        \param attrName
+            String object holding the name of the attribute whos value is to be returned.
+
+        \param def
+            bool value specifying the default value to be returned if \a attrName does not exist in the attribute block.
+            For some parsers, defaults can be gotten from schemas and such like, though for others this may not be desired
+            or possible, so this parameter is used to ensure a default is available in the abscence of other mechanisms.
+
+        \return
+            bool value equal to the value of attribute \a attrName if present, or \a def if not.
+
+        \exception IllegalRequestException  thrown if the attribute value string coul dnot be converted to the requested type.
+        */
+        bool getValueAsBool(const String& attrName, bool def = false) const;
+        
+        /*!
+        \brief
+            Return the value of attribute \a attrName as a integer value.
+
+        \param attrName
+            String object holding the name of the attribute whos value is to be returned.
+
+        \param def
+            integer value specifying the default value to be returned if \a attrName does not exist in the attribute block.
+            For some parsers, defaults can be gotten from schemas and such like, though for others this may not be desired
+            or possible, so this parameter is used to ensure a default is available in the abscence of other mechanisms.
+
+        \return
+            integer value equal to the value of attribute \a attrName if present, or \a def if not.
+        
+        \exception IllegalRequestException  thrown if the attribute value string coul dnot be converted to the requested type.
+        */
+        int getValueAsInteger(const String& attrName, int def = 0) const;
+        
+        /*!
+        \brief
+            Return the value of attribute \a attrName as a floating point value.
+
+        \param attrName
+            String object holding the name of the attribute whos value is to be returned.
+
+        \param def
+            float value specifying the default value to be returned if \a attrName does not exist in the attribute block.
+            For some parsers, defaults can be gotten from schemas and such like, though for others this may not be desired
+            or possible, so this parameter is used to ensure a default is available in the abscence of other mechanisms.
+
+        \return
+            float value equal to the value of attribute \a attrName if present, or \a def if not.
+
+        \exception IllegalRequestException  thrown if the attribute value string coul dnot be converted to the requested type.
+        */
+        float getValueAsFloat(const String& attrName, float def = 0.0f) const;
+
+    protected:
+        typedef std::map<String, String> AttributeMap;
+        AttributeMap    d_attrs;
+    };
+
+} // End of  CEGUI namespace section
+
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif  // end of guard _CEGUIXMLAttributes_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIImageset_xmlHandler.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIImageset_xmlHandler.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIImageset_xmlHandler.h	(revision 1812)
@@ -0,0 +1,107 @@
+/************************************************************************
+filename: 	CEGUIImageset_xmlHandler.h
+created:	21/2/2004
+author:		Paul D Turner
+
+purpose:	Defines the interface for the Imageset class
+*************************************************************************/
+/*************************************************************************
+Crazy Eddie's GUI System (http://www.cegui.org.uk)
+Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIImageset_xmlHandler_h_
+#define _CEGUIImageset_xmlHandler_h_
+
+#include "CEGUIImageset.h"
+#include "CEGUIXMLHandler.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*************************************************************************
+Implementation Classes
+*************************************************************************/
+/*!
+\brief
+Handler class used to parse the Imageset XML files using SAX2
+*/
+class Imageset_xmlHandler : public XMLHandler
+{
+public:
+	/*************************************************************************
+	Construction & Destruction
+	*************************************************************************/
+	/*!
+	\brief
+	Constructor for Imageset::xmlHandler objects
+
+	\param imageset
+	Pointer to the Imageset object creating this xmlHandler object
+	*/
+	Imageset_xmlHandler(Imageset* imageset) : d_imageset(imageset) {}
+
+	/*!
+	\brief
+	Destructor for Imageset::xmlHandler objects
+	*/
+	virtual ~Imageset_xmlHandler(void) {}
+
+	/*************************************************************************
+	SAX2 Handler overrides
+	*************************************************************************/ 
+	/*!
+	\brief
+	document processing (only care about elements, schema validates format)
+	*/
+    virtual void elementStart(const String& element, const XMLAttributes& attributes);
+    virtual void elementEnd(const String& element);
+
+	/*************************************************************************
+	Functions used by our implementation
+	*************************************************************************/
+	Imageset*	getImageset(void) const				{return d_imageset;}
+
+private:
+	/*************************************************************************
+	Implementation Constants
+	*************************************************************************/
+	static const String ImagesetElement;				//!< Tag name for Imageset elements.
+	static const String ImageElement;					//!< Tag name for Image elements.
+	static const char	ImagesetNameAttribute[];		//!< Attribute name that stores the name of the Imageset
+	static const char	ImagesetImageFileAttribute[];	//!< Attribute name that stores the filename for the image file.
+    static const char	ImagesetResourceGroupAttribute[];   //!< Attribute name that stores the resource group identifier used when loading image file.
+	static const char	ImagesetNativeHorzResAttribute[];	//!< Optional attribute that stores 'native' horizontal resolution for the Imageset.
+	static const char	ImagesetNativeVertResAttribute[];	//!< Optional attribute that stores 'native' vertical resolution for the Imageset.
+	static const char	ImagesetAutoScaledAttribute[];	//!< Optional attribute that specifies whether the Imageset should be auto-scaled.
+	static const char	ImageNameAttribute[];			//!< Attribute name that stores the name of the new Image.
+	static const char	ImageXPosAttribute[];			//!< Attribute name that stores the x position of the new Image.
+	static const char	ImageYPosAttribute[];			//!< Attribute name that stores the y position of the new Image.
+	static const char	ImageWidthAttribute[];			//!< Attribute name that stores the width of the new Image.
+	static const char	ImageHeightAttribute[];			//!< Attribute name that stores the height of the new Image.
+	static const char	ImageXOffsetAttribute[];		//!< Attribute name that stores the x rendering offset of the new Image.
+	static const char	ImageYOffsetAttribute[];		//!< Attribute name that stores the y rendering offset of the new Image.
+
+	/*************************************************************************
+	Implementation Data
+	*************************************************************************/
+	Imageset*	d_imageset;			//!< Holds a pointer to the Imageset that created the handler object
+};
+
+} // End of  CEGUI namespace section
+
+#endif	// end of guard _CEGUIImageset_xmlHandler_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIFactoryModule.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIFactoryModule.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIFactoryModule.h	(revision 1812)
@@ -0,0 +1,142 @@
+/************************************************************************
+	filename: 	CEGUIFactoryModule.h
+	created:	12/4/2004
+	author:		Paul D Turner
+	
+	purpose:	Defines interface for object that controls a loadable
+				module (.dll/.so/ whatever) that contains concrete
+				window / widget implementations and their factories.
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIFactoryModule_h_
+#define _CEGUIFactoryModule_h_
+
+/*************************************************************************
+	The following is basically taken from DynLib.h, which is part of
+	the Ogre project (http://www.ogre3d.org/)
+*************************************************************************/
+#if defined(__WIN32__) || defined(_WIN32)
+#    define DYNLIB_HANDLE hInstance
+#    define DYNLIB_LOAD( a ) LoadLibrary( a )
+#    define DYNLIB_GETSYM( a, b ) GetProcAddress( a, b )
+#    define DYNLIB_UNLOAD( a ) !FreeLibrary( a )
+
+	struct HINSTANCE__;
+	typedef struct HINSTANCE__* hInstance;
+
+#elif defined(__linux__)
+#    define DYNLIB_HANDLE void*
+#    define DYNLIB_LOAD( a ) dlopen( a, RTLD_LAZY )
+#    define DYNLIB_GETSYM( a, b ) dlsym( a, b )
+#    define DYNLIB_UNLOAD( a ) dlclose( a )
+#    define DYNLIB_ERROR( ) dlerror( )
+
+#elif defined(__APPLE_CC__)
+#    define DYNLIB_HANDLE CFBundleRef
+#    define DYNLIB_LOAD( a ) mac_loadExeBundle( a )
+#    define DYNLIB_GETSYM( a, b ) mac_getBundleSym( a, b )
+#    define DYNLIB_UNLOAD( a ) mac_unloadExeBundle( a )
+#    define DYNLIB_ERROR( ) mac_errorBundle()
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+	Class that encapsulates access to a dynamic loadable module containing implementations of Windows, Widgets, and their factories.
+*/
+class FactoryModule
+{
+public:
+	/*!
+	\brief
+		Construct the FactoryModule object by loading the dynamic loadable module specified.
+
+	\param filename
+		String object holding the filename of a loadable module.
+
+	\return
+		Nothing
+	*/
+	FactoryModule(const String& filename);
+
+
+	/*!
+	\brief
+		Destroys the FactoryModule object and unloads any loadable module.
+
+	\return
+		Nothing
+	*/
+	virtual ~FactoryModule(void);
+
+
+	/*!
+	\brief
+		Register a WindowFactory for \a type Windows.
+
+	\param type
+		String object holding the name of the Window type a factory is to be registered for.
+
+	\return
+		Nothing.
+	*/
+	void	registerFactory(const String& type) const;
+
+
+    /*!
+    \brief
+        Register all factories available in this module.
+
+    \return
+        uint value indicating the number of factories registered.
+    */
+    uint registerAllFactories() const;
+
+private:
+    /*!
+    \brief
+        Return a String containing the last failure message from the platforms
+        dynamic loading system.
+    */
+    String getFailureString() const;
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	static const char	RegisterFactoryFunctionName[];
+    static const char   RegisterAllFunctionName[];
+
+	typedef void (*FactoryRegisterFunction)(const String&); 
+    typedef uint (*RegisterAllFunction)(void);
+
+	FactoryRegisterFunction	d_regFunc;	//!< Pointer to the function called to register factories.
+    RegisterAllFunction d_regAllFunc;   //!< Pointer to a function called to register all factories in a module.
+	String			d_moduleName;		//!< Holds the name of the loaded module.
+	DYNLIB_HANDLE	d_handle;			//!< Pointer to a ImplDat derived class that can hold any required implementation data
+};
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIFactoryModule_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIColourRect.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIColourRect.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIColourRect.h	(revision 1812)
@@ -0,0 +1,204 @@
+/************************************************************************
+	filename: 	CEGUIColourRect.h
+	created:	8/3/2004
+	author:		Paul D Turner
+	
+	purpose:	Defines class representing colours for four corners of a
+				rectangle
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIColourRect_h_
+#define _CEGUIColourRect_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIcolour.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Class that holds details of colours for the four corners of a rectangle.
+*/
+class CEGUIEXPORT ColourRect
+{
+public:
+	/*!
+	\brief
+		Default constructor
+	*/
+	ColourRect(void);
+
+
+	/*!
+	\brief
+		Constructor for ColourRect objects (via single colour).  Also handles default construction.
+	*/
+	ColourRect(const colour& col);
+
+
+	/*!
+	\brief
+		Constructor for ColourRect objects
+	*/
+	ColourRect(const colour& top_left, const colour& top_right, const colour& bottom_left, const colour& bottom_right);
+
+
+	/*!
+	\brief
+		Set the alpha value to use for all four corners of the ColourRect.
+
+	\param alpha
+		Alpha value to use.
+
+	\return
+		Nothing.
+	*/
+	void	setAlpha(float alpha);
+
+
+	/*!
+	\brief
+		Set the alpha value to use for the top edge of the ColourRect.
+
+	\param alpha
+		Alpha value to use.
+
+	\return
+		Nothing.
+	*/
+	void	setTopAlpha(float alpha);
+
+
+	/*!
+	\brief
+		Set the alpha value to use for the bottom edge of the ColourRect.
+
+	\param alpha
+		Alpha value to use.
+
+	\return
+		Nothing.
+	*/
+	void	setBottomAlpha(float alpha);
+
+
+	/*!
+	\brief
+		Set the alpha value to use for the left edge of the ColourRect.
+
+	\param alpha
+		Alpha value to use.
+
+	\return
+		Nothing.
+	*/
+	void	setLeftAlpha(float alpha);
+
+
+	/*!
+	\brief
+		Set the alpha value to use for the right edge of the ColourRect.
+
+	\param alpha
+		Alpha value to use.
+
+	\return
+		Nothing.
+	*/
+	void	setRightAlpha(float alpha);
+
+
+	/*!
+	\brief
+		Determinate the ColourRect is monochromatic or variegated.
+
+	\return
+		True if all four corners of the ColourRect has same colour, false otherwise.
+	*/
+	bool	isMonochromatic() const;
+
+
+	/*!
+	\brief
+		Gets a portion of this ColourRect as a subset ColourRect
+
+	\param left
+		The left side of this subrectangle (in the range of 0-1 float)
+	\param right
+		The right side of this subrectangle (in the range of 0-1 float)
+	\param top
+		The top side of this subrectangle (in the range of 0-1 float)
+	\param bottom
+		The bottom side of this subrectangle (in the range of 0-1 float)
+
+	\return
+		A ColourRect from the specified range
+	*/
+	ColourRect getSubRectangle( float left, float right, float top, float bottom ) const;
+
+	/*!
+	\brief
+		Get the colour at a point in the rectangle
+
+	\param x
+		The x coordinate of the point
+	\param y
+		The y coordinate of the point
+
+	\return
+		The colour at the specified point.
+	*/
+	colour getColourAtPoint( float x, float y ) const;
+
+
+	/*!
+	\brief
+		Set the colour of all four corners simultaneously.
+
+	\param col
+		colour that is to be set for all four corners of the ColourRect;
+	*/
+	void	setColours(const colour& col);
+
+
+	/*!
+	\brief
+		Module the alpha components of each corner's colour by a constant.
+
+	\param alpha
+		The constant factor to modulate all alpha colour components by.
+	*/
+	void	modulateAlpha(float alpha);
+
+    /*!
+    \brief
+        Modulate all components of this colour rect with corresponding components from another colour rect.
+    */
+    ColourRect& operator*=(const ColourRect& other);
+
+
+	colour	d_top_left, d_top_right, d_bottom_left, d_bottom_right;		//<! ColourRect component colours
+};
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIColourRect_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIEvent.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIEvent.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIEvent.h	(revision 1812)
@@ -0,0 +1,376 @@
+/************************************************************************
+	filename: CEGUIEvent.h
+	created:  15/10/2004
+	authors:  Paul D Turner (High-level design) 
+            Gerald Lindsly (Coder)
+	
+	purpose:  Defines interface for Event class
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIEvent_h_
+#define _CEGUIEvent_h_
+
+#if defined (_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4786)
+#	pragma warning(disable : 4251)
+#	if !defined (_MSC_EXTENSIONS)
+#		pragma warning (disable : 4224)
+#	endif
+#endif
+
+#include "CEGUIBase.h"
+#include "CEGUIString.h"
+#include "CEGUIEventArgs.h"
+#include "CEGUIRefPtr.h"
+
+#include <map>
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+    The base class for the various binders.  This provides a consistent
+    interface for firing functions bound to an event.
+*/
+template <typename Ret, typename Args>
+class SubscriberInterface {
+public:
+  virtual Ret operator()(Args) const = 0;
+  virtual ~SubscriberInterface() {}
+};
+
+
+/*!
+\brief
+    This class binds a free function.
+*/
+template <typename Ret, typename Args>
+class _freeBinder : public SubscriberInterface<Ret,Args>
+{
+public:
+  virtual Ret operator()(Args args) const 
+  {
+    return d_f(args);
+  }
+  typedef Ret (*SlotFunction)(Args);
+  _freeBinder(SlotFunction f) : d_f(f) {}
+protected:
+  SlotFunction d_f;
+};
+
+
+/*!
+\brief
+    This class binds a copy of a functor.
+*/
+template <class Functor, typename Ret, typename Args>
+class _functorBinder : public SubscriberInterface<Ret,Args>
+{
+public:
+  virtual Ret operator()(Args args) const 
+  {
+    return d_f(args);
+  }
+  _functorBinder(const Functor& f) : d_f(f) {}
+protected:
+  Functor d_f;
+};
+
+
+/*!
+\brief
+    This class binds a member function along with a target object.
+*/
+template <class T, typename Ret, typename Args>
+class _memberBinder : public SubscriberInterface<Ret,Args>
+{
+  typedef Ret (T::*F)(Args);
+public:
+  virtual Ret operator()(Args args) const
+  {
+    return (d_t->*d_f)(args);
+  }
+  _memberBinder(F f, T* t) : d_f(f), d_t(t) {}
+protected:
+  F  d_f;
+  T* d_t;
+};
+
+
+/*!
+\brief
+    This template describes the Subscriber class.  It is a wrapper
+    for a pointer to a SubscriberInterface with various constructors
+    that will by implicit conversion construct the various binders.
+*/
+template <typename Ret, typename Args>
+class SubscriberTemplate
+{
+public:
+  Ret operator()(Args args) const
+  {
+    return (*d_si)(args);  // call the bound function
+  }
+
+  typedef Ret (*SlotFunction)(Args);
+
+  //! construct from a free function
+  SubscriberTemplate(SlotFunction f)
+  {
+    d_si = new _freeBinder<Ret,Args>(f);
+  }
+
+  //! construct from a member function and a pointer to the target object.
+  template <class T>
+  SubscriberTemplate(Ret (T::*f)(Args), T* target)
+  {
+    d_si = new _memberBinder<T,Ret,Args>(f, target);
+  }
+
+  //! construct from a generalized functor by copying it
+  template <typename Functor> 
+  SubscriberTemplate(const Functor& f)
+  {
+    d_si = new _functorBinder<Functor,Ret,Args>(f);
+  }
+
+  /*!
+  \brief
+    construct from a preconstructed SubscriberInterface.
+    used for SubscriberRef().
+  */
+  SubscriberTemplate(SubscriberInterface<Ret,Args>* si) : d_si(si) {}
+
+  //! copy constructor
+  SubscriberTemplate(const SubscriberTemplate<Ret,Args>& copy) : d_si(copy.d_si) {}
+
+  //! 'less than' comparable for insertion in a map
+  bool operator<(const SubscriberTemplate<Ret,Args>& rhs) const { return d_si < rhs.d_si; }
+
+  //! release the binding -- called upon disconnection
+  void release() const
+  {
+    delete d_si;
+  }
+
+protected:
+  SubscriberInterface<Ret,Args>* d_si;
+};
+
+
+/*!
+\brief
+    This class binds a const reference to a generalized functor.
+    Sometimes it may not be appropriate for the functor to be
+    cloned.  In which case, use SubscriberRef() (which uses this).
+*/
+template <class Functor, typename Ret, typename Args>
+class _refBinder : public SubscriberInterface<Ret,Args>
+{
+public:
+  virtual Ret operator()(Args args) const
+  {
+    return d_f(args);
+  }
+  _refBinder(const Functor& f) : d_f(f) {}
+protected:
+  const Functor& d_f;
+};
+
+/*!
+\brief
+    This helper function produces a const reference binding
+*/
+template <class Functor>
+SubscriberInterface<bool, const EventArgs&>*
+SubscriberRef(const Functor& f)
+{
+  return new _refBinder<Functor,bool,const EventArgs&>(f);
+}
+
+
+/*!
+\brief
+	Defines an 'event' which can be subscribed to by interested parties.
+
+	An Event can be subscribed by a function, a member function, or a function object.  Whichever option
+	is taken, the function signature needs to be as follows
+	\par
+	<em>bool function_name(const EventArgs& args);</em>
+	\note
+		An Event object may not be copied.
+*/
+class CEGUIEXPORT Event
+{
+public:
+    /*!
+    \brief
+        Interface to be implemented by connection objects.
+    */
+	class ConnectionInterface : public Referenced {
+	public:
+		virtual bool connected() { return false; }
+		virtual void disconnect() {}
+	};
+	typedef RefPtr<ConnectionInterface> Connection;
+
+    /*!
+    \brief
+        A Connection object that automatically disconnects from the event
+        when the ScropedConnection object goes out of scope (and is deleted).
+    */
+	class ScopedConnection {
+	public:
+		ScopedConnection(Connection conn_) : conn(conn_) {}
+		~ScopedConnection() { conn->disconnect(); }
+		Connection conn;
+	};
+
+
+	typedef SubscriberTemplate<bool, const EventArgs&> Subscriber;
+	typedef int Group;
+
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructs a new Event object with the specified name
+	*/
+	Event(const String& name);
+
+	/*!
+	\brief
+		Destructor for Event objects
+	*/
+	virtual ~Event(void);
+
+
+	/*!
+	\brief
+		Return the name given to this Event object when it was created.
+
+	\return
+		String object containing the name of the Event object.
+	*/
+	const String& getName(void) const	{return d_name;}
+
+
+	/*!
+	\brief
+		Subscribes some function / object to the Event
+
+	\param subscriber
+		A function, static member function, or function object, with the signature void function_name(const EventArgs& args)
+
+	\return
+		A Connection pointer which can be used to disconnect (unsubscribe) from the Event, and to check the connection state.
+	*/
+	Connection subscribe(Subscriber subscriber) { return subscribe(0, subscriber); }
+
+
+	/*!
+	\brief
+		Subscribes some function / object to the Event
+
+	\param group
+		The Event group to subscribe to, subscription groups are called in ascending order, followed by subscriptions with no group.
+		connections to the same group may be called in any order.
+
+	\param subscriber
+		A function, static member function, or function object, with the signature void function_name(const EventArgs& args)
+
+	\return
+		A Connection which can be used to disconnect (unsubscribe) from the Event, and to check the connection state.
+	*/
+	Connection subscribe(Group group, Subscriber subscriber);
+  
+
+	/*
+	\brief
+		Fires the event.  All event subscribers get called in the appropriate sequence.
+
+	\param args
+		An object derived from EventArgs to be passed to each event subscriber.
+
+	\return
+		Nothing.
+	*/
+	void	operator()(EventArgs& args);
+
+private:
+	/*************************************************************************
+		Copy constructor and assignment are not allowed for events
+	*************************************************************************/
+	Event(const Event& evt)	{}
+	Event& operator=(const Event& evt)	{return *this;}
+
+	/*
+	\brief
+		removes the subscriber from the event.
+
+	\param subscriber
+		A pointer to a SubscriberInterface which is to be removed from the event.
+
+	\return
+		- true, if the subscriber was registered with the event in the specified group and it was removed.
+		- false, if not.
+	*/
+	bool unsubscribe(Subscriber subscriber, Group group=0);
+
+	class GroupSubscriber {
+	public:
+		Group group;
+		Subscriber subscriber;
+		GroupSubscriber(Group group_, Subscriber subscriber_) 
+			: group(group_), subscriber(subscriber_) {}
+	};
+
+	struct ltGroupSubscriber
+	{
+		bool operator()(const GroupSubscriber& gs1, const GroupSubscriber& gs2) const
+		{
+			return gs1.group <  gs2.group ||
+				gs1.group == gs2.group && gs1.subscriber < gs2.subscriber;
+		}
+	};
+	typedef std::map<GroupSubscriber, Connection, ltGroupSubscriber> ConnectionOrdering;
+
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	const String	d_name;		//!< Name of this event
+	ConnectionOrdering connectionOrdering;
+	friend class ConnectionImpl;
+};
+
+
+} // End of  CEGUI namespace section
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIEvent_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIConfig_xmlHandler.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIConfig_xmlHandler.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIConfig_xmlHandler.h	(revision 1812)
@@ -0,0 +1,158 @@
+/************************************************************************
+	filename: 	CEGUIConfig_xmlHandler.h
+	created:	17/7/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to configuration file parser
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIConfig_xmlHandler_h_
+#define _CEGUIConfig_xmlHandler_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIString.h"
+#include "CEGUILogger.h"
+#include "CEGUIXMLHandler.h"
+
+#include <vector>
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Handler class used to parse the Configuration XML file.
+*/
+class Config_xmlHandler : public XMLHandler
+{
+public:
+	/*************************************************************************
+		Construction & Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for GUILayout_xmlHandler objects
+	*/
+	Config_xmlHandler(void) {}
+
+	/*!
+	\brief
+		Destructor for GUILayout_xmlHandler objects
+	*/
+	virtual ~Config_xmlHandler(void) {}
+
+	/*************************************************************************
+		SAX2 Handler overrides
+	*************************************************************************/ 
+	/*!
+	\brief
+		document processing (only care about elements, schema validates format)
+	*/
+    virtual void elementStart(const String& element, const XMLAttributes& attributes);
+
+	/*************************************************************************
+		Functions used by our implementation
+	*************************************************************************/
+	/*!
+	\brief
+		Return log filename
+	*/
+	const String&	getLogFilename(void) const				{return d_logFilename;}
+
+
+	/*!
+	\brief
+		Return initial scheme filename to load
+	*/
+	const String&	getSchemeFilename(void) const			{return d_schemeFilename;}
+
+
+	/*!
+	\brief
+		Return initial layout filename to load and set as the GUI sheet.
+	*/
+	const String&	getLayoutFilename(void) const			{return d_layoutFilename;}
+
+
+	/*!
+	\brief
+		Return the name of the initialisation script to run
+	*/
+	const String&	getInitScriptFilename(void) const		{return d_initScriptFilename;}
+
+
+	/*!
+	\brief
+		Return the name of the termination script to run
+	*/
+	const String&	getTermScriptFilename(void) const		{return d_termScriptFilename;}
+
+
+	/*!
+	\brief
+		Return name of font to use as default.
+	*/
+	const String&	getDefaultFontName(void) const		{return d_defaultFontName;}
+
+
+	/*!
+	\brief
+		Return name of default resource group.
+	*/
+	const String&	getDefaultResourceGroup(void) const		{return d_defaultResourceGroup;}
+
+    /*!
+    \brief
+        Return logging level which was read from the config file.
+    */
+    LoggingLevel getLoggingLevel(void) const     {return d_logLevel;}
+
+
+private:
+	/*************************************************************************
+		Implementation Constants
+	*************************************************************************/
+	static const String CEGUIConfigElement;				//!< Tag name for CEGUIConfig elements.
+	static const char	ConfigLogfileAttribute[];			//!< Attribute name that stores the filename to use for the log.
+	static const char	ConfigSchemeAttribute[];			//!< Attribute name that stores the filename of a scheme to load.
+	static const char	ConfigLayoutAttribute[];			//!< Attribute name that stores the filename of a layout to load.
+	static const char	ConfigDefaultFontAttribute[];		//!< Attribute name that stores the name of the default font to set (as loaded by scheme)
+	static const char	ConfigInitScriptAttribute[];		//!< Attribute name that stores the filename of an initialisation script to run.
+	static const char	ConfigTerminateScriptAttribute[];	//!< Attribute name that stores the filename of a termination script to run.
+    static const char   ConfigDefaultResourceGroupAttribute[]; //!< Attribute name that stores the default resource group (also used when loading config resources).
+    static const char   ConfigLoggingLevelAttribute[];      //!< Attribute name that stores the logging level to be used.
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	String		d_logFilename;			//!< filename for the log.
+	String		d_schemeFilename;		//!< filename for the scheme to auto-load.
+	String		d_layoutFilename;		//!< filename for the layout to auto-load.
+	String		d_initScriptFilename;	//!< filename for the script to run after system init.
+	String		d_termScriptFilename;	//!< filename for the script to run before system shutdown.
+	String		d_defaultFontName;		//!< Holds name of default font to set.
+    String      d_defaultResourceGroup; //!< Holds default resource group name.
+    LoggingLevel    d_logLevel;         //!< Holds the logging level read from the config.
+};
+
+
+} // End of  CEGUI namespace section
+
+#endif	// end of guard _CEGUIConfig_xmlHandler_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIProperty.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIProperty.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIProperty.h	(revision 1812)
@@ -0,0 +1,190 @@
+/************************************************************************
+	filename: 	CEGUIProperty.h
+	created:	21/2/2004
+	author:		Paul D Turner
+	
+	purpose:	Defines the Property class which forms part of a
+				PropertySet
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIProperty_h_
+#define _CEGUIProperty_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIString.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+	Dummy base class to ensure correct casting of receivers.
+*/
+class CEGUIEXPORT PropertyReceiver
+{
+public:
+	PropertyReceiver() {}
+	virtual ~PropertyReceiver() {}
+};
+
+
+/*!
+\brief
+	An abstract class that defines the interface to access object properties by name.
+
+	Property objects allow (via a PropertySet) access to certain properties of objects
+	by using simple get/set functions and the name of the property to be accessed.
+*/
+class CEGUIEXPORT Property
+{
+public:
+	/*!
+	\brief
+		Creates a new Property object.
+
+	\param name
+		String containing the name of the new Property.
+
+	\param help
+		String containing a description of the Property and it's usage.
+		
+	\param defaultValue
+		String holding the textual representation of the default value for this Property
+
+    \param writesXML
+        Specifies whether the writeXMLToStream method should do anything for this Property.  This
+        enables selectivity in what properties within a PropertySet will get output as XML.
+	*/
+	Property(const String& name, const String& help, const String& defaultValue = "", bool writesXML = true) :
+	  d_name(name),
+	  d_help(help),
+	  d_default(defaultValue),
+	  d_writeXML(writesXML)
+	{
+	}
+
+
+	/*!
+	\brief
+		Destructor for Property objects
+	*/
+	virtual ~Property(void) {}
+
+
+	/*!
+	\brief
+		Return a String that describes the purpose and usage of this Property.
+
+	\return
+		String that contains the help text
+	*/
+	const String& getHelp(void) const		{return d_help;}
+
+
+	/*!
+	\brief
+		Return a the name of this Property
+
+	\return
+		String containing the name of the Property
+	*/
+	const String& getName(void) const		{return d_name;}
+
+
+	/*!
+	\brief
+		Return the current value of the Property as a String
+
+	\param receiver
+		Pointer to the target object.
+
+	\return
+		String object containing a textual representation of the current value of the Property
+	*/
+	virtual String	get(const PropertyReceiver* receiver) const = 0;
+
+
+	/*!
+	\brief
+		Sets the value of the property
+
+	\param receiver
+		Pointer to the target object.
+
+	\param value
+		A String object that contains a textual representation of the new value to assign to the Property.
+
+	\return
+		Nothing.
+
+	\exception InvalidRequestException	Thrown when the Property was unable to interpret the content of \a value.
+	*/
+	virtual void	set(PropertyReceiver* receiver, const String& value) = 0;
+
+
+	/*!
+	\brief
+		Returns whether the property is at it's default value.
+
+	\param receiver
+		Pointer to the target object.
+
+	\return
+		- true if the property has it's default value.
+		- false if the property has been modified from it's default value.
+	*/
+	virtual bool	isDefault(const PropertyReceiver* receiver) const;
+
+
+	/*!
+	\brief
+		Returns the default value of the Property as a String.
+
+	\param receiver
+		Pointer to the target object.
+
+	\return
+		String object containing a textual representation of the default value for this property.
+	*/
+	virtual String	getDefault(const PropertyReceiver* receiver) const;
+
+
+    /*!
+    \brief
+        Writes out an XML representation of this class to the given stream.
+
+    \note
+        This would normally have been implemented via XMLGenerator base class, but in this
+        case we require the target PropertyReceiver in order to obtain the property value.
+    */
+    void writeXMLToStream(const PropertyReceiver* receiver, OutStream& out_stream) const;
+
+protected:
+	String	d_name;		//!< String that stores the Property name.
+	String	d_help;		//!< String that stores the Property help text.
+	String	d_default;	//!< String that stores the Property default value string.
+	bool    d_writeXML; //!< Specifies whether writeXMLToStream should do anything for this property.
+};
+
+} // End of  CEGUI namespace section
+
+#endif	// end of guard _CEGUIProperty_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIPropertyHelper.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIPropertyHelper.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIPropertyHelper.h	(revision 1812)
@@ -0,0 +1,76 @@
+/************************************************************************
+	filename: 	CEGUIPropertyHelper.h
+	created:	6/7/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to the PropertyHelper class
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIPropertyHelper_h_
+#define _CEGUIPropertyHelper_h_
+
+#include "CEGUIWindow.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Helper class used to convert various data types to and from the format expected in Propery strings
+*/
+class CEGUIEXPORT PropertyHelper
+{
+public:
+	static	float	stringToFloat(const String& str);
+	static	uint	stringToUint(const String& str);
+	static	int		stringToInt(const String& str);
+	static	bool	stringToBool(const String& str);
+	static	Size	stringToSize(const String& str);
+	static	Point	stringToPoint(const String& str);
+	static	Rect	stringToRect(const String& str);
+	static	MetricsMode	stringToMetricsMode(const String& str);
+	static const Image*	stringToImage(const String& str);
+	static	colour	stringToColour(const String& str);
+	static	ColourRect	stringToColourRect(const String& str);
+	static	UDim	stringToUDim(const String& str);
+	static	UVector2	stringToUVector2(const String& str);
+	static	URect	stringToURect(const String& str);
+
+	static String	floatToString(float val);
+	static String	uintToString(uint val);
+	static String	intToString(int val);
+	static String	boolToString(bool val);
+	static String	sizeToString(const Size& val);
+	static String	pointToString(const Point& val);
+	static String	rectToString(const Rect& val);
+	static String	metricsModeToString(MetricsMode val);
+	static String	imageToString(const Image* const val);
+	static String	colourToString(const colour& val);
+	static String	colourRectToString(const ColourRect& val);
+	static String	udimToString(const UDim& val);
+	static String	uvector2ToString(const UVector2& val);
+	static String	urectToString(const URect& val);
+};
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIPropertyHelper_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIMouseCursor.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIMouseCursor.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIMouseCursor.h	(revision 1812)
@@ -0,0 +1,329 @@
+/************************************************************************
+	filename: 	CEGUIMouseCursor.h
+	created:	21/2/2004
+	author:		Paul D Turner
+	
+	purpose:	Defines interface for the MouseCursor class
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIMouseCursor_h_
+#define _CEGUIMouseCursor_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIString.h"
+#include "CEGUISingleton.h"
+#include "CEGUIVector.h"
+#include "CEGUIRect.h"
+#include "CEGUIEventSet.h"
+#include "CEGUIInputEvent.h"
+#include "CEGUIUDim.h"
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4275)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+	Enumeration of special values used for mouse cursor settings in Window objects.
+*/
+enum MouseCursorImage
+{		
+	BlankMouseCursor	= 0,		//!< No image should be displayed for the mouse cursor.
+	DefaultMouseCursor	= -1		//!< The default mouse cursor image should be displayed.
+};
+
+
+/*!
+\brief
+	Class that allows access to the GUI system mouse cursor.
+
+	The MouseCursor provides functionality to access the position and imagery of the mouse cursor / pointer
+*/
+class CEGUIEXPORT MouseCursor : public EventSet, public Singleton<MouseCursor>
+{
+public:
+	static const String EventNamespace;				//!< Namespace for global events
+
+	/*************************************************************************
+		Event name constants
+	*************************************************************************/
+	// generated internally by MouseCursor
+	static const String EventImageChanged;			//!< The cursor image of the widget has changed.
+
+
+	/*!
+	\brief
+		Constructor for MouseCursor objects
+	*/
+	MouseCursor(void);
+
+
+	/*!
+	\brief
+		Destructor for MouseCursor objects
+	*/
+	~MouseCursor(void);
+
+
+	/*!
+	\brief
+		Return singleton MouseCursor object
+
+	\return
+		Singleton MouseCursor object
+	*/
+	static	MouseCursor&	getSingleton(void);
+
+
+	/*!
+	\brief
+		Return pointer to singleton MouseCursor object
+
+	\return
+		Pointer to singleton MouseCursor object
+	*/
+	static	MouseCursor*	getSingletonPtr(void);
+
+
+	/*!
+	\brief
+		Set the current mouse cursor image
+
+	\param imageset
+		String object holding the name of the Imageset that contains the desired Image.
+
+	\param image_name
+		String object holding the name of the desired Image on Imageset \a imageset.
+
+	\return
+		Nothing.
+
+	\exception UnknownObjectException	thrown if \a imageset is not known, or if \a imageset contains no Image named \a image_name.
+	*/
+	void	setImage(const String& imageset, const String& image_name);
+
+
+	/*!
+	\brief
+		Set the current mouse cursor image
+	*/
+	void	setImage(const Image* image);
+
+
+	/*!
+	\brief
+		Get the current mouse cursor image
+	\return
+		The current image used to draw mouse cursor.
+	*/
+	const Image*	getImage(void) const	{return d_cursorImage;}
+
+
+	/*!
+	\brief
+		Makes the cursor draw itself
+
+	\return
+		Nothing
+	*/
+	void	draw(void) const;
+
+
+	/*!
+	\brief
+		Set the current mouse cursor position
+
+	\param position
+		Point object describing the new location for the mouse.  This will be clipped to within the renderer screen area.
+	*/
+	void	setPosition(const Point& position);
+
+
+	/*!
+	\brief
+		Offset the mouse cursor position by the deltas specified in \a offset.
+
+	\param offset
+		Point object which describes the amount to move the cursor in each axis.
+
+	\return
+		Nothing.
+	*/
+	void	offsetPosition(const Point& offset);
+
+
+	/*!
+	\brief
+		Set the area that the mouse cursor is constrained to.
+
+	\param area
+		Pointer to a Rect object that describes the area of the display that the mouse is allowed to occupy.  The given area will be clipped to
+		the current Renderer screen area - it is never possible for the mouse to leave this area.  If this parameter is NULL, the
+		constraint is set to the size of the current Renderer screen area.
+
+	\return
+		Nothing.
+	*/
+	void	setConstraintArea(const Rect* area);
+
+
+	/*!
+	\brief
+		Set the area that the mouse cursor is constrained to.
+
+	\param area
+		Pointer to a URect object that describes the area of the display that the mouse is allowed to occupy.  The given area will be clipped to
+		the current Renderer screen area - it is never possible for the mouse to leave this area.  If this parameter is NULL, the
+		constraint is set to the size of the current Renderer screen area.
+
+	\return
+		Nothing.
+	*/
+	void	setUnifiedConstraintArea(const URect* area);
+
+
+	/*!
+	\brief
+		Hides the mouse cursor.
+
+	\return
+		Nothing.
+	*/
+	void	hide(void)		{d_visible = false;}
+
+
+	/*!
+	\brief
+		Shows the mouse cursor.
+
+	\return
+		Nothing.
+	*/
+	void	show(void)		{d_visible = true;}
+
+
+	/*!
+	\brief
+		return whether the mouse cursor is visible.
+
+	\return
+		true if the mouse cursor is visible, false if the mouse cursor is hidden.
+	*/
+	bool	isVisible(void) const	{return d_visible;}
+
+
+	/*!
+	\brief
+		Return the current mouse cursor position as a pixel offset from the top-left corner of the display.
+
+	\return
+		Point object describing the mouse cursor position in screen pixels.
+	*/
+	Point	getPosition(void) const		{return Point(d_position.d_x, d_position.d_y);}
+
+
+	/*!
+	\brief
+		return the current constraint area of the mouse cursor.
+
+	\return
+		Rect object describing the active area that the mouse cursor is constrained to.
+	*/
+	Rect	getConstraintArea(void) const;
+
+
+	/*!
+	\brief
+		return the current constraint area of the mouse cursor.
+
+	\return
+		URect object describing the active area that the mouse cursor is constrained to.
+	*/
+	const URect& getUnifiedConstraintArea(void) const;
+
+
+	/*!
+	\brief
+		Return the current mouse cursor position as display resolution independant values.
+
+	\return
+		Point object describing the current mouse cursor position as resolution independant values that
+		range from 0.0f to 1.0f, where 0.0f represents the left-most and top-most positions, and 1.0f
+		represents the right-most and bottom-most positions.
+	*/
+	Point	getDisplayIndependantPosition(void) const;
+
+
+protected:
+	/*************************************************************************
+		New event handlers
+	*************************************************************************/
+	/*!
+	\brief
+		event triggered internally when image of mouse cursor changes
+	*/
+	virtual void	onImageChanged(MouseCursorEventArgs& e);
+
+
+	/*************************************************************************
+		Implementation Functions
+	*************************************************************************/
+	/*!
+	\brief
+		Add mouse cursor specific events
+	*/
+	void	addMouseCursorEvents(void);
+
+
+private:
+	/*************************************************************************
+		Implementation Methods
+	*************************************************************************/
+	/*!
+	\brief
+		Checks the mouse cursor position is within the current 'constrain' Rect and adjusts as required.
+	*/
+	void	constrainPosition(void);
+
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	const Image*	d_cursorImage;		//!< Image that is currently set as the mouse cursor.
+	Vector3	d_position;					//!< Current location of the cursor
+	bool	d_visible;					//!< true if the cursor will be drawn, else false.
+	URect	d_constraints;				//!< Specifies the area (in screen pixels) that the mouse can move around in.
+};
+
+} // End of  CEGUI namespace section
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIMouseCursor_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIRect.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIRect.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIRect.h	(revision 1812)
@@ -0,0 +1,213 @@
+/************************************************************************
+	filename: 	CEGUIRect.h
+	created:	8/3/2004
+	author:		Paul D Turner
+	
+	purpose:	Defines 'Rect' class
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIRect_h_
+#define _CEGUIRect_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIVector.h"
+#include "CEGUISize.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Class encapsulating operations on a Rectangle
+*/
+class CEGUIEXPORT Rect
+{
+public:
+	Rect(void) {}
+
+
+	/*!
+	\brief
+		Constructor for a Rect.
+	*/
+	Rect(float left, float top, float right, float bottom);
+
+    Rect(Point pos, Size sz);
+
+
+	/*!
+	\brief
+		Return top-left postion of Rect as a Point
+	*/
+	Point	getPosition(void) const		{return Point(d_left, d_top);}
+
+	/*!
+	\brief
+		return width of Rect area
+	*/
+	float	getWidth(void) const		{return d_right - d_left;}
+
+
+	/*!
+	\brief
+		return height of Rect area
+	*/
+	float	getHeight(void) const		{return d_bottom - d_top;}
+
+
+	/*!
+	\brief
+		return the size of the Rect area
+	*/
+	Size	getSize(void) const			{return Size(getWidth(), getHeight());}
+
+
+	/*!
+	\brief
+		set the position of the Rect (leaves size in tact)
+	*/
+	void	setPosition(const Point& pt);
+
+
+	/*!
+	\brief
+		set the width of the Rect object
+	*/
+	void	setWidth(float width)		{d_right = d_left + width;}
+
+	/*!
+	\brief
+		set the height of the Rect object
+	*/
+	void	setHeight(float height)		{d_bottom = d_top + height;}
+
+
+	/*!
+	\brief
+		set the size of the Rect area
+	*/
+	void	setSize(const Size& sze)	{setWidth(sze.d_width); setHeight(sze.d_height);}
+
+
+	/*!
+	\brief
+		return a Rect that is the intersection of 'this' Rect with the Rect 'rect'
+
+	\note
+		It can be assumed that if d_left == d_right, or d_top == d_bottom, or getWidth() == 0, or getHeight() == 0, then
+		'this' rect was totally outside 'rect'.
+	*/
+	Rect	getIntersection(const Rect& rect) const;
+
+
+	/*!
+	\brief
+		Applies an offset the Rect object
+
+	\param pt
+		Point object containing the offsets to be applied to the Rect.
+
+	\return
+		this Rect after the offset is performed
+	*/
+	Rect&	offset(const Point& pt);
+
+
+	/*!
+	\brief
+		Return true if the given Point falls within this Rect
+
+	\param pt
+		Point object describing the position to test.
+
+	\return
+		true if position \a pt is within this Rect's area, else false
+	*/
+	bool	isPointInRect(const Point& pt) const;
+
+
+	/*!
+	\brief
+		check the size of the Rect object and if it is bigger than \a sz, resize it so it isn't.
+
+	\param sz
+		Size object that describes the maximum dimensions that this Rect should be limited to.
+
+	\return
+		'this' Rect object after the constrain operation
+	*/
+	Rect&	constrainSizeMax(const Size& sz);
+
+
+	/*!
+	\brief
+		check the size of the Rect object and if it is smaller than \a sz, resize it so it isn't.
+
+	\param sz
+		Size object that describes the minimum dimensions that this Rect should be limited to.
+
+	\return
+		'this' Rect object after the constrain operation
+	*/
+	Rect&	constrainSizeMin(const Size& sz);
+
+
+	/*!
+	\brief
+		check the size of the Rect object and if it is bigger than \a max_sz or smaller than \a min_sz, resize it so it isn't.
+
+	\param max_sz
+		Size object that describes the maximum dimensions that this Rect should be limited to.
+
+	\param min_sz
+		Size object that describes the minimum dimensions that this Rect should be limited to.
+
+	\return
+		'this' Rect object after the constrain operation
+	*/
+	Rect&	constrainSize(const Size& max_sz, const Size& min_sz);
+
+
+	/*************************************************************************
+		Operators
+	*************************************************************************/
+	bool	operator==(const Rect& rhs) const
+	{
+		return ((d_left == rhs.d_left) && (d_right == rhs.d_right) && (d_top == rhs.d_top) && (d_bottom == rhs.d_bottom));
+	}
+
+	bool	operator!=(const Rect& rhs) const		{return !operator==(rhs);}
+
+	Rect&	operator=(const Rect& rhs);
+
+    Rect operator*(float scalar) const      { return Rect(d_left * scalar, d_top * scalar, d_right * scalar, d_bottom * scalar); }
+    const Rect& operator*=(float scalar)    { d_left *= scalar; d_top *= scalar; d_right *= scalar; d_bottom *= scalar; return *this; }
+
+
+	/*************************************************************************
+		Data Fields
+	*************************************************************************/
+	float	d_top, d_bottom, d_left, d_right;
+};
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIRect_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIXMLHandler.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIXMLHandler.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIXMLHandler.h	(revision 1812)
@@ -0,0 +1,79 @@
+/************************************************************************
+    filename:   CEGUIXMLHandler.h
+    created:    12/3/2005
+    author:     Paul D Turner
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+ 
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+ 
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+ 
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIXMLHandler_h_
+#define _CEGUIXMLHandler_h_
+
+#include "CEGUIBase.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+    class CEGUIEXPORT XMLHandler
+    {
+    public:
+        /*!
+        \brief
+            XMLHandler base class constructor.
+         */
+        XMLHandler(void);
+
+        /*!
+        \brief
+            XMLHandler base class destructor.
+         */
+        virtual ~XMLHandler(void);
+        
+        /*!
+        \brief
+            Method called to notify the handler at the start of each XML element encountered.
+
+        \param element
+            String object holding the name of the element that is starting.
+
+        \param attributes
+            An XMLAttributes object holding the collection of attributes specified for the element.
+
+        \return
+            Nothing.
+         */
+        virtual void elementStart(const String& element, const XMLAttributes& attributes);
+        
+        /*!
+        \brief
+            Method called to notify the handler at the end of each XML element encountered.
+
+        \param element
+            String object holding the name of the element that is ending.
+
+        \return
+            Nothing.
+         */
+        virtual void elementEnd(const String& element);
+    };
+
+} // End of  CEGUI namespace section
+
+
+#endif  // end of guard _CEGUIXMLHandler_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIEventArgs.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIEventArgs.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIEventArgs.h	(revision 1812)
@@ -0,0 +1,66 @@
+/************************************************************************
+	filename: 	CEGUIEventArgs.h
+	created:	21/2/2004
+	author:		Paul D Turner
+	
+	purpose:	Defines base EventArgs class used with event signalling
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIEventArgs_h_
+#define _CEGUIEventArgs_h_
+
+#include "CEGUIBase.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Base class used as the argument to all subscribers Event object.
+
+	The base EventArgs class does not contain any useful information, it is intended
+	to be specialised for each type of event that can be generated by objects within
+	the system.  The use of this base class allows all event subscribers to have the
+	same function signature.
+
+	The \a handled field is used to signal whether an event was actually handled or not.  While
+	the event system does not look at this value, code at a higher level can use it to determine
+	how far to propagate an event.
+*/
+class CEGUIEXPORT EventArgs
+{
+public:
+	/*************************************************************************
+		Construction
+	*************************************************************************/
+	EventArgs(void) : handled(false) {}
+	virtual ~EventArgs(void) {}
+
+
+	/*************************************************************************
+		Data members
+	*************************************************************************/
+	bool	handled;		//!< handlers should set this to true if they handled the event, or false otherwise.
+};
+
+} // End of  CEGUI namespace section
+
+#endif	// end of guard _CEGUIEventArgs_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIImageset.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIImageset.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIImageset.h	(revision 1812)
@@ -0,0 +1,592 @@
+/************************************************************************
+	filename: 	CEGUIImageset.h
+	created:	21/2/2004
+	author:		Paul D Turner
+	
+	purpose:	Defines the interface for the Imageset class
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIImageset_h_
+#define _CEGUIImageset_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIString.h"
+#include "CEGUIRect.h"
+#include "CEGUIColourRect.h"
+#include "CEGUIImagesetManager.h"
+#include "CEGUIImage.h"
+#include "CEGUIIteratorBase.h"
+
+#include <map>
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+	Offers functions to define, access, and draw, a set of image components on a single graphical surface or Texture.
+
+	Imageset objects are a means by which a single graphical image (file, Texture, etc), can be split into a number
+	of 'components' which can later be accessed via name.  The components of an Imageset can queried for
+	various details, and sent to the Renderer object for drawing.
+*/
+class CEGUIEXPORT Imageset
+{
+	friend class Imageset_xmlHandler;
+private:
+	typedef	std::map<String, Image>	ImageRegistry;
+
+	/*************************************************************************
+		Friends to allow access to constructors and destructors
+	*************************************************************************/
+	friend Imageset*	ImagesetManager::createImageset(const String& name, Texture* texture);
+	friend Imageset*	ImagesetManager::createImageset(const String& filename, const String& resourceGroup);
+	friend Imageset*	ImagesetManager::createImagesetFromImageFile(const String& name, const String& filename, const String& resourceGroup);
+	friend void			ImagesetManager::destroyImageset(const String& name);
+
+
+	/*************************************************************************
+		Construction and Destruction (private, only ImagesetManager can 
+		create and destroy Imageset objects).
+	*************************************************************************/
+	/*!
+	\brief
+		Construct a new Imageset object.  Object will initially have no Images defined
+
+	\param texture
+		Texture object that holds the imagery for the Imageset being created.
+	*/
+	Imageset(const String& name, Texture* texture);
+
+
+	/*!
+	\brief
+		Construct a new Imageset object using data contained in the specified file.
+
+	\param filename
+		String object that holds the name of the Imageset data file that is to be processed.
+
+    \param resourceGroup
+        Resource group identifier to be passed to the resource manager.  NB: This affects the
+        imageset xml file only, the texture loaded may have its own group specified in the XML file.
+
+	\exception	FileIOException		thrown if something goes wrong while processing the file \a filename.
+	*/
+	Imageset(const String& filename, const String& resourceGroup);
+
+
+    /*!
+    \brief
+        Construct a new Imageset using the specified image file and imageset name.  The created
+        imageset will, by default, have a single Image defined named "full_image" which represents
+        the entire area of the loaded image file.
+
+    \note
+        Under certain renderers it may be required that the source image dimensions be some
+        power of 2, if this condition is not met then stretching and other undesired side-effects
+        may be experienced.  To be safe from such effects it is generally recommended that all
+        images that you load have dimensions that are some power of 2.
+
+    \param name
+        String object holding the name to be assigned to the created imageset.
+
+    \param filename
+        String object holding the filename of the image that is to be loaded.  The image should be
+        of some format that is supported by the Renderer that is in use.
+
+    \param resourceGroup
+        Resource group identifier to be passed to the resource manager, which may specify a group
+        from which the image file is to be loaded.
+
+    \exception FileIOException thrown if something goes wrong while loading the image.
+    */
+    Imageset(const String& name, const String& filename, const String& resourceGroup);
+
+
+public:	// For luabind support
+	/*!
+	\brief
+		Destroys Imageset objects
+	*/
+	~Imageset(void);
+
+
+public:
+	typedef	ConstBaseIterator<ImageRegistry>	ImageIterator;	//!< Iterator type for this collection
+
+	/*************************************************************************
+		Public interface
+	*************************************************************************/
+	/*!
+	\brief
+		return Texture object for this Imageset
+
+	\return
+		Texture object that holds the imagery for this Imageset
+	*/
+	Texture*	getTexture(void) const						{return d_texture;}
+
+
+	/*!
+	\brief
+		return String object holding the name of the Imageset
+
+	\return	
+		String object that holds the name of the Imageset.
+	*/
+	const String&	getName(void) const						{return d_name;}
+
+
+	/*!
+	\brief
+		return number of images defined for this Imageset
+
+	\return
+		uint value equal to the number of Image objects defined for the Imageset
+	*/
+	uint      getImageCount(void) const               {return (uint)d_images.size();}
+
+ 
+	/*!
+	\brief
+		return true if an Image with the specified name exists.
+
+	\param name
+		String object holding the name of the Image to look for.
+
+	\return
+		true if an Image object named \a name is defined for this Imageset, else false.
+	*/
+	bool		isImageDefined(const String& name) const	{return d_images.find(name) != d_images.end();}
+
+ 
+	/*!
+	\brief
+		return a copy of the Image object for the named image
+
+	\param name
+		String object holding the name of the Image object to be returned
+
+	\return
+		constant Image object that has the requested name.
+
+	\exception UnknownObjectException	thrown if no Image named \a name is defined for the Imageset
+	*/
+	const Image&	getImage(const String& name) const;
+
+
+	/*!
+	\brief
+		remove the definition for the Image with the specified name.  If no such Image exists, nothing happens.
+
+	\param name
+		String object holding the name of the Image object to be removed from the Imageset,
+	\return
+		Nothing.
+	*/
+	void	undefineImage(const String& name);
+
+
+	/*!
+	\brief
+		Removes the definitions for all Image objects currently defined in the Imageset
+
+	\return
+		Nothing
+	*/
+	void	undefineAllImages(void);
+
+
+	/*!
+	\brief
+		return a Size object describing the dimensions of the named image.
+
+	\param name
+		String object holding the name of the Image.
+
+	\return
+		Size object holding the dimensions of the requested Image.
+
+	\exception UnknownObjectException	thrown if no Image named \a name is defined for the Imageset
+	*/
+	Size	getImageSize(const String& name) const			{return getImage(name).getSize();}
+
+
+	/*!
+	\brief
+		return the width of the named image.
+
+	\param name
+		String object holding the name of the Image.
+
+	\return
+		float value equalling the width of the requested Image.
+
+	\exception UnknownObjectException	thrown if no Image named \a name is defined for the Imageset
+	*/
+	float	getImageWidth(const String& name) const			{return getImage(name).getWidth();}
+
+
+	/*!
+	\brief
+		return the height of the named image.
+
+	\param name
+		String object holding the name of the Image.
+
+	\return
+		float value equalling the height of the requested Image.
+
+	\exception UnknownObjectException	thrown if no Image named \a name is defined for the Imageset
+	*/
+	float	getImageHeight(const String& name) const		{return getImage(name).getHeight();}
+
+
+	/*!
+	\brief
+		return the rendering offsets applied to the named image.
+
+	\param name
+		String object holding the name of the Image.
+
+	\return
+		Point object that holds the rendering offsets for the requested Image.
+
+	\exception UnknownObjectException	thrown if no Image named \a name is defined for the Imageset
+	*/
+	Point	getImageOffset(const String& name) const		{return getImage(name).getOffsets();}
+
+
+	/*!
+	\brief
+		return the x rendering offset for the named image.
+
+	\param name
+		String object holding the name of the Image.
+
+	\return
+		float value equal to the x rendering offset applied when drawing the requested Image.
+
+	\exception UnknownObjectException	thrown if no Image named \a name is defined for the Imageset
+	*/
+	float	getImageOffsetX(const String& name) const		{return getImage(name).getOffsetX();}
+
+
+	/*!
+	\brief
+		return the y rendering offset for the named image.
+
+	\param name
+		String object holding the name of the Image.
+
+	\return
+		float value equal to the y rendering offset applied when drawing the requested Image.
+
+	\exception UnknownObjectException	thrown if no Image named \a name is defined for the Imageset
+	*/
+	float	getImageOffsetY(const String& name) const		{return getImage(name).getOffsetY();}
+
+	
+	/*!
+	\brief
+		Define a new Image for this Imageset
+
+	\param name
+		String object holding the name that will be assigned to the new Image, which must be unique within the Imageset.
+
+	\param position
+		Point object describing the pixel location of the Image on the image file / texture associated with this Imageset.
+
+	\param size
+		Size object describing the dimensions of the Image, in pixels.
+
+	\param render_offset
+		Point object describing the offsets, in pixels, that are to be applied to the Image when it is drawn.
+
+	\return
+		Nothing
+
+	\exception AlreadyExistsException	thrown if an Image named \a name is already defined for this Imageset
+	*/
+	void	defineImage(const String& name, const Point& position, const Size& size, const Point& render_offset)
+	{
+		defineImage(name, Rect(position.d_x, position.d_y, position.d_x + size.d_width, position.d_y + size.d_height), render_offset);
+	}
+
+
+	/*!
+	\brief
+		Define a new Image for this Imageset
+
+	\param name
+		String object holding the name that will be assigned to the new Image, which must be unique within the Imageset.
+
+	\param image_rect
+		Rect object describing the area on the image file / texture associated with this Imageset that will be used for the Image.
+
+	\param render_offset
+		Point object describing the offsets, in pixels, that are to be applied to the Image when it is drawn.
+
+	\return
+		Nothing
+
+	\exception AlreadyExistsException	thrown if an Image named \a name is already defined for this Imageset
+	*/
+	void	defineImage(const String& name, const Rect& image_rect, const Point& render_offset);
+
+
+	/*!
+	\brief
+		Queues an area of the associated Texture the be drawn on the screen.  Low-level routine to be used carefully!
+
+	\param source_rect
+		Rect object describing the area of the image file / texture that is to be queued for drawing
+
+	\param dest_rect
+		Rect describing the area of the screen that will be filled with the imagery from \a source_rect.
+
+	\param z
+		float value specifying 'z' order.  0 is topmost with increasing values moving back into the screen.
+
+	\param clip_rect
+		Rect object describing a 'clipping rectangle' that will be applied when drawing the requested imagery
+
+	\param colours
+		ColourRect object holding the ARGB colours to be applied to the four corners of the rendered imagery.
+	
+	\param quad_split_mode
+		One of the QuadSplitMode values specifying the way quads are split into triangles
+
+	\return
+		Nothing
+	*/
+	void	draw(const Rect& source_rect, const Rect& dest_rect, float z, const Rect& clip_rect,const ColourRect& colours, QuadSplitMode quad_split_mode) const;
+
+
+	/*!
+	\brief
+		Queues an area of the associated Texture the be drawn on the screen.  Low-level routine to be used carefully!
+
+	\param source_rect
+		Rect object describing the area of the image file / texture that is to be queued for drawing
+
+	\param dest_rect
+		Rect describing the area of the screen that will be filled with the imagery from \a source_rect.
+
+	\param z
+		float value specifying 'z' order.  0 is topmost with increasing values moving back into the screen.
+
+	\param clip_rect
+		Rect object describing a 'clipping rectangle' that will be applied when drawing the requested imagery
+
+	\param top_left_colour
+		colour to be applied to the top left corner of the rendered imagery.
+
+	\param top_right_colour
+		colour to be applied to the top right corner of the rendered imagery.
+
+	\param bottom_left_colour
+		colour to be applied to the bottom left corner of the rendered imagery.
+
+	\param bottom_right_colour
+		colour to be applied to the bottom right corner of the rendered imagery.
+	
+	\param quad_split_mode
+		One of the QuadSplitMode values specifying the way quads are split into triangles
+
+	\return
+		Nothing
+	*/
+	void	draw(const Rect& source_rect, const Rect& dest_rect, float z, const Rect& clip_rect, const colour& top_left_colour = 0xFFFFFFFF, const colour& top_right_colour = 0xFFFFFFFF,  const colour& bottom_left_colour = 0xFFFFFFFF, const colour& bottom_right_colour = 0xFFFFFFFF, QuadSplitMode quad_split_mode = TopLeftToBottomRight) const
+	{
+		draw(source_rect, dest_rect, z, clip_rect, ColourRect(top_left_colour, top_right_colour, bottom_left_colour, bottom_right_colour), quad_split_mode);
+	}
+
+
+	/*!
+	\brief
+		Return whether this Imageset is auto-scaled.
+
+	\return
+		true if Imageset is auto-scaled, false if not.
+	*/
+	bool	isAutoScaled(void) const		{return d_autoScale;}
+
+
+	/*!
+	\brief
+		Return the native display size for this Imageset.  This is only relevant if the Imageset is being auto-scaled.
+
+	\return
+		Size object describing the native display size for this Imageset.
+	*/
+	Size	getNativeResolution(void) const	{return Size(d_nativeHorzRes, d_nativeVertRes);}
+
+
+	/*!
+	\brief
+		Enable or disable auto-scaling for this Imageset.
+
+	\param setting
+		true to enable auto-scaling, false to disable auto-scaling.
+
+	\return
+		Nothing.
+	*/
+	void	setAutoScalingEnabled(bool setting);
+
+
+	/*!
+	\brief
+		Set the native resolution for this Imageset
+
+	\param size
+		Size object describing the new native screen resolution for this Imageset.
+
+	\return
+		Nothing
+	*/
+	void	setNativeResolution(const Size& size);
+
+
+	/*!
+	\brief
+		Notify the Imageset of the current (usually new) display resolution.
+
+	\param size
+		Size object describing the display resolution
+
+	\return
+		Nothing
+	*/
+	void	notifyScreenResolution(const Size& size);
+
+
+	/*!
+	\brief
+		Return an Imageset::ImageIterator object that can be used to iterate over the Image objects in the Imageset.
+	*/
+	ImageIterator	getIterator(void) const;
+
+
+    /*!
+    \brief
+        Writes an xml representation of this Imageset to \a out_stream.
+
+    \param out_stream
+        Stream where xml data should be output.
+
+    \return
+        Nothing.
+    */
+    void writeXMLToStream(OutStream& out_stream) const;
+
+
+protected:
+	/*************************************************************************
+		Implementation Constants
+	*************************************************************************/
+	static const char	ImagesetSchemaName[];			//!< Filename of the XML schema used for validating Imageset files.
+
+
+	/*************************************************************************
+		Implementation Functions
+	*************************************************************************/
+	/*!
+	\brief
+		Initialise the Imageset with information taken from the specified file.
+
+	\param filename
+		String object that holds the name of the Imageset data file that is to be processed.
+
+    \param resourceGroup
+        Resource group identifier to be passed to the resource manager.  NB: This affects the
+        imageset xml file only, the texture loaded may have its own group specified in the XML file.
+
+	\return
+		Nothing
+
+	\exception	FileIOException		thrown if something goes wrong while processing the file \a filename.
+	*/	
+	void	load(const String& filename, const String& resourceGroup);
+
+
+	/*!
+	\brief
+		Unloads all loaded data and leaves the Imageset in a clean (but un-usable) state.  This should be called for cleanup purposes only.
+	*/
+	void	unload(void);
+
+
+	/*!
+	\brief
+		set the Texture object to be used by this Imageset.  Changing textures on an Imageset that is in use is not a good idea!
+
+	\param texture
+		Texture object to be used by the Imageset.  The old texture is NOT disposed of, that is the clients responsibility.
+
+	\return
+		Nothing
+
+	\exception	NullObjectException		thrown if \a texture is NULL
+	*/
+	void	setTexture(Texture* texture);
+
+
+	/*!
+	\brief
+		Sets the scaling factor for all Images that are a part of this Imageset.
+
+	\return
+		Nothing.
+	*/
+	void	updateImageScalingFactors(void);
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	String			d_name;						//!< Holds the name of this imageset.
+	ImageRegistry	d_images;					//!< Registry of Image objects for the images defined for this Imageset
+	Texture*		d_texture;					//!< Texture object that handles imagery for this Imageset
+    String          d_textureFilename;          //!< String holding the name of the texture filename (if any).
+
+	// auto-scaling fields
+	bool	d_autoScale;			//!< true when auto-scaling is enabled.
+	float	d_horzScaling;			//!< current horizontal scaling factor.
+	float	d_vertScaling;			//!< current vertical scaling factor.
+	float	d_nativeHorzRes;		//!< native horizontal resolution for this Imageset.
+	float	d_nativeVertRes;		//!< native vertical resolution for this Imageset.
+};
+
+} // End of  CEGUI namespace section
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIImageset_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUISchemeManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUISchemeManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUISchemeManager.h	(revision 1812)
@@ -0,0 +1,185 @@
+/************************************************************************
+	filename: 	CEGUISchemeManager.h
+	created:	21/2/2004
+	author:		Paul D Turner
+	
+	purpose:	Defines the interface to the SchemeManager class
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUISchemeManager_h_
+#define _CEGUISchemeManager_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIString.h"
+#include "CEGUISingleton.h"
+#include "CEGUIIteratorBase.h"
+#include <map>
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4275)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	A class that manages the creation of, access to, and destruction of GUI Scheme objects
+*/
+class CEGUIEXPORT SchemeManager : public Singleton<SchemeManager>
+{
+public:
+	/*!
+	\brief
+		Constructor for SchemeManager objects
+	*/
+	SchemeManager(void);
+
+
+	/*!
+	\brief
+		Destructor for SchemeManager objects
+	*/
+	~SchemeManager(void);
+
+
+	/*!
+	\brief
+		Return singleton SchemeManager object
+
+	\return
+		Singleton SchemeManager object
+	*/
+	static	SchemeManager&	getSingleton(void);
+
+
+	/*!
+	\brief
+		Return pointer to singleton SchemeManager object
+
+	\return
+		Pointer to singleton SchemeManager object
+	*/
+	static	SchemeManager*	getSingletonPtr(void);
+
+
+	/*!
+	\brief
+		Loads a scheme
+
+	\param scheme_filename
+		String object that holds the filename of the scheme to be loaded
+
+    \param resourceGroup
+        Resource group identifier to be passed to the resource manager.  NB: This
+        affects loading of the scheme xml file only, scheme resources may specify
+        their own groups.
+
+	\return
+		Pointer to an object representing the loaded Scheme.
+	*/
+	Scheme*	loadScheme(const String& scheme_filename, const String& resourceGroup = "");
+
+
+	/*!
+	\brief
+		Unloads all data referenced in a scheme.  If any object is using some resource which is listed in the scheme, this function
+		will effectively pull the rug out from under those objects.  This should be used with extreme caution, or not at all.
+
+	\param scheme_name
+		String object specifying the name of the Scheme to be unloaded.
+	*/
+	void	unloadScheme(const String& scheme_name);
+
+
+	/*!
+	\brief
+		Returns true if the named Scheme is present in the system (though the resources for the scheme may or may not be loaded)
+
+	\param scheme_name
+		String object specifying the name of the Scheme to check for.
+
+	\return
+		true if the scheme is loaded, false if it is not.
+	*/
+	bool	isSchemePresent(const String& scheme_name) const		{return (d_schemes.find(scheme_name) != d_schemes.end());}
+
+
+	/*!
+	\brief
+		Returns a pointer to the Scheme object with the specified name.
+
+	\param name
+		String object holding the name of the Scheme to be returned.
+
+	\return
+		Pointer to the Scheme named \a name.
+
+	\exception UnknownObjectException	thrown if no Scheme named \a name is present in the system
+	*/
+	Scheme*	getScheme(const String& name) const;
+
+
+	/*!
+	\brief
+		Unload all schemes currently defined within the system.
+
+	\note
+		Calling this method has the potential to be very dangerous; if any of the
+		data that forms part of the scheme is still in use, you can expect
+		fireworks shortly after!
+
+	\return
+		Nothing.
+	*/
+	void	unloadAllSchemes(void);
+
+private:
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	typedef	std::map<String, Scheme*> SchemeRegistry;
+	SchemeRegistry	d_schemes;			//!< Collection that tracks the loaded Schemes.
+
+
+public:
+	/*************************************************************************
+		Iterator stuff
+	*************************************************************************/
+	typedef	ConstBaseIterator<SchemeRegistry>	SchemeIterator;
+
+	/*!
+	\brief
+		Return a SchemeManager::SchemeIterator object to iterate over the available schemes.
+	*/
+	SchemeIterator	getIterator(void) const;
+};
+
+} // End of  CEGUI namespace section
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUISchemeManager_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIInputEvent.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIInputEvent.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIInputEvent.h	(revision 1812)
@@ -0,0 +1,320 @@
+/************************************************************************
+	filename: 	CEGUIInputEvent.h
+	created:	30/5/2004
+	author:		Paul D Turner
+	
+	purpose:	Defines interface to input event classes
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIInputEvent_h_
+#define _CEGUIInputEvent_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIEventArgs.h"
+#include "CEGUIString.h"
+#include "CEGUIVector.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	struct to give scope to scan code enumeration.
+*/
+struct CEGUIEXPORT Key
+{
+	// enumeration of scan codes.  Customised from table taken from Ogre, which took them from DirectInput...
+	enum Scan
+    {
+        Escape          =0x01,
+        One             =0x02,
+        Two             =0x03,
+        Three           =0x04,
+        Four            =0x05,
+        Five            =0x06,
+        Six             =0x07,
+        Seven           =0x08,
+        Eight           =0x09,
+        Nine            =0x0A,
+        Zero            =0x0B,
+        Minus           =0x0C,    /* - on main keyboard */
+        Equals			=0x0D,
+        Backspace		=0x0E,    /* backspace */
+        Tab				=0x0F,
+        Q               =0x10,
+        W               =0x11,
+        E               =0x12,
+        R               =0x13,
+        T               =0x14,
+        Y               =0x15,
+        U               =0x16,
+        I               =0x17,
+        O               =0x18,
+        P               =0x19,
+        LeftBracket     =0x1A,
+        RightBracket    =0x1B,
+        Return			=0x1C,    /* Enter on main keyboard */
+        LeftControl		=0x1D,
+        A               =0x1E,
+        S               =0x1F,
+        D               =0x20,
+        F               =0x21,
+        G               =0x22,
+        H               =0x23,
+        J               =0x24,
+        K               =0x25,
+        L               =0x26,
+        Semicolon       =0x27,
+        Apostrophe		=0x28,
+        Grave           =0x29,    /* accent grave */
+        LeftShift       =0x2A,
+        Backslash       =0x2B,
+        Z               =0x2C,
+        X               =0x2D,
+        C               =0x2E,
+        V               =0x2F,
+        B               =0x30,
+        N               =0x31,
+        M               =0x32,
+        Comma           =0x33,
+        Period          =0x34,    /* . on main keyboard */
+        Slash           =0x35,    /* '/' on main keyboard */
+        RightShift      =0x36,
+        Multiply        =0x37,    /* * on numeric keypad */
+        LeftAlt        =0x38,    /* left Alt */
+        Space           =0x39,
+        Capital         =0x3A,
+        F1              =0x3B,
+        F2              =0x3C,
+        F3              =0x3D,
+        F4              =0x3E,
+        F5              =0x3F,
+        F6              =0x40,
+        F7              =0x41,
+        F8              =0x42,
+        F9              =0x43,
+        F10             =0x44,
+        NumLock         =0x45,
+        ScrollLock      =0x46,    /* Scroll Lock */
+        Numpad7         =0x47,
+        Numpad8         =0x48,
+        Numpad9         =0x49,
+        Subtract        =0x4A,    /* - on numeric keypad */
+        Numpad4         =0x4B,
+        Numpad5         =0x4C,
+        Numpad6         =0x4D,
+        Add				=0x4E,    /* + on numeric keypad */
+        Numpad1         =0x4F,
+        Numpad2         =0x50,
+        Numpad3         =0x51,
+        Numpad0         =0x52,
+        Decimal			=0x53,    /* . on numeric keypad */
+        OEM_102         =0x56,    /* < > | on UK/Germany keyboards */
+        F11             =0x57,
+        F12             =0x58,
+        F13             =0x64,    /*                     (NEC PC98) */
+        F14             =0x65,    /*                     (NEC PC98) */
+        F15             =0x66,    /*                     (NEC PC98) */
+        Kana            =0x70,    /* (Japanese keyboard)            */
+        ABNT_C1         =0x73,    /* / ? on Portugese (Brazilian) keyboards */
+        Convert         =0x79,    /* (Japanese keyboard)            */
+        NoConvert       =0x7B,    /* (Japanese keyboard)            */
+        Yen             =0x7D,    /* (Japanese keyboard)            */
+        ABNT_C2         =0x7E,    /* Numpad . on Portugese (Brazilian) keyboards */
+        NumpadEquals    =0x8D,    /* = on numeric keypad (NEC PC98) */
+        PrevTrack       =0x90,    /* Previous Track (KC_CIRCUMFLEX on Japanese keyboard) */
+        At              =0x91,    /*                     (NEC PC98) */
+        Colon           =0x92,    /*                     (NEC PC98) */
+        Underline       =0x93,    /*                     (NEC PC98) */
+        Kanji           =0x94,    /* (Japanese keyboard)            */
+        Stop            =0x95,    /*                     (NEC PC98) */
+        AX              =0x96,    /*                     (Japan AX) */
+        Unlabeled       =0x97,    /*                        (J3100) */
+        NextTrack       =0x99,    /* Next Track */
+        NumpadEnter     =0x9C,    /* Enter on numeric keypad */
+        RightControl    =0x9D,
+        Mute            =0xA0,    /* Mute */
+        Calculator      =0xA1,    /* Calculator */
+        PlayPause       =0xA2,    /* Play / Pause */
+        MediaStop       =0xA4,    /* Media Stop */
+        VolumeDown      =0xAE,    /* Volume - */
+        VolumeUp        =0xB0,    /* Volume + */
+        WebHome         =0xB2,    /* Web home */
+        NumpadComma     =0xB3,    /* , on numeric keypad (NEC PC98) */
+        Divide          =0xB5,    /* / on numeric keypad */
+        SysRq           =0xB7,
+        RightAlt        =0xB8,    /* right Alt */
+        Pause           =0xC5,    /* Pause */
+        Home            =0xC7,    /* Home on arrow keypad */
+        ArrowUp         =0xC8,    /* UpArrow on arrow keypad */
+        PageUp          =0xC9,    /* PgUp on arrow keypad */
+        ArrowLeft       =0xCB,    /* LeftArrow on arrow keypad */
+        ArrowRight      =0xCD,    /* RightArrow on arrow keypad */
+        End             =0xCF,    /* End on arrow keypad */
+        ArrowDown       =0xD0,    /* DownArrow on arrow keypad */
+        PageDown		=0xD1,    /* PgDn on arrow keypad */
+        Insert          =0xD2,    /* Insert on arrow keypad */
+        Delete          =0xD3,    /* Delete on arrow keypad */
+        LeftWindows     =0xDB,    /* Left Windows key */
+        RightWindow     =0xDC,    /* Right Windows key */
+        RightWindows    =0xDC,    /* Right Windows key - Correct spelling :) */
+        AppMenu         =0xDD,    /* AppMenu key */
+        Power           =0xDE,    /* System Power */
+        Sleep           =0xDF,    /* System Sleep */
+        Wake			=0xE3,    /* System Wake */
+        WebSearch		=0xE5,    /* Web Search */
+        WebFavorites	=0xE6,    /* Web Favorites */
+        WebRefresh		=0xE7,    /* Web Refresh */
+        WebStop			=0xE8,    /* Web Stop */
+        WebForward		=0xE9,    /* Web Forward */
+        WebBack			=0xEA,    /* Web Back */
+        MyComputer		=0xEB,    /* My Computer */
+        Mail			=0xEC,    /* Mail */
+        MediaSelect		=0xED     /* Media Select */
+    };
+
+};
+
+
+/*!
+/brief
+	Enumeration of mouse buttons
+*/
+enum MouseButton
+{
+	LeftButton,
+	RightButton,
+	MiddleButton,
+	X1Button,
+	X2Button,
+	MouseButtonCount,		//<! Dummy value that is == to the maximum number of mouse buttons supported.
+	NoButton				//!< Value set for no mouse button.  NB: This is not 0, do not assume! 
+};
+
+
+/*!
+\brief
+	System key flag values
+*/
+enum SystemKey
+{
+	LeftMouse		= 0x0001,			//!< The left mouse button.
+	RightMouse		= 0x0002,			//!< The right mouse button.
+	Shift			= 0x0004,			//!< Either shift key.
+	Control			= 0x0008,			//!< Either control key.
+	MiddleMouse		= 0x0010,			//!< The middle mouse button.
+	X1Mouse			= 0x0020,			//!< The first 'extra' mouse button
+	X2Mouse			= 0x0040,			//!< The second 'extra' mouse button.
+	Alt				= 0x0080			//!< Either alt key.
+};
+
+
+/*!
+\brief
+	EventArgs based class that is used for objects passed to handlers triggered for events
+	concerning some Window object.
+*/
+class CEGUIEXPORT WindowEventArgs : public EventArgs
+{
+public:
+	WindowEventArgs(Window* wnd) : window(wnd) {}
+
+	Window*	window;		//!< pointer to a Window object of relevance to the event.
+};
+
+
+/*!
+\brief
+	EventArgs based class that is used for objects passed to input event handlers
+	concerning mouse input.
+*/
+class CEGUIEXPORT MouseEventArgs : public WindowEventArgs
+{
+public:
+	MouseEventArgs(Window* wnd) : WindowEventArgs(wnd) {}
+
+	Point		position;		//!< holds current mouse position.
+	Vector2		moveDelta;		//!< holds variation of mouse position from last mouse input
+	MouseButton	button;			//!< one of the MouseButton enumerated values describing the mouse button causing the event (for button inputs only)
+	uint		sysKeys;		//!< current state of the system keys and mouse buttons.
+	float		wheelChange;	//!< Holds the amount the scroll wheel has changed.
+	uint        clickCount;     //!< Holds number of mouse button down events currently counted in a multi-click sequence (for button inputs only).
+};
+
+
+/*!
+\brief
+	EventArgs based class that is used for objects passed to input event handlers
+	concerning mouse cursor events.
+*/
+class CEGUIEXPORT MouseCursorEventArgs : public EventArgs
+{
+public:
+	MouseCursorEventArgs(MouseCursor* cursor) : mouseCursor(cursor) {}
+
+	MouseCursor* mouseCursor;	//!< pointer to a MouseCursor object of relevance to the event.
+	const Image* image;			//!< pointer to an Image object of relevance to the event.
+};
+
+
+/*!
+\brief
+	EventArgs based class that is used for objects passed to input event handlers
+	concerning keyboard input.
+*/
+class CEGUIEXPORT KeyEventArgs : public WindowEventArgs
+{
+public:
+	KeyEventArgs(Window* wnd) : WindowEventArgs(wnd) {}
+
+	utf32		codepoint;		//!< utf32 codepoint for the key (only used for Character inputs).
+	Key::Scan	scancode;		//!< Scan code of key that caused event (only used for key up & down inputs.
+	uint		sysKeys;		//!< current state of the system keys and mouse buttons.
+};
+
+
+/*!
+\brief
+	EventArgs based class that is used for Activated and Deactivated window events
+*/
+class CEGUIEXPORT ActivationEventArgs : public WindowEventArgs
+{
+public:
+	ActivationEventArgs(Window* wnd) : WindowEventArgs(wnd) {}
+
+	Window*	otherWindow;	//!< Pointer to the other window involved in the activation change.
+};
+
+/*!
+\brief
+	EventArgs based class used for certain drag/drop notifications
+*/
+class CEGUIEXPORT DragDropEventArgs : public WindowEventArgs
+{
+public:
+	DragDropEventArgs(Window* wnd) : WindowEventArgs(wnd) {}
+	DragContainer*	dragDropItem; //<! pointer to the DragContainer window being dragged / dropped.
+};
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIInputEvent_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUITextUtils.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUITextUtils.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUITextUtils.h	(revision 1812)
@@ -0,0 +1,164 @@
+/************************************************************************
+	filename: 	CEGUITextUtils.h
+	created:	30/5/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to a static class containing some utility
+				functions for text / string operations
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUITextUtils_h_
+#define _CEGUITextUtils_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIString.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Text utility support class.  This class is all static members.  You do not create instances of this class.
+*/
+class CEGUIEXPORT TextUtils
+{
+public:
+	/*************************************************************************
+		Constants
+	*************************************************************************/
+	static const String	DefaultWhitespace;		//!< The default set of whitespace
+	static const String	DefaultAlphanumerical;	//!< default set of alphanumericals.
+	static const String	DefaultWrapDelimiters;	//!< The default set of word-wrap delimiters
+
+
+	/*************************************************************************
+		Methods
+	*************************************************************************/
+	/*!
+	\brief
+		return a String containing the the next word in a String.
+
+		This method returns a String object containing the the word, starting at index \a start_idx, of String \a str
+		as delimited by the code points specified in string \a delimiters (or the ends of the input string).
+
+	\param str
+		String object containing the input data.
+
+	\param start_idx
+		index into \a str where the search for the next word is to begin.  Defaults to start of \a str.
+
+	\param delimiters
+		String object containing the set of delimiter code points to be used when determining the start and end
+		points of a word in string \a str.  Defaults to whitespace.
+
+	\return
+		String object containing the next \a delimiters delimited word from \a str, starting at index \a start_idx.
+	*/
+	static	String	getNextWord(const String& str, String::size_type start_idx = 0, const String& delimiters = DefaultWhitespace);
+
+
+	/*!
+	\brief
+		Return the index of the first character of the word at \a idx.
+
+	/note
+		This currently uses DefaultWhitespace and DefaultAlphanumerical to determine groupings for what constitutes a 'word'.
+
+	\param str
+		String containing text.
+
+	\param idx
+		Index into \a str where search for start of word is to begin.
+
+	\return
+		Index into \a str which marks the begining of the word at index \a idx.
+	*/
+	static	String::size_type	getWordStartIdx(const String& str, String::size_type idx);
+
+
+	/*!
+	\brief
+		Return the index of the first character of the word after the word at \a idx.
+
+	/note
+		This currently uses DefaultWhitespace and DefaultAlphanumerical to determine groupings for what constitutes a 'word'.
+
+	\param str
+		String containing text.
+
+	\param idx
+		Index into \a str where search is to begin.
+
+	\return
+		Index into \a str which marks the begining of the word at after the word at index \a idx.
+		If \a idx is within the last word, then the return is the last index in \a str.
+	*/
+	static	String::size_type	getNextWordStartIdx(const String& str, String::size_type idx);
+
+
+	/*!
+	\brief
+		Trim all characters from the set specified in \a chars from the begining of \a str.
+
+	\param str
+		String object to be trimmed.
+
+	\param chars
+		String object containing the set of code points to be trimmed.
+	*/
+	static	void	trimLeadingChars(String& str, const String& chars);
+
+
+	/*!
+	\brief
+		Trim all characters from the set specified in \a chars from the end of \a str.
+
+	\param str
+		String object to be trimmed.
+
+	\param chars
+		String object containing the set of code points to be trimmed.
+	*/
+	static	void	trimTrailingChars(String& str, const String& chars);
+
+
+private:
+	/*************************************************************************
+		Data
+	*************************************************************************/
+	static	String		d_delimiters;			//!< Current set of delimiters.
+	static	String		d_whitespace;			//!< Current set of whitespace.
+
+
+	/*************************************************************************
+		Construction / Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor and Destructor are private.  This class has all static members.
+	*/
+	TextUtils(void);
+	~TextUtils(void);
+};
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUITextUtils_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIRenderableImage.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIRenderableImage.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIRenderableImage.h	(revision 1812)
@@ -0,0 +1,254 @@
+/************************************************************************
+	filename: 	CEGUIRenderableImage.h
+	created:	17/4/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to renderable image UI entity
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIRenderableImage_h_
+#define _CEGUIRenderableImage_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIRenderableElement.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	A higher order GUI entity that represents a renderable image with formatting options.
+
+	This class is intended to be used where a (usually top-level) GUI element needs to draw an image that requires some additional
+	formatting.  It is possible to specify the Image that is to be rendered, as well as the horizontal and vertical formatting
+	required.
+*/
+class CEGUIEXPORT RenderableImage : public RenderableElement
+{
+public:
+	/*************************************************************************
+		Formatting Enumerations
+	*************************************************************************/
+	/*!
+	\brief
+		Enumeration of horizontal formatting options for a RenderableImage
+	*/
+	enum HorzFormatting
+	{
+		LeftAligned,	//!< Image will be rendered at it's natural size and with it's left edge aligned with the left edge of the RenderableImage rect.
+		RightAligned,	//!< Image will be rendered at it's natural size and with it's right edge aligned with the right edge of the RenderableImage rect.
+		HorzCentred,	//!< Image will be rendered at it's natural size and horizontally centred within the RenderableImage rect.
+		HorzStretched,	//!< Image will be horizontally stretched to cover the entire width of the RenderableImage rect.
+		HorzTiled		//!< Image will be tiled horizontally across the width of the RenderableImage rect.  The rightmost tile will be clipped to remain within the rect.
+	};
+
+
+	/*!
+	\brief
+		Enumeration of vertical formatting options for a RenderableImage
+	*/
+	enum VertFormatting
+	{
+		TopAligned,		//!< Image will be rendered at it's natural size and with it's top edge aligned with the top edge of the RenderableImage rect.
+		BottomAligned,	//!< Image will be rendered at it's natural size and with it's bottom edge aligned with the bottom edge of the RenderableImage rect.
+		VertCentred,	//!< Image will be rendered at it's natural size and vertically centred within the RenderableImage rect.
+		VertStretched,	//!< Image will be vertically stretched to cover the entire height of the RenderableImage rect.
+		VertTiled		//!< Image will be tiled vertically down the height of the RenderableImage rect.  The bottommost tile will be clipped to remain within the rect.
+	};
+
+
+	/*************************************************************************
+		Construction / Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Default constructor for RenderableImage objects.
+	*/
+	RenderableImage(void);
+
+
+	/*!
+	\brief
+		Destructor for RenderableImage objects
+	*/
+	virtual ~RenderableImage(void);
+
+
+	/*************************************************************************
+		Public Interface
+	*************************************************************************/
+	/*!
+	\brief
+		Set the Image object to be drawn by this RenderableImage.
+
+	\param image
+		Pointer to the Image object to be rendered.  Can be NULL to specify no image is to be rendered.
+	
+	\return
+		Nothing.
+	*/
+	void	setImage(const Image* image)		{d_image = image;}
+
+
+	/*!
+	\brief
+		Set the required horizontal formatting
+
+	\param formatting
+		One of the HorzFormatting values specifying the formatting required.
+
+	\return
+		Nothing
+	*/
+	void	setHorzFormatting(HorzFormatting formatting)			{d_horzFormat = formatting;}
+		
+
+	/*!
+	\brief
+		Set the required vertical formatting
+
+	\param formatting
+		One of the VertFormatting values specifying the formatting required.
+
+	\return
+		Nothing
+	*/
+	void	setVertFormatting(VertFormatting formatting)			{d_vertFormat = formatting;}
+	
+	
+	/*!
+	\brief
+		Set the required quad split mode
+
+	\param split_mode
+		One of the QuadSplitMode values specifying the way quads are split into triangles.
+
+	\return
+		Nothing
+	*/
+	void	setQuadSplitMode(QuadSplitMode split_mode)				{d_quadSplitMode = split_mode;}
+
+
+	/*!
+	\brief
+		Return the Image object currently set to be rendered.
+
+	\return
+		Pointer to the current Image object set for this RenderableImage.  May return NULL if no image is set.
+	*/
+	const Image*	getImage(void) const		{return d_image;}
+
+
+	/*!
+	\brief
+		Return current horizontal formatting setting.
+
+	\return
+		One of the HorzFormatting values specifying the formatting set.
+	*/
+	HorzFormatting	getHorzFormatting(void) const				{return d_horzFormat;}
+
+
+	/*!
+	\brief
+		Return current vertical formatting setting.
+
+	\return
+		One of the VertFormatting values specifying the formatting set.
+	*/
+	VertFormatting	getVertFormatting(void) const				{return d_vertFormat;}
+	
+	
+	/*!
+	\brief
+		Return current quad split mode setting.
+
+	\return
+		One of the QuadSplitMode values specifying the way quads are split into triangles.
+	*/
+	QuadSplitMode	getQuadSplitMode(void) const				{return d_quadSplitMode;}
+
+
+protected:
+	/*************************************************************************
+		Implementation functions
+	*************************************************************************/
+	/*!
+	\brief
+		Renders the imagery for a RenderableImage element.
+
+	\param position
+		Vector3 object describing the final rendering position for the object.
+
+	\param clip_rect
+		Rect object describing the clipping area for the rendering.  No rendering will be performed outside this area.
+
+	\return
+		Nothing.
+	*/
+	void draw_impl(const Vector3& position, const Rect& clip_rect) const;
+
+    // implements abstract method
+    void draw_impl(RenderCache& renderCache) const;
+
+    /*!
+    \brief
+        return number of horizontal tiles required.
+    */
+    uint getHorzTileCount() const;
+
+    /*!
+    \brief
+        return number of vertical tiles required.
+    */
+    uint getVertTileCount() const;
+
+    /*!
+    \brief
+        Return base x co-ord for first tile.
+    */
+    float getBaseXCoord(const Size& sz) const;
+
+    /*!
+    \brief
+        Return base y co-ord for first tile.
+    */
+    float getBaseYCoord(const Size& sz) const;
+
+    /*!
+    \brief
+        Return target size to be used for each tile.
+    */
+    Size getDestinationSize() const;
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	HorzFormatting	d_horzFormat;		//!< Currently set horizontal formatting option.
+	VertFormatting	d_vertFormat;		//!< Currently set vertical formatting option.
+	QuadSplitMode	d_quadSplitMode;	//!< Currently set quad split mode
+	const Image*	d_image;			//!< Pointer to the actual Image to be displayed.
+};
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIRenderableImage_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIDefaultResourceProvider.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIDefaultResourceProvider.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIDefaultResourceProvider.h	(revision 1812)
@@ -0,0 +1,51 @@
+/************************************************************************
+	filename: 	CEGUIDefaultResourceProvider.h
+	created:	8/7/2004
+	author:		James '_mental_' O'Sullivan
+	
+	purpose:	Defines abstract base class for CEGUIData objects
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIDefaultResourceProvider_h_
+#define _CEGUIDefaultResourceProvider_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIResourceProvider.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+class CEGUIEXPORT DefaultResourceProvider : public ResourceProvider
+{
+public:
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	DefaultResourceProvider() {}
+	~DefaultResourceProvider(void) {}
+
+//    void loadInputSourceContainer(const String& filename, InputSourceContainer& output);
+    void loadRawDataContainer(const String& filename, RawDataContainer& output, const String& resourceGroup);
+};
+
+} // End of  CEGUI namespace section
+
+#endif	// end of guard _CEGUIDefaultResourceProvider_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIGUISheet.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIGUISheet.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIGUISheet.h	(revision 1812)
@@ -0,0 +1,172 @@
+/************************************************************************
+    filename:   CEGUIGUISheet.h
+    created:    5/6/2004
+    author:     Paul D Turner
+
+    purpose:    Interface to a default window
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIGUISheet_h_
+#define _CEGUIGUISheet_h_
+
+#include "CEGUIWindow.h"
+#include "CEGUIWindowFactory.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+    Window class intended to be used as a simple, generic Window.
+
+    This class does no rendering and so appears totally transparent.  This window defaults
+    to position 0.0f, 0.0f with a size of 1.0f x 1.0f.
+
+    /note
+    The C++ name of this class has been retained for backward compatibility reasons.  The intended usage of
+    this window type has now been extended beyond that of a gui-sheet or root window.
+*/
+class CEGUIEXPORT GUISheet : public Window
+{
+public:
+    /*************************************************************************
+        Constants
+    *************************************************************************/
+    // type name for this widget
+    static const String WidgetTypeName;             //!< The unique typename of this widget
+
+
+    /*************************************************************************
+        Construction and Destruction
+    *************************************************************************/
+    /*!
+    \brief
+        Constructor for GUISheet windows.
+    */
+    GUISheet(const String& type, const String& name) : Window(type, name) {}
+
+
+    /*!
+    \brief
+        Destructor for GUISheet windows.
+    */
+    virtual ~GUISheet(void) {}
+
+
+protected:
+    /*!
+    \brief
+        Perform the actual rendering for this Window.
+
+    \param z
+        float value specifying the base Z co-ordinate that should be used when rendering
+
+    \return
+        Nothing
+    */
+    virtual void    drawSelf(float z) {}
+
+
+    /*!
+    \brief
+        overridden initialise member to set-up our default state.
+    */
+    void initialise(void)
+    {
+        Window::initialise();
+
+        setMaximumSize(Size(1.0f, 1.0f));
+        setSize(Size(1.0f, 1.0f));
+    }
+
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"GUISheet")	return true;
+		return Window::testClassName_impl(class_name);
+	}
+};
+
+
+/*!
+\brief
+    Factory class for producing default windows
+*/
+class GUISheetFactory : public WindowFactory
+{
+public:
+    /*************************************************************************
+        Construction and Destruction
+    *************************************************************************/
+    GUISheetFactory(void) : WindowFactory(GUISheet::WidgetTypeName) { }
+    ~GUISheetFactory(void){}
+
+
+    /*!
+    \brief
+        Create a new Window object of whatever type this WindowFactory produces.
+
+    \param name
+        A unique name that is to be assigned to the newly created Window object
+
+    \return
+        Pointer to the new Window object.
+    */
+    Window* createWindow(const String& name)
+    {
+        return new GUISheet(d_type, name);
+    }
+
+
+    /*!
+    \brief
+        Destroys the given Window object.
+
+    \param window
+        Pointer to the Window object to be destroyed.
+
+    \return
+        Nothing.
+    */
+    virtual void    destroyWindow(Window* window)    { if (window->getType() == d_type) delete window; }
+};
+
+/*!
+\brief
+    typedef for DefaultWindow, which is the new name for GUISheet.
+*/
+typedef GUISheet DefaultWindow;
+
+
+} // End of  CEGUI namespace section
+
+
+#endif  // end of guard _CEGUIGUISheet_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUITextItemProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUITextItemProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUITextItemProperties.h	(revision 1812)
@@ -0,0 +1,120 @@
+/************************************************************************
+	filename: 	CEGUITextItemProperties.h
+	created:	8/4/2005
+	author:		Tomas Lindquist Olsen (based on code by Paul D Turner)
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUITextItemProperties_h_
+#define _CEGUITextItemProperties_h_
+
+#include "CEGUIProperty.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+// Start of TextItemProperties namespace section
+namespace TextItemProperties
+{
+
+/*!
+\brief
+	Property to access the X offset of the text on the item.
+
+	\par Usage:
+		- Name: TextXOffset
+		- Format: "[float]".
+
+	\par Where:
+		- [float] represents the X offset of the text on the item.
+*/
+class TextXOffset : public Property
+{
+public:
+	TextXOffset() : Property(
+		"TextXOffset",
+		"Property to get/set the X offset of the text on the item.  Value is a float.",
+		"0.000000")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the text colour of the item.
+
+	\par Usage:
+		- Name: TextColour
+		- Format: "[aarrggbb]".
+
+	\par Where:
+		- [aarrggbb] represents the text colour of the item.
+*/
+class TextColour : public Property
+{
+public:
+	TextColour() : Property(
+		"TextColour",
+		"Property to get/set the text colour of the item.  Value is a colour.",
+		"00FFFFFF")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the horizontal formatting mode setting.
+
+	\par Usage:
+		- Name: TextFormatting
+		- Format: "[text]".
+
+	\par Where [text] is one of:
+		- "LeftAligned"
+		- "RightAligned"
+		- "HorzCentred"
+		- "HorzJustified"
+		- "WordWrapLeftAligned"
+		- "WordWrapRightAligned"
+		- "WordWrapCentred"
+		- "WordWrapJustified"
+*/
+class TextFormatting : public Property
+{
+public:
+	TextFormatting() : Property(
+		"TextFormatting",
+		"Property to get/set the horizontal formatting mode.  Value is one of the HorzFormatting strings.",
+		"LeftAligned")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+} // End of  TextItemProperties namespace section
+} // End of  CEGUI namespace section
+
+#endif	// end of guard _CEGUITextItemProperties_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIMultiColumnListProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIMultiColumnListProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIMultiColumnListProperties.h	(revision 1812)
@@ -0,0 +1,362 @@
+/************************************************************************
+	filename: 	CEGUIMultiColumnListProperties.h
+	created:	11/7/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to multi-column list properties.
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIMultiColumnListProperties_h_
+#define _CEGUIMultiColumnListProperties_h_
+
+#include "CEGUIProperty.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+// Start of MultiColumnListProperties namespace section
+/*!
+\brief
+	Namespace containing all classes that make up the properties interface for the MultiColumnList class
+*/
+namespace MultiColumnListProperties
+{
+/*!
+\brief
+	Property to access the setting for user sizing of the column headers.
+
+	\par Usage:
+		- Name: ColumnsSizable
+		- Format: "[text]"
+
+	\par Where [Text] is:
+		- "True" to indicate the column headers can be sized by the user.
+		- "False" to indicate the column headers can not be sized by the user.
+*/
+class ColumnsSizable : public Property
+{
+public:
+	ColumnsSizable() : Property(
+		"ColumnsSizable",
+		"Property to get/set the setting for user sizing of the column headers.  Value is either \"True\" or \"False\".",
+		"True")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the setting for user moving of the column headers.
+
+	\par Usage:
+		- Name: ColumnsMovable
+		- Format: "[text]"
+
+	\par Where [Text] is:
+		- "True" to indicate the column headers can be moved by the user.
+		- "False" to indicate the column headers can not be moved by the user.
+*/
+class ColumnsMovable : public Property
+{
+public:
+	ColumnsMovable() : Property(
+		"ColumnsMovable",
+		"Property to get/set the setting for user moving of the column headers.  Value is either \"True\" or \"False\".",
+		"True")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the setting for user modification of the sort column & direction.
+
+	\par Usage:
+		- Name: SortSettingEnabled
+		- Format: "[text]"
+
+	\par Where [Text] is:
+		- "True" to indicate the user may modify the sort column and direction by clicking the header segments.
+		- "False" to indicate the user may not modify the sort column or direction.
+*/
+class SortSettingEnabled : public Property
+{
+public:
+	SortSettingEnabled() : Property(
+		"SortSettingEnabled",
+		"Property to get/set the setting for for user modification of the sort column & direction.  Value is either \"True\" or \"False\".",
+		"True")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the sort direction setting of the list.
+
+	\par Usage:
+		- Name: SortDirection
+		- Format: "[text]"
+
+	\par Where [Text] is one of:
+		- "Ascending"
+		- "Descending"
+		- "None"
+*/
+class SortDirection : public Property
+{
+public:
+	SortDirection() : Property(
+		"SortDirection",
+		"Property to get/set the sort direction setting of the list.  Value is the text of one of the SortDirection enumerated value names.",
+		"None")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the current sort column (via ID code).
+
+	\par Usage:
+		- Name: SortColumnID
+		- Format: "[uint]".
+
+	\par Where:
+		- [uint] is any unsigned integer value.
+*/
+class SortColumnID : public Property
+{
+public:
+	SortColumnID() : Property(
+		"SortColumnID",
+		"Property to get/set the current sort column (via ID code).  Value is an unsigned integer number.",
+		"0", false)
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the nominated selection column (via ID).
+
+	\par Usage:
+		- Name: NominatedSelectionColumnID
+		- Format: "[uint]".
+
+	\par Where:
+		- [uint] is any unsigned integer value representing the ID code of the column to be used.
+*/
+class NominatedSelectionColumnID : public Property
+{
+public:
+	NominatedSelectionColumnID() : Property(
+		"NominatedSelectionColumnID",
+		"Property to get/set the nominated selection column (via ID).  Value is an unsigned integer number.",
+		"0")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the nominated selection row.
+
+	\par Usage:
+		- Name: NominatedSelectionRow
+		- Format: "[uint]".
+
+	\par Where:
+		- [uint] is any unsigned integer value representing the index of the row to be used.
+*/
+class NominatedSelectionRow : public Property
+{
+public:
+	NominatedSelectionRow() : Property(
+		"NominatedSelectionRow",
+		"Property to get/set the nominated selection row.  Value is an unsigned integer number.",
+		"0")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the 'always show' setting for the vertical scroll bar of the list box.
+
+	\par Usage:
+		- Name: ForceVertScrollbar
+		- Format: "[text]"
+
+	\par Where [Text] is:
+		- "True" to indicate that the vertical scroll bar will always be shown.
+		- "False" to indicate that the vertical scroll bar will only be shown when it is needed.
+*/
+class ForceVertScrollbar : public Property
+{
+public:
+	ForceVertScrollbar() : Property(
+		"ForceVertScrollbar",
+		"Property to get/set the 'always show' setting for the vertical scroll bar of the list box.  Value is either \"True\" or \"False\".",
+		"False")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the 'always show' setting for the horizontal scroll bar of the list box.
+
+	\par Usage:
+		- Name: ForceHorzScrollbar
+		- Format: "[text]"
+
+	\par Where [Text] is:
+		- "True" to indicate that the horizontal scroll bar will always be shown.
+		- "False" to indicate that the horizontal scroll bar will only be shown when it is needed.
+*/
+class ForceHorzScrollbar : public Property
+{
+public:
+	ForceHorzScrollbar() : Property(
+		"ForceHorzScrollbar",
+		"Property to get/set the 'always show' setting for the horizontal scroll bar of the list box.  Value is either \"True\" or \"False\".",
+		"False")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the selection mode setting of the list.
+
+	\par Usage:
+		- Name: SelectionMode
+		- Format: "[text]"
+
+	\par Where [Text] is one of:
+		- "RowSingle"
+		- "RowMultiple"
+		- "CellSingle"
+		- "CellMultiple"
+		- "NominatedColumnSingle"
+		- "NominatedColumnMultiple"
+		- "ColumnSingle"
+		- "ColumnMultiple"
+		- "NominatedRowSingle"
+		- "NominatedRowMultiple"
+*/
+class SelectionMode : public Property
+{
+public:
+	SelectionMode() : Property(
+		"SelectionMode",
+		"Property to get/set the selection mode setting of the list.  Value is the text of one of the SelectionMode enumerated value names.",
+		"RowSingle")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access a column.
+
+	\par Usage:
+		- Name: ColumnHeader
+		- Format: "text:[caption] width:[float] id:[uint]"
+
+	\par where:
+		- [caption] is the column header caption text.
+		- [float] is the width of the column.
+		- [uint] is the unique ID for the column.
+*/
+class ColumnHeader : public Property
+{
+public:
+	ColumnHeader() : Property(
+		"ColumnHeader",
+		"Property to set up a column (there is no getter for this property)",
+		"", false)
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+/*!
+\brief
+	Property to access the number of rows in the list (read-only)
+
+	\par Usage:
+		- Name: RowCount
+		- Format: "" (property is read-only).
+*/
+class RowCount : public Property
+{
+public:
+	RowCount() : Property(
+		"RowCount",
+		"Property to access the number of rows in the list (read only)",
+		"", false)
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+} // End of  MultiColumnListProperties namespace section
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIMultiColumnListProperties_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUISlider.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUISlider.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUISlider.h	(revision 1812)
@@ -0,0 +1,331 @@
+/************************************************************************
+	filename: 	CEGUISlider.h
+	created:	13/4/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to base class for Slider widget
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUISlider_h_
+#define _CEGUISlider_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIWindow.h"
+#include "elements/CEGUISliderProperties.h"
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+	Base class for Slider widgets.
+
+	The slider widget has a default range of 0.0f - 1.0f.  This enables use of the slider value to scale
+	any value needed by way of a simple multiplication.
+*/
+class CEGUIEXPORT Slider : public Window
+{
+public:
+	static const String EventNamespace;				//!< Namespace for global events
+
+
+	/*************************************************************************
+		Event name constants
+	*************************************************************************/
+	static const String EventValueChanged;		//!< Event fired when the slider value changes.
+	static const String EventThumbTrackStarted;	//!< Name of the event fired when the user begins dragging the thumb.
+	static const String EventThumbTrackEnded;		//!< Name of the event fired when the user releases the thumb.
+
+
+	/*************************************************************************
+		Accessors
+	*************************************************************************/
+	/*!
+	\brief
+		return the current slider value.
+
+	\return
+		float value equal to the sliders current value.
+	*/
+	float	getCurrentValue(void) const			{return d_value;}
+
+
+	/*!
+	\brief
+		return the maximum value set for this widget
+
+	\return
+		float value equal to the currently set maximum value for this slider.
+	*/
+	float	getMaxValue(void) const				{return d_maxValue;}
+
+
+	/*!
+	\brief
+		return the current click step setting for the slider.
+
+		The click step size is the amount the slider value will be adjusted when the widget
+		is clicked wither side of the slider thumb.
+
+	\return
+		float value representing the current click step setting.
+	*/
+	float	getClickStep(void) const		{return d_step;}
+
+
+	/*************************************************************************
+		Manipulators
+	*************************************************************************/
+	/*!
+	\brief
+		Initialises the Window based object ready for use.
+
+	\note
+		This must be called for every window created.  Normally this is handled automatically by the WindowFactory for each Window type.
+
+	\return
+		Nothing
+	*/
+	virtual	void	initialise(void);
+
+
+	/*!
+	\brief
+		set the maximum value for the slider.  Note that the minimum value is fixed at 0.
+
+	\param maxVal
+		float value specifying the maximum value for this slider widget.
+
+	\return
+		Nothing.
+	*/
+	void	setMaxValue(float maxVal);
+
+
+	/*!
+	\brief
+		set the current slider value.
+
+	\param value
+		float value specifying the new value for this slider widget.
+
+	\return
+		Nothing.
+	*/
+	void	setCurrentValue(float value);
+
+
+	/*!
+	\brief
+		set the current click step setting for the slider.
+
+		The click step size is the amount the slider value will be adjusted when the widget
+		is clicked wither side of the slider thumb.
+
+	\param step
+		float value representing the click step setting to use.
+
+	\return
+		Nothing.
+	*/
+	void	setClickStep(float step)		{d_step = step;}
+
+
+	/*************************************************************************
+		Construction / Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Slider base class constructor
+	*/
+	Slider(const String& type, const String& name);
+
+
+	/*!
+	\brief
+		Slider base class destructor
+	*/
+	virtual ~Slider(void);
+
+
+protected:
+	/*************************************************************************
+		Implementation Functions
+	*************************************************************************/
+	/*!
+	\brief
+		Add slider specific events
+	*/
+	void	addSliderEvents(void);
+
+
+	/*!
+	\brief
+		create a Thumb based widget to use as the thumb for this slider.
+
+    \param name
+        String containing the name to be assigned to the thumb upon creation.
+	*/
+	virtual Thumb*	createThumb(const String& name) const		= 0;
+
+
+	/*!
+	\brief
+		update the size and location of the thumb to properly represent the current state of the slider
+	*/
+	virtual void	updateThumb(void)	= 0;
+
+
+	/*!
+	\brief
+		return value that best represents current slider value given the current location of the thumb.
+
+	\return
+		float value that, given the thumb widget position, best represents the current value for the slider.
+	*/
+	virtual float	getValueFromThumb(void) const	= 0;
+
+
+	/*!
+	\brief
+		Given window location \a pt, return a value indicating what change should be 
+		made to the slider.
+
+	\param pt
+		Point object describing a pixel position in window space.
+
+	\return
+		- -1 to indicate slider should be moved to a lower setting.
+		-  0 to indicate slider should not be moved.
+		- +1 to indicate slider should be moved to a higher setting.
+	*/
+	virtual float	getAdjustDirectionFromPoint(const Point& pt) const	= 0;
+
+
+	/*!
+	\brief
+		handler function for when thumb moves.
+	*/
+	bool	handleThumbMoved(const EventArgs& e);
+
+
+	/*!
+	\brief
+		handler function for when thumb tracking begins
+	*/
+	bool	handleThumbTrackStarted(const EventArgs& e);
+
+
+	/*!
+	\brief
+		handler function for when thumb tracking begins
+	*/
+	bool	handleThumbTrackEnded(const EventArgs& e);
+
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"Slider")	return true;
+		return Window::testClassName_impl(class_name);
+	}
+
+
+	/*************************************************************************
+		New event handlers for slider widget
+	*************************************************************************/
+	/*!
+	\brief
+		Handler triggered when the slider value changes
+	*/
+	virtual void	onValueChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler triggered when the user begins to drag the slider thumb. 
+	*/
+	virtual void	onThumbTrackStarted(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler triggered when the slider thumb is released
+	*/
+	virtual void	onThumbTrackEnded(WindowEventArgs& e);
+
+
+	/*************************************************************************
+		Overridden event handlers
+	*************************************************************************/
+	virtual void	onMouseButtonDown(MouseEventArgs& e);
+	virtual	void	onMouseWheel(MouseEventArgs& e);
+
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	float	d_value;		//!< current slider value
+	float	d_maxValue;		//!< slider maximum value (minimum is fixed at 0)
+	float	d_step;			//!< amount to adjust slider by when clicked (and not dragged).
+
+	// Pointers to the controls that make up the slider
+	Thumb*	d_thumb;		//!< widget used to represent the 'thumb' of the slider.
+
+
+private:
+	/*************************************************************************
+		Static Properties for this class
+	*************************************************************************/
+	static SliderProperties::CurrentValue	d_currentValueProperty;
+	static SliderProperties::MaximumValue	d_maximumValueProperty;
+	static SliderProperties::ClickStepSize	d_clickStepSizeProperty;
+
+
+	/*************************************************************************
+		Private methods
+	*************************************************************************/
+	void	addSliderProperties(void);
+};
+
+} // End of  CEGUI namespace section
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUISlider_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUITitlebarProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUITitlebarProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUITitlebarProperties.h	(revision 1812)
@@ -0,0 +1,98 @@
+/************************************************************************
+	filename: 	CEGUITitlebarProperties.h
+	created:	10/7/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface for title bar property classes
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUITitlebarProperties_h_
+#define _CEGUITitlebarProperties_h_
+
+#include "CEGUIProperty.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+// Start of TitlebarProperties namespace section
+/*!
+\brief
+	Namespace containing all classes that make up the properties interface for the Titlebar class
+*/
+namespace TitlebarProperties
+{
+/*!
+\brief
+	Property to access the state of the dragging enabled setting for the Titlebar.
+
+	\par Usage:
+		- Name: DraggingEnabled
+		- Format: "[text]".
+
+	\par Where [Text] is:
+		- "True" to indicate that drag moving is enabled.
+		- "False" to indicate that drag moving is disabled.
+*/
+class DraggingEnabled : public Property
+{
+public:
+	DraggingEnabled() : Property(
+		"DraggingEnabled",
+		"Property to get/set the state of the dragging enabled setting for the Titlebar.  Value is either \"True\" or \"False\".",
+		"True")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to colour used for rendering the caption text.
+
+	\par Usage:
+		- Name: CaptionColour
+		- Format: "aarrggbb".
+
+	\par Where:
+		- aarrggbb is the ARGB colour value to be used.
+*/
+class CaptionColour : public Property
+{
+public:
+	CaptionColour() : Property(
+		"CaptionColour",
+		"Property to get/set the colour used for rendering the caption text.  Value is \"aarrggbb\" (hex).",
+		"FF000000")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+} // End of  TitlebarProperties namespace section
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUITitlebarProperties_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUITabControlProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUITabControlProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUITabControlProperties.h	(revision 1812)
@@ -0,0 +1,200 @@
+/************************************************************************
+	filename: 	CEGUITabControlProperties.h
+	created:	08/08/2004
+	author:		Steve Streeting
+	
+	purpose:	Interface to TabControl property classes
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUITabControlProperties_h_
+#define _CEGUITabControlProperties_h_
+
+#include "CEGUIProperty.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+// Start of TabControlProperties namespace section
+/*!
+\brief
+	Namespace containing all classes that make up the properties interface for the Listbox class
+*/
+namespace TabControlProperties
+{
+/*!
+\brief
+	Property to access the tab height setting of the tab control.
+
+	\par Usage:
+		- Name: TabHeight
+		- Format: "[float]"
+
+*/
+class TabHeight : public Property
+{
+public:
+	TabHeight() : Property(
+		"TabHeight",
+		"Property to get/set the height of the tabs.",
+		"")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+
+	// default depends upon current metrics mode
+	bool	isDefault(const PropertyReceiver* receiver) const;
+	String	getDefault(const PropertyReceiver* receiver) const;
+};
+
+/*!
+\brief
+Property to access the absolute tab height setting of the tab control.
+
+\par Usage:
+- Name: AbsoluteTabHeight
+- Format: "[float]"
+
+*/
+class AbsoluteTabHeight : public Property
+{
+public:
+    AbsoluteTabHeight() : Property(
+		"AbsoluteTabHeight",
+		"Property to get/set the absolute height of the tabs.",
+		"", false)
+	{}
+
+    String	get(const PropertyReceiver* receiver) const;
+    void	set(PropertyReceiver* receiver, const String& value);
+
+	// default depends upon size of parent
+	bool	isDefault(const PropertyReceiver* receiver) const;
+	String	getDefault(const PropertyReceiver* receiver) const;
+};
+
+/*!
+\brief
+Property to access the relative tab height setting of the tab control.
+
+\par Usage:
+- Name: RelativeTabHeight
+- Format: "[float]"
+
+*/
+class RelativeTabHeight : public Property
+{
+public:
+    RelativeTabHeight() : Property(
+		"RelativeTabHeight",
+		"Property to get/set the relative height of the tabs.",
+		"0.050000", false)
+	{}
+
+    String	get(const PropertyReceiver* receiver) const;
+    void	set(PropertyReceiver* receiver, const String& value);
+};
+
+/*!
+\brief
+Property to access the tab text padding setting of the tab control.
+
+\par Usage:
+- Name: TabTextPadding
+- Format: "[float]"
+
+*/
+class TabTextPadding : public Property
+{
+public:
+    TabTextPadding() : Property(
+		"TabTextPadding", 
+		"Property to get/set the padding either side of the tab buttons.",
+		"")
+	{}
+
+    String	get(const PropertyReceiver* receiver) const;
+    void	set(PropertyReceiver* receiver, const String& value);
+
+	// default depends upon current metrics mode
+	bool	isDefault(const PropertyReceiver* receiver) const;
+	String	getDefault(const PropertyReceiver* receiver) const;
+};
+
+/*!
+\brief
+Property to access the absolute tab text padding setting of the tab control.
+
+\par Usage:
+- Name: AbsoluteTabTextPadding
+- Format: "[float]"
+
+*/
+class AbsoluteTabTextPadding : public Property
+{
+public:
+    AbsoluteTabTextPadding() : Property(
+		"AbsoluteTabTextPadding",
+		"Property to get/set the absolute padding either side of the tab buttons.",
+		"5", false)
+	{}
+
+    String	get(const PropertyReceiver* receiver) const;
+    void	set(PropertyReceiver* receiver, const String& value);
+};
+
+/*!
+\brief
+Property to access the relative tab text padding setting of the tab control.
+
+\par Usage:
+- Name: RelativeTabTextPadding
+- Format: "[float]"
+
+*/
+class RelativeTabTextPadding : public Property
+{
+public:
+    RelativeTabTextPadding() : Property(
+		"RelativeTabTextPadding",
+		"Property to get/set the relative padding either side of the tab buttons.",
+		"", false)
+	{}
+
+    String	get(const PropertyReceiver* receiver) const;
+    void	set(PropertyReceiver* receiver, const String& value);
+
+	// default depends upon size of parent
+	bool	isDefault(const PropertyReceiver* receiver) const;
+	String	getDefault(const PropertyReceiver* receiver) const;
+};
+
+
+
+
+
+} // End of  TabControlProperties namespace section
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIListboxProperties_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIScrollablePane.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIScrollablePane.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIScrollablePane.h	(revision 1812)
@@ -0,0 +1,581 @@
+/************************************************************************
+	filename: 	CEGUIScrollablePane.h
+	created:	1/3/2005
+	author:		Paul D Turner
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIScrollablePane_h_
+#define _CEGUIScrollablePane_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIWindow.h"
+#include "elements/CEGUIScrollablePaneProperties.h"
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+    /*!
+    \brief
+        Base class for the ScrollablePane widget.
+
+        The ScrollablePane widget allows child windows to be attached which cover an area
+        larger than the ScrollablePane itself and these child windows can be scrolled into
+        view using the scrollbars of the scrollable pane.
+    */
+    class CEGUIEXPORT ScrollablePane : public Window
+    {
+    public:
+        /*************************************************************************
+            Constants
+        *************************************************************************/
+        static const String EventNamespace;                 //!< Namespace for global events
+        static const String EventContentPaneChanged;        //!< Event fired when an area on the content pane has been updated.
+        static const String EventVertScrollbarModeChanged;	//!< Event triggered when the vertical scroll bar 'force' setting changes.
+        static const String EventHorzScrollbarModeChanged;	//!< Event triggered when the horizontal scroll bar 'force' setting changes.
+        static const String EventAutoSizeSettingChanged;    //!< Event fired when the auto size setting changes.
+        static const String EventContentPaneScrolled;       //!< Event fired when the pane gets scrolled.
+
+        /*************************************************************************
+            Construction / Destruction
+        *************************************************************************/
+        /*!
+        \brief
+            Constructor for the ScrollablePane base class.
+        */
+        ScrollablePane(const String& type, const String& name);
+
+        /*!
+        \brief
+            Destructor for the ScrollablePane base class.
+        */
+        ~ScrollablePane(void);
+
+        /*************************************************************************
+        	Public interface
+        *************************************************************************/
+        /*!
+        \brief
+            Returns a pointer to the window holding the pane contents.
+
+            The purpose of this is so that attached windows may be inspected,
+            client code may not modify the returned window in any way.
+
+        \return
+            Pointer to the ScrolledContainer that is acting as the container for the
+            scrollable pane content.  The returned window is const, client code should
+            not modify the ScrolledContainer settings directly.
+        */
+        const ScrolledContainer* getContentPane(void) const;
+
+        /*!
+        \brief
+            Return whether the vertical scroll bar is always shown.
+
+        \return
+            - true if the scroll bar will always be shown even if it is not required.
+            - false if the scroll bar will only be shown when it is required.
+        */
+        bool	isVertScrollbarAlwaysShown(void) const;
+        /*!
+        \brief
+            Set whether the vertical scroll bar should always be shown.
+
+        \param setting
+            - true if the vertical scroll bar should be shown even when it is not required.
+            - false if the vertical scroll bar should only be shown when it is required.
+
+        \return
+            Nothing.
+        */
+        void	setShowVertScrollbar(bool setting);
+
+        /*!
+        \brief
+            Return whether the horizontal scroll bar is always shown.
+
+        \return
+            - true if the scroll bar will always be shown even if it is not required.
+            - false if the scroll bar will only be shown when it is required.
+        */
+        bool	isHorzScrollbarAlwaysShown(void) const;
+
+        /*!
+        \brief
+            Set whether the horizontal scroll bar should always be shown.
+
+        \param setting
+            - true if the horizontal scroll bar should be shown even when it is not required.
+            - false if the horizontal scroll bar should only be shown when it is required.
+
+        \return
+            Nothing.
+        */
+        void	setShowHorzScrollbar(bool setting);
+
+        /*!
+        \brief
+            Return whether the content pane is auto sized.
+
+        \return
+            - true to indicate the content pane will automatically resize itself.
+            - false to indicate the content pane will not automatically resize itself.
+        */
+        bool isContentPaneAutoSized(void) const;
+
+        /*!
+        \brief
+            Set whether the content pane should be auto-sized.
+
+        \param setting
+            - true to indicate the content pane should automatically resize itself.
+            - false to indicate the content pane should not automatically resize itself.
+
+        \return 
+            Nothing.
+        */
+        void setContentPaneAutoSized(bool setting);
+
+        /*!
+        \brief
+            Return the current content pane area for the ScrollablePane.
+
+        \return
+            Rect object that details the current pixel extents of the content
+            pane attached to this ScrollablePane.
+        */
+        const Rect& getContentPaneArea(void) const;
+
+        /*!
+        \brief
+            Set the current content pane area for the ScrollablePane.
+
+        \note
+            If the ScrollablePane is configured to auto-size the content pane
+            this call will have no effect.
+
+        \param area
+            Rect object that details the pixel extents to use for the content
+            pane attached to this ScrollablePane.
+
+        \return
+            Nothing.
+        */
+        void setContentPaneArea(const Rect& area);
+
+        /*!
+        \brief
+            Returns the horizontal scrollbar step size as a fraction of one
+            complete view page.
+
+        \return
+            float value specifying the step size where 1.0f would be the width of
+            the viewing area.
+        */
+        float getHorizontalStepSize(void) const;
+
+        /*!
+        \brief
+            Sets the horizontal scrollbar step size as a fraction of one
+            complete view page.
+
+        \param step
+            float value specifying the step size, where 1.0f would be the width of
+            the viewing area.
+
+        \return
+            Nothing.
+        */
+        void setHorizontalStepSize(float step);
+
+        /*!
+        \brief
+            Returns the horizontal scrollbar overlap size as a fraction of one
+            complete view page.
+
+        \return
+            float value specifying the overlap size where 1.0f would be the width of
+            the viewing area.
+        */
+        float getHorizontalOverlapSize(void) const;
+
+        /*!
+        \brief
+            Sets the horizontal scrollbar overlap size as a fraction of one
+            complete view page.
+
+        \param overlap
+            float value specifying the overlap size, where 1.0f would be the width of
+            the viewing area.
+
+        \return
+            Nothing.
+        */
+        void setHorizontalOverlapSize(float overlap);
+
+        /*!
+        \brief
+            Returns the horizontal scroll position as a fraction of the
+            complete scrollable width.
+
+        \return
+            float value specifying the scroll position.
+        */
+        float getHorizontalScrollPosition(void) const;
+
+        /*!
+        \brief
+            Sets the horizontal scroll position as a fraction of the
+            complete scrollable width.
+
+        \param position
+            float value specifying the new scroll position.
+
+        \return
+            Nothing.
+        */
+        void setHorizontalScrollPosition(float position);
+
+        /*!
+        \brief
+            Returns the vertical scrollbar step size as a fraction of one
+            complete view page.
+
+        \return
+            float value specifying the step size where 1.0f would be the height of
+            the viewing area.
+        */
+        float getVerticalStepSize(void) const;
+
+        /*!
+        \brief
+            Sets the vertical scrollbar step size as a fraction of one
+            complete view page.
+
+        \param step
+            float value specifying the step size, where 1.0f would be the height of
+            the viewing area.
+
+        \return
+            Nothing.
+        */
+        void setVerticalStepSize(float step);
+
+        /*!
+        \brief
+            Returns the vertical scrollbar overlap size as a fraction of one
+            complete view page.
+
+        \return
+            float value specifying the overlap size where 1.0f would be the height of
+            the viewing area.
+        */
+        float getVerticalOverlapSize(void) const;
+
+        /*!
+        \brief
+            Sets the vertical scrollbar overlap size as a fraction of one
+            complete view page.
+
+        \param overlap
+            float value specifying the overlap size, where 1.0f would be the height of
+            the viewing area.
+
+        \return
+            Nothing.
+        */
+        void setVerticalOverlapSize(float overlap);
+
+        /*!
+        \brief
+            Returns the vertical scroll position as a fraction of the
+            complete scrollable height.
+
+        \return
+            float value specifying the scroll position.
+        */
+        float getVerticalScrollPosition(void) const;
+
+        /*!
+        \brief
+            Sets the vertical scroll position as a fraction of the
+            complete scrollable height.
+
+        \param position
+            float value specifying the new scroll position.
+
+        \return
+            Nothing.
+        */
+        void setVerticalScrollPosition(float position);
+
+        /*************************************************************************
+            Overridden from Window
+        *************************************************************************/
+        void initialise(void);
+
+    protected:
+        /*************************************************************************
+        	Abstract interface
+        *************************************************************************/
+        /*!
+        \brief
+            Create a Scrollbar based widget to be used as the horizontal scrollbar.
+
+        \param name
+            String object holding the name that must be used when creating the widget.
+
+        \return
+            Scrollbar based object.
+        */
+        virtual Scrollbar* createHorizontalScrollbar(const String& name) const = 0;
+
+        /*!
+        \brief
+            Create a Scrollbar based widget to be used as the vertical scrollbar.
+
+        \param name
+            String object holding the name that must be used when creating the widget.
+
+        \return
+            Scrollbar based object.
+        */
+        virtual Scrollbar* createVerticalScrollbar(const String& name) const = 0;
+
+        /*!
+        \brief
+            Return a Rect that described the pane's viewable area, relative
+            to this Window, in pixels.
+
+        \return
+            Rect object describing the ScrollablePane's viewable area.
+        */
+        virtual Rect getViewableArea(void) const = 0;
+
+        /*************************************************************************
+        	Implementation Methods
+        *************************************************************************/
+        /*!
+        \brief
+            Add ScrollablePane specific events
+        */
+        void addScrollablePaneEvents(void);
+
+        /*!
+	    \brief
+		    display required integrated scroll bars according to current size of
+            the ScrollablePane view area and the size of the attached ScrolledContainer.
+	    */
+	    void configureScrollbars(void);
+
+        /*!
+        \brief
+            Return whether the vertical scrollbar is needed.
+
+        \return
+            - true if the scrollbar is either needed or forced via setting.
+            - false if the scrollbar should not be shown.
+        */
+        bool isVertScrollbarNeeded(void) const;
+
+        /*!
+        \brief
+            Return whether the horizontal scrollbar is needed.
+
+        \return
+            - true if the scrollbar is either needed or forced via setting.
+            - false if the scrollbar should not be shown.
+        */
+        bool isHorzScrollbarNeeded(void) const;
+
+        /*!
+        \brief
+            Update the content container position according to the current 
+            state of the widget (like scrollbar positions, etc).
+        */
+        void updateContainerPosition(void);
+
+
+		/*!
+		\brief
+			Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+		\param class_name
+			The class name that is to be checked.
+
+		\return
+			true if this window was inherited from \a class_name. false if not.
+		*/
+		virtual bool	testClassName_impl(const String& class_name) const
+		{
+			if (class_name==(const utf8*)"ScrollablePane")	return true;
+			return Window::testClassName_impl(class_name);
+		}
+
+
+        /*************************************************************************
+        	Event triggers
+        *************************************************************************/
+        /*!
+        \brief
+            Event trigger method called when some pane content has changed size
+            or location.
+
+        \param e
+            WindowEventArgs object.
+
+        \return
+            Nothing.
+        */
+        virtual void onContentPaneChanged(WindowEventArgs& e);
+
+        /*!
+        \brief
+            Event trigger method called when the setting that controls whether the 
+            vertical scrollbar is always shown or not, is changed.
+
+        \param e
+            WindowEventArgs object.
+
+        \return
+            Nothing.
+        */
+        virtual void onVertScrollbarModeChanged(WindowEventArgs& e);
+
+        /*!
+        \brief
+            Event trigger method called when the setting that controls whether the 
+            horizontal scrollbar is always shown or not, is changed.
+
+        \param e
+            WindowEventArgs object.
+
+        \return
+            Nothing.
+        */
+        virtual void onHorzScrollbarModeChanged(WindowEventArgs& e);
+
+        /*!
+        \brief
+            Notification method called whenever the setting that controls whether
+            the content pane is automatically sized is changed.
+
+        \param e
+            WindowEventArgs object.
+
+        \return
+            Nothing.
+        */
+        virtual void onAutoSizeSettingChanged(WindowEventArgs& e);
+
+        /*!
+        \brief
+            Notification method called whenever the content pane is scrolled via
+            changes in the scrollbar positions.
+
+        \param e
+            WindowEventArgs object.
+
+        \return
+            Nothing.
+        */
+        virtual void onContentPaneScrolled(WindowEventArgs& e);
+
+        /*************************************************************************
+        	Event handler methods
+        *************************************************************************/
+        /*!
+        \brief
+            Handler method which gets subscribed to the scrollbar position change
+            events.
+        */
+        bool handleScrollChange(const EventArgs&  e);
+
+        /*!
+        \brief
+            Handler method which gets subscribed to the ScrolledContainer content
+            change events.
+        */
+        bool handleContentAreaChange(const EventArgs& e);
+
+        /*!
+        \brief
+            Handler method which gets subscribed to the ScrolledContainer auto-size
+            setting changes.
+        */
+        bool handleAutoSizePaneChanged(const EventArgs& e);
+
+        /*************************************************************************
+        	Overridden from Window
+        *************************************************************************/
+        void addChild_impl(Window* wnd);
+        void removeChild_impl(Window* wnd);
+        void onSized(WindowEventArgs& e);
+        void onMouseWheel(MouseEventArgs& e);
+
+        /*************************************************************************
+        	Data fields
+        *************************************************************************/
+        bool    d_forceVertScroll;		//!< true if vertical scrollbar should always be displayed
+        bool    d_forceHorzScroll;		//!< true if horizontal scrollbar should always be displayed
+        Rect    d_contentRect;          //!< holds content area so we can track changes.
+        float   d_vertStep;             //!< vertical scroll step fraction.
+        float   d_vertOverlap;          //!< vertical scroll overlap fraction.
+        float   d_horzStep;             //!< horizontal scroll step fraction.
+        float   d_horzOverlap;          //!< horizontal scroll overlap fraction.
+
+        // component widgets
+        Scrollbar*  d_vertScrollbar;        //!< Scrollbar widget used for vertical scrolling.
+        Scrollbar*  d_horzScrollbar;        //!< Scrollbar widget used for horizontal scrolling.
+        ScrolledContainer*  d_container;    //!< ScrolledContainer widget holding the attached widgets.
+
+    private:
+	    /*************************************************************************
+		    Static Properties for this class
+	    *************************************************************************/
+        static ScrollablePaneProperties::ForceHorzScrollbar     d_horzScrollbarProperty;
+        static ScrollablePaneProperties::ForceVertScrollbar     d_vertScrollbarProperty;
+	    static ScrollablePaneProperties::ContentPaneAutoSized	d_autoSizedProperty;
+	    static ScrollablePaneProperties::ContentArea            d_contentAreaProperty;
+        static ScrollablePaneProperties::HorzStepSize           d_horzStepProperty;
+        static ScrollablePaneProperties::HorzOverlapSize        d_horzOverlapProperty;
+        static ScrollablePaneProperties::HorzScrollPosition     d_horzScrollPositionProperty;
+        static ScrollablePaneProperties::VertStepSize           d_vertStepProperty;
+        static ScrollablePaneProperties::VertOverlapSize        d_vertOverlapProperty;
+        static ScrollablePaneProperties::VertScrollPosition     d_vertScrollPositionProperty;
+
+	    /*************************************************************************
+		    Private methods
+	    *************************************************************************/
+	    void addScrollablePaneProperties(void);
+    };
+
+} // End of  CEGUI namespace section
+
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIScrollablePane_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIStaticImage.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIStaticImage.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIStaticImage.h	(revision 1812)
@@ -0,0 +1,343 @@
+/************************************************************************
+	filename: 	CEGUIStaticImage.h
+	created:	4/6/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface for the static image widget.
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIStaticImage_h_
+#define _CEGUIStaticImage_h_
+
+#include "elements/CEGUIStatic.h"
+#include "CEGUIRenderableImage.h"
+#include "elements/CEGUIStaticImageProperties.h"
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Static image widget class.
+
+	This base class performs it's own rendering.  There is no need to override this widget to perform rendering
+	of static images.
+*/
+class CEGUIEXPORT StaticImage : public Static
+{
+public:
+	static const String EventNamespace;				//!< Namespace for global events
+
+
+	/*************************************************************************
+		Formatting Enumerations
+	*************************************************************************/
+	/*!
+	\brief
+		Enumeration of horizontal formatting options for static image widgets
+	*/
+	enum HorzFormatting
+	{
+		LeftAligned,	//!< Image will be rendered at it's natural width, with it's left edge aligned with the left edge of the widget.
+		RightAligned,	//!< Image will be rendered at it's natural width, with it's right edge aligned with the right edge of the widget.
+		HorzCentred,	//!< Image will be rendered at it's natural width, horizontally centred within the widget.
+		HorzStretched,	//!< Image will be horizontally stretched to cover the entire width of the widget.
+		HorzTiled		//!< Image will be tiled horizontally across the width of the widget.  The rightmost tile may be clipped.
+	};
+
+
+	/*!
+	\brief
+		Enumeration of vertical formatting options for a static image widgets
+	*/
+	enum VertFormatting
+	{
+		TopAligned,		//!< Image will be rendered at it's natural height, with it's top edge aligned with the top edge of the widget.
+		BottomAligned,	//!< Image will be rendered at it's natural height, with it's bottom edge aligned with the bottom edge of the widget.
+		VertCentred,	//!< Image will be rendered at it's natural height, vertically centred within the widget.
+		VertStretched,	//!< Image will be vertically stretched to cover the entire height of the widget.
+		VertTiled		//!< Image will be tiled vertically down the height of the widget.  The bottommost tile may be clipped.
+	};
+
+
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for StaticImage widgets.
+	*/
+	StaticImage(const String& type, const String& name);
+
+
+	/*!
+	\brief
+		Destructor for StaticImage widgets.
+	*/
+	virtual ~StaticImage(void);
+
+
+	/*************************************************************************
+		Accessors
+	*************************************************************************/
+	/*!
+	\brief
+		Return a pointer to the current image displayed by this static image widget.
+
+	\return
+		Pointer to the Image object that is used to render this widget, or NULL for none.
+	*/
+	const Image*	getImage(void) const		{return d_image.getImage();}
+
+
+	/*!
+	\brief
+		Return a ColourRect object containing the colours used when rendering this widget.
+
+	\return
+		ColourRect object initialised with the colours used when rendering the image for this widget.
+	*/
+	ColourRect	getImageColours(void) const		{return d_imageCols;}
+
+	
+	/*!
+	\brief
+		Return the current horizontal formatting option set for this widget.
+
+	\return
+		One of the StaticImage::HorzFormatting enumerated values specifying the horizontal formatting currently set.
+	*/
+	HorzFormatting	getHorizontalFormatting(void) const		{return	(HorzFormatting)d_image.getHorzFormatting();}
+
+
+	/*!
+	\brief
+		Return the current vertical formatting option set for this widget.
+
+	\return
+		One of the StaticImage::VertFormatting enumerated values specifying the vertical formatting currently set.
+	*/
+	VertFormatting	getVerticalFormatting(void) const		{return	(VertFormatting)d_image.getVertFormatting();}
+
+
+	/*************************************************************************
+		Manipulators
+	*************************************************************************/
+	/*!
+	\brief
+		Set the Image object to be drawn by this widget.
+
+	\param image
+		Pointer to the Image object to be rendered.  Can be NULL to specify no image is to be rendered.
+	
+	\return
+		Nothing.
+	*/
+	void	setImage(const Image* image);
+
+
+	/*!
+	\brief
+		Set the Image object to be drawn by this widget.
+
+	\param imageset
+		String object specifying the name of the Imageset that holds the required image.
+
+	\param image
+		Name of the Image on the specified Imageset that is to be used.
+	
+	\return
+		Nothing.
+
+	\exception UnknownObjectException	thrown if Imageset \a imageset does not exist in the system or if \a imageset contains no Image named \a image.
+	*/
+	void	setImage(const String& imageset, const String& image);
+
+
+	/*!
+	\brief
+		Sets the colours to be applied when rendering the image.
+
+	\param colours
+		ColourRect object describing the colours to be used.
+
+	\return 
+		Nothing.
+	*/
+	void	setImageColours(const ColourRect& colours);
+
+
+	/*!
+	\brief
+		Sets the colours to be applied when rendering the image.
+
+	\param top_left_colour
+		Colour to be applied to the top-left corner of each Image used in the image.
+
+	\param top_right_colour
+		Colour to be applied to the top-right corner of each Image used in the image.
+
+	\param bottom_left_colour
+		Colour to be applied to the bottom-left corner of each Image used in the image.
+
+	\param bottom_right_colour
+		Colour to be applied to the bottom-right corner of each Image used in the image.
+
+	\return 
+		Nothing.
+	*/
+	void	setImageColours(const colour& top_left_colour, const colour& top_right_colour, const colour& bottom_left_colour, const colour& bottom_right_colour);
+
+
+	/*!
+	\brief
+		Sets the colour to be applied when rendering the image.
+
+	\param col
+		colour value to be used when rendering.
+
+	\return
+		Nothing.
+	*/
+	void	setImageColours(const colour& col)		{setImageColours(col, col, col, col);}
+
+
+	/*!
+	\brief
+		Set the formatting required for the image.
+
+	\param h_fmt
+		One of the HorzFormatting enumerated values specifying the formatting required.
+
+	\param v_fmt
+		One of the VertFormatting enumerated values specifying the formatting required.
+
+	\return
+		Nothing
+	*/
+	void	setFormatting(HorzFormatting h_fmt, VertFormatting v_fmt);
+
+
+	/*!
+	\brief
+		Set the formatting required for the image.
+
+	\param v_fmt
+		One of the VertFormatting enumerated values specifying the formatting required.
+
+	\return
+		Nothing
+	*/
+	void	setVerticalFormatting(VertFormatting v_fmt);
+
+
+	/*!
+	\brief
+		Set the formatting required for the image.
+
+	\param h_fmt
+		One of the HorzFormatting enumerated values specifying the formatting required.
+
+	\return
+		Nothing
+	*/
+	void	setHorizontalFormatting(HorzFormatting h_fmt);
+
+
+protected:
+	/*************************************************************************
+		Overridden from base class
+	*************************************************************************/
+	virtual	void populateRenderCache();
+
+	
+	/*************************************************************************
+		Event handling
+	*************************************************************************/
+	virtual void	onSized(WindowEventArgs& e);
+	virtual void	onAlphaChanged(WindowEventArgs& e);
+	virtual void	onStaticFrameChanged(WindowEventArgs& e);
+
+
+	/*************************************************************************
+		Implementation Methods
+	*************************************************************************/
+	/*!
+	\brief
+		update the internal RenderableImage with currently set colours and
+		alpha settings.
+	*/
+	void	updateRenderableImageColours(void);
+
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"StaticImage")	return true;
+		return Static::testClassName_impl(class_name);
+	}
+
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	RenderableImage	d_image;		//!< RenderableImage that does most of the work for us.
+	ColourRect		d_imageCols;	//!< Colours to use for the image.
+
+
+private:
+	/*************************************************************************
+		Static Properties for this class
+	*************************************************************************/
+	static StaticImageProperties::Image				d_imageProperty;
+	static StaticImageProperties::ImageColours		d_imageColoursProperty;
+	static StaticImageProperties::VertFormatting	d_vertFormattingProperty;
+	static StaticImageProperties::HorzFormatting	d_horzFormattingProperty;
+
+
+	/*************************************************************************
+		Private methods
+	*************************************************************************/
+	void	addStaticImageProperties(void);
+};
+
+} // End of  CEGUI namespace section
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIStaticImage_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIThumbProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIThumbProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIThumbProperties.h	(revision 1812)
@@ -0,0 +1,178 @@
+/************************************************************************
+	filename: 	CEGUIThumbProperties.h
+	created:	10/7/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface for Thumb properties
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIThumbProperties_h_
+#define _CEGUIThumbProperties_h_
+
+#include "CEGUIProperty.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+// Start of ThumbProperties namespace section
+/*!
+\brief
+	Namespace containing all classes that make up the properties interface for the Thumb class
+*/
+namespace ThumbProperties
+{
+/*!
+\brief
+	Property to access the state of the "hot-tracked" setting for the thumb.
+
+	\par Usage:
+		- Name: HotTracked
+		- Format: "[text]".
+
+	\par Where [Text] is:
+		- "True" to indicate the thumb will send notifications as it is dragged.
+		- "False" to indicate the thumb will only notify once, when it is released.
+*/
+class HotTracked : public Property
+{
+public:
+	HotTracked() : Property(
+		"HotTracked",
+		"Property to get/set the state of the state of the 'hot-tracked' setting for the thumb.  Value is either \"True\" or \"False\".",
+		"True")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the state the setting to free the thumb vertically.
+
+	\par Usage:
+		- Name: VertFree
+		- Format: "[text]".
+
+	\par Where [Text] is:
+		- "True" to indicate the thumb will be free (movable) vertically.
+		- "False" to indicate the thumb will be fixed vertically.
+*/
+class VertFree : public Property
+{
+public:
+	VertFree() : Property(
+		"VertFree",
+		"Property to get/set the state the setting to free the thumb vertically.  Value is either \"True\" or \"False\".",
+		"False")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the state the setting to free the thumb horizontally.
+
+	\par Usage:
+		- Name: HorzFree
+		- Format: "[text]".
+
+	\par Where [Text] is:
+		- "True" to indicate the thumb will be free (movable) horizontally.
+		- "False" to indicate the thumb will be fixed horizontally.
+*/
+class HorzFree : public Property
+{
+public:
+	HorzFree() : Property(
+		"HorzFree", 
+		"Property to get/set the state the setting to free the thumb horizontally.  Value is either \"True\" or \"False\".",
+		"False")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the vertical movement range for the thumb.
+
+	\par Usage:
+		- Name: VertRange
+		- Format: "min:[float] max:[float]".
+
+	\par Where:
+		- min:[float] specifies the minimum vertical setting (position) for the thumb, specified using the active metrics system for the window.
+		- max:[float] specifies the maximum vertical setting (position) for the thumb, specified using the active metrics system for the window.
+*/
+class VertRange : public Property
+{
+public:
+	VertRange() : Property(
+		"VertRange",
+		"Property to get/set the vertical movement range for the thumb.  Value is \"min:[float] max:[float]\".",
+		"min:0.000000 max:1.000000")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the horizontal movement range for the thumb.
+
+	\par Usage:
+		- Name: HorzRange
+		- Format: "min:[float] max:[float]".
+
+	\par Where:
+		- min:[float] specifies the minimum horizontal setting (position) for the thumb, specified using the active metrics system for the window.
+		- max:[float] specifies the maximum horizontal setting (position) for the thumb, specified using the active metrics system for the window.
+*/
+class HorzRange : public Property
+{
+public:
+	HorzRange() : Property(
+		"HorzRange",
+		"Property to get/set the horizontal movement range for the thumb.  Value is \"min:[float] max:[float]\".",
+		"min:0.000000 max:1.000000")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+} // End of  ThumbProperties namespace section
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIThumbProperties_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIMultiLineEditboxProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIMultiLineEditboxProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIMultiLineEditboxProperties.h	(revision 1812)
@@ -0,0 +1,300 @@
+/************************************************************************
+	filename: 	CEGUIMultiLineEditboxProperties.h
+	created:	10/7/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to properties for the MultiLineEditbox class
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIMultiLineEditboxProperties_h_
+#define _CEGUIMultiLineEditboxProperties_h_
+
+#include "CEGUIProperty.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+// Start of MultiLineEditboxProperties namespace section
+/*!
+\brief
+	Namespace containing all classes that make up the properties interface for the MultiLineEditbox class
+*/
+namespace MultiLineEditboxProperties
+{
+/*!
+\brief
+	Property to access the read-only setting of the edit box.
+
+	\par Usage:
+		- Name: ReadOnly
+		- Format: "[text]"
+
+	\par Where [Text] is:
+		- "True" to indicate the edit box is read-only.
+		- "False" to indicate the edit box is not read-only (text may be edited by user).
+*/
+class ReadOnly : public Property
+{
+public:
+	ReadOnly() : Property(
+		"ReadOnly",
+		"Property to get/set the read-only setting for the edit box.  Value is either \"True\" or \"False\".",
+		"False")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the word-wrap setting of the edit box.
+
+	\par Usage:
+		- Name: WordWrap
+		- Format: "[text]"
+
+	\par Where [Text] is:
+		- "True" to indicate the text should be word-wrapped.
+		- "False" to indicate the text should not be word-wrapped.
+*/
+class WordWrap : public Property
+{
+public:
+	WordWrap() : Property(
+		"WordWrap",
+		"Property to get/set the word-wrap setting of the edit box.  Value is either \"True\" or \"False\".",
+		"True")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the current carat index.
+
+	\par Usage:
+		- Name: CaratIndex
+		- Format: "[uint]"
+
+	\par Where:
+		- [uint] is the zero based index of the carat position within the text.
+*/
+class CaratIndex : public Property
+{
+public:
+	CaratIndex() : Property(
+		"CaratIndex",
+		"Property to get/set the current carat index.  Value is \"[uint]\".",
+		"0")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the current selection start index.
+
+	\par Usage:
+		- Name: SelectionStart
+		- Format: "[uint]"
+
+	\par Where:
+		- [uint] is the zero based index of the selection start position within the text.
+*/
+class SelectionStart : public Property
+{
+public:
+	SelectionStart() : Property(
+		"SelectionStart",
+		"Property to get/set the zero based index of the selection start position within the text.  Value is \"[uint]\".",
+		"0")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the current selection length.
+
+	\par Usage:
+		- Name: SelectionLength
+		- Format: "[uint]"
+
+	\par Where:
+		- [uint] is the length of the selection (as a count of the number of code points selected).
+*/
+class SelectionLength : public Property
+{
+public:
+	SelectionLength() : Property(
+		"SelectionLength",
+		"Property to get/set the length of the selection (as a count of the number of code points selected).  Value is \"[uint]\".",
+		"0")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the maximum text length for the edit box.
+
+	\par Usage:
+		- Name: MaxTextLength
+		- Format: "[uint]"
+
+	\par Where:
+		- [uint] is the maximum allowed text length (as a count of code points).
+*/
+class MaxTextLength : public Property
+{
+public:
+	MaxTextLength() : Property(
+		"MaxTextLength",
+		"Property to get/set the the maximum allowed text length (as a count of code points).  Value is \"[uint]\".",
+		"1073741824")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the normal, unselected, text colour used for rendering text.
+
+	\par Usage:
+		- Name: NormalTextColour
+		- Format: "aarrggbb".
+
+	\par Where:
+		- aarrggbb is the ARGB colour value to be used.
+*/
+class NormalTextColour : public Property
+{
+public:
+	NormalTextColour() : Property(
+		"NormalTextColour",
+		"Property to get/set the normal, unselected, text colour used for rendering text.  Value is \"aarrggbb\" (hex).",
+		"FFFFFFFF")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the colour used for rendering text within the selection area.
+
+	\par Usage:
+		- Name: SelectedTextColour
+		- Format: "aarrggbb".
+
+	\par Where:
+		- aarrggbb is the ARGB colour value to be used.
+*/
+class SelectedTextColour : public Property
+{
+public:
+	SelectedTextColour() : Property(
+		"SelectedTextColour",
+		"Property to get/set the colour used for rendering text within the selection area.  Value is \"aarrggbb\" (hex).",
+		"FF000000")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the colour used for rendering the selection highlight when the edit box is active.
+
+	\par Usage:
+		- Name: ActiveSelectionColour
+		- Format: "aarrggbb".
+
+	\par Where:
+		- aarrggbb is the ARGB colour value to be used.
+*/
+class ActiveSelectionColour : public Property
+{
+public:
+	ActiveSelectionColour() : Property(
+		"ActiveSelectionColour",
+		"Property to get/set the colour used for rendering the selection highlight when the edit box is active.  Value is \"aarrggbb\" (hex).",
+		"FF6060FF")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the colour used for rendering the selection highlight when the edit box is inactive.
+
+	\par Usage:
+		- Name: InactiveSelectionColour
+		- Format: "aarrggbb".
+
+	\par Where:
+		- aarrggbb is the ARGB colour value to be used.
+*/
+class InactiveSelectionColour : public Property
+{
+public:
+	InactiveSelectionColour() : Property(
+		"InactiveSelectionColour",
+		"Property to get/set the colour used for rendering the selection highlight when the edit box is inactive.  Value is \"aarrggbb\" (hex).",
+		"FF808080")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+} // End of  MultiLineEditboxProperties namespace section
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIMultiLineEditboxProperties_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIMenuBase.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIMenuBase.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIMenuBase.h	(revision 1812)
@@ -0,0 +1,296 @@
+/************************************************************************
+	filename: 	CEGUIMenuBase.h
+	created:	5/4/2005
+	author:		Tomas Lindquist Olsen (based on code by Paul D Turner)
+	
+	purpose:	Interface to base class for MenuBase widget
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIMenuBase_h_
+#define _CEGUIMenuBase_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIWindow.h"
+#include "elements/CEGUIMenuBaseProperties.h"
+#include "elements/CEGUIItemListBase.h"
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+	Abstract base class for menus.
+*/
+class CEGUIEXPORT MenuBase : public ItemListBase
+{
+public:
+	static const String EventNamespace;				//!< Namespace for global events
+
+	/*************************************************************************
+		Constants
+	*************************************************************************/
+	static const colour DefaultBackgroundColour;			//!< Default background colour
+
+
+	/*************************************************************************
+		Event name constants
+	*************************************************************************/
+	// generated internally by Window
+	static const String EventPopupOpened;					//!< A MenuItem attached to this menu opened a PopupMenu
+	static const String EventPopupClosed;					//!< A MenuItem attached to this menu opened a PopupMenu
+
+
+	/*************************************************************************
+		Accessor type functions
+	*************************************************************************/
+	/*!
+	\brief
+		Get the item spacing for this menu.
+
+	\return
+		A float value with the current item spacing for this menu
+	*/
+	float	getItemSpacing(void) const					{return d_itemSpacing;}
+
+
+	/*!
+	\brief
+		Get the horizontal padding for this menu's items.
+
+	\return
+		A float value with the current horizontal padding for this menu's items.
+	*/
+	float	getHorzPadding(void) const					{return d_horzPadding;}
+
+
+	/*!
+	\brief
+		Get the vertical padding for this menu's items.
+
+	\return
+		A float value with the current vertical padding for this menu's items.
+	*/
+	float	getVertPadding(void) const					{return d_vertPadding;}
+
+
+	/*!
+	\brief
+		Get the border width for this menu.
+
+	\return
+		A float value with the current border width for this menu.
+	*/
+	float	getBorderWidth(void) const					{return d_borderWidth;}	
+
+
+	/*!
+	\brief
+		Get the ColourRect with the colours used for rendering the background of this menu.
+
+	\return
+		A ColourRect with the colours used for rendering the background of this menu.
+	*/
+	const ColourRect&	getBackgroundColours(void) const	{return d_backgroundColours;}
+
+
+	/*!
+	\brief
+		Return whether this menu allows multiple popup menus to open at the same time.
+
+	\return
+		true if this menu allows multiple popup menus to be opened simultaneously. false if not
+	*/
+	bool	isMultiplePopupsAllowed(void) const			{return d_allowMultiplePopups;}
+
+
+	/*!
+	\brief
+		Get currently opened MenuItem in this menu. Returns NULL if menu item is open.
+
+	\return
+		Pointer to the MenuItem currently open.
+	*/
+	MenuItem*	getPopupMenuItem(void) const				{return d_popup;}
+
+
+	/*************************************************************************
+		Manipulators
+	*************************************************************************/
+	/*!
+	\brief
+		Set the item spacing for this menu.
+	*/
+	void	setItemSpacing(float spacing)				{d_itemSpacing=spacing;handleUpdatedItemData();}
+
+
+	/*!
+	\brief
+		Set the horizontal padding for this menu's items.
+	*/
+	void	setHorzPadding(float padding)				{d_horzPadding=padding;handleUpdatedItemData();}
+
+
+	/*!
+	\brief
+		Set the vertical padding for this menu's items.
+	*/
+	void	setVertPadding(float padding)				{d_vertPadding=padding;handleUpdatedItemData();}
+
+
+	/*!
+	\brief
+		Set the border width for this menu.
+	*/
+	void	setBorderWidth(float border)				{d_borderWidth=border;handleUpdatedItemData();}
+
+
+	/*!
+	\brief
+		Set the background colours to used when rendereing this menu.
+	*/
+	void	setBackgroundColours(const ColourRect& cr)	{d_backgroundColours=cr;}
+
+
+	/*!
+	\brief
+		Change the currently open MenuItem in this menu.
+
+	\param item
+		Pointer to a MenuItem to open or NULL to close any opened.
+	*/
+	void	changePopupMenuItem(MenuItem* item);
+
+
+	/*!
+	\brief
+		Set whether this menu allows multiple popup menus to opened simultaneously.
+	*/
+	void	setAllowMultiplePopups(bool setting)		{d_allowMultiplePopups=setting;}
+
+
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for MenuBase objects
+	*/
+	MenuBase(const String& type, const String& name);
+
+
+	/*!
+	\brief
+		Destructor for MenuBase objects
+	*/
+	virtual ~MenuBase(void);
+
+
+protected:
+	/*************************************************************************
+		New Event Handlers
+	*************************************************************************/
+	/*!
+	\brief
+		handler invoked internally when the a MenuItem attached to this menu opens its popup.
+	*/
+	virtual void	onPopupOpened(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		handler invoked internally when the a MenuItem attached to this menu closes its popup.
+	*/
+	virtual void	onPopupClosed(WindowEventArgs& e);
+
+
+	/*************************************************************************
+		Implementation Functions
+	*************************************************************************/
+	/*!
+	\brief
+		Add MenuBase specific events
+	*/
+	void	addMenuBaseEvents(void);
+
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"MenuBase")	return true;
+		return ItemListBase::testClassName_impl(class_name);
+	}
+
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	float d_itemSpacing;		//!< The spacing in pixels between items.
+	float d_horzPadding;		//!< The width in pixels that is added to the left and right of each item.
+	float d_vertPadding;		//!< The height in pixels that is added to the top and bottom of each item.
+	float d_borderWidth;		//!< The width in pixels of the border around the entire content of this menu.
+	
+	ColourRect d_backgroundColours;		//!< The colours used when rendering the background of this menu.
+	
+	MenuItem* d_popup;		//!< The currently open MenuItem. NULL if no item is open. If multiple popups are allowed, this means nothing.
+	bool d_allowMultiplePopups;		//!< true if multiple popup menus are allowed smultaneously.  false if not.
+
+
+private:
+	/*************************************************************************
+	Static Properties for this class
+	*************************************************************************/
+	static MenuBaseProperties::ItemSpacing			d_itemSpacingProperty;
+	static MenuBaseProperties::HorzPadding			d_horzPaddingProperty;
+	static MenuBaseProperties::VertPadding			d_vertPaddingProperty;
+	static MenuBaseProperties::BorderWidth			d_borderWidthProperty;
+	static MenuBaseProperties::BackgroundColours	d_backgroundColoursProperty;
+	static MenuBaseProperties::AllowMultiplePopups	d_allowMultiplePopupsProperty;
+
+	/*************************************************************************
+	Private methods
+	*************************************************************************/
+	void	addMenuBaseProperties(void);
+};
+
+} // End of  CEGUI namespace section
+
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIMenuBase_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUISliderProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUISliderProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUISliderProperties.h	(revision 1812)
@@ -0,0 +1,122 @@
+/************************************************************************
+	filename: 	CEGUISliderProperties.h
+	created:	10/7/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to properties for Slider class
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUISliderProperties_h_
+#define _CEGUISliderProperties_h_
+
+#include "CEGUIProperty.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+// Start of SliderProperties namespace section
+/*!
+\brief
+	Namespace containing all classes that make up the properties interface for the Slider class
+*/
+namespace SliderProperties
+{
+/*!
+\brief
+	Property to access the current value of the slider.
+
+	\par Usage:
+		- Name: CurrentValue
+		- Format: "[float]".
+
+	\par Where:
+		- [float] represents the current value of the slider.
+*/
+class CurrentValue : public Property
+{
+public:
+	CurrentValue() : Property(
+		"CurrentValue",
+		"Property to get/set the current value of the slider.  Value is a float.",
+		"0.000000")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the maximum value of the slider.
+
+	\par Usage:
+		- Name: MaximumValue
+		- Format: "[float]".
+
+	\par Where:
+		- [float] represents the maximum value of the slider.
+*/
+class MaximumValue : public Property
+{
+public:
+	MaximumValue() : Property(
+		"MaximumValue",
+		"Property to get/set the maximum value of the slider.  Value is a float.",
+		"1.000000")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the click-step size for the slider.
+
+	\par Usage:
+		- Name: ClickStepSize
+		- Format: "[float]".
+
+	\par Where:
+		- [float] represents the click-step size slider (this is how much the value changes when the slider container is clicked).
+*/
+class ClickStepSize : public Property
+{
+public:
+	ClickStepSize() : Property(
+		"ClickStepSize",
+		"Property to get/set the click-step size for the slider.  Value is a float.",
+		"0.010000")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+} // End of  SliderProperties namespace section
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUISliderProperties_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIMenuItemProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIMenuItemProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIMenuItemProperties.h	(revision 1812)
@@ -0,0 +1,164 @@
+/************************************************************************
+	filename: 	CEGUIMenuItemProperties.h
+	created:	8/4/2005
+	author:		Tomas Lindquist Olsen (based on code by Paul D Turner)
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIMenuItemProperties_h_
+#define _CEGUIMenuItemProperties_h_
+
+#include "CEGUIProperty.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+// Start of MenuItemProperties namespace section
+namespace MenuItemProperties
+{
+
+/*!
+\brief
+	Property to access the hover colour of the item.
+
+	\par Usage:
+		- Name: HoverColour
+		- Format: "[aarrggbb]".
+
+	\par Where:
+		- [aarrggbb] represents the hover colour of the item.
+*/
+class HoverColour : public Property
+{
+public:
+	HoverColour() : Property(
+		"HoverColour",
+		"Property to get/set the hover colour of the item.  Value is a colour.",
+		"00FFFFFF")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the pushed colour of the item.
+
+	\par Usage:
+		- Name: PushedColour
+		- Format: "[aarrggbb]".
+
+	\par Where:
+		- [aarrggbb] represents the pushed colour of the item.
+*/
+class PushedColour : public Property
+{
+public:
+	PushedColour() : Property(
+		"PushedColour",
+		"Property to get/set the pushed colour of the item.  Value is a colour.",
+		"00FFFFFF")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the opened colour of the item.
+
+	\par Usage:
+		- Name: OpenedColour
+		- Format: "[aarrggbb]".
+
+	\par Where:
+		- [aarrggbb] represents the opened colour of the item.
+*/
+class OpenedColour : public Property
+{
+public:
+	OpenedColour() : Property(
+		"OpenedColour",
+		"Property to get/set the opened colour of the item.  Value is a colour.",
+		"00EFEFEF")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the normal text colour of the item.
+
+	\par Usage:
+		- Name: NormalTextColour
+		- Format: "[aarrggbb]".
+
+	\par Where:
+		- [aarrggbb] represents the normal text colour of the item.
+*/
+class NormalTextColour : public Property
+{
+public:
+	NormalTextColour() : Property(
+		"NormalTextColour",
+		"Property to get/set the normal text colour of the item.  Value is a colour.",
+		"00FFFFFF")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the disabled text colour of the item.
+
+	\par Usage:
+		- Name: DisabledTextColour
+		- Format: "[aarrggbb]".
+
+	\par Where:
+		- [aarrggbb] represents the disabled text colour of the item.
+*/
+class DisabledTextColour : public Property
+{
+public:
+	DisabledTextColour() : Property(
+		"DisabledTextColour",
+		"Property to get/set the disabled text colour of the item.  Value is a colour.",
+		"007F7F7F")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+} // End of  MenuItemProperties namespace section
+} // End of  CEGUI namespace section
+
+#endif	// end of guard _CEGUIMenuItemProperties_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIListboxItem.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIListboxItem.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIListboxItem.h	(revision 1812)
@@ -0,0 +1,446 @@
+/************************************************************************
+	filename: 	CEGUIListboxItem.h
+	created:	8/6/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to base class for list items
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIListboxItem_h_
+#define _CEGUIListboxItem_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIString.h"
+#include "CEGUIColourRect.h"
+#include "CEGUIRenderCache.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Base class for list box items
+*/
+class CEGUIEXPORT ListboxItem
+{
+public:
+	/*************************************************************************
+		Constants
+	*************************************************************************/
+	static const colour	DefaultSelectionColour;		//!< Default selection brush colour.
+
+
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		base class constructor
+	*/
+	ListboxItem(const String& text, uint item_id = 0, void* item_data = NULL, bool disabled = false, bool auto_delete = true);
+
+
+	/*!
+	\brief
+		base class destructor
+	*/
+	virtual ~ListboxItem(void) {}
+
+
+	/*************************************************************************
+		Accessors
+	*************************************************************************/
+	/*!
+	\brief
+		return the text string set for this list box item.
+
+		Note that even if the item does not render text, the text string can still be useful, since it
+		is used for sorting list box items.
+
+	\return
+		String object containing the current text for the list box item.
+	*/
+	const String&	getText(void) const		{return d_itemText;}
+	const String&	getTooltipText(void) const		{return d_tooltipText;}
+
+	/*!
+	\brief
+		Return the current ID assigned to this list box item.
+
+		Note that the system does not make use of this value, client code can assign any meaning it
+		wishes to the ID.
+
+	\return
+		ID code currently assigned to this list box item
+	*/
+	uint	getID(void) const			{return d_itemID;}
+
+
+	/*!
+	\brief
+		Return the pointer to any client assigned user data attached to this lis box item.
+
+		Note that the system does not make use of this data, client code can assign any meaning it
+		wishes to the attached data.
+
+	\return
+		Pointer to the currently assigned user data.
+	*/
+	void*	getUserData(void) const		{return d_itemData;}
+
+
+	/*!
+	\brief
+		return whether this item is selected.
+
+	\return
+		true if the item is selected, false if the item is not selected.
+	*/
+	bool	isSelected(void) const		{return d_selected;}
+
+
+	/*!
+	\brief
+		return whether this item is disabled.
+
+	\return
+		true if the item is disabled, false if the item is enabled.
+	*/
+	bool	isDisabled(void) const		{return d_disabled;}
+
+
+	/*!
+	\brief
+		return whether this item will be automatically deleted when the list box it is attached to
+		is destroyed, or when the item is removed from the list box.
+
+	\return
+		true if the item object will be deleted by the system when the list box it is attached to is
+		destroyed, or when the item is removed from the list.  false if client code must destroy the
+		item after it is removed from the list.
+	*/
+	bool	isAutoDeleted(void) const	{return d_autoDelete;}
+
+
+	/*!
+	\brief
+		Get the owner window for this ListboxItem.
+		
+		The owner of a ListboxItem is typically set by the list box widgets when an item is added or inserted.
+
+	\return
+		Ponter to the window that is considered the owner of this ListboxItem.
+	*/
+	const Window*	getOwnerWindow(const Window* owner)		{return d_owner;}
+
+
+	/*!
+	\brief
+		Return the current colours used for selection highlighting.
+
+	\return
+		ColourRect object describing the currently set colours
+	*/
+	ColourRect	getSelectionColours(void) const		{return d_selectCols;}
+
+
+	/*!
+	\brief
+		Return the current selection highlighting brush.
+
+	\return
+		Pointer to the Image object currently used for selection highlighting.
+	*/
+	const Image*	getSelectionBrushImage(void) const		{return d_selectBrush;}
+
+
+	/*************************************************************************
+		Manipulators
+	*************************************************************************/
+	/*!
+	\brief
+		set the text string for this list box item.
+
+		Note that even if the item does not render text, the text string can still be useful, since it
+		is used for sorting list box items.
+
+	\param text
+		String object containing the text to set for the list box item.
+
+	\return
+		Nothing.
+	*/
+	void	setText(const String& text)		{d_itemText = text;}
+
+	void	setTooltipText(const String& text)		{d_tooltipText = text;}
+
+	/*!
+	\brief
+		Set the ID assigned to this list box item.
+
+		Note that the system does not make use of this value, client code can assign any meaning it
+		wishes to the ID.
+
+	\param item_id
+		ID code to be assigned to this list box item
+
+	\return
+		Nothing.
+	*/
+	void	setID(uint item_id)		{d_itemID = item_id;}
+
+
+	/*!
+	\brief
+		Set the client assigned user data attached to this lis box item.
+
+		Note that the system does not make use of this data, client code can assign any meaning it
+		wishes to the attached data.
+
+	\param item_data
+		Pointer to the user data to attach to this list item.
+
+	\return
+		Nothing.
+	*/
+	void	setUserData(void* item_data)	{d_itemData = item_data;}
+
+
+	/*!
+	\brief
+		set whether this item is selected.
+
+	\param setting
+		true if the item is selected, false if the item is not selected.
+
+	\return
+		Nothing.
+	*/
+	void	setSelected(bool setting)		{d_selected = setting;}
+
+
+	/*!
+	\brief
+		set whether this item is disabled.
+
+	\param setting
+		true if the item is disabled, false if the item is enabled.
+
+	\return
+		Nothing.
+	*/
+	void	setDisabled(bool setting)		{d_disabled = setting;}
+
+	/*!
+	\brief
+		Set whether this item will be automatically deleted when the list box it is attached to
+		is destroyed, or when the item is removed from the list box.
+
+	\param setting
+		true if the item object should be deleted by the system when the list box it is attached to is
+		destroyed, or when the item is removed from the list.  false if client code will destroy the
+		item after it is removed from the list.
+
+	\return
+		Nothing.
+	*/
+	void	setAutoDeleted(bool setting)		{d_autoDelete = setting;}
+
+
+	/*!
+	\brief
+		Set the owner window for this ListboxItem.  This is called by all the list box widgets when
+		an item is added or inserted.
+
+	\param owner
+		Ponter to the window that should be considered the owner of this ListboxItem.
+
+	\return
+		Nothing
+	*/
+	void	setOwnerWindow(const Window* owner)		{d_owner = owner;}
+
+
+	/*!
+	\brief
+		Set the colours used for selection highlighting.
+
+	\param cols
+		ColourRect object describing the colours to be used.
+
+	\return
+		Nothing.
+	*/
+	void	setSelectionColours(const ColourRect& cols)		{d_selectCols = cols;}
+
+
+	/*!
+	\brief
+		Set the colours used for selection highlighting.
+
+	\param top_left_colour
+		Colour (as ARGB value) to be applied to the top-left corner of the selection area.
+
+	\param top_right_colour
+		Colour (as ARGB value) to be applied to the top-right corner of the selection area.
+
+	\param bottom_left_colour
+		Colour (as ARGB value) to be applied to the bottom-left corner of the selection area.
+
+	\param bottom_right_colour
+		Colour (as ARGB value) to be applied to the bottom-right corner of the selection area.
+
+	\return 
+		Nothing.
+	*/
+	void	setSelectionColours(colour top_left_colour, colour top_right_colour, colour bottom_left_colour, colour bottom_right_colour);
+
+
+	/*!
+	\brief
+		Set the colours used for selection highlighting.
+
+	\param col
+		colour value to be used when rendering.
+
+	\return
+		Nothing.
+	*/
+	void	setSelectionColours(colour col)		{setSelectionColours(col, col, col, col);}
+
+
+	/*!
+	\brief
+		Set the selection highlighting brush image.
+
+	\param image
+		Pointer to the Image object to be used for selection highlighting.
+
+	\return
+		Nothing.
+	*/
+	void	setSelectionBrushImage(const Image* image)		{d_selectBrush = image;}
+
+
+	/*!
+	\brief
+		Set the selection highlighting brush image.
+
+	\param imageset
+		Name of the imagest containing the image to be used.
+
+	\param image
+		Name of the image to be used
+
+	\return
+		Nothing.
+	*/
+	void	setSelectionBrushImage(const String& imageset, const String& image);
+
+
+	/*************************************************************************
+		Abstract portion of interface
+	*************************************************************************/
+	/*!
+	\brief
+		Return the rendered pixel size of this list box item.
+
+	\return
+		Size object describing the size of the list box item in pixels.
+	*/
+	virtual	Size	getPixelSize(void) const	= 0;
+
+
+	/*!
+	\brief
+		Draw the list box item in its current state
+
+	\param position
+		Vecor3 object describing the upper-left corner of area that should be rendered in to for the draw operation.
+
+	\param alpha
+		Alpha value to be used when rendering the item (between 0.0f and 1.0f).
+
+	\param clipper
+		Rect object describing the clipping rectangle for the draw operation.
+
+	\return
+		Nothing.
+	*/
+	virtual	void	draw(const Vector3& position, float alpha, const Rect& clipper) const	= 0;
+
+    virtual void    draw(RenderCache& cache,const Rect& targetRect, float zBase,  float alpha, const Rect* clipper) const = 0;
+
+	/*************************************************************************
+		Operators
+	*************************************************************************/
+	/*!
+	\brief
+		Less-than operator, compares item texts.
+	*/
+	virtual	bool	operator<(const ListboxItem& rhs) const		{return d_itemText < rhs.getText();}
+
+
+	/*!
+	\brief
+		Greater-than operator, compares item texts.
+	*/
+	virtual	bool	operator>(const ListboxItem& rhs) const		{return d_itemText > rhs.getText();}
+
+
+protected:
+	/*************************************************************************
+		Implementation methods
+	*************************************************************************/
+	/*!
+	\brief
+		Return a ColourRect object describing the colours in \a cols after having their alpha
+		component modulated by the value \a alpha.
+	*/
+	ColourRect getModulateAlphaColourRect(const ColourRect& cols, float alpha) const;
+
+
+	/*!
+	\brief
+		Return a colour value describing the colour specified by \a col after having its alpha
+		component modulated by the value \a alpha.
+	*/
+	colour calculateModulatedAlphaColour(colour col, float alpha) const;
+
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	String	d_itemText;		//!< Text for this list box item.  If not rendered, this is still used for list sorting.
+	String  d_tooltipText;  //!< Text for the individual tooltip of this item
+	uint	d_itemID;		//!< ID code assigned by client code.  This has no meaning within the GUI system.
+	void*	d_itemData;		//!< Pointer to some client code data.  This has no meaning within the GUI system.
+	bool	d_selected;		//!< true if this item is selected.  false if the item is not selected.
+	bool	d_disabled;		//!< true if this item is disabled.  false if the item is not disabled.
+	bool	d_autoDelete;	//!< true if the system should destroy this item, false if client code will destroy the item.
+	const Window*	d_owner;	//!< Pointer to the window that owns this item.
+	ColourRect		d_selectCols;		//!< Colours used for selection highlighting.
+	const Image*	d_selectBrush;		//!< Image used for rendering selection.
+};
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIListboxItem_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIScrollablePaneProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIScrollablePaneProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIScrollablePaneProperties.h	(revision 1812)
@@ -0,0 +1,293 @@
+/************************************************************************
+	filename: 	CEGUIScrollablePaneProperties.h
+	created:	3/3/2005
+	author:		Paul D Turner
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIScrollablePaneProperties_h_
+#define _CEGUIScrollablePaneProperties_h_
+
+#include "CEGUIProperty.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+// Start of ScrollablePaneProperties namespace section
+/*!
+\brief
+	Namespace containing all classes that make up the properties interface for the ScrollablePane class
+*/
+namespace ScrollablePaneProperties
+{
+    /*!
+    \brief
+        Property to access the setting which controls whether the content pane is automatically
+        resized according to the size and position of attached content.
+
+    \par Usage:
+        - Name: ContentPaneAutoSized
+        - Format: "[text]"
+
+    \par Where [Text] is:
+        - "True" to indicate the pane should automatically resize itself.
+        - "False" to indicate the pane should not automatically resize itself.
+    */
+    class ContentPaneAutoSized : public Property
+    {
+    public:
+        ContentPaneAutoSized() : Property(
+            "ContentPaneAutoSized",
+            "Property to get/set the setting which controls whether the content pane will auto-size itself.  Value is either \"True\" or \"False\".",
+            "True")
+        {}
+
+        String	get(const PropertyReceiver* receiver) const;
+        void	set(PropertyReceiver* receiver, const String& value);
+    };
+
+    /*!
+    \brief
+       Property to access the current content pane area rectangle (as window relative pixels).
+
+    \par Usage:
+        - Name: ContentArea
+        - Format: "l:[float] t:[float] r:[float] b:[float]".
+
+    \par Where:
+        - l:[float]	specifies the position of the left edge of the area as a floating point number.
+        - t:[float]	specifies the position of the top edge of the area as a floating point number.
+        - r:[float]	specifies the position of the right edge of the area as a floating point number.
+        - b:[float]	specifies the position of the bottom edge of the area as a floating point number.
+    */
+    class ContentArea : public Property
+    {
+    public:
+        ContentArea() : Property(
+            "ContentArea",
+            "Property to get/set the current content area rectangle of the content pane.  Value is \"l:[float] t:[float] r:[float] b:[float]\" (where l is left, t is top, r is right, and b is bottom).",
+            "l:0.000000 t:0.000000 r:0.000000 b:0.000000")
+        {}
+
+        String	get(const PropertyReceiver* receiver) const;
+        void	set(PropertyReceiver* receiver, const String& value);
+    };
+
+    /*!
+    \brief
+        Property to access the setting which controls whether the vertical scroll bar will 
+        always be displayed, or only displayed when it is required.
+
+    \par Usage:
+        - Name: ForceVertScrollbar
+        - Format: "[text]"
+
+    \par Where [Text] is:
+        - "True" to indicate that the vertical scroll bar will always be shown.
+        - "False" to indicate that the vertical scroll bar will only be shown when it is needed.
+    */
+    class ForceVertScrollbar : public Property
+    {
+    public:
+        ForceVertScrollbar() : Property(
+            "ForceVertScrollbar",
+            "Property to get/set the setting which controls whether the vertical scroll bar is aways shown.  Value is either \"True\" or \"False\".",
+            "False")
+        {}
+
+        String	get(const PropertyReceiver* receiver) const;
+        void	set(PropertyReceiver* receiver, const String& value);
+    };
+
+
+    /*!
+    \brief
+        Property to access the setting which controls whether the horizontal scroll bar will 
+        always be displayed, or only displayed when it is required.
+
+    \par Usage:
+        - Name: ForceHorzScrollbar
+        - Format: "[text]"
+
+    \par Where [Text] is:
+        - "True" to indicate that the horizontal scroll bar will always be shown.
+        - "False" to indicate that the horizontal scroll bar will only be shown when it is needed.
+    */
+    class ForceHorzScrollbar : public Property
+    {
+    public:
+        ForceHorzScrollbar() : Property(
+            "ForceHorzScrollbar",
+            "Property to get/set the setting which controls whether the horizontal scroll bar is aways shown.  Value is either \"True\" or \"False\".",
+            "False")
+        {}
+
+        String	get(const PropertyReceiver* receiver) const;
+        void	set(PropertyReceiver* receiver, const String& value);
+    };
+
+    /*!
+    \brief
+        Property to access the step size for the horizontal Scrollbar.
+
+    \par Usage:
+        - Name: HorzStepSize
+        - Format: "[float]".
+
+    \par Where:
+        - [float] specifies the size of the increase/decrease button step for the horizontal scrollbar (as a fraction of 1 page).
+    */
+    class HorzStepSize : public Property
+    {
+    public:
+        HorzStepSize() : Property(
+            "HorzStepSize",
+            "Property to get/set the step size for the horizontal Scrollbar.  Value is a float.",
+            "0.100000")
+        {}
+
+        String	get(const PropertyReceiver* receiver) const;
+        void	set(PropertyReceiver* receiver, const String& value);
+    };
+
+    /*!
+    \brief
+        Property to access the overlap size for the horizontal Scrollbar.
+
+    \par Usage:
+        - Name: HorzOverlapSize
+        - Format: "[float]".
+
+    \par Where:
+        - [float] specifies the size of the per-page overlap (as a fraction of one page).
+    */
+    class HorzOverlapSize : public Property
+    {
+    public:
+        HorzOverlapSize() : Property(
+            "HorzOverlapSize",
+            "Property to get/set the overlap size for the horizontal Scrollbar.  Value is a float.",
+            "0.010000")
+        {}
+
+        String	get(const PropertyReceiver* receiver) const;
+        void	set(PropertyReceiver* receiver, const String& value);
+    };
+
+    /*!
+    \brief
+        Property to access the scroll position of the horizontal Scrollbar.
+
+    \par Usage:
+        - Name: HorzScrollPosition
+        - Format: "[float]".
+
+    \par Where:
+        - [float] specifies the current scroll position / value of the horizontal Scrollbar (as a fraction of the whole).
+    */
+    class HorzScrollPosition : public Property
+    {
+    public:
+        HorzScrollPosition() : Property(
+            "HorzScrollPosition",
+            "Property to get/set the scroll position of the horizontal Scrollbar as a fraction.  Value is a float.",
+            "0.000000")
+        {}
+
+        String	get(const PropertyReceiver* receiver) const;
+        void	set(PropertyReceiver* receiver, const String& value);
+    };
+
+    /*!
+    \brief
+        Property to access the step size for the vertical Scrollbar.
+
+    \par Usage:
+        - Name: VertStepSize
+        - Format: "[float]".
+
+    \par Where:
+        - [float] specifies the size of the increase/decrease button step for the vertical scrollbar (as a fraction of 1 page).
+    */
+    class VertStepSize : public Property
+    {
+    public:
+        VertStepSize() : Property(
+            "VertStepSize",
+            "Property to get/set the step size for the vertical Scrollbar.  Value is a float.",
+            "0.100000")
+        {}
+
+        String	get(const PropertyReceiver* receiver) const;
+        void	set(PropertyReceiver* receiver, const String& value);
+    };
+
+    /*!
+    \brief
+        Property to access the overlap size for the vertical Scrollbar.
+
+    \par Usage:
+        - Name: VertOverlapSize
+        - Format: "[float]".
+
+    \par Where:
+        - [float] specifies the size of the per-page overlap (as a fraction of one page).
+    */
+    class VertOverlapSize : public Property
+    {
+    public:
+        VertOverlapSize() : Property(
+            "VertOverlapSize",
+            "Property to get/set the overlap size for the vertical Scrollbar.  Value is a float.",
+            "0.010000")
+        {}
+
+        String	get(const PropertyReceiver* receiver) const;
+        void	set(PropertyReceiver* receiver, const String& value);
+    };
+
+    /*!
+    \brief
+        Property to access the scroll position of the vertical Scrollbar.
+
+    \par Usage:
+        - Name: VertScrollPosition
+        - Format: "[float]".
+
+    \par Where:
+        - [float] specifies the current scroll position / value of the vertical Scrollbar (as a fraction of the whole).
+    */
+    class VertScrollPosition : public Property
+    {
+    public:
+        VertScrollPosition() : Property(
+            "VertScrollPosition",
+            "Property to get/set the scroll position of the vertical Scrollbar as a fraction.  Value is a float.",
+            "0.000000")
+        {}
+
+        String	get(const PropertyReceiver* receiver) const;
+        void	set(PropertyReceiver* receiver, const String& value);
+    };
+
+} // End of  ScrollablePaneProperties namespace section
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIScrollablePaneProperties_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIStaticProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIStaticProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIStaticProperties.h	(revision 1812)
@@ -0,0 +1,391 @@
+/************************************************************************
+	filename: 	CEGUIStaticProperties.h
+	created:	10/7/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to properties for Static (base class) widget.
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIStaticProperties_h_
+#define _CEGUIStaticProperties_h_
+
+#include "CEGUIProperty.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+// Start of StaticProperties namespace section
+/*!
+\brief
+	Namespace containing all classes that make up the properties interface for the Static (base) class
+*/
+namespace StaticProperties
+{
+/*!
+\brief
+	Property to access the state of the frame enabled setting for the Static widget.
+
+	\par Usage:
+		- Name: FrameEnabled
+		- Format: "[text]".
+
+	\par Where [Text] is:
+		- "True" to indicate that the frame is enabled.
+		- "False" to indicate that the frame is disabled.
+*/
+class FrameEnabled : public Property
+{
+public:
+	FrameEnabled() : Property(
+		"FrameEnabled",
+		"Property to get/set the state of the frame enabled setting for the Static widget.  Value is either \"True\" or \"False\".",
+		"True")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the state of the frame background setting for the Static widget.
+
+	\par Usage:
+		- Name: BackgroundEnabled
+		- Format: "[text]".
+
+	\par Where [Text] is:
+		- "True" to indicate that the background is enabled.
+		- "False" to indicate that the background is disabled.
+*/
+class BackgroundEnabled : public Property
+{
+public:
+	BackgroundEnabled() : Property(
+		"BackgroundEnabled",
+		"Property to get/set the state of the frame background setting for the Static widget.  Value is either \"True\" or \"False\".",
+		"True")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the frame colours for the Static widget.
+
+	\par Usage:
+		- Name: FrameColours
+		- Format: "tl:[aarrggbb] tr:[aarrggbb] bl:[aarrggbb] br:[aarrggbb]".
+
+	\par Where:
+		- tl:[aarrggbb] is the top-left colour value specified as ARGB (hex).
+		- tr:[aarrggbb] is the top-right colour value specified as ARGB (hex).
+		- bl:[aarrggbb] is the bottom-left colour value specified as ARGB (hex).
+		- br:[aarrggbb] is the bottom-right colour value specified as ARGB (hex).
+*/
+class FrameColours : public Property
+{
+public:
+	FrameColours() : Property(
+		"FrameColours",
+		"Property to get/set the frame colours for the Static widget.  Value is \"tl:[aarrggbb] tr:[aarrggbb] bl:[aarrggbb] br:[aarrggbb]\".",
+		"tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the background colours for the Static widget.
+
+	\par Usage:
+		- Name: BackgroundColours
+		- Format: "tl:[aarrggbb] tr:[aarrggbb] bl:[aarrggbb] br:[aarrggbb]".
+
+	\par Where:
+		- tl:[aarrggbb] is the top-left colour value specified as ARGB (hex).
+		- tr:[aarrggbb] is the top-right colour value specified as ARGB (hex).
+		- bl:[aarrggbb] is the bottom-left colour value specified as ARGB (hex).
+		- br:[aarrggbb] is the bottom-right colour value specified as ARGB (hex).
+*/
+class BackgroundColours : public Property
+{
+public:
+	BackgroundColours() : Property(
+		"BackgroundColours",
+		"Property to get/set the background colours for the Static widget.  Value is \"tl:[aarrggbb] tr:[aarrggbb] bl:[aarrggbb] br:[aarrggbb]\".",
+		"tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the background image for the Static widget.
+
+	\par Usage:
+		- Name: BackgroundImage
+		- Format: "set:[text] image:[text]".
+
+	\par Where:
+		- set:[text] is the name of the Imageset containing the image.  The Imageset name should not contain spaces.  The Imageset specified must already be loaded.
+		- image:[text] is the name of the Image on the specified Imageset.  The Image name should not contain spaces.
+*/
+class BackgroundImage : public Property
+{
+public:
+	BackgroundImage() : Property(
+		"BackgroundImage",
+		"Property to get/set the background image for the Static widget.  Value should be \"set:[imageset name] image:[image name]\".",
+		"")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the top-left image for the frame of the Static widget.
+
+	\par Usage:
+		- Name: TopLeftFrameImage
+		- Format: "set:[text] image:[text]".
+
+	\par Where:
+		- set:[text] is the name of the Imageset containing the image.  The Imageset name should not contain spaces.  The Imageset specified must already be loaded.
+		- image:[text] is the name of the Image on the specified Imageset.  The Image name should not contain spaces.
+*/
+class TopLeftFrameImage : public Property
+{
+public:
+	TopLeftFrameImage() : Property(
+		"TopLeftFrameImage",
+		"Property to get/set the top-left image for the frame of the Static widget.  Value should be \"set:[imageset name] image:[image name]\".",
+		"")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the top-right image for the frame of the Static widget.
+
+	\par Usage:
+		- Name: TopRightFrameImage
+		- Format: "set:[text] image:[text]".
+
+	\par Where:
+		- set:[text] is the name of the Imageset containing the image.  The Imageset name should not contain spaces.  The Imageset specified must already be loaded.
+		- image:[text] is the name of the Image on the specified Imageset.  The Image name should not contain spaces.
+*/
+class TopRightFrameImage : public Property
+{
+public:
+	TopRightFrameImage() : Property(
+		"TopRightFrameImage",
+		"Property to get/set the top-right image for the frame of the Static widget.  Value should be \"set:[imageset name] image:[image name]\".",
+		"")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the bottom-left image for the frame of the Static widget.
+
+	\par Usage:
+		- Name: BottomLeftFrameImage
+		- Format: "set:[text] image:[text]".
+
+	\par Where:
+		- set:[text] is the name of the Imageset containing the image.  The Imageset name should not contain spaces.  The Imageset specified must already be loaded.
+		- image:[text] is the name of the Image on the specified Imageset.  The Image name should not contain spaces.
+*/
+class BottomLeftFrameImage : public Property
+{
+public:
+	BottomLeftFrameImage() : Property(
+		"BottomLeftFrameImage",
+		"Property to get/set the bottom-left image for the frame of the Static widget.  Value should be \"set:[imageset name] image:[image name]\".",
+		"")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the bottom-right image for the frame of the Static widget.
+
+	\par Usage:
+		- Name: BottomRightFrameImage
+		- Format: "set:[text] image:[text]".
+
+	\par Where:
+		- set:[text] is the name of the Imageset containing the image.  The Imageset name should not contain spaces.  The Imageset specified must already be loaded.
+		- image:[text] is the name of the Image on the specified Imageset.  The Image name should not contain spaces.
+*/
+class BottomRightFrameImage : public Property
+{
+public:
+	BottomRightFrameImage() : Property(
+		"BottomRightFrameImage",
+		"Property to get/set the bottom-right image for the frame of the Static widget.  Value should be \"set:[imageset name] image:[image name]\".",
+		"")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the left edge image for the frame of the Static widget.
+
+	\par Usage:
+		- Name: LeftFrameImage
+		- Format: "set:[text] image:[text]".
+
+	\par Where:
+		- set:[text] is the name of the Imageset containing the image.  The Imageset name should not contain spaces.  The Imageset specified must already be loaded.
+		- image:[text] is the name of the Image on the specified Imageset.  The Image name should not contain spaces.
+*/
+class LeftFrameImage : public Property
+{
+public:
+	LeftFrameImage() : Property(
+		"LeftFrameImage",
+		"Property to get/set the left edge image for the frame of the Static widget.  Value should be \"set:[imageset name] image:[image name]\".",
+		"")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the right edge image for the frame of the Static widget.
+
+	\par Usage:
+		- Name: RightFrameImage
+		- Format: "set:[text] image:[text]".
+
+	\par Where:
+		- set:[text] is the name of the Imageset containing the image.  The Imageset name should not contain spaces.  The Imageset specified must already be loaded.
+		- image:[text] is the name of the Image on the specified Imageset.  The Image name should not contain spaces.
+*/
+class RightFrameImage : public Property
+{
+public:
+	RightFrameImage() : Property(
+		"RightFrameImage",
+		"Property to get/set the right edge image for the frame of the Static widget.  Value should be \"set:[imageset name] image:[image name]\".",
+		"")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the top edge image for the frame of the Static widget.
+
+	\par Usage:
+		- Name: TopFrameImage
+		- Format: "set:[text] image:[text]".
+
+	\par Where:
+		- set:[text] is the name of the Imageset containing the image.  The Imageset name should not contain spaces.  The Imageset specified must already be loaded.
+		- image:[text] is the name of the Image on the specified Imageset.  The Image name should not contain spaces.
+*/
+class TopFrameImage : public Property
+{
+public:
+	TopFrameImage() : Property(
+		"TopFrameImage",
+		"Property to get/set the top edge image for the frame of the Static widget.  Value should be \"set:[imageset name] image:[image name]\".",
+		"")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the bottom edge image for the frame of the Static widget.
+
+	\par Usage:
+		- Name: BottomFrameImage
+		- Format: "set:[text] image:[text]".
+
+	\par Where:
+		- set:[text] is the name of the Imageset containing the image.  The Imageset name should not contain spaces.  The Imageset specified must already be loaded.
+		- image:[text] is the name of the Image on the specified Imageset.  The Image name should not contain spaces.
+*/
+class BottomFrameImage : public Property
+{
+public:
+	BottomFrameImage() : Property(
+		"BottomFrameImage",
+		"Property to get/set the bottom edge image for the frame of the Static widget.  Value should be \"set:[imageset name] image:[image name]\".",
+		"")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+
+
+} // End of  StaticProperties namespace section
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIStaticProperties_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIProgressBarProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIProgressBarProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIProgressBarProperties.h	(revision 1812)
@@ -0,0 +1,98 @@
+/************************************************************************
+	filename: 	CEGUIProgressBarProperties.h
+	created:	10/7/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to properties for the ProgressBar class
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIProgressBarProperties_h_
+#define _CEGUIProgressBarProperties_h_
+
+#include "CEGUIProperty.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+// Start of ProgressBarProperties namespace section
+/*!
+\brief
+	Namespace containing all classes that make up the properties interface for the ProgressBar class
+*/
+namespace ProgressBarProperties
+{
+/*!
+\brief
+	Property to access the current progress of the progress bar.
+
+	\par Usage:
+		- Name: CurrentProgress
+		- Format: "[float]".
+
+	\par Where:
+		- [float] is the current progress of the bar expressed as a value between 0 and 1.
+*/
+class CurrentProgress : public Property
+{
+public:
+	CurrentProgress() : Property(
+		"CurrentProgress",
+		"Property to get/set the current progress of the progress bar.  Value is a float  value between 0.0 and 1.0 specifying the progress.",
+		"0.000000")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the step size setting for the progress bar.
+
+	\par Usage:
+		- Name: StepSize
+		- Format: "[float]".
+
+	\par Where:
+		- [float] is the size of the invisible sizing border in screen pixels.
+*/
+class StepSize : public Property
+{
+public:
+	StepSize() : Property(
+		"StepSize",
+		"Property to get/set the step size setting for the progress bar.  Value is a float value.",
+		"0.010000")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+} // End of  ProgressBarProperties namespace section
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIProgressBarProperties_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIStaticImageProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIStaticImageProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIStaticImageProperties.h	(revision 1812)
@@ -0,0 +1,160 @@
+/************************************************************************
+	filename: 	CEGUIStaticImageProperties.h
+	created:	10/7/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface for StaticImage property classes
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIStaticImageProperties_h_
+#define _CEGUIStaticImageProperties_h_
+
+#include "CEGUIProperty.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+// Start of StaticImageProperties namespace section
+/*!
+\brief
+	Namespace containing all classes that make up the properties interface for the StaticImage class
+*/
+namespace StaticImageProperties
+{
+/*!
+\brief
+	Property to access the image for the StaticImage widget.
+
+	\par Usage:
+		- Name: Image
+		- Format: "set:[text] image:[text]".
+
+	\par Where:
+		- set:[text] is the name of the Imageset containing the image.  The Imageset name should not contain spaces.  The Imageset specified must already be loaded.
+		- image:[text] is the name of the Image on the specified Imageset.  The Image name should not contain spaces.
+*/
+class Image : public Property
+{
+public:
+	Image() : Property(
+		"Image",
+		"Property to get/set the image for the StaticImage widget.  Value should be \"set:[imageset name] image:[image name]\".",
+		"")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the image colours for the StaticImage widget.
+
+	\par Usage:
+		- Name: ImageColours
+		- Format: "tl:[aarrggbb] tr:[aarrggbb] bl:[aarrggbb] br:[aarrggbb]".
+
+	\par Where:
+		- tl:[aarrggbb] is the top-left colour value specified as ARGB (hex).
+		- tr:[aarrggbb] is the top-right colour value specified as ARGB (hex).
+		- bl:[aarrggbb] is the bottom-left colour value specified as ARGB (hex).
+		- br:[aarrggbb] is the bottom-right colour value specified as ARGB (hex).
+*/
+class ImageColours : public Property
+{
+public:
+	ImageColours() : Property(
+		"ImageColours",
+		"Property to get/set the text colours for the StaticImage widget.  Value is \"tl:[aarrggbb] tr:[aarrggbb] bl:[aarrggbb] br:[aarrggbb]\".",
+		"tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the horizontal formatting mode setting.
+
+	\par Usage:
+		- Name: HorzFormatting
+		- Format: "[text]".
+
+	\par Where [text] is one of:
+		- "LeftAligned"
+		- "RightAligned"
+		- "HorzCentred"
+		- "HorzStretched"
+		- "HorzTiled"
+*/
+class HorzFormatting : public Property
+{
+public:
+	HorzFormatting() : Property(
+		"HorzFormatting",
+		"Property to get/set the horizontal formatting mode.  Value is one of the HorzFormatting strings.",
+		"HorzStretched")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the vertical formatting mode setting.
+
+	\par Usage:
+		- Name: VertFormatting
+		- Format: "[text]".
+
+	\par Where [text] is one of:
+		- "TopAligned"
+		- "BottomAligned"
+		- "VertCentred"
+		- "VertStretched"
+		- "VertTiled"
+*/
+class VertFormatting : public Property
+{
+public:
+	VertFormatting() : Property(
+		"VertFormatting",
+		"Property to get/set the vertical formatting mode.  Value is one of the VertFormatting strings.",
+		"VertStretched")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+} // End of  StaticImageProperties namespace section
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIStaticImageProperties_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUITabPane.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUITabPane.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUITabPane.h	(revision 1812)
@@ -0,0 +1,118 @@
+/************************************************************************
+	filename: 	CEGUITabPane.h
+	created:	8/8/2004
+	author:		Steve Streeting
+	
+	purpose:	Defines interface for the content area of a tab control
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUITabPane_h_
+#define _CEGUITabPane_h_
+
+#include "elements/CEGUIStatic.h"
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Base class for a tab pane.
+*/
+class CEGUIEXPORT TabPane : public Static
+{
+public:
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for tab pane widgets.
+	*/
+    TabPane(const String& type, const String& name) : Static(type, name) {}
+
+
+	/*!
+	\brief
+		Destructor for tab pane widgets.
+	*/
+    virtual ~TabPane(void) {}
+
+
+	/*************************************************************************
+		Accessors
+	*************************************************************************/
+
+	/*************************************************************************
+		Manipulators
+	*************************************************************************/
+
+protected:
+	/*************************************************************************
+		Overridden from base class
+	*************************************************************************/
+
+    /*************************************************************************
+		Implementation methods
+	*************************************************************************/
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"Tabpane")	return true;
+		return Static::testClassName_impl(class_name);
+	}
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+
+private:
+	/*************************************************************************
+		Static Properties for this class
+	*************************************************************************/
+
+
+	/*************************************************************************
+		Private methods
+	*************************************************************************/
+};
+
+} // End of  CEGUI namespace section
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUITabPane_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIItemEntry.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIItemEntry.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIItemEntry.h	(revision 1812)
@@ -0,0 +1,127 @@
+/************************************************************************
+	filename: 	CEGUIItemEntry.h
+	created:	31/3/2005
+	author:		Tomas Lindquist Olsen (based on code by Paul D Turner)
+	
+	purpose:	Interface to base class for ItemEntry widget
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIItemEntry_h_
+#define _CEGUIItemEntry_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIWindow.h"
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+	Base class for item type widgets.
+*/
+class CEGUIEXPORT ItemEntry : public Window
+{
+public:
+	/*************************************************************************
+		Abstract Implementation Functions (must be provided by derived class)
+	*************************************************************************/
+	/*!
+	\brief
+		Return the "optimal" size for the item
+	
+	\return
+		Size describing the size in pixel that this ItemEntry's content requires
+		for non-clipped rendering
+	*/
+	virtual Size getItemPixelSize(void) = 0;
+
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for ItemEntry objects
+	*/
+	ItemEntry(const String& type, const String& name);
+
+
+	/*!
+	\brief
+		Destructor for ItemEntry objects
+	*/
+	virtual ~ItemEntry(void);
+
+
+protected:
+	/*************************************************************************
+		Implementation Functions
+	*************************************************************************/
+	/*!
+	\brief
+		Add itementry specific events
+	*/
+	void	addItemEntryEvents(void);
+
+
+	/*!
+    \brief
+        Perform the actual rendering for this Window.
+
+    \return
+        Nothing
+    */
+    virtual void    populateRenderCahce() {};
+
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"ItemEntry")	return true;
+		return Window::testClassName_impl(class_name);
+	}
+   
+};
+
+} // End of  CEGUI namespace section
+
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+
+#endif	// end of guard _CEGUIItemEntry_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIFrameWindow.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIFrameWindow.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIFrameWindow.h	(revision 1812)
@@ -0,0 +1,797 @@
+/************************************************************************
+	filename: 	CEGUIFrameWindow.h
+	created:	13/4/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to base class for FrameWindow
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIFrameWindow_h_
+#define _CEGUIFrameWindow_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIWindow.h"
+#include "elements/CEGUIFrameWindowProperties.h"
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Abstract base class for a movable, sizable, window with a title-bar and a frame.
+*/
+class CEGUIEXPORT FrameWindow : public Window
+{
+public:
+	static const String EventNamespace;				//!< Namespace for global events
+
+
+	/*************************************************************************
+		Constants	
+	*************************************************************************/
+	// additional event names for this window
+	static const String EventRollupToggled;		//!< Fired when the rollup (shade) state of the window changes
+	static const String EventCloseClicked;		//!< Fired when the close button for the window is clicked.
+
+	// other bits
+	static const float	DefaultSizingBorderSize;	//!< Default size for the sizing border (in pixels)
+
+
+	/*!
+	\brief
+		Enumeration that defines the set of possible locations for the mouse on a frame windows sizing border.
+	*/
+	enum SizingLocation {
+		SizingNone,			//!< Position is not a sizing location.
+		SizingTopLeft,		//!< Position will size from the top-left.
+		SizingTopRight,		//!< Position will size from the top-right.
+		SizingBottomLeft,	//!< Position will size from the bottom left.
+		SizingBottomRight,	//!< Position will size from the bottom right.
+		SizingTop,			//!< Position will size from the top.
+		SizingLeft,			//!< Position will size from the left.
+		SizingBottom,		//!< Position will size from the bottom.
+		SizingRight         //!< Position will size from the right.
+	};
+
+	/*!
+	\brief
+		Initialises the Window based object ready for use.
+
+	\note
+		This must be called for every window created.  Normally this is handled automatically by the WindowFactory for each Window type.
+
+	\return
+		Nothing
+	*/
+	virtual void	initialise(void);
+	
+	
+	/*!
+	\brief
+		Return whether this window is sizable.  Note that this requires that the window have an enabled frame and that sizing itself is enabled
+
+	\return
+		true if the window can be sized, false if the window can not be sized
+	*/
+	bool	isSizingEnabled(void) const					{return d_sizingEnabled && isFrameEnabled();}
+
+
+	/*!
+	\brief
+		Return whether the frame for this window is enabled.
+
+	\return
+		true if the frame for this window is enabled, false if the frame for this window is disabled.
+	*/
+	bool	isFrameEnabled(void) const					{return d_frameEnabled;}
+
+
+	/*!
+	\brief
+		Return whether the title bar for this window is enabled.
+
+	\return
+		true if the window has a title bar and it is enabled, false if the window has no title bar or if the title bar is disabled.
+	*/	
+	bool	isTitleBarEnabled(void) const				{return (d_titlebar != NULL) && !((Window*)d_titlebar)->isDisabled();}
+
+
+	/*!
+	\brief
+		Return whether this close button for this window is enabled.
+
+	\return
+		true if the window has a close button and it is enabled, false if the window either has no close button or if the close button is disabled.
+	*/
+	bool	isCloseButtonEnabled(void) const			{return (d_closeButton != NULL) && !((Window*)d_closeButton)->isDisabled();}
+
+
+	/*!
+	\brief
+		Return whether roll up (a.k.a shading) is enabled for this window.
+
+	\return
+		true if roll up is enabled, false if roll up is disabled.
+	*/
+	bool	isRollupEnabled(void) const					{return d_rollupEnabled;}
+
+
+	/*!
+	\brief
+		Return whether the window is currently rolled up (a.k.a shaded).
+
+	\return
+		true if the window is rolled up, false if the window is not rolled up.
+	*/
+	bool	isRolledup(void) const						{return d_rolledup;}
+
+
+	/*!
+	\brief
+		Return the thickness of the sizing border.
+
+	\return
+		float value describing the thickness of the sizing border in screen pixels.
+	*/
+	float	getSizingBorderThickness(void) const		{return d_borderSize;}
+
+
+	/*!
+	\brief
+		Enables or disables sizing for this window.
+
+	\param setting
+		set to true to enable sizing (also requires frame to be enabled), or false to disable sizing.
+
+	\return
+		nothing
+	*/
+	void	setSizingEnabled(bool setting);
+
+
+	/*!
+	\brief
+		Enables or disables the frame for this window.
+
+	\param setting
+		set to true to enable the frame for this window, or false to disable the frame for this window.
+
+	\return
+		Nothing.
+	*/
+	void	setFrameEnabled(bool setting);
+
+
+	/*!
+	\brief
+		Enables or disables the title bar for the frame window.
+
+	\param setting
+		set to true to enable the title bar (if one is attached), or false to disable the title bar.
+
+	\return
+		Nothing.
+	*/
+	void	setTitleBarEnabled(bool setting);
+
+
+	/*!
+	\brief
+		Enables or disables the close button for the frame window.
+
+	\param setting
+		Set to true to enable the close button (if one is attached), or false to disable the close button.
+
+	\return
+		Nothing.
+	*/
+	void	setCloseButtonEnabled(bool setting);
+
+
+	/*!
+	\brief
+		Enables or disables roll-up (shading) for this window.
+
+	\param setting
+		Set to true to enable roll-up for the frame window, or false to disable roll-up.
+
+	\return
+		Nothing.
+	*/
+	void	setRollupEnabled(bool setting);
+
+
+	/*!
+	\brief
+		Toggles the state of the window between rolled-up (shaded) and normal sizes.  This requires roll-up to be enabled.
+
+	\return
+		Nothing
+	*/
+	void	toggleRollup(void);
+
+
+	/*!
+	\brief
+		Set the size of the sizing border for this window.
+
+	\param pixels
+		float value specifying the thickness for the sizing border in screen pixels.
+
+	\return
+		Nothing.
+	*/
+	void	setSizingBorderThickness(float pixels)		{d_borderSize = pixels;}
+
+
+	/*!
+	\brief
+		Set the font to use for the title bar text
+
+	\param name
+		String object holding the name of the font to use.
+
+	\return
+		Nothing.
+	*/
+	void	setTitlebarFont(const String& name);
+
+
+	/*!
+	\brief
+		Set the font to use for the title bar text
+
+	\param font
+		Pointer to the font to use.
+
+	\return
+		Nothing.
+	*/
+	void	setTitlebarFont(Font* font);
+
+
+	/*!
+	\brief
+		Move the window by the pixel offsets specified in \a offset.
+
+		This is intended for internal system use - it is the method by which the title bar moves the frame window.
+
+	\param offset
+		Vector2 object containing the offsets to apply (offsets are in screen pixels).
+
+	\return
+		Nothing.
+	*/
+	void	offsetPixelPosition(const Vector2& offset);
+
+
+	/*!
+	\brief
+		Return whether this FrameWindow can be moved by dragging the title bar.
+
+	\return
+		true if the Window will move when the user drags the title bar, false if the window will not move.
+	*/
+	bool	isDragMovingEnabled(void) const		{return d_dragMovable;}
+
+
+	/*!
+	\brief
+		Set whether this FrameWindow can be moved by dragging the title bar.
+
+	\param setting
+		true if the Window should move when the user drags the title bar, false if the window should not move.
+
+	\return
+		Nothing.
+	*/
+	void	setDragMovingEnabled(bool setting);
+
+
+	/*!
+	\brief
+		Return the font being used for the title bar text
+
+	\return
+		Pointer to the Font being used for the TitleBar on this FrameWindow.
+	*/
+	const Font*	getTitlebarFont(void) const;
+
+
+	/*!
+	\brief
+		Return the current colour used for rendering the caption text
+
+	\return
+		colour value that specifies the colour used when rendering the title bar caption text.
+	*/
+	colour	getCaptionColour(void) const;
+
+
+	/*!
+	\brief
+		Sets the colour to be used for rendering the caption text.
+
+	\param col
+		colour value that specifies the colour to be used when rendering the title bar caption text.
+
+	\return
+		Nothing.
+	*/
+	void	setCaptionColour(colour col);
+
+    /*!
+    \brief
+        Return a pointer to the currently set Image to be used for the north-south
+        sizing mouse cursor.
+
+    \return
+        Pointer to an Image object, or 0 for none.
+    */
+    const Image* getNSSizingCursorImage() const;
+
+    /*!
+    \brief
+        Return a pointer to the currently set Image to be used for the east-west
+        sizing mouse cursor.
+
+    \return
+        Pointer to an Image object, or 0 for none.
+    */
+    const Image* getEWSizingCursorImage() const;
+
+    /*!
+    \brief
+        Return a pointer to the currently set Image to be used for the northwest-southeast
+        sizing mouse cursor.
+
+    \return
+        Pointer to an Image object, or 0 for none.
+    */
+    const Image* getNWSESizingCursorImage() const;
+
+    /*!
+    \brief
+        Return a pointer to the currently set Image to be used for the northeast-southwest
+        sizing mouse cursor.
+
+    \return
+        Pointer to an Image object, or 0 for none.
+    */
+    const Image* getNESWSizingCursorImage() const;
+
+    /*!
+    \brief
+        Set the Image to be used for the north-south sizing mouse cursor.
+
+    \param image
+        Pointer to an Image object, or 0 for none.
+
+    \return
+        Nothing.
+    */
+    void setNSSizingCursorImage(const Image* image);
+
+    /*!
+    \brief
+        Set the Image to be used for the east-west sizing mouse cursor.
+
+    \param image
+        Pointer to an Image object, or 0 for none.
+
+    \return
+        Nothing.
+    */
+    void setEWSizingCursorImage(const Image* image);
+
+    /*!
+    \brief
+        Set the Image to be used for the northwest-southeast sizing mouse cursor.
+
+    \param image
+        Pointer to an Image object, or 0 for none.
+
+    \return
+        Nothing.
+    */
+    void setNWSESizingCursorImage(const Image* image);
+
+    /*!
+    \brief
+        Set the Image to be used for the northeast-southwest sizing mouse cursor.
+
+    \param image
+        Pointer to an Image object, or 0 for none.
+
+    \return
+        Nothing.
+    */
+    void setNESWSizingCursorImage(const Image* image);
+
+    /*!
+    \brief
+        Set the image to be used for the north-south sizing mouse cursor.
+
+    \param imageset
+        String holding the name of the Imageset containing the Image to be used.
+
+    \param image
+        String holding the name of the Image to be used.
+
+    \return
+        Nothing.
+
+    \exception UnknownObjectException thrown if either \a imageset or \a image refer to non-existant entities.
+    */
+    void setNSSizingCursorImage(const String& imageset, const String& image);
+
+    /*!
+    \brief
+        Set the image to be used for the east-west sizing mouse cursor.
+
+    \param imageset
+        String holding the name of the Imageset containing the Image to be used.
+
+    \param image
+        String holding the name of the Image to be used.
+
+    \return
+        Nothing.
+
+    \exception UnknownObjectException thrown if either \a imageset or \a image refer to non-existant entities.
+    */
+    void setEWSizingCursorImage(const String& imageset, const String& image);
+
+    /*!
+    \brief
+        Set the image to be used for the northwest-southeast sizing mouse cursor.
+
+    \param imageset
+        String holding the name of the Imageset containing the Image to be used.
+
+    \param image
+        String holding the name of the Image to be used.
+
+    \return
+        Nothing.
+
+    \exception UnknownObjectException thrown if either \a imageset or \a image refer to non-existant entities.
+    */
+    void setNWSESizingCursorImage(const String& imageset, const String& image);
+
+    /*!
+    \brief
+        Set the image to be used for the northeast-southwest sizing mouse cursor.
+
+    \param imageset
+        String holding the name of the Imageset containing the Image to be used.
+
+    \param image
+        String holding the name of the Image to be used.
+
+    \return
+        Nothing.
+
+    \exception UnknownObjectException thrown if either \a imageset or \a image refer to non-existant entities.
+    */
+    void setNESWSizingCursorImage(const String& imageset, const String& image);
+
+    // overridden from Window class
+    bool    isHit(const Point& position) const      { return Window::isHit(position) && !d_rolledup; }
+
+
+	/*************************************************************************
+		Construction / Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for FrameWindow objects.
+	*/
+	FrameWindow(const String& name, const String& type);
+
+	/*!
+	\brief
+		Destructor for FramwWindow objects.
+	*/
+	virtual ~FrameWindow(void);
+
+
+protected:
+	/*************************************************************************
+		Implementation Functions
+	*************************************************************************/
+	/*!
+	\brief
+		Create a control based upon the Titlebar base class to be used as the title bar for this window.
+
+    \param name
+        String object holding the name that must be used when creating the titlebar.
+
+	\return
+		Pointer to an object who's class derives from Titlebar
+	*/
+	virtual Titlebar*	createTitlebar(const String& name) const		= 0;
+
+
+	/*!
+	\brief
+		Create a control based upon the PushButton base class, to be used at the close button for the window.
+
+    \param name
+        String object holding the name that must be used when creating the close button.
+
+	\return
+		Pointer to an object who's class derives from PushButton.
+	*/
+	virtual PushButton*	createCloseButton(const String& name) const	= 0;
+
+
+	/*!
+	\brief
+		move the window's left edge by 'delta'.  The rest of the window does not move, thus this changes the size of the Window.
+
+	\param delta
+		float value that specifies the amount to move the window edge, and in which direction.  Positive values make window smaller.
+	*/
+	void	moveLeftEdge(float delta);
+
+
+	/*!
+	\brief
+		move the window's right edge by 'delta'.  The rest of the window does not move, thus this changes the size of the Window.
+
+	\param delta
+		float value that specifies the amount to move the window edge, and in which direction.  Positive values make window larger.
+	*/
+	void	moveRightEdge(float delta);
+
+
+	/*!
+	\brief
+		move the window's top edge by 'delta'.  The rest of the window does not move, thus this changes the size of the Window.
+
+	\param delta
+		float value that specifies the amount to move the window edge, and in which direction.  Positive values make window smaller.
+	*/
+	void	moveTopEdge(float delta);
+
+
+	/*!
+	\brief
+		move the window's bottom edge by 'delta'.  The rest of the window does not move, thus this changes the size of the Window.
+
+	\param delta
+		float value that specifies the amount to move the window edge, and in which direction.  Positive values make window larger.
+	*/
+	void	moveBottomEdge(float delta);
+
+
+	/*!
+	\brief
+		check local pixel co-ordinate point 'pt' and return one of the
+		SizingLocation enumerated values depending where the point falls on
+		the sizing border.
+
+	\param pt
+		Point object describing, in pixels, the window relative offset to check.
+
+	\return
+		One of the SizingLocation enumerated values that describe which part of
+		the sizing border that \a pt corresponded to, if any.
+	*/
+	SizingLocation	getSizingBorderAtPoint(const Point& pt) const;
+
+ 
+	/*!
+	\brief
+		return true if given SizingLocation is on left edge.
+
+	\param loc
+		SizingLocation value to be checked.
+
+	\return
+		true if \a loc is on the left edge.  false if \a loc is not on the left edge.
+	*/
+	bool	isLeftSizingLocation(SizingLocation loc) const			{return ((loc == SizingLeft) || (loc == SizingTopLeft) || (loc == SizingBottomLeft));}
+
+
+	/*!
+	\brief
+		return true if given SizingLocation is on right edge.
+
+	\param loc
+		SizingLocation value to be checked.
+
+	\return
+		true if \a loc is on the right edge.  false if \a loc is not on the right edge.
+	*/
+	bool	isRightSizingLocation(SizingLocation loc) const			{return ((loc == SizingRight) || (loc == SizingTopRight) || (loc == SizingBottomRight));}
+
+
+	/*!
+	\brief
+		return true if given SizingLocation is on top edge.
+
+	\param loc
+		SizingLocation value to be checked.
+
+	\return
+		true if \a loc is on the top edge.  false if \a loc is not on the top edge.
+	*/
+	bool	isTopSizingLocation(SizingLocation loc) const			{return ((loc == SizingTop) || (loc == SizingTopLeft) || (loc == SizingTopRight));}
+
+
+	/*!
+	\brief
+		return true if given SizingLocation is on bottom edge.
+
+	\param loc
+		SizingLocation value to be checked.
+
+	\return
+		true if \a loc is on the bottom edge.  false if \a loc is not on the bottom edge.
+	*/
+	bool	isBottomSizingLocation(SizingLocation loc) const		{return ((loc == SizingBottom) || (loc == SizingBottomLeft) || (loc == SizingBottomRight));}
+
+
+	/*!
+	\brief
+		Add frame window specific events
+	*/
+	void	addFrameWindowEvents(void);
+
+
+	/*!
+	\brief
+		Method to respond to close button click events and fire our close event
+	*/
+	bool	closeClickHandler(const EventArgs& e);
+
+
+	/*!
+	\brief
+		Set the appropriate mouse cursor for the given window-relative pixel point.
+	*/
+	void	setCursorForPoint(const Point& pt) const;
+
+
+	/*!
+	\brief
+		Return a Rect that describes, in window relative pixel co-ordinates, the outer edge of the sizing area for this window.
+	*/
+	virtual	Rect	getSizingRect(void) const		{return Rect(0, 0, getAbsoluteWidth(), getAbsoluteHeight());}
+
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"FrameWindow")	return true;
+		return Window::testClassName_impl(class_name);
+	}
+
+
+	/*************************************************************************
+		New events for Frame Windows
+	*************************************************************************/
+	/*!
+	\brief
+		Event generated internally whenever the roll-up / shade state of the window
+		changes.
+	*/
+	virtual void	onRollupToggled(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Event generated internally whenever the close button is clicked.
+	*/
+	virtual void	onCloseClicked(WindowEventArgs& e);
+
+
+	/*************************************************************************
+		Overridden event handlers
+	*************************************************************************/
+	virtual void	onMouseMove(MouseEventArgs& e);
+	virtual void	onMouseButtonDown(MouseEventArgs& e);
+	virtual void	onMouseButtonUp(MouseEventArgs& e);
+	virtual void	onCaptureLost(WindowEventArgs& e);
+	virtual void    onTextChanged(WindowEventArgs& e);
+	virtual void	onActivated(ActivationEventArgs& e);
+	virtual void	onDeactivated(ActivationEventArgs& e);
+
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	// frame data
+	bool	d_frameEnabled;		//!< true if window frame should be drawn.
+
+	// window roll-up data
+	bool	d_rollupEnabled;	//!< true if roll-up of window is allowed.
+	bool	d_rolledup;			//!< true if window is rolled up.
+
+	// drag-sizing data
+	bool	d_sizingEnabled;	//!< true if sizing is enabled for this window.
+	bool	d_beingSized;		//!< true if window is being sized.
+	float	d_borderSize;		//!< thickness of the sizing border around this window
+	Point	d_dragPoint;		//!< point window is being dragged at.
+
+	// composite controls
+	Titlebar*	d_titlebar;				//!< points to the title bar widget.
+	PushButton*	d_closeButton;			//!< points to close button widget.
+
+	// images for cursor when on sizing border
+	const Image*	d_nsSizingCursor;		//!< North/South sizing cursor image.
+	const Image*	d_ewSizingCursor;		//!< East/West sizing cursor image.
+	const Image*	d_nwseSizingCursor;		//!< North-West/South-East cursor image.
+	const Image*	d_neswSizingCursor;		//!< North-East/South-West cursor image.
+
+	bool	d_dragMovable;		//!< true if the window will move when dragged by the title bar.
+
+
+private:
+	/*************************************************************************
+		Static Properties for this class
+	*************************************************************************/
+	static FrameWindowProperties::SizingEnabled		d_sizingEnabledProperty;
+	static FrameWindowProperties::FrameEnabled		d_frameEnabledProperty;
+	static FrameWindowProperties::TitlebarEnabled	d_titlebarEnabledProperty;
+	static FrameWindowProperties::CloseButtonEnabled d_closeButtonEnabledProperty;
+	static FrameWindowProperties::RollUpState		d_rollUpStateProperty;
+	static FrameWindowProperties::RollUpEnabled		d_rollUpEnabledProperty;
+	static FrameWindowProperties::DragMovingEnabled	d_dragMovingEnabledProperty;
+	static FrameWindowProperties::SizingBorderThickness d_sizingBorderThicknessProperty;
+	static FrameWindowProperties::TitlebarFont		d_titlebarFontProperty;
+	static FrameWindowProperties::CaptionColour		d_captionColourProperty;
+    static FrameWindowProperties::NSSizingCursorImage   d_nsSizingCursorProperty;
+    static FrameWindowProperties::EWSizingCursorImage   d_ewSizingCursorProperty;
+    static FrameWindowProperties::NWSESizingCursorImage d_nwseSizingCursorProperty;
+    static FrameWindowProperties::NESWSizingCursorImage d_neswSizingCursorProperty;
+
+
+	/*************************************************************************
+		Private methods
+	*************************************************************************/
+	void	addFrameWindowProperties(void);
+};
+
+} // End of  CEGUI namespace section
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIFrameWindow_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIScrollbar.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIScrollbar.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIScrollbar.h	(revision 1812)
@@ -0,0 +1,513 @@
+/************************************************************************
+	filename: 	CEGUIScrollbar.h
+	created:	13/4/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to base class for Scrollbar widget
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIScrollbar_h_
+#define _CEGUIScrollbar_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIWindow.h"
+#include "elements/CEGUIScrollbarProperties.h"
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Base scroll bar class.
+
+	This base class for scroll bars does not have any idea of direction - a derived class would
+	add whatever meaning is appropriate according to what that derived class
+	represents to the user.
+*/
+class CEGUIEXPORT Scrollbar : public Window
+{
+public:
+	static const String EventNamespace;				//!< Namespace for global events
+
+	/*************************************************************************
+		Event name constants
+	*************************************************************************/
+	static const String EventScrollPositionChanged;		//!< Name of the event fired when the scroll bar position value changes
+	static const String EventThumbTrackStarted;			//!< Name of the event fired when the user begins dragging the thumb.
+	static const String EventThumbTrackEnded;				//!< Name of the event fired when the user releases the thumb.
+	static const String EventScrollConfigChanged;			//!< Name of the event fired when the scroll bar configuration data changes.
+
+
+	/*************************************************************************
+		Accessor functions
+	*************************************************************************/
+	/*!
+	\brief
+		Return the size of the document or data.
+		
+		The document size should be thought of as the total size of the data that
+		is being scrolled through (the number of lines in a text file for example).
+
+	\note
+		The returned value has no meaning within the Gui system, it is left up to the
+		application to assign appropriate values for the application specific use of
+		the scroll bar.
+
+	\return
+		float value specifying the currently set document size.
+	*/
+	float	getDocumentSize(void) const			{return d_documentSize;}
+
+
+	/*!
+	\brief
+		Return the page size for this scroll bar.
+		
+		The page size is typically the amount of data that can be displayed at one
+		time.  This value is also used when calculating the amount the position will
+		change when you click either side of the scroll bar thumb - the amount the
+		position changes will is (pageSize - overlapSize).
+
+	\note
+		The returned value has no meaning within the Gui system, it is left up to the
+		application to assign appropriate values for the application specific use of
+		the scroll bar.
+
+	\return
+		float value specifying the currently set page size.
+	*/
+	float	getPageSize(void) const				{return d_pageSize;}
+
+
+	/*!
+	\brief
+		Return the step size for this scroll bar.
+		
+		The step size is typically a single unit of data that can be displayed, this is the
+		amount the position will change when you click either of the arrow buttons on the
+		scroll bar.  (this could be 1 for a single line of text, for example).
+
+	\note
+		The returned value has no meaning within the Gui system, it is left up to the
+		application to assign appropriate values for the application specific use of
+		the scroll bar.
+
+	\return
+		float value specifying the currently set step size.
+	*/
+	float	getStepSize(void) const				{return d_stepSize;}
+
+
+	/*!
+	\brief
+		Return the overlap size for this scroll bar.
+		
+		The overlap size is the amount of data from the end of a 'page' that will
+		remain visible when the position is moved by a page.  This is usually used
+		so that the user keeps some context of where they were within the document's
+		data when jumping a page at a time.
+
+	\note
+		The returned value has no meaning within the Gui system, it is left up to the
+		application to assign appropriate values for the application specific use of
+		the scroll bar.
+
+	\return
+		float value specifying the currently set overlap size.
+	*/
+	float	getOverlapSize(void) const			{return d_overlapSize;}
+
+
+	/*!
+	\brief
+		Return the current position of scroll bar within the document.
+
+		The range of the scroll bar is from 0 to the size of the document minus the
+		size of a page (0 <= position <= (documentSize - pageSize)).
+
+	\note
+		The returned value has no meaning within the Gui system, it is left up to the
+		application to assign appropriate values for the application specific use of
+		the scroll bar.
+
+	\return
+		float value specifying the current position of the scroll bar within its
+		document.
+	*/
+	float	getScrollPosition(void) const		{return d_position;}
+
+
+	/*************************************************************************
+		Manipulator Commands
+	*************************************************************************/
+	/*!
+	\brief
+		Initialises the Scrollbar object ready for use.
+
+	\note
+		This must be called for every window created.  Normally this is handled automatically by the WindowFactory for each Window type.
+
+	\return
+		Nothing
+	*/
+	virtual void	initialise(void);
+
+
+	/*!
+	\brief
+		Set the size of the document or data.
+		
+		The document size should be thought of as the total size of the data that
+		is being scrolled through (the number of lines in a text file for example).
+
+	\note
+		The value set has no meaning within the Gui system, it is left up to the
+		application to assign appropriate values for the application specific use of
+		the scroll bar.
+
+	\param document_size
+		float value specifying the document size.
+
+	\return
+		Nothing.
+	*/
+	void	setDocumentSize(float document_size);
+
+
+	/*!
+	\brief
+		Set the page size for this scroll bar.
+		
+		The page size is typically the amount of data that can be displayed at one
+		time.  This value is also used when calculating the amount the position will
+		change when you click either side of the scroll bar thumb - the amount the
+		position changes will is (pageSize - overlapSize).
+
+	\note
+		The value set has no meaning within the Gui system, it is left up to the
+		application to assign appropriate values for the application specific use of
+		the scroll bar.
+
+	\param page_size
+		float value specifying the page size.
+
+	\return
+		Nothing.
+	*/
+	void	setPageSize(float page_size);
+
+
+	/*!
+	\brief
+		Set the step size for this scroll bar.
+		
+		The step size is typically a single unit of data that can be displayed, this is the
+		amount the position will change when you click either of the arrow buttons on the
+		scroll bar.  (this could be 1 for a single line of text, for example).
+
+	\note
+		The value set has no meaning within the Gui system, it is left up to the
+		application to assign appropriate values for the application specific use of
+		the scroll bar.
+
+	\param step_size
+		float value specifying the step size.
+
+	\return
+		Nothing.
+	*/
+	void	setStepSize(float step_size);
+
+
+	/*!
+	\brief
+		Set the overlap size for this scroll bar.
+		
+		The overlap size is the amount of data from the end of a 'page' that will
+		remain visible when the position is moved by a page.  This is usually used
+		so that the user keeps some context of where they were within the document's
+		data when jumping a page at a time.
+
+	\note
+		The value set has no meaning within the Gui system, it is left up to the
+		application to assign appropriate values for the application specific use of
+		the scroll bar.
+
+	\param overlap_size
+		float value specifying the overlap size.
+
+	\return
+		Nothing.
+	*/
+	void	setOverlapSize(float overlap_size);
+
+
+	/*!
+	\brief
+		Set the current position of scroll bar within the document.
+
+		The range of the scroll bar is from 0 to the size of the document minus the
+		size of a page (0 <= position <= (documentSize - pageSize)), any attempt to
+		set the position outside this range will be adjusted so that it falls within
+		the legal range.
+
+	\note
+		The returned value has no meaning within the Gui system, it is left up to the
+		application to assign appropriate values for the application specific use of
+		the scroll bar.
+
+	\param position
+		float value specifying the position of the scroll bar within its
+		document.
+
+	\return
+		Nothing.
+	*/
+	void	setScrollPosition(float position);
+
+
+	/*************************************************************************
+		Construction / Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for Scrollbar objects
+	*/
+	Scrollbar(const String& type, const String& name);
+
+
+	/*!
+	\brief
+		Destructor for Scrollbar objects
+	*/
+	virtual ~Scrollbar(void);
+
+
+protected:
+	/*************************************************************************
+		Implementation Methods
+	*************************************************************************/
+	/*!
+	\brief
+		Add scroll bar specific events
+	*/
+	void	addScrollbarEvents(void);
+
+
+	/*!
+	\brief
+		create a PushButton based widget to use as the increase button for this scroll bar.
+
+    \param name
+        String holding the name that must be passed when creating the component widget.
+	*/
+	virtual PushButton*	createIncreaseButton(const String& name) const		= 0;
+
+
+	/*!
+	\brief
+		create a PushButton based widget to use as the decrease button for this scroll bar.
+
+    \param name
+        String holding the name that must be passed when creating the component widget.
+	*/
+	virtual PushButton*	createDecreaseButton(const String& name) const		= 0;
+
+
+	/*!
+	\brief
+		create a Thumb based widget to use as the thumb for this scroll bar.
+
+    \param name
+        String holding the name that must be passed when creating the component widget.
+	*/
+	virtual Thumb*	createThumb(const String& name) const		= 0;
+
+
+	/*!
+	\brief
+		update the size and location of the thumb to properly represent the current state of the scroll bar
+	*/
+	virtual void	updateThumb(void)	= 0;
+
+
+	/*!
+	\brief
+		return value that best represents current scroll bar position given the current location of the thumb.
+
+	\return
+		float value that, given the thumb widget position, best represents the current position for the scroll bar.
+	*/
+	virtual float	getValueFromThumb(void) const	= 0;
+
+
+	/*!
+	\brief
+		Given window location \a pt, return a value indicating what change should be 
+		made to the scroll bar.
+
+	\param pt
+		Point object describing a pixel position in window space.
+
+	\return
+		- -1 to indicate scroll bar position should be moved to a lower value.
+		-  0 to indicate scroll bar position should not be changed.
+		- +1 to indicate scroll bar position should be moved to a higher value.
+	*/
+	virtual float	getAdjustDirectionFromPoint(const Point& pt) const	= 0;
+
+
+	/*!
+	\brief
+		handler function for when thumb moves.
+	*/
+	bool	handleThumbMoved(const EventArgs& e);
+
+
+	/*!
+	\brief
+		handler function for when the increase button is clicked.
+	*/
+	bool	handleIncreaseClicked(const EventArgs& e);
+
+
+	/*!
+	\brief
+		handler function for when the decrease button is clicked.
+	*/
+	bool	handleDecreaseClicked(const EventArgs& e);
+
+
+	/*!
+	\brief
+		handler function for when thumb tracking begins
+	*/
+	bool	handleThumbTrackStarted(const EventArgs& e);
+
+
+	/*!
+	\brief
+		handler function for when thumb tracking begins
+	*/
+	bool	handleThumbTrackEnded(const EventArgs& e);
+
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"Scrollbar")	return true;
+		return Window::testClassName_impl(class_name);
+	}
+
+
+	/*************************************************************************
+		New event handlers for slider widget
+	*************************************************************************/
+	/*!
+	\brief
+		Handler triggered when the scroll position changes
+	*/
+	virtual void	onScrollPositionChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler triggered when the user begins to drag the scroll bar thumb. 
+	*/
+	virtual void	onThumbTrackStarted(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler triggered when the scroll bar thumb is released
+	*/
+	virtual void	onThumbTrackEnded(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler triggered when the scroll bar data configuration changes
+	*/
+	virtual void	onScrollConfigChanged(WindowEventArgs& e);
+
+
+	/*************************************************************************
+		Overridden event handlers
+	*************************************************************************/
+	virtual void	onMouseButtonDown(MouseEventArgs& e);
+	virtual	void	onMouseWheel(MouseEventArgs& e);
+
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	float	d_documentSize;		//!< The size of the document / data being scrolled thorugh.
+	float	d_pageSize;			//!< The size of a single 'page' of data.
+	float	d_stepSize;			//!< Step size used for increase / decrease button clicks.
+	float	d_overlapSize;		//!< Amount of overlap when jumping by a page.
+	float	d_position;			//!< Current scroll position.
+
+	// Pointers to the controls that make up the scroll bar
+	Thumb*		d_thumb;		//!< widget used to represent the 'thumb' of the scroll bar.
+	PushButton*	d_increase;		//!< Widget used for the increase button of the scroll bar.
+	PushButton*	d_decrease;		//!< Widget used for the decrease button of the scroll bar.
+
+
+private:
+	/*************************************************************************
+		Static Properties for this class
+	*************************************************************************/
+	static ScrollbarProperties::DocumentSize	d_documentSizeProperty;
+	static ScrollbarProperties::PageSize		d_pageSizeProperty;
+	static ScrollbarProperties::StepSize		d_stepSizeProperty;
+	static ScrollbarProperties::OverlapSize		d_overlapSizeProperty;
+	static ScrollbarProperties::ScrollPosition	d_scrollPositionProperty;
+
+
+	/*************************************************************************
+		Private methods
+	*************************************************************************/
+	void	addScrollbarProperties(void);
+};
+
+
+} // End of  CEGUI namespace section
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIScrollbar_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIListHeaderSegmentProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIListHeaderSegmentProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIListHeaderSegmentProperties.h	(revision 1812)
@@ -0,0 +1,152 @@
+/************************************************************************
+	filename: 	CEGUIListHeaderSegmentProperties.h
+	created:	11/7/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to properties for ListHeaderSegment class
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIListHeaderSegmentProperties_h_
+#define _CEGUIListHeaderSegmentProperties_h_
+
+#include "CEGUIProperty.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+// Start of ListHeaderSegmentProperties namespace section
+/*!
+\brief
+	Namespace containing all classes that make up the properties interface for the ListHeaderSegment class
+*/
+namespace ListHeaderSegmentProperties
+{
+/*!
+\brief
+	Property to access the sizable setting of the header segment.
+
+	\par Usage:
+		- Name: Sizable
+		- Format: "[text]"
+
+	\par Where [Text] is:
+		- "True" to indicate the segment can be sized by the user.
+		- "False" to indicate the segment can not be sized by the user.
+*/
+class Sizable : public Property
+{
+public:
+	Sizable() : Property(
+		"Sizable",
+		"Property to get/set the sizable setting of the header segment.  Value is either \"True\" or \"False\".",
+		"True")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the click-able setting of the header segment.
+
+	\par Usage:
+		- Name: Clickable
+		- Format: "[text]"
+
+	\par Where [Text] is:
+		- "True" to indicate the segment can be clicked by the user.
+		- "False" to indicate the segment can not be clicked by the user.
+*/
+class Clickable : public Property
+{
+public:
+	Clickable() : Property(
+		"Clickable",
+		"Property to get/set the click-able setting of the header segment.  Value is either \"True\" or \"False\".",
+		"True")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the drag-able setting of the header segment.
+
+	\par Usage:
+		- Name: Dragable
+		- Format: "[text]"
+
+	\par Where [Text] is:
+		- "True" to indicate the segment can be dragged by the user.
+		- "False" to indicate the segment can not be dragged by the user.
+*/
+class Dragable : public Property
+{
+public:
+	Dragable() : Property(
+		"Dragable",
+		"Property to get/set the drag-able setting of the header segment.  Value is either \"True\" or \"False\".",
+		"True")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the sort direction setting of the header segment.
+
+	\par Usage:
+		- Name: SortDirection
+		- Format: "[text]"
+
+	\par Where [Text] is one of:
+		- "Ascending"
+		- "Descending"
+		- "None"
+*/
+class SortDirection : public Property
+{
+public:
+	SortDirection() : Property(
+		"SortDirection",
+		"Property to get/set the sort direction setting of the header segment.  Value is the text of one of the SortDirection enumerated value names.",
+		"None")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+} // End of  ListHeaderSegmentProperties namespace section
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIListHeaderSegmentProperties_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIPushButtonProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIPushButtonProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIPushButtonProperties.h	(revision 1812)
@@ -0,0 +1,181 @@
+/************************************************************************
+	filename: 	CEGUIPushButtonProperties.h
+	created:	22/2/2005
+	author:		Paul D Turner
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIPushButtonProperties_h_
+#define _CEGUIPushButtonProperties_h_
+
+#include "CEGUIProperty.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+// Start of PushButtonProperties namespace section
+/*!
+\brief
+   Namespace containing all classes that make up the properties
+   interface for the PushButton class
+*/
+namespace PushButtonProperties
+{
+
+/*!
+\brief
+   Property to access the normal image of the button
+
+   \par Usage:
+      - Name: NormalImage
+      - Format: "set:<imageset> image:<imagename>".
+
+*/
+class NormalImage : public Property
+{
+public:
+   NormalImage() : Property(
+	   "NormalImage", 
+	   "Property to get/set the normal image for the PushButton widget.  Value should be \"set:[imageset name] image:[image name]\".",
+	   "")
+   {}
+
+   String   get(const PropertyReceiver* receiver) const;
+   void   set(PropertyReceiver* receiver, const String& value);
+};
+
+/*!
+\brief
+   Property to access the pushed image of the button
+
+   \par Usage:
+      - Name: PushedImage
+      - Format: "set:<imageset> image:<imagename>".
+
+*/
+class PushedImage : public Property
+{
+public:
+   PushedImage() : Property(
+	   "PushedImage",
+	   "Property to get/set the pushed image for the PushButton widget.  Value should be \"set:[imageset name] image:[image name]\".",
+	   "")
+   {}
+
+   String   get(const PropertyReceiver* receiver) const;
+   void   set(PropertyReceiver* receiver, const String& value);
+};
+
+/*!
+\brief
+   Property to access the hover image of the button
+
+   \par Usage:
+      - Name: HoverImage
+      - Format: "set:<imageset> image:<imagename>".
+
+*/
+class HoverImage : public Property
+{
+public:
+   HoverImage() : Property(
+	   "HoverImage",
+	   "Property to get/set the hover image for the PushButton widget.  Value should be \"set:[imageset name] image:[image name]\".",
+	   "")
+   {}
+
+   String   get(const PropertyReceiver* receiver) const;
+   void   set(PropertyReceiver* receiver, const String& value);
+};
+
+/*!
+\brief
+   Property to access the disabled image of the button
+
+   \par Usage:
+      - Name: DisabledImage
+      - Format: "set:<imageset> image:<imagename>".
+
+*/
+class DisabledImage : public Property
+{
+public:
+   DisabledImage() : Property(
+	   "DisabledImage",
+	   "Property to get/set the disabled image for the PushButton widget.  Value should be \"set:[imageset name] image:[image name]\".",
+	   "")
+   {}
+
+   String   get(const PropertyReceiver* receiver) const;
+   void   set(PropertyReceiver* receiver, const String& value);
+};
+
+/*!
+\brief
+   Property to access whether to use the standard images or the supplied custom ones
+
+   \par Usage:
+      - Name: UseStandardImagery
+      - Format: "True|False".
+
+*/
+class UseStandardImagery : public Property
+{
+public:
+   UseStandardImagery() : Property(
+	   "UseStandardImagery",
+	   "Property to get/set whether to use the standard imagery for the PushButton widget.  Value should be \"True\" or \"False\".",
+	   "True")
+   {}
+
+   String   get(const PropertyReceiver* receiver) const;
+   void   set(PropertyReceiver* receiver, const String& value);
+};
+
+/*!
+\brief
+   Property to access an offset that is used to shift the text in the x-direction.
+
+   \par Usage:
+      - Name: UseStandardImagery
+      - Format: "<xoffset>".
+
+   \par
+      where <xoffset> is a float value specifying the offset relative to the button-size
+
+*/
+class TextXOffset : public Property
+{
+public:
+   TextXOffset() : Property(
+	   "TextXOffset",
+	   "Property to get/set a relative x offset for the button's text",
+	   "0.000000")
+   {}
+
+   String get(const PropertyReceiver* receiver) const;
+   void set(PropertyReceiver* receiver, const String& value);
+};
+
+}
+
+}
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIRadioButton.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIRadioButton.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIRadioButton.h	(revision 1812)
@@ -0,0 +1,215 @@
+/************************************************************************
+	filename: 	CEGUIRadioButton.h
+	created:	13/4/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to base class for RadioButton widget
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIRadioButton_h_
+#define _CEGUIRadioButton_h_
+
+#include "CEGUIBase.h"
+#include "elements/CEGUIButtonBase.h"
+#include "elements/CEGUIRadioButtonProperties.h"
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Base class to provide the logic for Radio Button widgets.
+
+*/
+class CEGUIEXPORT RadioButton : public ButtonBase
+{
+public:
+	static const String EventNamespace;				//!< Namespace for global events
+
+
+	/*************************************************************************
+		Event name constants
+	*************************************************************************/
+	// generated internally by Window
+	static const String EventSelectStateChanged;			//!< The selected state of the widget has changed.
+
+
+	/*************************************************************************
+		Accessor Functions
+	*************************************************************************/ 
+	/*!
+	\brief
+		return true if the radio button is selected (has the checkmark)
+
+	\return
+		true if this widget is selected, false if the widget is not selected.
+	*/
+	bool	isSelected(void) const				{return d_selected;}
+
+	
+	/*!
+	\brief
+		return the groupID assigned to this radio button
+
+	\return
+		ulong value that identifies the Radio Button group this widget belongs to.
+	*/
+	ulong	getGroupID(void) const				{return d_groupID;}
+
+
+	/*!
+	\brief
+		Return a pointer to the RadioButton object within the same group as this RadioButton, that
+		is currently selected.
+
+	\return
+		Pointer to the RadioButton object that is the RadioButton within the same group as this RadioButton,
+		and is attached to the same parent window as this RadioButton, that is currently selected.
+		Returns NULL if no button within the group is selected, or if 'this' is not attached to a parent window.
+	*/
+	RadioButton*	getSelectedButtonInGroup(void) const;
+
+
+	/*************************************************************************
+		Manipulator Functions
+	*************************************************************************/
+	/*!
+	\brief
+		set whether the radio button is selected or not
+
+	\param select
+		true to put the radio button in the selected state, false to put the radio button in the
+		deselected state.  If changing to the selected state, any previously selected radio button
+		within the same group is automatically deselected.
+
+	\return
+		Nothing.
+	*/
+	void	setSelected(bool select);
+
+	
+	/*!
+	\brief
+		set the groupID for this radio button
+
+	\param group
+		ulong value specifying the radio button group that this widget belongs to.
+
+	\return	
+		Nothing.
+	*/
+	void	setGroupID(ulong group);
+
+
+	/*************************************************************************
+		Construction / Destruction
+	*************************************************************************/
+	RadioButton(const String& type, const String& name);
+	virtual ~RadioButton(void);
+
+
+protected:
+	/*************************************************************************
+		Implementation Functions
+	*************************************************************************/
+	/*!
+	\brief
+		Add radio button specific events
+	*/
+	void	addRadioButtonEvents(void);
+
+
+	/*!
+	\brief
+		Deselect any selected radio buttons attached to the same parent within the same group
+		(but not do not deselect 'this').
+	*/
+	void	deselectOtherButtonsInGroup(void) const;
+
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"RadioButton")	return true;
+		return ButtonBase::testClassName_impl(class_name);
+	}
+
+
+	/*************************************************************************
+		New Radio Button Events
+	*************************************************************************/
+	/*!
+	\brief
+		event triggered internally when the select state of the button changes.
+	*/
+	virtual void	onSelectStateChanged(WindowEventArgs& e);
+
+
+	/*************************************************************************
+		Overridden Event handlers
+	*************************************************************************/
+	virtual void	onMouseButtonUp(MouseEventArgs& e);
+
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	bool		d_selected;				// true when radio button is selected (has checkmark)
+	ulong		d_groupID;				// radio button group ID
+
+
+private:
+	/*************************************************************************
+		Static Properties for this class
+	*************************************************************************/
+	static RadioButtonProperties::Selected	d_selectedProperty;
+	static RadioButtonProperties::GroupID	d_groupIDProperty;
+
+
+	/*************************************************************************
+		Private methods
+	*************************************************************************/
+	void	addRadioButtonProperties(void);
+};
+
+
+} // End of  CEGUI namespace section
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIRadioButton_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIFrameWindowProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIFrameWindowProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIFrameWindowProperties.h	(revision 1812)
@@ -0,0 +1,391 @@
+/************************************************************************
+	filename: 	CEGUIFrameWindowProperties.h
+	created:	10/7/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to properties for FrameWIndow class
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIFrameWindowProperties_h_
+#define _CEGUIFrameWindowProperties_h_
+
+#include "CEGUIProperty.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+// Start of FrameWindowProperties namespace section
+/*!
+\brief
+	Namespace containing all classes that make up the properties interface for the FrameWindow class
+*/
+namespace FrameWindowProperties
+{
+/*!
+\brief
+	Property to access the state of the sizable setting for the FrameWindow.
+
+	\par Usage:
+		- Name: SizingEnabled
+		- Format: "[text]".
+
+	\par Where [Text] is:
+		- "True" to indicate the window will be user re-sizable.
+		- "False" to indicate the window will not be re-sizable by the user.
+*/
+class SizingEnabled : public Property
+{
+public:
+	SizingEnabled() : Property(
+		"SizingEnabled",
+		"Property to get/set the state of the sizable setting for the FrameWindow.  Value is either \"True\" or \"False\".",
+		"True")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the setting for whether the window frame will be displayed.
+
+	\par Usage:
+		- Name: FrameEnabled
+		- Format: "[text]".
+
+	\par Where [Text] is:
+		- "True" to indicate the windows frame should be displayed.
+		- "False" to indicate the windows frame should not be displayed.
+*/
+class FrameEnabled : public Property
+{
+public:
+	FrameEnabled() : Property(
+		"FrameEnabled",
+		"Property to get/set the setting for whether the window frame will be displayed.  Value is either \"True\" or \"False\".",
+		"True")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the setting for whether the window title-bar will be enabled (or displayed depending upon choice of final widget type).
+
+	\par Usage:
+		- Name: TitlebarEnabled
+		- Format: "[text]".
+
+	\par Where [Text] is:
+		- "True" to indicate the windows title bar should be enabled (and/or visible)
+		- "False" to indicate the windows title bar should be disabled (and/or hidden)
+*/
+class TitlebarEnabled : public Property
+{
+public:
+	TitlebarEnabled() : Property(
+		"TitlebarEnabled",
+		"Property to get/set the setting for whether the window title-bar will be enabled (or displayed depending upon choice of final widget type).  Value is either \"True\" or \"False\".",
+		"") 
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the setting for whether the window close button will be enabled (or displayed depending upon choice of final widget type).
+
+	\par Usage:
+		- Name: CloseButtonEnabled
+		- Format: "[text]".
+
+	\par Where [Text] is:
+		- "True" to indicate the windows close button should be enabled (and/or visible)
+		- "False" to indicate the windows close button should be disabled (and/or hidden)
+*/
+class CloseButtonEnabled : public Property
+{
+public:
+	CloseButtonEnabled() : Property(
+		"CloseButtonEnabled",
+		"Property to get/set the setting for whether the window close button will be enabled (or displayed depending upon choice of final widget type).  Value is either \"True\" or \"False\".",
+		"True")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the setting for whether the user is able to roll-up / shade the window.
+
+	\par Usage:
+		- Name: RollUpEnabled
+		- Format: "[text]".
+
+	\par Where [Text] is:
+		- "True" to indicate the user can roll-up / shade the window.
+		- "False" to indicate the user can not roll-up / shade the window.
+*/
+class RollUpEnabled : public Property
+{
+public:
+	RollUpEnabled() : Property(
+		"RollUpEnabled",
+		"Property to get/set the setting for whether the user is able to roll-up / shade the window.  Value is either \"True\" or \"False\".",
+		"True")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the roll-up / shade state of the window.
+
+	\par Usage:
+		- Name: RollUpState
+		- Format: "[text]".
+
+	\par Where [Text] is:
+		- "True" to indicate the window is / should be rolled-up.
+		- "False" to indicate the window is not / should not be rolled up
+*/
+class RollUpState : public Property
+{
+public:
+	RollUpState() : Property(
+		"RollUpState",
+		"Property to get/set the roll-up / shade state of the window.  Value is either \"True\" or \"False\".",
+		"False")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the setting for whether the user may drag the window around by its title bar.
+
+	\par Usage:
+		- Name: DragMovingEnabled
+		- Format: "[text]".
+
+	\par Where [Text] is:
+		- "True" to indicate the window may be repositioned by the user via dragging.
+		- "False" to indicate the window may not be repositioned by the user.
+*/
+class DragMovingEnabled : public Property
+{
+public:
+	DragMovingEnabled() : Property(
+		"DragMovingEnabled",
+		"Property to get/set the setting for whether the user may drag the window around by its title bar.  Value is either \"True\" or \"False\".",
+		"True")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the setting for the sizing border thickness.
+
+	\par Usage:
+		- Name: SizingBorderThickness
+		- Format: "[float]".
+
+	\par Where:
+		- [float] is the size of the invisible sizing border in screen pixels.
+*/
+class SizingBorderThickness : public Property
+{
+public:
+	SizingBorderThickness() : Property(
+		"SizingBorderThickness",
+		"Property to get/set the setting for the sizing border thickness.  Value is a float specifying the border thickness in pixels.",
+		"8.000000")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the Font set for the windows title bar.
+
+	\par Usage:
+		- Name: TitlebarFont
+		- Format: "[text]".
+
+	\par Where:
+		- [text] is the name of the Font to assign for this windows title bar.  The Font specified must already be loaded.
+*/
+class TitlebarFont : public Property
+{
+public:
+	TitlebarFont() : Property(
+		"TitlebarFont",
+		"Property to get/set the Font set for the windows title bar.  Value is the name of the font to use (must be loaded already).",
+		"")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+/*!
+\brief
+	Property to colour used for rendering the caption text.
+
+	\par Usage:
+		- Name: CaptionColour
+		- Format: "aarrggbb".
+
+	\par Where:
+		- aarrggbb is the ARGB colour value to be used.
+*/
+class CaptionColour : public Property
+{
+public:
+	CaptionColour() : Property(
+		"CaptionColour",
+		"Property to get/set the colour used for rendering the caption text.  Value is \"aarrggbb\" (hex).",
+		"FF000000")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+/*!
+\brief
+   Property to access the N-S (up-down) sizing cursor image
+
+   \par Usage:
+      - Name: NSSizingCursorImage
+      - Format: "set:<imageset> image:<imagename>".
+
+*/
+class NSSizingCursorImage : public Property
+{
+public:
+   NSSizingCursorImage() : Property(
+	   "NSSizingCursorImage",
+	   "Property to get/set the N-S (up-down) sizing cursor image for the FramwWindow.  Value should be \"set:[imageset name] image:[image name]\".",
+	   "")
+   {}
+
+   String   get(const PropertyReceiver* receiver) const;
+   void   set(PropertyReceiver* receiver, const String& value);
+};
+
+/*!
+\brief
+   Property to access the E-W (left/right) sizing cursor image
+
+   \par Usage:
+      - Name: EWSizingCursorImage
+      - Format: "set:<imageset> image:<imagename>".
+
+*/
+class EWSizingCursorImage : public Property
+{
+public:
+   EWSizingCursorImage() : Property(
+	   "EWSizingCursorImage",
+	   "Property to get/set the E-W (left-right) sizing cursor image for the FramwWindow.  Value should be \"set:[imageset name] image:[image name]\".",
+	   "")
+   {}
+
+   String   get(const PropertyReceiver* receiver) const;
+   void   set(PropertyReceiver* receiver, const String& value);
+};
+
+/*!
+\brief
+   Property to access the NW-SE diagonal sizing cursor image
+
+   \par Usage:
+      - Name: NWSESizingCursorImage
+      - Format: "set:<imageset> image:<imagename>".
+
+*/
+class NWSESizingCursorImage : public Property
+{
+public:
+   NWSESizingCursorImage() : Property(
+	   "NWSESizingCursorImage",
+	   "Property to get/set the NW-SE diagonal sizing cursor image for the FramwWindow.  Value should be \"set:[imageset name] image:[image name]\".",
+	   "")
+   {}
+
+   String   get(const PropertyReceiver* receiver) const;
+   void   set(PropertyReceiver* receiver, const String& value);
+};
+
+/*!
+\brief
+   Property to access the NE-SW diagonal sizing cursor image
+
+   \par Usage:
+      - Name: NESWSizingCursorImage
+      - Format: "set:<imageset> image:<imagename>".
+
+*/
+class NESWSizingCursorImage : public Property
+{
+public:
+   NESWSizingCursorImage() : Property(
+	   "NESWSizingCursorImage",
+	   "Property to get/set the NE-SW diagonal sizing cursor image for the FramwWindow.  Value should be \"set:[imageset name] image:[image name]\".",
+	   "")
+   {}
+
+   String   get(const PropertyReceiver* receiver) const;
+   void   set(PropertyReceiver* receiver, const String& value);
+};
+
+} // End of  FrameWindowProperties namespace section
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIFrameWindowProperties_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUITabButton.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUITabButton.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUITabButton.h	(revision 1812)
@@ -0,0 +1,180 @@
+/************************************************************************
+	filename: 	CEGUITabButton.h
+	created:	8/8/2004
+	author:		Steve Streeting
+	
+	purpose:	Interface to base class for TabButton widget
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUITabButton_h_
+#define _CEGUITabButton_h_
+
+#include "CEGUIBase.h"
+#include "elements/CEGUIButtonBase.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+    Base class for TabButtons.  A TabButton based class is used internally as
+    the button that appears at the top of a TabControl widget to select the
+    active tab pane.
+*/
+class CEGUIEXPORT TabButton : public ButtonBase
+{
+public:
+	static const String EventNamespace;				//!< Namespace for global events
+
+
+	/*************************************************************************
+		Event name constants
+	*************************************************************************/
+	// generated internally by Window
+	static const String EventClicked;					//!< The button was clicked.
+
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for base TabButton class
+	*/
+	TabButton(const String& type, const String& name);
+
+
+	/*!
+	\brief
+		Destructor for TabButton class
+	*/
+	virtual ~TabButton(void);
+
+    /*!
+    \brief
+        Set whether this tab button is selected or not
+    */
+    virtual void setSelected(bool selected) { d_selected = selected; requestRedraw(); }
+
+    /*!
+    \brief
+        Set whether this tab button is on the right of the selected button, 
+        used to disable edges of buttons when deselected (to give an overlapping
+        look)
+    */
+    virtual void setRightOfSelected(bool isRight) { d_rightOfSelected = isRight; requestRedraw(); }
+
+    /*!
+    \brief
+        Return whether this tab button is selected or not
+    */
+    bool isSelected(void) const { return d_selected; }
+
+
+    /*!
+    \brief
+        Set the target window which is the content pane which this button is
+        covering.
+    */
+    void setTargetWindow(Window* wnd);
+    /*!
+    \brief
+        Get the target window which is the content pane which this button is
+        covering.
+    */
+    Window* getTargetWindow(void) { return d_targetWindow; }
+
+    /*!
+    \brief
+        Set the index at which this tab is positioned.
+    */
+    void setTabIndex(uint idx) { d_tabIndex = idx; }
+
+    /*!
+    \brief
+        Get the index at which this tab is positioned.
+    */
+    uint getTabIndex(void) { return d_tabIndex; }
+protected:
+    /*************************************************************************
+    Implementation Data
+    *************************************************************************/
+    bool    d_selected;             //!< Is this button selected?
+    bool    d_rightOfSelected;      //!< Is this button to the right of the selected tab?
+    Window* d_targetWindow;         //!< The target window which this button is representing
+    uint    d_tabIndex;             //!< The index at which this tab is positioned
+	/*************************************************************************
+		New Event Handlers
+	*************************************************************************/
+	/*!
+	\brief
+		handler invoked internally when the button is clicked.
+	*/
+	virtual void	onClicked(WindowEventArgs& e);
+
+
+	/*************************************************************************
+		Overridden Event Handlers
+	*************************************************************************/
+	virtual void	onMouseButtonUp(MouseEventArgs& e);
+
+
+	/*************************************************************************
+		Implementation Functions
+	*************************************************************************/
+	/*!
+	\brief
+		Add button specific events
+	*/
+	void	addTabButtonEvents(void);
+	/*!
+	\brief
+		Perform the rendering for this widget.
+
+	\param z
+		float value specifying the base Z co-ordinate that should be used when rendering
+
+	\return
+		Nothing
+	*/
+	void	drawSelf(float z);
+
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"TabButton")	return true;
+		return ButtonBase::testClassName_impl(class_name);
+	}
+};
+
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUITabButton_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIItemListBaseProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIItemListBaseProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIItemListBaseProperties.h	(revision 1812)
@@ -0,0 +1,63 @@
+/************************************************************************
+	filename: 	CEGUIItemListBaseProperties.h
+	created:	5/4/2005
+	author:		Tomas Lindquist Olsen (based on code by Paul D Turner)
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIItemListBaseProperties_h_
+#define _CEGUIItemListBaseProperties_h_
+
+#include "CEGUIProperty.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+// Start of ItemListBaseProperties namespace section
+namespace ItemListBaseProperties
+{
+    /*!
+    \brief
+	    Property to access the state of the auto resize enabled setting.
+
+	    \par Usage:
+		    - Name: AutoResizeEnabled
+		    - Format: "[text]".
+
+	    \par Where [Text] is:
+		    - "True" to indicate that auto resizing is enabled.
+		    - "False" to indicate that auto resizing is disabled.
+    */
+    class AutoResizeEnabled : public Property
+    {
+    public:
+	    AutoResizeEnabled() : Property(
+		    "AutoResizeEnabled",
+		    "Property to get/set the state of the auto resizing enabled setting for the ItemListBase.  Value is either \"True\" or \"False\".",
+		    "False")
+	    {}
+
+	    String	get(const PropertyReceiver* receiver) const;
+	    void	set(PropertyReceiver* receiver, const String& value);
+    };
+
+} // End of  ItemListBaseProperties namespace section
+} // End of  CEGUI namespace section
+
+#endif	// end of guard _CEGUIItemListBaseProperties_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUITextItem.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUITextItem.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUITextItem.h	(revision 1812)
@@ -0,0 +1,238 @@
+/************************************************************************
+	filename: 	CEGUITextItem.h
+	created:	31/3/2005
+	author:		Tomas Lindquist Olsen (based on code by Paul D Turner)
+	
+	purpose:	Interface to base class for TextItem widget
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUITextItem_h_
+#define _CEGUITextItem_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIWindow.h"
+#include "elements/CEGUIItemEntry.h"
+#include "elements/CEGUITextItemProperties.h"
+#include "CEGUIFont.h"
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+	Base class for all the TextItem widgets.
+*/
+class CEGUIEXPORT TextItem : public ItemEntry
+{
+public:
+	/*************************************************************************
+		Constants
+	*************************************************************************/
+	static const colour		DefaultTextColour;		//!< Default colour used when rendering text.
+
+
+	/*************************************************************************
+		Accessors
+	*************************************************************************/
+	/*!
+	\brief
+		Return the TextFormatting currently used for rendering the text.
+
+	\return
+		TextFormatting value describing the currently used text formatting option.
+	*/
+	TextFormatting getTextFormatting() const		{return d_textFormatting;}
+
+
+	/*!
+    \brief
+        get the offset that is used to shift of the text in the x-direction
+        this is useful if the button-images are not symmetrical and the
+        text shouldn't be completely centered
+
+    \return
+        the offset in pixels
+    */
+    float   getTextXOffset(void) const				{return d_textXOffset;}
+
+
+	/*!
+    \brief
+        Get the current text colour of the item.
+
+    \return
+        The current text colour.
+    */
+	colour getTextColour(void) const			{return d_textColour;}
+
+
+	/*************************************************************************
+		Manipulators
+	*************************************************************************/
+	/*!
+	\brief
+		Set the TextFormatting to be used when rendering the text.
+	*/
+	void setTextFormatting(TextFormatting format)	{d_textFormatting=format;}
+
+
+	/*!
+    \brief
+        Set the current text colour of the item.
+
+    \param col
+        The colour to set as the current text colour.
+    */
+	void setTextColour(const colour& col)			{d_textColour=col;}
+
+
+	/*!
+    \brief
+        Set the offset to use for a shift of the text in the x-direction
+        this is useful if the button-images are not symmetrical and the
+        text shouldn't be completely centered
+
+    \param offset
+        The offset to use - in pixels.
+
+    \return
+        Nothing.
+    */
+    void   setTextXOffset(float offset)				{d_textXOffset=offset;}
+
+
+	/*************************************************************************
+		Pure functions from ItemEntry
+	*************************************************************************/
+	/*!
+	\brief
+		Return the "optimal" size for the item
+	
+	\return
+		Size describing the size in pixel that this TextItem's content requires
+		for non-clipped rendering
+	*/
+	virtual Size getItemPixelSize(void);
+
+
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for TextItem objects
+	*/
+	TextItem(const String& type, const String& name);
+
+
+	/*!
+	\brief
+		Destructor for TextItem objects
+	*/
+	virtual ~TextItem(void);
+
+
+protected:
+	/*************************************************************************
+		Abstract Implementation Functions (must be provided by derived class)
+	*************************************************************************/
+
+	/*************************************************************************
+		Overridden event handlers
+	*************************************************************************/
+	/*!
+	\brief
+		Handler called when the window's text is changed.
+
+	\param e
+		WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event.  For this
+		event the trigger window is always 'this'.
+	*/
+	virtual void	onTextChanged(WindowEventArgs& e);
+
+
+	/*************************************************************************
+		Implementation Functions
+	*************************************************************************/
+    virtual void populateRenderCache();
+
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"TextItem")	return true;
+		return ItemEntry::testClassName_impl(class_name);
+	}
+
+
+	/*************************************************************************
+		Implementation Rendering Functions
+	*************************************************************************/
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	colour d_textColour;				//!< the current text colour
+	TextFormatting d_textFormatting;	//!< the current text formatting
+
+	//text-offset
+    float d_textXOffset;		//!< offset applied to the x co-ordinate of the text rendered.
+
+
+private:
+	/*************************************************************************
+		Static Properties for this class
+	*************************************************************************/
+	static TextItemProperties::TextColour		d_textColourProperty;
+	static TextItemProperties::TextFormatting	d_textFormattingProperty;
+	static TextItemProperties::TextXOffset		d_textXOffsetProperty;
+
+	/*************************************************************************
+		Private methods
+	*************************************************************************/
+	void	addTextItemProperties(void);
+};
+
+} // End of  CEGUI namespace section
+
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+
+#endif	// end of guard _CEGUITextItem_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIButtonBase.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIButtonBase.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIButtonBase.h	(revision 1812)
@@ -0,0 +1,339 @@
+/************************************************************************
+	filename: 	CEGUIButtonBase.h
+	created:	13/4/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to base class for ButtonBase widget
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIButtonBase_h_
+#define _CEGUIButtonBase_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIWindow.h"
+#include "elements/CEGUIButtonBaseProperties.h"
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+	Base class for all the 'button' type widgets (push button, radio button, check-box, etc)
+*/
+class CEGUIEXPORT ButtonBase : public Window
+{
+public:
+	/*************************************************************************
+		Constants
+	*************************************************************************/
+	// default colours for text label rendering
+	static const colour		DefaultNormalLabelColour;		//!< Default colour used when rendering label text in normal state.
+	static const colour		DefaultHoverLabelColour;		//!< Default colour used when rendering label text in hover / highlight state.
+	static const colour		DefaultPushedLabelColour;		//!< Default colour used when rendering label text in pushed state.
+	static const colour		DefaultDisabledLabelColour;		//!< Default colour used when rendering label text in disabled state.
+
+
+	/*************************************************************************
+		Accessor type functions
+	*************************************************************************/
+	/*!
+	\brief
+		return true if user is hovering over this widget (or it's pushed and user is not over it for highlight)
+
+	\return
+		true if the user is hovering or if the button is pushed and the mouse is not over the button.  Otherwise return false.
+	*/
+	bool	isHovering(void) const			{return d_hovering;}
+
+
+	/*!
+	\brief
+		Return true if the button widget is in the pushed state.
+
+	\return
+		true if the button-type widget is pushed, false if the widget is not pushed.
+	*/
+	bool	isPushed(void) const			{return d_pushed;}
+
+
+	/*!
+	\brief
+		return text label colour used for normal rendering
+
+	\return
+		colour value that is used for the label text when rendering in the normal state.
+	*/
+	colour	getNormalTextColour(void) const			{return d_normalColour;}
+
+
+	/*!
+	\brief
+		return text label colour used for hover / highlight rendering
+
+	\return
+		colour value that is used for the label text when rendering in the hover / highlighted states.
+	*/
+	colour	getHoverTextColour(void) const			{return d_hoverColour;}
+
+
+	/*!
+	\brief
+		return text label colour used for pushed rendering
+
+	\return
+		colour value that is used for the label text when rendering in the pushed state.
+	*/
+	colour	getPushedTextColour(void) const			{return d_pushedColour;}
+
+
+	/*!
+	\brief
+		return text label colour used for disabled rendering
+
+	\return
+		colour value that is used for the label text when rendering in the disabled state.
+	*/
+	colour	getDisabledTextColour(void) const		{return d_disabledColour;}
+
+	/*************************************************************************
+		Manipulators
+	*************************************************************************/
+	/*!
+	\brief
+		Set the colour to use for the label text when rendering in the normal state.
+
+	\param colour
+		colour value specifying the colour to be used.
+
+	\return
+		Nothing.
+	*/
+	void	setNormalTextColour(const colour& colour);
+
+
+	/*!
+	\brief
+		Set the colour to use for the label text when rendering in the hover / highlighted states.
+
+	\param colour
+		colour value specifying the colour to be used.
+
+	\return
+		Nothing.
+	*/
+	void	setHoverTextColour(const colour& colour);
+
+
+	/*!
+	\brief
+		Set the colour to use for the label text when rendering in the pushed state.
+
+	\param colour
+		colour value specifying the colour to be used.
+
+	\return
+		Nothing.
+	*/
+	void	setPushedTextColour(const colour& colour);
+
+
+	/*!
+	\brief
+		Set the colour to use for the label text when rendering in the disabled state.
+
+	\param colour
+		colour value specifying the colour to be used.
+
+	\return
+		Nothing.
+	*/
+	void	setDisabledTextColour(const colour& colour);
+
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for ButtonBase objects
+	*/
+	ButtonBase(const String& type, const String& name);
+
+
+	/*!
+	\brief
+		Destructor for ButtonBase objects
+	*/
+	virtual ~ButtonBase(void);
+
+
+protected:
+	/*************************************************************************
+		Overridden event handlers
+	*************************************************************************/
+	virtual void	onMouseMove(MouseEventArgs& e);
+	virtual void	onMouseButtonDown(MouseEventArgs& e);
+	virtual void	onMouseButtonUp(MouseEventArgs& e);
+	virtual void	onCaptureLost(WindowEventArgs& e);
+	virtual void	onMouseLeaves(MouseEventArgs& e);
+
+
+	/*************************************************************************
+		Implementation Functions
+	*************************************************************************/
+	/*!
+	\brief
+		Update the internal state of the widget with the mouse at the given position.
+
+	\param mouse_pos
+		Point object describing, in screen pixel co-ordinates, the location of the mouse cursor.
+
+	\return
+		Nothing
+	*/
+	void	updateInternalState(const Point& mouse_pos);
+
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"ButtonBase")	return true;
+		return Window::testClassName_impl(class_name);
+	}
+
+
+	/*************************************************************************
+		Implementation Rendering Functions
+	*************************************************************************/
+	/*!
+	\brief
+		Perform the rendering for this widget.
+
+	\param z
+		float value specifying the base Z co-ordinate that should be used when rendering
+
+	\return
+		Nothing
+	*/
+	virtual	void	drawSelf(float z);
+
+
+	/*!
+	\brief
+		Render the button-type widget in it's 'normal' state
+
+	\param z
+		float value specifying the base Z co-ordinate that should be used when rendering
+
+	\return
+		Nothing
+	*/
+	virtual void	drawNormal(float z)		= 0;
+
+
+	/*!
+	\brief
+		Render the button-type widget in it's 'hover' (highlighted) state
+
+	\param z
+		float value specifying the base Z co-ordinate that should be used when rendering
+
+	\return
+		Nothing
+	*/
+	virtual void	drawHover(float z)			{drawNormal(z);}
+
+
+	/*!
+	\brief
+		Render the button-type widget in it's 'pushed' state
+
+	\param z
+		float value specifying the base Z co-ordinate that should be used when rendering
+
+	\return
+		Nothing
+	*/
+	virtual void	drawPushed(float z)		{drawNormal(z);}
+
+
+	/*!
+	\brief
+		Render the button-type widget in it's 'disabled' state
+
+	\param z
+		float value specifying the base Z co-ordinate that should be used when rendering
+
+	\return
+		Nothing
+	*/
+	virtual void	drawDisabled(float z)		{drawNormal(z);}
+
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	bool	d_pushed;			//!< true when widget is pushed
+	bool	d_hovering;			//!< true when the button is in 'hover' state and requires the hover rendering.
+
+	// common rendering setting data
+	colour	d_normalColour;					//!< Colour used for label text when rendering in normal state
+	colour	d_hoverColour;					//!< Colour used for label text when rendering in highlighted state
+	colour	d_pushedColour;					//!< Colour used for label text when rendering in pushed state
+	colour	d_disabledColour;				//!< Colour used for label text when rendering in disabled state
+
+private:
+	/*************************************************************************
+		Static Properties for this class
+	*************************************************************************/
+	static ButtonBaseProperties::NormalTextColour	d_normalTextColourProperty;
+	static ButtonBaseProperties::HoverTextColour	d_hoverTextColourProperty;
+	static ButtonBaseProperties::PushedTextColour	d_pushedTextColourProperty;
+	static ButtonBaseProperties::DisabledTextColour	d_disabledTextColourProperty;
+
+	/*************************************************************************
+		Private methods
+	*************************************************************************/
+	void	addButtonBaseProperties(void);
+};
+
+} // End of  CEGUI namespace section
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIButtonBase_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUITabControl.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUITabControl.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUITabControl.h	(revision 1812)
@@ -0,0 +1,477 @@
+/************************************************************************
+	filename: 	CEGUITabControl.h
+	created:	08/08/2004
+	author:		Steve Streeting
+	
+	purpose:	Interface to base class for TabControl widget
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUITabControl_h_
+#define _CEGUITabControl_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIWindow.h"
+#include "elements/CEGUITabControlProperties.h"
+#include "elements/CEGUITabPane.h"
+#include <vector>
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+    // Forward declaration
+    class TabButton;
+
+/*!
+\brief
+	Base class for standard Tab Control widget.
+*/
+class CEGUIEXPORT TabControl : public Window
+{
+public:
+	static const String EventNamespace;				//!< Namespace for global events
+
+
+	/*************************************************************************
+		Constants
+	*************************************************************************/
+	// event names
+	static const String EventSelectionChanged;			//!< Event triggered when there is a change to the currently selected tab.
+
+
+	/*************************************************************************
+		Accessor Methods
+	*************************************************************************/
+	/*!
+	\brief
+		Return number of tabs 
+
+	\return
+		the number of tabs currently present.
+	*/
+	uint	getTabCount(void) const;
+
+
+    /*!
+    \brief
+        Set the selected tab by the name of the root window within it.
+    \exception	InvalidRequestException	thrown if \a index is out of range.
+    */
+    void    setSelectedTab(const String &name);
+
+    /*!
+    \brief
+        Set the selected tab by the ID of the root window within it.
+    \exception	InvalidRequestException	thrown if \a index is out of range.
+    */
+    void    setSelectedTab(uint ID);
+
+    /*!
+    \brief
+        Set the selected tab by the index position in the tab control.
+    \exception	InvalidRequestException	thrown if \a index is out of range.
+    */
+    void    setSelectedTabAtIndex(uint index);
+
+    /*!
+	\brief
+		Return the Window which is the first child of the tab at index position \a index.
+
+	\param index
+		Zero based index of the item to be returned.
+
+	\return
+		Pointer to the Window at index position \a index in the tab control.
+
+	\exception	InvalidRequestException	thrown if \a index is out of range.
+	*/
+    Window*	getTabContentsAtIndex(uint index) const;
+
+    /*!
+    \brief
+        Return the Window which is the tab content with the given name.
+
+    \param name
+        Name of the Window which was attached as a tab content.
+
+    \return
+        Pointer to the named Window in the tab control.
+
+    \exception	InvalidRequestException	thrown if content is not found.
+    */
+    Window*	getTabContents(const String& name) const;
+
+    /*!
+    \brief
+        Return the Window which is the tab content with the given ID.
+
+    \param ID
+        ID of the Window which was attached as a tab content.
+
+    \return
+        Pointer to the Window with the given ID in the tab control.
+
+    \exception	InvalidRequestException	thrown if content is not found.
+    */
+    Window*	getTabContents(uint ID) const;
+
+    /*!
+	\brief
+		Return whether the tab contents window is currently selected.
+
+    \param wnd
+        The tab contents window to query.
+
+	\return
+		true if the tab is currently selected, false otherwise.
+
+	\exception	InvalidRequestException	thrown if \a wnd is not a valid tab contents window.
+	*/
+    bool	isTabContentsSelected(Window* wnd) const;
+
+    /*!
+	\brief
+		Return the index of the currently selected tab.
+
+	\return
+		index of the currently selected tab.
+	*/
+    uint	getSelectedTabIndex() const;
+	
+    /*!
+    \brief
+        Return the relative height of the tabs
+    */
+    float getRelativeTabHeight(void) const { return d_rel_tabHeight; }
+    /*!
+    \brief
+        Return the absolute height of the tabs
+    */
+    float getAbsoluteTabHeight(void) const { return d_abs_tabHeight; }
+    /*!
+    \brief
+        Return the height of the tabs in the current metrics mode
+    */
+    float getTabHeight(void) const;
+    /*!
+    \brief
+        Return the amount of padding to add either side of the text in the tab,
+        according to the current metrics mode.
+    */
+    float getTabTextPadding(void) const;
+    /*!
+    \brief
+        Return the relative amount of padding to add either side of the text in the tab
+    */
+    float getRelativeTabTextPadding(void) const { return d_rel_tabPadding; }
+    /*!
+    \brief
+        Return the absolute amount of padding to add either side of the text in the tab
+    */
+    float getAbsoluteTabTextPadding(void) const { return d_abs_tabPadding; }
+
+
+    /*************************************************************************
+		Manipulator Methods
+	*************************************************************************/
+	/*!
+	\brief
+		Initialise the Window based object ready for use.
+
+	\note
+		This must be called for every window created.  Normally this is handled automatically by the WindowFactory for each Window type.
+
+	\return
+		Nothing
+	*/
+	virtual void	initialise(void);
+
+    /*!
+    \brief
+        Set the relative height of the tabs
+    */
+    void setRelativeTabHeight(float height);
+    /*!
+    \brief
+        Set the absolute height of the tabs
+    */
+    void setAbsoluteTabHeight(float height);
+    /*!
+    \brief
+        Set the height of the tabs in the current metrics mode
+    */
+    void setTabHeight(float height);
+
+    /*!
+    \brief
+        Set the amount of padding to add either side of the text in the tab,
+        according to the current metrics mode.
+    */
+    void setTabTextPadding(float);
+    /*!
+    \brief
+        Set the relative amount of padding to add either side of the text in the tab
+    */
+    void setRelativeTabTextPadding(float);
+    /*!
+    \brief
+        Set the absolute amount of padding to add either side of the text in the tab
+    */
+    void setAbsoluteTabTextPadding(float);
+    /*!
+    \brief 
+        Add a new tab to the tab control. 
+    \par 
+        The new tab will be added with the same text as the window passed in.
+    \param wnd
+        The Window which will be placed in the content area of this new tab.
+    */
+    void addTab(Window* wnd);
+    /*!
+    \brief 
+        Remove the named tab from the tab control. 
+    \par 
+        The tab content will be destroyed. 
+    */
+    void removeTab(const String& name);
+    /*!
+    \brief 
+    Remove the tab with the given ID from the tab control. 
+    \par 
+    The tab content will be destroyed. 
+    */
+    void removeTab(uint ID);
+
+
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for TabControl base class.
+	*/
+	TabControl(const String& type, const String& name);
+
+
+	/*!
+	\brief
+		Destructor for Listbox base class.
+	*/
+	virtual ~TabControl(void);
+
+
+protected:
+
+	/*************************************************************************
+		Implementation Functions
+	*************************************************************************/
+    /*!
+    \brief
+        Perform the actual rendering for this Window. 
+
+    \param z
+        float value specifying the base Z co-ordinate that should be used when rendering
+
+    \return
+        Nothing
+    */
+    virtual	void	drawSelf(float z) { /* do nothing; rendering handled by children */ }
+
+    /*!
+	\brief
+		Add tab control specific events
+	*/
+	void	addTabControlEvents(void);
+
+    /*!
+    \brief
+        Add a TabButton for the specified child Window.
+    */
+    virtual void addButtonForTabContent(Window* wnd);
+    /*!
+    \brief
+        Remove the TabButton for the specified child Window.
+    */
+    virtual void removeButtonForTabContent(Window* wnd);
+    /*!
+    \brief
+        Return the TabButton associated with this Window.
+    \exception	InvalidRequestException	thrown if content is not found.
+    */
+	TabButton* getButtonForTabContents(Window* wnd) const;
+    /*!
+    \brief
+        Construct a button name to handle a window.
+    */
+    String makeButtonName(Window* wnd);
+    
+    /*!
+    \brief
+        Internal implementation of select tab.
+    \param wnd
+        Pointer to a Window which is the root of the tab content to select
+    */
+    virtual void selectTab_impl(Window* wnd);
+
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"TabControl")	return true;
+		return Window::testClassName_impl(class_name);
+	}
+
+	void performChildWindowLayout();
+    int writeChildWindowsXML(OutStream& out_stream) const;
+
+	/*************************************************************************
+		New event handlers
+	*************************************************************************/
+
+	/*!
+	\brief
+		Handler called internally when the currently selected item or items changes.
+	*/
+	virtual	void	onSelectionChanged(WindowEventArgs& e);
+
+	/*!
+	\brief
+		Handler called when the window's font is changed.
+
+	\param e
+		WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event.  For this
+		event the trigger window is always 'this'.
+	*/
+	virtual void	onFontChanged(WindowEventArgs& e);
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+    Window*     d_tabButtonPane;    //!< The area containing the tab buttons
+    TabPane*    d_tabContentPane;   //!< The content area window
+    float       d_abs_tabHeight;    //!< The height of the tabs in pixels
+    float       d_rel_tabHeight;    //!< The height of the tabs relative to parent
+    float       d_abs_tabPadding;    //!< The padding of the tabs in pixels
+    float       d_rel_tabPadding;    //!< The padding of the tabs relative to parent
+    uint        d_nextTabIndex;     //!< The index to give the next tab 
+    typedef std::map<uint, TabButton*> TabButtonIndexMap; 
+    TabButtonIndexMap d_tabButtonIndexMap;  //!< Sorting for tabs
+    /*************************************************************************
+    Abstract Implementation Functions (must be provided by derived class)
+    *************************************************************************/
+    /*!
+    \brief
+    create and return a pointer to a TabPane widget for use as content area
+
+    \param name
+    String holding the name to be given to the new component.
+
+    \return
+    Pointer to a TabPane to be used for holding the main content.
+    */
+    virtual TabPane*	createTabContentPane(const String& name) const		= 0;
+
+    /*!
+    \brief
+        create and return a pointer to a widget for use as tab button area
+
+    \param name
+    String holding the name to be given to the new component.
+
+    \return
+        Pointer to a Static to be used for holding the tab buttons.
+    */
+    virtual Window*	createTabButtonPane(const String& name) const;
+
+    /*!
+    \brief
+        create and return a pointer to a TabButton widget for use as a clickable tab header
+    \param name
+        Button name
+    \return
+        Pointer to a TabButton to be used for changing tabs.
+    */
+    virtual TabButton*	createTabButton(const String& name) const		= 0;
+
+    /*!
+    \brief
+        Calculate the correct position and size of a tab button, based on the
+        index it is due to be placed at.
+    \param btn
+        Pointer to a button to calculate the size and position for. This button
+        will be updated in place with these metrics.
+    \param targetIndex
+        The index at which the tab is/will be placed. Tabs must exist for all the
+        indexes before this.
+    */
+    void calculateTabButtonSizePosition(TabButton* btn, uint targetIndex);
+
+protected:
+	/*************************************************************************
+		Static Properties for this class
+	*************************************************************************/
+	static TabControlProperties::TabHeight			d_tabHeightProperty;
+    static TabControlProperties::AbsoluteTabHeight	d_absoluteTabHeightProperty;
+    static TabControlProperties::RelativeTabHeight	d_relativeTabHeightProperty;
+
+    static TabControlProperties::TabTextPadding			d_tabTextPaddingProperty;
+    static TabControlProperties::AbsoluteTabTextPadding	d_absoluteTabTextPaddingProperty;
+    static TabControlProperties::RelativeTabTextPadding	d_relativeTabTextPaddingProperty;
+	/*************************************************************************
+		Private methods
+	*************************************************************************/
+	void	addTabControlProperties(void);
+
+    void    addChild_impl(Window* wnd);
+    void    removeChild_impl(Window* wnd);
+
+    /*************************************************************************
+    Event handlers
+    *************************************************************************/
+    bool handleContentWindowTextChanged(const EventArgs& args);
+    bool handleTabButtonClicked(const EventArgs& args);
+};
+
+
+
+} // End of  CEGUI namespace section
+
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUITabControl_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIRadioButtonProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIRadioButtonProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIRadioButtonProperties.h	(revision 1812)
@@ -0,0 +1,99 @@
+/************************************************************************
+	filename: 	CEGUIRadioButtonProperties.h
+	created:	10/7/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to properties for RadioButton class
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIRadioButtonProperties_h_
+#define _CEGUIRadioButtonProperties_h_
+
+#include "CEGUIProperty.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+// Start of RadioButtonProperties namespace section
+/*!
+\brief
+	Namespace containing all classes that make up the properties interface for the RadioButton class
+*/
+namespace RadioButtonProperties
+{
+/*!
+\brief
+	Property to access the selected state of the RadioButton.
+
+	\par Usage:
+		- Name: Selected
+		- Format: "[text]".
+
+	\par Where [Text] is:
+		- "True" to indicate the radio button is selected.
+		- "False" to indicate the radio button is not selected.
+*/
+class Selected : public Property
+{
+public:
+	Selected() : Property(
+		"Selected",
+		"Property to get/set the selected state of the RadioButton.  Value is either \"True\" or \"False\".",
+		"False")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the radio button group ID.
+
+	\par Usage:
+		- Name: GroupID
+		- Format: "[uint]".
+
+	\par Where:
+		- [uint] is any unsigned integer value.
+*/
+class GroupID : public Property
+{
+public:
+	GroupID() : Property(
+		"GroupID",
+		"Property to get/set the radio button group ID.  Value is an unsigned integer number.",
+		"0")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+} // End of  RadioButtonProperties namespace section
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIRadioButtonProperties_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIListboxTextItem.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIListboxTextItem.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIListboxTextItem.h	(revision 1812)
@@ -0,0 +1,185 @@
+/************************************************************************
+	filename: 	CEGUIListboxTextItem.h
+	created:	12/6/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface for list box text items
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIListboxTextItem_h_
+#define _CEGUIListboxTextItem_h_
+#include "elements/CEGUIListboxItem.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Class used for textual items in a list box.
+*/
+class CEGUIEXPORT ListboxTextItem : public ListboxItem
+{
+public:
+	/*************************************************************************
+		Constants
+	*************************************************************************/
+	static const colour	DefaultTextColour;			//!< Default text colour.
+
+
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		base class constructor
+	*/
+	ListboxTextItem(const String& text, uint item_id = 0, void* item_data = NULL, bool disabled = false, bool auto_delete = true);
+
+
+	/*!
+	\brief
+		base class destructor
+	*/
+	virtual ~ListboxTextItem(void) {}
+
+
+	/*************************************************************************
+		Accessor methods
+	*************************************************************************/
+	/*!
+	\brief
+		Return a pointer to the font being used by this ListboxTextItem
+
+		This method will try a number of places to find a font to be used.  If no font can be
+		found, NULL is returned.
+
+	\return
+		Font to be used for rendering this item
+	*/
+	const Font*	getFont(void) const;
+
+
+	/*!
+	\brief
+		Return the current colours used for text rendering.
+
+	\return
+		ColourRect object describing the currently set colours
+	*/
+	ColourRect	getTextColours(void) const		{return d_textCols;}
+
+
+	/*************************************************************************
+		Manipulator methods
+	*************************************************************************/
+	/*!
+	\brief
+		Set the font to be used by this ListboxTextItem
+
+	\param font
+		Font to be used for rendering this item
+
+	\return
+		Nothing
+	*/
+	void	setFont(const Font* font)		{d_font = font;}
+
+
+	/*!
+	\brief
+		Set the font to be used by this ListboxTextItem
+
+	\param font_name
+		String object containing the name of the Font to be used for rendering this item
+
+	\return
+		Nothing
+	*/
+	void	setFont(const String& font_name);
+
+
+	/*!
+	\brief
+		Set the colours used for text rendering.
+
+	\param cols
+		ColourRect object describing the colours to be used.
+
+	\return
+		Nothing.
+	*/
+	void	setTextColours(const ColourRect& cols)			{d_textCols = cols;}
+
+
+	/*!
+	\brief
+		Set the colours used for text rendering.
+
+	\param top_left_colour
+		Colour (as ARGB value) to be applied to the top-left corner of each text glyph rendered.
+
+	\param top_right_colour
+		Colour (as ARGB value) to be applied to the top-right corner of each text glyph rendered.
+
+	\param bottom_left_colour
+		Colour (as ARGB value) to be applied to the bottom-left corner of each text glyph rendered.
+
+	\param bottom_right_colour
+		Colour (as ARGB value) to be applied to the bottom-right corner of each text glyph rendered.
+
+	\return 
+		Nothing.
+	*/
+	void	setTextColours(colour top_left_colour, colour top_right_colour, colour bottom_left_colour, colour bottom_right_colour);
+
+
+	/*!
+	\brief
+		Set the colours used for text rendering.
+
+	\param col
+		colour value to be used when rendering.
+
+	\return
+		Nothing.
+	*/
+	void	setTextColours(colour col)		{setTextColours(col, col, col, col);}
+
+
+	/*************************************************************************
+		Required implementations of pure virtuals from the base class.
+	*************************************************************************/
+    Size getPixelSize(void) const;
+    void draw(const Vector3& position, float alpha, const Rect& clipper) const;
+    void draw(RenderCache& cache,const Rect& targetRect, float zBase,  float alpha, const Rect* clipper) const;
+
+protected:
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	ColourRect		d_textCols;			//!< Colours used for rendering the text.
+	const Font*		d_font;				//!< Font used for rendering text.
+};
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIListboxTextItem_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUICombobox.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUICombobox.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUICombobox.h	(revision 1812)
@@ -0,0 +1,1066 @@
+/************************************************************************
+	filename: 	CEGUICombobox.h
+	created:	13/4/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to base class for Combobox widget
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUICombobox_h_
+#define _CEGUICombobox_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIWindow.h"
+#include "elements/CEGUIComboboxProperties.h"
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+	Base class for the Combobox widget
+*/
+class CEGUIEXPORT Combobox : public Window
+{
+public:
+	static const String EventNamespace;				//!< Namespace for global events
+
+	/*************************************************************************
+		Constants
+	*************************************************************************/
+	// event names from edit box
+	static const String EventReadOnlyModeChanged;			//!< The read-only mode for the edit box has been changed.
+	static const String EventValidationStringChanged;		//!< The validation string has been changed.
+	static const String EventMaximumTextLengthChanged;	//!< The maximum allowable string length has been changed.
+	static const String EventTextInvalidated;				//!< Some operation has made the current text invalid with regards to the validation string.
+	static const String EventInvalidEntryAttempted;		//!< The user attempted to modify the text in a way that would have made it invalid.
+	static const String EventCaratMoved;					//!< The text carat (insert point) has changed.
+	static const String EventTextSelectionChanged;		//!< The current text selection has changed.
+	static const String EventEditboxFull;					//!< The number of characters in the edit box has reached the current maximum.
+	static const String EventTextAccepted;				//!< The user has accepted the current text by pressing Return, Enter, or Tab.
+
+	// event names from list box
+	static const String EventListContentsChanged;			//!< Event triggered when the contents of the list is changed.
+	static const String EventListSelectionChanged;		//!< Event triggered when there is a change to the currently selected item(s).
+	static const String EventSortModeChanged;				//!< Event triggered when the sort mode setting changes.
+	static const String EventVertScrollbarModeChanged;	//!< Event triggered when the vertical scroll bar 'force' setting changes.
+	static const String EventHorzScrollbarModeChanged;	//!< Event triggered when the horizontal scroll bar 'force' setting changes.
+
+	// events we produce / generate ourselves
+	static const String EventDropListDisplayed;			//!< Event triggered when the drop-down list is displayed
+	static const String EventDropListRemoved;				//!< Event triggered when the drop-down list is removed / hidden.
+	static const String EventListSelectionAccepted;		//!< Event triggered when the user accepts a selection from the drop-down list
+
+
+	/*!
+	\brief
+		check if the given position would hit this window.
+
+	\param position
+		Point object describing the position to check in screen pixels
+
+	\return
+		true if \a position 'hits' this Window, else false.
+	*/
+	virtual bool	isHit(const Point& position) const		{return false;}
+
+
+	/*!
+	\brief
+		returns the mode of operation for the combo box.
+
+	\return
+		- true if the user can show the list and select an item with a single mouse click.
+		- false if the user must click to show the list and then click again to select an item.
+	*/
+	bool	getSingleClickEnabled(void) const;
+
+
+	/*!
+	\brief
+		returns true if the drop down list is visible.
+
+	\return
+		true if the drop down list is visible, false otherwise.
+	*/
+	bool	isDropDownListVisible(void) const;
+
+
+	/*************************************************************************
+		Editbox Accessors
+	*************************************************************************/
+	/*!
+	\brief
+		return true if the Editbox has input focus.
+
+	\return
+		true if the Editbox has keyboard input focus, false if the Editbox does not have keyboard input focus.
+	*/
+	bool	hasInputFocus(void) const;
+
+
+	/*!
+	\brief
+		return true if the Editbox is read-only.
+
+	\return
+		true if the Editbox is read only and can't be edited by the user, false if the Editbox is not
+		read only and may be edited by the user.
+	*/
+	bool	isReadOnly(void) const;
+
+
+	/*!
+	\brief
+		return true if the Editbox text is valid given the currently set validation string.
+
+	\note
+		It is possible to programmatically set 'invalid' text for the Editbox by calling setText.  This has certain
+		implications since if invalid text is set, whatever the user types into the box will be rejected when the input
+		is validated.
+
+	\note
+		Validation is performed by means of a regular expression.  If the text matches the regex, the text is said to have passed
+		validation.  If the text does not match with the regex then the text fails validation.
+
+	\return
+		true if the current Editbox text passes validation, false if the text does not pass validation.
+	*/
+	bool	isTextValid(void) const;
+
+
+	/*!
+	\brief
+		return the currently set validation string
+
+	\note
+		Validation is performed by means of a regular expression.  If the text matches the regex, the text is said to have passed
+		validation.  If the text does not match with the regex then the text fails validation.
+
+	\return
+		String object containing the current validation regex data
+	*/
+	const String&	getValidationString(void) const;
+
+
+	/*!
+	\brief
+		return the current position of the carat.
+
+	\return
+		Index of the insert carat relative to the start of the text.
+	*/
+	size_t	getCaratIndex(void) const;
+
+
+	/*!
+	\brief
+		return the current selection start point.
+
+	\return
+		Index of the selection start point relative to the start of the text.  If no selection is defined this function returns
+		the position of the carat.
+	*/
+	size_t	getSelectionStartIndex(void) const;
+
+
+	/*!
+	\brief
+		return the current selection end point.
+
+	\return
+		Index of the selection end point relative to the start of the text.  If no selection is defined this function returns
+		the position of the carat.
+	*/
+	size_t	getSelectionEndIndex(void) const;
+
+	
+	/*!
+	\brief
+		return the length of the current selection (in code points / characters).
+
+	\return
+		Number of code points (or characters) contained within the currently defined selection.
+	*/
+	size_t	getSelectionLength(void) const;
+
+
+	/*!
+	\brief
+		return the maximum text length set for this Editbox.
+
+	\return
+		The maximum number of code points (characters) that can be entered into this Editbox.
+
+	\note
+		Depending on the validation string set, the actual length of text that can be entered may be less than the value
+		returned here (it will never be more).
+	*/
+	size_t	getMaxTextLength(void) const;
+
+
+	/*!
+	\brief
+		return the currently set colour to be used for rendering Editbox text in the
+		normal, unselected state.
+
+	\return
+		colour value describing the ARGB colour that is currently set.
+	*/
+	colour	getNormalTextColour(void) const;
+
+
+	/*!
+	\brief
+		return the currently set colour to be used for rendering the Editbox text when within the
+		selected region.
+
+	\return
+		colour value describing the ARGB colour that is currently set.
+	*/
+	colour	getSelectedTextColour(void) const;
+
+
+	/*!
+	\brief
+		return the currently set colour to be used for rendering the Editbox selection highlight
+		when the Editbox is active.
+
+	\return
+		colour value describing the ARGB colour that is currently set.
+	*/
+	colour	getNormalSelectBrushColour(void) const;
+
+
+	/*!
+	\brief
+		return the currently set colour to be used for rendering the Editbox selection highlight
+		when the Editbox is inactive.
+
+	\return
+		colour value describing the ARGB colour that is currently set.
+	*/
+	colour	getInactiveSelectBrushColour(void) const;
+
+
+	/*************************************************************************
+		List Accessors
+	*************************************************************************/
+	/*!
+	\brief
+		Return number of items attached to the list box
+
+	\return
+		the number of items currently attached to this list box.
+	*/
+	size_t	getItemCount(void) const;
+
+	
+	/*!
+	\brief
+		Return a pointer to the currently selected item.
+
+	\return
+		Pointer to a ListboxItem based object that is the selected item in the list.  will return NULL if
+		no item is selected.
+	*/
+	ListboxItem*	getSelectedItem(void) const;
+
+
+	/*!
+	\brief
+		Return the item at index position \a index.
+
+	\param index
+		Zero based index of the item to be returned.
+
+	\return
+		Pointer to the ListboxItem at index position \a index in the list box.
+
+	\exception	InvalidRequestException	thrown if \a index is out of range.
+	*/
+	ListboxItem*	getListboxItemFromIndex(size_t index) const;
+
+
+	/*!
+	\brief
+		Return the index of ListboxItem \a item
+
+	\param item
+		Pointer to a ListboxItem whos zero based index is to be returned.
+
+	\return
+		Zero based index indicating the position of ListboxItem \a item in the list box.
+
+	\exception	InvalidRequestException	thrown if \a item is not attached to this list box.
+	*/
+	size_t	getItemIndex(const ListboxItem* item) const;
+
+
+	/*!
+	\brief
+		return whether list sorting is enabled
+
+	\return
+		true if the list is sorted, false if the list is not sorted
+	*/
+	bool	isSortEnabled(void) const;
+
+
+	/*!
+	\brief
+		return whether the string at index position \a index is selected
+
+	\param index
+		Zero based index of the item to be examined.
+
+	\return
+		true if the item at \a index is selected, false if the item at \a index is not selected.
+
+	\exception	InvalidRequestException	thrown if \a index is out of range.
+	*/
+	bool	isItemSelected(size_t index) const;
+
+
+	/*!
+	\brief
+		Search the list for an item with the specified text
+
+	\param text
+		String object containing the text to be searched for.
+
+	\param start_item
+		ListboxItem where the search is to begin, the search will not include \a item.  If \a item is
+		NULL, the search will begin from the first item in the list.
+
+	\return
+		Pointer to the first ListboxItem in the list after \a item that has text matching \a text.  If
+		no item matches the criteria NULL is returned.
+
+	\exception	InvalidRequestException	thrown if \a item is not attached to this list box.
+	*/
+	ListboxItem*	findItemWithText(const String& text, const ListboxItem* start_item);
+
+
+	/*!
+	\brief
+		Return whether the specified ListboxItem is in the List
+
+	\return
+		true if ListboxItem \a item is in the list, false if ListboxItem \a item is not in the list.
+	*/
+	bool	isListboxItemInList(const ListboxItem* item) const;
+
+
+	/*!
+	\brief
+		Return whether the vertical scroll bar is always shown.
+
+	\return
+		- true if the scroll bar will always be shown even if it is not required.
+		- false if the scroll bar will only be shown when it is required.
+	*/
+	bool	isVertScrollbarAlwaysShown(void) const;
+
+
+	/*!
+	\brief
+		Return whether the horizontal scroll bar is always shown.
+
+	\return
+		- true if the scroll bar will always be shown even if it is not required.
+		- false if the scroll bar will only be shown when it is required.
+	*/
+	bool	isHorzScrollbarAlwaysShown(void) const;
+
+
+	/*************************************************************************
+		Combobox Manipulators
+	*************************************************************************/
+	/*!
+	\brief
+		Initialise the Window based object ready for use.
+
+	\note
+		This must be called for every window created.  Normally this is handled automatically by the WindowFactory for each Window type.
+
+	\return
+		Nothing
+	*/
+	virtual void	initialise(void);
+
+
+	/*!
+	\brief
+		Show the drop-down list
+
+	\return
+		Nothing
+	*/
+	void	showDropList(void);
+
+
+	/*!
+	\brief
+		Hide the drop-down list
+
+	\return
+		Nothing.
+	*/
+	void	hideDropList(void);
+
+
+	/*!
+	\brief
+		Set the mode of operation for the combo box.
+
+	\param setting
+		- true if the user should be able to show the list and select an item with a single mouse click.
+		- false if the user must click to show the list and then click again to select an item.
+
+	\return
+		Nothing.
+	*/
+	void	setSingleClickEnabled(bool setting);
+
+
+	/*************************************************************************
+		Editbox Manipulators
+	*************************************************************************/
+	/*!
+	\brief
+		Specify whether the Editbox is read-only.
+
+	\param setting
+		true if the Editbox is read only and can't be edited by the user, false if the Editbox is not
+		read only and may be edited by the user.
+
+	\return
+		Nothing.
+	*/
+	void	setReadOnly(bool setting);
+
+
+	/*!
+	\brief
+		Set the text validation string.
+
+	\note
+		Validation is performed by means of a regular expression.  If the text matches the regex, the text is said to have passed
+		validation.  If the text does not match with the regex then the text fails validation.
+
+	\param validation_string
+		String object containing the validation regex data to be used.
+
+	\return
+		Nothing.
+	*/
+	void	setValidationString(const String& validation_string);
+
+
+	/*!
+	\brief
+		Set the current position of the carat.
+
+	\param carat_pos
+		New index for the insert carat relative to the start of the text.  If the value specified is greater than the
+		number of characters in the Editbox, the carat is positioned at the end of the text.
+
+	\return
+		Nothing.
+	*/
+	void	setCaratIndex(size_t carat_pos);
+
+
+	/*!
+	\brief
+		Define the current selection for the Editbox
+
+	\param start_pos
+		Index of the starting point for the selection.  If this value is greater than the number of characters in the Editbox, the
+		selection start will be set to the end of the text.
+
+	\param end_pos
+		Index of the ending point for the selection.  If this value is greater than the number of characters in the Editbox, the
+		selection start will be set to the end of the text.
+
+	\return
+		Nothing.
+	*/
+	void	setSelection(size_t start_pos, size_t end_pos);
+	
+
+	/*!
+	\brief
+		set the maximum text length for this Editbox.
+
+	\param max_len
+		The maximum number of code points (characters) that can be entered into this Editbox.
+
+	\note
+		Depending on the validation string set, the actual length of text that can be entered may be less than the value
+		set here (it will never be more).
+
+	\return
+		Nothing.
+	*/
+	void	setMaxTextLength(size_t max_len);
+
+
+	/*!
+	\brief
+		Set the colour to be used for rendering Editbox text in the normal, unselected state.
+
+	\param col
+		colour value describing the ARGB colour that is to be used.
+
+	\return
+		Nothing.
+	*/
+	void	setNormalTextColour(colour col);
+
+
+	/*!
+	\brief
+		Set the colour to be used for rendering the Editbox text when within the
+		selected region.
+
+	\return
+		colour value describing the ARGB colour that is currently set.
+	*/
+	void	setSelectedTextColour(colour col);
+
+
+	/*!
+	\brief
+		Set the colour to be used for rendering the Editbox selection highlight
+		when the Editbox is active.
+
+	\param col
+		colour value describing the ARGB colour that is to be used.
+
+	\return
+		Nothing.
+	*/
+	void	setNormalSelectBrushColour(colour col);
+
+
+	/*!
+	\brief
+		Set the colour to be used for rendering the Editbox selection highlight
+		when the Editbox is inactive.
+
+	\param col
+		colour value describing the ARGB colour that is to be used.
+
+	\return
+		Nothing.
+	*/
+	void	setInactiveSelectBrushColour(colour col);
+
+
+	/*!
+	\brief
+		Activate the edit box component of the Combobox.
+
+	\return
+		Nothing.
+	*/
+	void	activateEditbox(void);
+
+
+	/*************************************************************************
+		List Manipulators
+	*************************************************************************/
+	/*!
+	\brief
+		Remove all items from the list.
+
+		Note that this will cause 'AutoDelete' items to be deleted.
+	*/
+	void	resetList(void);
+
+
+	/*!
+	\brief
+		Add the given ListboxItem to the list.
+
+	\param item
+		Pointer to the ListboxItem to be added to the list.  Note that it is the passed object that is added to the
+		list, a copy is not made.  If this parameter is NULL, nothing happens.
+
+	\return
+		Nothing.
+	*/
+	void	addItem(ListboxItem* item);
+
+
+	/*!
+	\brief
+		Insert an item into the list box after a specified item already in the list.
+
+		Note that if the list is sorted, the item may not end up in the requested position.
+
+	\param item
+		Pointer to the ListboxItem to be inserted.  Note that it is the passed object that is added to the
+		list, a copy is not made.  If this parameter is NULL, nothing happens.
+
+	\param position
+		Pointer to a ListboxItem that \a item is to be inserted after.  If this parameter is NULL, the item is
+		inserted at the start of the list.
+
+	\return
+		Nothing.
+	*/
+	void	insertItem(ListboxItem* item, const ListboxItem* position);
+
+
+	/*!
+	\brief
+		Removes the given item from the list box.
+
+	\param item
+		Pointer to the ListboxItem that is to be removed.  If \a item is not attached to this list box then nothing
+		will happen.
+
+	\return
+		Nothing.
+	*/
+	void	removeItem(const ListboxItem* item);
+
+
+	/*!
+	\brief
+		Clear the selected state for all items.
+
+	\return
+		Nothing.
+	*/
+	void	clearAllSelections(void);
+
+
+	/*!
+	\brief
+		Set whether the list should be sorted.
+
+	\param setting
+		true if the list should be sorted, false if the list should not be sorted.
+
+	\return
+		Nothing.
+	*/
+	void	setSortingEnabled(bool setting);
+
+	
+	/*!
+	\brief
+		Set whether the vertical scroll bar should always be shown.
+
+	\param setting
+		true if the vertical scroll bar should be shown even when it is not required.  false if the vertical
+		scroll bar should only be shown when it is required.
+
+	\return
+		Nothing.
+	*/
+	void	setShowVertScrollbar(bool setting);
+
+
+	/*!
+	\brief
+		Set whether the horizontal scroll bar should always be shown.
+
+	\param setting
+		true if the horizontal scroll bar should be shown even when it is not required.  false if the horizontal
+		scroll bar should only be shown when it is required.
+
+	\return
+		Nothing.
+	*/
+	void	setShowHorzScrollbar(bool setting);
+
+
+	/*!
+	\brief
+		Set the select state of an attached ListboxItem.
+
+		This is the recommended way of selecting and deselecting items attached to a list box as it respects the
+		multi-select mode setting.  It is possible to modify the setting on ListboxItems directly, but that approach
+		does not respect the settings of the list box.
+
+	\param item
+		The ListboxItem to be affected.  This item must be attached to the list box.
+
+	\param state
+		true to select the item, false to de-select the item.
+
+	\return
+		Nothing.
+	
+	\exception	InvalidRequestException	thrown if \a item is not attached to this list box.
+	*/
+	void	setItemSelectState(ListboxItem* item, bool state);
+
+
+	/*!
+	\brief
+		Set the select state of an attached ListboxItem.
+
+		This is the recommended way of selecting and deselecting items attached to a list box as it respects the
+		multi-select mode setting.  It is possible to modify the setting on ListboxItems directly, but that approach
+		does not respect the settings of the list box.
+
+	\param item_index
+		The zero based index of the ListboxItem to be affected.  This must be a valid index (0 <= index < getItemCount())
+
+	\param state
+		true to select the item, false to de-select the item.
+
+	\return
+		Nothing.
+	
+	\exception	InvalidRequestException	thrown if \a item_index is out of range for the list box
+	*/
+	void	setItemSelectState(size_t item_index, bool state);
+
+
+	/*!
+	\brief
+		Causes the list box to update it's internal state after changes have been made to one or more
+		attached ListboxItem objects.
+
+		Client code must call this whenever it has made any changes to ListboxItem objects already attached to the
+		list box.  If you are just adding items, or removed items to update them prior to re-adding them, there is
+		no need to call this method.
+
+	\return
+		Nothing.
+	*/
+	void	handleUpdatedListItemData(void);
+
+
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for Combobox base class
+	*/
+	Combobox(const String& type, const String& name);
+
+
+	/*!
+	\brief
+		Destructor for Combobox base class
+	*/
+	virtual ~Combobox(void);
+
+
+protected:
+	/*************************************************************************
+		Implementation Methods
+	*************************************************************************/
+	/*!
+	\brief
+		Add combo box specific events
+	*/
+	void	addComboboxEvents(void);
+
+
+	/*!
+	\brief
+		Create, initialise, and return a pointer to an Editbox widget to be used as part
+		of this Combobox.
+
+	\return
+		Pointer to an Editbox derived class.
+	*/
+	virtual	Editbox*	createEditbox(const String& name) const		= 0;
+
+
+	/*!
+	\brief
+		Create, initialise, and return a pointer to a PushButton widget to be used as part
+		of this Combobox.
+
+	\return
+		Pointer to a PushButton derived class.
+	*/
+	virtual	PushButton*	createPushButton(const String& name) const	= 0;
+
+
+	/*!
+	\brief
+		Create, initialise, and return a pointer to a ComboDropList widget to be used as part
+		of this Combobox.
+
+	\return
+		Pointer to a ComboDropList derived class.
+	*/
+	virtual	ComboDropList*	createDropList(const String& name) const	= 0;
+
+
+	/*!
+	\brief
+		Handler function for button clicks.
+	*/
+	bool	button_PressHandler(const EventArgs& e);
+
+
+	/*!
+	\brief
+		Handler for selections made in the drop-list
+	*/
+	bool	droplist_SelectionAcceptedHandler(const EventArgs& e);
+
+
+	/*!
+	\brief
+		Handler for when drop-list hides itself
+	*/
+	bool	droplist_HiddenHandler(const EventArgs& e);
+
+
+	/*!
+	\brief
+		Mouse button down handler attached to edit box
+	*/
+	bool	editbox_MouseDownHandler(const EventArgs& e);
+
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"Combobox")	return true;
+		return Window::testClassName_impl(class_name);
+	}
+
+
+	/*************************************************************************
+		Handlers to relay child widget events so they appear to come from us
+	*************************************************************************/
+	bool editbox_ReadOnlyChangedHandler(const EventArgs& e);
+	bool editbox_ValidationStringChangedHandler(const EventArgs& e);
+	bool editbox_MaximumTextLengthChangedHandler(const EventArgs& e);
+	bool editbox_TextInvalidatedEventHandler(const EventArgs& e);
+	bool editbox_InvalidEntryAttemptedHandler(const EventArgs& e);
+	bool editbox_CaratMovedHandler(const EventArgs& e);
+	bool editbox_TextSelectionChangedHandler(const EventArgs& e);
+	bool editbox_EditboxFullEventHandler(const EventArgs& e);
+	bool editbox_TextAcceptedEventHandler(const EventArgs& e);
+	bool editbox_TextChangedEventHandler(const EventArgs& e);
+	bool listbox_ListContentsChangedHandler(const EventArgs& e);
+	bool listbox_ListSelectionChangedHandler(const EventArgs& e);
+	bool listbox_SortModeChangedHandler(const EventArgs& e);
+	bool listbox_VertScrollModeChangedHandler(const EventArgs& e);
+	bool listbox_HorzScrollModeChangedHandler(const EventArgs& e);
+
+	
+	/*************************************************************************
+		New Events for Combobox
+	*************************************************************************/
+	/*!
+	\brief
+		Handler called internally when the read only state of the Combobox's Editbox has been changed.
+	*/
+	virtual	void	onReadOnlyChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called internally when the Combobox's Editbox validation string has been changed.
+	*/
+	virtual	void	onValidationStringChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called internally when the Combobox's Editbox maximum text length is changed.
+	*/
+	virtual	void	onMaximumTextLengthChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called internally when the Combobox's Editbox text has been invalidated.
+	*/
+	virtual	void	onTextInvalidatedEvent(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called internally when an invalid entry was attempted in the Combobox's Editbox.
+	*/
+	virtual	void	onInvalidEntryAttempted(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called internally when the carat in the Comboxbox's Editbox moves.
+	*/
+	virtual	void	onCaratMoved(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called internally when the selection within the Combobox's Editbox changes.
+	*/
+	virtual	void	onTextSelectionChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called internally when the maximum length is reached for text in the Combobox's Editbox.
+	*/
+	virtual	void	onEditboxFullEvent(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called internally when the text in the Combobox's Editbox is accepted (by various means).
+	*/
+	virtual	void	onTextAcceptedEvent(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called internally when the Combobox's Drop-down list contents are changed.
+	*/
+	virtual	void	onListContentsChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called internally when the selection within the Combobox's drop-down list changes
+		(this is not the 'final' accepted selection, just the currently highlighted item).
+	*/
+	virtual	void	onListSelectionChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called  fired internally when the sort mode for the Combobox's drop-down list is changed.
+	*/
+	virtual	void	onSortModeChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called internally when the 'force' setting for the vertical scrollbar within the Combobox's
+		drop-down list is changed.
+	*/
+	virtual	void	onVertScrollbarModeChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called internally when the 'force' setting for the horizontal scrollbar within the Combobox's
+		drop-down list is changed.
+	*/
+	virtual	void	onHorzScrollbarModeChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called internally when the Combobox's drop-down list has been displayed.
+	*/
+	virtual	void	onDropListDisplayed(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called internally when the Combobox's drop-down list has been hidden.
+	*/
+	virtual	void	onDroplistRemoved(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called internally when the user has confirmed a selection within the Combobox's drop-down list.
+	*/
+	virtual	void	onListSelectionAccepted(WindowEventArgs& e);
+
+
+	/*************************************************************************
+		Overridden Event handlers
+	*************************************************************************/
+	virtual	void	onFontChanged(WindowEventArgs& e);
+	virtual void	onTextChanged(WindowEventArgs& e);
+	virtual void	onActivated(ActivationEventArgs& e);
+
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	Editbox*		d_editbox;		//!< Editbox widget sub-component.
+	ComboDropList*	d_droplist;		//!< ComboDropList widget sub-component.	
+	PushButton*		d_button;		//!< PushButton widget sub-component.
+	bool			d_singleClickOperation;		//!< true if user can show and select from list in a single click.
+
+
+private:
+	/*************************************************************************
+		Static Properties for this class
+	*************************************************************************/
+	static ComboboxProperties::ReadOnly						d_readOnlyProperty;
+	static ComboboxProperties::ValidationString				d_validationStringProperty;
+	static ComboboxProperties::CaratIndex					d_caratIndexProperty;
+	static ComboboxProperties::EditSelectionStart			d_selStartProperty;
+	static ComboboxProperties::EditSelectionLength			d_selLengthProperty;
+	static ComboboxProperties::MaxEditTextLength			d_maxTextLengthProperty;
+	static ComboboxProperties::NormalEditTextColour			d_normalTextColourProperty;
+	static ComboboxProperties::SelectedEditTextColour		d_selectedTextColourProperty;
+	static ComboboxProperties::ActiveEditSelectionColour	d_activeSelectionColourProperty;
+	static ComboboxProperties::InactiveEditSelectionColour	d_inactiveSelectionColourProperty;
+	static ComboboxProperties::SortList						d_sortProperty;
+	static ComboboxProperties::ForceVertScrollbar			d_forceVertProperty;
+	static ComboboxProperties::ForceHorzScrollbar			d_forceHorzProperty;
+	static ComboboxProperties::SingleClickMode				d_singleClickOperationProperty;
+
+	/*************************************************************************
+		Private methods
+	*************************************************************************/
+	void	addComboboxProperties(void);
+};
+
+} // End of  CEGUI namespace section
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUICombobox_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIThumb.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIThumb.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIThumb.h	(revision 1812)
@@ -0,0 +1,320 @@
+/************************************************************************
+	filename: 	CEGUIThumb.h
+	created:	25/4/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface for a 'Thumb' widget.  Intended to be used as
+				part of other widgets such as scrollers and sliders.
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIThumb_h_
+#define _CEGUIThumb_h_
+
+#include "CEGUIPushButton.h"
+#include "elements/CEGUIThumbProperties.h"
+#include <utility>
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+	Base class for Thumb widget.
+	
+	The thumb widget is used to compose other widgets (like sliders and scroll bars).  You would
+	not normally need to use this widget directly unless you are making a new widget of some type.
+*/
+class CEGUIEXPORT Thumb : public PushButton
+{
+public:
+	static const String EventNamespace;				//!< Namespace for global events
+
+
+	/*************************************************************************
+		Event name constants
+	*************************************************************************/
+	// generated internally by Window
+	static const String EventThumbPositionChanged;		//!< The position of the thumb widget has changed.
+	static const String EventThumbTrackStarted;			//!< Name of the event fired when the user begins dragging the thumb.
+	static const String EventThumbTrackEnded;				//!< Name of the event fired when the user releases the thumb.
+
+
+	/*************************************************************************
+		Accessor Functions
+	*************************************************************************/ 
+	/*!
+	\brief
+		return whether hot-tracking is enabled or not.
+
+	\return
+		true if hot-tracking is enabled.  false if hot-tracking is disabled.
+	*/
+	bool	isHotTracked(void) const			{return d_hotTrack;}
+
+	/*!
+	\brief
+		return whether the thumb is movable on the vertical axis.
+
+	\return
+		true if the thumb is movable along the vertical axis.
+		false if the thumb is fixed on the vertical axis.
+	*/
+	bool	isVertFree(void) const				{return d_vertFree;}
+
+	/*!
+	\brief
+		return whether the thumb is movable on the horizontal axis.
+
+	\return
+		true if the thumb is movable along the horizontal axis.
+		false if the thumb is fixed on the horizontal axis.
+	*/
+	bool	isHorzFree(void) const				{return d_horzFree;}
+
+
+	/*!
+	\brief
+		Return a std::pair that describes the current range set for the vertical movement.
+
+	\return
+		a std::pair describing the current vertical range.  The first element is the minimum value,
+		the second element is the maximum value.
+	*/
+	std::pair<float, float>	getVertRange(void) const;
+
+
+	/*!
+	\brief
+		Return a std::pair that describes the current range set for the horizontal movement.
+
+	\return
+		a std::pair describing the current horizontal range.  The first element is the minimum value,
+		the second element is the maximum value.
+	*/
+	std::pair<float, float>	getHorzRange(void) const;
+
+
+	/*************************************************************************
+		Manipulator Functions
+	*************************************************************************/
+	/*!
+	\brief
+		set whether the thumb uses hot-tracking.
+
+	\param setting
+		true to enable hot-tracking.  false to disable hot-tracking.
+
+	\return
+		Nothing.
+	*/
+	void	setHotTracked(bool setting)				{d_hotTrack = setting;}
+
+
+	/*!
+	\brief
+		set whether thumb is movable on the vertical axis.
+
+	\param setting
+		true to allow movement of thumb along the vertical axis.  false to fix thumb on the vertical axis.
+
+	\return
+		nothing.
+	*/
+	void	setVertFree(bool setting)						{d_vertFree = setting;}
+
+
+	/*!
+	\brief
+		set whether thumb is movable on the horizontal axis.
+
+	\param setting
+		true to allow movement of thumb along the horizontal axis.  false to fix thumb on the horizontal axis.
+
+	\return
+		nothing.
+	*/
+	void	setHorzFree(bool setting)						{d_horzFree = setting;}
+	
+
+	/*!
+	\brief
+		set the movement range of the thumb for the vertical axis.
+
+		The values specified here are relative to the parent window for the thumb, and are specified in whichever
+		metrics mode is active for the widget.
+
+	\param min
+		the minimum setting for the thumb on the vertical axis.
+
+	\param max
+		the maximum setting for the thumb on the vertical axis.
+
+	\return
+		Nothing.
+	*/
+	void	setVertRange(float min, float max);
+
+
+	/*!
+	\brief
+		set the movement range of the thumb for the horizontal axis.
+
+		The values specified here are relative to the parent window for the thumb, and are specified in whichever
+		metrics mode is active for the widget.
+
+	\param min
+		the minimum setting for the thumb on the horizontal axis.
+
+	\param max
+		the maximum setting for the thumb on the horizontal axis.
+
+	\return
+		Nothing.
+	*/
+	void	setHorzRange(float min, float max);
+
+
+	/*************************************************************************
+		Construction / Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for Thumb objects
+	*/
+	Thumb(const String& type, const String& name);
+
+
+	/*!
+	\brief
+		Destructor for Thumb objects
+	*/
+	virtual ~Thumb(void);
+
+
+protected:
+	/*************************************************************************
+		Implementation Functions
+	*************************************************************************/
+	/*!
+	\brief
+		Add thumb specific events
+	*/
+	void	addThumbEvents(void);
+
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"Thumb")	return true;
+		return PushButton::testClassName_impl(class_name);
+	}
+
+
+	/*************************************************************************
+		New Thumb Events
+	*************************************************************************/
+	/*!
+	\brief
+		event triggered internally when the position of the thumb
+	*/
+	virtual void	onThumbPositionChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler triggered when the user begins to drag the thumb. 
+	*/
+	virtual void	onThumbTrackStarted(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler triggered when the thumb is released
+	*/
+	virtual void	onThumbTrackEnded(WindowEventArgs& e);
+
+
+
+	/*************************************************************************
+		Overridden event handling routines
+	*************************************************************************/
+	virtual void	onMouseMove(MouseEventArgs& e);
+	virtual void	onMouseButtonDown(MouseEventArgs& e);
+	virtual void	onCaptureLost(WindowEventArgs& e);
+
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	// general settings
+	bool	d_hotTrack;					//!< true if events are to be sent real-time, else just when thumb is released
+	bool	d_vertFree;					//!< true if thumb is movable vertically
+	bool	d_horzFree;					//!< true if thumb is movable horizontally
+
+	// operational limits
+	float	d_vertMin, d_vertMax;		//!< vertical range
+	float	d_horzMin, d_horzMax;		//!< horizontal range
+
+	// internal state
+	bool	d_beingDragged;				//!< true if thumb is being dragged
+	Point	d_dragPoint;				//!< point where we are being dragged at.
+
+
+private:
+	/*************************************************************************
+		Static Properties for this class
+	*************************************************************************/
+	static ThumbProperties::HotTracked	d_hotTrackedProperty;
+	static ThumbProperties::VertFree	d_vertFreeProperty;
+	static ThumbProperties::HorzFree	d_horzFreeProperty;
+	static ThumbProperties::VertRange	d_vertRangeProperty;
+	static ThumbProperties::HorzRange	d_horzRangeProperty;
+
+
+	/*************************************************************************
+		Private methods
+	*************************************************************************/
+	void	addThumbProperties(void);
+};
+
+} // End of  CEGUI namespace section
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIThumb_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIDragContainer.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIDragContainer.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIDragContainer.h	(revision 1812)
@@ -0,0 +1,501 @@
+/************************************************************************
+	filename: 	CEGUIDragContainer.h
+	created:	14/2/2005
+	author:		Paul D Turner
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIDragContainer_h_
+#define _CEGUIDragContainer_h_
+
+#include "CEGUIWindow.h"
+#include "CEGUIWindowFactory.h"
+#include "elements/CEGUIDragContainerProperties.h"
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+    /*!
+    \brief
+        Generic drag & drop enabled window class
+    */
+    class CEGUIEXPORT DragContainer : public Window
+    {
+    public:
+        /*************************************************************************
+            Constants
+        *************************************************************************/
+        static const String WidgetTypeName;     //!< Type name for DragContainer.
+        static const String EventNamespace;     //!< Namespace for global events
+        static const String EventDragStarted;   //!< Name of the event fired when the user begins dragging the thumb.
+        static const String EventDragEnded;     //!< Name of the event fired when the user releases the thumb.
+        static const String EventDragPositionChanged;   //!< Event fired when the drag position has changed.
+        static const String EventDragEnabledChanged;    //!< Event fired when dragging is enabled or disabled.
+        static const String EventDragAlphaChanged;      //!< Event fired when the alpha value used when dragging is changed.
+        static const String EventDragMouseCursorChanged;//!< Event fired when the mouse cursor used when dragging is changed.
+        static const String EventDragThresholdChanged;  //!< Event fired when the drag pixel threshold is changed.
+        static const String EventDragDropTargetChanged; //!< Event fired when the drop target changes.
+
+        /*************************************************************************
+            Object Construction and Destruction
+        *************************************************************************/
+        /*!
+        \brief
+            Constructor for DragContainer objects
+        */
+        DragContainer(const String& type, const String& name);
+
+        /*!
+        \brief
+            Destructor for DragContainer objects
+        */
+        virtual ~DragContainer(void);
+
+        /*************************************************************************
+        	Public Interface to DragContainer
+        *************************************************************************/
+        /*!
+        \brief
+            Return whether dragging is currently enabled for this DragContainer.
+
+        \return
+            - true if dragging is enabled and the DragContainer may be dragged.
+            - false if dragging is disabled and the DragContainer may not be dragged.
+        */
+        bool isDraggingEnabled(void) const;
+
+        /*!
+        \brief
+            Set whether dragging is currently enabled for this DragContainer.
+
+        \param setting
+            - true to enable dragging so that the DragContainer may be dragged.
+            - false to disabled dragging so that the DragContainer may not be dragged.
+
+        \return
+            Nothing.
+        */
+        void setDraggingEnabled(bool setting);
+
+        /*!
+        \brief
+            Return whether the DragContainer is currently being dragged.
+
+        \return
+            - true if the DragContainer is being dragged.
+            - false if te DragContainer is not being dragged.
+        */
+        bool isBeingDragged(void) const;
+
+        /*!
+        \brief
+            Return the current drag threshold in pixels.
+
+            The drag threshold is the number of pixels that the mouse must be
+            moved with the left button held down in order to commence a drag
+            operation.
+        
+        \return
+            float value indicating the current drag threshold value.
+        */
+        float getPixelDragThreshold(void) const;
+
+        /*!
+        \brief
+            Set the current drag threshold in pixels.
+
+            The drag threshold is the number of pixels that the mouse must be
+            moved with the left button held down in order to commence a drag
+            operation.
+
+        \param pixels
+            float value indicating the new drag threshold value.
+
+        \return
+            Nothing.
+        */
+        void setPixelDragThreshold(float pixels);
+
+        /*!
+        \brief
+            Return the alpha value that will be set on the DragContainer while a drag operation is
+            in progress.
+
+        \return
+            Current alpha value to use whilst dragging.
+        */
+        float getDragAlpha(void) const;
+
+        /*!
+        \brief
+            Set the alpha value to be set on the DragContainer when a drag operation is
+            in progress.
+
+            This method can be used while a drag is in progress to update the alpha.  Note that
+            the normal setAlpha method does not affect alpha while a drag is in progress, but
+            once the drag operation has ended, any value set via setAlpha will be restored.
+
+        \param alpha
+            Alpha value to use whilst dragging.
+
+        \return
+            Nothing.
+        */
+        void setDragAlpha(float alpha);
+
+        /*!
+        \brief
+            Return the Image currently set to be used for the mouse cursor when a
+            drag operation is in progress.
+
+        \return
+            Image object currently set to be used as the mouse cursor when dragging.
+        */
+        const Image* getDragCursorImage(void) const;
+
+        /*!
+        \brief
+            Set the Image to be used for the mouse cursor when a drag operation is
+            in progress.
+
+            This method may be used during a drag operation to update the current mouse
+            cursor image.
+
+        \param image
+            Image object to be used as the mouse cursor while dragging.
+
+        \return
+            Nothing.
+        */
+        void setDragCursorImage(const Image* image);
+
+        /*!
+        \brief
+            Set the Image to be used for the mouse cursor when a drag operation is
+            in progress.
+
+            This method may be used during a drag operation to update the current mouse
+            cursor image.
+
+        \param image
+            One of the MouseCursorImage enumerated values.
+
+        \return
+            Nothing.
+        */
+        void setDragCursorImage(MouseCursorImage image);
+
+        /*!
+        \brief
+            Set the Image to be used for the mouse cursor when a drag operation is
+            in progress.
+
+            This method may be used during a drag operation to update the current mouse
+            cursor image.
+
+        \param imageset
+            String holding the name of the Imageset that contains the Image to be used.
+
+        \param image
+            Image defined for the Imageset \a imageset to be used as the mouse cursor
+            when dragging.
+
+        \return
+            Nothing.
+
+        \exception UnknownObjectException   thrown if either \a imageset or \a image are unknown.
+        */
+        void setDragCursorImage(const String& imageset, const String& image);
+
+        /*!
+        \brief
+            Return the Window object that is the current drop target for the DragContainer.
+
+            The drop target for a DragContainer is basically the Window that the DragContainer
+            is within while being dragged.  The drop target may be 0 to indicate no target.
+
+        \return
+            Pointer to a Window object that contains the DragContainer whilst being dragged, or
+            0 to indicate no current target.
+        */
+        Window* getCurrentDropTarget(void) const;
+
+    protected:
+        /*************************************************************************
+        	Protected Implementation Methods
+        *************************************************************************/
+        /*!
+        \brief
+            Adds events specific to the DragContainer base class.
+        
+        \return
+            Nothing.
+        */
+        void addDragContainerEvents(void);
+
+        /*!
+        \brief
+            Return whether the required minimum movement threshold before initiating dragging
+            has been exceeded.
+
+        \param local_mouse
+            Mouse position as a pixel offset from the top-left corner of this window.
+
+        \return
+            - true if the threshold has been exceeded and dragging should be initiated.
+            - false if the threshold has not been exceeded.
+        */		
+        bool isDraggingThresholdExceeded(const Point& local_mouse);
+
+	    /*!
+	    \brief
+		    Initialise the required states to put the window into dragging mode.
+
+        \return
+            Nothing.
+	    */
+        void initialiseDragging(void);
+
+        /*!
+	    \brief
+		    Update state for window dragging.
+
+	    \param local_mouse
+		    Mouse position as a pixel offset from the top-left corner of this window.
+
+	    \return
+		    Nothing.
+	    */
+        void doDragging(const Point& local_mouse);
+
+        /*!
+        \brief
+            Method to update mouse cursor image
+        */
+        void updateActiveMouseCursor(void) const;
+
+
+		/*!
+		\brief
+			Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+		\param class_name
+			The class name that is to be checked.
+
+		\return
+			true if this window was inherited from \a class_name. false if not.
+		*/
+		virtual bool	testClassName_impl(const String& class_name) const
+		{
+			if (class_name==(const utf8*)"DragContainer")	return true;
+			return Window::testClassName_impl(class_name);
+		}
+
+
+        /*************************************************************************
+        	Implementation of abstract methods in Window
+        *************************************************************************/
+        void drawSelf(float z);
+
+        /*************************************************************************
+        	Overrides of methods in Window
+        *************************************************************************/
+
+        /*************************************************************************
+        	Overrides for Event handler methods
+        *************************************************************************/
+        virtual void onMouseButtonDown(MouseEventArgs& e);
+        virtual void onMouseButtonUp(MouseEventArgs& e);
+        virtual void onMouseMove(MouseEventArgs& e);
+        virtual void onCaptureLost(WindowEventArgs& e);
+        virtual void onAlphaChanged(WindowEventArgs& e);
+        virtual void onClippingChanged(WindowEventArgs& e);/*Window::drawSelf(z);*/
+
+        /*************************************************************************
+        	New Event handler methods
+        *************************************************************************/
+        /*!
+        \brief
+            Method called when dragging commences
+
+        \param e
+            WindowEventArgs object containing any relevant data.
+
+        \return
+            Nothing.
+        */
+        virtual void onDragStarted(WindowEventArgs& e);
+
+        /*!
+        \brief
+            Method called when dragging ends.
+
+        \param e
+            WindowEventArgs object containing any relevant data.
+
+        \return
+            Nothing.
+        */
+        virtual void onDragEnded(WindowEventArgs& e);
+
+        /*!
+        \brief
+            Method called when the dragged object position is changed.
+
+        \param e
+            WindowEventArgs object containing any relevant data.
+
+        \return
+            Nothing.
+        */
+        virtual void onDragPositionChanged(WindowEventArgs& e);
+
+        /*!
+        \brief
+            Method called when the dragging state is enabled or disabled
+        \param e
+            WindowEventArgs object.
+        \return
+            Nothing.
+        */
+        virtual void onDragEnabledChanged(WindowEventArgs& e);
+
+        /*!
+        \brief
+            Method called when the alpha value to use when dragging is changed.
+        \param e
+            WindowEventArgs object.
+        \return
+            Nothing.
+        */
+        virtual void onDragAlphaChanged(WindowEventArgs& e);
+
+        /*!
+        \brief
+            Method called when the mouse cursor to use when dragging is changed.
+        \param e
+            WindowEventArgs object.
+        \return
+            Nothing.
+        */
+        virtual void onDragMouseCursorChanged(WindowEventArgs& e);
+
+        /*!
+        \brief
+            Method called when the movement threshold required to trigger dragging is changed.
+        \param e
+            WindowEventArgs object.
+        \return
+            Nothing.
+        */
+        virtual void onDragThresholdChanged(WindowEventArgs& e);
+
+        /*!
+        \brief
+            Method called when the current drop target of this DragContainer changes.
+        \note
+            This event fires just prior to the target field being changed.  The default implementation
+            changes the drop target, you can examine the old and new targets before calling the default
+            implementation to make the actual change (and fire appropriate events for the Window objects
+            involved).
+        \param e
+            DragDropEventArgs object initialised as follows:
+            - dragDropItem is initialised to the DragContainer triggering the event (typically 'this').
+            - window is initialised to point to the Window which will be the new drop target.
+        \return
+            Nothing.
+        */
+        virtual void onDragDropTargetChanged(DragDropEventArgs& e);
+
+        /*************************************************************************
+        	Data
+        *************************************************************************/
+        bool    d_draggingEnabled;  //!< True when dragging is enabled.
+        bool    d_leftMouseDown;    //!< True when left mouse button is down.
+        bool    d_dragging;         //!< true when being dragged.
+        Point   d_dragPoint;        //!< point we are being dragged at.
+        Point   d_startPosition;    //!< position prior to dragging.
+        float   d_dragThreshold;    //!< Pixels mouse must move before dragging commences.
+        float   d_dragAlpha;        //!< Alpha value to set when dragging.
+        float   d_storedAlpha;      //!< Alpha value to re-set when dragging ends.
+        bool    d_storedClipState;  //!< Parent clip state to re-set.
+        Window* d_dropTarget;       //!< Target window for possible drop operation.
+        const Image* d_dragCursorImage; //!< Image to use for mouse cursor when dragging.
+
+    private:
+        /*************************************************************************
+            Static properties for the Spinner widget
+        *************************************************************************/
+        static DragContainerProperties::DragAlpha       d_dragAlphaProperty;
+        static DragContainerProperties::DragCursorImage d_dragCursorImageProperty;
+        static DragContainerProperties::DraggingEnabled d_dragEnabledProperty;
+        static DragContainerProperties::DragThreshold   d_dragThresholdProperty;
+
+        /*************************************************************************
+        	Implementation methods
+        *************************************************************************/
+        /*!
+        \brief
+            Adds properties specific to the DragContainer base class.
+        
+        \return
+            Nothing.
+        */
+        void addDragContainerProperties(void);
+    };
+
+    /*!
+    \brief
+        Factory class for producing DragContainer windows
+    */
+    class DragContainerFactory : public WindowFactory
+    {
+    public:
+        DragContainerFactory(void) : WindowFactory(DragContainer::WidgetTypeName) { }
+        ~DragContainerFactory(void){}
+
+        Window* createWindow(const String& name)
+        {
+            DragContainer* wnd = new DragContainer(d_type, name);
+            return wnd;
+        }
+
+        void destroyWindow(Window* window)
+        {
+            if (window->getType() == d_type)
+                delete window;
+        }
+
+    };
+
+
+} // End of  CEGUI namespace section
+
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIDragContainer_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIMultiLineEditbox.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIMultiLineEditbox.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIMultiLineEditbox.h	(revision 1812)
@@ -0,0 +1,793 @@
+/************************************************************************
+	filename: 	CEGUIMultiLineEditbox.h
+	created:	30/6/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to the Multi-lien edit box base class.
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIMultiLineEditbox_h_
+#define _CEGUIMultiLineEditbox_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIWindow.h"
+#include "CEGUIFont.h"
+#include "elements/CEGUIMultiLineEditboxProperties.h"
+
+#include <vector>
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Base class for the multi-line edit box widget.
+*/
+class CEGUIEXPORT MultiLineEditbox : public Window
+{
+public:
+	static const String EventNamespace;				//!< Namespace for global events
+
+
+	/*************************************************************************
+		Constants
+	*************************************************************************/
+	// event names
+	static const String EventReadOnlyModeChanged;			//!< The read-only mode for the edit box has been changed.
+	static const String EventWordWrapModeChanged;			//!< The word wrap mode of the text box has been changed.
+	static const String EventMaximumTextLengthChanged;	//!< The maximum allowable string length has been changed.
+	static const String EventCaratMoved;					//!< The text carat (insert point) has changed.
+	static const String EventTextSelectionChanged;		//!< The current text selection has changed.
+	static const String EventEditboxFull;					//!< The number of characters in the edit box has reached the current maximum.
+	static const String EventVertScrollbarModeChanged;	//!< Event triggered when the vertical scroll bar 'force' setting changes.
+	static const String EventHorzScrollbarModeChanged;	//!< Event triggered when the horizontal scroll bar 'force' setting changes.
+
+	// default colours
+	static const argb_t	DefaultNormalTextColour;			//!< Colour applied to normal unselected text.
+	static const argb_t	DefaultSelectedTextColour;			//!< Colour applied to selected text.
+	static const argb_t	DefaultNormalSelectionColour;		//!< Colour applied to normal selection brush.
+	static const argb_t	DefaultInactiveSelectionColour;		//!< Colour applied to selection brush when widget is inactive.
+
+
+	/*************************************************************************
+		Accessor Functions
+	*************************************************************************/
+	/*!
+	\brief
+		return true if the edit box has input focus.
+
+	\return
+		- true if the edit box has keyboard input focus.
+		- false if the edit box does not have keyboard input focus.
+	*/
+	bool	hasInputFocus(void) const;
+
+
+	/*!
+	\brief
+		return true if the edit box is read-only.
+
+	\return
+		- true if the edit box is read only and can't be edited by the user.
+		- false if the edit box is not read only and may be edited by the user.
+	*/
+	bool	isReadOnly(void) const		{return d_readOnly;}
+
+
+	/*!
+	\brief
+		return the current position of the carat.
+
+	\return
+		Index of the insert carat relative to the start of the text.
+	*/
+	size_t	getCaratIndex(void) const		{return d_caratPos;}
+
+
+	/*!
+	\brief
+		return the current selection start point.
+
+	\return
+		Index of the selection start point relative to the start of the text.  If no selection is defined this function returns
+		the position of the carat.
+	*/
+	size_t	getSelectionStartIndex(void) const;
+
+
+	/*!
+	\brief
+		return the current selection end point.
+
+	\return
+		Index of the selection end point relative to the start of the text.  If no selection is defined this function returns
+		the position of the carat.
+	*/
+	size_t	getSelectionEndIndex(void) const;
+
+	
+	/*!
+	\brief
+		return the length of the current selection (in code points / characters).
+
+	\return
+		Number of code points (or characters) contained within the currently defined selection.
+	*/
+	size_t	getSelectionLength(void) const;
+
+
+	/*!
+	\brief
+		return the maximum text length set for this edit box.
+
+	\return
+		The maximum number of code points (characters) that can be entered into this edit box.
+	*/
+	size_t	getMaxTextLength(void) const		{return d_maxTextLen;}
+
+
+	/*!
+	\brief
+		return the currently set colour to be used for rendering edit box text in the
+		normal, unselected state.
+
+	\return
+		colour value describing the ARGB colour that is currently set.
+	*/
+	colour	getNormalTextColour(void) const				{return d_normalTextColour;}
+
+
+	/*!
+	\brief
+		return the currently set colour to be used for rendering the edit box text when within the
+		selected region.
+
+	\return
+		colour value describing the ARGB colour that is currently set.
+	*/
+	colour	getSelectedTextColour(void) const			{return d_selectTextColour;}
+
+
+	/*!
+	\brief
+		return the currently set colour to be used for rendering the edit box selection highlight
+		when the edit box is active.
+
+	\return
+		colour value describing the ARGB colour that is currently set.
+	*/
+	colour	getNormalSelectBrushColour(void) const		{return d_selectBrushColour;}
+
+
+	/*!
+	\brief
+		return the currently set colour to be used for rendering the edit box selection highlight
+		when the edit box is inactive.
+
+	\return
+		colour value describing the ARGB colour that is currently set.
+	*/
+	colour	getInactiveSelectBrushColour(void) const	{return d_inactiveSelectBrushColour;}
+
+
+	/*!
+	\brief
+		Return whether the text in the edit box will be word-wrapped.
+
+	\return
+		- true if the text will be word-wrapped at the edges of the widget frame.
+		- false if text will not be word-wrapped (a scroll bar will be used to access long text lines).
+	*/
+	bool	isWordWrapped(void) const;
+
+
+	/*************************************************************************
+		Manipulators
+	*************************************************************************/
+	/*!
+	\brief
+		Initialise the Window based object ready for use.
+
+	\note
+		This must be called for every window created.  Normally this is handled automatically by the WindowFactory for each Window type.
+
+	\return
+		Nothing
+	*/
+	virtual void	initialise(void);
+
+
+	/*!
+	\brief
+		Specify whether the edit box is read-only.
+
+	\param setting
+		- true if the edit box is read only and can't be edited by the user.
+		- false if the edit box is not read only and may be edited by the user.
+
+	\return
+		Nothing.
+	*/
+	void	setReadOnly(bool setting);
+
+
+	/*!
+	\brief
+		Set the current position of the carat.
+
+	\param carat_pos
+		New index for the insert carat relative to the start of the text.  If the value specified is greater than the
+		number of characters in the edit box, the carat is positioned at the end of the text.
+
+	\return
+		Nothing.
+	*/
+	void	setCaratIndex(size_t carat_pos);
+
+
+	/*!
+	\brief
+		Define the current selection for the edit box
+
+	\param start_pos
+		Index of the starting point for the selection.  If this value is greater than the number of characters in the edit box, the
+		selection start will be set to the end of the text.
+
+	\param end_pos
+		Index of the ending point for the selection.  If this value is greater than the number of characters in the edit box, the
+		selection start will be set to the end of the text.
+
+	\return
+		Nothing.
+	*/
+	void	setSelection(size_t start_pos, size_t end_pos);
+	
+
+	/*!
+	\brief
+		set the maximum text length for this edit box.
+
+	\param max_len
+		The maximum number of code points (characters) that can be entered into this Editbox.
+
+	\return
+		Nothing.
+	*/
+	void	setMaxTextLength(size_t max_len);
+
+
+	/*!
+	\brief
+		Set the colour to be used for rendering edit box text in the normal, unselected state.
+
+	\param col
+		colour value describing the ARGB colour that is to be used.
+
+	\return
+		Nothing.
+	*/
+	void	setNormalTextColour(const colour& col);
+
+
+	/*!
+	\brief
+		Set the colour to be used for rendering the edit box text when within the
+		selected region.
+
+	\return
+		colour value describing the ARGB colour that is currently set.
+	*/
+	void	setSelectedTextColour(const colour& col);
+
+
+	/*!
+	\brief
+		Set the colour to be used for rendering the edit box selection highlight
+		when the edit box is active.
+
+	\param col
+		colour value describing the ARGB colour that is to be used.
+
+	\return
+		Nothing.
+	*/
+	void	setNormalSelectBrushColour(const colour& col);
+
+
+	/*!
+	\brief
+		Set the colour to be used for rendering the edit box selection highlight
+		when the edit box is inactive.
+
+	\param col
+		colour value describing the ARGB colour that is to be used.
+
+	\return
+		Nothing.
+	*/
+	void	setInactiveSelectBrushColour(const colour& col);
+
+
+	/*!
+	\brief
+		Scroll the view so that the current carat position is visible.
+	*/
+	void	ensureCaratIsVisible(void);
+
+
+	/*!
+	\brief
+		Set whether the text will be word wrapped or not.
+
+	\param setting
+		- true if the text should word-wrap at the edges of the text box.
+		- false if the text should not wrap, but a scroll bar should be used.
+
+	\return
+		Nothing.
+	*/
+	void	setWordWrapping(bool setting);
+
+
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for the MultiLineEditbox base class.
+	*/
+	MultiLineEditbox(const String& type, const String& name);
+
+
+	/*!
+	\brief
+		Destructor for the MultiLineEditbox base class.
+	*/
+	virtual ~MultiLineEditbox(void);
+
+
+protected:
+	/*************************************************************************
+		Implementation Methods (abstract)
+	*************************************************************************/
+	/*!
+	\brief
+		Return a Rect object describing, in un-clipped pixels, the window relative area
+		that the text should be rendered in to.
+
+	\return
+		Rect object describing the area of the Window to be used for rendering text.
+	*/
+	virtual	Rect	getTextRenderArea(void) const		= 0;
+
+
+	/*!
+	\brief
+		create and return a pointer to a Scrollbar widget for use as vertical scroll bar
+
+	\param name
+	   String holding the name to be assigned to the component.
+
+	\return
+		Pointer to a Scrollbar to be used for scrolling vertically.
+	*/
+	virtual Scrollbar*	createVertScrollbar(const String& name) const		= 0;
+ 
+
+	/*!
+	\brief
+		create and return a pointer to a Scrollbar widget for use as horizontal scroll bar
+
+	\param name
+	   String holding the name to be assigned to the component.
+
+	\return
+		Pointer to a Scrollbar to be used for scrolling horizontally.
+	*/
+	virtual Scrollbar*	createHorzScrollbar(const String& name) const		= 0;
+
+
+	/*!
+	\brief
+		Perform rendering of the widget control frame and other 'static' areas.  This
+		method should not render the actual text.  Note that the text will be rendered
+		to layer 4 and the selection brush to layer 3, other layers can be used for
+		rendering imagery behind and infront of the text & selection..
+
+	\return
+		Nothing.
+	*/
+	virtual	void	cacheEditboxBaseImagery()		= 0;
+
+
+	/*!
+	\brief
+		Render the carat.
+
+	\return
+		Nothing
+	*/
+	virtual void	cacheCaratImagery(const Rect& textArea)	= 0;
+
+
+	/*************************************************************************
+		Implementation Methods
+	*************************************************************************/
+	/*!
+	\brief
+		Add multi-line edit box specific events
+	*/
+	void	addMultiLineEditboxEvents(void);
+
+
+	/*!
+	\brief
+		Render text lines.
+	*/
+	void	cacheTextLines(const Rect& dest_area);
+
+
+	/*!
+	\brief
+		Format the text into lines as needed by the current formatting options.
+	*/
+	void	formatText(void);
+
+
+	/*!
+	\brief
+		Return the length of the next token in String \a text starting at index \a start_idx.
+
+	\note
+		Any single whitespace character is one token, any group of other characters is a token.
+	
+	\return
+		The code point length of the token.
+	*/
+	size_t	getNextTokenLength(const String& text, size_t start_idx) const;
+
+
+	virtual	void populateRenderCache();
+
+
+	/*!
+	\brief
+		display required integrated scroll bars according to current state of the edit box and update their values.
+	*/
+	void	configureScrollbars(void);
+
+
+	/*!
+	\brief
+		Return the text code point index that is rendered closest to screen position \a pt.
+
+	\param pt
+		Point object describing a position on the screen in pixels.
+
+	\return
+		Code point index into the text that is rendered closest to screen position \a pt.
+	*/
+	size_t	getTextIndexFromPosition(const Point& pt) const;
+
+
+	/*!
+	\brief
+		Return the line number a given index falls on with the current formatting.  Will return last line
+		if index is out of range.
+	*/
+	size_t	getLineNumberFromIndex(size_t index) const;
+
+
+	/*!
+	\brief
+		Clear the current selection setting
+	*/
+	void	clearSelection(void);
+
+
+	/*!
+	\brief
+		Erase the currently selected text.
+
+	\param modify_text
+		when true, the actual text will be modified.  When false, everything is done except erasing the characters.
+	*/
+	void	eraseSelectedText(bool modify_text = true);
+
+
+	/*!
+	\brief
+		Processing for backspace key
+	*/
+	void	handleBackspace(void);
+
+
+	/*!
+	\brief
+		Processing for Delete key
+	*/
+	void	handleDelete(void);
+
+
+	/*!
+	\brief
+		Processing to move carat one character left
+	*/
+	void	handleCharLeft(uint sysKeys);
+
+
+	/*!
+	\brief
+		Processing to move carat one word left
+	*/
+	void	handleWordLeft(uint sysKeys);
+
+
+	/*!
+	\brief
+		Processing to move carat one character right
+	*/
+	void	handleCharRight(uint sysKeys);
+
+
+	/*!
+	\brief
+		Processing to move carat one word right
+	*/
+	void	handleWordRight(uint sysKeys);
+
+
+	/*!
+	\brief
+		Processing to move carat to the start of the text.
+	*/
+	void	handleDocHome(uint sysKeys);
+
+
+	/*!
+	\brief
+		Processing to move carat to the end of the text
+	*/
+	void	handleDocEnd(uint sysKeys);
+
+
+	/*!
+	\brief
+		Processing to move carat to the start of the current line.
+	*/
+	void	handleLineHome(uint sysKeys);
+
+
+	/*!
+	\brief
+		Processing to move carat to the end of the current line
+	*/
+	void	handleLineEnd(uint sysKeys);
+
+
+	/*!
+	\brief
+		Processing to move carat up a line.
+	*/
+	void	handleLineUp(uint sysKeys);
+
+
+	/*!
+	\brief
+		Processing to move carat down a line.
+	*/
+	void	handleLineDown(uint sysKeys);
+
+
+	/*!
+	\brief
+		Processing to insert a new line / paragraph.
+	*/
+	void	handleNewLine(uint sysKeys);
+
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if ((class_name==(const utf8*)"MultiLineEditBox") ||
+			(class_name==(const utf8*)"MultiLineEditbox"))
+		{
+			return true;
+		}
+
+		return Window::testClassName_impl(class_name);
+	}
+
+	/*!
+	\brief
+	   Internal handler that is triggered when the user interacts with the scrollbars.
+    */
+    bool handle_scrollChange(const EventArgs& args);
+
+
+	/*************************************************************************
+		New event handlers
+	*************************************************************************/
+	/*!
+	\brief
+		Handler called when the read-only state of the edit box changes
+	*/
+	void	onReadOnlyChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the word wrap mode for the the edit box changes
+	*/
+	void	onWordWrapModeChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the maximum text length for the edit box changes
+	*/
+	void	onMaximumTextLengthChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the carat moves.
+	*/
+	void	onCaratMoved(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the text selection changes
+	*/
+	void	onTextSelectionChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the edit box is full
+	*/
+	void	onEditboxFullEvent(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the 'always show' setting for the vertical scroll bar changes.
+	*/
+	void	onVertScrollbarModeChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when 'always show' setting for the horizontal scroll bar changes.
+	*/
+	void	onHorzScrollbarModeChanged(WindowEventArgs& e);
+
+
+	/*************************************************************************
+		Overridden event handlers
+	*************************************************************************/
+	virtual	void	onMouseButtonDown(MouseEventArgs& e);
+	virtual void	onMouseButtonUp(MouseEventArgs& e);
+	virtual	void	onMouseDoubleClicked(MouseEventArgs& e);
+	virtual	void	onMouseTripleClicked(MouseEventArgs& e);
+	virtual void	onMouseMove(MouseEventArgs& e);
+	virtual void	onCaptureLost(WindowEventArgs& e);
+	virtual void	onCharacter(KeyEventArgs& e);
+	virtual void	onKeyDown(KeyEventArgs& e);
+	virtual void	onTextChanged(WindowEventArgs& e);
+	virtual void	onSized(WindowEventArgs& e);
+	virtual	void	onMouseWheel(MouseEventArgs& e);
+
+
+	/*************************************************************************
+		Implementation struct
+	*************************************************************************/
+	/*!
+	\brief
+		struct used to store information about a formatted line within the
+		paragraph.
+	*/
+	struct LineInfo
+	{
+		size_t	d_startIdx;		//!< Starting index for this line.
+		size_t	d_length;		//!< Code point length of this line.
+		float	d_extent;		//!< Rendered extent of this line.
+	};
+
+
+	/*************************************************************************
+		Implementation data
+	*************************************************************************/
+	bool	d_readOnly;			//!< true if the edit box is in read-only mode
+	size_t	d_maxTextLen;		//!< Maximum number of characters for this Editbox.
+	size_t	d_caratPos;			//!< Position of the carat / insert-point.
+	size_t	d_selectionStart;	//!< Start of selection area.
+	size_t	d_selectionEnd;		//!< End of selection area.
+	bool	d_dragging;			//!< true when a selection is being dragged.
+	size_t	d_dragAnchorIdx;	//!< Selection index for drag selection anchor point.
+
+	typedef	std::vector<LineInfo>	LineList;	//!< Type for collection of LineInfos.
+	static String d_lineBreakChars;	//!< Holds what we consider to be line break characters.
+	bool		d_wordWrap;			//!< true when formatting uses word-wrapping.
+	LineList	d_lines;			//!< Holds the lines for the current formatting.
+	float		d_widestExtent;		//!< Holds the extent of the widest line as calculated in the last formatting pass.
+
+	// component widgets
+	Scrollbar*	d_vertScrollbar;	//!< Points to the vertical scroll bar widget.
+	Scrollbar*	d_horzScrollbar;	//!< Points to the horizontal scroll bar widget.
+	bool	d_forceVertScroll;		//!< true if vertical scrollbar should always be displayed
+	bool	d_forceHorzScroll;		//!< true if horizontal scrollbar should always be displayed
+
+	// images
+	const Image*	d_selectionBrush;	//!< Image to use as the selection brush (should be set by derived class).
+
+	// basic rendering colours
+	colour	d_normalTextColour;				//!< Text colour used normally.
+	colour	d_selectTextColour;				//!< Text colour used when text is highlighted
+	colour	d_selectBrushColour;			//!< Colour to apply to the selection brush.
+	colour	d_inactiveSelectBrushColour;	//!< Colour to apply to the selection brush when widget is inactive / read-only.
+
+
+private:
+	/*************************************************************************
+		Static Properties for this class
+	*************************************************************************/
+	static MultiLineEditboxProperties::ReadOnly					d_readOnlyProperty;
+	static MultiLineEditboxProperties::WordWrap					d_wordWrapProperty;
+	static MultiLineEditboxProperties::CaratIndex				d_caratIndexProperty;
+	static MultiLineEditboxProperties::SelectionStart			d_selectionStartProperty;
+	static MultiLineEditboxProperties::SelectionLength			d_selectionLengthProperty;
+	static MultiLineEditboxProperties::MaxTextLength			d_maxTextLengthProperty;
+	static MultiLineEditboxProperties::NormalTextColour			d_normalTextColourProperty;
+	static MultiLineEditboxProperties::SelectedTextColour		d_selectedTextColourProperty;
+	static MultiLineEditboxProperties::ActiveSelectionColour	d_activeSelectionColourProperty;
+	static MultiLineEditboxProperties::InactiveSelectionColour	d_inactiveSelectionColourProperty;
+
+
+	/*************************************************************************
+		Private methods
+	*************************************************************************/
+	void	addMultiLineEditboxProperties(void);
+};
+
+} // End of  CEGUI namespace section
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIMultiLineEditbox_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIMenuItem.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIMenuItem.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIMenuItem.h	(revision 1812)
@@ -0,0 +1,409 @@
+/************************************************************************
+	filename: 	CEGUIMenuItem.h
+	created:	2/4/2005
+	author:		Tomas Lindquist Olsen (based on code by Paul D Turner)
+	
+	purpose:	Interface to base class for MenuItem widget
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIMenuItem_h_
+#define _CEGUIMenuItem_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIWindow.h"
+#include "elements/CEGUITextItem.h"
+#include "elements/CEGUIMenuItemProperties.h"
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+	Base class for menu items.
+*/
+class CEGUIEXPORT MenuItem : public TextItem
+{
+public:
+	static const String EventNamespace;				//!< Namespace for global events
+
+	/*************************************************************************
+		Constants
+	*************************************************************************/
+	// default colours for rendering
+	
+	static const colour		DefaultHoverColour;			//!< Default colour used when rendering in hover / highlight state.
+	static const colour		DefaultPushedColour;		//!< Default colour used when rendering in pushed state.
+	static const colour		DefaultOpenedColour;		//!< Default colour used when rendering in opended state.
+	static const colour		DefaultNormalTextColour;	//!< Default colour used when rendering the text in normal state.
+	static const colour		DefaultDisabledTextColour;	//!< Default colour used when rendering the text in disabled state.
+
+
+	/*************************************************************************
+		Event name constants
+	*************************************************************************/
+	// generated internally by Window
+	static const String EventClicked;					//!< The menuitem was clicked.
+
+
+	/*************************************************************************
+		Accessor type functions
+	*************************************************************************/
+	/*!
+	\brief
+		return true if user is hovering over this widget (or it's pushed and user is not over it for highlight)
+
+	\return
+		true if the user is hovering or if the button is pushed and the mouse is not over the button.  Otherwise return false.
+	*/
+	bool	isHovering(void) const			{return d_hovering;}
+
+
+	/*!
+	\brief
+		Return true if the button widget is in the pushed state.
+
+	\return
+		true if the button-type widget is pushed, false if the widget is not pushed.
+	*/
+	bool	isPushed(void) const			{return d_pushed;}
+
+
+	/*!
+	\brief
+		return text label colour used for hover / highlight rendering
+
+	\return
+		colour value that is used for the label text when rendering in the hover / highlighted states.
+	*/
+	colour	getHoverColour(void) const			{return d_hoverColour;}
+
+
+	/*!
+	\brief
+		return text label colour used for pushed rendering
+
+	\return
+		colour value that is used for the label text when rendering in the pushed state.
+	*/
+	colour	getPushedColour(void) const			{return d_pushedColour;}
+
+
+	/*!
+	\brief
+		return text label colour used for opened rendering
+
+	\return
+		colour value that is used for the label text when rendering in the opened state.
+	*/
+	colour	getOpenedColour(void) const			{return d_openedColour;}
+
+
+	/*!
+	\brief
+		return text label colour used for normal rendering
+
+	\return
+		colour value that is used for the label text when rendering in the normal state.
+	*/
+	colour	getNormalTextColour(void) const			{return d_normalTextColour;}
+
+
+	/*!
+	\brief
+		return text label colour used for disabled rendering
+
+	\return
+		colour value that is used for the label text when rendering in the disabled state.
+	*/
+	colour	getDisabledTextColour(void) const		{return d_disabledTextColour;}
+
+
+	/*!
+	\brief
+		Get the PopupMenu that is currently attached to this MenuItem.
+
+	\return
+		A pointer to the currently attached PopupMenu.  Null is there is no PopupMenu attached.
+	*/
+	PopupMenu*	getPopupMenu(void) const			{return d_popup;}
+
+
+	/*************************************************************************
+		Manipulators
+	*************************************************************************/
+	/*!
+	\brief
+		Set the colour to use when rendering in the hover / highlighted states.
+
+	\param colour
+		colour value specifying the colour to be used.
+
+	\return
+		Nothing.
+	*/
+	void	setHoverColour(const colour& colour);
+
+
+	/*!
+	\brief
+		Set the colour to use when rendering in the pushed state.
+
+	\param colour
+		colour value specifying the colour to be used.
+
+	\return
+		Nothing.
+	*/
+	void	setPushedColour(const colour& colour);
+
+
+	/*!
+	\brief
+		Set the colour to use when rendering in the opened state.
+
+	\param colour
+		colour value specifying the colour to be used.
+
+	\return
+		Nothing.
+	*/
+	void	setOpenedColour(const colour& colour);
+
+
+	/*!
+	\brief
+		Set the colour to use for the label text when rendering in the normal state.
+
+	\param colour
+		colour value specifying the colour to be used.
+
+	\return
+		Nothing.
+	*/
+	void	setNormalTextColour(const colour& colour);
+
+
+	/*!
+	\brief
+		Set the colour to use for the label text when rendering in the disabled state.
+
+	\param colour
+		colour value specifying the colour to be used.
+
+	\return
+		Nothing.
+	*/
+	void	setDisabledTextColour(const colour& colour);
+
+
+	/*!
+	\brief
+		Set the popup menu for this item.
+
+	\param popup
+		popupmenu window to attach to this item
+
+	\return
+		Nothing.
+	*/
+	void	setPopupMenu(PopupMenu* popup);
+
+
+	/*!
+	\brief
+		Opens the PopupMenu.
+	*/
+	void	openPopupMenu(void);
+
+
+	/*!
+	\brief
+		Closes the PopupMenu.
+
+	\param notify
+		true if the parent menubar is to be notified of the close.
+
+	\return
+		Nothing.
+	*/
+	void	closePopupMenu(bool notify=true);
+
+
+	/*!
+	\brief
+		Toggles the PopupMenu.
+
+	\return
+		true if the popup was opened. false if it was closed.
+	*/
+	bool	togglePopupMenu(void);
+
+
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for MenuItem objects
+	*/
+	MenuItem(const String& type, const String& name);
+
+
+	/*!
+	\brief
+		Destructor for MenuItem objects
+	*/
+	virtual ~MenuItem(void);
+
+
+protected:
+	/*************************************************************************
+		New Event Handlers
+	*************************************************************************/
+	/*!
+	\brief
+		handler invoked internally when the MenuItem is clicked.
+	*/
+	virtual void	onClicked(WindowEventArgs& e);
+
+
+	/*************************************************************************
+		Overridden event handlers
+	*************************************************************************/
+	virtual void	onMouseMove(MouseEventArgs& e);
+	virtual void	onMouseButtonDown(MouseEventArgs& e);
+	virtual void	onMouseButtonUp(MouseEventArgs& e);
+	virtual void	onCaptureLost(WindowEventArgs& e);
+	virtual void	onMouseLeaves(MouseEventArgs& e);
+
+
+	/*************************************************************************
+		Implementation Functions
+	*************************************************************************/
+	/*!
+	\brief
+		Update the internal state of the widget with the mouse at the given position.
+
+	\param mouse_pos
+		Point object describing, in screen pixel co-ordinates, the location of the mouse cursor.
+
+	\return
+		Nothing
+	*/
+	void	updateInternalState(const Point& mouse_pos);
+
+
+	/*!
+	\brief
+		Add menuitem specific events
+	*/
+	void	addMenuItemEvents(void);
+
+
+	/*!
+	\brief
+		Recursive function that closes all popups down the hierarcy starting with this one.
+
+	\return
+		Nothing.
+	*/
+	void	closeAllMenuItemPopups();
+
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"MenuItem")	return true;
+		return TextItem::testClassName_impl(class_name);
+	}
+
+
+	/*************************************************************************
+		Implementation Rendering Functions
+	*************************************************************************/
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	bool	d_pushed;			//!< true when widget is pushed
+	bool	d_hovering;			//!< true when the button is in 'hover' state and requires the hover rendering.
+	bool	d_opened;			//!< true when the menu item's popup menu is opened.
+
+	// common rendering setting data
+	colour	d_hoverColour;					//!< Colour used when rendering in highlighted state
+	colour	d_pushedColour;					//!< Colour used when rendering in pushed state
+	colour	d_openedColour;					//!< Colour used when rendering in opened state
+	colour	d_normalTextColour;				//!< Colour used for the text when rendering in normal state
+	colour	d_disabledTextColour;			//!< Colour used for the text when rendering in disabled state
+
+	PopupMenu* d_popup;						//!< PopupMenu that this item displays when activated.
+
+	bool	d_popupWasClosed;				//!< Used internally to determine if a popup was just closed on a Clicked event
+
+private:
+	/*************************************************************************
+		Static Properties for this class
+	*************************************************************************/
+	static MenuItemProperties::HoverColour			d_hoverColourProperty;
+	static MenuItemProperties::PushedColour			d_pushedColourProperty;
+	static MenuItemProperties::OpenedColour			d_openedColourProperty;
+	static MenuItemProperties::NormalTextColour		d_normalTextColourProperty;
+	static MenuItemProperties::DisabledTextColour	d_disabledTextColourProperty;
+
+
+	/*************************************************************************
+		Private methods
+	*************************************************************************/
+	void addMenuItemProperties(void);
+
+
+	/*!
+	\brief
+		Add given window to child list at an appropriate position
+	*/
+	virtual void	addChild_impl(Window* wnd);
+};
+
+} // End of  CEGUI namespace section
+
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+
+#endif	// end of guard _CEGUIMenuItem_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIButtonBaseProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIButtonBaseProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIButtonBaseProperties.h	(revision 1812)
@@ -0,0 +1,156 @@
+/************************************************************************
+	filename: 	CEGUIButtonBaseProperties.h
+	created:	9/7/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to properties for button base class
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIButtonBaseProperties_h_
+#define _CEGUIButtonBaseProperties_h_
+
+#include "CEGUIProperty.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+// Start of ButtonBaseProperties namespace section
+/*!
+\brief
+	Namespace containing all classes that make up the properties interface for the ButtonBase class
+*/
+namespace ButtonBaseProperties
+{
+/*!
+\brief
+	Property to access the normal text colour.
+
+	This property offers access to the colour value to be used for rendering the button caption text for the normal state.
+
+	\par Usage:
+		- Name: NormalTextColour
+		- Format: "aarrggbb".
+
+	\par Where:
+		- aarrggbb is the ARGB colour value to be used.
+*/
+class NormalTextColour : public Property
+{
+public:
+	NormalTextColour() : Property(
+		"NormalTextColour",
+		"Property to get/set the colour to use when rendering label text for normal state.  Value is \"aarrggbb\" (hex).",
+		"FFFFFFFF")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the hover / highlight text colour.
+
+	This property offers access to the colour value to be used for rendering the button caption text for the hover or highlight state.
+
+	\par Usage:
+		- Name: HoverTextColour
+		- Format: "aarrggbb".
+
+	\par Where:
+		- aarrggbb is the ARGB colour value to be used.
+*/
+class HoverTextColour : public Property
+{
+public:
+	HoverTextColour() : Property(
+		"HoverTextColour",
+		"Property to get/set the colour to use when rendering label text for hover/highlight state.  Value is \"aarrggbb\" (hex).",
+		"FFFFFFFF")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the pushed text colour.
+
+	This property offers access to the colour value to be used for rendering the button caption text for the pushed state.
+
+	\par Usage:
+		- Name: PushedTextColour
+		- Format: "aarrggbb".
+
+	\par Where:
+		- aarrggbb is the ARGB colour value to be used.
+*/
+class PushedTextColour : public Property
+{
+public:
+	PushedTextColour() : Property(
+		"PushedTextColour", 
+		"Property to get/set the colour to use when rendering label text for pushed state.  Value is \"aarrggbb\" (hex).",
+		"FFFFFFFF")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the disabled text colour.
+
+	This property offers access to the colour value to be used for rendering the button caption text for the disabled state.
+
+	\par Usage:
+		- Name: DisabledTextColour
+		- Format: "aarrggbb".
+
+	\par Where:
+		- aarrggbb is the ARGB colour value to be used.
+*/
+class DisabledTextColour : public Property
+{
+public:
+	DisabledTextColour() : Property(
+		"DisabledTextColour",
+		"Property to get/set the colour to use when rendering label text for disabled state.  Value is \"aarrggbb\" (hex).",
+		"FF7F7F7F")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+} // End of  ButtonBaseProperties namespace section
+
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIButtonBaseProperties_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIListbox.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIListbox.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIListbox.h	(revision 1812)
@@ -0,0 +1,742 @@
+/************************************************************************
+	filename: 	CEGUIListbox.h
+	created:	13/4/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to base class for Listbox widget
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIListbox_h_
+#define _CEGUIListbox_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIWindow.h"
+#include "elements/CEGUIListboxProperties.h"
+#include <vector>
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+	Base class for standard Listbox widget.
+*/
+class CEGUIEXPORT Listbox : public Window
+{
+public:
+	static const String EventNamespace;				//!< Namespace for global events
+
+
+	/*************************************************************************
+		Constants
+	*************************************************************************/
+	// event names
+	static const String EventListContentsChanged;			//!< Event triggered when the contents of the list is changed.
+	static const String EventSelectionChanged;			//!< Event triggered when there is a change to the currently selected item(s).
+	static const String EventSortModeChanged;				//!< Event triggered when the sort mode setting changes.
+	static const String EventMultiselectModeChanged;		//!< Event triggered when the multi-select mode setting changes.
+	static const String EventVertScrollbarModeChanged;	//!< Event triggered when the vertical scroll bar 'force' setting changes.
+	static const String EventHorzScrollbarModeChanged;	//!< Event triggered when the horizontal scroll bar 'force' setting changes.
+
+
+	/*************************************************************************
+		Accessor Methods
+	*************************************************************************/
+	/*!
+	\brief
+		Return number of items attached to the list box
+
+	\return
+		the number of items currently attached to this list box.
+	*/
+	size_t	getItemCount(void) const		{return d_listItems.size();}
+
+	
+	/*!
+	\brief
+		Return the number of selected items in the list box.
+
+	\return
+		Total number of attached items that are in the selected state.
+	*/
+	size_t	getSelectedCount(void) const;
+
+
+	/*!
+	\brief
+		Return a pointer to the first selected item.
+
+	\return
+		Pointer to a ListboxItem based object that is the first selected item in the list.  will return NULL if
+		no item is selected.
+	*/
+	ListboxItem*	getFirstSelectedItem(void) const;
+
+
+	/*!
+	\brief
+		Return a pointer to the next selected item after item \a start_item
+
+	\param start_item
+		Pointer to the ListboxItem where the search for the next selected item is to begin.  If this
+		parameter is NULL, the search will begin with the first item in the list box.
+
+	\return
+		Pointer to a ListboxItem based object that is the next selected item in the list after
+		the item specified by \a start_item.  Will return NULL if no further items were selected.
+
+	\exception	InvalidRequestException	thrown if \a start_item is not attached to this list box.
+	*/
+	ListboxItem*	getNextSelected(const ListboxItem* start_item) const;
+
+
+	/*!
+	\brief
+		Return the item at index position \a index.
+
+	\param index
+		Zero based index of the item to be returned.
+
+	\return
+		Pointer to the ListboxItem at index position \a index in the list box.
+
+	\exception	InvalidRequestException	thrown if \a index is out of range.
+	*/
+	ListboxItem*	getListboxItemFromIndex(size_t index) const;
+
+
+	/*!
+	\brief
+		Return the index of ListboxItem \a item
+
+	\param item
+		Pointer to a ListboxItem whos zero based index is to be returned.
+
+	\return
+		Zero based index indicating the position of ListboxItem \a item in the list box.
+
+	\exception	InvalidRequestException	thrown if \a item is not attached to this list box.
+	*/
+	size_t	getItemIndex(const ListboxItem* item) const;
+
+
+	/*!
+	\brief
+		return whether list sorting is enabled
+
+	\return
+		true if the list is sorted, false if the list is not sorted
+	*/
+	bool	isSortEnabled(void) const		{return d_sorted;}
+
+	/*!
+	\brief
+		return whether multi-select is enabled
+
+	\return
+		true if multi-select is enabled, false if multi-select is not enabled.
+	*/
+	bool	isMultiselectEnabled(void) const	{return d_multiselect;}
+
+	bool	isItemTooltipsEnabled(void) const	{return d_itemTooltips;}
+
+	/*!
+	\brief
+		return whether the string at index position \a index is selected
+
+	\param index
+		Zero based index of the item to be examined.
+
+	\return
+		true if the item at \a index is selected, false if the item at \a index is not selected.
+
+	\exception	InvalidRequestException	thrown if \a index is out of range.
+	*/
+	bool	isItemSelected(size_t index) const;
+
+
+	/*!
+	\brief
+		Search the list for an item with the specified text
+
+	\param text
+		String object containing the text to be searched for.
+
+	\param start_item
+		ListboxItem where the search is to begin, the search will not include \a item.  If \a item is
+		NULL, the search will begin from the first item in the list.
+
+	\return
+		Pointer to the first ListboxItem in the list after \a item that has text matching \a text.  If
+		no item matches the criteria NULL is returned.
+
+	\exception	InvalidRequestException	thrown if \a item is not attached to this list box.
+	*/
+	ListboxItem*	findItemWithText(const String& text, const ListboxItem* start_item);
+
+
+	/*!
+	\brief
+		Return whether the specified ListboxItem is in the List
+
+	\return
+		true if ListboxItem \a item is in the list, false if ListboxItem \a item is not in the list.
+	*/
+	bool	isListboxItemInList(const ListboxItem* item) const;
+
+
+	/*!
+	\brief
+		Return whether the vertical scroll bar is always shown.
+
+	\return
+		- true if the scroll bar will always be shown even if it is not required.
+		- false if the scroll bar will only be shown when it is required.
+	*/
+	bool	isVertScrollbarAlwaysShown(void) const;
+
+
+	/*!
+	\brief
+		Return whether the horizontal scroll bar is always shown.
+
+	\return
+		- true if the scroll bar will always be shown even if it is not required.
+		- false if the scroll bar will only be shown when it is required.
+	*/
+	bool	isHorzScrollbarAlwaysShown(void) const;
+
+
+	/*************************************************************************
+		Manipulator Methods
+	*************************************************************************/
+	/*!
+	\brief
+		Initialise the Window based object ready for use.
+
+	\note
+		This must be called for every window created.  Normally this is handled automatically by the WindowFactory for each Window type.
+
+	\return
+		Nothing
+	*/
+	virtual void	initialise(void);
+
+
+	/*!
+	\brief
+		Remove all items from the list.
+
+		Note that this will cause 'AutoDelete' items to be deleted.
+	*/
+	void	resetList(void);
+
+
+	/*!
+	\brief
+		Add the given ListboxItem to the list.
+
+	\param item
+		Pointer to the ListboxItem to be added to the list.  Note that it is the passed object that is added to the
+		list, a copy is not made.  If this parameter is NULL, nothing happens.
+
+	\return
+		Nothing.
+	*/
+	void	addItem(ListboxItem* item);
+
+
+	/*!
+	\brief
+		Insert an item into the list box after a specified item already in the list.
+
+		Note that if the list is sorted, the item may not end up in the requested position.
+
+	\param item
+		Pointer to the ListboxItem to be inserted.  Note that it is the passed object that is added to the
+		list, a copy is not made.  If this parameter is NULL, nothing happens.
+
+	\param position
+		Pointer to a ListboxItem that \a item is to be inserted after.  If this parameter is NULL, the item is
+		inserted at the start of the list.
+
+	\return
+		Nothing.
+	
+	\exception InvalidRequestException	thrown if no ListboxItem \a position is attached to this list box.
+	*/
+	void	insertItem(ListboxItem* item, const ListboxItem* position);
+
+
+	/*!
+	\brief
+		Removes the given item from the list box.  If the item is has the auto delete state set, the item will be deleted.
+
+	\param item
+		Pointer to the ListboxItem that is to be removed.  If \a item is not attached to this list box then nothing
+		will happen.
+
+	\return
+		Nothing.
+	*/
+	void	removeItem(const ListboxItem* item);
+
+
+	/*!
+	\brief
+		Clear the selected state for all items.
+
+	\return
+		Nothing.
+	*/
+	void	clearAllSelections(void);
+
+
+	/*!
+	\brief
+		Set whether the list should be sorted.
+
+	\param setting
+		true if the list should be sorted, false if the list should not be sorted.
+
+	\return
+		Nothing.
+	*/
+	void	setSortingEnabled(bool setting);
+
+	
+	/*!
+	\brief
+		Set whether the list should allow multiple selections or just a single selection
+
+	\param  setting
+		true if the widget should allow multiple items to be selected, false if the widget should only allow
+		a single selection.
+
+	\return
+		Nothing.
+	*/
+	void	setMultiselectEnabled(bool setting);
+
+
+	/*!
+	\brief
+		Set whether the vertical scroll bar should always be shown.
+
+	\param setting
+		true if the vertical scroll bar should be shown even when it is not required.  false if the vertical
+		scroll bar should only be shown when it is required.
+
+	\return
+		Nothing.
+	*/
+	void	setShowVertScrollbar(bool setting);
+
+
+	/*!
+	\brief
+		Set whether the horizontal scroll bar should always be shown.
+
+	\param setting
+		true if the horizontal scroll bar should be shown even when it is not required.  false if the horizontal
+		scroll bar should only be shown when it is required.
+
+	\return
+		Nothing.
+	*/
+	void	setShowHorzScrollbar(bool setting);
+
+	void	setItemTooltipsEnabled(bool setting);
+	/*!
+	\brief
+		Set the select state of an attached ListboxItem.
+
+		This is the recommended way of selecting and deselecting items attached to a list box as it respects the
+		multi-select mode setting.  It is possible to modify the setting on ListboxItems directly, but that approach
+		does not respect the settings of the list box.
+
+	\param item
+		The ListboxItem to be affected.  This item must be attached to the list box.
+
+	\param state
+		true to select the item, false to de-select the item.
+
+	\return
+		Nothing.
+	
+	\exception	InvalidRequestException	thrown if \a item is not attached to this list box.
+	*/
+	void	setItemSelectState(ListboxItem* item, bool state);
+
+
+	/*!
+	\brief
+		Set the select state of an attached ListboxItem.
+
+		This is the recommended way of selecting and deselecting items attached to a list box as it respects the
+		multi-select mode setting.  It is possible to modify the setting on ListboxItems directly, but that approach
+		does not respect the settings of the list box.
+
+	\param item_index
+		The zero based index of the ListboxItem to be affected.  This must be a valid index (0 <= index < getItemCount())
+
+	\param state
+		true to select the item, false to de-select the item.
+
+	\return
+		Nothing.
+	
+	\exception	InvalidRequestException	thrown if \a item_index is out of range for the list box
+	*/
+	void	setItemSelectState(size_t item_index, bool state);
+
+
+	/*!
+	\brief
+		Causes the list box to update it's internal state after changes have been made to one or more
+		attached ListboxItem objects.
+
+		Client code must call this whenever it has made any changes to ListboxItem objects already attached to the
+		list box.  If you are just adding items, or removed items to update them prior to re-adding them, there is
+		no need to call this method.
+
+	\return
+		Nothing.
+	*/
+	void	handleUpdatedItemData(void);
+
+
+	/*!
+	\brief
+		Ensure the item at the specified index is visible within the list box.
+
+	\param item_index
+		Zero based index of the item to be made visible in the list box.  If this value is out of range, the
+		list is always scrolled to the bottom.
+
+	\return
+		Nothing.
+	*/
+	void	ensureItemIsVisible(size_t item_index);
+
+
+	/*!
+	\brief
+		Ensure the item at the specified index is visible within the list box.
+
+	\param item
+		Pointer to the ListboxItem to be made visible in the list box.
+
+	\return
+		Nothing.
+
+	\exception	InvalidRequestException	thrown if \a item is not attached to this list box.
+	*/
+	void	ensureItemIsVisible(const ListboxItem* item);
+
+
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for Listbox base class.
+	*/
+	Listbox(const String& type, const String& name);
+
+
+	/*!
+	\brief
+		Destructor for Listbox base class.
+	*/
+	virtual ~Listbox(void);
+
+
+protected:
+	/*************************************************************************
+		Abstract Implementation Functions (must be provided by derived class)
+	*************************************************************************/
+	/*!
+	\brief
+		Return a Rect object describing, in un-clipped pixels, the window relative area
+		that is to be used for rendering list items.
+
+	\return
+		Rect object describing the area of the Window to be used for rendering
+		list box items.
+	*/
+	virtual	Rect	getListRenderArea(void) const		= 0;
+
+
+	/*!
+	\brief
+		create and return a pointer to a Scrollbar widget for use as vertical scroll bar
+
+	\param name
+	   String holding the name to be given to the created widget component.
+
+	\return
+		Pointer to a Scrollbar to be used for scrolling the list vertically.
+	*/
+	virtual Scrollbar*	createVertScrollbar(const String& name) const		= 0;
+ 
+
+	/*!
+	\brief
+		create and return a pointer to a Scrollbar widget for use as horizontal scroll bar
+
+	\param name
+	   String holding the name to be given to the created widget component.
+
+	\return
+		Pointer to a Scrollbar to be used for scrolling the list horizontally.
+	*/
+	virtual Scrollbar*	createHorzScrollbar(const String& name) const		= 0;
+
+
+	/*!
+	\brief
+		Perform caching of the widget control frame and other 'static' areas.  This
+		method should not render the actual items.  Note that the items are typically
+		rendered to layer 3, other layers can be used for rendering imagery behind and
+		infront of the items.
+
+	\return
+		Nothing.
+	*/
+	virtual	void cacheListboxBaseImagery() = 0;
+
+
+	/*************************************************************************
+		Implementation Functions
+	*************************************************************************/
+	/*!
+	\brief
+		Add list box specific events
+	*/
+	void	addListboxEvents(void);
+
+
+	/*!
+	\brief
+		display required integrated scroll bars according to current state of the list box and update their values.
+	*/
+	void	configureScrollbars(void);
+
+	/*!
+	\brief
+		select all strings between positions \a start and \a end.  (inclusive)
+		including \a end.
+	*/
+	void	selectRange(size_t start, size_t end);
+
+
+	/*!
+	\brief
+		Return the sum of all item heights
+	*/
+	float	getTotalItemsHeight(void) const;
+
+
+	/*!
+	\brief
+		Return the width of the widest item
+	*/
+	float	getWidestItemWidth(void) const;
+
+
+	/*!
+	\brief
+		Clear the selected state for all items (implementation)
+
+	\return
+		true if some selections were cleared, false nothing was changed.
+	*/
+	bool	clearAllSelections_impl(void);
+
+
+	/*!
+	\brief
+		Return the ListboxItem under the given window local pixel co-ordinate.
+
+	\return
+		ListboxItem that is under window pixel co-ordinate \a pt, or NULL if no
+		item is under that position.
+	*/
+	ListboxItem*	getItemAtPoint(const Point& pt) const;
+
+
+	/*!
+	\brief
+		Remove all items from the list.
+
+	\note
+		Note that this will cause 'AutoDelete' items to be deleted.
+
+	\return
+		- true if the list contents were changed.
+		- false if the list contents were not changed (list already empty).
+	*/
+	bool	resetList_impl(void);
+
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"Listbox")	return true;
+		return Window::testClassName_impl(class_name);
+	}
+
+	/*!
+	\brief
+	   Internal handler that is triggered when the user interacts with the scrollbars.
+    */
+    bool handle_scrollChange(const EventArgs& args);
+
+    // overridden from Window base class.
+    void populateRenderCache();
+
+
+	/*************************************************************************
+		New event handlers
+	*************************************************************************/
+	/*!
+	\brief
+		Handler called internally when the list contents are changed
+	*/
+	virtual	void	onListContentsChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called internally when the currently selected item or items changes.
+	*/
+	virtual	void	onSelectionChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called internally when the sort mode setting changes.
+	*/
+	virtual	void	onSortModeChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called internally when the multi-select mode setting changes.
+	*/
+	virtual	void	onMultiselectModeChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called internally when the forced display of the vertical scroll bar setting changes.
+	*/
+	virtual	void	onVertScrollbarModeChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called internally when the forced display of the horizontal scroll bar setting changes.
+	*/
+	virtual	void	onHorzScrollbarModeChanged(WindowEventArgs& e);
+
+
+	/*************************************************************************
+		Overridden Event handlers
+	*************************************************************************/
+	virtual void	onSized(WindowEventArgs& e);
+	virtual void	onMouseButtonDown(MouseEventArgs& e);
+	virtual	void	onMouseWheel(MouseEventArgs& e);
+	virtual void	onMouseMove(MouseEventArgs& e);
+
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	typedef	std::vector<ListboxItem*>	LBItemList;
+	bool	d_sorted;				//!< true if list is sorted
+	bool	d_multiselect;			//!< true if multi-select is enabled
+	bool	d_forceVertScroll;		//!< true if vertical scrollbar should always be displayed
+	bool	d_forceHorzScroll;		//!< true if horizontal scrollbar should always be displayed
+	bool	d_itemTooltips;			//!< true if each item should have an individual tooltip
+	Scrollbar*	d_vertScrollbar;	//!< vertical scroll-bar widget
+	Scrollbar*	d_horzScrollbar;	//!< horizontal scroll-bar widget
+	LBItemList	d_listItems;		//!< list of items in the list box.
+	ListboxItem*	d_lastSelected;	//!< holds pointer to the last selected item (used in range selections)
+
+
+private:
+	/*************************************************************************
+		Static Properties for this class
+	*************************************************************************/
+	static ListboxProperties::Sort					d_sortProperty;
+	static ListboxProperties::MultiSelect			d_multiSelectProperty;
+	static ListboxProperties::ForceVertScrollbar	d_forceVertProperty;
+	static ListboxProperties::ForceHorzScrollbar	d_forceHorzProperty;
+	static ListboxProperties::ItemTooltips			d_itemTooltipsProperty;
+
+	/*************************************************************************
+		Private methods
+	*************************************************************************/
+	void	addListboxProperties(void);
+};
+
+
+/*!
+\brief
+	Helper function used in sorting to compare two list box item text strings
+	via the ListboxItem pointers and return if \a a is less than \a b.
+*/
+bool lbi_less(const ListboxItem* a, const ListboxItem* b);
+
+
+/*!
+\brief
+	Helper function used in sorting to compare two list box item text strings
+	via the ListboxItem pointers and return if \a a is greater than \a b.
+*/
+bool lbi_greater(const ListboxItem* a, const ListboxItem* b);
+
+} // End of  CEGUI namespace section
+
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIListbox_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIListHeader.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIListHeader.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIListHeader.h	(revision 1812)
@@ -0,0 +1,851 @@
+/************************************************************************
+	filename: 	CEGUIListHeader.h
+	created:	13/4/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to base class for ListHeader widget
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIListHeader_h_
+#define _CEGUIListHeader_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIWindow.h"
+#include "elements/CEGUIListHeaderSegment.h"
+#include "elements/CEGUIListHeaderProperties.h"
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	EventArgs class used for segment move (sequence changed) events.
+*/
+class CEGUIEXPORT HeaderSequenceEventArgs : public WindowEventArgs
+{
+public:
+	HeaderSequenceEventArgs(Window* wnd, uint old_idx, uint new_idx) : WindowEventArgs(wnd), d_oldIdx(old_idx), d_newIdx(new_idx) {};
+
+	uint d_oldIdx;		//!< The original column index of the segment that has moved.
+	uint d_newIdx;		//!< The new column index of the segment that has moved.
+};
+
+
+/*!
+\brief
+	Base class for the multi column list header widget.
+*/
+class CEGUIEXPORT ListHeader : public Window
+{
+public:
+	static const String EventNamespace;				//!< Namespace for global events
+
+
+	/*************************************************************************
+		Constants
+	*************************************************************************/
+	// Event names
+	static const String EventSortColumnChanged;			//!< Event fired when the current sort column changes.
+	static const String EventSortDirectionChanged;		//!< Event fired when the sort direction changes.
+	static const String EventSegmentSized;				//!< Event fired when a segment has been sized by the user (e.window is the segment).
+	static const String EventSegmentClicked;				//!< Event fired when a segment has been clicked by the user (e.window is the segment).
+	static const String EventSplitterDoubleClicked;		//!< Event fired when a segment splitter has been double-clicked.  (e.window is the segment).
+	static const String EventSegmentSequenceChanged;		//!< Event fired when the order of the segments has changed.  ('e' is a HeaderSequenceEventArgs&)
+	static const String EventSegmentAdded;				//!< Event fired when a segment is added to the header.
+	static const String EventSegmentRemoved;				//!< Event fired when a segment is removed from the header.
+	static const String EventSortSettingChanged;			//!< Event fired when setting that controls user modification to sort configuration changes.
+	static const String EventDragMoveSettingChanged;		//!< Event fired when setting that controls user drag & drop of segments changes.
+	static const String EventDragSizeSettingChanged;		//!< Event fired when setting that controls user sizing of segments changes.
+	static const String EventSegmentRenderOffsetChanged;	//!< Event fired when the rendering offset for the segments changes.
+
+	// values
+	static const float	ScrollSpeed;				//!< Speed to scroll at when dragging outside header.
+	static const float	MinimumSegmentPixelWidth;	//!< Miniumum width of a segment in pixels.
+
+
+	/*************************************************************************
+		Accessor Methods
+	*************************************************************************/
+	/*!
+	\brief
+		Return the number of columns or segments attached to the header.
+
+	\return
+		uint value equal to the number of columns / segments currently in the header.
+	*/
+	uint	getColumnCount(void) const;
+
+	
+	/*!
+	\brief
+		Return the ListHeaderSegment object for the specified column
+
+	\param column
+		zero based column index of the ListHeaderSegment to be returned.
+
+	\return
+		ListHeaderSegment object at the requested index.
+
+	\exception InvalidRequestException	thrown if column is out of range.
+	*/
+	ListHeaderSegment&	getSegmentFromColumn(uint column) const;
+
+
+	/*!
+	\brief
+		Return the ListHeaderSegment object with the specified ID.
+
+	\param id
+		id code of the ListHeaderSegment to be returned.
+
+	\return
+		ListHeaderSegment object with the ID \a id.  If more than one segment has the same ID, only the first one will
+		ever be returned.
+
+	\exception	InvalidRequestException		thrown if no segment with the requested ID is attached.
+	*/
+	ListHeaderSegment&	getSegmentFromID(uint id) const;
+
+
+	/*!
+	\brief
+		Return the ListHeaderSegment that is marked as being the 'sort key' segment.  There must be at least one segment
+		to successfully call this method.
+
+	\return
+		ListHeaderSegment object which is the sort-key segment.
+
+	\exception	InvalidRequestException		thrown if no segments are attached to the ListHeader.
+	*/
+	ListHeaderSegment&	getSortSegment(void) const;
+
+
+	/*!
+	\brief
+		Return the zero based column index of the specified segment.
+
+	\param segment
+		ListHeaderSegment whos zero based index is to be returned.
+
+	\return
+		Zero based column index of the ListHeaderSegment \a segment.
+
+	\exception	InvalidRequestException		thrown if \a segment is not attached to this ListHeader.
+	*/
+	uint	getColumnFromSegment(const ListHeaderSegment& segment) const;
+
+
+	/*!
+	\brief
+		Return the zero based column index of the segment with the specified ID.
+
+	\param id
+		ID code of the segment whos column index is to be returned.
+
+	\return
+		Zero based column index of the first ListHeaderSegment whos ID matches \a id.
+
+	\exception	InvalidRequestException		thrown if no attached segment has the requested ID.
+	*/
+	uint	getColumnFromID(uint id) const;
+
+
+	/*!
+	\brief
+		Return the zero based index of the current sort column.  There must be at least one segment/column to successfully call this
+		method.
+
+	\return
+		Zero based column index that is the current sort column.
+
+	\exception	InvalidRequestException		thrown if there are no segments / columns in this ListHeader.
+	*/
+	uint	getSortColumn(void) const;
+
+
+	/*!
+	\brief
+		Return the zero based column index of the segment with the specified text.
+
+	\param text
+		String object containing the text to be searched for.
+
+	\return
+		Zero based column index of the segment with the specified text.
+
+	\exception InvalidRequestException	thrown if no attached segments have the requested text.
+	*/
+	uint	getColumnWithText(const String& text) const;
+
+
+	/*!
+	\brief
+		Return the pixel offset to the given ListHeaderSegment.
+
+	\param segment
+		ListHeaderSegment object that the offset to is to be returned.
+
+	\return
+		The number of pixels up-to the begining of the ListHeaderSegment described by \a segment.
+
+	\exception InvalidRequestException	thrown if \a segment is not attached to the ListHeader.
+	*/
+	float	getPixelOffsetToSegment(const ListHeaderSegment& segment) const;
+
+
+	/*!
+	\brief
+		Return the pixel offset to the ListHeaderSegment at the given zero based column index.
+
+	\param column
+		Zero based column index of the ListHeaderSegment whos pixel offset it to be returned.
+
+	\return
+		The number of pixels up-to the begining of the ListHeaderSegment located at zero based column
+		index \a column.
+
+	\exception InvalidRequestException	thrown if \a column is out of range.
+	*/
+	float	getPixelOffsetToColumn(uint column) const;
+
+
+	/*!
+	\brief
+		Return the total pixel width of all attached segments.
+
+	\return
+		Sum of the pixel widths of all attached ListHeaderSegment objects.
+	*/
+	float	getTotalSegmentsPixelExtent(void) const;
+
+
+	/*!
+	\brief
+		Return the pixel width of the specified column.
+
+	\param column
+		Zero based column index of the segment whos pixel width is to be returned.
+
+	\return
+		Pixel width of the ListHeaderSegment at the zero based column index specified by \a column.
+
+	\exception InvalidRequestException	thrown if \a column is out of range.
+	*/
+	float	getColumnPixelWidth(uint column) const;
+
+
+	/*!
+	\brief
+		Return the currently set sort direction.
+
+	\return
+		One of the ListHeaderSegment::SortDirection enumerated values specifying the current sort direction.
+	*/
+	ListHeaderSegment::SortDirection	getSortDirection(void) const;
+
+
+	/*!
+	\brief
+		Return whether user manipulation of the sort column & direction are enabled.
+
+	\return
+		true if the user may interactively modify the sort column and direction.  false if the user may not
+		modify the sort column and direction (these can still be set programmatically).
+	*/
+	bool	isSortingEnabled(void) const;
+
+
+	/*!
+	\brief
+		Return whether the user may size column segments.
+
+	\return
+		true if the user may interactively modify the width of column segments, false if they may not.
+	*/
+	bool	isColumnSizingEnabled(void) const;
+
+
+	/*!
+	\brief
+		Return whether the user may modify the order of the segments.
+
+	\return
+		true if the user may interactively modify the order of the column segments, false if they may not.
+	*/
+	bool	isColumnDraggingEnabled(void) const;
+
+
+	/*!
+	\brief
+		Return the current segment offset value.  This value is used to implement scrolling of the header segments within
+		the ListHeader area.
+
+	\return
+		float value specifying the current segment offset value in whatever metrics system is active for the ListHeader.
+	*/
+	float	getSegmentOffset(void) const	{return d_segmentOffset;}
+
+
+	/*************************************************************************
+		Manipulator Methods
+	*************************************************************************/
+	/*!
+	\brief
+		Set whether user manipulation of the sort column and direction is enabled.
+
+	\param setting
+		- true to allow interactive user manipulation of the sort column and direction.
+		- false to disallow interactive user manipulation of the sort column and direction.
+
+	\return
+		Nothing.
+	*/
+	void	setSortingEnabled(bool setting);
+
+
+	/*!
+	\brief
+		Set the current sort direction.
+
+	\param direction
+		One of the ListHeaderSegment::SortDirection enumerated values indicating the sort direction to be used.
+
+	\return
+		Nothing.
+	*/
+	void	setSortDirection(ListHeaderSegment::SortDirection direction);
+
+
+	/*!
+	\brief
+		Set the column segment to be used as the sort column.
+
+	\param segment
+		ListHeaderSegment object indicating the column to be sorted.
+
+	\return
+		Nothing.
+
+	\exception InvalidRequestException	thrown if \a segment is not attached to this ListHeader.
+	*/
+	void	setSortSegment(const ListHeaderSegment& segment);
+
+
+	/*!
+	\brief
+		Set the column to be used as the sort column.
+
+	\param column
+		Zero based column index indicating the column to be sorted.
+
+	\return
+		Nothing.
+
+	\exception InvalidRequestException	thrown if \a column is out of range for this ListHeader.
+	*/
+	void	setSortColumn(uint column);
+
+
+	/*!
+	\brief
+		Set the column to to be used for sorting via its ID code.
+
+	\param id
+		ID code of the column segment that is to be used as the sort column.
+
+	\return
+		Nothing.
+
+	\exception InvalidRequestException	thrown if no segment with ID \a id is attached to the ListHeader.
+	*/
+	void	setSortColumnFromID(uint id);
+
+
+	/*!
+	\brief
+		Set whether columns may be sized by the user.
+
+	\param setting
+		- true to indicate that the user may interactively size segments.
+		- false to indicate that the user may not interactively size segments.
+
+	\return
+		Nothing.
+	*/
+	void	setColumnSizingEnabled(bool setting);
+
+
+	/*!
+	\brief
+		Set whether columns may be reordered by the user via drag and drop.
+
+	\param setting
+		- true to indicate the user may change the order of the column segments via drag and drop.
+		- false to indicate the user may not change the column segment order.
+
+	\return
+		Nothing.
+	*/
+	void	setColumnDraggingEnabled(bool setting);
+
+
+	/*!
+	\brief
+		Add a new column segment to the end of the header.
+
+	\param text
+		String object holding the initial text for the new segment
+
+	\param id
+		Client specified ID code to be assigned to the new segment.
+
+	\param width
+		Initial width of the new segment using the relative metrics system
+
+	\return
+		Nothing.
+	*/
+	void	addColumn(const String& text, uint id, float width);
+
+
+	/*!
+	\brief
+		Insert a new column segment at the specified position.
+
+	\param text
+		String object holding the initial text for the new segment
+
+	\param id
+		Client specified ID code to be assigned to the new segment.
+
+	\param width
+		Initial width of the new segment using the relative metrics system
+
+	\param position
+		Zero based column index indicating the desired position for the new column.  If this is greater than
+		the current number of columns, the new segment is added to the end if the header.
+
+	\return
+		Nothing.
+	*/
+	void	insertColumn(const String& text, uint id, float width, uint position);
+
+
+	/*!
+	\brief
+		Insert a new column segment at the specified position.
+
+	\param text
+		String object holding the initial text for the new segment
+
+	\param id
+		Client specified ID code to be assigned to the new segment.
+
+	\param width
+		Initial width of the new segment using the relative metrics system
+
+	\param position
+		ListHeaderSegment object indicating the insert position for the new segment.  The new segment will be
+		inserted before the segment indicated by \a position.
+
+	\return
+		Nothing.
+
+	\exception InvalidRequestException	thrown if ListHeaderSegment \a position is not attached to the ListHeader.
+	*/
+	void	insertColumn(const String& text, uint id, float width, const ListHeaderSegment& position);
+
+
+	/*!
+	\brief
+		Removes a column segment from the ListHeader.
+
+	\param column
+		Zero based column index indicating the segment to be removed.
+
+	\return
+		Nothing.
+
+	\exception InvalidRequestException	thrown if \a column is out of range.
+	*/
+	void	removeColumn(uint column);
+
+
+	/*!
+	\brief
+		Remove the specified segment from the ListHeader.
+
+	\param segment
+		ListHeaderSegment object that is to be removed from the ListHeader.
+
+	\return
+		Nothing.
+
+	\exception InvalidRequestException	thrown if \a segment is not attached to this ListHeader.
+	*/
+	void	removeSegment(const ListHeaderSegment& segment);
+
+
+	/*!
+	\brief
+		Moves a column segment into a new position.
+
+	\param column
+		Zero based column index indicating the column segment to be moved.
+
+	\param position
+		Zero based column index indicating the new position for the segment.  If this is greater than the current number of segments,
+		the segment is moved to the end of the header.
+
+	\return
+		Nothing.
+
+	\exception InvalidRequestException thrown if \a column is out of range for this ListHeader.
+	*/
+	void	moveColumn(uint column, uint position);
+
+
+	/*!
+	\brief
+		Move a column segment to a new position.
+
+	\param column
+		Zero based column index indicating the column segment to be moved.
+
+	\param position
+		ListHeaderSegment object indicating the new position for the segment.  The segment at \a column
+		will be moved behind segment \a position (that is, segment \a column will appear to the right of
+		segment \a position).
+
+	\return
+		Nothing.
+
+	\exception InvalidRequestException thrown if \a column is out of range for this ListHeader, or if \a position
+		is not attached to this ListHeader.
+	*/
+	void	moveColumn(uint column, const ListHeaderSegment& position);
+
+
+	/*!
+	\brief
+		Moves a segment into a new position.
+
+	\param segment
+		ListHeaderSegment object that is to be moved.
+
+	\param position
+		Zero based column index indicating the new position for the segment.  If this is greater than the current number of segments,
+		the segment is moved to the end of the header.
+
+	\return
+		Nothing.
+
+	\exception InvalidRequestException thrown if \a segment is not attached to this ListHeader.
+	*/
+	void	moveSegment(const ListHeaderSegment& segment, uint position);
+
+
+	/*!
+	\brief
+		Move a segment to a new position.
+
+	\param segment
+		ListHeaderSegment object that is to be moved.
+
+	\param position
+		ListHeaderSegment object indicating the new position for the segment.  The segment \a segment
+		will be moved behind segment \a position (that is, segment \a segment will appear to the right of
+		segment \a position).
+
+	\return
+		Nothing.
+
+	\exception InvalidRequestException thrown if either \a segment or \a position are not attached to this ListHeader.
+	*/
+	void	moveSegment(const ListHeaderSegment& segment, const ListHeaderSegment& position);
+
+
+	/*!
+	\brief
+		Set the current base segment offset.  (This implements scrolling of the header segments within
+		the header area).
+
+	\param offset
+		New base offset for the first segment.  The segments will of offset to the left by the amount specified.
+		\a offset should be specified using the active metrics system for the ListHeader.
+
+	\return
+		Nothing.
+	*/
+	void	setSegmentOffset(float offset);
+
+
+	/*!
+	\brief
+		Set the pixel width of the specified column.
+
+	\param column
+		Zero based column index of the segment whos pixel width is to be set.
+
+	\param width
+		float value specifying the new pixel width to set for the ListHeaderSegment at the zero based column
+		index specified by \a column.
+
+	\return
+		Nothing
+
+	\exception InvalidRequestException	thrown if \a column is out of range.
+	*/
+	void	setColumnPixelWidth(uint column, float width);
+
+
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for the list header base class.
+	*/
+	ListHeader(const String& type, const String& name);
+
+
+	/*!
+	\brief
+		Destructor for the list header base class.
+	*/
+	virtual ~ListHeader(void);
+
+
+protected:
+	/*************************************************************************
+		Abstract Implementation Methods
+	*************************************************************************/
+	/*!
+	\brief
+		Create and return a pointer to a new ListHeaderSegment based object.
+
+	\param name
+		String object holding the name that should be given to the new Window.
+
+	\return
+		Pointer to an ListHeaderSegment based object of whatever type is appropriate for
+		this ListHeader.
+	*/
+	virtual ListHeaderSegment*	createNewSegment(const String& name) const	= 0;
+
+
+	/*!
+	\brief
+		Cleanup and destroy the given ListHeaderSegment that was created via the
+		createNewSegment method.
+
+	\param segment
+		Pointer to a ListHeaderSegment based object to be destroyed.
+
+	\return
+		Nothing.
+	*/
+	virtual void	destroyListSegment(ListHeaderSegment* segment) const = 0;
+
+
+	/*************************************************************************
+		Implementation Methods
+	*************************************************************************/
+	/*!
+	\brief
+		Create initialise and return a ListHeaderSegment object, with all events subscribed and ready to use.
+	*/
+	ListHeaderSegment*	createInitialisedSegment(const String& text, uint id, float width);
+
+
+	/*!
+	\brief
+		Layout the attached segments
+	*/
+	void	layoutSegments(void);
+
+
+	/*!
+	\brief
+		Add ListHeader specific events
+	*/
+	void	addListHeaderEvents(void);
+
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"ListHeader")	return true;
+		return Window::testClassName_impl(class_name);
+	}
+
+
+	/*************************************************************************
+		New List header event handlers
+	*************************************************************************/
+	/*!
+	\brief
+		Handler called when the sort column is changed.
+	*/
+	virtual	void	onSortColumnChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the sort direction is changed.
+	*/
+	virtual	void	onSortDirectionChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when a segment is sized by the user.  e.window points to the segment.
+	*/
+	virtual	void	onSegmentSized(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when a segment is clicked by the user.  e.window points to the segment.
+	*/
+	virtual	void	onSegmentClicked(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when a segment splitter / sizer is double-clicked.  e.window points to the segment.
+	*/
+	virtual	void	onSplitterDoubleClicked(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the segment / column order changes.
+	*/
+	virtual	void	onSegmentSequenceChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when a new segment is added to the header.
+	*/
+	virtual	void	onSegmentAdded(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when a segment is removed from the header.
+	*/
+	virtual	void	onSegmentRemoved(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called then setting that controls the users ability to modify the search column & direction changes.
+	*/
+	virtual	void	onSortSettingChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the setting that controls the users ability to drag and drop segments changes.
+	*/
+	virtual	void	onDragMoveSettingChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the setting that controls the users ability to size segments changes.
+	*/
+	virtual	void	onDragSizeSettingChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the base rendering offset for the segments (scroll position) changes.
+	*/
+	virtual	void	onSegmentOffsetChanged(WindowEventArgs& e);
+
+
+	/*************************************************************************
+		handlers for events we subscribe to from segments
+	*************************************************************************/
+	bool	segmentSizedHandler(const EventArgs& e);
+	bool	segmentMovedHandler(const EventArgs& e);
+	bool	segmentClickedHandler(const EventArgs& e);
+	bool	segmentDoubleClickHandler(const EventArgs& e);
+	bool	segmentDragHandler(const EventArgs& e);
+
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	typedef	std::vector<ListHeaderSegment*>		SegmentList;
+	SegmentList	d_segments;			//!< Attached segment windows in header order.
+	ListHeaderSegment*	d_sortSegment;	//!< Pointer to the segment that is currently set as the sork-key,
+	bool	d_sizingEnabled;		//!< true if segments can be sized by the user.
+	bool	d_sortingEnabled;		//!< true if the sort criteria modifications by user are enabled (no sorting is actuall done)
+	bool	d_movingEnabled;		//!< true if drag & drop moving of columns / segments is enabled.
+	uint	d_uniqueIDNumber;		//!< field used to create unique names.
+	float	d_segmentOffset;		//!< Base offset used to layout the segments (allows scrolling within the window area)
+	ListHeaderSegment::SortDirection	d_sortDir;		//!< Brief copy of the current sort direction.
+
+
+private:
+	/*************************************************************************
+		Static Properties for this class
+	*************************************************************************/
+	static ListHeaderProperties::SortSettingEnabled		d_sortSettingProperty;
+	static ListHeaderProperties::ColumnsSizable			d_sizableProperty;
+	static ListHeaderProperties::ColumnsMovable			d_movableProperty;
+	static ListHeaderProperties::SortColumnID			d_sortColumnIDProperty;
+	static ListHeaderProperties::SortDirection			d_sortDirectionProperty;
+
+
+	/*************************************************************************
+		Private methods
+	*************************************************************************/
+	void	addHeaderProperties(void);
+};
+
+} // End of  CEGUI namespace section
+
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIListHeader_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIComboboxProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIComboboxProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIComboboxProperties.h	(revision 1812)
@@ -0,0 +1,403 @@
+/************************************************************************
+	filename: 	CEGUIComboboxProperties.h
+	created:	11/7/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to Combobox property classes
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIComboboxProperties_h_
+#define _CEGUIComboboxProperties_h_
+
+#include "CEGUIProperty.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+// Start of ComboboxProperties namespace section
+/*!
+\brief
+	Namespace containing all classes that make up the properties interface for the Combobox class
+*/
+namespace ComboboxProperties
+{
+/*!
+\brief
+	Property to access the read-only setting of the edit box.
+
+	\par Usage:
+		- Name: ReadOnly
+		- Format: "[text]"
+
+	\par Where [Text] is:
+		- "True" to indicate the edit box is read-only.
+		- "False" to indicate the edit box is not read-only (text may be edited by user).
+*/
+class ReadOnly : public Property
+{
+public:
+	ReadOnly() : Property(
+		"ReadOnly",
+		"Property to get/set the read-only setting for the Editbox.  Value is either \"True\" or \"False\".",
+		"False")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the string used for regular expression validation of the edit box text.
+
+	\par Usage:
+		- Name: ValidationString
+		- Format: "[text]"
+
+	\par Where:
+		- [Text] is the string used for validating text entry.
+*/
+class ValidationString : public Property
+{
+public:
+	ValidationString() : Property(
+		"ValidationString",
+		"Property to get/set the validation string Editbox.  Value is a text string.",
+		".*")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the current carat index.
+
+	\par Usage:
+		- Name: CaratIndex
+		- Format: "[uint]"
+
+	\par Where:
+		- [uint] is the zero based index of the carat position within the text.
+*/
+class CaratIndex : public Property
+{
+public:
+	CaratIndex() : Property(
+		"CaratIndex",
+		"Property to get/set the current carat index.  Value is \"[uint]\".",
+		"0")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the current selection start index.
+
+	\par Usage:
+		- Name: EditSelectionStart
+		- Format: "[uint]"
+
+	\par Where:
+		- [uint] is the zero based index of the selection start position within the text.
+*/
+class EditSelectionStart : public Property
+{
+public:
+	EditSelectionStart() : Property(
+		"EditSelectionStart",
+		"Property to get/set the zero based index of the selection start position within the text.  Value is \"[uint]\".",
+		"0")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the current selection length.
+
+	\par Usage:
+		- Name: EditSelectionLength
+		- Format: "[uint]"
+
+	\par Where:
+		- [uint] is the length of the selection (as a count of the number of code points selected).
+*/
+class EditSelectionLength : public Property
+{
+public:
+	EditSelectionLength() : Property(
+		"EditSelectionLength",
+		"Property to get/set the length of the selection (as a count of the number of code points selected).  Value is \"[uint]\".",
+		"0")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the maximum text length for the edit box.
+
+	\par Usage:
+		- Name: MaxEditTextLength
+		- Format: "[uint]"
+
+	\par Where:
+		- [uint] is the maximum allowed text length (as a count of code points).
+*/
+class MaxEditTextLength : public Property
+{
+public:
+	MaxEditTextLength() : Property(
+		"MaxEditTextLength",
+		"Property to get/set the the maximum allowed text length (as a count of code points).  Value is \"[uint]\".",
+		"1073741824")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the normal, unselected, text colour used for rendering text.
+
+	\par Usage:
+		- Name: NormalEditTextColour
+		- Format: "aarrggbb".
+
+	\par Where:
+		- aarrggbb is the ARGB colour value to be used.
+*/
+class NormalEditTextColour : public Property
+{
+public:
+	NormalEditTextColour() : Property(
+		"NormalEditTextColour",
+		"Property to get/set the normal, unselected, text colour used for rendering text.  Value is \"aarrggbb\" (hex).",
+		"00FFFFFF")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the colour used for rendering text within the selection area.
+
+	\par Usage:
+		- Name: SelectedEditTextColour
+		- Format: "aarrggbb".
+
+	\par Where:
+		- aarrggbb is the ARGB colour value to be used.
+*/
+class SelectedEditTextColour : public Property
+{
+public:
+	SelectedEditTextColour() : Property(
+		"SelectedEditTextColour",
+		"Property to get/set the colour used for rendering text within the selection area.  Value is \"aarrggbb\" (hex).",
+		"00000000")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the colour used for rendering the selection highlight when the edit box is active.
+
+	\par Usage:
+		- Name: ActiveEditSelectionColour
+		- Format: "aarrggbb".
+
+	\par Where:
+		- aarrggbb is the ARGB colour value to be used.
+*/
+class ActiveEditSelectionColour : public Property
+{
+public:
+	ActiveEditSelectionColour() : Property(
+		"ActiveEditSelectionColour",
+		"Property to get/set the colour used for rendering the selection highlight when the edit box is active.  Value is \"aarrggbb\" (hex).",
+		"006060FF")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the colour used for rendering the selection highlight when the edit box is inactive.
+
+	\par Usage:
+		- Name: InactiveEditSelectionColour
+		- Format: "aarrggbb".
+
+	\par Where:
+		- aarrggbb is the ARGB colour value to be used.
+*/
+class InactiveEditSelectionColour : public Property
+{
+public:
+	InactiveEditSelectionColour() : Property(
+		"InactiveEditSelectionColour",
+		"Property to get/set the colour used for rendering the selection highlight when the edit box is inactive.  Value is \"aarrggbb\" (hex).",
+		"00808080")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the sort setting of the list box.
+
+	\par Usage:
+		- Name: SortList
+		- Format: "[text]"
+
+	\par Where [Text] is:
+		- "True" to indicate the list items should be sorted.
+		- "False" to indicate the list items should not be sorted.
+*/
+class SortList : public Property
+{
+public:
+	SortList() : Property(
+		"SortList",
+		"Property to get/set the sort setting of the list box.  Value is either \"True\" or \"False\".",
+		"False")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the 'always show' setting for the vertical scroll bar of the list box.
+
+	\par Usage:
+		- Name: ForceVertScrollbar
+		- Format: "[text]"
+
+	\par Where [Text] is:
+		- "True" to indicate that the vertical scroll bar will always be shown.
+		- "False" to indicate that the vertical scroll bar will only be shown when it is needed.
+*/
+class ForceVertScrollbar : public Property
+{
+public:
+	ForceVertScrollbar() : Property(
+		"ForceVertScrollbar",
+		"Property to get/set the 'always show' setting for the vertical scroll bar of the list box.  Value is either \"True\" or \"False\".",
+		"False")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the 'always show' setting for the horizontal scroll bar of the list box.
+
+	\par Usage:
+		- Name: ForceHorzScrollbar
+		- Format: "[text]"
+
+	\par Where [Text] is:
+		- "True" to indicate that the horizontal scroll bar will always be shown.
+		- "False" to indicate that the horizontal scroll bar will only be shown when it is needed.
+*/
+class ForceHorzScrollbar : public Property
+{
+public:
+	ForceHorzScrollbar() : Property(
+		"ForceHorzScrollbar",
+		"Property to get/set the 'always show' setting for the horizontal scroll bar of the list box.  Value is either \"True\" or \"False\".",
+		"False")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the 'single click mode' setting for the combo box.
+
+	\par Usage:
+		- Name: SingleClickMode
+		- Format: "[text]"
+
+	\par Where [Text] is:
+		- "True" to indicate that the box will operate in single click mode
+		- "False" to indicate that the box will not operate in single click mode
+*/
+class SingleClickMode : public Property
+{
+public:
+	SingleClickMode() : Property(
+		"SingleClickMode",
+		"Property to get/set the 'single click mode' setting for the combo box.  Value is either \"True\" or \"False\".",
+		"False")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+} // End of  ComboboxProperties namespace section
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIComboboxProperties_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIStatic.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIStatic.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIStatic.h	(revision 1812)
@@ -0,0 +1,453 @@
+/************************************************************************
+	filename: 	CEGUIStatic.h
+	created:	13/4/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to base class for Static widget
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIStatic_h_
+#define _CEGUIStatic_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIWindow.h"
+#include "CEGUIRenderableFrame.h"
+#include "elements/CEGUIStaticProperties.h"
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Base class for static widgets.
+*/
+class CEGUIEXPORT Static : public Window
+{
+public:
+	static const String EventNamespace;				//!< Namespace for global events
+
+
+	/*************************************************************************
+		Accessors
+	*************************************************************************/
+	/*!
+	\brief
+		Return whether the frame for this static widget is enabled or disabled.
+
+	\return
+		true if the frame is enabled and will be rendered.  false is the frame is disabled and will not be rendered.
+	*/
+	bool	isFrameEnabled(void) const		{return d_frameEnabled;}
+
+
+	/*!
+	\brief
+		Return whether the background for this static widget is enabled to disabled.
+
+	\return
+		true if the background is enabled and will be rendered.  false if the background is disabled and will not be rendered.
+	*/
+	bool	isBackgroundEnabled(void) const		{return d_backgroundEnabled;}
+
+
+	/*!
+	\brief
+		Return a ColourRect object containing the colours used when rendering this widget.
+
+	\return
+		ColourRect object initialised with the colours used when rendering the frame for this widget.
+	*/
+	ColourRect	getFrameColours(void) const		{return d_frameCols;}
+
+
+	/*!
+	\brief
+		Return a ColourRect object containing the colours used when rendering this widget.
+
+	\return
+		ColourRect object initialised with the colours used when rendering the background for this widget.
+	*/
+	ColourRect	getBackgroundColours(void) const		{return d_backgroundCols;}
+
+
+	// overridden so derived classes are auto-clipped to within the inner area of the frame when it's active.
+	virtual Rect	getUnclippedInnerRect(void) const;
+
+
+	/*!
+	\brief
+		Return the Image being used for the specified location of the frame.
+
+	\param location
+		One of the FrameLocation enumerated values specifying the image to be returned.
+
+	\return
+		Pointer to the Image object currently set for the frame location specified in \a location.  May return NULL if no
+		Image is set for the requested position.
+	*/
+	const Image*	getImageForFrameLocation(FrameLocation location) const;
+
+
+	/*!
+	\brief
+		Return the Image currently set as the background image for the widget.
+
+	\return
+		Pointer to the Image object currently set as the background for this StaticWidget.  May return NULL if
+		no Image is currently set.
+	*/
+	const Image* getBackgroundImage(void) const;
+
+
+	/*************************************************************************
+		Manipulators
+	*************************************************************************/
+	/*!
+	\brief
+		Enable or disable rendering of the frame for this static widget.
+
+		Frame imagery can be customised via the setFrameImages method.
+
+	\param setting
+		true to enable rendering of a frame.  false to disable rendering of a frame.
+	*/
+	void	setFrameEnabled(bool setting);
+
+
+	/*!
+	\brief
+		specify the Image objects to use for each part of the frame.  A NULL may be used to omit any part.
+
+	\param topleft
+		Pointer to an Image object to render as the top-left corner of the frame.  Specify NULL to omit this part of the frame.
+
+	\param topright
+		Pointer to an Image object to render as the top-right corner of the frame.  Specify NULL to omit this part of the frame.
+
+	\param bottomleft
+		Pointer to an Image object to render as the bottom-left corner of the frame.  Specify NULL to omit this part of the frame.
+
+	\param bottomright
+		Pointer to an Image object to render as the bottom-right corner of the frame.  Specify NULL to omit this part of the frame.
+
+	\param left
+		Pointer to an Image object to render as the left edge of the frame.  Specify NULL to omit this part of the frame.
+
+	\param top
+		Pointer to an Image object to render as the top edge of the frame.  Specify NULL to omit this part of the frame.
+
+	\param right
+		Pointer to an Image object to render as the right edge of the frame.  Specify NULL to omit this part of the frame.
+
+	\param bottom
+		Pointer to an Image object to render as the bottom edge of the frame.  Specify NULL to omit this part of the frame.
+
+	\return
+		Nothing
+	*/
+	void	setFrameImages(const Image* topleft, const Image* topright, const Image* bottomleft, const Image* bottomright, const Image* left, const Image* top, const Image* right, const Image* bottom);
+
+
+	/*!
+	\brief
+		Sets the colours to be applied when rendering the frame.
+
+	\param colours
+		ColourRect object describing the colours to be used.
+
+	\return 
+		Nothing.
+	*/
+	void	setFrameColours(const ColourRect& colours);
+
+
+	/*!
+	\brief
+		Sets the colours to be applied when rendering the frame.
+
+	\param top_left_colour
+		Colour to be applied to the top-left corner of each Image used in the frame.
+
+	\param top_right_colour
+		Colour to be applied to the top-right corner of each Image used in the frame.
+
+	\param bottom_left_colour
+		Colour to be applied to the bottom-left corner of each Image used in the frame.
+
+	\param bottom_right_colour
+		Colour to be applied to the bottom-right corner of each Image used in the frame.
+
+	\return 
+		Nothing.
+	*/
+	void	setFrameColours(const colour& top_left_colour, const colour& top_right_colour, const colour& bottom_left_colour, const colour& bottom_right_colour);
+
+
+	/*!
+	\brief
+		Sets the colour to be applied when rendering the frame.
+
+	\param col
+		colour value to be used when rendering.
+
+	\return
+		Nothing.
+	*/
+	void	setFrameColours(const colour& col)		{setFrameColours(col, col, col, col);}
+
+
+	/*!
+	\brief
+		Enable or disable rendering of the background for this static widget.
+
+	\param setting
+		true to enable rendering of the background.  false to disable rendering of the background.
+	*/
+	void	setBackgroundEnabled(bool setting);
+
+
+	/*!
+	\brief
+		Set the image to use as the background for the static widget.
+
+	\param image
+		Pointer to the Image object to be rendered.  Can be NULL to specify no image is to be rendered.
+	
+	\return
+		Nothing.
+	*/
+	void	setBackgroundImage(const Image* image);
+
+
+	/*!
+	\brief
+		Set the image to use as the background for the static widget.
+
+	\param imageset
+		String object specifying the name of the Imageset that holds the required image.
+
+	\param image
+		Name of the Image on the specified Imageset that is to be used.
+	
+	\return
+		Nothing.
+
+	\exception UnknownObjectException	thrown if Imageset \a imageset does not exist in the system or if \a imageset contains no Image named \a image.
+	*/
+	void	setBackgroundImage(const String& imageset, const String& image);
+
+
+	/*!
+	\brief
+		Sets the colours to be applied when rendering the background.
+
+	\param colours
+		ColourRect object describing the colours to be used.
+
+	\return 
+		Nothing.
+	*/
+	void	setBackgroundColours(const ColourRect& colours);
+
+
+	/*!
+	\brief
+		Sets the colours to be applied when rendering the background.
+
+	\param top_left_colour
+		Colour to be applied to the top-left corner of the background.
+
+	\param top_right_colour
+		Colour to be applied to the top-right corner of the background.
+
+	\param bottom_left_colour
+		Colour to be applied to the bottom-left corner of the background.
+
+	\param bottom_right_colour
+		Colour to be applied to the bottom-right corner of the background.
+
+	\return 
+		Nothing.
+	*/
+	void	setBackgroundColours(const colour& top_left_colour, const colour& top_right_colour, const colour& bottom_left_colour, const colour& bottom_right_colour);
+
+
+	/*!
+	\brief
+		Sets the colour to be applied when rendering the background.
+
+	\param col
+		colour value to be used when rendering.
+
+	\return
+		Nothing.
+	*/
+	void	setBackgroundColours(const colour& col)		{setBackgroundColours(col, col, col, col);}
+
+
+	/*!
+	\brief
+		Set the Image to use for the specified location of the frame.
+
+	\param location
+		One of the FrameLocation enumerated values specifying the image to be returned.
+
+	\param image
+		Pointer to the Image to use for the frame location specified in \a location.  May be NULL to indicate the
+		frame component is not required.
+
+	\return
+		Nothing.
+	*/
+	void	setImageForFrameLocation(FrameLocation location, const Image* image);
+
+
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for static widget base class
+	*/
+	Static(const String& type, const String& name);
+
+
+	/*!
+	\brief
+		Destructor for static widget base class.
+	*/
+	virtual ~Static(void);
+
+
+protected:
+	/*************************************************************************
+		Overridden from base class
+	*************************************************************************/
+	virtual	void populateRenderCache();
+
+
+	/*************************************************************************
+		Event handling
+	*************************************************************************/
+	virtual void	onSized(WindowEventArgs& e);
+	virtual void	onAlphaChanged(WindowEventArgs& e);
+
+
+	/*************************************************************************
+		Implementation methods
+	*************************************************************************/
+	/*!
+	\brief
+		update the internal RenderableFrame with currently set colours and
+		alpha settings.
+	*/
+	void	updateRenderableFrameColours(void);
+
+
+	/*!
+	\brief
+		return ARGB colour value \a col, with its alpha component modulated by the value specified in float \a alpha.
+	*/
+	colour	calculateModulatedAlphaColour(const colour& col, float alpha) const;
+
+
+	/*!
+	\brief
+		This is used internally to indicate that the frame for the static widget has been modified, and as such
+		derived classes may need to adjust their layouts or reconfigure their rendering somehow.
+	\note
+		This does not currently fire an external event.
+	*/
+	virtual void	onStaticFrameChanged(WindowEventArgs& e)	{}
+
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"Static")	return true;
+		return Window::testClassName_impl(class_name);
+	}
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	bool				d_frameEnabled;		//!< True when the frame is enabled.
+	ColourRect			d_frameCols;		//!< Used to store frame colours.
+	RenderableFrame		d_frame;			//!< Frame object used for rendering a frame for the static element.
+	bool				d_backgroundEnabled;//!< true when the background is enabled.
+	ColourRect			d_backgroundCols;	//!< Colours to use when drawing background.
+	const Image*		d_background;		//!< Image to use for widget background.
+
+	// cache of frame edge sizes
+	float	d_left_width;			//!< Width of the left edge image for the current frame.
+	float	d_right_width;			//!< Width of the right edge image for the current frame.
+	float	d_top_height;			//!< Height of the top edge image for the current frame.
+	float	d_bottom_height;		//!< Height of the bottom edge image for the current frame.
+
+
+private:
+	/*************************************************************************
+		Static Properties for this class
+	*************************************************************************/
+	static StaticProperties::FrameEnabled				d_frameEnabledProperty;
+	static StaticProperties::BackgroundEnabled			d_backgroundEnabledProperty;
+	static StaticProperties::FrameColours				d_frameColoursProperty;
+	static StaticProperties::BackgroundColours			d_backgroundColoursProperty;
+	static StaticProperties::BackgroundImage			d_backgroundImageProperty;
+	static StaticProperties::TopLeftFrameImage			d_topLeftFrameProperty;
+	static StaticProperties::TopRightFrameImage			d_topRightFrameProperty;
+	static StaticProperties::BottomLeftFrameImage		d_bottomLeftFrameProperty;
+	static StaticProperties::BottomRightFrameImage		d_bottomRightFrameProperty;
+	static StaticProperties::LeftFrameImage				d_leftFrameProperty;
+	static StaticProperties::RightFrameImage			d_rightFrameProperty;
+	static StaticProperties::TopFrameImage				d_topFrameProperty;
+	static StaticProperties::BottomFrameImage			d_bottomFrameProperty;
+
+
+	/*************************************************************************
+		Private methods
+	*************************************************************************/
+	void	addStaticProperties(void);
+};
+
+
+} // End of  CEGUI namespace section
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIStatic_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIMenubar.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIMenubar.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIMenubar.h	(revision 1812)
@@ -0,0 +1,119 @@
+/************************************************************************
+	filename: 	CEGUIMenubar.h
+	created:	27/3/2005
+	author:		Tomas Lindquist Olsen (based on code by Paul D Turner)
+	
+	purpose:	Interface to base class for Menubar widget
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIMenubar_h_
+#define _CEGUIMenubar_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIWindow.h"
+#include "elements/CEGUIMenuBase.h"
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+	Base class for menu bars.
+*/
+class CEGUIEXPORT Menubar : public MenuBase
+{
+public:
+	static const String EventNamespace;				//!< Namespace for global events
+
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for Menubar objects
+	*/
+	Menubar(const String& type, const String& name);
+
+
+	/*!
+	\brief
+		Destructor for Menubar objects
+	*/
+	virtual ~Menubar(void);
+
+
+protected:
+	/*************************************************************************
+		Implementation Functions
+	*************************************************************************/
+	/*!
+	\brief
+		Setup size and position for the item widgets attached to this Menubar
+
+	\return
+		Nothing.
+	*/
+	virtual void	layoutItemWidgets();
+
+
+	/*!
+	\brief
+		Resizes the menubar to exactly fit the content that is attached to it.
+
+	\return
+		Nothing.
+	*/
+	virtual Size getContentSize();
+
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"Menubar")	return true;
+		return MenuBase::testClassName_impl(class_name);
+	}
+
+};
+
+} // End of  CEGUI namespace section
+
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIMenubar_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIProgressBar.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIProgressBar.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIProgressBar.h	(revision 1812)
@@ -0,0 +1,222 @@
+/************************************************************************
+	filename: 	CEGUIProgressBar.h
+	created:	13/4/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to base class for ProgressBar widget
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIProgressBar_h_
+#define _CEGUIProgressBar_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIWindow.h"
+#include "elements/CEGUIProgressBarProperties.h"
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Base class for progress bars.
+*/
+class CEGUIEXPORT ProgressBar : public Window
+{
+public:
+	static const String EventNamespace;				//!< Namespace for global events
+
+
+	/*************************************************************************
+		Event name constants
+	*************************************************************************/
+	static const String EventProgressChanged;		//!< Event fired whenever the progress value changes.
+	static const String EventProgressDone;		//!< Event fired when the progress bar reaches 100%.	
+
+
+	/************************************************************************
+		Accessor Functions
+	************************************************************************/
+	/*!
+	\brief
+		return the current progress value
+	*/
+	float	getProgress(void) const		{return d_progress;}
+
+	/*!
+	\brief
+		return the current step size
+	*/
+	float	getStep(void) const			{return d_step;}
+
+
+	/*************************************************************************
+		Manipulator Functions
+	*************************************************************************/
+	/*!
+	\brief
+		set the current progress.
+
+	\param progress
+		The level of progress to set.  If this value is >1.0f (100%) progress will be limited to 1.0f.
+
+	\return
+		Nothing.
+	*/
+	void	setProgress(float progress);
+
+
+	/*!
+	\brief
+		set the size of the 'step' in percentage points (default is 0.01f or 1%).
+
+	\param step
+		Amount to increase the progress by each time the step method is called.
+
+	\return
+		Nothing.
+	*/
+	void	setStepSize(float step_val)		{d_step = step_val;}
+
+
+	/*!
+	\brief
+		cause the progress to step
+
+		The amount the progress bar will step can be changed by calling the setStepSize method.  The
+		default step size is 0.01f which is equal to 1%.
+	
+	\return
+		Nothing.
+	*/
+	void	step(void)			{setProgress(d_progress + d_step);}
+
+
+	/*!
+	\brief
+		Modify the progress level by a specified delta.
+
+	\param delta
+		amount to adjust the progress by.  Whatever this value is, the progress of the bar will be kept
+		within the range: 0.0f <= progress <= 1.0f.
+
+	\return
+		Nothing.
+	*/
+	void	adjustProgress(float delta)		{setProgress(d_progress + delta);}
+
+
+	/*************************************************************************
+		Construction / Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for ProgressBar class
+	*/
+	ProgressBar(const String& type, const String& name);
+
+
+	/*!
+	\brief
+		Destructor for ProgressBar
+	*/
+	virtual ~ProgressBar(void);
+
+
+protected:
+	/*************************************************************************
+		Implementation methods
+	*************************************************************************/
+	/*!
+	\brief
+		Add progress bar specific events to the window
+	*/
+	void	addProgressBarEvents(void);
+
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"ProgressBar")	return true;
+		return Window::testClassName_impl(class_name);
+	}
+
+
+	/*************************************************************************
+		Event handlers for progress bar specific events
+	*************************************************************************/
+	/*!
+	\brief
+		event triggered when progress changes
+	*/
+	virtual	void	onProgressChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		event triggered when progress reaches 100%
+	*/
+	virtual void	onProgressDone(WindowEventArgs& e);
+
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	float	d_progress;		//!< current progress (from 0.0f to 1.0f)
+	float	d_step;			//!< amount to 'step' progress by on a call to step()
+
+
+private:
+	/*************************************************************************
+		Static Properties for this class
+	*************************************************************************/
+	static ProgressBarProperties::CurrentProgress	d_currentProgressProperty;
+	static ProgressBarProperties::StepSize			d_stepSizeProperty;
+
+
+	/*************************************************************************
+		Private methods
+	*************************************************************************/
+	void	addProgressBarProperties(void);
+};
+
+
+} // End of  CEGUI namespace section
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIProgressBar_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUITooltip.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUITooltip.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUITooltip.h	(revision 1812)
@@ -0,0 +1,361 @@
+/************************************************************************
+    filename:   CEGUITooltip.h
+    created:    21/2/2005
+    author:     Paul D Turner
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+ 
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+ 
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+ 
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUITooltip_h_
+#define _CEGUITooltip_h_
+
+#include "CEGUIWindow.h"
+#include "elements/CEGUITooltipProperties.h"
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+    /*!
+    \brief
+        Base class for Tooltip widgets.
+        
+        The Tooltip class shows a simple pop-up window around the mouse position
+        with some text information.  The tool-tip fades in when the user hovers
+        with the mouse over a window which has tool-tip text set, and then fades
+        out after some pre-set time.
+
+    \note
+        For Tooltip to work properly, you must specify a default tool-tip widget
+        type via System::setTooltip, or by setting a custom tool-tip object for
+        your Window(s).  Additionally, you need to ensure that time pulses are
+        properly passed to the system via System::injectTimePulse.
+    */
+    class CEGUIEXPORT Tooltip : public Window
+    {
+    public:
+        /*************************************************************************
+            Constants
+        *************************************************************************/
+        static const String EventNamespace;                 //!< Namespace for global events
+        static const String EventHoverTimeChanged;          //!< Event fired when the hover timeout gets changed.
+        static const String EventDisplayTimeChanged;        //!< Event fired when the display timeout gets changed.
+        static const String EventFadeTimeChanged;           //!< Event fired when the fade timeout gets changed.
+        static const String EventTooltipActive;             //!< Event fired when the tooltip is about to get activated.
+        static const String EventTooltipInactive;           //!< Event fired when the tooltip has been deactivated.
+
+        /************************************************************************
+            Object Construction and Destruction
+        ************************************************************************/
+        /*!
+        \brief
+            Constructor for the Tooltip base class constructor
+         */
+        Tooltip(const String& type, const String& name);
+
+        /*!
+        \brief
+            Destructor for the Tooltip base class.
+         */
+        ~Tooltip(void);
+
+        /************************************************************************
+            Public interface
+        ************************************************************************/
+        /*!
+        \brief
+            Sets the target window for the tooltip.  This used internally to manage tooltips, you
+            should not have to call this yourself.
+
+        \param wnd
+            Window object that the tooltip should be associated with (for now).
+
+        \return
+            Nothing.
+         */
+        void setTargetWindow(Window* wnd);
+
+        /*!
+        \brief
+            return the current target window for this Tooltip.
+
+        \return
+            Pointer to the target window for this Tooltip or 0 for none.
+        */
+        const Window* getTargetWindow();
+
+        /*!
+        \brief
+            Resets the timer on the tooltip when in the Active / Inactive states.  This is used internally
+            to control the tooltip, it is not normally necessary to call this method yourself.
+
+        \return
+            Nothing.
+         */
+        void resetTimer(void);
+
+        /*!
+        \brief
+            Return the number of seconds the mouse should hover stationary over the target window before
+            the tooltip gets activated.
+
+        \return
+            float value representing a number of seconds.
+         */
+        float getHoverTime(void) const;
+
+        /*!
+        \brief
+            Set the number of seconds the tooltip should be displayed for before it automatically
+            de-activates itself.  0 indicates that the tooltip should never timesout and auto-deactivate.
+
+        \param seconds
+            float value representing a number of seconds.
+
+        \return
+            Nothing.
+         */
+        void setDisplayTime(float seconds);
+
+        /*!
+        \brief
+            Return the number of seconds that should be taken to fade the tooltip into and out of
+            visibility.
+
+        \return
+            float value representing a number of seconds.
+         */
+        float getFadeTime(void) const;
+
+        /*!
+        \brief
+            Set the number of seconds the mouse should hover stationary over the target window before
+            the tooltip gets activated.
+
+        \param seconds
+            float value representing a number of seconds.
+
+        \return
+            Nothing.
+         */
+        void setHoverTime(float seconds);
+
+        /*!
+        \brief
+            Return the number of seconds the tooltip should be displayed for before it automatically
+            de-activates itself.  0 indicates that the tooltip never timesout and auto-deactivates.
+
+        \return
+            float value representing a number of seconds.
+         */
+        float getDisplayTime(void) const;
+
+        /*!
+        \brief
+            Set the number of seconds that should be taken to fade the tooltip into and out of
+            visibility.
+
+        \param seconds
+            float value representing a number of seconds.
+
+        \return
+            Nothing.
+         */
+        void setFadeTime(float seconds);
+
+        // 
+        /*!
+        \brief
+            Causes the tooltip to position itself appropriately.
+
+        \return
+            Nothing.
+        */
+        void positionSelf(void);
+
+    protected:
+        /*************************************************************************
+            Implementation Methods
+        *************************************************************************/
+        /*!
+        \brief
+            Add ScrollablePane specific events
+        */
+        void addTooltipEvents(void);
+
+        // methods to perform processing for each of the widget states
+        void doActiveState(float elapsed);
+        void doInactiveState(float elapsed);
+        void doFadeInState(float elapsed);
+        void doFadeOutState(float elapsed);
+
+        // methods to switch widget states
+        void switchToInactiveState(void);
+        void switchToActiveState(void);
+        void switchToFadeInState(void);
+        void switchToFadeOutState(void);
+
+
+		/*!
+		\brief
+			Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+		\param class_name
+			The class name that is to be checked.
+
+		\return
+			true if this window was inherited from \a class_name. false if not.
+		*/
+		virtual bool	testClassName_impl(const String& class_name) const
+		{
+			if (class_name==(const utf8*)"Tooltip")	return true;
+			return Window::testClassName_impl(class_name);
+		}
+
+        /*!
+        \brief
+            Return the size of the area that will be occupied by the tooltip text, given
+            any current formatting options.
+
+        \return
+            Size object describing the size of the rendered tooltip text in pixels.
+        */
+        virtual Size getTextSize() const;
+
+        /*************************************************************************
+            Event triggers
+        *************************************************************************/
+        /*!
+        \brief
+            Event trigger method called when the hover timeout gets changed.
+
+        \param e
+            WindowEventArgs object.
+
+        \return
+            Nothing.
+        */
+        virtual void onHoverTimeChanged(WindowEventArgs& e);
+
+        /*!
+        \brief
+            Event trigger method called when the display timeout gets changed.
+
+        \param e
+            WindowEventArgs object.
+
+        \return
+            Nothing.
+        */
+        virtual void onDisplayTimeChanged(WindowEventArgs& e);
+
+        /*!
+        \brief
+            Event trigger method called when the fade timeout gets changed.
+
+        \param e
+            WindowEventArgs object.
+
+        \return
+            Nothing.
+        */
+        virtual void onFadeTimeChanged(WindowEventArgs& e);
+
+        /*!
+        \brief
+            Event trigger method called just before the tooltip becomes active.
+
+        \param e
+            WindowEventArgs object.
+
+        \return
+            Nothing.
+        */
+        virtual void onTooltipActive(WindowEventArgs& e);
+
+        /*!
+        \brief
+            Event trigger method called just after the tooltip is deactivated.
+
+        \param e
+            WindowEventArgs object.
+
+        \return
+            Nothing.
+        */
+        virtual void onTooltipInactive(WindowEventArgs& e);
+
+
+        /************************************************************************
+            Overridden from Window.
+        ************************************************************************/
+        void updateSelf(float elapsed);
+        void onMouseEnters(MouseEventArgs& e);
+        void onTextChanged(WindowEventArgs& e);
+
+        /************************************************************************
+            Enumerations
+        ************************************************************************/
+        /*!
+        \brief
+            states for tooltip
+         */
+        enum TipState
+        {
+            Inactive,   //!< Tooltip is currently inactive.
+            Active,     //!< Tooltip is currently displayed and active.
+            FadeIn,     //!< Tooltip is currently transitioning from Inactive to Active state.
+            FadeOut     //!< Tooltip is currently transitioning from Active to Inactive state.
+        };
+
+        /************************************************************************
+            Data fields
+        ************************************************************************/
+        TipState    d_state;        //!< Current tooltip state.
+        float       d_elapsed;      //!< Used to track state change timings
+        const Window* d_target;     //!< Current target Window for this Tooltip.
+        float       d_hoverTime;    //!< tool-tip hover time (seconds mouse must stay stationary before tip shows).
+        float       d_displayTime;  //!< tool-tip display time (seconds that tip is showsn for).
+        float       d_fadeTime;     //!< tool-tip fade time (seconds it takes for tip to fade in and/or out).
+
+    private:
+        /*************************************************************************
+            Static Properties for this class
+        *************************************************************************/
+        static TooltipProperties::HoverTime      d_hoverTimeProperty;
+        static TooltipProperties::DisplayTime    d_displayTimeProperty;
+        static TooltipProperties::FadeTime       d_fadeTimeProperty;
+
+        /*************************************************************************
+            Private methods
+        *************************************************************************/
+        void addTooltipProperties(void);
+    };
+
+} // End of  CEGUI namespace section
+
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif  // end of guard _CEGUITooltip_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIDragContainerProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIDragContainerProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIDragContainerProperties.h	(revision 1812)
@@ -0,0 +1,138 @@
+/************************************************************************
+	filename: 	CEGUIDragContainerProperties.h
+	created:	15/2/2005
+	author:		Paul D Turner
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIDragContainerProperties_h_
+#define _CEGUIDragContainerProperties_h_
+
+#include "CEGUIProperty.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+// Start of DragContainerProperties namespace section
+namespace DragContainerProperties
+{
+    /*!
+    \brief
+	    Property to access the state of the dragging enabled setting.
+
+	    \par Usage:
+		    - Name: DraggingEnabled
+		    - Format: "[text]".
+
+	    \par Where [Text] is:
+		    - "True" to indicate that dragging is enabled.
+		    - "False" to indicate that dragging is disabled.
+    */
+    class DraggingEnabled : public Property
+    {
+    public:
+	    DraggingEnabled() : Property(
+		    "DraggingEnabled",
+		    "Property to get/set the state of the dragging enabled setting for the DragContainer.  Value is either \"True\" or \"False\".",
+		    "True")
+	    {}
+
+	    String	get(const PropertyReceiver* receiver) const;
+	    void	set(PropertyReceiver* receiver, const String& value);
+    };
+
+    /*!
+    \brief
+	    Property to access the dragging alpha value.
+
+	    \par Usage:
+		    - Name: DragAlpha
+		    - Format: "[float]".
+
+	    \par Where:
+		    - [float] represents the alpha value to set when dragging.
+    */
+    class DragAlpha : public Property
+    {
+    public:
+	    DragAlpha() : Property(
+		    "DragAlpha",
+		    "Property to get/set the dragging alpha value.  Value is a float.",
+		    "0.500000")
+	    {}
+
+	    String get(const PropertyReceiver* receiver) const;
+	    void set(PropertyReceiver* receiver, const String& value);
+    };
+
+    /*!
+    \brief
+	    Property to access the dragging threshold value.
+
+	    \par Usage:
+		    - Name: DragThreshold
+		    - Format: "[float]".
+
+	    \par Where:
+		    - [float] represents the movement threshold (in pixels) which must be exceeded to commence dragging.
+    */
+    class DragThreshold : public Property
+    {
+    public:
+	    DragThreshold() : Property(
+		    "DragThreshold",
+		    "Property to get/set the dragging threshold value.  Value is a float.",
+		    "8.000000")
+	    {}
+
+	    String get(const PropertyReceiver* receiver) const;
+	    void set(PropertyReceiver* receiver, const String& value);
+    };
+
+    /*!
+    \brief
+	    Property to access the dragging mouse cursor setting.
+
+	    This property offers access to the mouse cursor image used when dragging the DragContainer.
+
+	    \par Usage:
+		    - Name: DragCursorImage
+		    - Format: "set:[text] image:[text]".
+
+	    \par Where:
+		    - set:[text] is the name of the Imageset containing the image.  The Imageset name should not contain spaces.  The Imageset specified must already be loaded.
+		    - image:[text] is the name of the Image on the specified Imageset.  The Image name should not contain spaces.
+    */
+    class DragCursorImage : public Property
+    {
+    public:
+	    DragCursorImage() : Property(
+		    "DragCursorImage",
+		    "Property to get/set the mouse cursor image used when dragging.  Value should be \"set:<imageset name> image:<image name>\".",
+		    "")
+	    {}
+
+	    String	get(const PropertyReceiver* receiver) const;
+	    void	set(PropertyReceiver* receiver, const String& value);
+    };
+
+} // End of  DragContainerProperties namespace section
+} // End of  CEGUI namespace section
+
+#endif	// end of guard _CEGUIDragContainerProperties_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIEditbox.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIEditbox.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIEditbox.h	(revision 1812)
@@ -0,0 +1,715 @@
+/************************************************************************
+	filename: 	CEGUIEditbox.h
+	created:	13/4/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to base class for Editbox widget
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIEditbox_h_
+#define _CEGUIEditbox_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIWindow.h"
+#include "elements/CEGUIEditboxProperties.h"
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+// forward declare implementation data type
+struct RegexValidator;
+
+
+/*!
+\brief
+	Base class for an Editbox widget
+*/
+class CEGUIEXPORT Editbox : public Window
+{
+public:
+	static const String EventNamespace;				//!< Namespace for global events
+
+
+	/*************************************************************************
+		Constants
+	*************************************************************************/
+	// default colours
+	static const argb_t	DefaultNormalTextColour;			//!< Colour applied to normal unselected text.
+	static const argb_t	DefaultSelectedTextColour;			//!< Colour applied to selected text.
+	static const argb_t	DefaultNormalSelectionColour;		//!< Colour applied to normal selection brush.
+	static const argb_t	DefaultInactiveSelectionColour;		//!< Colour applied to selection brush when widget is inactive.
+
+
+	/*************************************************************************
+		Event name constants
+	*************************************************************************/
+	static const String EventReadOnlyModeChanged;			//!< The read-only mode for the edit box has been changed.
+	static const String EventMaskedRenderingModeChanged;	//!< The masked rendering mode (password mode) has been changed.
+	static const String EventMaskCodePointChanged;		//!< The code point (character) to use for masked text has been changed.
+	static const String EventValidationStringChanged;		//!< The validation string has been changed.
+	static const String EventMaximumTextLengthChanged;	//!< The maximum allowable string length has been changed.
+	static const String EventTextInvalidated;				//!< Some operation has made the current text invalid with regards to the validation string.
+	static const String EventInvalidEntryAttempted;		//!< The user attempted to modify the text in a way that would have made it invalid.
+	static const String EventCaratMoved;					//!< The text carat (insert point) has changed.
+	static const String EventTextSelectionChanged;		//!< The current text selection has changed.
+	static const String EventEditboxFull;					//!< The number of characters in the edit box has reached the current maximum.
+	static const String EventTextAccepted;				//!< The user has accepted the current text by pressing Return, Enter, or Tab.
+
+
+	/*************************************************************************
+		Accessor Functions
+	*************************************************************************/
+	/*!
+	\brief
+		return true if the Editbox has input focus.
+
+	\return
+		true if the Editbox has keyboard input focus, false if the Editbox does not have keyboard input focus.
+	*/
+	bool	hasInputFocus(void) const;
+
+
+	/*!
+	\brief
+		return true if the Editbox is read-only.
+
+	\return
+		true if the Editbox is read only and can't be edited by the user, false if the Editbox is not
+		read only and may be edited by the user.
+	*/
+	bool	isReadOnly(void) const		{return d_readOnly;}
+
+
+	/*!
+	\brief
+		return true if the text for the Editbox will be rendered masked.
+
+	\return
+		true if the Editbox text will be rendered masked using the currently set mask code point, false if the Editbox
+		text will be rendered as plain text.
+	*/
+	bool	isTextMasked(void) const	{return	d_maskText;}
+
+
+	/*!
+	\brief
+		return true if the Editbox text is valid given the currently set validation string.
+
+	\note
+		It is possible to programmatically set 'invalid' text for the Editbox by calling setText.  This has certain
+		implications since if invalid text is set, whatever the user types into the box will be rejected when the input
+		is validated.
+
+	\note
+		Validation is performed by means of a regular expression.  If the text matches the regex, the text is said to have passed
+		validation.  If the text does not match with the regex then the text fails validation.
+
+	\return
+		true if the current Editbox text passes validation, false if the text does not pass validation.
+	*/
+	bool	isTextValid(void) const;
+
+
+	/*!
+	\brief
+		return the currently set validation string
+
+	\note
+		Validation is performed by means of a regular expression.  If the text matches the regex, the text is said to have passed
+		validation.  If the text does not match with the regex then the text fails validation.
+
+	\return
+		String object containing the current validation regex data
+	*/
+	const String&	getValidationString(void) const		{return d_validationString;}
+
+
+	/*!
+	\brief
+		return the current position of the carat.
+
+	\return
+		Index of the insert carat relative to the start of the text.
+	*/
+	size_t	getCaratIndex(void) const		{return d_caratPos;}
+
+
+	/*!
+	\brief
+		return the current selection start point.
+
+	\return
+		Index of the selection start point relative to the start of the text.  If no selection is defined this function returns
+		the position of the carat.
+	*/
+	size_t	getSelectionStartIndex(void) const;
+
+
+	/*!
+	\brief
+		return the current selection end point.
+
+	\return
+		Index of the selection end point relative to the start of the text.  If no selection is defined this function returns
+		the position of the carat.
+	*/
+	size_t	getSelectionEndIndex(void) const;
+
+	
+	/*!
+	\brief
+		return the length of the current selection (in code points / characters).
+
+	\return
+		Number of code points (or characters) contained within the currently defined selection.
+	*/
+	size_t	getSelectionLength(void) const;
+
+
+	/*!
+	\brief
+		return the utf32 code point used when rendering masked text.
+
+	\return
+		utf32 code point value representing the Unicode code point that will be rendered instead of the Editbox text
+		when rendering in masked mode.
+	*/
+	utf32	getMaskCodePoint(void) const		{return d_maskCodePoint;}
+
+
+	/*!
+	\brief
+		return the maximum text length set for this Editbox.
+
+	\return
+		The maximum number of code points (characters) that can be entered into this Editbox.
+
+	\note
+		Depending on the validation string set, the actual length of text that can be entered may be less than the value
+		returned here (it will never be more).
+	*/
+	size_t	getMaxTextLength(void) const		{return d_maxTextLen;}
+
+
+	/*!
+	\brief
+		return the currently set colour to be used for rendering Editbox text in the
+		normal, unselected state.
+
+	\return
+		colour value describing the ARGB colour that is currently set.
+	*/
+	colour	getNormalTextColour(void) const				{return d_normalTextColour;}
+
+
+	/*!
+	\brief
+		return the currently set colour to be used for rendering the Editbox text when within the
+		selected region.
+
+	\return
+		colour value describing the ARGB colour that is currently set.
+	*/
+	colour	getSelectedTextColour(void) const			{return d_selectTextColour;}
+
+
+	/*!
+	\brief
+		return the currently set colour to be used for rendering the Editbox selection highlight
+		when the Editbox is active.
+
+	\return
+		colour value describing the ARGB colour that is currently set.
+	*/
+	colour	getNormalSelectBrushColour(void) const		{return d_selectBrushColour;}
+
+
+	/*!
+	\brief
+		return the currently set colour to be used for rendering the Editbox selection highlight
+		when the Editbox is inactive.
+
+	\return
+		colour value describing the ARGB colour that is currently set.
+	*/
+	colour	getInactiveSelectBrushColour(void) const	{return d_inactiveSelectBrushColour;}
+
+
+	/*************************************************************************
+		Manipulators
+	*************************************************************************/
+	/*!
+	\brief
+		Specify whether the Editbox is read-only.
+
+	\param setting
+		true if the Editbox is read only and can't be edited by the user, false if the Editbox is not
+		read only and may be edited by the user.
+
+	\return
+		Nothing.
+	*/
+	void	setReadOnly(bool setting);
+
+
+	/*!
+	\brief
+		Specify whether the text for the Editbox will be rendered masked.
+
+	\param setting
+		true if the Editbox text should be rendered masked using the currently set mask code point, false if the Editbox
+		text should be rendered as plain text.
+
+	\return
+		Nothing.
+	*/
+	void	setTextMasked(bool setting);
+
+
+	/*!
+	\brief
+		Set the text validation string.
+
+	\note
+		Validation is performed by means of a regular expression.  If the text matches the regex, the text is said to have passed
+		validation.  If the text does not match with the regex then the text fails validation.
+
+	\param validation_string
+		String object containing the validation regex data to be used.
+
+	\return
+		Nothing.
+	*/
+	void	setValidationString(const String& validation_string);
+
+
+	/*!
+	\brief
+		Set the current position of the carat.
+
+	\param carat_pos
+		New index for the insert carat relative to the start of the text.  If the value specified is greater than the
+		number of characters in the Editbox, the carat is positioned at the end of the text.
+
+	\return
+		Nothing.
+	*/
+	void	setCaratIndex(size_t carat_pos);
+
+
+	/*!
+	\brief
+		Define the current selection for the Editbox
+
+	\param start_pos
+		Index of the starting point for the selection.  If this value is greater than the number of characters in the Editbox, the
+		selection start will be set to the end of the text.
+
+	\param end_pos
+		Index of the ending point for the selection.  If this value is greater than the number of characters in the Editbox, the
+		selection end will be set to the end of the text.
+
+	\return
+		Nothing.
+	*/
+	void	setSelection(size_t start_pos, size_t end_pos);
+	
+
+	/*!
+	\brief
+		set the utf32 code point used when rendering masked text.
+
+	\param code_point
+		utf32 code point value representing the Unicode code point that should be rendered instead of the Editbox text
+		when rendering in masked mode.
+
+	\return
+		Nothing.
+	*/
+	void	setMaskCodePoint(utf32 code_point);
+
+
+	/*!
+	\brief
+		set the maximum text length for this Editbox.
+
+	\param max_len
+		The maximum number of code points (characters) that can be entered into this Editbox.
+
+	\note
+		Depending on the validation string set, the actual length of text that can be entered may be less than the value
+		set here (it will never be more).
+
+	\return
+		Nothing.
+	*/
+	void	setMaxTextLength(size_t max_len);
+
+
+	/*!
+	\brief
+		Set the colour to be used for rendering Editbox text in the normal, unselected state.
+
+	\param col
+		colour value describing the ARGB colour that is to be used.
+
+	\return
+		Nothing.
+	*/
+	void	setNormalTextColour(const colour& col);
+
+
+	/*!
+	\brief
+		Set the colour to be used for rendering the Editbox text when within the
+		selected region.
+
+	\return
+		colour value describing the ARGB colour that is currently set.
+	*/
+	void	setSelectedTextColour(const colour& col);
+
+
+	/*!
+	\brief
+		Set the colour to be used for rendering the Editbox selection highlight
+		when the Editbox is active.
+
+	\param col
+		colour value describing the ARGB colour that is to be used.
+
+	\return
+		Nothing.
+	*/
+	void	setNormalSelectBrushColour(const colour& col);
+
+
+	/*!
+	\brief
+		Set the colour to be used for rendering the Editbox selection highlight
+		when the Editbox is inactive.
+
+	\param col
+		colour value describing the ARGB colour that is to be used.
+
+	\return
+		Nothing.
+	*/
+	void	setInactiveSelectBrushColour(const colour& col);
+
+
+	/*************************************************************************
+		Construction / Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for Editbox class.
+	*/
+	Editbox(const String& type, const String& name);
+
+
+	/*!
+	\brief
+		Destructor for Editbox class.
+	*/
+	virtual ~Editbox(void);
+
+
+protected:
+	/*************************************************************************
+		Implementation functions
+	*************************************************************************/
+	/*!
+	\brief
+		Add edit box specific events
+	*/
+	void	addEditboxEvents(void);
+
+
+	/*!
+	\brief
+		Return the text code point index that is rendered closest to screen position \a pt.
+
+	\param pt
+		Point object describing a position on the screen in pixels.
+
+	\return
+		Code point index into the text that is rendered closest to screen position \a pt.
+	*/
+	virtual	size_t	getTextIndexFromPosition(const Point& pt) const		= 0;
+
+
+	/*!
+	\brief
+		Clear the current selection setting
+	*/
+	void	clearSelection(void);
+
+
+	/*!
+	\brief
+		Erase the currently selected text.
+
+	\param modify_text
+		when true, the actual text will be modified.  When false, everything is done except erasing the characters.
+	*/
+	void	eraseSelectedText(bool modify_text = true);
+
+
+	/*!
+	\brief
+		return true if the given string matches the validation regular expression.
+	*/
+	bool	isStringValid(const String& str) const;
+
+
+
+	/*!
+	\brief
+		Processing for backspace key
+	*/
+	void	handleBackspace(void);
+
+
+	/*!
+	\brief
+		Processing for Delete key
+	*/
+	void	handleDelete(void);
+
+
+	/*!
+	\brief
+		Processing to move carat one character left
+	*/
+	void	handleCharLeft(uint sysKeys);
+
+
+	/*!
+	\brief
+		Processing to move carat one word left
+	*/
+	void	handleWordLeft(uint sysKeys);
+
+
+	/*!
+	\brief
+		Processing to move carat one character right
+	*/
+	void	handleCharRight(uint sysKeys);
+
+
+	/*!
+	\brief
+		Processing to move carat one word right
+	*/
+	void	handleWordRight(uint sysKeys);
+
+
+	/*!
+	\brief
+		Processing to move carat to the start of the text.
+	*/
+	void	handleHome(uint sysKeys);
+
+
+	/*!
+	\brief
+		Processing to move carat to the end of the text
+	*/
+	void	handleEnd(uint sysKeys);
+
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"Editbox")	return true;
+		return Window::testClassName_impl(class_name);
+	}
+
+
+	/*************************************************************************
+		New event handlers
+	*************************************************************************/
+	/*!
+	\brief
+		Event fired internally when the read only state of the Editbox has been changed
+	*/
+	virtual	void	onReadOnlyChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Event fired internally when the masked rendering mode (password mode) has been changed
+	*/
+	virtual	void	onMaskedRenderingModeChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Event fired internally when the code point to use for masked rendering has been changed.
+	*/
+	virtual	void	onMaskCodePointChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Event fired internally when the validation string is changed.
+	*/
+	virtual	void	onValidationStringChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Event fired internally when the maximum text length for the edit box is changed.
+	*/
+	virtual	void	onMaximumTextLengthChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Event fired internally when something has caused the current text to now fail validation
+
+		This can be caused by changing the validation string or setting a maximum length that causes the
+		current text to be truncated.
+	*/
+	virtual	void	onTextInvalidatedEvent(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Event fired internally when the user attempted to make a change to the edit box that would
+		have caused it to fail validation.
+	*/
+	virtual	void	onInvalidEntryAttempted(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Event fired internally when the carat (insert point) position changes.
+	*/
+	virtual	void	onCaratMoved(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Event fired internally when the current text selection changes.
+	*/
+	virtual	void	onTextSelectionChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Event fired internally when the edit box text has reached the set maximum length.
+	*/
+	virtual	void	onEditboxFullEvent(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Event fired internally when the user accepts the edit box text by pressing Return, Enter, or Tab.
+	*/
+	virtual	void	onTextAcceptedEvent(WindowEventArgs& e);
+
+	
+	/*************************************************************************
+		Overridden event handlers
+	*************************************************************************/
+	virtual	void	onMouseButtonDown(MouseEventArgs& e);
+	virtual void	onMouseButtonUp(MouseEventArgs& e);
+	virtual	void	onMouseDoubleClicked(MouseEventArgs& e);
+	virtual	void	onMouseTripleClicked(MouseEventArgs& e);
+	virtual void	onMouseMove(MouseEventArgs& e);
+	virtual void	onCaptureLost(WindowEventArgs& e);
+	virtual void	onCharacter(KeyEventArgs& e);
+	virtual void	onKeyDown(KeyEventArgs& e);
+	virtual void	onTextChanged(WindowEventArgs& e);
+
+
+	/*************************************************************************
+		Implementation data
+	*************************************************************************/
+	bool	d_readOnly;			//!< True if the editbox is in read-only mode
+	bool	d_maskText;			//!< True if the editbox text should be rendered masked.
+	utf32	d_maskCodePoint;	//!< Code point to use when rendering masked text.
+	size_t	d_maxTextLen;		//!< Maximum number of characters for this Editbox.
+	size_t	d_caratPos;			//!< Position of the carat / insert-point.
+	size_t	d_selectionStart;	//!< Start of selection area.
+	size_t	d_selectionEnd;		//!< End of selection area.
+	String	d_validationString;	//!< Copy of validation reg-ex string.
+	RegexValidator*	d_validator;		//!< RegEx String used for validation of text.
+	bool	d_dragging;			//!< true when a selection is being dragged.
+	size_t	d_dragAnchorIdx;	//!< Selection index for drag selection anchor point.
+
+	// basic rendering colours
+	colour	d_normalTextColour;				//!< Text colour used normally.
+	colour	d_selectTextColour;				//!< Text colour used when text is highlighted
+	colour	d_selectBrushColour;			//!< Colour to apply to the selection brush.
+	colour	d_inactiveSelectBrushColour;	//!< Colour to apply to the selection brush when widget is inactive / read-only.
+
+
+private:
+	/*************************************************************************
+		Static Properties for this class
+	*************************************************************************/
+	static EditboxProperties::ReadOnly					d_readOnlyProperty;
+	static EditboxProperties::MaskText					d_maskTextProperty;
+	static EditboxProperties::MaskCodepoint				d_maskCodepointProperty;
+	static EditboxProperties::ValidationString			d_validationStringProperty;
+	static EditboxProperties::CaratIndex				d_caratIndexProperty;
+	static EditboxProperties::SelectionStart			d_selectionStartProperty;
+	static EditboxProperties::SelectionLength			d_selectionLengthProperty;
+	static EditboxProperties::MaxTextLength				d_maxTextLengthProperty;
+	static EditboxProperties::NormalTextColour			d_normalTextColourProperty;
+	static EditboxProperties::SelectedTextColour		d_selectedTextColourProperty;
+	static EditboxProperties::ActiveSelectionColour		d_activeSelectionColourProperty;
+	static EditboxProperties::InactiveSelectionColour	d_inactiveSelectionColourProperty;
+
+
+	/*************************************************************************
+		Private methods
+	*************************************************************************/
+	void	addEditboxProperties(void);
+};
+
+} // End of  CEGUI namespace section
+
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIEditbox_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIListboxProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIListboxProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIListboxProperties.h	(revision 1812)
@@ -0,0 +1,175 @@
+/************************************************************************
+	filename: 	CEGUIListboxProperties.h
+	created:	11/7/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to Listbox property classes
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIListboxProperties_h_
+#define _CEGUIListboxProperties_h_
+
+#include "CEGUIProperty.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+// Start of ListboxProperties namespace section
+/*!
+\brief
+	Namespace containing all classes that make up the properties interface for the Listbox class
+*/
+namespace ListboxProperties
+{
+/*!
+\brief
+	Property to access the sort setting of the list box.
+
+	\par Usage:
+		- Name: Sort
+		- Format: "[text]"
+
+	\par Where [Text] is:
+		- "True" to indicate the list items should be sorted.
+		- "False" to indicate the list items should not be sorted.
+*/
+class Sort : public Property
+{
+public:
+	Sort() : Property(
+		"Sort",
+		"Property to get/set the sort setting of the list box.  Value is either \"True\" or \"False\".",
+		"False")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the multi-select setting of the list box.
+
+	\par Usage:
+		- Name: MultiSelect
+		- Format: "[text]"
+
+	\par Where [Text] is:
+		- "True" to indicate that multiple items may be selected.
+		- "False" to indicate that only a single item may be selected.
+*/
+class MultiSelect : public Property
+{
+public:
+	MultiSelect() : Property(
+		"MultiSelect",
+		"Property to get/set the multi-select setting of the list box.  Value is either \"True\" or \"False\".",
+		"False")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the 'always show' setting for the vertical scroll bar of the list box.
+
+	\par Usage:
+		- Name: ForceVertScrollbar
+		- Format: "[text]"
+
+	\par Where [Text] is:
+		- "True" to indicate that the vertical scroll bar will always be shown.
+		- "False" to indicate that the vertical scroll bar will only be shown when it is needed.
+*/
+class ForceVertScrollbar : public Property
+{
+public:
+	ForceVertScrollbar() : Property(
+		"ForceVertScrollbar",
+		"Property to get/set the 'always show' setting for the vertical scroll bar of the list box.  Value is either \"True\" or \"False\".",
+		"False")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the 'always show' setting for the horizontal scroll bar of the list box.
+
+	\par Usage:
+		- Name: ForceHorzScrollbar
+		- Format: "[text]"
+
+	\par Where [Text] is:
+		- "True" to indicate that the horizontal scroll bar will always be shown.
+		- "False" to indicate that the horizontal scroll bar will only be shown when it is needed.
+*/
+class ForceHorzScrollbar : public Property
+{
+public:
+	ForceHorzScrollbar() : Property(
+		"ForceHorzScrollbar",
+		"Property to get/set the 'always show' setting for the horizontal scroll bar of the list box.  Value is either \"True\" or \"False\".",
+		"False")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+/*!
+\brief
+Property to access the show item tooltips setting of the list box.
+
+\par Usage:
+- Name: ItemTooltips
+- Format: "[text]"
+
+\par Where [Text] is:
+- "True" to indicate that the tooltip of the list box will be set by the item below the mouse pointer
+- "False" to indicate that the list box has a static tooltip.
+*/
+class ItemTooltips : public Property
+{
+public:
+	ItemTooltips() : Property(
+		"ItemTooltips",
+		"Property to access the show item tooltips setting of the list box.  Value is either \"True\" or \"False\".",
+		"False")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+} // End of  ListboxProperties namespace section
+
+} // End of  CEGUI namespace section
+
+#endif	// end of guard _CEGUIListboxProperties_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIListHeaderProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIListHeaderProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIListHeaderProperties.h	(revision 1812)
@@ -0,0 +1,177 @@
+/************************************************************************
+	filename: 	CEGUIListHeaderProperties.h
+	created:	11/7/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to the properties for the ListHeader class.
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIListHeaderProperties_h_
+#define _CEGUIListHeaderProperties_h_
+
+#include "CEGUIProperty.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+// Start of ListHeaderProperties namespace section
+/*!
+\brief
+	Namespace containing all classes that make up the properties interface for the ListHeader class
+*/
+namespace ListHeaderProperties
+{
+/*!
+\brief
+	Property to access the setting for user sizing of the column headers.
+
+	\par Usage:
+		- Name: ColumnsSizable
+		- Format: "[text]"
+
+	\par Where [Text] is:
+		- "True" to indicate the column headers can be sized by the user.
+		- "False" to indicate the column headers can not be sized by the user.
+*/
+class ColumnsSizable : public Property
+{
+public:
+	ColumnsSizable() : Property(
+		"ColumnsSizable",
+		"Property to get/set the setting for user sizing of the column headers.  Value is either \"True\" or \"False\".",
+		"True")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the setting for user moving of the column headers.
+
+	\par Usage:
+		- Name: ColumnsMovable
+		- Format: "[text]"
+
+	\par Where [Text] is:
+		- "True" to indicate the column headers can be moved by the user.
+		- "False" to indicate the column headers can not be moved by the user.
+*/
+class ColumnsMovable : public Property
+{
+public:
+	ColumnsMovable() : Property(
+		"ColumnsMovable",
+		"Property to get/set the setting for user moving of the column headers.  Value is either \"True\" or \"False\".",
+		"True")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the setting for user modification of the sort column & direction.
+
+	\par Usage:
+		- Name: SortSettingEnabled
+		- Format: "[text]"
+
+	\par Where [Text] is:
+		- "True" to indicate the user may modify the sort column and direction by clicking the header segments.
+		- "False" to indicate the user may not modify the sort column or direction.
+*/
+class SortSettingEnabled : public Property
+{
+public:
+	SortSettingEnabled() : Property(
+		"SortSettingEnabled",
+		"Property to get/set the setting for for user modification of the sort column & direction.  Value is either \"True\" or \"False\".",
+		"True")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the sort direction setting of the list header.
+
+	\par Usage:
+		- Name: SortDirection
+		- Format: "[text]"
+
+	\par Where [Text] is one of:
+		- "Ascending"
+		- "Descending"
+		- "None"
+*/
+class SortDirection : public Property
+{
+public:
+	SortDirection() : Property(
+		"SortDirection",
+		"Property to get/set the sort direction setting of the header.  Value is the text of one of the SortDirection enumerated value names.",
+		"None")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the current sort column (via ID code).
+
+	\par Usage:
+		- Name: SortColumnID
+		- Format: "[uint]".
+
+	\par Where:
+		- [uint] is any unsigned integer value.
+*/
+class SortColumnID : public Property
+{
+public:
+	SortColumnID() : Property(
+		"SortColumnID",
+		"Property to get/set the current sort column (via ID code).  Value is an unsigned integer number.",
+		"0")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+} // End of  ListHeaderProperties namespace section
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIListHeaderProperties_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUITooltipProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUITooltipProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUITooltipProperties.h	(revision 1812)
@@ -0,0 +1,115 @@
+/************************************************************************
+	filename: 	CEGUITooltipProperties.h
+	created:	3/3/2005
+	author:		Paul D Turner
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUITooltipProperties_h_
+#define _CEGUITooltipProperties_h_
+
+#include "CEGUIProperty.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+// Start of TooltipProperties namespace section
+/*!
+\brief
+	Namespace containing all classes that make up the properties interface for the Tooltip class
+*/
+namespace TooltipProperties
+{
+    /*!
+    \brief
+        Property to access the timout that must expire before the tooltip gets activated.
+
+    \par Usage:
+        - Name: HoverTime
+        - Format: "[float]".
+
+    \par Where:
+        - [float] specifies the number of seconds the mouse must hover stationary on a widget before the tooltip gets activated.
+    */
+    class HoverTime : public Property
+    {
+    public:
+        HoverTime() : Property(
+            "HoverTime",
+            "Property to get/set the hover timeout value in seconds.  Value is a float.",
+            "0.400000")
+        {}
+
+        String  get(const PropertyReceiver* receiver) const;
+        void    set(PropertyReceiver* receiver, const String& value);
+    };
+
+    /*!
+    \brief
+        Property to access the time after which the tooltip automatically de-activates itself.
+
+    \par Usage:
+        - Name: DisplayTime
+        - Format: "[float]".
+
+    \par Where:
+        - [float] specifies the number of seconds after which the tooltip will deactivate itself if the mouse has remained stationary.
+    */
+    class DisplayTime : public Property
+    {
+    public:
+        DisplayTime() : Property(
+            "DisplayTime",
+            "Property to get/set the display timeout value in seconds.  Value is a float.",
+            "7.500000")
+        {}
+
+        String  get(const PropertyReceiver* receiver) const;
+        void    set(PropertyReceiver* receiver, const String& value);
+    };
+
+    /*!
+    \brief
+        Property to access the duration of the fade effect for the tooltip.
+
+    \par Usage:
+        - Name: FadeTime
+        - Format: "[float]".
+
+    \par Where:
+        - [float] specifies the number of seconds over which the fade in / fade out effect will happen.
+    */
+    class FadeTime : public Property
+    {
+    public:
+        FadeTime() : Property(
+            "FadeTime",
+            "Property to get/set duration of the fade effect in seconds.  Value is a float.",
+            "0.330000")
+        {}
+
+        String  get(const PropertyReceiver* receiver) const;
+        void    set(PropertyReceiver* receiver, const String& value);
+    };
+
+} // End of  TooltipProperties namespace section
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUITooltipProperties_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIListHeaderSegment.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIListHeaderSegment.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIListHeaderSegment.h	(revision 1812)
@@ -0,0 +1,442 @@
+/************************************************************************
+	filename: 	CEGUIListHeaderSegment.h
+	created:	15/6/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to list header segment class.
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIListHeaderSegment_h_
+#define _CEGUIListHeaderSegment_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIWindow.h"
+#include "elements/CEGUIListHeaderSegmentProperties.h"
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Base class for list header segment window
+*/
+class CEGUIEXPORT ListHeaderSegment : public Window
+{
+public:
+	static const String EventNamespace;				//!< Namespace for global events
+
+
+	/*************************************************************************
+		Constants
+	*************************************************************************/
+	// Event names
+	static const String EventSegmentClicked;				//!< Event fired when the segment is clicked.
+	static const String EventSplitterDoubleClicked;		//!< Event fired when the sizer/splitter is double-clicked.
+	static const String EventSizingSettingChanged;		//!< Event fired when the sizing setting changes.
+	static const String EventSortDirectionChanged;		//!< Event fired when the sort direction value changes.
+	static const String EventMovableSettingChanged;		//!< Event fired when the movable setting changes.
+	static const String EventSegmentDragStart;			//!< Event fired when the segment has started to be dragged.
+	static const String EventSegmentDragStop;				//!< Event fired when segment dragging has stopped (via mouse release).
+	static const String EventSegmentDragPositionChanged;	//!< Event fired when the segment drag position has changed.
+	static const String EventSegmentSized;				//!< Event fired when the segment is sized.
+	static const String EventClickableSettingChanged;		//!< Event fired when the clickable state of the segment changes.
+
+	// Defaults
+	static const float	DefaultSizingArea;		//!< Default size of the sizing area.
+	static const float	SegmentMoveThreshold;	//!< Amount the mouse must be dragged before drag-moving is initiated.
+
+
+	/*************************************************************************
+		Enumerated types
+	*************************************************************************/
+	/*!
+	\brief
+		Enumeration of possible values for sorting direction used with ListHeaderSegment classes
+	*/
+	enum SortDirection
+	{
+		None,		//!< Items under this segment should not be sorted.
+		Ascending,	//!< Items under this segment should be sorted in ascending order.
+		Descending	//!< Items under this segment should be sorted in descending order.
+	};
+
+
+	/*************************************************************************
+		Accessor Methods
+	*************************************************************************/
+	/*!
+	\brief
+		Return whether this segment can be sized.
+
+	\return
+		true if the segment can be horizontally sized, false if the segment can not be horizontally sized.
+	*/
+	bool	isSizingEnabled(void) const			{return d_sizingEnabled;}
+
+
+	/*!
+	\brief
+		Return the current sort direction set for this segment.
+
+		Note that this has no impact on the way the segment functions (aside from the possibility
+		of varied rendering).  This is intended as a 'helper setting' to classes that make use of
+		the ListHeaderSegment objects.
+
+	\return
+		One of the SortDirection enumerated values indicating the current sort direction set for this
+		segment.
+	*/
+	SortDirection	getSortDirection(void) const	{return d_sortDir;}
+
+
+	/*!
+	\brief
+		Return whether drag moving is enabled for this segment.
+
+	\return
+		true if the segment can be drag moved, false if the segment can not be drag moved.
+	*/
+	bool	isDragMovingEnabled(void) const		{return d_movingEnabled;}
+
+
+	/*!
+	\brief
+		Return the current drag move position offset (in pixels relative to the top-left corner of the segment).
+
+	\return
+		Point object describing the drag move offset position.
+	*/
+	const Point&	getDragMoveOffset(void) const	{return d_dragPosition;}
+
+
+	/*!
+	\brief
+		Return whether the segment is clickable.
+
+	\return
+		true if the segment can be clicked, false of the segment can not be clicked (so no highlighting or events will happen).
+	*/
+	bool	isClickable(void) const		{return d_allowClicks;}
+
+
+	/*************************************************************************
+		Manipulator Methods
+	*************************************************************************/
+	/*!
+	\brief
+		Set whether this segment can be sized.
+
+	\param setting
+		true if the segment may be horizontally sized, false if the segment may not be horizontally sized.
+
+	\return
+		Nothing.
+	*/
+	void	setSizingEnabled(bool setting);
+
+
+	/*!
+	\brief
+		Set the current sort direction set for this segment.
+
+		Note that this has no impact on the way the segment functions (aside from the possibility
+		of varied rendering).  This is intended as a 'helper setting' to classes that make use of
+		the ListHeaderSegment objects.
+
+	\param sort_dir
+		One of the SortDirection enumerated values indicating the current sort direction set for this
+		segment.
+
+	\return
+		Nothing
+	*/
+	void	setSortDirection(SortDirection sort_dir);
+
+
+	/*!
+	\brief
+		Set whether drag moving is allowed for this segment.
+
+	\param setting
+		true if the segment may be drag moved, false if the segment may not be drag moved.
+
+	\return
+		Nothing.
+	*/
+	void	setDragMovingEnabled(bool setting);
+
+
+	/*!
+	\brief
+		Set whether the segment is clickable.
+
+	\param setting
+		true if the segment may be clicked, false of the segment may not be clicked (so no highlighting or events will happen).
+
+	\return
+		Nothing.
+	*/
+	void setClickable(bool setting);
+
+
+	/*************************************************************************
+		Construction & Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for list header segment base class
+	*/
+	ListHeaderSegment(const String& type, const String& name);
+
+
+	/*!
+	\brief
+		Destructor for list header segment base class.
+	*/
+	virtual ~ListHeaderSegment(void);
+
+
+protected:
+	/*************************************************************************
+		Implementation Methods
+	*************************************************************************/
+	/*!
+	\brief
+		Add list header segment specific events
+	*/
+	void	addHeaderSegmentEvents(void);
+
+
+	/*!
+	\brief
+		Update state for drag sizing.
+
+	\param local_mouse
+		Mouse position as a pixel offset from the top-left corner of this window.
+
+	\return
+		Nothing.
+	*/
+	void	doDragSizing(const Point& local_mouse);
+
+
+	/*!
+	\brief
+		Update state for drag moving.
+
+	\param local_mouse
+		Mouse position as a pixel offset from the top-left corner of this window.
+
+	\return
+		Nothing.
+	*/
+	void	doDragMoving(const Point& local_mouse);
+
+
+	/*!
+	\brief
+		Initialise the required states to put the widget into drag-moving mode.
+	*/
+	void	initDragMoving(void);
+
+
+	/*!
+	\brief
+		Initialise the required states when we are hovering over the sizing area.
+	*/
+	void	initSizingHoverState(void);
+
+
+	/*!
+	\brief
+		Initialise the required states when we are hovering over the main segment area.
+	*/
+	void	initSegmentHoverState(void);
+
+
+	/*!
+	\brief
+		Return whether the required minimum movement threshold before initiating drag-moving
+		has been exceeded.
+
+	\param local_mouse
+		Mouse position as a pixel offset from the top-left corner of this window.
+
+	\return
+		true if the threshold has been exceeded and drag-moving should be initiated, or false
+		if the threshold has not been exceeded.
+	*/		
+	bool	isDragMoveThresholdExceeded(const Point& local_mouse);
+
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"ListHeaderSegment")	return true;
+		return Window::testClassName_impl(class_name);
+	}
+
+
+	/*************************************************************************
+		New Event Handlers
+	*************************************************************************/
+	/*!
+	\brief
+		Handler called when segment is clicked.
+	*/
+	virtual void	onSegmentClicked(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the sizer/splitter is double-clicked.
+	*/
+	virtual void	onSplitterDoubleClicked(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when sizing setting changes.
+	*/
+	virtual void	onSizingSettingChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the sort direction value changes.
+	*/
+	virtual void	onSortDirectionChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the drag-movable setting is changed.
+	*/
+	virtual void	onMovableSettingChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the user starts dragging the segment.
+	*/
+	virtual void	onSegmentDragStart(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the user stops dragging the segment (releases mouse button)
+	*/
+	virtual void	onSegmentDragStop(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the drag position changes.
+	*/
+	virtual void	onSegmentDragPositionChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the segment is sized.
+	*/
+	virtual void	onSegmentSized(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the clickable setting for the segment changes
+	*/
+	virtual void	onClickableSettingChanged(WindowEventArgs& e);
+
+
+	/*************************************************************************
+		Overridden Event Handlers
+	*************************************************************************/
+	virtual void	onMouseMove(MouseEventArgs& e);
+	virtual void	onMouseButtonDown(MouseEventArgs& e);
+	virtual void	onMouseButtonUp(MouseEventArgs& e);
+	virtual void	onMouseDoubleClicked(MouseEventArgs& e);
+	virtual void	onMouseLeaves(MouseEventArgs& e);
+	virtual void	onCaptureLost(WindowEventArgs& e);
+
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	const Image*	d_sizingMouseCursor;	//!< Image to use for mouse when sizing (typically set by derived class).
+	const Image*	d_movingMouseCursor;	//!< Image to use for mouse when moving (typically set by derived class).
+
+	float	d_splitterSize;		//!< pixel width of the sizing area.
+	bool	d_splitterHover;	//!< True if the mouse is over the splitter
+
+	bool	d_dragSizing;		//!< true when we are being sized.
+	Point	d_dragPoint;		//!< point we are being dragged at when sizing or moving.
+
+	SortDirection	d_sortDir;	//!< Direction for sorting (used for deciding what icon to display).
+
+	bool	d_segmentHover;		//!< true when the mouse is within the segment area (and not in sizing area).
+	bool	d_segmentPushed;	//!< true when the left mouse button has been pressed within the confines of the segment.
+	bool	d_sizingEnabled;	//!< true when sizing is enabled for this segment.
+	bool	d_movingEnabled;	//!< True when drag-moving is enabled for this segment;
+	bool	d_dragMoving;		//!< true when segment is being drag moved.
+	Point	d_dragPosition;		//!< position of dragged segment.
+	bool	d_allowClicks;		//!< true if the segment can be clicked.
+
+
+private:
+	/*************************************************************************
+		Static Properties for this class
+	*************************************************************************/
+	static ListHeaderSegmentProperties::Clickable		d_clickableProperty;
+	static ListHeaderSegmentProperties::Dragable		d_dragableProperty;
+	static ListHeaderSegmentProperties::Sizable			d_sizableProperty;
+	static ListHeaderSegmentProperties::SortDirection	d_sortDirectionProperty;
+
+
+	/*************************************************************************
+		Private methods
+	*************************************************************************/
+	void	addHeaderSegmentProperties(void);
+};
+
+} // End of  CEGUI namespace section
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIListHeaderSegment_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIScrolledContainer.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIScrolledContainer.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIScrolledContainer.h	(revision 1812)
@@ -0,0 +1,271 @@
+/************************************************************************
+	filename: 	CEGUIScrolledContainer.h
+	created:	1/3/2005
+	author:		Paul D Turner
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIScrolledContainer_h_
+#define _CEGUIScrolledContainer_h_
+
+#include "CEGUIWindow.h"
+#include "CEGUIWindowFactory.h"
+#include "elements/CEGUIScrolledContainerProperties.h"
+#include <map>
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+    /*!
+    \brief
+        Helper container window class which is used in the implementation of the
+        ScrollablePane widget class.
+    */
+    class CEGUIEXPORT ScrolledContainer : public Window
+    {
+    public:
+        /*************************************************************************
+            Constants
+        *************************************************************************/
+        static const String WidgetTypeName;     //!< Type name for ScrolledContainer.
+        static const String EventNamespace;     //!< Namespace for global events
+        static const String EventContentChanged;    //!< Event fired whenever some child changes.
+        static const String EventAutoSizeSettingChanged;    //!< Event fired when the autosize setting changes.
+
+        /*************************************************************************
+        	Object construction and destruction
+        *************************************************************************/
+        /*!
+        \brief
+            Constructor for ScrolledContainer objects.
+        */
+        ScrolledContainer(const String& type, const String& name);
+
+        /*!
+        \brief
+            Destructor for ScrolledContainer objects.
+        */
+        ~ScrolledContainer(void);
+
+        /*************************************************************************
+        	Public interface methods
+        *************************************************************************/
+        /*!
+        \brief
+            Return whether the content pane is auto sized.
+
+        \return
+            - true to indicate the content pane will automatically resize itself.
+            - false to indicate the content pane will not automatically resize itself.
+        */
+        bool isContentPaneAutoSized(void) const;
+
+        /*!
+        \brief
+            Set whether the content pane should be auto-sized.
+
+        \param setting
+            - true to indicate the content pane should automatically resize itself.
+            - false to indicate the content pane should not automatically resize itself.
+
+        \return 
+            Nothing.
+        */
+        void setContentPaneAutoSized(bool setting);
+
+        /*!
+        \brief
+            Return the current content pane area for the ScrolledContainer.
+
+        \return
+            Rect object that details the current pixel extents of the content
+            pane represented by this ScrolledContainer.
+        */
+        const Rect& getContentArea(void) const;
+
+        /*!
+        \brief
+            Set the current content pane area for the ScrolledContainer.
+
+        \note
+            If the ScrolledContainer is configured to auto-size the content pane
+            this call will have no effect.
+
+        \param area
+            Rect object that details the pixel extents to use for the content
+            pane represented by this ScrolledContainer.
+
+        \return
+            Nothing.
+        */
+        void setContentArea(const Rect& area);
+
+        /*!
+        \brief
+            Return the current extents of the attached content.
+
+        \return
+            Rect object that describes the pixel extents of the attached
+            child windows.  This is effectively the smallest bounding box
+            that could contain all the attached windows.
+        */
+        Rect getChildExtentsArea(void) const;
+
+    protected:
+        /*************************************************************************
+        	Implementation methods
+        *************************************************************************/
+        /*!
+        \brief
+            Adds events for this widget type.
+        */
+        void addScrolledContainerEvents(void);
+
+
+		/*!
+		\brief
+			Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+		\param class_name
+			The class name that is to be checked.
+
+		\return
+			true if this window was inherited from \a class_name. false if not.
+		*/
+		virtual bool	testClassName_impl(const String& class_name) const
+		{
+			if (class_name==(const utf8*)"ScrolledContainer")	return true;
+			return Window::testClassName_impl(class_name);
+		}
+
+        /*************************************************************************
+        	Implementation of abstract methods from Window
+        *************************************************************************/
+        void drawSelf(float z) {};
+
+        /*************************************************************************
+        	Event trigger methods.
+        *************************************************************************/
+        /*!
+        \brief
+            Notification method called whenever the content size may have changed.
+
+        \param e
+            WindowEventArgs object.
+
+        \return
+            Nothing.
+        */
+        virtual void onContentChanged(WindowEventArgs& e);
+
+        /*!
+        \brief
+            Notification method called whenever the setting that controls whether
+            the content pane is automatically sized is changed.
+
+        \param e
+            WindowEventArgs object.
+
+        \return
+            Nothing.
+        */
+        virtual void onAutoSizeSettingChanged(WindowEventArgs& e);
+
+        /*************************************************************************
+        	Event callbacks
+        *************************************************************************/
+        /*!
+        \brief
+            Method which receives notifications about child windows being moved.
+        */
+        bool handleChildSized(const EventArgs& e);
+
+        /*!
+        \brief
+            Method which receives notifications about child windows being sized.
+        */
+        bool handleChildMoved(const EventArgs& e);
+
+        /*************************************************************************
+        	Overridden from Window.
+        *************************************************************************/
+        Rect getUnclippedInnerRect(void) const;
+        void onChildAdded(WindowEventArgs& e);
+        void onChildRemoved(WindowEventArgs& e);
+        void onParentSized(WindowEventArgs& e);
+
+        /*************************************************************************
+        	Data fields
+        *************************************************************************/
+        typedef std::multimap<Window*, Event::Connection>  ConnectionTracker;
+        ConnectionTracker d_eventConnections;   //!< Tracks event connections we make.
+        Rect d_contentArea;     //!< Holds extents of the content pane.
+        bool d_autosizePane;    //!< true if the pane auto-sizes itself.
+
+    private:
+	    /*************************************************************************
+		    Static Properties for this class
+	    *************************************************************************/
+	    static ScrolledContainerProperties::ContentPaneAutoSized	d_autoSizedProperty;
+	    static ScrolledContainerProperties::ContentArea             d_contentAreaProperty;
+	    static ScrolledContainerProperties::ChildExtentsArea        d_childExtentsAreaProperty;
+
+	    /*************************************************************************
+		    Private methods
+	    *************************************************************************/
+	    void addScrolledContainerProperties(void);
+    };
+
+    /*!
+    \brief
+        Factory class for producing ScrolledContainer windows
+    */
+    class ScrolledContainerFactory : public WindowFactory
+    {
+    public:
+        ScrolledContainerFactory(void) : WindowFactory(ScrolledContainer::WidgetTypeName) { }
+        ~ScrolledContainerFactory(void){}
+
+        Window* createWindow(const String& name)
+        {
+            ScrolledContainer* wnd = new ScrolledContainer(d_type, name);
+            return wnd;
+        }
+
+        void destroyWindow(Window* window)
+        {
+            if (window->getType() == d_type)
+                delete window;
+        }
+
+    };
+
+} // End of  CEGUI namespace section
+
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIScrolledContainer_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIEditboxProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIEditboxProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIEditboxProperties.h	(revision 1812)
@@ -0,0 +1,355 @@
+/************************************************************************
+	filename: 	CEGUIEditboxProperties.h
+	created:	9/7/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to Properties for Editbox class
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIEditboxProperties_h_
+#define _CEGUIEditboxProperties_h_
+
+#include "CEGUIProperty.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+// Start of EditboxProperties namespace section
+/*!
+\brief
+	Namespace containing all classes that make up the properties interface for the Editbox class
+*/
+namespace EditboxProperties
+{
+/*!
+\brief
+	Property to access the read-only setting of the edit box.
+
+	This property offers access to the read-only setting for the Editbox object.
+
+	\par Usage:
+		- Name: ReadOnly
+		- Format: "[text]"
+
+	\par Where [Text] is:
+		- "True" to indicate the edit box is read-only.
+		- "False" to indicate the edit box is not read-only (text may be edited by user).
+*/
+class ReadOnly : public Property
+{
+public:
+	ReadOnly() : Property(
+		"ReadOnly",
+		"Property to get/set the read-only setting for the Editbox.  Value is either \"True\" or \"False\".",
+		"False")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the mask text setting of the edit box.
+
+	This property offers access to the mask text setting for the Editbox object.
+
+	\par Usage:
+		- Name: MaskText
+		- Format: "[text]"
+
+	\par Where [Text] is:
+		- "True" to indicate the text should be masked.
+		- "False" to indicate the text should not be masked.
+*/
+class MaskText : public Property
+{
+public:
+	MaskText() : Property(
+		"MaskText",
+		"Property to get/set the mask text setting for the Editbox.  Value is either \"True\" or \"False\".",
+		"False")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the mask text setting of the edit box.
+
+	This property offers access to the mask text setting for the Editbox object.
+
+	\par Usage:
+		- Name: MaskCodepoint
+		- Format: "[uint]"
+
+	\par Where:
+		- [uint] is the Unicode utf32 value of the codepoint used for masking text.
+*/
+class MaskCodepoint : public Property
+{
+public:
+	MaskCodepoint() : Property(
+		"MaskCodepoint",
+		"Property to get/set the utf32 codepoint value used for masking text.  Value is \"[uint]\".",
+		"42")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the string used for regular expression validation of the edit box text.
+
+	\par Usage:
+		- Name: ValidationString
+		- Format: "[text]"
+
+	\par Where:
+		- [Text] is the string used for validating text entry.
+*/
+class ValidationString : public Property
+{
+public:
+	ValidationString() : Property(
+		"ValidationString",
+		"Property to get/set the validation string Editbox.  Value is a text string.",
+		".*")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the current carat index.
+
+	\par Usage:
+		- Name: CaratIndex
+		- Format: "[uint]"
+
+	\par Where:
+		- [uint] is the zero based index of the carat position within the text.
+*/
+class CaratIndex : public Property
+{
+public:
+	CaratIndex() : Property(
+		"CaratIndex",
+		"Property to get/set the current carat index.  Value is \"[uint]\".",
+		"0")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the current selection start index.
+
+	\par Usage:
+		- Name: SelectionStart
+		- Format: "[uint]"
+
+	\par Where:
+		- [uint] is the zero based index of the selection start position within the text.
+*/
+class SelectionStart : public Property
+{
+public:
+	SelectionStart() : Property(
+		"SelectionStart",
+		"Property to get/set the zero based index of the selection start position within the text.  Value is \"[uint]\".",
+		"0")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the current selection length.
+
+	\par Usage:
+		- Name: SelectionLength
+		- Format: "[uint]"
+
+	\par Where:
+		- [uint] is the length of the selection (as a count of the number of code points selected).
+*/
+class SelectionLength : public Property
+{
+public:
+	SelectionLength() : Property(
+		"SelectionLength",
+		"Property to get/set the length of the selection (as a count of the number of code points selected).  Value is \"[uint]\".",
+		"0")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the maximum text length for the edit box.
+
+	\par Usage:
+		- Name: MaxTextLength
+		- Format: "[uint]"
+
+	\par Where:
+		- [uint] is the maximum allowed text length (as a count of code points).
+*/
+class MaxTextLength : public Property
+{
+public:
+	MaxTextLength() : Property(
+		"MaxTextLength",
+		"Property to get/set the the maximum allowed text length (as a count of code points).  Value is \"[uint]\".",
+		"1073741824")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the normal, unselected, text colour used for rendering text.
+
+	\par Usage:
+		- Name: NormalTextColour
+		- Format: "aarrggbb".
+
+	\par Where:
+		- aarrggbb is the ARGB colour value to be used.
+*/
+class NormalTextColour : public Property
+{
+public:
+	NormalTextColour() : Property(
+		"NormalTextColour",
+		"Property to get/set the normal, unselected, text colour used for rendering text.  Value is \"aarrggbb\" (hex).",
+		"FFFFFFFF")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the colour used for rendering text within the selection area.
+
+	\par Usage:
+		- Name: SelectedTextColour
+		- Format: "aarrggbb".
+
+	\par Where:
+		- aarrggbb is the ARGB colour value to be used.
+*/
+class SelectedTextColour : public Property
+{
+public:
+	SelectedTextColour() : Property(
+		"SelectedTextColour",
+		"Property to get/set the colour used for rendering text within the selection area.  Value is \"aarrggbb\" (hex).",
+		"FF000000")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the colour used for rendering the selection highlight when the edit box is active.
+
+	\par Usage:
+		- Name: ActiveSelectionColour
+		- Format: "aarrggbb".
+
+	\par Where:
+		- aarrggbb is the ARGB colour value to be used.
+*/
+class ActiveSelectionColour : public Property
+{
+public:
+	ActiveSelectionColour() : Property(
+		"ActiveSelectionColour",
+		"Property to get/set the colour used for rendering the selection highlight when the edit box is active.  Value is \"aarrggbb\" (hex).",
+		"FF6060FF")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the colour used for rendering the selection highlight when the edit box is inactive.
+
+	\par Usage:
+		- Name: InactiveSelectionColour
+		- Format: "aarrggbb".
+
+	\par Where:
+		- aarrggbb is the ARGB colour value to be used.
+*/
+class InactiveSelectionColour : public Property
+{
+public:
+	InactiveSelectionColour() : Property(
+		"InactiveSelectionColour",
+		"Property to get/set the colour used for rendering the selection highlight when the edit box is inactive.  Value is \"aarrggbb\" (hex).",
+		"FF808080")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+} // End of  EditboxProperties namespace section
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIEditboxProperties_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIPushButton.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIPushButton.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIPushButton.h	(revision 1812)
@@ -0,0 +1,335 @@
+/************************************************************************
+	filename: 	CEGUIPushButton.h
+	created:	13/4/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to base class for PushButton widget
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIPushButton_h_
+#define _CEGUIPushButton_h_
+
+#include "CEGUIBase.h"
+#include "elements/CEGUIButtonBase.h"
+#include "elements/CEGUIPushButtonProperties.h"
+#include "CEGUIRenderableImage.h"
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+    Base class to provide logic for push button type widgets.
+*/
+class CEGUIEXPORT PushButton : public ButtonBase
+{
+public:
+	static const String EventNamespace;				//!< Namespace for global events
+
+
+	/*************************************************************************
+		Event name constants
+	*************************************************************************/
+	// generated internally by Window
+	static const String EventClicked;					//!< The button was clicked.
+
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for base PushButton class
+	*/
+	PushButton(const String& type, const String& name);
+
+
+	/*!
+	\brief
+		Destructor for PushButton class
+	*/
+	virtual ~PushButton(void);
+
+    /*************************************************************************
+    	Common Public Interface
+    *************************************************************************/
+	/*!
+	\brief
+		return whether or not rendering of the standard imagery is enabled.
+
+	\return
+		true if the standard button imagery will be rendered, false if no standard rendering will be performed.
+	*/
+	bool	isStandardImageryEnabled(void) const;
+
+
+	/*!
+	\brief
+		Return whether of not custom button image areas are auto-scaled to the size of the button.
+
+	\return
+		true if client specified custom image areas are re-sized when the button size changes.  false if image areas will
+		remain unchanged when the button is sized.
+	*/
+	bool	isCustomImageryAutoSized(void) const;
+
+    /*!
+	\brief
+		returns a pointer to a read-only RenderableImage object holding the details
+        of the image set to render for the button in the normal state, or 0 if no
+        image is currently set for this state.
+
+	\return
+		Pointer to a const RenderableImage object with all the details for the image.  
+	*/
+	const RenderableImage*	getNormalImage(void) const;
+
+	/*!
+	\brief
+        returns a pointer to a read-only RenderableImage object holding the details
+        of the image set to render for the button in the highlighted state, or 0 if no
+        image is currently set for this state.
+
+	\return
+		Pointer to a const RenderableImage object with all the details for the image.  
+	*/
+	const RenderableImage*	getHoverImage(void) const;
+
+	/*!
+	\brief
+        returns a pointer to a read-only RenderableImage object holding the details
+        of the image set to render for the button in the pushed state, or 0 if no
+        image is currently set for this state.
+
+	\return
+		Pointer to a const RenderableImage object with all the details for the image.  
+	*/
+	const RenderableImage*	getPushedImage(void) const;
+
+	/*!
+	\brief
+        returns a pointer to a read-only RenderableImage object holding the details
+        of the image set to render for the button in the disabled state, or 0 if no
+        image is currently set for this state.
+
+	\return
+		Pointer to a const RenderableImage object with all the details for the image.  
+	*/
+	const RenderableImage*	getDisabledImage(void) const;
+
+    /*!
+    \brief
+        get the offset that is used to shift of the text in the x-direction
+        this is useful if the button-images are not symmetrical and the
+        text shouldn't be completely centered
+
+    \return
+        the offset relative to the button-size
+    */
+    float   getTextXOffset(void) const;
+
+	/*!
+	\brief
+		set whether or not to render the standard imagery for the button
+
+	\param setting
+		true to have the standard button imagery drawn, false to have no standard imagery drawn.
+
+	\return
+		Nothing.
+	*/
+	void	setStandardImageryEnabled(bool setting);
+
+	/*!
+	\brief
+		Set whether to auto re-size custom image areas when the button is sized.
+
+	\param setting
+		true to have custom image areas auto-sized.  false to have system leave image areas untouched.
+
+	\return
+		Nothing.
+	*/
+	void	setCustomImageryAutoSized(bool setting);
+
+	/*!
+	\brief
+		set the details of the image to render for the button in the normal state.
+
+	\param image
+		RenderableImage object with all the details for the image.  Note that an internal copy of the Renderable image is made and
+		ownership of \a image remains with client code.  If this parameter is NULL, rendering of an image for this button state is
+		disabled.
+
+	\return
+		Nothing.
+	*/
+	void	setNormalImage(const RenderableImage* image);
+
+	/*!
+	\brief
+		set the details of the image to render for the button in the highlighted state.
+
+	\param image
+		RenderableImage object with all the details for the image.  Note that an internal copy of the Renderable image is made and
+		ownership of \a image remains with client code.  If this parameter is NULL, rendering of an image for this button state is
+		disabled.
+
+	\return
+		Nothing.
+	*/
+	void	setHoverImage(const RenderableImage* image);
+
+	/*!
+	\brief
+		set the details of the image to render for the button in the pushed state.
+
+	\param image
+		RenderableImage object with all the details for the image.  Note that an internal copy of the Renderable image is made and
+		ownership of \a image remains with client code.  If this parameter is NULL, rendering of an image for this button state is
+		disabled.
+
+	\return
+		Nothing.
+	*/
+	void	setPushedImage(const RenderableImage* image);
+
+	/*!
+	\brief
+		set the details of the image to render for the button in the disabled state.
+
+	\param image
+		RenderableImage object with all the details for the image.  Note that an internal copy of the Renderable image is made and
+		ownership of \a image remains with client code.  If this parameter is NULL, rendering of an image for this button state is
+		disabled.
+
+	\return
+		Nothing.
+	*/
+	void	setDisabledImage(const RenderableImage* image);
+
+    /*!
+    \brief
+        set the offset to use for a shift of the text in the x-direction
+        this is useful if the button-images are not symmetrical and the
+        text shouldn't be completely centered
+
+    \param offset
+        The offset to use. This is relative to the button-width
+
+    \return
+        Nothing.
+    */
+    void   setTextXOffset(float offset);
+
+protected:
+	/*************************************************************************
+		New Event Handlers
+	*************************************************************************/
+	/*!
+	\brief
+		handler invoked internally when the button is clicked.
+	*/
+	virtual void	onClicked(WindowEventArgs& e);
+
+
+	/*************************************************************************
+		Overridden Event Handlers
+	*************************************************************************/
+	virtual void	onMouseButtonUp(MouseEventArgs& e);
+    virtual void    onSized(WindowEventArgs& e);
+
+
+	/*************************************************************************
+		Implementation Functions
+	*************************************************************************/
+	/*!
+	\brief
+		Add button specific events
+	*/
+	void	addPushButtonEvents(void);
+
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"PushButton")	return true;
+		return ButtonBase::testClassName_impl(class_name);
+	}
+
+
+    /*************************************************************************
+    	Data Fields
+    *************************************************************************/
+    // flags stating which imagery is to be rendered and how.
+    bool	d_autoscaleImages;				//!< when true custom images will be scaled to the same size as the button
+    bool	d_useStandardImagery;			//!< true if button standard imagery should be drawn.
+    bool	d_useNormalImage;				//!< true if an image should be drawn for the normal state.
+    bool	d_useHoverImage;				//!< true if an image should be drawn for the highlighted state.
+    bool	d_usePushedImage;				//!< true if an image should be drawn for the pushed state.
+    bool	d_useDisabledImage;				//!< true if an image should be drawn for the disabled state.
+
+    // button RenderableImage objects
+    RenderableImage		d_normalImage;		//!< RenderableImage used when rendering an image in the normal state.
+    RenderableImage		d_hoverImage;		//!< RenderableImage used when rendering an image in the highlighted state.
+    RenderableImage		d_pushedImage;		//!< RenderableImage used when rendering an image in the pushed state.
+    RenderableImage		d_disabledImage;	//!< RenderableImage used when rendering an image in the disabled state.
+
+    //text-offset
+    float d_textXOffset;		//!< offset applied to the x co-ordinate of the text label.
+
+private:
+    /*************************************************************************
+        Static Properties for this class
+    *************************************************************************/
+    static PushButtonProperties::NormalImage    d_normalImageProperty;
+    static PushButtonProperties::PushedImage    d_pushedImageProperty;
+    static PushButtonProperties::HoverImage     d_hoverImageProperty;
+    static PushButtonProperties::DisabledImage  d_disabledImageProperty;
+    static PushButtonProperties::UseStandardImagery d_useStandardImageryProperty;
+    static PushButtonProperties::TextXOffset    d_textXOffsetProperty;
+
+    /*************************************************************************
+        Private methods
+    *************************************************************************/
+    void	addPushButtonProperties(void);
+};
+
+
+} // End of  CEGUI namespace section
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIPushButton_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIMenuBaseProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIMenuBaseProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIMenuBaseProperties.h	(revision 1812)
@@ -0,0 +1,189 @@
+/************************************************************************
+	filename: 	CEGUIMenuBaseProperties.h
+	created:	5/4/2005
+	author:		Tomas Lindquist Olsen (based on code by Paul D Turner)
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIMenuBaseProperties_h_
+#define _CEGUIMenuBaseProperties_h_
+
+#include "CEGUIProperty.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+// Start of ItemListBaseProperties namespace section
+namespace MenuBaseProperties
+{
+
+/*!
+\brief
+	Property to access the item spacing of the menu.
+
+	\par Usage:
+		- Name: ItemSpacing
+		- Format: "[float]".
+
+	\par Where:
+		- [float] represents the item spacing of the menu.
+*/
+class ItemSpacing : public Property
+{
+public:
+	ItemSpacing() : Property(
+		"ItemSpacing",
+		"Property to get/set the item spacing of the menu.  Value is a float.",
+		"10.000000")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the horz padding value of the menu.
+
+	\par Usage:
+		- Name: HorzPadding
+		- Format: "[float]".
+
+	\par Where:
+		- [float] represents the horz padding of the slider.
+*/
+class HorzPadding : public Property
+{
+public:
+	HorzPadding() : Property(
+		"HorzPadding",
+		"Property to get/set the horizontal padding of the menu.  Value is a float.",
+		"3.000000")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the vert padding value of the menu.
+
+\par Usage:
+	- Name: VertPadding
+	- Format: "[float]".
+
+\par Where:
+	- [float] represents the vert padding of the slider.
+*/
+class VertPadding : public Property
+{
+public:
+	VertPadding() : Property(
+		"VertPadding",
+		"Property to get/set the vertical padding of the menu.  Value is a float.",
+		"3.000000")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the border width of the menu.
+
+\par Usage:
+	- Name: BorderWidth
+	- Format: "[float]".
+
+\par Where:
+	- [float] represents the border width of the slider.
+*/
+class BorderWidth : public Property
+{
+public:
+	BorderWidth() : Property(
+		"BorderWidth",
+		"Property to get/set the border width of the menu.  Value is a float.",
+		"5.000000")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the background colours of the menu.
+
+\par Usage:
+	- Name: BackgroundColours
+	- Format: "tl:aarrggbb tr:aarrggbb bl:aarrggbb br:aarrggbb".
+
+\par Where:
+	- aarrggbb is the ARGB colour value to be used for each corner of the ColourRect
+*/
+class BackgroundColours : public Property
+{
+public:
+	BackgroundColours() : Property(
+		"BackgroundColours",
+		"Property to get/set the background colours of the menu.  Value is a ColourRect.",
+		"tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+    Property to access the state of the allow multiple popups setting.
+
+    \par Usage:
+	    - Name: AllowMultiplePopups
+	    - Format: "[text]".
+
+    \par Where [Text] is:
+	    - "True" to indicate that auto resizing is enabled.
+	    - "False" to indicate that auto resizing is disabled.
+*/
+class AllowMultiplePopups : public Property
+{
+public:
+    AllowMultiplePopups() : Property(
+	    "AllowMultiplePopups",
+	    "Property to get/set the state of the allow multiple popups setting for the menu.  Value is either \"True\" or \"False\".",
+	    "False")
+    {}
+
+    String	get(const PropertyReceiver* receiver) const;
+    void	set(PropertyReceiver* receiver, const String& value);
+};
+
+} // End of  MenuBaseProperties namespace section
+} // End of  CEGUI namespace section
+
+#endif	// end of guard _CEGUIMenuBaseProperties_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUISpinner.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUISpinner.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUISpinner.h	(revision 1812)
@@ -0,0 +1,425 @@
+/************************************************************************
+    filename: 	CEGUISpinner.h
+    created:	3/2/2005
+    author:		Paul D Turner
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUISpinner_h_
+#define _CEGUISpinner_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIWindow.h"
+#include "elements/CEGUISpinnerProperties.h"
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+    /*!
+    \brief
+        Base class for the Spinner widget.
+
+        The spinner widget has a text area where numbers may be entered
+        and two buttons which may be used to increase or decrease the
+        value in the text area by a user specified amount.
+    */
+    class CEGUIEXPORT Spinner : public Window
+    {
+    public:
+        /*!
+        \brief
+            Enumerated type specifying possible input and/or display modes for the spinner.
+        */
+        enum TextInputMode
+        {
+            FloatingPoint,  //!< Floating point decimal.
+            Integer,        //!< Integer decimal.
+            Hexadecimal,    //!< Hexadecimal.
+            Octal           //!< Octal
+        };
+
+        /*************************************************************************
+            Events system constants
+        *************************************************************************/
+        static const String EventNamespace;                 //!< Namespace for global events
+        static const String EventValueChanged;              //!< Event fired when the spinner value changes.
+        static const String EventStepChanged;               //!< Event fired when the step value changes.
+        static const String EventMaximumValueChanged;       //!< Event fired when the maximum spinner value changes.
+        static const String EventMinimumValueChanged;       //!< Event fired when the minimum spinner value changes.
+        static const String EventTextInputModeChanged;      //!< Event fired when the input/display mode is changed.
+
+        /*************************************************************************
+            Object Construction and Destruction
+        *************************************************************************/
+        /*!
+        \brief
+            Constructor for Spinner objects
+        */
+        Spinner(const String& type, const String& name);
+
+        /*!
+        \brief
+            Destructor for Spinner objects
+        */
+        virtual ~Spinner(void);
+
+	    /*!
+	    \brief
+		    Initialises the Window based object ready for use.
+
+	    \note
+		    This must be called for every window created.  Normally this is handled automatically by the WindowFactory for each Window type.
+
+	    \return
+		    Nothing
+	    */
+        void initialise(void);
+
+
+        /*************************************************************************
+        	Accessors
+        *************************************************************************/
+        /*!
+        \brief
+            Return the current spinner value.
+
+        \return
+            current float value of the Spinner.
+        */
+        float getCurrentValue(void) const;
+
+        /*!
+        \brief
+            Return the current step value.
+
+        \return
+            float step value.  This is the value added to the spinner vaue when the
+            up / down buttons are clicked.
+        */
+        float getStepSize(void) const;
+
+        /*!
+        \brief
+            Return the current maximum limit value for the Spinner.
+
+        \return
+            Maximum value that is allowed for the spinner.
+        */
+        float getMaximumValue(void) const;
+
+        /*!
+        \brief
+            Return the current minimum limit value for the Spinner.
+
+        \return
+            Minimum value that is allowed for the spinner.
+        */
+        float getMinimumValue(void) const;
+
+        /*!
+        \brief
+            Return the current text input / display mode setting.
+
+        \return
+            One of the TextInputMode enumerated values indicating the current
+            text input and display mode.
+        */
+        TextInputMode getTextInputMode(void) const;
+
+        /*************************************************************************
+        	Manipulators
+        *************************************************************************/
+        /*!
+        \brief
+            Set the current spinner value.
+
+        \param value
+            value to be assigned to the Spinner.
+
+        \return
+            Nothing.
+        */
+        void setCurrentValue(float value);
+
+        /*!
+        \brief
+            Set the current step value.
+
+        \param step
+            The value added to be the spinner value when the
+            up / down buttons are clicked.
+
+        \return
+            Nothing.
+        */
+        void setStepSize(float step);
+
+        /*!
+        \brief
+            Set the spinner maximum value.
+
+        \param maxValue
+            The maximum value to be allowed by the spinner.
+
+        \return
+            Nothing.
+        */
+        void setMaximumValue(float maxValue);
+
+        /*!
+        \brief
+            Set the spinner minimum value.
+
+        \param minVaue
+            The minimum value to be allowed by the spinner.
+
+        \return
+            Nothing.
+        */
+        void setMinimumValue(float minVaue);
+
+        /*!
+        \brief
+            Set the spinner input / display mode.
+
+        \param mode
+            One of the TextInputMode enumerated values indicating the text
+            input / display mode to be used by the spinner.
+
+        \return
+            Nothing.
+        */
+        void setTextInputMode(TextInputMode mode);
+
+    protected:
+        /*************************************************************************
+        	Constants
+        *************************************************************************/
+        static const String FloatValidator;      //!< Validator regex used for floating point mode.
+        static const String IntegerValidator;    //!< Validator regex used for decimal integer mode.
+        static const String HexValidator;        //!< Validator regex used for hexadecimal mode.
+        static const String OctalValidator;      //!< Validator regex used for octal mode.
+
+        /*************************************************************************
+        	Protected Implementation Methods
+        *************************************************************************/
+        /*!
+        \brief
+            Adds events specific to the Spinner base class.
+        
+        \return
+            Nothing.
+        */
+        void addSpinnerEvents(void);
+
+        /*!
+        \brief
+            Returns the numerical representation of the current editbox text.
+
+        \return
+            float value that is the numerical equivalent of the editbox text.
+
+        \exception InvalidRequestException  thrown if the text can not be converted.
+        */
+        virtual float getValueFromText(void) const;
+
+        /*!
+        \brief
+            Returns the textual representation of the current spinner value.
+
+        \return
+            String object that is equivalent to the the numerical value of the spinner.
+        */
+        virtual String getTextFromValue(void) const;
+
+
+		/*!
+		\brief
+			Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+		\param class_name
+			The class name that is to be checked.
+
+		\return
+			true if this window was inherited from \a class_name. false if not.
+		*/
+		virtual bool	testClassName_impl(const String& class_name) const
+		{
+			if (class_name==(const utf8*)"Spinner")	return true;
+			return Window::testClassName_impl(class_name);
+		}
+
+
+        /*************************************************************************
+        	Abstract Implementation methods
+        *************************************************************************/
+        /*!
+        \brief
+            Creates a PushButton based widget that will be used for the increase
+            button component of the Spinner widget.
+
+        \return
+            Pointer to a valid PushButton based object.
+        */
+        virtual PushButton* createIncreaseButton(const String& name) const = 0;
+
+        /*!
+        \brief
+            Creates a PushButton based widget that will be used for the decrease
+            button component of the Spinner widget.
+
+        \return
+            Pointer to a valid PushButton based object.
+        */
+        virtual PushButton* createDecreaseButton(const String& name) const = 0;
+
+        /*!
+        \brief
+            Creates an Editbox based widget that will be used for the text input
+            area of the spinner widget.
+
+        \return
+            Pointer to a valid Editbox based object.
+        */
+        virtual Editbox* createEditbox(const String& name) const = 0;
+
+        /*************************************************************************
+        	Overrides for Event handler methods
+        *************************************************************************/
+        virtual	void onFontChanged(WindowEventArgs& e);
+        virtual void onTextChanged(WindowEventArgs& e);
+        virtual void onActivated(ActivationEventArgs& e);
+
+        /*************************************************************************
+        	New Event handler methods
+        *************************************************************************/
+        /*!
+        \brief
+            Method called when the spinner value changes.
+
+        \param e
+            WindowEventArgs object containing any relevant data.
+
+        \return
+            Nothing.
+        */
+        virtual void onValueChanged(WindowEventArgs& e);
+
+        /*!
+        \brief
+            Method called when the step value changes.
+
+        \param e
+            WindowEventArgs object containing any relevant data.
+
+        \return
+            Nothing.
+        */
+        virtual void onStepChanged(WindowEventArgs& e);
+
+        /*!
+        \brief
+            Method called when the maximum value setting changes.
+
+        \param e
+            WindowEventArgs object containing any relevant data.
+
+        \return
+            Nothing.
+        */
+        virtual void onMaximumValueChanged(WindowEventArgs& e);
+
+        /*!
+        \brief
+            Method called when the minimum value setting changes.
+
+        \param e
+            WindowEventArgs object containing any relevant data.
+
+        \return
+            Nothing.
+        */
+        virtual void onMinimumValueChanged(WindowEventArgs& e);
+
+        /*!
+        \brief
+            Method called when the text input/display mode is changed.
+
+        \param e
+            WindowEventArgs object containing any relevant data.
+
+        \return
+            Nothing.
+        */
+        virtual void onTextInputModeChanged(WindowEventArgs& e);
+
+        /*************************************************************************
+        	Internal event listener methods
+        *************************************************************************/
+        bool handleIncreaseButton(const EventArgs& e);
+        bool handleDecreaseButton(const EventArgs& e);
+        bool handleEditTextChange(const EventArgs& e);
+
+
+        /*************************************************************************
+        	Data Fields
+        *************************************************************************/
+        PushButton* d_increaseButton;   //!< Pointer to the increase button widget.
+        PushButton* d_decreaseButton;   //!< Pointer to the decrease button widget.
+        Editbox*    d_editbox;          //!< Pointer to the editbox widget.
+
+        float   d_stepSize;     //!< Step size value used y the increase & decrease buttons.
+        float   d_currentValue; //!< Numerical copy of the text in d_editbox.
+        float   d_maxValue;     //!< Maximum value for spinner.
+        float   d_minValue;     //!< Minimum value for spinner.
+        TextInputMode   d_inputMode;    //!< Current text display/input mode.
+
+    private:
+        /*************************************************************************
+        	Static properties for the Spinner widget
+        *************************************************************************/
+        static SpinnerProperties::CurrentValue  d_currentValueProperty;
+        static SpinnerProperties::StepSize      d_stepSizeProperty;
+        static SpinnerProperties::MaximumValue  d_maxValueProperty;
+        static SpinnerProperties::MinimumValue  d_minValueProperty;
+        static SpinnerProperties::TextInputMode d_textInputModeProperty;
+
+        /*************************************************************************
+        	Private Implementation Methods
+        *************************************************************************/
+        /*!
+        \brief
+            Adds properties supported by the Spinner class.
+
+        \return
+            Nothing.
+        */
+        void    addSpinnerProperties(void);
+    };
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUISpinner_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIComboDropList.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIComboDropList.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIComboDropList.h	(revision 1812)
@@ -0,0 +1,204 @@
+/************************************************************************
+	filename: 	CEGUIComboDropList.h
+	created:	13/6/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface for the Combobox Drop-List widget base class
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIComboDropList_h_
+#define _CEGUIComboDropList_h_
+
+#include "elements/CEGUIListbox.h"
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Base class for the combo box drop down list.  This is a specialisation of the Listbox class.
+*/
+class CEGUIEXPORT ComboDropList : public Listbox
+{
+public:
+	static const String EventNamespace;				//!< Namespace for global events
+
+
+	/*************************************************************************
+		Constants
+	*************************************************************************/
+	// Event names
+	static const String EventListSelectionAccepted;		//!< Event fired when the user confirms the selection by clicking the mouse.
+
+
+	/*!
+	\brief
+		Initialise the Window based object ready for use.
+
+	\note
+		This must be called for every window created.  Normally this is handled automatically by the WindowFactory for each Window type.
+
+	\return
+		Nothing
+	*/
+	virtual void	initialise(void);
+
+
+	/*!
+	\brief
+		Set whether the drop-list is 'armed' for selection.
+
+	\note
+		This setting is not exclusively under client control; the ComboDropList will auto-arm in
+		response to certain left mouse button events.  This is also dependant upon the autoArm
+		setting of the ComboDropList.
+
+	\param setting
+		- true to arm the box; items will be highlighted and the next left button up event
+		will cause dismissal and possible item selection.
+
+		- false to disarm the box; items will not be highlighted or selected until the box is armed.
+
+	\return
+		Nothing.
+	*/
+	void	setArmed(bool setting)		{ d_armed = setting; }
+
+
+	/*!
+	\brief
+		Return the 'armed' state of the ComboDropList.
+
+	\return
+		- true if the box is armed; items will be highlighted and the next left button up event
+		will cause dismissal and possible item selection.
+
+		- false if the box is not armed; items will not be highlighted or selected until the box is armed.
+	*/
+	bool	isArmed(void) const		{ return d_armed; }
+
+
+	/*!
+	\brief
+		Set the mode of operation for the ComboDropList.
+
+	\param setting
+		- true if the ComboDropList auto-arms when the mouse enters the box.
+		- false if the user must click to arm the box.
+
+	\return
+		Nothing.
+	*/
+	void	setAutoArmEnabled(bool setting)		{ d_autoArm = setting; }
+
+
+	/*!
+	\brief
+		returns the mode of operation for the drop-list
+
+	\return
+		- true if the ComboDropList auto-arms when the mouse enters the box.
+		- false if the user must click to arm the box.
+	*/
+	bool	isAutoArmEnabled(void) const		{ return d_autoArm; }
+
+
+	/*************************************************************************
+		Constructor & Destructor
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for ComboDropList base class
+	*/
+	ComboDropList(const String& type, const String& name);
+
+
+	/*!
+	\brief
+		Destructor for ComboDropList base class
+	*/
+	virtual ~ComboDropList(void);
+
+
+protected:
+	/*!
+	\brief
+		Add drop-list specific events
+	*/
+	void	addComboDropListEvents(void);
+
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"ComboDropList")	return true;
+		return Listbox::testClassName_impl(class_name);
+	}
+	
+	/*************************************************************************
+		New event handlers
+	*************************************************************************/
+	/*!
+	\brief
+		Handler for when list selection is confirmed.
+	*/
+	void	onListSelectionAccepted(WindowEventArgs& e);
+
+
+	/*************************************************************************
+		Overridden Event handling
+	*************************************************************************/
+	virtual void	onMouseMove(MouseEventArgs& e);
+	virtual void	onMouseButtonDown(MouseEventArgs& e);
+	virtual void	onMouseButtonUp(MouseEventArgs& e);
+	virtual void	onCaptureLost(WindowEventArgs& e);
+	virtual void	onActivated(ActivationEventArgs& e);
+
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	bool	d_autoArm;		//!< true if the box auto-arms when the mouse enters it.
+	bool	d_armed;		//!< true when item selection has been armed.
+};
+
+} // End of  CEGUI namespace section
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIComboDropList_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIItemListBase.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIItemListBase.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIItemListBase.h	(revision 1812)
@@ -0,0 +1,427 @@
+/************************************************************************
+	filename: 	CEGUIItemListBase.h
+	created:	31/3/2005
+	author:		Tomas Lindquist Olsen (based on original Listbox code by Paul D Turner)
+	
+	purpose:	Interface to base class for ItemListBase widgets
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIItemListBase_h_
+#define _CEGUIItemListBase_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIWindow.h"
+#include "elements/CEGUIItemListBaseProperties.h"
+#include "elements/CEGUIItemEntry.h"
+
+#include <vector>
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+	Base class for item list widgets.
+*/
+class CEGUIEXPORT ItemListBase : public Window
+{
+public:
+	static const String EventNamespace;				//!< Namespace for global events
+
+
+	/*************************************************************************
+		Constants
+	*************************************************************************/
+	// event names
+	static const String EventListContentsChanged;			//!< Event triggered when the contents of the list is changed.
+
+
+	/*************************************************************************
+		Accessor Methods
+	*************************************************************************/
+	/*!
+	\brief
+		Return number of items attached to the list
+
+	\return
+		the number of items currently attached to this list.
+	*/
+	size_t	getItemCount(void) const		{return d_listItems.size();}
+
+
+	/*!
+	\brief
+		Return the item at index position \a index.
+
+	\param index
+		Zero based index of the item to be returned.
+
+	\return
+		Pointer to the ItemEntry at index position \a index in the list.
+
+	\exception	InvalidRequestException	thrown if \a index is out of range.
+	*/
+	ItemEntry*	getItemFromIndex(size_t index) const;
+
+
+	/*!
+	\brief
+		Return the index of ItemEntry \a item
+
+	\param item
+		Pointer to a ItemEntry whos zero based index is to be returned.
+
+	\return
+		Zero based index indicating the position of ItemEntry \a item in the list.
+
+	\exception	InvalidRequestException	thrown if \a item is not attached to this list.
+	*/
+	size_t	getItemIndex(const ItemEntry* item) const;
+
+
+	/*!
+	\brief
+		Search the list for an item with the specified text
+
+	\param text
+		String object containing the text to be searched for.
+
+	\param start_item
+		ItemEntry where the search is to begin, the search will not include \a item.  If \a item is
+		NULL, the search will begin from the first item in the list.
+
+	\return
+		Pointer to the first ItemEntry in the list after \a item that has text matching \a text.  If
+		no item matches the criteria NULL is returned.
+
+	\exception	InvalidRequestException	thrown if \a item is not attached to this list box.
+	*/
+	ItemEntry*	findItemWithText(const String& text, const ItemEntry* start_item);
+
+
+	/*!
+	\brief
+		Return whether the specified ItemEntry is in the List
+
+	\return
+		true if ItemEntry \a item is in the list, false if ItemEntry \a item is not in the list.
+	*/
+	bool	isItemInList(const ItemEntry* item) const;
+
+
+	/*!
+	\brief
+		Return wheter this window is automatically resized to fit its content.
+
+	\return
+		true if automatic resizing is enabled, false if it is disabled.
+	*/
+	bool isAutoResizeEnabled() const		{return d_autoResize;}
+
+
+	/*************************************************************************
+		Manipulator Methods
+	*************************************************************************/
+	/*!
+	\brief
+		Initialise the Window based object ready for use.
+
+	\note
+		This must be called for every window created.  Normally this is handled automatically by the WindowFactory for each Window type.
+
+	\return
+		Nothing
+	*/
+	virtual void	initialise(void);
+
+
+	/*!
+	\brief
+		Remove all items from the list.
+
+		Note that this will cause 'AutoDelete' items to be deleted.
+	*/
+	void	resetList(void);
+
+
+	/*!
+	\brief
+		Add the given ItemEntry to the list.
+
+	\param item
+		Pointer to the ItemEntry to be added to the list.  Note that it is the passed object that is added to the
+		list, a copy is not made.  If this parameter is NULL, nothing happens.
+
+	\return
+		Nothing.
+	*/
+	void	addItem(ItemEntry* item);
+
+
+	/*!
+	\brief
+		Insert an item into the list after a specified item already in the list.
+
+		Note that if the list is sorted, the item may not end up in the requested position.
+
+	\param item
+		Pointer to the ItemEntry to be inserted.  Note that it is the passed object that is added to the
+		list, a copy is not made.  If this parameter is NULL, nothing happens.
+
+	\param position
+		Pointer to a ItemEntry that \a item is to be inserted after.  If this parameter is NULL, the item is
+		inserted at the start of the list.
+
+	\return
+		Nothing.
+	*/
+	void	insertItem(ItemEntry* item, const ItemEntry* position);
+
+
+	/*!
+	\brief
+		Removes the given item from the list.  If the item is has the auto delete state set, the item will be deleted.
+
+	\param item
+		Pointer to the ItemEntry that is to be removed.  If \a item is not attached to this list then nothing
+		will happen.
+
+	\return
+		Nothing.
+	*/
+	void	removeItem(ItemEntry* item);
+
+
+	/*!
+	\brief
+		Causes the list to update it's internal state after changes have been made to one or more
+		attached ItemEntry objects.
+
+		Client code must call this whenever it has made any changes to ItemEntry objects already attached to the
+		list.  If you are just adding items, or removed items to update them prior to re-adding them, there is
+		no need to call this method.
+
+	\return
+		Nothing.
+	*/
+	void	handleUpdatedItemData(void);
+
+
+	/*!
+	\brief
+		Set whether or not this ItemListBase widget should automatically resize to fit its content.
+
+	\param setting
+		Boolean value that if true enables automatic resizing, if false disables automatic resizing.
+
+	\return
+		Nothing.
+	*/
+	void setAutoResizeEnabled(bool setting);
+
+
+	/*!
+	\brief
+	Resize the ItemListBase to exactly fit the content that is attached to it.
+	Return a Rect object describing, in un-clipped pixels, the window relative area
+	that is to be used for rendering items.
+
+	\return
+	Nothing
+	*/
+	virtual	void	sizeToContent(void)		{sizeToContent_impl();}
+
+
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for ItemListBase base class.
+	*/
+	ItemListBase(const String& type, const String& name);
+
+
+	/*!
+	\brief
+		Destructor for ItemListBase base class.
+	*/
+	virtual ~ItemListBase(void);
+
+
+protected:
+	/*************************************************************************
+		Abstract Implementation Functions (must be provided by derived class)
+	*************************************************************************/
+	/*!
+	\brief
+		Resize the ItemListBase to exactly fit the content that is attached to it.
+		Return a Rect object describing, in un-clipped pixels, the window relative area
+		that is to be used for rendering items.
+
+	\return
+		Nothing
+	*/
+	virtual	void	sizeToContent_impl(void)		= 0;
+
+
+	/*!
+	\brief
+		Returns the Size in unclipped pixels of the content attached to this ItemListBase that is attached to it.
+
+	\return
+		Nothing.
+	*/
+	virtual Size getContentSize()		= 0;
+
+
+	/*!
+	\brief
+		Return a Rect object describing, in un-clipped pixels, the window relative area
+		that is to be used for rendering list items.
+
+	\return
+		Rect object describing the window relative area of the that is to be used for rendering
+		the items.
+	*/
+	virtual	Rect	getItemRenderArea(void) const		= 0;
+
+
+	/*!
+	\brief
+		Setup size and position for the item widgets attached to this ItemListBase
+
+	\return
+		Nothing.
+	*/
+	virtual void	layoutItemWidgets()	= 0;
+
+
+	/*!
+	\brief
+		Perform the actual rendering for this Window.
+
+	\return
+		Nothing
+	*/
+	virtual	void	populateRenderCache() = 0;
+
+
+	/*************************************************************************
+		Implementation Functions
+	*************************************************************************/
+	/*!
+	\brief
+		Add list box specific events
+	*/
+	void	addItemListBaseEvents(void);
+
+
+	/*!
+	\brief
+		Remove all items from the list.
+
+	\note
+		Note that this will cause 'AutoDelete' items to be deleted.
+
+	\return
+		- true if the list contents were changed.
+		- false if the list contents were not changed (list already empty).
+	*/
+	bool	resetList_impl(void);
+
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"ItemListBase")	return true;
+		return Window::testClassName_impl(class_name);
+	}
+
+	/*************************************************************************
+		New event handlers
+	*************************************************************************/
+	/*!
+	\brief
+		Handler called internally when the list contents are changed
+	*/
+	virtual	void	onListContentsChanged(WindowEventArgs& e);
+
+
+	/*************************************************************************
+		Overridden Event handlers
+	*************************************************************************/
+	virtual void	onSized(WindowEventArgs& e);
+
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	typedef	std::vector<ItemEntry*>	ItemEntryList;
+	ItemEntryList	d_listItems;		//!< list of items in the list.
+
+	// boolean telling if this ItemListBase widget should automatically resize to fit its content.
+	bool d_autoResize;
+
+private:
+	/*************************************************************************
+	Static Properties for this class
+	*************************************************************************/
+	static ItemListBaseProperties::AutoResizeEnabled	d_autoResizeEnabledProperty;
+
+
+	/*************************************************************************
+		Private methods
+	*************************************************************************/
+	void	addItemListBaseProperties(void);
+
+
+	/*!
+	\brief
+		Add given window to child list at an appropriate position
+	*/
+	virtual void	addChild_impl(Window* wnd);
+};
+
+} // End of  CEGUI namespace section
+
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIItemListBase_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUICheckbox.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUICheckbox.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUICheckbox.h	(revision 1812)
@@ -0,0 +1,177 @@
+/************************************************************************
+	filename: 	CEGUICheckbox.h
+	created:	13/4/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to base class for Checkbox Widget
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUICheckbox_h_
+#define _CEGUICheckbox_h_
+
+#include "CEGUIBase.h"
+#include "elements/CEGUIButtonBase.h"
+#include "elements/CEGUICheckboxProperties.h"
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+	Base class providing logic for Check-box widgets
+*/
+class CEGUIEXPORT Checkbox : public ButtonBase
+{
+public:
+	static const String EventNamespace;				//!< Namespace for global events
+
+	/*************************************************************************
+		Event name constants
+	*************************************************************************/
+	// generated internally by Window
+	static const String EventCheckStateChanged;			//!< The check-state of the widget has changed.
+
+
+	/*************************************************************************
+		Accessor Functions
+	*************************************************************************/
+	/*!
+	\brief
+		return true if the check-box is selected (has the checkmark)
+
+	\return
+		true if the widget is selected and has the check-mark, false if the widget
+		is not selected and does not have the check-mark.
+	*/
+	bool	isSelected(void) const						{return d_selected;}
+
+
+	/*************************************************************************
+		Manipulator Functions
+	*************************************************************************/
+	/*!
+	\brief
+		set whether the check-box is selected or not
+
+	\param select
+		true to select the widget and give it the check-mark.  false to de-select the widget and
+		remove the check-mark.
+
+	\return
+		Nothing.
+	*/
+	void	setSelected(bool select);
+
+
+	/*************************************************************************
+		Construction / Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for Checkbox class.
+	*/
+	Checkbox(const String& type, const String& name);
+
+
+	/*!
+	\brief
+		Destructor for Checkbox class.
+	*/
+	virtual ~Checkbox(void);
+
+
+protected:
+	/*************************************************************************
+		New event handlers
+	*************************************************************************/
+	/*!
+	\brief
+		event triggered internally when state of check-box changes
+	*/
+	virtual void	onSelectStateChange(WindowEventArgs& e);
+
+
+	/*************************************************************************
+		Overridden event handlers
+	*************************************************************************/
+	virtual void	onMouseButtonUp(MouseEventArgs& e);
+
+
+	/*************************************************************************
+		Implementation Functions
+	*************************************************************************/
+	/*!
+	\brief
+		Add check-box specific events
+	*/
+	void	addCheckboxEvents(void);
+
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"Checkbox")	return true;
+		return ButtonBase::testClassName_impl(class_name);
+	}
+
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	bool		d_selected;					//!< true if check-box is selected (has checkmark)
+
+private:
+	/*************************************************************************
+		Static Properties for this class
+	*************************************************************************/
+	static CheckboxProperties::Selected	d_selectedProperty;
+
+
+	/*************************************************************************
+		Private methods
+	*************************************************************************/
+	void	addCheckboxProperties(void);
+};
+
+} // End of  CEGUI namespace section
+
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUICheckbox_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIScrolledContainerProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIScrolledContainerProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIScrolledContainerProperties.h	(revision 1812)
@@ -0,0 +1,123 @@
+/************************************************************************
+	filename: 	CEGUIScrolledContainerProperties.h
+	created:	3/3/2005
+	author:		Paul D Turner
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIScrolledContainerProperties_h_
+#define _CEGUIScrolledContainerProperties_h_
+
+#include "CEGUIProperty.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+// Start of ScrolledContainerProperties namespace section
+/*!
+\brief
+	Namespace containing all classes that make up the properties interface for the ScrolledContainer class
+*/
+namespace ScrolledContainerProperties
+{
+    /*!
+    \brief
+        Property to access the setting which controls whether the content pane is automatically
+        resized according to the size and position of attached content.
+
+    \par Usage:
+        - Name: ContentPaneAutoSized
+        - Format: "[text]"
+
+    \par Where [Text] is:
+        - "True" to indicate the pane should automatically resize itself.
+        - "False" to indicate the pane should not automatically resize itself.
+    */
+    class ContentPaneAutoSized : public Property
+    {
+    public:
+        ContentPaneAutoSized() : Property(
+            "ContentPaneAutoSized",
+            "Property to get/set the setting which controls whether the content pane will auto-size itself.  Value is either \"True\" or \"False\".",
+            "True")
+        {}
+
+        String	get(const PropertyReceiver* receiver) const;
+        void	set(PropertyReceiver* receiver, const String& value);
+    };
+
+    /*!
+    \brief
+       Property to access the current content pane area rectangle (as window relative pixels).
+
+    \par Usage:
+        - Name: ContentArea
+        - Format: "l:[float] t:[float] r:[float] b:[float]".
+
+    \par Where:
+        - l:[float]	specifies the position of the left edge of the area as a floating point number.
+        - t:[float]	specifies the position of the top edge of the area as a floating point number.
+        - r:[float]	specifies the position of the right edge of the area as a floating point number.
+        - b:[float]	specifies the position of the bottom edge of the area as a floating point number.
+    */
+    class ContentArea : public Property
+    {
+    public:
+        ContentArea() : Property(
+            "ContentArea",
+            "Property to get/set the current content area rectangle of the content pane.  Value is \"l:[float] t:[float] r:[float] b:[float]\" (where l is left, t is top, r is right, and b is bottom).",
+            "l:0.000000 t:0.000000 r:0.000000 b:0.000000")
+        {}
+
+        String	get(const PropertyReceiver* receiver) const;
+        void	set(PropertyReceiver* receiver, const String& value);
+    };
+
+    /*!
+    \brief
+        Property offering read-only access to the current content extents rectangle (as window relative pixels).
+
+    \par Usage:
+        - Name: ChildExtentsArea
+        - Format: "l:[float] t:[float] r:[float] b:[float]".
+
+    \par Where:
+        - l:[float]	specifies the position of the left edge of the area as a floating point number.
+        - t:[float]	specifies the position of the top edge of the area as a floating point number.
+        - r:[float]	specifies the position of the right edge of the area as a floating point number.
+        - b:[float]	specifies the position of the bottom edge of the area as a floating point number.
+    */
+    class ChildExtentsArea : public Property
+    {
+    public:
+        ChildExtentsArea() : Property(
+            "ChildExtentsArea",
+            "Property to get the current content extents rectangle.  Value is \"l:[float] t:[float] r:[float] b:[float]\" (where l is left, t is top, r is right, and b is bottom).",
+            "l:0.000000 t:0.000000 r:0.000000 b:0.000000")
+        {}
+
+        String	get(const PropertyReceiver* receiver) const;
+        void	set(PropertyReceiver* receiver, const String& value);
+    };
+
+} // End of  ScrolledContainerProperties namespace section
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIScrolledContainerProperties_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIPopupMenu.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIPopupMenu.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIPopupMenu.h	(revision 1812)
@@ -0,0 +1,227 @@
+/************************************************************************
+	filename: 	CEGUIPopupMenu.h
+	created:	27/3/2005
+	author:		Tomas Lindquist Olsen (based on code by Paul D Turner)
+	
+	purpose:	Interface to base class for PopupMenu widget
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIPopupMenu_h_
+#define _CEGUIPopupMenu_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIWindow.h"
+#include "elements/CEGUIPopupMenuProperties.h"
+#include "elements/CEGUIMenuBase.h"
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+	Base class for popup menus
+*/
+class CEGUIEXPORT PopupMenu : public MenuBase
+{
+public:
+	static const String EventNamespace;				//!< Namespace for global events
+
+	/*************************************************************************
+		Accessor type functions
+	*************************************************************************/
+	/*!
+	\brief
+		Get the fade in time for this popup menu.
+
+	\return
+		The time in seconds that it takes for the popup to fade in.
+		0 if fading is disabled.
+	*/
+	float	getFadeInTime(void) const			{return d_fadeInTime;}
+
+
+	/*!
+	\brief
+		Get the fade out time for this popup menu.
+
+	\return
+		The time in seconds that it takes for the popup to fade out.
+		0 if fading is disabled.
+	*/
+	float	getFadeOutTime(void) const			{return d_fadeOutTime;}
+
+
+	/*************************************************************************
+		Manipulators
+	*************************************************************************/
+	/*!
+	\brief
+		Set the fade in time for this popup menu.
+
+	\param fadetime
+		The time in seconds that it takes for the popup to fade in.
+		If this parameter is zero, fading is disabled.
+	*/
+	void	setFadeInTime(float fadetime)		{d_fadeInTime=fadetime;}
+
+
+	/*!
+	\brief
+		Set the fade out time for this popup menu.
+
+	\param fadetime
+		The time in seconds that it takes for the popup to fade out.
+		If this parameter is zero, fading is disabled.
+	*/
+	void	setFadeOutTime(float fadetime)		{d_fadeOutTime=fadetime;}
+
+	/*!
+	\brief
+		Tells the popup menu to open.
+	*/
+	void	openPopupMenu(void);
+
+
+	/*!
+	\brief
+		Tells the popup menu to close.
+	*/
+	void	closePopupMenu(void);
+
+
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for PopupMenu objects
+	*/
+	PopupMenu(const String& type, const String& name);
+
+
+	/*!
+	\brief
+		Destructor for PopupMenu objects
+	*/
+	virtual ~PopupMenu(void);
+
+
+protected:
+	/*************************************************************************
+		Implementation Functions
+	*************************************************************************/
+	/*!
+	\brief
+	Perform actual update processing for this Window.
+
+	\param elapsed
+	float value indicating the number of seconds elapsed since the last update call.
+
+	\return
+	Nothing.
+	*/
+	virtual void	updateSelf(float elapsed);
+
+
+	/*!
+	\brief
+		Setup size and position for the item widgets attached to this Listbox
+
+	\return
+		Nothing.
+	*/
+	virtual void	layoutItemWidgets(void);
+
+
+	/*!
+	\brief
+		Resizes the popup menu to exactly fit the content that is attached to it.
+
+	\return
+		Nothing.
+	*/
+	virtual Size getContentSize(void);
+
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"PopupMenu")	return true;
+		return MenuBase::testClassName_impl(class_name);
+	}
+
+
+	/*************************************************************************
+		Overridden event handlers
+	*************************************************************************/
+	virtual void onAlphaChanged(WindowEventArgs& e);
+
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	float d_origAlpha;			//!< The original alpha of this window.
+
+	float d_fadeElapsed;		//!< The time in seconds this popup menu has been fading.
+	float d_fadeOutTime;		//!< The time in seconds it takes for this popup menu to fade out.
+	float d_fadeInTime;			//!< The time in seconds it takes for this popup menu to fade in.
+	bool d_fading;				//!< true if this popup menu is fading in/out. false if not
+	bool d_fadingOut;			//!< true if this popup menu is fading out. false if fading in.
+
+private:
+	/*************************************************************************
+	Static Properties for this class
+	*************************************************************************/
+	static PopupMenuProperties::FadeInTime	d_fadeInTimeProperty;
+	static PopupMenuProperties::FadeOutTime	d_fadeOutTimeProperty;
+
+
+	/*************************************************************************
+	Private methods
+	*************************************************************************/
+	void	addPopupMenuProperties(void);
+};
+
+} // End of  CEGUI namespace section
+
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+
+#endif	// end of guard _CEGUIPopupMenu_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUISpinnerProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUISpinnerProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUISpinnerProperties.h	(revision 1812)
@@ -0,0 +1,165 @@
+/************************************************************************
+	filename: 	CEGUISpinnerProperties.h
+	created:	7/2/2005
+	author:		Paul D Turner
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUISpinnerProperties_h_
+#define _CEGUISpinnerProperties_h_
+
+#include "CEGUIProperty.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+// Start of SpinnerProperties namespace section
+namespace SpinnerProperties
+{
+    /*!
+    \brief
+	    Property to access the current value of the spinner.
+
+	    \par Usage:
+		    - Name: CurrentValue
+		    - Format: "[float]".
+
+	    \par Where:
+		    - [float] represents the current value of the Spinner widget.
+    */
+    class CurrentValue : public Property
+    {
+    public:
+	    CurrentValue() : Property(
+		    "CurrentValue",
+		    "Property to get/set the current value of the spinner.  Value is a float.",
+		    "0.000000")
+	    {}
+
+	    String get(const PropertyReceiver* receiver) const;
+	    void set(PropertyReceiver* receiver, const String& value);
+    };
+
+    /*!
+    \brief
+	    Property to access the step size of the spinner.
+
+	    \par Usage:
+		    - Name: StepSize
+		    - Format: "[float]".
+
+	    \par Where:
+		    - [float] represents the current value of the Spinner widget.
+    */
+    class StepSize : public Property
+    {
+    public:
+	    StepSize() : Property(
+		    "StepSize",
+		    "Property to get/set the step size of the spinner.  Value is a float.",
+		    "1.000000")
+	    {}
+
+	    String get(const PropertyReceiver* receiver) const;
+	    void set(PropertyReceiver* receiver, const String& value);
+    };
+
+    /*!
+    \brief
+	    Property to access the minimum value setting of the spinner.
+
+	    \par Usage:
+		    - Name: MinimumValue
+		    - Format: "[float]".
+
+	    \par Where:
+		    - [float] represents the current minimum value of the Spinner widget.
+    */
+    class MinimumValue : public Property
+    {
+    public:
+	    MinimumValue() : Property(
+		    "MinimumValue",
+		    "Property to get/set the minimum value setting of the spinner.  Value is a float.",
+		    "-32768.000000")
+	    {}
+
+	    String get(const PropertyReceiver* receiver) const;
+	    void set(PropertyReceiver* receiver, const String& value);
+    };
+
+    /*!
+    \brief
+	    Property to access the maximum value setting of the spinner.
+
+	    \par Usage:
+		    - Name: MaximumValue
+		    - Format: "[float]".
+
+	    \par Where:
+		    - [float] represents the current maximum value of the Spinner widget.
+    */
+    class MaximumValue : public Property
+    {
+    public:
+	    MaximumValue() : Property(
+		    "MaximumValue",
+		    "Property to get/set the maximum value setting of the spinner.  Value is a float.",
+		    "32767.000000")
+	    {}
+
+	    String get(const PropertyReceiver* receiver) const;
+	    void set(PropertyReceiver* receiver, const String& value);
+    };
+
+    /*!
+    \brief
+	    Property to access the TextInputMode setting.
+
+	    This property offers access the text display and input mode for the spinner.
+
+	    \par Usage:
+		    - Name: TextInputMode
+		    - Format: "[text]".
+
+	    \par Where [text] is:
+		    - "FloatingPoint" for floating point decimal numbers.
+		    - "Integer" for integer decimal numbers.
+            - "Hexadecimal" for hexadecimal numbers.
+            - "Octal" for octal numbers.
+    */
+    class TextInputMode : public Property
+    {
+    public:
+	    TextInputMode() : Property(
+		    "TextInputMode",
+		    "Property to get/set the TextInputMode setting for the spinner.  Value is \"FloatingPoint\", \"Integer\", \"Hexadecimal\", or \"Octal\".",
+		    "Integer")
+	    {}
+
+	    String	get(const PropertyReceiver* receiver) const;
+	    void	set(PropertyReceiver* receiver, const String& value);
+    };
+
+} // End of  SpinnerProperties namespace section
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUISpinnerProperties_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIStaticText.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIStaticText.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIStaticText.h	(revision 1812)
@@ -0,0 +1,411 @@
+/************************************************************************
+	filename: 	CEGUIStaticText.h
+	created:	4/6/2004
+	author:		Paul D Turner
+	
+	purpose:	Defines interface for a static text widget
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIStaticText_h_
+#define _CEGUIStaticText_h_
+
+#include "elements/CEGUIStatic.h"
+#include "elements/CEGUIStaticTextProperties.h"
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Base class for a static text widget.
+*/
+class CEGUIEXPORT StaticText : public Static
+{
+public:
+	static const String EventNamespace;				//!< Namespace for global events
+
+
+	/*************************************************************************
+		Formatting Enumerations
+	*************************************************************************/
+	/*!
+	\brief
+		Enumeration of horizontal formatting options for static text widgets
+	*/
+	enum HorzFormatting
+	{
+		LeftAligned,			//!< Text is output as a single line of text with the first character aligned with the left edge of the widget.
+		RightAligned,			//!< Text is output as a single line of text with the last character aligned with the right edge of the widget.
+		HorzCentred,			//!< Text is output as a single line of text horizontally centred within the widget.
+		HorzJustified,			//!< Text is output as a single line of text with the first and last characters aligned with the edges of the widget.
+		WordWrapLeftAligned,	//!< Text is output as multiple word-wrapped lines of text with the first character of each line aligned with the left edge of the widget.
+		WordWrapRightAligned,	//!< Text is output as multiple word-wrapped lines of text with the last character of each line aligned with the right edge of the widget.
+		WordWrapCentred,		//!< Text is output as multiple word-wrapped lines of text with each line horizontally centered within the widget.
+		WordWrapJustified		//!< Text is output as multiple word-wrapped lines of text with the first and last characters of each line aligned with the edges of the widget.
+	};
+
+
+	/*!
+	\brief
+		Enumeration of vertical formatting options for a static text widgets
+	*/
+	enum VertFormatting
+	{
+		TopAligned,		//!< Text is output with the top of first line of text aligned with the top edge of the widget.
+		BottomAligned,	//!< Text is output with the bottom of last line of text aligned with the bottom edge of the widget.
+		VertCentred     //!< Text is output vertically centred within the widget.
+	};
+
+
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for static text widgets.
+	*/
+	StaticText(const String& type, const String& name);
+
+
+	/*!
+	\brief
+		Destructor for static text widgets.
+	*/
+	virtual ~StaticText(void);
+
+
+	/*************************************************************************
+		Accessors
+	*************************************************************************/
+	/*!
+	\brief
+		Return a ColourRect object containing the colours used when rendering this widget.
+
+	\return
+		ColourRect object initialised with the colours used when rendering the text for this widget.
+	*/
+	ColourRect	getTextColours(void) const		{return d_textCols;}
+
+	
+	/*!
+	\brief
+		Return the current horizontal formatting option set for this widget.
+
+	\return
+		One of the StaticText::HorzFormatting enumerated values specifying the horizontal formatting currently set.
+	*/
+	HorzFormatting	getHorizontalFormatting(void) const		{return	d_horzFormatting;}
+
+
+	/*!
+	\brief
+		Return the current vertical formatting option set for this widget.
+
+	\return
+		One of the StaticText::VertFormatting enumerated values specifying the vertical formatting currently set.
+	*/
+	VertFormatting	getVerticalFormatting(void) const		{return	d_vertFormatting;}
+
+
+	/*!
+	\brief
+		Return whether the vertical scroll bar is set to be shown if needed.
+
+	\return
+		- true if the vertical scroll bar will be shown if needed (top or bottom aligned formatting only).
+		- false if the vertical scroll bar will never be shown (default behaviour).
+	*/
+	bool	isVerticalScrollbarEnabled(void) const;
+
+
+	/*!
+	\brief
+		Return whether the horizontal scroll bar is set to be shown if needed.
+
+	\return
+		- true if the horizontal scroll bar will be shown if needed (non-word wrapped, left or right aligned formatting only).
+		- false if the horizontal scroll bar will never be shown (default behaviour).
+	*/
+	bool	isHorizontalScrollbarEnabled(void) const;
+
+
+	// overridden (again) so scroll bars are not clipped when they are active
+	virtual Rect	getUnclippedInnerRect(void) const;
+
+
+	/*************************************************************************
+		Manipulators
+	*************************************************************************/
+	/*!
+	\brief
+		Initialise the Window based object ready for use.
+
+	\note
+		This must be called for every window created.  Normally this is handled automatically by the WindowFactory for each Window type.
+
+	\return
+		Nothing
+	*/
+	virtual void	initialise(void);
+
+
+	/*!
+	\brief
+		Sets the colours to be applied when rendering the text.
+
+	\param colours
+		ColourRect object describing the colours to be used for each text glyph rendered.
+
+	\return 
+		Nothing.
+	*/
+	void	setTextColours(const ColourRect& colours);
+
+
+	/*!
+	\brief
+		Sets the colours to be applied when rendering the text.
+
+	\param top_left_colour
+		Colour to be applied to the top-left corner of each text glyph rendered.
+
+	\param top_right_colour
+		Colour to be applied to the top-right corner of each text glyph rendered.
+
+	\param bottom_left_colour
+		Colour to be applied to the bottom-left corner of each text glyph rendered.
+
+	\param bottom_right_colour
+		Colour to be applied to the bottom-right corner of each text glyph rendered.
+
+	\return 
+		Nothing.
+	*/
+	void	setTextColours(const colour& top_left_colour, const colour& top_right_colour, const colour& bottom_left_colour, const colour& bottom_right_colour);
+
+
+	/*!
+	\brief
+		Sets the colour to be applied when rendering the text.
+
+	\param col
+		colour value to be used when rendering.
+
+	\return
+		Nothing.
+	*/
+	void	setTextColours(const colour& col)		{setTextColours(col, col, col, col);}
+
+
+	/*!
+	\brief
+		Set the formatting required for the text.
+
+	\param h_fmt
+		One of the HorzFormatting enumerated values specifying the formatting required.
+
+	\param v_fmt
+		One of the VertFormatting enumerated values specifying the formatting required.
+
+	\return
+		Nothing
+	*/
+	void	setFormatting(HorzFormatting h_fmt, VertFormatting v_fmt);
+
+
+	/*!
+	\brief
+		Set the formatting required for the text.
+
+	\param v_fmt
+		One of the VertFormatting enumerated values specifying the formatting required.
+
+	\return
+		Nothing
+	*/
+	void	setVerticalFormatting(VertFormatting v_fmt);
+
+
+	/*!
+	\brief
+		Set the formatting required for the text.
+
+	\param h_fmt
+		One of the HorzFormatting enumerated values specifying the formatting required.
+
+	\return
+		Nothing
+	*/
+	void	setHorizontalFormatting(HorzFormatting h_fmt);
+
+
+	/*!
+	\brief
+		Set whether the vertical scroll bar will be shown if needed.
+
+	\param setting
+		- true if the vertical scroll bar should be shown if needed (top or bottom aligned formatting only).
+		- false if the vertical scroll bar should never be shown (default behaviour).
+	*/
+	void	setVerticalScrollbarEnabled(bool setting);
+
+
+	/*!
+	\brief
+		Set whether the horizontal scroll bar will be shown if needed.
+
+	\param setting
+		- true if the horizontal scroll bar should be shown if needed (non-word wrapped, left or right aligned formatting only).
+		- false if the horizontal scroll bar should never be shown (default behaviour).
+	*/
+	void	setHorizontalScrollbarEnabled(bool setting);
+
+
+protected:
+	/*************************************************************************
+		Overridden from base class
+	*************************************************************************/
+	virtual void populateRenderCache();
+
+
+	/*************************************************************************
+		Overridden events
+	*************************************************************************/
+	virtual void	onTextChanged(WindowEventArgs& e);
+	virtual void	onSized(WindowEventArgs& e);
+	virtual	void	onFontChanged(WindowEventArgs& e);
+	virtual void	onMouseWheel(MouseEventArgs& e);
+
+
+	/*************************************************************************
+		Implementation methods
+	*************************************************************************/
+	/*!
+	\brief
+		Return a Rect object describing, in un-clipped pixels, the window relative area
+		that the text should be rendered in to.
+
+	\return
+		Rect object describing the area of the Window to be used for rendering text.
+	*/
+	virtual	Rect	getTextRenderArea(void) const;
+
+
+	/*!
+	\brief
+		display required integrated scroll bars according to current state of the edit box and update their values.
+	*/
+	void	configureScrollbars(void);
+
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"StaticText")	return true;
+		return Static::testClassName_impl(class_name);
+	}
+
+
+	/*************************************************************************
+		Implementation Methods (abstract)
+	*************************************************************************/
+	/*!
+	\brief
+		create and return a pointer to a Scrollbar widget for use as vertical scroll bar
+
+	\param name
+	   String containing the name to be given to the created component.
+
+	\return
+		Pointer to a Scrollbar to be used for scrolling vertically.
+	*/
+	virtual Scrollbar*	createVertScrollbar(const String& name) const		= 0;
+ 
+
+	/*!
+	\brief
+		create and return a pointer to a Scrollbar widget for use as horizontal scroll bar
+
+	\param name
+	   String containing the name to be given to the created component.
+
+	\return
+		Pointer to a Scrollbar to be used for scrolling horizontally.
+	*/
+	virtual Scrollbar*	createHorzScrollbar(const String& name) const		= 0;
+
+
+	/*************************************************************************
+		Event subscribers
+	*************************************************************************/
+	bool	handleScrollbarChange(const EventArgs& e);
+
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	HorzFormatting	d_horzFormatting;		//!< Horizontal formatting to be applied to the text.
+	VertFormatting	d_vertFormatting;		//!< Vertical formatting to be applied to the text.
+	ColourRect		d_textCols;				//!< Colours used when rendering the text.
+	Scrollbar*		d_vertScrollbar;		//!< Widget used as vertical scrollbar;
+	Scrollbar*		d_horzScrollbar;		//!< Widget used as horizontal scrollbar;
+	bool			d_enableVertScrollbar;	//!< true if vertical scroll bar is enabled.
+	bool			d_enableHorzScrollbar;	//!< true if horizontal scroll bar is enabled.
+
+private:
+	/*************************************************************************
+		Static Properties for this class
+	*************************************************************************/
+	static StaticTextProperties::TextColours	d_textColoursProperty;
+	static StaticTextProperties::VertFormatting	d_vertFormattingProperty;
+	static StaticTextProperties::HorzFormatting	d_horzFormattingProperty;
+	static StaticTextProperties::VertScrollbar	d_vertScrollbarProperty;
+	static StaticTextProperties::HorzScrollbar	d_horzScrollbarProperty;
+
+
+	/*************************************************************************
+		Private methods
+	*************************************************************************/
+	void	addStaticTextProperties(void);
+};
+
+} // End of  CEGUI namespace section
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIStaticText_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIScrollbarProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIScrollbarProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIScrollbarProperties.h	(revision 1812)
@@ -0,0 +1,171 @@
+/************************************************************************
+	filename: 	CEGUIScrollbarProperties.h
+	created:	10/7/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface for Scrollbar properties
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIScrollbarProperties_h_
+#define _CEGUIScrollbarProperties_h_
+
+#include "CEGUIProperty.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+// Start of ScrollbarProperties namespace section
+/*!
+\brief
+	Namespace containing all classes that make up the properties interface for the Scrollbar class
+*/
+namespace ScrollbarProperties
+{
+/*!
+\brief
+	Property to access the document size for the Scrollbar.
+
+	\par Usage:
+		- Name: DocumentSize
+		- Format: "[float]".
+
+	\par Where:
+		- [float] specifies the size of the document being scrolled (as defined by the client code).
+*/
+class DocumentSize : public Property
+{
+public:
+	DocumentSize() : Property(
+		"DocumentSize",
+		"Property to get/set the document size for the Scrollbar.  Value is a float.",
+		"1.000000")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the page size for the Scrollbar.
+
+	\par Usage:
+		- Name: PageSize
+		- Format: "[float]".
+
+	\par Where:
+		- [float] specifies the size of the visible page (as defined by the client code).
+*/
+class PageSize : public Property
+{
+public:
+	PageSize() : Property(
+		"PageSize",
+		"Property to get/set the page size for the Scrollbar.  Value is a float.",
+		"0.000000")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the step size for the Scrollbar.
+
+	\par Usage:
+		- Name: StepSize
+		- Format: "[float]".
+
+	\par Where:
+		- [float] specifies the size of the increase/decrease button step (as defined by the client code).
+*/
+class StepSize : public Property
+{
+public:
+	StepSize() : Property(
+		"StepSize",
+		"Property to get/set the step size for the Scrollbar.  Value is a float.",
+		"1.000000")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the overlap size for the Scrollbar.
+
+	\par Usage:
+		- Name: OverlapSize
+		- Format: "[float]".
+
+	\par Where:
+		- [float] specifies the size of the per-page overlap (as defined by the client code).
+*/
+class OverlapSize : public Property
+{
+public:
+	OverlapSize() : Property(
+		"OverlapSize",
+		"Property to get/set the overlap size for the Scrollbar.  Value is a float.",
+		"0.000000")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+/*!
+\brief
+	Property to access the scroll position of the Scrollbar.
+
+	\par Usage:
+		- Name: ScrollPosition
+		- Format: "[float]".
+
+	\par Where:
+		- [float] specifies the current scroll position / value of the Scrollbar.
+*/
+class ScrollPosition : public Property
+{
+public:
+	ScrollPosition() : Property(
+		"ScrollPosition",
+		"Property to get/set the scroll position of the Scrollbar.  Value is a float.",
+		"0.000000")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+} // End of  ScrollbarProperties namespace section
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIScrollbarProperties_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUICheckboxProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUICheckboxProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUICheckboxProperties.h	(revision 1812)
@@ -0,0 +1,75 @@
+/************************************************************************
+	filename: 	CEGUICheckboxProperties.h
+	created:	9/7/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to properties for the Checkbox class
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUICheckboxProperties_h_
+#define _CEGUICheckboxProperties_h_
+
+#include "CEGUIProperty.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+// Start of CheckboxProperties namespace section
+/*!
+\brief
+	Namespace containing all classes that make up the properties interface for the Checkbox class
+*/
+namespace CheckboxProperties
+{
+/*!
+\brief
+	Property to access the selected state of the check box.
+
+	This property offers access to the select state for the Checkbox object.
+
+	\par Usage:
+		- Name: Selected
+		- Format: "[text]".
+
+	\par Where [Text] is:
+		- "True" to indicate the check box is selected (has check mark).
+		- "False" to indicate the check box is not selected (does not have check mark).
+*/
+class Selected : public Property
+{
+public:
+	Selected() : Property(
+		"Selected",
+		"Property to get/set the selected state of the Checkbox.  Value is either \"True\" or \"False\".",
+		"False")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+} // End of  CheckboxProperties namespace section
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUICheckboxProperties_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIMultiColumnList.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIMultiColumnList.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIMultiColumnList.h	(revision 1812)
@@ -0,0 +1,1579 @@
+/************************************************************************
+	filename: 	CEGUIMultiColumnList.h
+	created:	13/4/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to base class for MultiColumnList widget
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIMultiColumnList_h_
+#define _CEGUIMultiColumnList_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIWindow.h"
+#include "CEGUIListHeader.h"
+#include "elements/CEGUIMultiColumnListProperties.h"
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+	Simple grid index structure.
+*/
+struct CEGUIEXPORT MCLGridRef
+{
+	MCLGridRef(uint r, uint c) : row(r), column(c) {}
+
+	uint	row;		//!< Zero based row index.
+	uint	column;		//!< Zero based column index.
+
+	// operators
+	MCLGridRef& operator=(const MCLGridRef& rhs);
+	bool operator<(const MCLGridRef& rhs) const;
+	bool operator<=(const MCLGridRef& rhs) const;
+	bool operator>(const MCLGridRef& rhs) const;
+	bool operator>=(const MCLGridRef& rhs) const;
+	bool operator==(const MCLGridRef& rhs) const;
+	bool operator!=(const MCLGridRef& rhs) const;
+};
+
+
+/*!
+\brief
+	Base class for the multi column list widget.
+*/
+class CEGUIEXPORT MultiColumnList : public Window
+{
+public:
+	static const String EventNamespace;				//!< Namespace for global events
+
+
+	/*************************************************************************
+		Constants
+	*************************************************************************/
+	// Event names
+	static const String EventSelectionModeChanged;		//!< Event fired when the selection mode for the list box changes.
+	static const String EventNominatedSelectColumnChanged;//!< Event fired when the nominated select column changes.
+	static const String EventNominatedSelectRowChanged;	//!< Event fired when the nominated select row changes.
+	static const String EventVertScrollbarModeChanged;	//!< Event fired when the vertical scroll bar 'force' setting changes.
+	static const String EventHorzScrollbarModeChanged;	//!< Event fired when the horizontal scroll bar 'force' setting changes.
+	static const String EventSelectionChanged;			//!< Event fired when the current selection(s) within the list box changes.
+	static const String EventListContentsChanged;			//!< Event fired when the contents of the list box changes.
+	static const String EventSortColumnChanged;			//!< Event fired when the sort column changes.
+	static const String EventSortDirectionChanged;		//!< Event fired when the sort direction changes.
+	static const String EventListColumnSized;				//!< Event fired when the width of a column in the list changes.
+	static const String EventListColumnMoved;				//!< Event fired when the column order changes.
+
+
+	/*************************************************************************
+		Enumerations
+	*************************************************************************/
+	/*!
+	\brief
+		Enumerated values for the selection modes possible with a Multi-column list
+	*/
+	enum SelectionMode
+	{
+		RowSingle,					// Any single row may be selected.  All items in the row are selected.
+		RowMultiple,				// Multiple rows may be selected.  All items in the row are selected.
+		CellSingle,					// Any single cell may be selected.
+		CellMultiple,				// Multiple cells bay be selected.
+		NominatedColumnSingle,		// Any single item in a nominated column may be selected.
+		NominatedColumnMultiple,	// Multiple items in a nominated column may be selected.
+		ColumnSingle,				// Any single column may be selected.  All items in the column are selected.
+		ColumnMultiple,				// Multiple columns may be selected.  All items in the column are selected.
+		NominatedRowSingle,			// Any single item in a nominated row may be selected.
+		NominatedRowMultiple		// Multiple items in a nominated row may be selected.
+	};
+
+
+	/*************************************************************************
+		Accessor Methods
+	*************************************************************************/
+	/*!
+	\brief
+		Return whether user manipulation of the sort column and direction are enabled.
+
+	\return
+		true if the user may interactively modify the sort column and direction.  false if the user may not
+		modify the sort column and direction (these can still be set programmatically).
+	*/
+	bool	isUserSortControlEnabled(void) const;
+
+
+	/*!
+	\brief
+		Return whether the user may size column segments.
+
+	\return
+		true if the user may interactively modify the width of columns, false if they may not.
+	*/
+	bool	isUserColumnSizingEnabled(void) const;
+
+
+	/*!
+	\brief
+		Return whether the user may modify the order of the columns.
+
+	\return
+		true if the user may interactively modify the order of the columns, false if they may not.
+	*/
+	bool	isUserColumnDraggingEnabled(void) const;
+
+
+	/*!
+	\brief
+		Return the number of columns in the multi-column list
+
+	\return
+		uint value equal to the number of columns in the list.
+	*/
+	uint	getColumnCount(void) const;
+
+
+	/*!
+	\brief
+		Return the number of rows in the multi-column list.
+
+	\return
+		uint value equal to the number of rows currently in the list.
+	*/
+	uint	getRowCount(void) const;
+
+
+	/*!
+	\brief
+		Return the zero based index of the current sort column.  There must be at least one column to successfully call this
+		method.
+
+	\return
+		Zero based column index that is the current sort column.
+
+	\exception	InvalidRequestException		thrown if there are no columns in this multi column list.
+	*/
+	uint	getSortColumn(void) const;
+
+	
+	/*!
+	\brief
+		Return the zero based column index of the column with the specified ID.
+
+	\param col_id
+		ID code of the column whos index is to be returned.
+
+	\return
+		Zero based column index of the first column whos ID matches \a col_id.
+
+	\exception	InvalidRequestException		thrown if no attached column has the requested ID.
+	*/
+	uint	getColumnWithID(uint col_id) const;
+
+
+	/*!
+	\brief
+		Return the zero based index of the column whos header text matches the specified text.
+
+	\param text
+		String object containing the text to be searched for.
+
+	\return
+		Zero based column index of the column whos header has the specified text.
+
+	\exception InvalidRequestException	thrown if no columns header has the requested text.
+	*/
+	uint	getColumnWithHeaderText(const String& text) const;
+
+
+	/*!
+	\brief
+		Return the total width of all column headers.
+
+	\return
+		Sum total of all the column header widths in whichever metrics system is active.
+	*/
+	float	getTotalColumnHeadersWidth(void) const;
+
+
+	/*!
+	\brief
+		Return the width of the specified column header (and therefore the column itself).
+
+	\param col_idx
+		Zero based column index of the column whos width is to be returned.
+
+	\return
+		Width of the column header at the zero based column index specified by \a col_idx, in whichever is the active metrics system.
+
+	\exception InvalidRequestException	thrown if \a column is out of range.
+	*/
+	float	getColumnHeaderWidth(uint col_idx) const;
+
+
+	/*!
+	\brief
+		Return the currently set sort direction.
+
+	\return
+		One of the ListHeaderSegment::SortDirection enumerated values specifying the current sort direction.
+	*/
+	ListHeaderSegment::SortDirection	getSortDirection(void) const;
+
+
+	/*!
+	\brief
+		Return the ListHeaderSegment object for the specified column
+
+	\param col_idx
+		zero based index of the column whos ListHeaderSegment is to be returned.
+
+	\return
+		ListHeaderSegment object for the column at the requested index.
+
+	\exception InvalidRequestException	thrown if \a col_idx is out of range.
+	*/
+	ListHeaderSegment&	getHeaderSegmentForColumn(uint col_idx) const;
+
+
+	/*!
+	\brief
+		Return the zero based index of the Row that contains \a item.
+
+	\param item
+		Pointer to the ListboxItem that the row index is to returned for.
+
+	\return
+		Zero based index of the row that contains ListboxItem \a item.
+
+	\exception InvalidRequestException	thrown if \a item is not attached to the list box.
+	*/
+	uint	getItemRowIndex(const ListboxItem* item) const;
+
+
+	/*!
+	\brief
+		Return the current zero based index of the column that contains \a item.
+
+	\param item
+		Pointer to the ListboxItem that the column index is to returned for.
+
+	\return
+		Zero based index of the column that contains ListboxItem \a item.
+
+	\exception InvalidRequestException	thrown if \a item is not attached to the list box.
+	*/
+	uint	getItemColumnIndex(const ListboxItem* item) const;
+
+
+	/*!
+	\brief
+		Return the grid reference for \a item.
+
+	\param item
+		Pointer to the ListboxItem whos current grid reference is to be returned.
+
+	\return
+		MCLGridRef object describing the current grid reference of ListboxItem \a item.
+
+	\exception InvalidRequestException	thrown if \a item is not attached to the list box.
+	*/
+	MCLGridRef	getItemGridReference(const ListboxItem* item) const;
+
+	
+	/*!
+	\brief
+		Return a pointer to the ListboxItem at the specified grid reference.
+
+	\param grid_ref
+		MCLGridRef object that describes the position of the ListboxItem to be returned.
+
+	\return
+		Pointer to the ListboxItem at grid reference \a grid_ref.
+
+	\exception InvalidRequestException	thrown if \a grid_ref is invalid for this list box.
+	*/
+	ListboxItem*	getItemAtGridReference(const MCLGridRef& grid_ref) const;
+
+
+	/*!
+	\brief
+		return whether ListboxItem \a item is attached to the column at index \a col_idx.
+
+	\param item
+		Pointer to the ListboxItem to look for.
+
+	\param col_idx
+		Zero based index of the column that is to be searched.
+
+	\return
+		- true if \a item is attached to list box column \a col_idx.
+		- false if \a item is not attached to list box column \a col_idx.
+
+	\exception InvalidRequestException	thrown if \a col_idx is out of range.
+	*/
+	bool	isListboxItemInColumn(const ListboxItem* item, uint col_idx) const;
+
+
+	/*!
+	\brief
+		return whether ListboxItem \a item is attached to the row at index \a row_idx.
+
+	\param item
+		Pointer to the ListboxItem to look for.
+
+	\param row_idx
+		Zero based index of the row that is to be searched.
+
+	\return
+		- true if \a item is attached to list box row \a row_idx.
+		- false if \a item is not attached to list box row \a row_idx.
+
+	\exception InvalidRequestException	thrown if \a row_idx is out of range.
+	*/
+	bool	isListboxItemInRow(const ListboxItem* item, uint row_idx) const;
+
+
+	/*!
+	\brief
+		return whether ListboxItem \a item is attached to the list box.
+
+	\param item
+		Pointer to the ListboxItem to look for.
+
+	\return
+		- true if \a item is attached to list box.
+		- false if \a item is not attached to list box.
+	*/
+	bool	isListboxItemInList(const ListboxItem* item) const;
+
+
+	/*!
+	\brief
+		Return the ListboxItem in column \a col_idx that has the text string \a text.
+
+	\param text
+		String object containing the text to be searched for.
+
+	\param col_idx
+		Zero based index of the column to be searched.
+
+	\param start_item
+		Pointer to the ListboxItem where the exclusive search is to start, or NULL to search from the top of the column.
+
+	\return
+		Pointer to the first ListboxItem in column \a col_idx, after \a start_item, that has the string \a text.
+
+	\exception InvalidRequestException	thrown if \a start_item is not attached to the list box, or if \a col_idx is out of range.
+	*/
+	ListboxItem*	findColumnItemWithText(const String& text, uint col_idx, const ListboxItem* start_item) const;
+
+
+	/*!
+	\brief
+		Return the ListboxItem in row \a row_idx that has the text string \a text.
+
+	\param text
+		String object containing the text to be searched for.
+
+	\param row_idx
+		Zero based index of the row to be searched.
+
+	\param start_item
+		Pointer to the ListboxItem where the exclusive search is to start, or NULL to search from the start of the row.
+
+	\return
+		Pointer to the first ListboxItem in row \a row_idx, after \a start_item, that has the string \a text.
+
+	\exception InvalidRequestException	thrown if \a start_item is not attached to the list box, or if \a row_idx is out of range.
+	*/
+	ListboxItem*	findRowItemWithText(const String& text, uint row_idx, const ListboxItem* start_item) const;
+
+
+	/*!
+	\brief
+		Return the ListboxItem that has the text string \a text.
+		
+	\note
+		List box searching progresses across the columns in each row.
+
+	\param text
+		String object containing the text to be searched for.
+
+	\param start_item
+		Pointer to the ListboxItem where the exclusive search is to start, or NULL to search the whole list box.
+
+	\return
+		Pointer to the first ListboxItem, after \a start_item, that has the string \a text.
+
+	\exception InvalidRequestException	thrown if \a start_item is not attached to the list box.
+	*/
+	ListboxItem*	findListItemWithText(const String& text, const ListboxItem* start_item) const;
+
+
+	/*!
+	\brief
+		Return a pointer to the first selected ListboxItem attached to this list box.
+
+	\note
+		List box searching progresses across the columns in each row.
+
+	\return
+		Pointer to the first ListboxItem attached to this list box that is selected, or NULL if no item is selected.
+	*/
+	ListboxItem*	getFirstSelectedItem(void) const;
+
+
+	/*!
+	\brief
+		Return a pointer to the next selected ListboxItem after \a start_item.
+		
+	\note
+		List box searching progresses across the columns in each row.
+
+	\param start_item
+		Pointer to the ListboxItem where the exclusive search is to start, or NULL to search the whole list box.
+
+	\return
+		Pointer to the first selected ListboxItem attached to this list box, after \a start_item, or NULL if no item is selected.
+
+	\exception InvalidRequestException	thrown if \a start_item is not attached to the list box.
+	*/
+	ListboxItem*	getNextSelected(const ListboxItem* start_item) const;
+
+
+	/*!
+	\brief
+		Return the number of selected ListboxItems attached to this list box.
+
+	return
+		uint value equal to the number of ListboxItems attached to this list box that are currently selected.
+	*/
+	uint	getSelectedCount(void) const;
+
+
+	/*!
+	\brief
+		Return whether the ListboxItem at \a grid_ref is selected.
+
+	\param grid_ref
+		MCLGridRef object describing the grid reference that is to be examined.
+
+	\return
+		- true if there is a ListboxItem at \a grid_ref and it is selected.
+		- false if there is no ListboxItem at \a grid_ref, or if the item is not selected.
+	
+	\exception InvalidRequestException	thrown if \a grid_ref contains an invalid grid position.
+	*/
+	bool	isItemSelected(const MCLGridRef& grid_ref) const;
+
+
+	/*!
+	\brief
+		Return the ID of the currently set nominated selection column to be used when in one of the NominatedColumn*
+		selection modes.
+
+	\note
+		You should only ever call this when getColumnCount() returns > 0.
+
+	\return
+		ID code of the nominated selection column.
+	*/
+	uint	getNominatedSelectionColumnID(void) const;
+
+
+	/*!
+	\brief
+		Return the index of the currently set nominated selection column to be used when in one of the NominatedColumn*
+		selection modes.
+
+	\return
+		Zero based index of the nominated selection column.
+	*/
+	uint	getNominatedSelectionColumn(void) const;
+
+
+	/*!
+	\brief
+		Return the index of the currently set nominated selection row to be used when in one of the NominatedRow*
+		selection modes.
+
+	\return
+		Zero based index of the nominated selection column.
+	*/
+	uint	getNominatedSelectionRow(void) const;
+
+
+	/*!
+	\brief
+		Return the currently set selection mode.
+
+	\return
+		One of the MultiColumnList::SelectionMode enumerated values specifying the current selection mode.
+	*/
+	MultiColumnList::SelectionMode	getSelectionMode(void) const;
+
+
+	/*!
+	\brief
+		Return whether the vertical scroll bar is always shown.
+
+	\return
+		- true if the scroll bar will always be shown even if it is not required.
+		- false if the scroll bar will only be shown when it is required.
+	*/
+	bool	isVertScrollbarAlwaysShown(void) const;
+
+
+	/*!
+	\brief
+		Return whether the horizontal scroll bar is always shown.
+
+	\return
+		- true if the scroll bar will always be shown even if it is not required.
+		- false if the scroll bar will only be shown when it is required.
+	*/
+	bool	isHorzScrollbarAlwaysShown(void) const;
+
+
+	/*!
+	\brief
+		Return the ID code assigned to the requested column.
+
+	\param col_idx
+		Zero based index of the column whos ID code is to be returned.
+
+	\return
+		Current ID code assigned to the column at the requested index.
+
+	\exception InvalidRequestException	thrown if \a col_idx is out of range
+	*/
+	uint	getColumnID(uint col_idx) const;
+
+
+	/*!
+	\brief
+		Return the ID code assigned to the requested row.
+
+	\param row_idx
+		Zero based index of the row who's ID code is to be returned.
+
+	\return
+		Current ID code assigned to the row at the requested index.
+
+	\exception InvalidRequestException	thrown if \a row_idx is out of range
+	*/
+	uint	getRowID(uint row_idx) const;
+
+
+	/*!
+	\brief
+		Return the zero based row index of the row with the specified ID.
+
+	\param row_id
+		ID code of the row who's index is to be returned.
+
+	\return
+		Zero based row index of the first row who's ID matches \a row_id.
+
+	\exception	InvalidRequestException		thrown if no row has the requested ID.
+	*/
+	uint	getRowWithID(uint row_id) const;
+
+
+	/*************************************************************************
+		Manipulator Methods
+	*************************************************************************/
+	/*!
+	\brief
+		Initialise the Window based object ready for use.
+
+	\note
+		This must be called for every window created.  Normally this is handled automatically by the WindowFactory for each Window type.
+
+	\return
+		Nothing
+	*/
+	virtual void	initialise(void);
+
+
+	/*!
+	\brief
+		Remove all items from the list.
+
+		Note that this will cause 'AutoDelete' items to be deleted.
+	*/
+	void	resetList(void);
+
+
+	/*!
+	\brief
+		Add a column to the list box.
+
+	\param text
+		String object containing the text label for the column header.
+
+	\param col_id
+		ID code to be assigned to the column header.
+
+	\param width
+		Initial width to be set for the column using the active metrics mode for this window.
+
+	\return
+		Nothing.
+	*/
+	void	addColumn(const String& text, uint col_id, float width);
+
+
+	/*!
+	\brief
+		Insert a new column in the list.
+
+	\param text
+		String object containing the text label for the column header.
+
+	\param col_id
+		ID code to be assigned to the column header.
+
+	\param width
+		Initial width to be set for the column using the active metrics mode for this window.
+
+	\param position
+		Zero based index where the column is to be inserted.  If this is greater than the current
+		number of columns, the new column is inserted at the end.
+
+	\return
+		Nothing.
+	*/
+	void	insertColumn(const String& text, uint col_id, float width, uint position);
+
+
+	/*!
+	\brief
+		Removes a column from the list box.  This will cause any ListboxItem using the autoDelete option in the column to be deleted.
+
+	\param col_idx
+		Zero based index of the column to be removed.
+
+	\return
+		Nothing.
+
+	\exception InvalidRequestException	thrown if \a col_idx is invalid.
+	*/
+	void	removeColumn(uint col_idx);
+
+
+	/*!
+	\brief
+		Removes a column from the list box.  This will cause any ListboxItem using the autoDelete option in the column to be deleted.
+
+	\param col_id
+		ID code of the column to be deleted.
+
+	\return
+		Nothing.
+
+	\exception InvalidRequestException	thrown if no column with \a col_id is available on this list box.
+	*/
+	void	removeColumnWithID(uint col_id);
+
+
+	/*!
+	\brief
+		Move the column at index \a col_idx so it is at index \a position.
+
+	\param col_idx
+		Zero based index of the column to be moved.
+
+	\param position
+		Zero based index of the new position for the column.
+
+	\return
+		Nothing.
+
+	\exception InvalidRequestException	thrown if \a col_idx is invalid.
+	*/
+	void	moveColumn(uint col_idx, uint position);
+
+
+	/*!
+	\brief
+		Move the column with ID \a col_id so it is at index \a position.
+
+	\param col_id
+		ID code of the column to be moved.
+
+	\param position
+		Zero based index of the new position for the column.
+
+	\return
+		Nothing.
+
+	\exception InvalidRequestException	thrown if no column with \a col_id is available on this list box.
+	*/
+	void	moveColumnWithID(uint col_id, uint position);
+
+
+	/*!
+	\brief
+		Add an empty row to the list box.
+
+	\param row_id
+		ID code to be assigned to the new row.
+
+	\note
+		If the list is being sorted, the new row will appear at an appropriate position according to the sorting being
+		applied.  If no sorting is being done, the new row will appear at the bottom of the list.
+
+	\return
+		Initial zero based index of the new row.
+	*/
+	uint	addRow(uint row_id = 0);
+
+
+	/*!
+	\brief
+		Add a row to the list box, and set the item in the column with ID \a col_id to \a item.
+
+	\note
+		If the list is being sorted, the new row will appear at an appropriate position according to the sorting being
+		applied.  If no sorting is being done, the new row will appear at the bottom of the list.
+
+	\param item
+		Pointer to a ListboxItem to be used as the initial contents for the column with ID \a col_id.
+
+	\param col_id
+		ID code of the column whos initial item is to be set to \a item.
+
+	\param row_id
+		ID code to be assigned to the new row.
+
+	\return
+		Initial zero based index of the new row.
+
+	\exception InvalidRequestException	thrown if no column with the specified ID is attached to the list box.
+	*/
+	uint	addRow(ListboxItem* item, uint col_id, uint row_id = 0);
+
+
+	/*!
+	\brief
+		Insert an empty row into the list box.
+
+	\note
+		If the list is being sorted, the new row will appear at an appropriate position according to the sorting being
+		applied.  If no sorting is being done, the new row will appear at the specified index.
+
+	\param row_idx
+		Zero based index where the row should be inserted.  If this is greater than the current number of rows, the row is
+		appended to the list.
+
+	\param row_id
+		ID code to be assigned to the new row.
+
+	\return
+		Zero based index where the row was actually inserted.
+	*/
+	uint	insertRow(uint row_idx, uint row_id = 0);
+
+
+	/*!
+	\brief
+		Insert a row into the list box, and set the item in the column with ID \a col_id to \a item.
+
+	\note
+		If the list is being sorted, the new row will appear at an appropriate position according to the sorting being
+		applied.  If no sorting is being done, the new row will appear at the specified index.
+
+	\param item
+		Pointer to a ListboxItem to be used as the initial contents for the column with ID \a col_id.
+
+	\param col_id
+		ID code of the column whos initial item is to be set to \a item.
+
+	\param row_idx
+		Zero based index where the row should be inserted.  If this is greater than the current number of rows, the row is
+		appended to the list.
+
+	\param row_id
+		ID code to be assigned to the new row.
+
+	\return
+		Zero based index where the row was actually inserted.
+
+	\exception InvalidRequestException	thrown if no column with the specified ID is attached to the list box.
+	*/
+	uint	insertRow(ListboxItem* item, uint col_id, uint row_idx, uint row_id = 0);
+
+
+	/*!
+	\brief
+		Remove the list box row with index \a row_idx.  Any ListboxItem in row \a row_idx using autoDelete mode will be deleted.
+
+	\param row_idx
+		Zero based index of the row to be removed.
+
+	\return
+		Nothing.
+
+	\exception InvalidRequestException	thrown if \a row_idx is invalid.
+	*/
+	void	removeRow(uint row_idx);
+
+
+	/*!
+	\brief
+		Set the ListboxItem for grid reference \a position.
+
+	\param item
+		Pointer to the ListboxItem to be set at \a position.
+
+	\param position
+		MCLGridRef describing the grid reference of the item to be set.
+
+	\return
+		Nothing.
+
+	\exception InvalidRequestException	thrown if \a position contains an invalid grid reference.
+	*/
+	void	setItem(ListboxItem* item, const MCLGridRef& position);
+
+
+	/*!
+	\brief
+		Set the ListboxItem for the column with ID \a col_id in row \a row_idx.
+
+	\param item
+		Pointer to the ListboxItem to be set into the list.
+
+	\param col_id
+		ID code of the column to receive \a item.
+
+	\param row_idx
+		Zero based index of the row to receive \a item.
+
+	\return
+		Nothing.
+
+	\exception InvalidRequestException	thrown if no column with ID \a col_id exists, or of \a row_idx is out of range.
+	*/
+	void	setItem(ListboxItem* item, uint col_id, uint row_idx);
+
+
+	/*!
+	\brief
+		Set the selection mode for the list box.
+
+	\param sel_mode
+		One of the MultiColumnList::SelectionMode enumerated values specifying the selection mode to be used.
+
+	\return
+		Nothing.
+
+	\exception	InvalidRequestException	thrown if the value specified for \a sel_mode is invalid.
+	*/
+	void	setSelectionMode(MultiColumnList::SelectionMode sel_mode);
+
+
+	/*!
+	\brief
+		Set the column to be used for the NominatedColumn* selection modes.
+
+	\param	col_id
+		ID code of the column to be used in NominatedColumn* selection modes.
+
+	\return	
+		Nothing.
+
+	\exception InvalidRequestException	thrown if no column has ID code \a col_id.
+	*/
+	void	setNominatedSelectionColumnID(uint col_id);
+
+
+	/*!
+	\brief
+		Set the column to be used for the NominatedColumn* selection modes.
+
+	\param	col_idx
+		zero based index of the column to be used in NominatedColumn* selection modes.
+
+	\return	
+		Nothing.
+
+	\exception InvalidRequestException	thrown if \a col_idx is out of range.
+	*/
+	void	setNominatedSelectionColumn(uint col_idx);
+
+
+	/*!
+	\brief
+		Set the row to be used for the NominatedRow* selection modes.
+
+	\param	row_idx
+		zero based index of the row to be used in NominatedRow* selection modes.
+
+	\return	
+		Nothing.
+
+	\exception InvalidRequestException	thrown if \a row_idx is out of range.
+	*/
+	void	setNominatedSelectionRow(uint row_idx);
+
+
+	/*!
+	\brief
+		Set the sort direction to be used.
+
+	\param direction
+		One of the ListHeaderSegment::SortDirection enumerated values specifying the sort direction to be used.
+
+	\return
+		Nothing.
+	*/
+	void	setSortDirection(ListHeaderSegment::SortDirection direction);
+
+
+	/*!
+	\brief
+		Set the column to be used as the sort key.
+
+	\param col_idx
+		Zero based index of the column to use as the key when sorting the list items.
+
+	\return
+		Nothing.
+
+	\exception InvalidRequestException	thrown if col_idx is out of range.
+	*/
+	void	setSortColumn(uint col_idx);
+
+
+	/*!
+	\brief
+		Set the column to be used as the sort key.
+
+	\param col_id
+		ID code of the column to use as the key when sorting the list items.
+
+	\return
+		Nothing.
+
+	\exception InvalidRequestException	thrown if col_id is invalid for this list box.
+	*/
+	void	setSortColumnByID(uint col_id);
+
+	
+	/*!
+	\brief
+		Set whether the vertical scroll bar should always be shown, or just when needed.
+
+	\param setting
+		- true to have the vertical scroll bar shown at all times.
+		- false to have the vertical scroll bar appear only when needed.
+
+	\return
+		Nothing.
+	*/
+	void	setShowVertScrollbar(bool setting);
+
+
+	/*!
+	\brief
+		Set whether the horizontal scroll bar should always be shown, or just when needed.
+
+	\param setting
+		- true to have the horizontal scroll bar shown at all times.
+		- false to have the horizontal scroll bar appear only when needed.
+
+	\return
+		Nothing.
+	*/
+	void	setShowHorzScrollbar(bool setting);
+
+	
+	/*!
+	\brief
+		Removed the selected state from any currently selected ListboxItem attached to the list.
+
+	\return
+		Nothing.
+	*/
+	void	clearAllSelections(void);
+
+
+	/*!
+	\brief
+		Sets or clears the selected state of the given ListboxItem which must be attached to the list.
+
+	\note
+		Depending upon the current selection mode, this may cause other items to be selected, other
+		items to be deselected, or for nothing to actually happen at all.
+
+	\param item
+		Pointer to the attached ListboxItem to be affected.
+
+	\param state
+		- true to put the ListboxItem into the selected state.
+		- false to put the ListboxItem into the de-selected state.
+
+	\return
+		Nothing.
+	
+	\exception InvalidRequestException	thrown if \a item is not attached to the list box.
+	*/
+	void	setItemSelectState(ListboxItem* item, bool state);
+
+
+	/*!
+	\brief
+		Sets or clears the selected state of the ListboxItem at the given grid reference.
+
+	\note
+		Depending upon the current selection mode, this may cause other items to be selected, other
+		items to be deselected, or for nothing to actually happen at all.
+
+	\param grid_ref
+		MCLGridRef object describing the position of the item to be affected.
+
+	\param state
+		- true to put the ListboxItem into the selected state.
+		- false to put the ListboxItem into the de-selected state.
+
+	\return
+		Nothing.
+	
+	\exception InvalidRequestException	thrown if \a grid_ref is invalid for this list box.
+	*/
+	void	setItemSelectState(const MCLGridRef& grid_ref, bool state);
+
+	
+	/*!
+	\brief
+		Inform the list box that one or more attached ListboxItems have been externally modified, and
+		the list should re-sync its internal state and refresh the display as needed.
+
+	\return
+		Nothing.
+	*/
+	void	handleUpdatedItemData(void);
+
+
+	/*!
+	\brief
+		Set the width of the specified column header (and therefore the column itself).
+
+	\param col_idx
+		Zero based column index of the column whos width is to be set.
+
+	\param width
+		float value specifying the new width for the column using the active metrics system.
+
+	\return
+		Nothing.
+
+	\exception InvalidRequestException	thrown if \a column is out of range.
+	*/
+	void	setColumnHeaderWidth(uint col_idx, float width);
+
+
+	/*!
+	\brief
+		Set whether user manipulation of the sort column and direction are enabled.
+
+	\param setting
+		- true if the user may interactively modify the sort column and direction.
+		- false if the user may not modify the sort column and direction (these can still be set programmatically).
+
+	\return
+		Nothing.
+	*/
+	void	setUserSortControlEnabled(bool setting);
+
+
+	/*!
+	\brief
+		Set whether the user may size column segments.
+
+	\param setting
+		- true if the user may interactively modify the width of columns.
+		- false if the user may not change the width of the columns.
+
+	\return
+		Nothing.
+	*/
+	void	setUserColumnSizingEnabled(bool setting);
+
+
+	/*!
+	\brief
+		Set whether the user may modify the order of the columns.
+
+	\param setting
+		- true if the user may interactively modify the order of the columns.
+		- false if the user may not modify the order of the columns.
+	*/
+	void	setUserColumnDraggingEnabled(bool setting);
+
+
+	/*!
+	\brief
+		Automatically determines the "best fit" size for the specified column and sets
+		the column width to the same.
+
+	\param col_idx
+		Zero based index of the column to be sized.
+
+	\return
+		Nothing.
+
+	\exception InvalidRequestException	thrown if \a col_idx is out of range.
+	*/
+	void	autoSizeColumnHeader(uint col_idx);
+
+
+	/*!
+	\brief
+		Set the ID code assigned to a given row.
+
+	\param row_idx
+		Zero based index of the row who's ID code is to be set.
+
+	\param row_id
+		ID code to be assigned to the row at the requested index.
+
+	\return
+		Nothing.
+
+	\exception InvalidRequestException	thrown if \a row_idx is out of range
+	*/
+	void	setRowID(uint row_idx, uint row_id);
+
+
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for the Multi-column list base class
+	*/
+	MultiColumnList(const String& type, const String& name);
+
+
+	/*!
+	\brief
+		Destructor for the multi-column list base class.
+	*/
+	virtual ~MultiColumnList(void);
+
+
+protected:
+	/*************************************************************************
+		Implementation Functions (abstract interface)
+	*************************************************************************/
+	/*!
+	\brief
+		Return a Rect object describing, in un-clipped pixels, the window relative area
+		that is to be used for rendering list items.
+
+	\return
+		Rect object describing the area of the Window to be used for rendering
+		list box items.
+	*/
+	virtual	Rect	getListRenderArea(void) const		= 0;
+
+
+	/*!
+	\brief
+		create and return a pointer to a ListHeaer widget for use as the column headers.
+
+	\param name
+	   String holding the name to be assigned to the created component.
+
+	\return
+		Pointer to a ListHeader based object.
+	*/
+	virtual ListHeader*	createListHeader(const String& name) const		= 0;
+ 
+
+	/*!
+	\brief
+		create and return a pointer to a Scrollbar widget for use as vertical scroll bar
+
+	\param name
+	   String holding the name to be assigned to the created component.
+
+	\return
+		Pointer to a Scrollbar to be used for scrolling the list vertically.
+	*/
+	virtual Scrollbar*	createVertScrollbar(const String& name) const		= 0;
+ 
+
+	/*!
+	\brief
+		create and return a pointer to a Scrollbar widget for use as horizontal scroll bar
+
+	\param name
+	   String holding the name to be assigned to the created component.
+
+	\return
+		Pointer to a Scrollbar to be used for scrolling the list horizontally.
+	*/
+	virtual Scrollbar*	createHorzScrollbar(const String& name) const		= 0;
+
+
+	/*!
+	\brief
+		Perform rendering of the widget control frame and other 'static' areas.  This
+		method should not render the actual items.  Note that the items are typically
+		rendered to layer 3, other layers can be used for rendering imagery behind and
+		infront of the items.
+
+	\return
+		Nothing.
+	*/
+	virtual	void	cacheListboxBaseImagery()		= 0;
+
+
+	/*************************************************************************
+		Implementation Functions
+	*************************************************************************/
+	/*!
+	\brief
+		Add multi column list box specific events
+	*/
+	void	addMultiColumnListboxEvents(void);
+
+    // overridden from base class.
+	virtual	void populateRenderCache();
+
+
+	/*!
+	\brief
+		display required integrated scroll bars according to current state of the list box and update their values.
+	*/
+	void	configureScrollbars(void);
+
+
+	/*!
+	\brief
+		select all strings between positions \a start and \a end.  (inclusive).  Returns true if something was modified.
+	*/
+	bool	selectRange(const MCLGridRef& start, const MCLGridRef& end);
+
+
+	/*!
+	\brief
+		Return the sum of all row heights
+	*/
+	float	getTotalRowsHeight(void) const;
+
+
+	/*!
+	\brief
+		Return the width of the widest item in the given column
+	*/
+	float	getWidestColumnItemWidth(uint col_idx) const;
+
+
+	/*!
+	\brief
+		Return the height of the highest item in the given row.
+	*/
+	float	getHighestRowItemHeight(uint row_idx) const;
+
+
+	/*!
+	\brief
+		Clear the selected state for all items (implementation)
+
+	\return
+		true if some selections were cleared, false nothing was changed.
+	*/
+	bool	clearAllSelections_impl(void);
+
+
+	/*!
+	\brief
+		Return the ListboxItem under the given window local pixel co-ordinate.
+
+	\return
+		ListboxItem that is under window pixel co-ordinate \a pt, or NULL if no
+		item is under that position.
+	*/
+	ListboxItem*	getItemAtPoint(const Point& pt) const;
+
+
+	/*!
+	\brief
+		Set select state for the given item.  This appropriately selects other
+		items depending upon the select mode.  Returns true if something is
+		changed, else false.
+	*/
+	bool	setItemSelectState_impl(const MCLGridRef grid_ref, bool state);
+
+
+	/*!
+	\brief
+		Set select state for all items in the given row
+	*/
+	void	setSelectForItemsInRow(uint row_idx, bool state);
+
+
+	/*!
+	\brief
+		Set select state for all items in the given column
+	*/
+	void	setSelectForItemsInColumn(uint col_idx, bool state);
+
+
+	/*!
+	\brief
+		Move the column at index \a col_idx so it is at index \a position.  Implementation version which does not move the
+		header segment (since that may have already happened).
+
+	\exception InvalidRequestException	thrown if \a col_idx is invalid.
+	*/
+	void	moveColumn_impl(uint col_idx, uint position);
+
+
+	/*!
+	\brief
+		Remove all items from the list.
+
+	\note
+		Note that this will cause 'AutoDelete' items to be deleted.
+
+	\return
+		- true if the list contents were changed.
+		- false if the list contents were not changed (list already empty).
+	*/
+	bool	resetList_impl(void);
+
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"MultiColumnList")	return true;
+		return Window::testClassName_impl(class_name);
+	}
+
+    // overrides function in base class.
+    int writePropertiesXML(OutStream& out_stream) const;
+
+	/*************************************************************************
+		New event handlers for multi column list
+	*************************************************************************/
+	/*!
+	\brief
+		Handler called when the selection mode of the list box changes
+	*/
+	virtual	void	onSelectionModeChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the nominated selection column changes
+	*/
+	virtual	void	onNominatedSelectColumnChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the nominated selection row changes.
+	*/
+	virtual	void	onNominatedSelectRowChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the vertical scroll bar 'force' mode is changed.
+	*/
+	virtual	void	onVertScrollbarModeChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the horizontal scroll bar 'force' mode is changed.
+	*/
+	virtual	void	onHorzScrollbarModeChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the current selection changes.
+	*/
+	virtual	void	onSelectionChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the list contents is changed.
+	*/
+	virtual	void	onListContentsChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the sort column changes.
+	*/
+	virtual	void	onSortColumnChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the sort direction changes.
+	*/
+	virtual	void	onSortDirectionChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when a column is sized.
+	*/
+	virtual	void	onListColumnSized(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the column order is changed.
+	*/
+	virtual	void	onListColumnMoved(WindowEventArgs& e);
+
+
+	/*************************************************************************
+		Overridden Event handlers
+	*************************************************************************/
+	virtual void	onSized(WindowEventArgs& e);
+	virtual void	onMouseButtonDown(MouseEventArgs& e);
+	virtual	void	onMouseWheel(MouseEventArgs& e);
+
+
+	/*************************************************************************
+		Handlers for subscribed events
+	*************************************************************************/
+	bool	handleHeaderScroll(const EventArgs& e);
+	bool	handleHeaderSegMove(const EventArgs& e);
+	bool	handleColumnSizeChange(const EventArgs& e);
+	bool	handleHorzScrollbar(const EventArgs& e);
+	bool	handleVertScrollbar(const EventArgs& e);
+	bool	handleSortColumnChange(const EventArgs& e);
+	bool	handleSortDirectionChange(const EventArgs& e);
+	bool	handleHeaderSegDblClick(const EventArgs& e);
+
+    /*!
+    \brief
+        Struct used internally to represent a row in the list and also to ease
+        sorting of the rows.
+    */
+	struct ListRow
+	{
+		typedef	std::vector<ListboxItem*>	RowItems;
+		RowItems	d_items;
+		uint		d_sortColumn;
+		uint		d_rowID;
+
+		// operators
+		ListboxItem* const& operator[](uint idx) const	{return d_items[idx];}
+		ListboxItem*&	operator[](uint idx) {return d_items[idx];}
+		bool	operator<(const ListRow& rhs) const;
+		bool	operator>(const ListRow& rhs) const;
+	};
+
+
+	/*!
+	\brief
+		std algorithm predicate used for sorting in descending order
+	*/
+	static bool pred_descend(const ListRow& a, const ListRow& b);
+
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	// component widgets and settings.
+	Scrollbar*	d_vertScrollbar;	//!< vertical scroll-bar widget
+	Scrollbar*	d_horzScrollbar;	//!< horizontal scroll-bar widget
+	ListHeader*	d_header;			//!< The ListHeader attached to this multi-column list.
+	bool	d_forceVertScroll;		//!< true if vertical scrollbar should always be displayed
+	bool	d_forceHorzScroll;		//!< true if horizontal scrollbar should always be displayed
+
+	// selection abilities.
+	SelectionMode	d_selectMode;	//!< Holds selection mode (represented by settings below).
+	uint	d_nominatedSelectCol;	//!< Nominated column for single column selection.
+	uint	d_nominatedSelectRow;	//!< Nominated row for single row selection.
+	bool	d_multiSelect;			//!< Allow multiple selections.
+	bool	d_fullRowSelect;		//!< All items in a row are selected.
+	bool	d_fullColSelect;		//!< All items in a column are selected.
+	bool	d_useNominatedRow;		//!< true if we use a nominated row to select.
+	bool	d_useNominatedCol;		//!< true if we use a nominated col to select.
+	ListboxItem*	d_lastSelected;	//!< holds pointer to the last selected item (used in range selections)
+
+	// storage of items in the list box.
+	typedef std::vector<ListRow>		ListItemGrid;
+	ListItemGrid	d_grid;			//!< Holds the list box data.
+
+
+private:
+	/*************************************************************************
+		Static Properties for this class
+	*************************************************************************/
+	static MultiColumnListProperties::ColumnsMovable				d_columnsMovableProperty;
+	static MultiColumnListProperties::ColumnsSizable				d_columnsSizableProperty;
+	static MultiColumnListProperties::ForceHorzScrollbar			d_forceHorzScrollProperty;
+	static MultiColumnListProperties::ForceVertScrollbar			d_forceVertScrollProperty;
+	static MultiColumnListProperties::NominatedSelectionColumnID	d_nominatedSelectColProperty;
+	static MultiColumnListProperties::NominatedSelectionRow			d_nominatedSelectRowProperty;
+	static MultiColumnListProperties::SelectionMode					d_selectModeProperty;
+	static MultiColumnListProperties::SortColumnID					d_sortColumnIDProperty;
+	static MultiColumnListProperties::SortDirection					d_sortDirectionProperty;
+	static MultiColumnListProperties::SortSettingEnabled			d_sortSettingProperty;
+	static MultiColumnListProperties::ColumnHeader					d_columnHeaderProperty;
+	static MultiColumnListProperties::RowCount						d_rowCountProperty;
+
+
+	/*************************************************************************
+		Private methods
+	*************************************************************************/
+	void	addMultiColumnListProperties(void);
+};
+
+} // End of  CEGUI namespace section
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIMultiColumnList_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIPopupMenuProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIPopupMenuProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIPopupMenuProperties.h	(revision 1812)
@@ -0,0 +1,88 @@
+/************************************************************************
+	filename: 	CEGUIPopupMenuProperties.h
+	created:	5/4/2005
+	author:		Tomas Lindquist Olsen (based on code by Paul D Turner)
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIPopupMenuProperties_h_
+#define _CEGUIPopupMenuProperties_h_
+
+#include "CEGUIProperty.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+// Start of ItemListBaseProperties namespace section
+namespace PopupMenuProperties
+{
+
+/*!
+\brief
+	Property to access the fade in time in seconds of the menu bar.
+
+	\par Usage:
+		- Name: FadeInTime
+		- Format: "[float]".
+
+	\par Where:
+		- [float] represents the fade in time in seconds of the menu bar.
+*/
+class FadeInTime : public Property
+{
+public:
+	FadeInTime() : Property(
+		"FadeInTime",
+		"Property to get/set the fade in time in seconds of the menu bar.  Value is a float.",
+		"0.000000")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the fade out time in seconds of the menu bar.
+
+	\par Usage:
+		- Name: FadeOutTime
+		- Format: "[float]".
+
+	\par Where:
+		- [float] represents the fade out time in seconds of the menu bar.
+*/
+class FadeOutTime : public Property
+{
+public:
+	FadeOutTime() : Property(
+		"FadeOutTime",
+		"Property to get/set the fade out time in seconds of the menu bar.  Value is a float.",
+		"0.000000")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+} // End of  PopupMenuProperties namespace section
+} // End of  CEGUI namespace section
+
+#endif	// end of guard _CEGUIPopupMenuProperties_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUITitlebar.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUITitlebar.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUITitlebar.h	(revision 1812)
@@ -0,0 +1,194 @@
+/************************************************************************
+	filename: 	CEGUITitlebar.h
+	created:	25/4/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface for a Titlebar Widget
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUITitlebar_h_
+#define _CEGUITitlebar_h_
+
+#include "CEGUIWindow.h"
+#include "elements/CEGUITitlebarProperties.h"
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+	Class representing the title bar for Frame Windows.
+
+*/
+class CEGUIEXPORT Titlebar : public Window
+{
+public:
+	static const String EventNamespace;				//!< Namespace for global events
+
+
+	/*!
+	\brief
+		Return whether this title bar will respond to dragging.
+
+	\return
+		true if the title bar will respond to dragging, false if the title bar will not respond.
+	*/
+	bool	isDraggingEnabled(void) const;
+
+
+	/*!
+	\brief
+		Set whether this title bar widget will respond to dragging.
+
+	\param setting
+		true if the title bar should respond to being dragged, false if it should not respond.
+
+	\return
+		Nothing.
+	*/
+	void	setDraggingEnabled(bool setting);
+
+
+	/*!
+	\brief
+		Return the current colour used for rendering the caption text
+
+	\return
+		colour value that specifies the colour used when rendering the title bar caption text.
+	*/
+	colour	getCaptionColour(void) const;
+
+
+	/*!
+	\brief
+		Sets the colour to be used for rendering the caption text.
+
+	\param col
+		colour value that specifies the colour to be used when rendering the title bar caption text.
+
+	\return
+		Nothing.
+	*/
+	void	setCaptionColour(const colour& col);
+
+
+	/*************************************************************************
+		Construction / Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for Titlebar base class.
+	*/
+	Titlebar(const String& type, const String& name);
+
+
+	/*!
+	\brief
+		Destructor for Titlebar base class.
+	*/
+	virtual ~Titlebar(void);
+
+
+protected:
+	/*************************************************************************
+		Overridden event handler functions
+	*************************************************************************/
+	virtual void	onMouseMove(MouseEventArgs& e);
+	virtual void	onMouseButtonDown(MouseEventArgs& e);
+	virtual void	onMouseButtonUp(MouseEventArgs& e);
+	virtual void	onMouseDoubleClicked(MouseEventArgs& e);
+	virtual void	onCaptureLost(WindowEventArgs& e);
+	virtual void	onFontChanged(WindowEventArgs &e);
+
+
+	/*************************************************************************
+		New event handlers for title bar
+	*************************************************************************/
+	/*!
+	\brief
+		Event handler called when the 'draggable' state for the title bar is changed.
+		
+		Note that this is for 'internal' use at the moment and as such does not add or
+		fire a public Event that can be subscribed to.
+	*/
+	virtual void	onDraggingModeChanged(WindowEventArgs& e) {}
+
+
+	/*************************************************************************
+		Implementation Functions
+	*************************************************************************/
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"Titlebar")	return true;
+		return Window::testClassName_impl(class_name);
+	}
+
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	bool	d_dragging;			//!< set to true when the window is being dragged.
+	Point	d_dragPoint;		//!< Point at which we are being dragged.
+	bool	d_dragEnabled;		//!< true when dragging for the widget is enabled.
+
+	Rect	d_oldCursorArea;	//!< Used to backup cursor restraint area.
+
+	colour	d_captionColour;	//!< Colour used when rendering the title caption.
+
+
+private:
+	/*************************************************************************
+		Static Properties for this class
+	*************************************************************************/
+	static TitlebarProperties::DraggingEnabled	d_dragEnabledProperty;
+	static TitlebarProperties::CaptionColour	d_captionColourProperty;
+
+
+	/*************************************************************************
+		Private methods
+	*************************************************************************/
+	void	addTitlebarProperties(void);
+};
+
+} // End of  CEGUI namespace section
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUITitlebar_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/Makefile.am
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/Makefile.am	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/Makefile.am	(revision 1812)
@@ -0,0 +1,73 @@
+pkgincludedir=$(prefix)/include/CEGUI/elements
+pkginclude_HEADERS = CEGUIButtonBase.h \
+                     CEGUIButtonBaseProperties.h \
+                     CEGUICheckbox.h \
+                     CEGUICheckboxProperties.h \
+                     CEGUIComboDropList.h \
+                     CEGUICombobox.h \
+                     CEGUIComboboxProperties.h \
+                     CEGUIDragContainer.h \
+                     CEGUIDragContainerProperties.h \
+                     CEGUIEditbox.h \
+                     CEGUIEditboxProperties.h \
+                     CEGUIFrameWindow.h \
+                     CEGUIFrameWindowProperties.h \
+                     CEGUIGUISheet.h \
+                     CEGUIItemEntry.h \
+                     CEGUIItemListBase.h \
+                     CEGUIItemListBaseProperties.h \
+                     CEGUIListHeader.h \
+                     CEGUIListHeaderProperties.h \
+                     CEGUIListbox.h \
+                     CEGUIListboxItem.h \
+                     CEGUIListboxProperties.h \
+                     CEGUIListboxTextItem.h \
+                     CEGUIListHeader.h \
+                     CEGUIListHeaderProperties.h \
+                     CEGUIListHeaderSegment.h \
+                     CEGUIListHeaderSegmentProperties.h \
+                     CEGUIMenubar.h \
+                     CEGUIMenuBase.h \
+                     CEGUIMenuBaseProperties.h \
+                     CEGUIMenuItem.h \
+                     CEGUIMenuItemProperties.h \
+                     CEGUIMultiColumnList.h \
+                     CEGUIMultiColumnListProperties.h \
+                     CEGUIMultiLineEditbox.h \
+                     CEGUIMultiLineEditboxProperties.h \
+                     CEGUIPopupMenu.h \
+                     CEGUIPopupMenuProperties.h \
+                     CEGUIProgressBar.h \
+                     CEGUIProgressBarProperties.h \
+                     CEGUIPushButton.h \
+                     CEGUIPushButtonProperties.h \
+                     CEGUIRadioButton.h \
+                     CEGUIRadioButtonProperties.h \
+                     CEGUIScrollablePane.h \
+                     CEGUIScrollablePaneProperties.h \
+                     CEGUIScrollbar.h \
+                     CEGUIScrollbarProperties.h \
+                     CEGUIScrolledContainer.h \
+                     CEGUIScrolledContainerProperties.h \
+                     CEGUISlider.h \
+                     CEGUISliderProperties.h \
+                     CEGUISpinner.h \
+                     CEGUISpinnerProperties.h \
+                     CEGUIStatic.h \
+                     CEGUIStaticImage.h \
+                     CEGUIStaticImageProperties.h \
+                     CEGUIStaticProperties.h \
+                     CEGUIStaticText.h \
+                     CEGUIStaticTextProperties.h \
+                     CEGUITabButton.h \
+                     CEGUITabControl.h \
+                     CEGUITabControlProperties.h \
+                     CEGUITabPane.h \
+                     CEGUITextItem.h \
+                     CEGUITextItemProperties.h \
+                     CEGUIThumb.h \
+                     CEGUIThumbProperties.h \
+                     CEGUITitlebar.h \
+                     CEGUITitlebarProperties.h \
+                     CEGUITooltip.h \
+                     CEGUITooltipProperties.h
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIStaticTextProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIStaticTextProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/elements/CEGUIStaticTextProperties.h	(revision 1812)
@@ -0,0 +1,186 @@
+/************************************************************************
+	filename: 	CEGUIStaticTextProperties.h
+	created:	10/7/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface for properties for the StaticText class.
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIStaticTextProperties_h_
+#define _CEGUIStaticTextProperties_h_
+
+#include "CEGUIProperty.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+// Start of StaticTextProperties namespace section
+/*!
+\brief
+	Namespace containing all classes that make up the properties interface for the StaticText class
+*/
+namespace StaticTextProperties
+{
+/*!
+\brief
+	Property to access the text colours for the StaticText widget.
+
+	\par Usage:
+		- Name: TextColours
+		- Format: "tl:[aarrggbb] tr:[aarrggbb] bl:[aarrggbb] br:[aarrggbb]".
+
+	\par Where:
+		- tl:[aarrggbb] is the top-left colour value specified as ARGB (hex).
+		- tr:[aarrggbb] is the top-right colour value specified as ARGB (hex).
+		- bl:[aarrggbb] is the bottom-left colour value specified as ARGB (hex).
+		- br:[aarrggbb] is the bottom-right colour value specified as ARGB (hex).
+*/
+class TextColours : public Property
+{
+public:
+	TextColours() : Property(
+		"TextColours",
+		"Property to get/set the text colours for the StaticText widget.  Value is \"tl:[aarrggbb] tr:[aarrggbb] bl:[aarrggbb] br:[aarrggbb]\".",
+		"tl:FFFFFFFF tr:FFFFFFFF bl:FFFFFFFF br:FFFFFFFF")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the horizontal formatting mode setting.
+
+	\par Usage:
+		- Name: HorzFormatting
+		- Format: "[text]".
+
+	\par Where [text] is one of:
+		- "LeftAligned"
+		- "RightAligned"
+		- "HorzCentred"
+		- "HorzJustified"
+		- "WordWrapLeftAligned"
+		- "WordWrapRightAligned"
+		- "WordWrapCentred"
+		- "WordWrapJustified"
+*/
+class HorzFormatting : public Property
+{
+public:
+	HorzFormatting() : Property(
+		"HorzFormatting",
+		"Property to get/set the horizontal formatting mode.  Value is one of the HorzFormatting strings.",
+		"LeftAligned")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the vertical formatting mode setting.
+
+	\par Usage:
+		- Name: VertFormatting
+		- Format: "[text]".
+
+	\par Where [text] is one of:
+		- "TopAligned"
+		- "BottomAligned"
+		- "VertCentred"
+*/
+class VertFormatting : public Property
+{
+public:
+	VertFormatting() : Property(
+		"VertFormatting",
+		"Property to get/set the vertical formatting mode.  Value is one of the VertFormatting strings.",
+		"VertCentred")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the setting for enabling the vertical scroll bar.
+
+	\par Usage:
+		- Name: VertScrollbar
+		- Format: "[text]"
+
+		\par Where [Text] is:
+		- "True" to indicate the scroll bar is enabled and will be shown when needed.
+		- "False" to indicate the scroll bar is disabled and will never be shown
+*/
+class VertScrollbar : public Property
+{
+public:
+	VertScrollbar() : Property(
+		"VertScrollbar",
+		"Property to get/set the setting for the vertical scroll bar.  Value is either \"True\" or \"False\".",
+		"False")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the setting for enabling the horizontal scroll bar.
+
+	\par Usage:
+		- Name: HorzScrollbar
+		- Format: "[text]"
+
+		\par Where [Text] is:
+		- "True" to indicate the scroll bar is enabled and will be shown when needed.
+		- "False" to indicate the scroll bar is disabled and will never be shown
+*/
+class HorzScrollbar : public Property
+{
+public:
+	HorzScrollbar() : Property(
+		"HorzScrollbar",
+		"Property to get/set the setting for the horizontal scroll bar.  Value is either \"True\" or \"False\".",
+		"False")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+} // End of  StaticTextProperties namespace section
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIStaticTextProperties_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUISize.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUISize.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUISize.h	(revision 1812)
@@ -0,0 +1,54 @@
+/************************************************************************
+	filename: 	CEGUISize.h
+	created:	14/3/2004
+	author:		Paul D Turner
+	
+	purpose:	Defines interface for Size class
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUISize_h_
+#define _CEGUISize_h_
+
+#include "CEGUIBase.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+	Class that holds the size (width & height) of something.
+*/
+class CEGUIEXPORT Size
+{
+public:
+	Size(void) {}
+	Size(float width, float height) : d_width(width), d_height(height) {}
+
+	bool operator==(const Size& other) const;
+	bool operator!=(const Size& other) const;
+
+	float d_width, d_height;
+};
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUISize_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIRenderableElement.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIRenderableElement.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIRenderableElement.h	(revision 1812)
@@ -0,0 +1,311 @@
+/************************************************************************
+	filename: 	CEGUIRenderableElement.h
+	created:	14/4/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface for base class of a 'higher-level' renderable
+				UI entity.
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIRenderableElement_h_
+#define _CEGUIRenderableElement_h_
+
+#include "CEGUIBase.h"
+#include "CEGUISystem.h"
+#include "CEGUIColourRect.h"
+#include "CEGUIVector.h"
+#include "CEGUIRenderCache.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+
+*/
+class CEGUIEXPORT RenderableElement
+{
+public:
+	/*************************************************************************
+		Drawing methods
+	*************************************************************************/
+	/*!
+	\brief
+		Draw the element chain starting with this element.
+
+	\param position
+		Vector3 object describing the base position to be used when rendering the element chain.  Each element
+		in the chain will be offset from this position by it's own internal position setting.
+
+	\param clip_rect
+		Rect object describing the clipping area.  No rendering will appear outside this area.
+	*/
+	void	draw(const Vector3& position, const Rect& clip_rect);
+
+    /*!
+    \brief
+        Draw the element chain into the given RenderCache
+
+    \param renderCache
+        RenderCache object where element imagery is to be queued.
+
+    \return
+        Nothing.
+    */
+    void draw(RenderCache& renderCache) const;
+
+	/*************************************************************************
+		Accessors
+	*************************************************************************/
+	/*!
+	\brief
+		Return a pointer to the next RenderableElement in the chain.
+
+	\return
+		Pointer to a RenderableElement object that is linked this this one.  May be NULL for none.
+	*/
+	RenderableElement*	getNextElement(void) const			{return d_next;}
+
+
+	/*!
+	\brief
+		Return the rendering colours set for this RenderableElement
+
+	\return
+		ColourRect object describing the colours to be used when rendering this RenderableElement.
+	*/
+	const ColourRect&	getColours(void) const						{return d_colours;}
+
+
+	/*!
+	\brief
+		Return the offset position of this RenderableElement.
+
+	\return
+		Point object describing the offset position that this RenderableElement is to be rendered at.  This
+		value is added to whatever position is specified when the RenderableElement::draw method is called to
+		obtain the final rendering position.
+	*/
+	Point	getPosition(void) const							{return Point(d_area.d_left, d_area.d_top);}
+
+
+	/*!
+	\brief
+		Return the current size of the element.
+
+	\return
+		Size object describing the current size of the RenderableFrame.
+	*/
+	Size	getSize(void) const				{return Size(d_area.getWidth(), d_area.getHeight());}
+
+
+	/*!
+	\brief
+		Return the area for the element.
+
+	\return
+		Rect object describing the pixel area (offset from some unknown location) of the frame.
+	*/
+	const Rect&	getRect(void) const				{return d_area;}
+
+
+	/*!
+	\brief
+		return whether the element colours will be applied locally to each image drawn as part of the RenderableElement, or
+		applied across the whole of the RenderableElement area.
+
+	\return
+		- true if the RenderableElement colours will be applied locally to each sub-image drawn as part of this RenderableElement.
+		- false if the RenderableElement colours will be applied evenly across the face of the entire RenderableElement.
+	*/
+	bool	isColourRectPerImage(bool setting) const		{return d_useColoursPerImage;}
+
+
+	/*************************************************************************
+		Manipulators
+	*************************************************************************/
+	/*!
+	\brief
+	Link another RenderableElement to this one.
+
+	The linked element will be drawn whenever this element is drawn using the same base position and clipping area
+	as provided when the RenderableElement::draw method is called.  Whole chains of Renderable Elements can be
+	created using this system.
+
+	\param element
+		Pointer to a RenderableElement object that will be linked to this element.
+
+	\return
+		Nothing.
+	*/
+	void	setNextElement(RenderableElement* element)		{d_next = element;}
+
+
+	/*!
+	\brief
+		Sets the colours to be applied when rendering the element.
+
+	\param colours
+		ColourRect object describing the colours to be used.
+
+	\return 
+		Nothing.
+	*/
+	void	setColours(const ColourRect& colours)			{d_colours = colours;}
+
+
+	/*!
+	\brief
+		Sets the colours to be applied when rendering the element.
+
+	\param top_left_colour
+		Colour to be applied to the top-left corner of each Image used in the element.
+
+	\param top_right_colour
+		Colour to be applied to the top-right corner of each Image used in the element.
+
+	\param bottom_left_colour
+		Colour to be applied to the bottom-left corner of each Image used in the element.
+
+	\param bottom_right_colour
+		Colour to be applied to the bottom-right corner of each Image used in the element.
+
+	\return 
+		Nothing.
+	*/
+	void	setColours(const colour& top_left_colour, const colour& top_right_colour, const colour& bottom_left_colour, const colour& bottom_right_colour);
+
+
+	/*!
+	\brief
+		Set the rendering offset position for this element.
+
+	\param position
+		Point object describing the offset position to use for this element.  This value is added to whatever
+		position is specified when the RenderableElement::draw method is called to obtain the final rendering
+		position.
+
+	\return
+		Nothing.
+	*/
+	void	setPosition(const Point& position)				{d_area.setPosition(position);}
+
+
+	/*!
+	\brief
+		set the dimensions for the frame.
+
+	\param size
+		Size object describing the new size for the frame (in pixels)
+	*/
+	void	setSize(const Size& size)		{d_area.setSize(size);}
+
+
+	/*!
+	\brief
+		Set the area for the frame
+
+	\param area
+		Rect object describing the pixel area (offset from some unknown location) of the frame.
+
+	\return
+		None.
+	*/
+	void	setRect(const Rect& area)		{d_area = area;}
+
+
+	/*!
+	\brief
+		set whether the element colours should be applied locally to each image drawn as part of the RenderableElement, or
+		applied across the whole of the RenderableElement area.
+
+	\param setting
+		- true to specify that RenderableElement colours be applied locally to each sub-image drawn as part of this RenderableElement.
+		- false to specify that RenderableElement colours should be applied evenly across the face of the entire RenderableElement.
+
+	\return
+		Nothing.
+	*/
+	void	setColourRectPerImage(bool setting)		{d_useColoursPerImage = setting;}
+
+
+	/*************************************************************************
+		Construction / Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for RenderableElement base class
+	*/
+	RenderableElement(void);
+
+
+
+	/*!
+	\brief
+		Destructor for RenderableElement base class
+	*/
+	virtual ~RenderableElement(void);
+
+
+protected:
+	/*************************************************************************
+		Implementation methods
+	*************************************************************************/
+	/*!
+	\brief
+		This function performs the required rendering for this element.
+
+	\param position
+		Vector3 object describing the final rendering position for the object.
+
+	\param clip_rect
+		Rect object describing the clipping area for the rendering.  No rendering will be performed outside this area.
+
+	\return
+		Nothing.
+	*/
+	virtual void	draw_impl(const Vector3& position, const Rect& clip_rect) const = 0;
+
+    /*!
+    \brief
+        Implementation method to draw the element into the given RenderCache
+
+    \param renderCache
+        RenderCache object where element imagery is to be queued.
+
+    \return
+        Nothing.
+    */
+    virtual void draw_impl(RenderCache& renderCache) const = 0;
+
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	RenderableElement*	d_next;		//!< Link to another RenderableElement.
+	ColourRect	d_colours;			//!< Colours to be used for this element;
+	Rect		d_area;				//!< Currently defined area for this element.
+	bool		d_useColoursPerImage;	//!< true if d_colours should be applied separately to each Image drawn (false to interpolate across d_area).
+};
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIRenderableElement_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIXMLParser.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIXMLParser.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIXMLParser.h	(revision 1812)
@@ -0,0 +1,141 @@
+/************************************************************************
+    filename:   CEGUIXMLParser.h
+    created:    12/3/2005
+    author:     Paul D Turner
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+ 
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+ 
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+ 
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIXMLParser_h_
+#define _CEGUIXMLParser_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIString.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+    /*!
+    \brief
+        This is an abstract class that is used by CEGUI to interface with XML parser libraries.
+     */
+    class CEGUIEXPORT XMLParser
+    {
+    public:
+        /*!
+        \brief
+            XMLParser base class constructor.
+         */
+        XMLParser(void);
+
+        /*!
+        \brief
+            XMLParser base class destructor.
+         */
+        virtual ~XMLParser(void);
+
+        /*!
+        \brief
+            Initialises the XMLParser module ready for use.
+
+            Note that this calls the protected abstract method 'initialiseImpl', which should
+            be provided in your implementation to perform any required initialisation.
+
+        \return
+            - true if the module initialised successfully.
+            - false if the module initialisation failed.
+         */
+        bool initialise(void);
+
+        /*!
+        \brief
+            Cleans up the XMLParser module after use.
+
+            Note that this calls the protected abstract method 'cleanupImpl', which should
+            be provided in your implementation to perform any required cleanup.
+
+        \return
+            Nothing.
+         */
+        void cleanup(void);
+
+        /*!
+        \brief
+            abstract method which initiates parsing of an XML file.
+
+        \param handler
+            XMLHandler based object which will process the XML elements.
+
+        \param filename
+            String object holding the filename of the XML file to be parsed.
+
+        \param schemaName
+            String object holding the name of the XML schema file to use for validating the XML.
+            Note that whether this is used or not is dependant upon the XMLParser in use.
+
+        \param resourceGroup
+            String object holding the resource group identifier which will be passed to the
+            ResourceProvider when loading the XML and schema files.
+
+        \return
+            Nothing.
+         */
+        virtual void parseXMLFile(XMLHandler& handler, const String& filename, const String& schemaName, const String& resourceGroup) = 0;
+
+        /*!
+        \brief
+            Return identification string for the XML parser module.  If the internal id string has not been
+            set by the XML parser module creator, a generic string of "Unknown XML parser" will be returned.
+
+        \return
+            String object holding a string that identifies the XML parser in use.
+        */
+        const String& getIdentifierString() const;
+
+    protected:
+        /*!
+        \brief
+            abstract method which initialises the XMLParser ready for use.
+
+        \return
+            - true if the module initialised successfully.
+            - false if the module initialisation failed.
+         */
+        virtual bool initialiseImpl(void) = 0;
+
+        /*!
+        \brief
+            abstract method which cleans up the XMLParser after use.
+
+        \return
+            Nothing.
+         */
+
+        virtual void cleanupImpl(void) = 0;
+
+        // data fields
+        String d_identifierString;                 //!< String that holds some id information about the module.
+
+    private:
+        bool d_initialised;     //!< true if the parser module has been initialised,
+    };
+
+} // End of  CEGUI namespace section
+
+
+#endif  // end of guard _CEGUIXMLParser_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIGlobalEventSet.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIGlobalEventSet.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIGlobalEventSet.h	(revision 1812)
@@ -0,0 +1,141 @@
+/************************************************************************
+	filename: 	CEGUIGlobalEventSet.h
+	created:	16/1/2005
+	author:		Paul D Turner
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http:www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIGlobalEventSet_h_
+#define _CEGUIGlobalEventSet_h_
+
+#include "CEGUIEventSet.h"
+#include "CEGUISingleton.h"
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4275)
+#endif
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+    The GlobalEventSet singleton allows you to subscribe to an event for all
+    instances of a class.  The GlobalEventSet effectively supports "late binding"
+    to events; which means you can subscribe to some event that does not actually
+    exist (yet).
+*/
+class CEGUIEXPORT GlobalEventSet : public EventSet, public Singleton<GlobalEventSet>
+{
+public:
+	GlobalEventSet();
+	~GlobalEventSet();
+
+
+	/*!
+	\brief
+		Return singleton System object
+
+	\return
+		Singleton System object
+	*/
+	static	GlobalEventSet&	getSingleton(void);
+
+
+	/*!
+	\brief
+		Return pointer to singleton System object
+
+	\return
+		Pointer to singleton System object
+	*/
+	static	GlobalEventSet*	getSingletonPtr(void);
+
+
+	/*!
+	\brief
+		Subscribes the the named Event.
+
+	\note
+		If the named event does not exist it is added.
+
+	\param name
+		String object containing the name of the Event to subscribe to.
+
+	\param subscriber
+		Function or object that is to be subscribed to the Event.
+
+	\return
+		Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.
+	*/
+	virtual Event::Connection	subscribeEvent(const String& name, Event::Subscriber subscriber);
+
+
+	/*!
+	\brief
+		Subscribes the the specified group of the named Event.
+
+	/note
+		If the named event does not exist it is added.
+
+	\param name
+		String object containing the name of the Event to subscribe to.
+
+	\param group
+		Group which is to be subscribed to.  Subscription groups are called in ascending order.
+
+	\param subscriber
+		Function or object that is to be subscribed to the Event.
+
+	\return
+		Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.
+	*/
+	virtual Event::Connection	subscribeEvent(const String& name, Event::Group group, Event::Subscriber subscriber);
+
+
+	/*!
+	\brief
+		Fires the named event passing the given EventArgs object.
+
+	\param name
+		String object holding the name of the Event that is to be fired (triggered)
+
+	\param args
+		The EventArgs (or derived) object that is to be bassed to each subscriber of the Event.  Once all subscribers
+		have been called the 'handled' field of the event is updated appropriately.
+		
+	\param eventNamespace
+		String object describing the namespace prefix to use when firing the global event.
+
+	\return
+		Nothing.
+	*/
+	virtual void	fireEvent(const String& name, EventArgs& args, const String& eventNamespace = "");
+};
+
+} // End of  CEGUI namespace section
+
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIGlobalEventSet_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUI.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUI.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUI.h	(revision 1812)
@@ -0,0 +1,100 @@
+/************************************************************************
+	filename: 	CEGUI.h
+	created:	21/2/2004
+	author:		Paul D Turner
+	
+	purpose:	Main system include for client code
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUI_h_
+#define _CEGUI_h_
+
+// base stuff
+#include "CEGUIBase.h"
+#include "CEGUIString.h"
+#include "CEGUIRect.h"
+#include "CEGUIExceptions.h"
+#include "CEGUITexture.h"
+#include "CEGUIRenderer.h"
+#include "CEGUIImageset.h"
+#include "CEGUIImagesetManager.h"
+#include "CEGUILogger.h"
+#include "CEGUIMouseCursor.h"
+#include "CEGUIFont.h"
+#include "CEGUIFontManager.h"
+#include "CEGUIEventArgs.h"
+#include "CEGUIEvent.h"
+#include "CEGUIEventSet.h"
+#include "CEGUIGlobalEventSet.h"
+#include "CEGUIProperty.h"
+#include "CEGUIPropertySet.h"
+#include "CEGUIWindow.h"
+#include "CEGUIWindowFactory.h"
+#include "CEGUIWindowFactoryManager.h"
+#include "CEGUIWindowManager.h"
+#include "CEGUIScheme.h"
+#include "CEGUISchemeManager.h"
+#include "CEGUISystem.h"
+#include "CEGUIScriptModule.h"
+
+// mid-level renderables
+#include "CEGUIRenderableFrame.h"
+#include "CEGUIRenderableImage.h"
+
+// gui elements
+#include "elements/CEGUIButtonBase.h"
+#include "elements/CEGUIPushButton.h"
+#include "elements/CEGUICheckbox.h"
+#include "elements/CEGUIRadioButton.h"
+#include "elements/CEGUITitlebar.h"
+#include "elements/CEGUIFrameWindow.h"
+#include "elements/CEGUIProgressBar.h"
+#include "elements/CEGUIEditbox.h"
+#include "elements/CEGUIThumb.h"
+#include "elements/CEGUISlider.h"
+#include "elements/CEGUIScrollbar.h"
+#include "elements/CEGUIStatic.h"
+#include "elements/CEGUIListbox.h"
+#include "elements/CEGUICombobox.h"
+#include "elements/CEGUIListHeader.h"
+#include "elements/CEGUIMultiColumnList.h"
+#include "elements/CEGUIStaticText.h"
+#include "elements/CEGUIStaticImage.h"
+#include "elements/CEGUIGUISheet.h"
+#include "elements/CEGUIListboxTextItem.h"
+#include "elements/CEGUIComboDropList.h"
+#include "elements/CEGUIMultiLineEditbox.h"
+#include "elements/CEGUITabButton.h"
+#include "elements/CEGUITabPane.h"
+#include "elements/CEGUITabControl.h"
+#include "elements/CEGUISpinner.h"
+#include "elements/CEGUIDragContainer.h"
+#include "elements/CEGUIScrolledContainer.h"
+#include "elements/CEGUIScrollablePane.h"
+#include "elements/CEGUITooltip.h"
+#include "elements/CEGUIItemEntry.h"
+#include "elements/CEGUITextItem.h"
+#include "elements/CEGUIMenuItem.h"
+#include "elements/CEGUIItemListBase.h"
+#include "elements/CEGUIMenuBase.h"
+#include "elements/CEGUIMenubar.h"
+#include "elements/CEGUIPopupMenu.h"
+
+#endif	// end of guard _CEGUI_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIFont_xmlHandler.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIFont_xmlHandler.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIFont_xmlHandler.h	(revision 1812)
@@ -0,0 +1,114 @@
+/************************************************************************
+filename: 	CEGUIFont_xmlHandler.h
+created:	21/2/2004
+author:		Paul D Turner
+
+purpose:	Defines interface for the Font class
+*************************************************************************/
+/*************************************************************************
+Crazy Eddie's GUI System (http://www.cegui.org.uk)
+Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIFont_xmlHandler_h_
+#define _CEGUIFont_xmlHandler_h_
+
+#include "CEGUIFont.h"
+#include "CEGUIXMLHandler.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+Handler class used to parse the Font XML files using SAX2
+*/
+class Font_xmlHandler : public XMLHandler
+{
+public:
+	/*************************************************************************
+	Construction & Destruction
+	*************************************************************************/
+	/*!
+	\brief
+	Constructor for Font::xmlHandler objects
+
+	\param font
+	Pointer to the Font object creating this xmlHandler object
+	*/
+	Font_xmlHandler(Font* font) : d_font(font) {}
+
+	/*!
+	\brief
+	Destructor for Font::xmlHandler objects
+	*/
+	virtual ~Font_xmlHandler(void) {}
+
+	/*************************************************************************
+	SAX2 Handler overrides
+	*************************************************************************/
+	/*!
+	\brief
+	document processing (only care about elements, schema validates format)
+	*/
+    virtual void elementStart(const String& element, const XMLAttributes& attributes);
+    virtual void elementEnd(const String& element);
+
+private:
+	/*************************************************************************
+	Implementation Constants
+	*************************************************************************/
+	// XML related strings
+	static const String FontElement;					//!< Tag name for Font elements.
+	static const String MappingElement;				//!< Tag name for Mapping elements.
+	static const String FontTypeStatic;				//!< Value used for FontTypeAttribute for a static (bitmapped) font.
+	static const String FontTypeDynamic;				//!< Value used for FontTypeAttribute for a dynamic (true-type) font.
+	static const String GlyphElement;					//!< Tag name for Glyph elements.
+	static const String GlyphRangeElement;			//!< Tag name for GlyphRange elements.
+	static const String GlyphSetElement;				//!< Tag name for GlyphSet elements.
+	static const char	FontNameAttribute[];			//!< Attribute name that stores the name of the Font
+    static const char	FontFilenameAttribute[];		//!< Attribute name that stores the filename, this is either an Imageset xml file, or a font file.
+    static const char	FontResourceGroupAttribute[];   //!< Attribute name that stores the resource group identifier used when loading font file.
+	static const char	FontTypeAttribute[];			//!< Attribute name that stores the type of font being defined (either static or dynamic).
+	static const char	FontSizeAttribute[];			//!< Attribute name that stores the point size for a dynamic font.
+	static const char	FontFirstCodepointAttribute[];	//!< Attribute name that stores the first code-point for a dynamic font.
+	static const char	FontLastCodepointAttribute[];	//!< Attribute name that stores the last code-point for a dynamic font.
+	static const char	FontNativeHorzResAttribute[];	//!< Optional attribute that stores 'native' horizontal resolution for the Font.
+	static const char	FontNativeVertResAttribute[];	//!< Optional attribute that stores 'native' vertical resolution for the Font.
+	static const char	FontAutoScaledAttribute[];		//!< Optional attribute that specifies whether the Font should be auto-scaled.
+	static const char	FontAntiAliasedAttribute[];		//!< Optional attribute that specifies whether the TTF based font should be anti-aliased.
+	static const char	MappingCodepointAttribute[];	//!< Attribute name that stores the Unicode code-point for a mapping.
+	static const char	MappingImageAttribute[];		//!< Attribute name that stores the Image name for a mapping.
+	static const char	MappingHorzAdvanceAttribute[];	//!< Attribute name that stores the horizontal advance for a glyph.
+	static const char	GlyphCodepointAttribute[];				//!< Attribute name that stores the U+ codepoint to add to the set.
+	static const char	GlyphRangeStartCodepointAttribute[];	//!< Attribute name that stores the U+ codepoint for the start of a range.
+	static const char	GlyphRangeEndCodepointAttribute[];		//!< Attribute name that stores the U+ codepoint for the end of a range.
+	static const char	GlyphSetGlyphsAttribute[];				//!< Attribute name that stores the UTF8 encoded codepoint set.
+
+	// general constants
+	static const int	AutoGenerateHorzAdvance;		//!< Horizontal advance value that tells the parser to auto-calculate some reasonable value.
+
+	/*************************************************************************
+	Implementation Data
+	*************************************************************************/
+	Font*	d_font;			//!< Font object that we are helping to build
+	String	d_glyphSet;		//!< String holding the set of codepoints to be available.
+};
+
+} // End of  CEGUI namespace section
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIWindowProperties.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIWindowProperties.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIWindowProperties.h	(revision 1812)
@@ -0,0 +1,1704 @@
+/************************************************************************
+	filename: 	CEGUIWindowProperties.h
+	created:	5/7/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to available window base class properties
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIWindowProperties_h_
+#define _CEGUIWindowProperties_h_
+
+#include "CEGUIProperty.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+// Start of WindowProperties namespace section
+/*!
+\brief
+	Namespace containing all classes that make up the properties interface for the Window base class
+*/
+namespace WindowProperties
+{
+/*!
+\brief
+	Property to access minimum window size.
+
+	This property offers access to the minimum size setting for the window, using screen relative metrics.
+
+	\par Usage:
+		- Name: RelativeMinSize
+		- Format: "w:[float] h:[float]".
+
+	\par Where:
+		- w:[float]	specifies the minimum width as a floating point number.
+		- h:[float] specifies the minimum height as a floating point number.
+*/
+class RelativeMinSize : public Property
+{
+public:
+	RelativeMinSize() : Property(
+		"RelativeMinSize",
+		"Property to get/set the minimum size for the Window.  Value is \"w:[float] h:[float]\" using relative metrics (this setting is relative to the display size).",
+		"w:0.000000 h:0.000000", false)
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access maximum window size.
+
+	This property offers access to the maximum size setting for the window, using screen relative metrics.
+
+	\par Usage:
+		- Name: RelativeMaxSize
+		- Format: "w:[float] h:[float]".
+
+	\par Where:
+		- w:[float]	specifies the maximum width as a floating point number.
+		- h:[float] specifies the maximum height as a floating point number.
+*/
+class RelativeMaxSize : public Property
+{
+public:
+	RelativeMaxSize() : Property(
+		"RelativeMaxSize",
+		"Property to get/set the maximum size for the Window.  Value is \"w:[float] h:[float]\" using relative metrics (this setting is relative to the display size).",
+		"w:1.000000 h:1.000000", false)
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access minimum window size.
+
+	This property offers access to the minimum size setting for the window, using absolute screen pixel metrics.
+
+	\par Usage:
+		- Name: AbsoluteMinSize
+		- Format: "w:[float] h:[float]".
+
+	\par Where:
+		- w:[float]	specifies the minimum width as a floating point number.
+		- h:[float] specifies the minimum height as a floating point number.
+*/
+class AbsoluteMinSize : public Property
+{
+public:
+	AbsoluteMinSize() : Property(
+		"AbsoluteMinSize",
+		"Property to get/set the minimum size for the Window.  Value is \"w:[float] h:[float]\" using absolute (pixel) metrics.",
+		"w:0.000000 h:0.000000", false)
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access maximum window size.
+
+	This property offers access to the maximum size setting for the window, using absolute screen pixel metrics.
+
+	\par Usage:
+		- Name: AbsoluteMaxSize
+		- Format: "w:[float] h:[float]".
+
+	\par Where:
+		- w:[float]	specifies the maximum width as a floating point number.
+		- h:[float] specifies the maximum height as a floating point number.
+*/
+class AbsoluteMaxSize : public Property
+{
+public:
+	AbsoluteMaxSize() : Property(
+		"AbsoluteMaxSize",
+		"Property to get/set the maximum size for the Window.  Value is \"w:[float] h:[float]\" using absolute (pixel) metrics.",
+		"", false)
+		{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+
+	// default depends upon current size of display.
+	bool	isDefault(const PropertyReceiver* receiver) const;
+	String	getDefault(const PropertyReceiver* receiver) const;
+};
+
+
+/*!
+\brief
+	Property to access the metrics mode setting.
+
+	This property offers access to the metrics mode setting for the window.
+
+	\par Usage:
+		- Name: MetricsMode
+		- Format: "[text]".
+
+	\par Where [text] is:
+		- "Relative" for the relative metrics mode.
+		- "Absolute" for the absolute metrics mode.
+		- "Inherited" if metrics should be inherited from the parent (only used with set method).
+*/
+class MetricsMode : public Property
+{
+public:
+	MetricsMode() : Property(
+		"MetricsMode",
+		"Property to get/set the metrics mode for the Window.  Value is \"Relative\", \"Absolute\", or \"Inherited\".",
+		"Relative")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access window ID field.
+
+	This property offers access to the client specified ID for the window.
+
+	\par Usage:
+		- Name: ID
+		- Format: "[uint]".
+
+	\par Where:
+		- [uint] is any unsigned integer value.
+*/
+class ID : public Property
+{
+public:
+	ID() : Property(
+		"ID",
+		"Property to get/set the ID value of the Window.  Value is an unsigned integer number.",
+		"0")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access window alpha setting.
+
+	This property offers access to the alpha-blend setting for the window.
+
+	\par Usage:
+		- Name: Alpha
+		- Format: "[float]".
+
+	\par Where:
+		- [float] is a floating point number between 0.0 and 1.0.
+*/
+class Alpha : public Property
+{
+public:
+	Alpha() : Property(
+		"Alpha",
+		"Property to get/set the alpha value of the Window.  Value is floating point number.",
+		"1.000000") 
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access window Font setting.
+
+	This property offers access to the current Font setting for the window.
+
+	\par Usage:
+		- Name: Font
+		- Format: "[text]".
+
+	\par Where:
+		- [text] is the name of the Font to assign for this window.  The Font specified must already be loaded.
+*/
+class Font : public Property
+{
+public:
+	Font() : Property(
+		"Font",
+		"Property to get/set the font for the Window.  Value is the name of the font to use (must be loaded already).",
+		"")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+	bool	isDefault(const PropertyReceiver* receiver) const;
+};
+
+
+/*!
+\brief
+	Property to access window text setting.
+
+	This property offers access to the current text for the window.
+
+	\par Usage:
+		- Name: Text
+		- Format: "[text]".
+
+	\par Where:
+		- [text] is the name of the Font to assign for this window.  The Font specified must already be loaded.
+*/
+class Text : public Property
+{
+public:
+	Text() : Property(
+		"Text", 
+		"Property to get/set the text / caption for the Window.  Value is the text string to use.",
+		"")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access window mouse cursor setting.
+
+	This property offers access to the current mouse cursor image for the window.
+
+	\par Usage:
+		- Name: MouseCursorImage
+		- Format: "set:[text] image:[text]".
+
+	\par Where:
+		- set:[text] is the name of the Imageset containing the image.  The Imageset name should not contain spaces.  The Imageset specified must already be loaded.
+		- image:[text] is the name of the Image on the specified Imageset.  The Image name should not contain spaces.
+*/
+class MouseCursorImage : public Property
+{
+public:
+	MouseCursorImage() : Property(
+		"MouseCursorImage",
+		"Property to get/set the mouse cursor image for the Window.  Value should be \"set:<imageset name> image:<image name>\".",
+		"")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+	bool	isDefault(const PropertyReceiver* receiver) const;
+};
+
+
+/*!
+\brief
+	Property to access window "clipped by parent" setting.
+
+	This property offers access to the clipped by parent setting for the window.
+
+	\par Usage:
+		- Name: ClippedByParent
+		- Format: "[text]".
+
+	\par Where [Text] is:
+		- "True" to indicate the Window is clipped by it's parent.
+		- "False" to indicate the Window is not clipped by it's parent.
+*/
+class ClippedByParent : public Property
+{
+public:
+	ClippedByParent() : Property(
+		"ClippedByParent",
+		"Property to get/set the 'clipped by parent' setting for the Window.  Value is either \"True\" or \"False\".",
+		"True")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access window "Inherits Alpha" setting.
+
+	This property offers access to the inherits alpha setting for the window.
+
+	\par Usage:
+		- Name: InheritsAlpha
+		- Format: "[text]".
+
+	\par Where [Text] is:
+		- "True" to indicate the Window inherits alpha blend values from it's ancestors.
+		- "False" to indicate the Window does not inherit alpha blend values from it's ancestors.
+*/
+class InheritsAlpha : public Property
+{
+public:
+	InheritsAlpha() : Property(
+		"InheritsAlpha",
+		"Property to get/set the 'inherits alpha' setting for the Window.  Value is either \"True\" or \"False\".",
+		"True")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access window "Always-On-Top" setting.
+
+	This property offers access to the always on top / topmost setting for the window.
+
+	\par Usage:
+		- Name: AlwaysOnTop
+		- Format: "[text]".
+
+	\par Where [Text] is:
+		- "True" to indicate the Window is always on top, and appears above all other non-always on top Windows.
+		- "False" to indicate the Window is not always on top, and will appear below all other always on top Windows.
+*/
+class AlwaysOnTop : public Property
+{
+public:
+	AlwaysOnTop() : Property(
+		"AlwaysOnTop",
+		"Property to get/set the 'always on top' setting for the Window.  Value is either \"True\" or \"False\".",
+		"False")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access window Disabled setting.
+
+	This property offers access to the enabled / disabled setting for the window.
+
+	\par Usage:
+		- Name: Disabled
+		- Format: "[text]".
+
+	\par Where [Text] is:
+		- "True" to indicate the Window is disabled, and will normally receive no inputs from the user.
+		- "False" to indicate the Window is not disabled and will receive inputs from the user as normal.
+*/
+class Disabled : public Property
+{
+public:
+	Disabled() : Property(
+		"Disabled",
+		"Property to get/set the 'disabled state' setting for the Window.  Value is either \"True\" or \"False\".",
+		"False")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+	bool	isDefault(const PropertyReceiver* receiver) const;
+};
+
+
+/*!
+\brief
+	Property to access window Visible setting.
+
+	This property offers access to the visible setting for the window.
+
+	\par Usage:
+		- Name: Visible
+		- Format: "[text]".
+
+	\par Where [Text] is:
+		- "True" to indicate the Window is visible.
+		- "False" to indicate the Window is not visible.
+*/
+class Visible : public Property
+{
+public:
+	Visible() : Property(
+		"Visible",
+		"Property to get/set the 'visible state' setting for the Window.  Value is either \"True\" or \"False\".",
+		"True")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+	bool	isDefault(const PropertyReceiver* receiver) const;
+};
+
+
+/*!
+\brief
+	Property to access window Restore Old Capture setting.
+
+	This property offers access to the restore old capture setting for the window.  This setting is of generally limited use, it
+	is primary purpose is for certain operations required for compound widgets.
+
+	\par Usage:
+		- Name: RestoreOldCapture
+		- Format: "[text]".
+
+	\par Where [Text] is:
+		- "True" to indicate the Window should restore any previous capture Window when it loses input capture.
+		- "False" to indicate the Window should not restore the old capture Window.  This is the default behaviour.
+*/
+class RestoreOldCapture : public Property
+{
+public:
+	RestoreOldCapture() : Property(
+		"RestoreOldCapture",
+		"Property to get/set the 'restore old capture' setting for the Window.  Value is either \"True\" or \"False\".",
+		"False")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access window Destroyed by Parent setting.
+
+	This property offers access to the destryed by parent setting for the window.
+
+	\par Usage:
+		- Name: DestroyedByParent
+		- Format: "[text]".
+
+	\par Where [Text] is:
+		- "True" to indicate the Window should be automatically destroyed when it's parent Window is destroyed.
+		- "False" to indicate the Window should not be destroyed when it's parent Window is destroyed.
+*/
+class DestroyedByParent : public Property
+{
+public:
+	DestroyedByParent() : Property(
+		"DestroyedByParent",
+		"Property to get/set the 'destroyed by parent' setting for the Window.  Value is either \"True\" or \"False\".",
+		"True")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access window width.
+
+	This property offers access to the Width setting for the window, using the Windows active metrics mode.
+
+	\par Usage:
+		- Name: Width
+		- Format: "[float]".
+
+	\par Where:
+		- [float]	specifies the width as a floating point number, using the active metrics system for the Window.
+*/
+class Width : public Property
+{
+public:
+	Width() : Property(
+		"Width",
+		"Property to get/set the width of the Window.  Value is floating point using the active metrics mode.",
+		"0.000000", false) {}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access window width.
+
+	This property offers access to the Width setting for the window, using the relative metrics mode.
+
+	\par Usage:
+		- Name: RelativeWidth
+		- Format: "[float]".
+
+	\par Where:
+		- [float]	specifies the width as a floating point number, using the relative metrics system.
+*/
+class RelativeWidth : public Property
+{
+public:
+	RelativeWidth() : Property(
+		"RelativeWidth",
+		"Property to get/set the width of the Window.  Value is floating point using relative metrics.",
+		"0.000000", false)
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access window width.
+
+	This property offers access to the Width setting for the window, using the absolute metrics mode.
+
+	\par Usage:
+		- Name: AbsoluteWidth
+		- Format: "[float]".
+
+	\par Where:
+		- [float]	specifies the width as a floating point number, using the absolute metrics system.
+*/
+class AbsoluteWidth: public Property
+{
+public:
+	AbsoluteWidth() : Property(
+		"AbsoluteWidth",
+		"Property to get/set the width of the Window.  Value is floating point using absolute metrics.",
+		"0.000000", false)
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access window height.
+
+	This property offers access to the Height setting for the window, using the Windows active metrics mode.
+
+	\par Usage:
+		- Name: Height
+		- Format: "[float]".
+
+	\par Where:
+		- [float]	specifies the height as a floating point number, using the active metrics system for the Window.
+*/
+class Height : public Property
+{
+public:
+	Height() : Property(
+		"Height",
+		"Property to get/set the height of the Window.  Value is floating point using the active metrics mode.",
+		"0.000000", false)
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access window height.
+
+	This property offers access to the Height setting for the window, using the relative metrics mode.
+
+	\par Usage:
+		- Name: RelativeHeight
+		- Format: "[float]".
+
+	\par Where:
+		- [float]	specifies the height as a floating point number, using the relative metrics system.
+*/
+class RelativeHeight : public Property
+{
+public:
+	RelativeHeight() : Property(
+		"RelativeHeight",
+		"Property to get/set the height of the Window.  Value is floating point using relative metrics.",
+		"0.000000", false)
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access window height.
+
+	This property offers access to the Height setting for the window, using the absolute metrics mode.
+
+	\par Usage:
+		- Name: AbsoluteHeight
+		- Format: "[float]".
+
+	\par Where:
+		- [float]	specifies the height as a floating point number, using the absolute metrics system.
+*/
+class AbsoluteHeight : public Property
+{
+public:
+	AbsoluteHeight() : Property(
+		"AbsoluteHeight",
+		"Property to get/set the height of the Window.  Value is floating point using absolute metrics.",
+		"0.000000", false)
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the window size.
+
+	This property offers access to the size setting for the window, using the Windows active metrics mode.
+
+	\par Usage:
+		- Name: Size
+		- Format: "w:[float] h:[float]".
+
+	\par Where:
+		- w:[float]	specifies the minimum width as a floating point number, using the active metrics system for the Window.
+		- h:[float] specifies the minimum height as a floating point number, using the active metrics system for the Window.
+*/
+class Size : public Property
+{
+public:
+	Size() : Property(
+		"Size",
+		"Property to get/set the size of the Window.  Value is \"w:[float] h:[float]\" using the active metrics mode.",
+		"w:0.000000 h:0.000000", false)
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the window size.
+
+	This property offers access to the size setting for the window, using the relative metrics system.
+
+	\par Usage:
+		- Name: RelativeSize
+		- Format: "w:[float] h:[float]".
+
+	\par Where:
+		- w:[float]	specifies the minimum width as a floating point number, using the relative metrics system.
+		- h:[float] specifies the minimum height as a floating point number, using the relative metrics system.
+*/
+class RelativeSize : public Property
+{
+public:
+	RelativeSize() : Property(
+		"RelativeSize",
+		"Property to get/set the size of the Window.  Value is \"w:[float] h:[float]\" using relative metrics.",
+		"w:0.000000 h:0.000000", false)
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access the window size.
+
+	This property offers access to the size setting for the window, using the absolute metrics system.
+
+	\par Usage:
+		- Name: AbsoluteSize
+		- Format: "w:[float] h:[float]".
+
+	\par Where:
+		- w:[float]	specifies the minimum width as a floating point number, using the absolute metrics system.
+		- h:[float] specifies the minimum height as a floating point number, using the absolute metrics system.
+*/
+class AbsoluteSize : public Property
+{
+public:
+	AbsoluteSize() : Property(
+		"AbsoluteSize",
+		"Property to get/set the size of the Window.  Value is \"w:[float] h:[float]\" using absolute metrics.",
+		"w:0.000000 h:0.000000", false)
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access window X position.
+
+	This property offers access to the X position for the window, using the Windows active metrics mode.
+
+	\par Usage:
+		- Name: XPosition
+		- Format: "[float]".
+
+	\par Where:
+		- [float]	specifies the x position co-ordinate as a floating point number, using the active metrics system for the Window.
+*/
+class XPosition : public Property
+{
+public:
+	XPosition() : Property(
+		"XPosition",
+		"Property to get/set the x co-ordinate position of the Window.  Value is a floating point number using the active metrics mode.",
+		"0.000000", false)
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access window X position.
+
+	This property offers access to the X position for the window, using the relative metrics system.
+
+	\par Usage:
+		- Name: RelativeXPosition
+		- Format: "[float]".
+
+	\par Where:
+		- [float]	specifies the x position co-ordinate as a floating point number, using the relative metrics system.
+*/
+class RelativeXPosition : public Property
+{
+public:
+	RelativeXPosition() : Property(
+		"RelativeXPosition",
+		"Property to get/set the x co-ordinate position of the Window.  Value is a floating point number using relative metrics.",
+		"0.000000", false)
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access window X position.
+
+	This property offers access to the X position for the window, using the absolute metrics system.
+
+	\par Usage:
+		- Name: AbsoluteXPosition
+		- Format: "[float]".
+
+	\par Where:
+		- [float]	specifies the x position co-ordinate as a floating point number, using the absolute metrics system.
+*/
+class AbsoluteXPosition : public Property
+{
+public:
+	AbsoluteXPosition() : Property(
+		"AbsoluteXPosition",
+		"Property to get/set the x co-ordinate position of the Window.  Value is a floating point number using absolute metrics.",
+		"0.000000", false)
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access window Y position.
+
+	This property offers access to the Y position for the window, using the Windows active metrics mode.
+
+	\par Usage:
+		- Name: YPosition
+		- Format: "[float]".
+
+	\par Where:
+		- [float]	specifies the y position co-ordinate as a floating point number, using the active metrics system for the Window.
+*/
+class YPosition : public Property
+{
+public:
+	YPosition() : Property(
+		"YPosition",
+		"Property to get/set the y co-ordinate position of the Window.  Value is a floating point number using the active metrics mode.",
+		"0.000000", false)
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access window Y position.
+
+	This property offers access to the Y position for the window, using the relative metrics system.
+
+	\par Usage:
+		- Name: RelativeYPosition
+		- Format: "[float]".
+
+	\par Where:
+		- [float]	specifies the y position co-ordinate as a floating point number, using the relative metrics system.
+*/
+class RelativeYPosition : public Property
+{
+public:
+	RelativeYPosition() : Property(
+		"RelativeYPosition",
+		"Property to get/set the y co-ordinate position of the Window.  Value is a floating point number using relative metrics.",
+		"0.000000", false)
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access window Y position.
+
+	This property offers access to the Y position for the window, using the absolute metrics system.
+
+	\par Usage:
+		- Name: AbsoluteYPosition
+		- Format: "[float]".
+
+	\par Where:
+		- [float]	specifies the y position co-ordinate as a floating point number, using the absolute metrics system.
+*/
+class AbsoluteYPosition : public Property
+{
+public:
+	AbsoluteYPosition() : Property(
+		"AbsoluteYPosition",
+		"Property to get/set the y co-ordinate position of the Window.  Value is a floating point number using absolute metrics.",
+		"0.000000", false)
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access window position.
+
+	This property offers access to the position for the window, using the Windows active metrics mode.
+
+	\par Usage:
+		- Name: Position
+		- Format: "x:[float] y:[float]".
+
+	\par Where:
+		- x:[float]	specifies the x position co-ordinate as a floating point number, using the active metrics system for the Window.
+		- y:[float]	specifies the y position co-ordinate as a floating point number, using the active metrics system for the Window.
+*/
+class Position : public Property
+{
+public:
+	Position() : Property(
+		"Position",
+		"Property to get/set the position of the Window.  Value is \"x:[float] y:[float]\" using the active metrics mode.",
+		"x:0.000000 y:0.000000", false)
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access window position.
+
+	This property offers access to the position for the window, using the relative metrics system.
+
+	\par Usage:
+		- Name: RelativePosition
+		- Format: "x:[float] y:[float]".
+
+	\par Where:
+		- x:[float]	specifies the x position co-ordinate as a floating point number, using the relative metrics system.
+		- y:[float]	specifies the y position co-ordinate as a floating point number, using the relative metrics system.
+*/
+class RelativePosition : public Property
+{
+public:
+	RelativePosition() : Property(
+		"RelativePosition",
+		"Property to get/set the position of the Window.  Value is \"x:[float] y:[float]\" using relative metrics.",
+		"x:0.000000 y:0.000000", false)
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access window position.
+
+	This property offers access to the position for the window, using the absolute metrics system.
+
+	\par Usage:
+		- Name: AbsolutePosition
+		- Format: "x:[float] y:[float]".
+
+	\par Where:
+		- x:[float]	specifies the x position co-ordinate as a floating point number, using the absolute metrics system.
+		- y:[float]	specifies the y position co-ordinate as a floating point number, using the absolute metrics system.
+*/
+class AbsolutePosition : public Property
+{
+public:
+	AbsolutePosition() : Property(
+		"AbsolutePosition",
+		"Property to get/set the position of the Window.  Value is \"x:[float] y:[float]\" using absolute metrics.",
+		"x:0.000000 y:0.000000", false)
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access window area rectangle.
+
+	This property offers access to the area rectangle (Rect) for the window, using the Windows active metrics mode.
+
+	\par Usage:
+		- Name: Rect
+		- Format: "l:[float] t:[float] r:[float] b:[float]".
+
+	\par Where:
+		- l:[float]	specifies the position of the left edge of the area as a floating point number, using the active metrics system for the Window.
+		- t:[float]	specifies the position of the top edge of the area as a floating point number, using the active metrics system for the Window.
+		- r:[float]	specifies the position of the right edge of the area as a floating point number, using the active metrics system for the Window.
+		- b:[float]	specifies the position of the bottom edge of the area as a floating point number, using the active metrics system for the Window.
+*/
+class Rect : public Property
+{
+public:
+	Rect() : Property(
+		"Rect",
+		"Property to get/set the area rectangle of the Window.  Value is \"l:[float] t:[float] r:[float] b:[float]\" (where l is left, t is top, r is right, and b is bottom) using the active metrics system.",
+		"l:0.000000 t:0.000000 r:0.000000 b:0.000000", false)
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access window area rectangle.
+
+	This property offers access to the area rectangle (Rect) for the window, using the relative metrics system.
+
+	\par Usage:
+		- Name: RelativeRect
+		- Format: "l:[float] t:[float] r:[float] b:[float]".
+
+	\par Where:
+		- l:[float]	specifies the position of the left edge of the area as a floating point number, using the relative metrics system.
+		- t:[float]	specifies the position of the top edge of the area as a floating point number, using the relative metrics system.
+		- r:[float]	specifies the position of the right edge of the area as a floating point number, using the relative metrics system.
+		- b:[float]	specifies the position of the bottom edge of the area as a floating point number, using the relative metrics system.
+*/
+class RelativeRect : public Property
+{
+public:
+	RelativeRect() : Property(
+		"RelativeRect",
+		"Property to get/set the area rectangle of the Window.  Value is \"l:[float] t:[float] r:[float] b:[float]\" (where l is left, t is top, r is right, and b is bottom) using relative metrics.",
+		"l:0.000000 t:0.000000 r:0.000000 b:0.000000", false) 
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access window area rectangle.
+
+	This property offers access to the area rectangle (Rect) for the window, using the absolute metrics system.
+
+	\par Usage:
+		- Name: AbsoluteRect
+		- Format: "l:[float] t:[float] r:[float] b:[float]".
+
+	\par Where:
+		- l:[float]	specifies the position of the left edge of the area as a floating point number, using the absolute metrics system.
+		- t:[float]	specifies the position of the top edge of the area as a floating point number, using the absolute metrics system.
+		- r:[float]	specifies the position of the right edge of the area as a floating point number, using the absolute metrics system.
+		- b:[float]	specifies the position of the bottom edge of the area as a floating point number, using the absolute metrics system.
+*/
+class AbsoluteRect : public Property
+{
+public:
+	AbsoluteRect() : Property(
+		"AbsoluteRect",
+		"Property to get/set the area rectangle of the Window.  Value is \"l:[float] t:[float] r:[float] b:[float]\" (where l is left, t is top, r is right, and b is bottom) using absolute metrics.",
+		"l:0.000000 t:0.000000 r:0.000000 b:0.000000", false) 
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access window Z-Order changing enabled setting.
+
+	This property offers access to the setting that controls whether z-order changes are enabled for the window.
+
+	\par Usage:
+		- Name: ZOrderChangeEnabled
+		- Format: "[text]".
+
+	\par Where [Text] is:
+		- "True" to indicate the Window should respect requests to change z-order.
+		- "False" to indicate the Window should not change it's z-order.
+*/
+class ZOrderChangeEnabled : public Property
+{
+public:
+	ZOrderChangeEnabled() : Property(
+		"ZOrderChangeEnabled",
+		"Property to get/set the 'z-order changing enabled' setting for the Window.  Value is either \"True\" or \"False\".",
+		"True")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+    Property to control whether the window will receive double/triple-click events.
+
+    This property offers access to the setting that controls whether a window will receive double-click and
+    triple-click events, or whether the window will receive multiple single mouse button down events instead.
+
+    \par Usage:
+        - Name: WantsMultiClickEvents
+        - Format: "[text]".
+
+    \par Where [Text] is:
+        - "True" to indicate the Window wants double-click and triple-click events.
+        - "False" to indicate the Window wants multiple single mouse button down events.
+*/
+class WantsMultiClickEvents : public Property
+{
+public:
+    WantsMultiClickEvents() : Property(
+        "WantsMultiClickEvents",
+        "Property to get/set whether the window will receive double-click and triple-click events.  Value is either \"True\" or \"False\".",
+        "True")
+    {}
+
+    String	get(const PropertyReceiver* receiver) const;
+    void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+    Property to control whether the window will receive autorepeat mouse button down events.
+
+    This property offers access to the setting that controls whether a window will receive autorepeat
+    mouse button down events.
+
+    \par Usage:
+        - Name: MouseButtonDownAutoRepeat
+        - Format: "[text]".
+
+    \par Where [Text] is:
+        - "True" to indicate the Window will receive autorepeat mouse button down events.
+        - "False" to indicate the Window will not receive autorepeat mouse button down events.
+*/
+class MouseButtonDownAutoRepeat : public Property
+{
+public:
+    MouseButtonDownAutoRepeat() : Property(
+        "MouseButtonDownAutoRepeat",
+        "Property to get/set whether the window will receive autorepeat mouse button down events.  Value is either \"True\" or \"False\".",
+        "False")
+    {}
+
+    String  get(const PropertyReceiver* receiver) const;
+    void    set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+    Property to access window autorepeat delay value.
+
+    This property offers access to the value that controls the initial delay for autorepeat mouse button down events.
+
+    \par Usage:
+        - Name: AutoRepeatDelay
+        - Format: "[float]".
+
+    \par Where:
+        - [float]   specifies the delay in seconds.
+*/
+class AutoRepeatDelay : public Property
+{
+public:
+    AutoRepeatDelay() : Property(
+        "AutoRepeatDelay",
+        "Property to get/set the autorepeat delay.  Value is a floating point number indicating the delay required in seconds.",
+        "0.300000")
+    {}
+
+    String  get(const PropertyReceiver* receiver) const;
+    void    set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+    Property to access window autorepeat rate value.
+
+    This property offers access to the value that controls the generation rate for autorepeat mouse button down events.
+
+    \par Usage:
+        - Name: AutoRepeatRate
+        - Format: "[float]".
+
+    \par Where:
+        - [float]   specifies the rate at which autorepeat events will be generated in seconds.
+*/
+class AutoRepeatRate : public Property
+{
+public:
+    AutoRepeatRate() : Property(
+        "AutoRepeatRate",
+        "Property to get/set the autorepeat rate.  Value is a floating point number indicating the rate required in seconds.",
+        "0.060000")
+    {}
+
+    String  get(const PropertyReceiver* receiver) const;
+    void    set(PropertyReceiver* receiver, const String& value);
+};
+
+/*!
+\brief
+	Property to access whether inputs are passed to child windows when
+    input is captured to this window.
+
+	\par Usage:
+		- Name: DistributeCapturedInputs
+		- Format: "[text]".
+
+	\par Where [Text] is:
+		- "True" to indicate 'captured' inputs should be passed to attached child windows.
+		- "False" to indicate 'captured' inputs should be passed to this window only.
+*/
+class DistributeCapturedInputs : public Property
+{
+public:
+	DistributeCapturedInputs() : Property(
+		"DistributeCapturedInputs",
+		"Property to get/set whether captured inputs are passed to child windows.  Value is either \"True\" or \"False\".",
+		"False")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+/*!
+\brief
+    Property to access the custom tooltip for this Window.
+
+    \par Usage:
+        - Name: CustomTooltipType
+        - Format: "[text]".
+
+    \par Where:
+        - [Text] is the typename of the custom tooltip for the Window.
+ */
+class CustomTooltipType : public Property
+{
+public:
+    CustomTooltipType() : Property(
+    "CustomTooltipType",
+    "Property to get/set the custom tooltip for the window.  Value is the type name of the custom tooltip.",
+    "")
+    {}
+
+    String  get(const PropertyReceiver* receiver) const;
+    void    set(PropertyReceiver* receiver, const String& value);
+};
+
+/*!
+\brief
+    Property to access the tooltip text for this Window.
+
+    \par Usage:
+        - Name: Tooltip
+        - Format: "[text]".
+
+    \par Where:
+        - [Text] is the tooltip text for this window.
+ */
+class Tooltip : public Property
+{
+public:
+    Tooltip() : Property(
+    "Tooltip",
+    "Property to get/set the tooltip text for the window.  Value is the tooltip text for the window.",
+    "")
+    {}
+
+    String  get(const PropertyReceiver* receiver) const;
+    void    set(PropertyReceiver* receiver, const String& value);
+};
+
+/*!
+\brief
+    Property to access whether the window inherits its tooltip text from its parent whn it has no tooltip text of its own.
+
+    \par Usage:
+        - Name: InheritsTooltipText
+        - Format: "[text]".
+
+    \par Where [Text] is:
+        - "True" to indicate the Window inherits its tooltip text from its parent.
+        - "False" to indicate the Window does not inherit its tooltip text.
+*/
+class InheritsTooltipText : public Property
+{
+public:
+    InheritsTooltipText() : Property(
+        "InheritsTooltipText",
+        "Property to get/set whether the window inherits its parents tooltip text when it has none of its own.  Value is either \"True\" or \"False\".",
+        "False")
+    {}
+
+    String  get(const PropertyReceiver* receiver) const;
+    void    set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+	Property to access whether the window rises to the top of the z order when clicked.
+
+	\par Usage:
+		- Name: RiseOnClick
+		- Format: "[text]".
+
+	\par Where [Text] is:
+		- "True" to indicate the Window will rise to the surface when clicked.
+		- "False" to indicate the Window will not change z position when clicked.
+*/
+class RiseOnClick : public Property
+{
+public:
+    RiseOnClick() : Property(
+		"RiseOnClick",
+		"Property to get/set whether the window will come tot he top of the z order hwn clicked.  Value is either \"True\" or \"False\".",
+		"True")
+	{}
+
+	String	get(const PropertyReceiver* receiver) const;
+	void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+    Property to access the vertical alignment setting for the window.
+
+    \par Usage:
+        - Name: VerticalAlignment
+        - Format: "[text]".
+
+    \par Where [Text] is:
+        - "Top" to indicate the windows position is an offset of its top edge from its parents top edge.
+        - "Centre" to indicate the windows position is an offset of its centre point from its parents centre point.
+        - "Bottom" to indicate the windows position is an offset of its bottom edge from its parents bottom edge.
+*/
+class VerticalAlignment : public Property
+{
+    public:
+        VerticalAlignment() : Property(
+        "VerticalAlignment",
+        "Property to get/set the windows vertical alignment.  Value is one of \"Top\", \"Centre\" or \"Bottom\".",
+        "Top")
+        {}
+
+        String	get(const PropertyReceiver* receiver) const;
+        void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+    Property to access the horizontal alignment setting for the window.
+
+    \par Usage:
+        - Name: HorizontalAlignment
+        - Format: "[text]".
+
+    \par Where [Text] is:
+        - "Left" to indicate the windows position is an offset of its left edge from its parents left edge.
+        - "Centre" to indicate the windows position is an offset of its centre point from its parents centre point.
+        - "Right" to indicate the windows position is an offset of its right edge from its parents right edge.
+*/
+class HorizontalAlignment : public Property
+{
+    public:
+        HorizontalAlignment() : Property(
+        "HorizontalAlignment",
+        "Property to get/set the windows horizontal alignment.  Value is one of \"Left\", \"Centre\" or \"Right\".",
+        "Left")
+        {}
+
+        String	get(const PropertyReceiver* receiver) const;
+        void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*
+\brief
+	Property to access the unified area rectangle of the window.
+
+	\par Usage:
+		- Name: UnifiedAreaRect
+		- Format: "{{[ls],[lo]},{[ts],[to]},{[rs],[ro]},{[bs],[bo]}}"
+
+	\par Where:
+		- [ls] is a floating point value describing the relative scale value for the left edge.
+		- [lo] is a floating point value describing the absolute offset value for the left edge.
+		- [ts] is a floating point value describing the relative scale value for the top edge.
+		- [to] is a floating point value describing the absolute offset value for the top edge.
+		- [rs] is a floating point value describing the relative scale value for the right edge.
+		- [ro] is a floating point value describing the absolute offset value for the right edge.
+		- [bs] is a floating point value describing the relative scale value for the bottom edge.
+		- [bo] is a floating point value describing the absolute offset value for the bottom edge.
+*/
+class UnifiedAreaRect : public Property
+{
+	public:
+		UnifiedAreaRect() : Property(
+		"UnifiedAreaRect",
+		"Property to get/set the windows unified area rectangle.  Value is a \"URect\".",
+		"{{0.000000,0.000000},{0.000000,0.000000},{0.000000,0.000000},{0.000000,0.000000}}")
+		{}
+
+		String	get(const PropertyReceiver* receiver) const;
+		void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*
+\brief
+	Property to access the unified position of the window.
+
+	\par Usage:
+		- Name: UnifiedPosition
+		- Format: "{{[xs],[xo]},{[ys],[yo]}}"
+
+	\par Where:
+		- [xs] is a floating point value describing the relative scale value for the position x-coordinate.
+		- [xo] is a floating point value describing the absolute offset value for the position x-coordinate.
+		- [ys] is a floating point value describing the relative scale value for the position y-coordinate.
+		- [yo] is a floating point value describing the absolute offset value for the position y-coordinate.
+*/
+class UnifiedPosition : public Property
+{
+	public:
+		UnifiedPosition() : Property(
+		"UnifiedPosition",
+		"Property to get/set the windows unified position.  Value is a \"UVector2\".",
+		"{{0.000000,0.000000},{0.000000,0.000000}}", false)
+		{}
+
+		String	get(const PropertyReceiver* receiver) const;
+		void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*
+\brief
+	Property to access the unified position x-coordinate of the window.
+
+	\par Usage:
+		- Name: UnifiedXPosition
+		- Format: "{[s],[o]}"
+
+	\par Where:
+		- [s] is a floating point value describing the relative scale value for the position x-coordinate.
+		- [o] is a floating point value describing the absolute offset value for the position x-coordinate.
+*/
+class UnifiedXPosition : public Property
+{
+	public:
+		UnifiedXPosition() : Property(
+		"UnifiedXPosition",
+		"Property to get/set the windows unified position x-coordinate.  Value is a \"UDim\".",
+		"{0.000000,0.000000}", false)
+		{}
+
+		String	get(const PropertyReceiver* receiver) const;
+		void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*
+\brief
+	Property to access the unified position y-coordinate of the window.
+
+	\par Usage:
+		- Name: UnifiedYPosition
+		- Format: "{[s],[o]}"
+
+	\par Where:
+		- [s] is a floating point value describing the relative scale value for the position y-coordinate.
+		- [o] is a floating point value describing the absolute offset value for the position y-coordinate.
+*/
+class UnifiedYPosition : public Property
+{
+	public:
+		UnifiedYPosition() : Property(
+		"UnifiedYPosition",
+		"Property to get/set the windows unified position y-coordinate.  Value is a \"UDim\".",
+		"{0.000000,0.000000}", false)
+		{}
+
+		String	get(const PropertyReceiver* receiver) const;
+		void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*
+\brief
+	Property to access the unified position of the window.
+
+	\par Usage:
+		- Name: UnifiedSize
+		- Format: "{{[ws],[wo]},{[hs],[ho]}}"
+
+	\par Where:
+		- [ws] is a floating point value describing the relative scale value for the width.
+		- [wo] is a floating point value describing the absolute offset value for the width.
+		- [hs] is a floating point value describing the relative scale value for the height.
+		- [ho] is a floating point value describing the absolute offset value for the height.
+*/
+class UnifiedSize : public Property
+{
+	public:
+		UnifiedSize() : Property(
+		"UnifiedSize",
+		"Property to get/set the windows unified size.  Value is a \"UVector2\".",
+		"{{0.000000,0.000000},{0.000000,0.000000}}", false)
+		{}
+
+		String	get(const PropertyReceiver* receiver) const;
+		void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*
+\brief
+	Property to access the unified width of the window.
+
+	\par Usage:
+		- Name: UnifiedWidth
+		- Format: "{[s],[o]}"
+
+	\par Where:
+		- [s] is a floating point value describing the relative scale value for the width.
+		- [o] is a floating point value describing the absolute offset value for the width.
+*/
+class UnifiedWidth : public Property
+{
+	public:
+		UnifiedWidth() : Property(
+		"UnifiedWidth",
+		"Property to get/set the windows unified width.  Value is a \"UDim\".",
+		"{0.000000,0.000000}", false)
+		{}
+
+		String	get(const PropertyReceiver* receiver) const;
+		void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*
+\brief
+	Property to access the unified height of the window.
+
+	\par Usage:
+		- Name: UnifiedHeight
+		- Format: "{[s],[o]}"
+
+	\par Where:
+		- [s] is a floating point value describing the relative scale value for the height.
+		- [o] is a floating point value describing the absolute offset value for the height.
+*/
+class UnifiedHeight : public Property
+{
+	public:
+		UnifiedHeight() : Property(
+		"UnifiedHeight",
+		"Property to get/set the windows unified height.  Value is a \"UDim\".",
+		"{0.000000,0.000000}", false)
+		{}
+
+		String	get(const PropertyReceiver* receiver) const;
+		void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*
+\brief
+	Property to access the unified minimum size of the window.
+
+	\par Usage:
+		- Name: UnifiedMinSize
+		- Format: "{{[ws],[wo]},{[hs],[ho]}}"
+
+	\par Where:
+		- [ws] is a floating point value describing the relative scale value for the minimum width.
+		- [wo] is a floating point value describing the absolute offset value for the minimum width.
+		- [hs] is a floating point value describing the relative scale value for the minimum height.
+		- [ho] is a floating point value describing the absolute offset value for the minimum height.
+*/
+class UnifiedMinSize : public Property
+{
+	public:
+		UnifiedMinSize() : Property(
+		"UnifiedMinSize",
+		"Property to get/set the windows unified minimum size.  Value is a \"UVector2\".",
+		"{{0.000000,0.000000},{0.000000,0.000000}}")
+		{}
+
+		String	get(const PropertyReceiver* receiver) const;
+		void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*
+\brief
+	Property to access the unified maximum size of the window.
+
+	\par Usage:
+		- Name: UnifiedMaxSize
+		- Format: "{{[ws],[wo]},{[hs],[ho]}}"
+
+	\par Where:
+		- [ws] is a floating point value describing the relative scale value for the maximum width.
+		- [wo] is a floating point value describing the absolute offset value for the maximum width.
+		- [hs] is a floating point value describing the relative scale value for the maximum height.
+		- [ho] is a floating point value describing the absolute offset value for the maximum height.
+*/
+class UnifiedMaxSize : public Property
+{
+	public:
+		UnifiedMaxSize() : Property(
+		"UnifiedMaxSize",
+		"Property to get/set the windows unified maximum size.  Value is a \"UVector2\".",
+		"{{0.000000,0.000000},{0.000000,0.000000}}")
+		{}
+
+		String	get(const PropertyReceiver* receiver) const;
+		void	set(PropertyReceiver* receiver, const String& value);
+};
+
+
+/*!
+\brief
+    Property to access whether the window ignores mouse events and pass them through to any windows behind it.
+
+    \par Usage:
+        - Name: MousePassThroughEnabled
+        - Format: "[text]".
+
+    \par Where [Text] is:
+        - "True" to indicate the Window will not respond to mouse events but pass them directly to any children behind it.
+        - "False" to indicate the Window will respond to normally to all mouse events (Default).
+*/
+class MousePassThroughEnabled : public Property
+{
+public:
+    MousePassThroughEnabled() : Property(
+        "MousePassThroughEnabled",
+        "Property to get/set whether the window ignores mouse events and pass them through to any windows behind it.  Value is either \"True\" or \"False\".",
+        "False")
+    {}
+
+    String  get(const PropertyReceiver* receiver) const;
+    void    set(PropertyReceiver* receiver, const String& value);
+};
+
+
+} // End of  WindowProperties namespace section
+
+
+} // End of  CEGUI namespace section
+
+#endif	// end of guard _CEGUIWindowProperties_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIImagesetManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIImagesetManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIImagesetManager.h	(revision 1812)
@@ -0,0 +1,271 @@
+/************************************************************************
+	filename: 	CEGUIImagesetManager.h
+	created:	21/2/2004
+	author:		Paul D Turner
+	
+	purpose:	Defines interface for ImagesetManager object
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIImagesetManager_h_
+#define _CEGUIImagesetManager_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIString.h"
+#include "CEGUISingleton.h"
+#include "CEGUIIteratorBase.h"
+#include <map>
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4275)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Class providing a shared library of Imageset objects to the system.
+
+	The ImagesetManager is used to create, access, and destroy Imageset objects.  The idea is that
+	the ImagesetManager will function as a central repository for imagery used within the GUI system,
+	and that such imagery can be accessed, via a unique name, by any interested party within the system.
+*/
+class CEGUIEXPORT ImagesetManager : public Singleton<ImagesetManager>
+{
+public:
+	/*!
+	\brief
+		Constructor for ImagesetManager objects
+	*/
+	ImagesetManager(void);
+
+
+	/*!
+	\brief
+		Destructor for ImagesetManager objects
+	*/
+	~ImagesetManager(void);
+
+
+	/*!
+	\brief
+		Return singleton ImagesetManager object
+
+	\return
+		Singleton ImagesetManager object
+	*/
+	static	ImagesetManager&	getSingleton(void);
+
+
+	/*!
+	\brief
+		Return pointer to singleton ImagesetManager object
+
+	\return
+		Pointer to singleton ImagesetManager object
+	*/
+	static	ImagesetManager*	getSingletonPtr(void);
+
+
+	/*!
+	\brief
+		Create a Imageset object with the given name and Texture
+
+		The created Imageset will be of limited use, and will require one or more images to be defined for the set.
+
+	\param name
+		String object containing the unique name for the Imageset being created.
+
+	\param texture
+		Texture object to be associated with the Imageset
+
+	\return
+		Pointer to the newly created Imageset object
+
+	\exception AlreadyExistsException	Thrown if an Imageset named \a name is already present in the system.
+	*/
+	Imageset*	createImageset(const String& name, Texture* texture);
+
+	/*!
+	\brief
+		Create an Imageset object from the specified file
+
+	\param filename
+		String object holding the name of the Imageset definition file which should be used to create the Imageset
+
+    \param resourceGroup
+        Resource group identifier to be passed to the resource manager.  NB: This affects the
+        imageset xml file only, the texture loaded may have its own group specified in the XML file.
+
+	\return
+		Pointer to the newly created Imageset object
+
+	\exception	AlreadyExistsException	Thrown if an Imageset named \a name is already present in the system.
+	\exception	FileIOException			Thrown if something goes wrong while processing the file \a filename.
+	*/
+	Imageset*	createImageset(const String& filename, const String& resourceGroup = "");
+
+
+    /*!
+    \brief
+        Create an Imageset object from the specified image file.  The Imageset will initially have a single
+        image defined named "full_image" which is an image that represents the entire area of the loaded image.
+
+    \param name
+        String object containing the unique name for the Imageset being created.
+
+    \param filename
+        String object holding the name of the image file to be loaded.
+
+    \param resourceGroup
+        Resource group identifier to be passed to the resource manager when loading the image file.
+
+    \return
+        Pointer to the newly created Imageset object
+
+    \exception	AlreadyExistsException	Thrown if an Imageset named \a name is already present in the system.
+    \exception	FileIOException			Thrown if something goes wrong while reading the image file \a filename.
+    */
+    Imageset* createImagesetFromImageFile(const String& name, const String& filename, const String& resourceGroup = "");
+
+
+	/*!
+	\brief
+		Destroys the Imageset with the specified name
+
+	\param name
+		String object containing the name of the Imageset to be destroyed.  If no such Imageset exists, nothing happens.
+
+	\return
+		Nothing.
+	*/
+	void	destroyImageset(const String& name);
+
+	/*!
+	\brief
+		Destroys the given Imageset object
+
+	\param imageset
+		Pointer to the Imageset to be destroyed.  If no such Imageset exists, nothing happens.
+
+	\return
+		Nothing.
+	*/
+	void	destroyImageset(Imageset* imageset);
+
+
+	/*!
+	\brief
+		Destroys all Imageset objects registered in the system
+
+	\return
+		Nothing
+	*/
+	void	destroyAllImagesets(void);
+
+
+	/*!
+	\brief
+		Returns a pointer to the Imageset object with the specified name
+
+	\param name
+		String object containing the name of the Imageset to return a pointer to
+
+	\return
+		Pointer to the requested Imageset object
+
+	\exception	UnknownObjectException	Thrown if no Imageset named \a name is present in within the system
+	*/
+	Imageset*	getImageset(const String& name) const;
+
+
+	/*!
+	\brief
+		Check for the existence of a named Imageset
+
+	\param name
+		String object containing the name of the Imageset to look for
+
+	\return
+		true if an Imageset named \a name is presently loaded in the system, else false.
+	*/
+	bool	isImagesetPresent(const String& name) const			{return d_imagesets.find(name) != d_imagesets.end();}
+
+
+	/*!
+	\brief
+		Notify the ImagesetManager of the current (usually new) display resolution.
+
+	\param size
+		Size object describing the display resolution
+
+	\return
+		Nothing
+	*/
+	void	notifyScreenResolution(const Size& size);
+
+
+    /*!
+    \brief
+        Writes a full XML imageset for the specified Imageset to the given OutStream.
+
+    \param imageset
+        String holding the name of the Imageset to be written to the stream.
+
+    \param out_stream
+        OutStream (std::ostream based) object where data is to be sent.
+
+    \return
+        Nothing.
+    */
+    void writeImagesetToStream(const String& imageset, OutStream& out_stream) const;
+
+
+private:
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	typedef	std::map<String, Imageset*>		ImagesetRegistry;
+	ImagesetRegistry	d_imagesets;
+
+public:
+	/*************************************************************************
+		Iterator stuff
+	*************************************************************************/
+	typedef	ConstBaseIterator<ImagesetRegistry>	ImagesetIterator;
+
+	/*!
+	\brief
+		Return a ImagesetManager::ImagesetIterator object to iterate over the available Imageset objects.
+	*/
+	ImagesetIterator	getIterator(void) const;
+};
+
+} // End of  CEGUI namespace section
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIImageSetManager_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIWindowFactoryManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIWindowFactoryManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIWindowFactoryManager.h	(revision 1812)
@@ -0,0 +1,430 @@
+/************************************************************************
+	filename: 	CEGUIWindowFactoryManager.h
+	created:	22/2/2004
+	author:		Paul D Turner
+	
+	purpose:	Defines interface for WindowFactoryManager class
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIWindowFactoryManager_h_
+#define _CEGUIWindowFactoryManager_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIString.h"
+#include "CEGUISingleton.h"
+#include "CEGUILogger.h"
+#include "CEGUIIteratorBase.h"
+#include <map>
+#include <vector>
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4275)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*! 
+\brief
+	Class that manages WindowFactory objects
+*/
+class CEGUIEXPORT WindowFactoryManager : public Singleton<WindowFactoryManager>
+{
+public:
+    /*!
+    \brief
+        struct used to hold mapping information required to create a falagard based window.
+    */
+    struct CEGUIEXPORT FalagardWindowMapping
+    {
+        String  d_windowType;
+        String  d_lookName;
+        String  d_baseType;
+    };
+
+    /*!
+    \brief
+        Class used to track active alias targets for Window factory types.
+    */
+	class CEGUIEXPORT AliasTargetStack
+	{
+	public:
+		/*!
+		\brief
+			Constructor for WindowAliasTargetStack objects
+		*/
+		AliasTargetStack(void) {}
+
+
+		/*!
+		\brief
+			Destructor for WindowAliasTargetStack objects
+		*/
+		~AliasTargetStack(void) {}
+
+
+		/*!
+		\brief
+			Return a String holding the current target type for this stack
+
+		\return
+			reference to a String object holding the currently active target type name for this stack.
+		*/
+		const String&	getActiveTarget(void) const;
+
+		/*!
+		\brief
+			Return the number of stacked target types in the stack
+
+		\return
+			number of target types stacked for this alias.
+		*/
+		uint	getStackedTargetCount(void) const;
+
+
+	private:
+		friend class WindowFactoryManager;
+		typedef std::vector<String>	TargetTypeStack;		//!< Type used to implement stack of target type names.
+
+		TargetTypeStack	d_targetStack;		//!< Container holding the target types.
+	};
+
+
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructs a new WindowFactoryManager object.
+	*/
+	WindowFactoryManager(void)
+	{
+		Logger::getSingleton().logEvent((utf8*)"CEGUI::WindowFactoryManager singleton created");
+	}
+
+
+	/*!
+	\brief
+		Destructor for WindowFactoryManager objects
+	*/
+	~WindowFactoryManager(void)
+	{
+		Logger::getSingleton().logEvent((utf8*)"CEGUI::WindowFactoryManager singleton destroyed");
+	}
+
+
+	/*************************************************************************
+		Public Interface
+	*************************************************************************/
+	/*!
+	\brief
+		Return singleton WindowFactoryManager object
+
+	\return
+		Singleton WindowFactoryManager object
+	*/
+	static	WindowFactoryManager&	getSingleton(void);
+
+
+	/*!
+	\brief
+		Return pointer to singleton WindowFactoryManager object
+
+	\return
+		Pointer to singleton WindowFactoryManager object
+	*/
+	static	WindowFactoryManager*	getSingletonPtr(void);
+
+
+	/*!
+	\brief
+		Adds a new WindowFactory to the list of registered factories.
+
+	\param factory
+		Pointer to the WindowFactory to be added to the WindowManager.
+
+	\return
+		Nothing
+	
+	\exception NullObjectException		\a factory was null.
+	\exception AlreadyExistsException	\a factory provided a Window type name which is in use by another registered WindowFactory.
+	*/
+	void	addFactory(WindowFactory* factory);
+
+
+	/*!
+	\brief
+		Removes a WindowFactory from the list of registered factories.
+		
+	\note
+		The WindowFactory object is not destroyed (since it was created externally), instead it is just removed from the list.
+
+	\param name
+		String which holds the name (technically, Window type name) of the WindowFactory to be removed.  If \a name is not
+		in the list, no error occurs (nothing happens).
+
+	\return
+		Nothing
+	*/
+	void	removeFactory(const String& name);
+
+
+	/*!
+	\brief
+		Removes a WindowFactory from the list of registered factories.
+
+	\note
+		The WindowFactory object is not destroyed (since it was created externally), instead it is just removed from the list.
+
+	\param factory
+		Pointer to the factory object to be removed.  If \a factory is null, or if no such WindowFactory is in the list, no
+		error occurs (nothing happens).
+
+	\return
+		Nothing
+	*/
+	void	removeFactory(WindowFactory* factory);
+
+
+	/*!
+	\brief
+		Remove all WindowFactory objects from the list.
+
+	\return
+		Nothing
+	*/
+	void	removeAllFactories(void)		{d_factoryRegistry.clear();}
+
+
+	/*!
+	\brief
+		Return a pointer to the specified WindowFactory object.
+
+	\param type
+		String holding the Window object type to return the WindowFactory for.
+
+	\return
+		Pointer to the WindowFactory object that creates Windows of the type \a type.
+
+	\exception UnknownObjectException	No WindowFactory object for Window objects of type \a type was found.
+	*/
+	WindowFactory*	getFactory(const String& type) const;
+
+
+    /*!
+    \brief
+        Checks the list of registered WindowFactory objects, aliases, and
+        falagard mapped types for one which can create Window objects of the
+        specified type.
+
+    \param name
+        String containing the Window type name to check for.
+
+    \return
+        - true if a WindowFactory, alias, or falagard mapping for Window objects
+          of type \a name is registered.
+        - false if the system knows nothing about windows of type \a name.
+    */
+    bool	isFactoryPresent(const String& name) const;
+
+
+	/*!
+	\brief
+		Adds an alias for a current window type.
+
+		This method allows you to create an alias for a specified window type.  This means that you can then use
+		either name as the type parameter when creating a window.
+
+	\note
+		You need to be careful using this system.  Creating an alias using a name that already exists will replace the previous
+		mapping for that alias.  Each alias name maintains a stack, which means that it is possible to remove an alias and have the
+		previous alias restored.  The windows created via an alias use the real type, so removing an alias after window creation is always
+		safe (i.e. it is not the same as removing a real factory, which would cause an exception when trying to destroy a window with a missing
+		factory).
+
+	\param aliasName
+		String object holding the alias name.  That is the name that \a targetType will also be known as from no on.
+
+	\param targetType
+		String object holding the type window type name that is to be aliased.  This type must already exist.
+
+	\return
+		Nothing.
+
+	\exception UnknownObjectException	thrown if \a targetType is not known within the system.
+	*/
+	void	addWindowTypeAlias(const String& aliasName, const String& targetType);
+
+
+	/*!
+	\brief
+		Remove the specified alias mapping.  If the alias mapping does not exist, nothing happens.
+
+	\note
+		You are required to supply both the alias and target names because there may exist more than one entry for a given
+		alias - therefore you are required to be explicit about which alias is to be removed.
+
+	\param aliasName
+		String object holding the alias name.
+
+	\param targetType
+		String object holding the type window type name that was aliased.
+
+	\return
+		Nothing.
+	*/
+	void	removeWindowTypeAlias(const String& aliasName, const String& targetType);
+
+    /*!
+    \brief
+        Add a mapping for a falagard based window.
+
+        This function creates maps a target window type and target 'look' name onto a registered window type, thus allowing
+        the ususal window creation interface to be used to create windows that require extra information to full initialise
+        themselves.
+    \note
+        These mappings support 'late binding' to the target window type, as such the type indicated by \a targetType need not
+        exist in the system until attempting to create a Window using the type.
+    \par
+        Also note that creating a mapping for an existing type will replace any previous mapping for that same type.
+
+    \param newType
+        The type name that will be used to create windows using the target type and look.
+
+    \param targetType
+        The base window type.
+
+    \param lookName
+        The name of the 'look' that will be used by windows of this type.
+
+    \return
+        Nothing.
+    */
+    void addFalagardWindowMapping(const String& newType, const String& targetType, const String& lookName);
+
+    /*!
+    \brief
+        Remove the specified falagard type mapping if it exists.
+
+    \return
+        Nothing.
+    */
+    void removeFalagardWindowMapping(const String& type);
+
+    /*!
+    \brief
+        Return whether the given type is a falagard mapped type.
+
+    \param type
+        Name of a window type.
+
+    \return
+        - true if the requested type is a Falagard mapped window type.
+        - false if the requested type is a normal WindowFactory (or alias), or if the type does not exist.
+    */
+    bool isFalagardMappedType(const String& type) const;
+
+    /*!
+    \brief
+        Return the name of the LookN'Feel assigned to the specified window mapping.
+
+    \param type
+        Name of a window type.  The window type referenced should be a falagard mapped type.
+
+    \return
+        String object holding the name of the look mapped for the requested type.
+
+    \exception InvalidRequestException thrown if \a type is not a falagard mapping type (or maybe the type didn't exist).
+    */
+    const String& getMappedLookForType(const String& type) const;
+
+
+    /*!
+    \brief
+        Use the alias system, where required, to 'de-reference' the specified
+        type to an actual window type that can be created directly (that being
+        either a concrete window type, or a falagard mapped type).
+
+    \note
+        Even though implied by the above description, this method does not
+        check that a factory for the final type exists; we simply say that the
+        returned type is not an alias for some other type.
+
+    \param type
+        String describing the type to be de-referenced.
+
+    \return
+        String object holding a type for a window that can be created directly;
+        that is, a type that does not describe an alias to some other type.
+    */
+    String getDereferencedAliasType(const String& type) const;
+
+private:
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	typedef	std::map<String, WindowFactory*>	WindowFactoryRegistry;		//!< Type used to implement registry of WindowFactory objects
+	typedef std::map<String, AliasTargetStack>	TypeAliasRegistry;		//!< Type used to implement registry of window type aliases.
+    typedef std::map<String, FalagardWindowMapping> FalagardMapRegistry;    //!< Type used to implement registry of falagard window mappings.
+
+	WindowFactoryRegistry	d_factoryRegistry;			//!< The container that forms the WindowFactory registry
+	TypeAliasRegistry		d_aliasRegistry;			//!< The container that forms the window type alias registry.
+    FalagardMapRegistry     d_falagardRegistry;         //!< Container that hold all the falagard window mappings.
+
+public:
+	/*************************************************************************
+		Iterator stuff
+	*************************************************************************/
+	typedef	ConstBaseIterator<WindowFactoryRegistry>	WindowFactoryIterator;
+	typedef ConstBaseIterator<TypeAliasRegistry>		TypeAliasIterator;
+    typedef ConstBaseIterator<FalagardMapRegistry>      FalagardMappingIterator;
+
+	/*!
+	\brief
+		Return a WindowFactoryManager::WindowFactoryIterator object to iterate over the available WindowFactory types.
+	*/
+	WindowFactoryIterator	getIterator(void) const;
+
+
+	/*!
+	\brief
+		Return a WindowFactoryManager::TypeAliasIterator object to iterate over the defined aliases for window types.
+	*/
+	TypeAliasIterator	getAliasIterator(void) const;
+
+
+    /*!
+    \brief
+        Return a WindowFactoryManager::FalagardMappingIterator object to iterate over the defined falagard window mappings.
+    */
+    FalagardMappingIterator getFalagardMappingIterator() const;
+};
+
+} // End of  CEGUI namespace section
+
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIWindowFactoryManager_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIEventSet.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIEventSet.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIEventSet.h	(revision 1812)
@@ -0,0 +1,271 @@
+/************************************************************************
+	filename: 	CEGUIEventSet.h
+	created:	21/2/2004
+	author:		Paul D Turner
+	
+	purpose:	Defines class for a named collection of Event objects
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIEventSet_h_
+#define _CEGUIEventSet_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIString.h"
+#include "CEGUIEvent.h"
+#include "CEGUIIteratorBase.h"
+#include <map>
+
+#if defined (_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Class that collects together a set of Event objects.
+
+	The EventSet used to collect Event objects together, and allow access
+	to them by a unique name
+*/
+class CEGUIEXPORT EventSet
+{
+public:
+	/*!
+	\brief
+		Constructor for EventSet objects
+	*/
+	EventSet();
+
+
+	/*!
+	\brief
+		Destructor for EventSet objects
+	*/
+	virtual ~EventSet(void);
+
+
+	/*!
+	\brief
+		Add a new Event to the EventSet with the given name.
+
+	\param name
+		String object containing the name to give the new Event.  The name must be unique for the EventSet.
+
+	\return
+		Nothing
+
+	\exception AlreadyExistsException	Thrown if an Event already exists named \a name.
+	*/
+	void	addEvent(const String& name);
+
+
+	/*!
+	\brief
+		Removes the Event with the given name.  All connections to the event are disconnected.
+
+	\param name
+		String object containing the name of the Event to remove.  If no such Event exists, nothing happens.
+
+	\return
+		Nothing.
+	*/
+	void	removeEvent(const String& name);
+
+
+	/*!
+	\brief
+		Remove all Event objects from the EventSet
+
+	\return
+		Nothing
+	*/
+	void	removeAllEvents(void);
+
+
+	/*!
+	\brief
+		Checks to see if an Event with the given name is present in the EventSet.
+
+	\return
+		true if an Event named \a name was found, or false if the Event was not found
+	*/
+	bool	isEventPresent(const String& name);
+
+
+	/*!
+	\brief
+		Subscribes the named Event.
+
+	\param name
+		String object containing the name of the Event to subscribe to.
+
+	\param subscriber
+		Function or object that is to be subscribed to the Event.
+
+	\return
+		Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.
+
+	\exception UnknownObjectException	Thrown if an Event named \a name is not in the EventSet
+	*/
+	virtual Event::Connection	subscribeEvent(const String& name, Event::Subscriber subscriber);
+
+
+	/*!
+	\brief
+		Subscribes the specified group of the named Event.
+
+	\param name
+		String object containing the name of the Event to subscribe to.
+
+	\param group
+		Group which is to be subscribed to.  Subscription groups are called in ascending order.
+
+	\param subscriber
+		Function or object that is to be subscribed to the Event.
+
+	\return
+		Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.
+
+	\exception UnknownObjectException	Thrown if an Event named \a name is not in the EventSet
+	*/
+	virtual Event::Connection	subscribeEvent(const String& name, Event::Group group, Event::Subscriber subscriber);
+	
+	
+	/*!
+	\brief
+		Subscribes the named Event to a scripted funtion
+
+	\param name
+		String object containing the name of the Event to subscribe to.
+
+	\param subscriber_name
+		String object containing the name of the script funtion that is to be subscribed to the Event.
+
+	\return
+		Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.
+
+	\exception UnknownObjectException	Thrown if an Event named \a name is not in the EventSet
+	*/
+	virtual Event::Connection	subscribeScriptedEvent(const String& name, const String& subscriber_name);
+	
+	
+	/*!
+	\brief
+		Subscribes the specified group of the named Event to a scripted funtion.
+
+	\param name
+		String object containing the name of the Event to subscribe to.
+
+	\param group
+		Group which is to be subscribed to.  Subscription groups are called in ascending order.
+
+	\param subscriber_name
+		String object containing the name of the script funtion that is to be subscribed to the Event.
+
+	\return
+		Connection object that can be used to check the status of the Event connection and to disconnect (unsubscribe) from the Event.
+
+	\exception UnknownObjectException	Thrown if an Event named \a name is not in the EventSet
+	*/
+	virtual Event::Connection	subscribeScriptedEvent(const String& name, Event::Group group, const String& subscriber_name);
+
+
+	/*!
+	\brief
+		Fires the named event passing the given EventArgs object.
+
+	\param name
+		String object holding the name of the Event that is to be fired (triggered)
+
+	\param args
+		The EventArgs (or derived) object that is to be bassed to each subscriber of the Event.  Once all subscribers
+		have been called the 'handled' field of the event is updated appropriately.
+		
+	\param eventNamespace
+		String object describing the global event namespace prefix for this event.
+
+	\return
+		Nothing.
+
+	\exception UnknownObjectException	Thrown if no Event named \a name was found in the EventSet.
+	*/
+	virtual void	fireEvent(const String& name, EventArgs& args, const String& eventNamespace = "");
+
+
+	/*!
+	\brief
+		Return whether the EventSet is muted or not.
+
+	\return
+		- true if the EventSet is muted.  All requests to fire events will be ignored.
+		- false if the EventSet is not muted.  All requests to fire events are processed as normal.
+	*/
+	bool	isMuted(void) const;
+
+
+	/*!
+	\brief
+		Set the mute state for this EventSet.
+
+	\param setting
+		- true if the EventSet is to be muted (no further event firing requests will be honoured until EventSet is unmuted).
+		- false if the EventSet is not to be muted and all events should fired as requested.
+
+	\return
+		Nothing.
+	*/
+	void	setMutedState(bool setting);
+
+
+protected:
+	// Do not allow copying, assignment, or any other usage than simple creation.
+	EventSet(EventSet& e) {}
+	EventSet& operator=(EventSet& e) {return *this;}
+
+	typedef std::map<String, Event*>	EventMap;
+	EventMap	d_events;
+
+	bool	d_muted;	//!< true if events for this EventSet have been muted.
+
+public:
+	/*************************************************************************
+		Iterator stuff
+	*************************************************************************/
+	typedef	ConstBaseIterator<EventMap>	EventIterator;
+
+	/*!
+	\brief
+		Return a EventSet::EventIterator object to iterate over the available events.
+	*/
+	EventIterator	getIterator(void) const;
+};
+
+} // End of  CEGUI namespace section
+
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIEventSet_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalagard_xmlHandler.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalagard_xmlHandler.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalagard_xmlHandler.h	(revision 1812)
@@ -0,0 +1,181 @@
+/************************************************************************
+    filename:   CEGUIFalagard_xmlHandler.h
+    created:    Fri Jun 17 2005
+    author:     Paul D Turner <paul@cegui.org.uk>
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+ 
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+ 
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+ 
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIFalagard_xmlHandler_h_
+#define _CEGUIFalagard_xmlHandler_h_
+
+#include "CEGUIXMLHandler.h"
+#include "CEGUIcolour.h"
+#include "falagard/CEGUIFalDimensions.h"
+#include "CEGUIWindow.h"
+#include <vector>
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+    // forward refs
+    class WidgetLookManager;
+    class WidgetLookFeel;
+    class WidgetComponent;
+    class ImagerySection;
+    class StateImagery;
+    class LayerSpecification;
+    class SectionSpecification;
+    class ImageryComponent;
+    class ComponentArea;
+    class Dimension;
+    class TextComponent;
+    class NamedArea;
+    class FrameComponent;
+
+    /*!
+    \brief
+        Handler class used to parse look & feel XML files used by the Falagard system.
+    */
+    class Falagard_xmlHandler : public XMLHandler
+    {
+    public:
+        /*!
+        \brief
+            Constructor for Falagard_xmlHandler objects
+        */
+        Falagard_xmlHandler(WidgetLookManager* mgr);
+
+        /*!
+        \brief
+            Destructor for Falagard_xmlHandler objects
+        */
+        ~Falagard_xmlHandler();
+
+        /*************************************************************************
+            XMLHandler base class overrides
+        *************************************************************************/
+        void elementStart(const String& element, const XMLAttributes& attributes);
+        void elementEnd(const String& element);
+
+    private:
+        /*************************************************************************
+            Implementation Constants
+        *************************************************************************/
+        // element names
+        static const String FalagardElement;            //!< Tag name for root Falagard elements.
+        static const String WidgetLookElement;          //!< Tag name for WidgetLook elements.
+        static const String ChildElement;               //!< Tag name for Child elements.
+        static const String ImagerySectionElement;      //!< Tag name for ImagerySection elements.
+        static const String StateImageryElement;        //!< Tag name for StateImagery elements.
+        static const String LayerElement;               //!< Tag name for Layer elements.
+        static const String SectionElement;             //!< Tag name for Section elements.
+        static const String ImageryComponentElement;    //!< Tag name for ImageryComponent elements.
+        static const String TextComponentElement;       //!< Tag name for TextComponent elements.
+        static const String FrameComponentElement;      //!< Tag name for FrameComponent elements.
+        static const String AreaElement;                //!< Tag name for Area elements.
+        static const String ImageElement;               //!< Tag name for Image elements.
+        static const String ColoursElement;             //!< Tag name for Colours elements.
+        static const String VertFormatElement;          //!< Tag name for VertFormat elements.
+        static const String HorzFormatElement;          //!< Tag name for HorzFormat elements.
+        static const String VertAlignmentElement;       //!< Tag name for VertAlignment elements.
+        static const String HorzAlignmentElement;       //!< Tag name for HorzAlignment elements.
+        static const String PropertyElement;            //!< Tag name for Property elements.
+		static const String DimElement;                 //!< Tag name for dimension container elements.
+		static const String UnifiedDimElement;          //!< Tag name for unified dimension elements.
+        static const String AbsoluteDimElement;         //!< Tag name for absolute dimension elements.
+        static const String ImageDimElement;            //!< Tag name for image dimension elements.
+        static const String WidgetDimElement;           //!< Tag name for widget dimension elements.
+        static const String FontDimElement;             //!< Tag name for font dimension elements.
+        static const String PropertyDimElement;         //!< Tag name for property dimension elements.
+        static const String TextElement;                //!< Tag name for text component text elements
+        static const String ColourPropertyElement;      //!< Tag name for property colour elements (fetches cols from a colour property)
+        static const String ColourRectPropertyElement;  //!< Tag name for property colour elements (fetches cols from a ColourRect property)
+        static const String NamedAreaElement;           //!< Tag name for named area elements.
+        static const String PropertyDefinitionElement;  //!< Tag name for property definition elements.
+        static const String DimOperatorElement;         //!< Tag name for dimension operator elements.
+        static const String VertFormatPropertyElement;  //!< Tag name for element that specifies a vertical formatting property.
+        static const String HorzFormatPropertyElement;  //!< Tag name for element that specifies a horizontal formatting property..
+        static const String AreaPropertyElement;        //!< Tag name for element that specifies a URect property..
+        static const String ImagePropertyElement;       //!< Tag name for element that specifies an Image property..
+        // attribute names
+        static const String TopLeftAttribute;           //!< Attribute name that stores colour for top-left corner.
+        static const String TopRightAttribute;          //!< Attribute name that stores colour for top-right corner.
+        static const String BottomLeftAttribute;        //!< Attribute name that stores colour for bottom-left corner.
+        static const String BottomRightAttribute;       //!< Attribute name that stores colour for bottom-right corner.
+        static const String ImagesetAttribute;          //!< Attribute name that stores name of an imageset.
+        static const String ImageAttribute;             //!< Attribute name that stores name of an image.
+        static const String TypeAttribute;              //!< Attribute name that stores a type string.
+        static const String NameAttribute;              //!< Attribute name that stores name string
+        static const String PriorityAttribute;          //!< Attribute name that stores an integer priority.
+        static const String SectionNameAttribute;       //!< Attribute name that stores an imagery section name.
+        static const String NameSuffixAttribute;        //!< Attribute name that stores a widget name suffix.
+        static const String LookAttribute;              //!< Attribute name that stores the name of a widget look.
+        static const String ScaleAttribute;             //!< Attribute name that stores a UDim scale value.
+        static const String OffsetAttribute;            //!< Attribute name that stores a UDim offset value.
+        static const String ValueAttribute;             //!< Attribute name that stores a property value string.
+        static const String DimensionAttribute;         //!< Attribute name that stores a dimension type.
+        static const String WidgetAttribute;            //!< Attribute name that stores the name of a widget (suffix).
+        static const String StringAttribute;            //!< Attribute name that stores a string of text.
+        static const String FontAttribute;              //!< Attribute name that stores the name of a font.
+        static const String InitialValueAttribute;      //!< Attribute name that stores the initial default value for a property definition.
+        static const String ClippedAttribute;           //!< Attribute name that stores whether some component will be clipped.
+        static const String OperatorAttribute;          //!< Attribute name that stores the name of an operator.
+        static const String PaddingAttribute;           //!< Attribute name that stores some padding value..
+        static const String LayoutOnWriteAttribute;     //!< Attribute name that stores whether to layout on write of a property.
+        static const String RedrawOnWriteAttribute;     //!< Attribute name that stores whether to redraw on write of a property.
+
+        /*************************************************************************
+            helper methods
+        **************************************************************************/
+        static argb_t hexStringToARGB(const String& str);
+
+        /*************************************************************************
+            implementation methods
+        **************************************************************************/
+        void assignAreaDimension(Dimension& dim);
+
+        void doBaseDimStart(const BaseDim* dim);
+        void doBaseDimEnd();
+
+        /*************************************************************************
+            Implementation Data
+        *************************************************************************/
+        WidgetLookManager* d_manager;
+
+        // these hold pointers to various objects under construction.
+        WidgetLookFeel*     d_widgetlook;
+        WidgetComponent*    d_childcomponent;
+        ImagerySection*     d_imagerysection;
+        StateImagery*       d_stateimagery;
+        LayerSpecification* d_layer;
+        SectionSpecification* d_section;
+        ImageryComponent*   d_imagerycomponent;
+        ComponentArea*   d_area;
+        Dimension       d_dimension;
+        TextComponent*  d_textcomponent;
+        NamedArea*      d_namedArea;
+        FrameComponent*  d_framecomponent;
+
+        std::vector<BaseDim*>    d_dimStack;
+    };
+
+} // End of  CEGUI namespace section
+
+
+#endif  // end of guard _CEGUIFalagard_xmlHandler_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalComponentBase.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalComponentBase.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalComponentBase.h	(revision 1812)
@@ -0,0 +1,252 @@
+/************************************************************************
+    filename:   CEGUIFalComponentBase.h
+    created:    Mon Jul 18 2005
+    author:     Paul D Turner <paul@cegui.org.uk>
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+ 
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+ 
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+ 
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIFalComponentBase_h_
+#define _CEGUIFalComponentBase_h_
+
+#include "falagard/CEGUIFalDimensions.h"
+#include "CEGUIWindow.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+    /*!
+    \brief
+        Common base class used for renderable components within an ImagerySection.
+    */
+    class CEGUIEXPORT FalagardComponentBase
+    {
+    public:
+        /*!
+        \brief
+            Constructor
+        */
+        FalagardComponentBase();
+
+        /*!
+        \brief
+            Destructor
+        */
+        virtual ~FalagardComponentBase();
+
+        /*!
+        \brief
+            Render this component.  More correctly, the component is cached for rendering.
+
+        \param srcWindow
+            Window to use as the base for translating the component's ComponentArea into pixel values.
+
+        \param base_z
+            The z value to use for rendering the component.  Note that this is not the final z value to use, but
+            some z offset from a currently unknown starting value.
+
+        \param modColours
+            ColourRect describing colours that are to be modulated with the component's stored colour values
+            to calculate a set of 'final' colour values to be used.  May be 0.
+
+        \return
+            Nothing.
+        */
+        void render(Window& srcWindow, float base_z, const CEGUI::ColourRect* modColours = 0, const Rect* clipper = 0, bool clipToDisplay = false) const;
+
+        /*!
+        \brief
+            Render this component.  More correctly, the component is cached for rendering.
+
+        \param srcWindow
+            Window to use as the base for translating the component's ComponentArea into pixel values.
+
+        \param baseRect
+            Rect to use as the base for translating the component's ComponentArea into pixel values.
+
+        \param base_z
+            The z value to use for rendering the component.  Note that this is not the final z value to use, but
+            some z offset from a currently unknown starting value.
+
+        \param modColours
+            ColourRect describing colours that are to be modulated with the component's stored colour values
+            to calculate a set of 'final' colour values to be used.  May be 0.
+
+        \return
+            Nothing.
+        */
+        void render(Window& srcWindow, const Rect& baseRect, float base_z, const CEGUI::ColourRect* modColours = 0, const Rect* clipper = 0, bool clipToDisplay = false) const;
+
+        /*!
+        \brief
+            Return the ComponentArea of this ImageryComponent.
+
+        \return
+            ComponentArea object describing the ImageryComponent's current target area.
+        */
+        const ComponentArea& getComponentArea() const;
+
+        /*!
+        \brief
+            Set the ImageryComponent's ComponentArea.
+
+        \param area
+            ComponentArea object describing a new target area for the ImageryComponent.
+
+        \return
+            Nothing.
+        */
+        void setComponentArea(const ComponentArea& area);
+
+        /*!
+        \brief
+            Return the ColourRect set for use by this ImageryComponent.
+
+        \return
+            ColourRect object holding the colours currently in use by this ImageryComponent.
+        */
+        const ColourRect& getColours() const;
+
+        /*!
+        \brief
+            Set the colours to be used by this ImageryComponent.
+
+        \param cols
+            ColourRect object describing the colours to be used by this ImageryComponent.
+        */
+        void setColours(const ColourRect& cols);
+
+        /*!
+        \brief
+            Set the name of the property where colour values can be obtained.
+
+        \param property
+            String containing the name of the property.
+
+        \return
+            Nothing.
+        */
+        void setColoursPropertySource(const String& property);
+
+        /*!
+        \brief
+            Set whether the colours property source represents a full ColourRect.
+
+        \param setting
+            - true if the colours property will access a ColourRect object.
+            - false if the colours property will access a colour object.
+
+        \return
+            Nothing.
+        */
+        void setColoursPropertyIsColourRect(bool setting = true);
+
+        /*!
+        \brief
+            Set the name of the property where vertical formatting option can be obtained.
+
+        \param property
+            String containing the name of the property.
+
+        \return
+            Nothing.
+        */
+        void setVertFormattingPropertySource(const String& property);
+
+        /*!
+        \brief
+            Set the name of the property where horizontal formatting option can be obtained.
+
+        \param property
+            String containing the name of the property.
+
+        \return
+            Nothing.
+        */
+        void setHorzFormattingPropertySource(const String& property);
+
+    protected:
+        /*!
+        \brief
+            Helper method to initialise a ColourRect with appropriate values according to the way the
+            ImageryComponent is set up.
+
+            This will try and get values from multiple places:
+                - a property attached to \a wnd
+                - or the integral d_colours value.
+        */
+        void initColoursRect(const Window& wnd, const ColourRect* modCols, ColourRect& cr) const;
+
+        /*!
+        \brief
+            Method to do main render caching work.
+        */
+        virtual void render_impl(Window& srcWindow, Rect& destRect, float base_z, const CEGUI::ColourRect* modColours, const Rect* clipper, bool clipToDisplay) const = 0;
+
+        /*!
+        \brief
+            Writes xml for the colours to a OutStream.  Will prefer property colours before explicit.
+
+        \note
+            This is intended as a helper method for sub-classes when outputting xml to a stream.
+
+        \return
+            - true if xml element was written.
+            - false if nothing was output due to the formatting not being set (sub-class may then choose to do something else.)
+        */
+        bool writeColoursXML(OutStream& out_stream) const;
+
+        /*!
+        \brief
+            Writes xml for the vertical formatting to a OutStream if such a property is defined.
+
+        \note
+            This is intended as a helper method for sub-classes when outputting xml to a stream.
+
+        \return
+            - true if xml element was written.
+            - false if nothing was output due to the formatting not being set (sub-class may then choose to do something else.)
+        */
+        bool writeVertFormatXML(OutStream& out_stream) const;
+
+        /*!
+        \brief
+            Writes xml for the horizontal formatting to a OutStream if such a property is defined.
+
+        \note
+            This is intended as a helper method for sub-classes when outputting xml to a stream.
+
+        \return
+            - true if xml element was written.
+            - false if nothing was output due to the formatting not being set (sub-class may then choose to do something else.)
+        */
+        bool writeHorzFormatXML(OutStream& out_stream) const;
+
+
+        // data fields
+        ComponentArea   d_area;                 //!< Destination area for this component.
+        ColourRect      d_colours;              //!< base colours to be applied when rendering the image component.
+        String          d_colourPropertyName;   //!< name of property to fetch colours from.
+        bool            d_colourProperyIsRect;  //!< true if the colour property will fetch a full ColourRect.
+        String          d_vertFormatPropertyName;   //!< name of property to fetch vertical formatting setting from.
+        String          d_horzFormatPropertyName;   //!< name of property to fetch horizontal formatting setting from.
+    };
+} // End of  CEGUI namespace section
+
+
+#endif  // end of guard _CEGUIFalComponentBase_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalPropertyDefinition.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalPropertyDefinition.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalPropertyDefinition.h	(revision 1812)
@@ -0,0 +1,67 @@
+/************************************************************************
+    filename:   CEGUIFalPropertyDefinition.h
+    created:    Sun Jun 26 2005
+    author:     Paul D Turner <paul@cegui.org.uk>
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+ 
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+ 
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+ 
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIFalPropertyDefinition_h_
+#define _CEGUIFalPropertyDefinition_h_
+
+#include "CEGUIProperty.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+    /*!
+    \brief
+        class representing a new property to be available on all widgets that use the WidgetLook
+        that this PropertyDefinition is defiend for.
+    */
+    class CEGUIEXPORT PropertyDefinition : public Property
+    {
+    public:
+        PropertyDefinition(const String& name, const String& initialValue, bool redrawOnWrite, bool layoutOnWrite);
+
+        // abstract members from Property
+        String get(const PropertyReceiver* receiver) const;
+        void set(PropertyReceiver* receiver, const String& value);
+
+        /*!
+        \brief
+            Writes an xml representation of this PropertyDefinition  to \a out_stream.
+
+        \param out_stream
+            Stream where xml data should be output.
+
+        \return
+            Nothing.
+        */
+        void writeXMLToStream(OutStream& out_stream) const;
+
+    protected:
+        String d_userStringName;
+        bool d_writeCausesRedraw;
+        bool d_writeCausesLayout;
+    };
+
+} // End of  CEGUI namespace section
+
+
+#endif  // end of guard _CEGUIFalPropertyDefinition_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalStateImagery.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalStateImagery.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalStateImagery.h	(revision 1812)
@@ -0,0 +1,172 @@
+/************************************************************************
+    filename:   CEGUIFalStateImagery.h
+    created:    Mon Jun 13 2005
+    author:     Paul D Turner <paul@cegui.org.uk>
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+ 
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+ 
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+ 
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIFalStateImagery_h_
+#define _CEGUIFalStateImagery_h_
+
+#include "falagard/CEGUIFalLayerSpecification.h"
+#include "CEGUIWindow.h"
+#include <set>
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+    /*!
+    \brief
+        Class the encapsulates imagery for a given widget state.
+    */
+    class CEGUIEXPORT StateImagery
+    {
+    public:
+        /*!
+        \brief
+            Constructor
+        */
+        StateImagery() {}
+
+        /*!
+        \brief
+            Constructor
+
+        \param name
+            Name of the state
+        */
+        StateImagery(const String& name);
+
+        /*!
+        \brief
+            Render imagery for this state.
+
+        \param srcWindow
+            Window to use when convering BaseDim values to pixels.
+
+        \return
+            Nothing.
+        */
+        void render(Window& srcWindow, const ColourRect* modcols = 0, const Rect* clipper = 0) const;
+
+        /*!
+        \brief
+            Render imagery for this state.
+
+        \param srcWindow
+            Window to use when convering BaseDim values to pixels.
+
+        \param baseRect
+            Rect to use when convering BaseDim values to pixels.
+
+        \return
+            Nothing.
+        */
+        void render(Window& srcWindow, const Rect& baseRect, const ColourRect* modcols = 0, const Rect* clipper = 0) const;
+
+        /*!
+        \brief
+            Add an imagery LayerSpecification to this state.
+
+        \param layer
+            LayerSpecification to be added to this state (will be copied)
+
+        \return
+            Nothing.
+        */
+        void addLayer(const LayerSpecification& layer);
+
+        /*!
+        \brief
+            Removed all LayerSpecifications from this state.
+
+        \return
+            Nothing.
+        */
+        void clearLayers();
+
+        /*!
+        \brief
+            Return the name of this state.
+
+        \return
+            String object holding the name of the StateImagery object.
+        */
+        const String& getName() const;
+
+        /*!
+        \brief
+            Return whether this state imagery should be clipped to the display rather than the target window.
+
+            Clipping to the display effectively implies that the imagery should be rendered unclipped.
+
+        /return
+            - true if the imagery will be clipped to the display area.
+            - false if the imagery will be clipped to the target window area.
+        */
+        bool isClippedToDisplay() const;
+
+        /*!
+        \brief
+            Set whether this state imagery should be clipped to the display rather than the target window.
+
+            Clipping to the display effectively implies that the imagery should be rendered unclipped.
+
+        \param setting
+            - true if the imagery should be clipped to the display area.
+            - false if the imagery should be clipped to the target window area.
+
+        \return
+            Nothing.
+        */
+        void setClippedToDisplay(bool setting);
+
+        /*!
+        \brief
+            Writes an xml representation of this StateImagery to \a out_stream.
+
+        \param out_stream
+            Stream where xml data should be output.
+
+        \return
+            Nothing.
+        */
+        void writeXMLToStream(OutStream& out_stream) const;
+
+    private:
+        typedef std::multiset<LayerSpecification> LayersList;
+
+        CEGUI::String   d_stateName;    //!< Name of this state.
+        LayersList      d_layers;       //!< Collection of LayerSpecification objects to be drawn for this state.
+        bool            d_clipToDisplay; //!< true if Imagery for this state should be clipped to the display instead of winodw (effectively, not clipped).
+    };
+
+} // End of  CEGUI namespace section
+
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif  // end of guard _CEGUIFalStateImagery_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalWidgetLookManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalWidgetLookManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalWidgetLookManager.h	(revision 1812)
@@ -0,0 +1,227 @@
+/************************************************************************
+    filename:   CEGUIFalWidgetLookManager.h
+    created:    Mon Jun 13 2005
+    author:     Paul D Turner <paul@cegui.org.uk>
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+ 
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+ 
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+ 
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIFalWidgetLookManager_h_
+#define _CEGUIFalWidgetLookManager_h_
+
+#include "CEGUISingleton.h"
+#include "CEGUIString.h"
+#include "CEGUIExceptions.h"
+#include "falagard/CEGUIFalWidgetLookFeel.h"
+#include <map>
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#	pragma warning(disable : 4275)
+#endif
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+    /*!
+    \brief
+        Manager class that gives top-level access to widget data based "look and feel" specifications loaded into the system.
+    */
+    class CEGUIEXPORT WidgetLookManager : public Singleton<WidgetLookManager>
+    {
+    public:
+        /*!
+        \brief
+            Constructor.
+        */
+        WidgetLookManager();
+
+        /*!
+        \brief
+            Destructor
+        */
+        ~WidgetLookManager();
+
+       	/*!
+	      \brief
+		        Return singleton WidgetLookManager object
+
+	      \return
+		        Singleton WidgetLookManager object
+	      */
+	      static	WidgetLookManager&	getSingleton(void);
+
+
+	      /*!
+	      \brief
+		        Return pointer to singleton WindowFactoryManager object
+
+	      \return
+		        Pointer to singleton WindowFactoryManager object
+	      */
+	      static	WidgetLookManager*	getSingletonPtr(void);
+
+
+        /*!
+        \brief
+            Parses a file containing window look & feel specifications (in the form of XML).
+
+        \note
+            If the new file contains specifications for widget types that are already specified, it is not an error;
+            the previous definitions are overwritten by the new data.  An entry will appear in the log each time any
+            look & feel component is overwritten.
+
+        \param filename
+            String object containing the filename of a file containing the widget look & feel data
+
+        \param resourceGroup
+            Resource group identifier to pass to the resource provider when loading the file.
+
+        \return
+            Nothing.
+
+        \exception	FileIOException				thrown if there was some problem accessing or parsing the file \a filename
+        \exception	InvalidRequestException		thrown if an invalid filename was provided.
+        */
+        void parseLookNFeelSpecification(const String& filename, const String& resourceGroup = "");
+
+
+        /*!
+        \brief
+            Return whether a WidgetLookFeel has been created with the specified name.
+
+        \param widget
+            String object holding the name of a widget look to test for.
+
+        \return
+            - true if a WindowLookFeel named \a widget is available.
+            - false if so such WindowLookFeel is currently available.
+        */
+        bool isWidgetLookAvailable(const String& widget) const;
+
+
+        /*!
+        \brief
+            Return a const reference to a WidgetLookFeel object which has the specified name.
+
+        \param widget
+            String object holding the name of a widget look that is to be returned.
+
+        \return
+            const reference to the requested WidgetLookFeel object.
+
+        \exception UnknownObjectException   thrown if no WindowLookFeel is available with the requested name.
+        */
+        const WidgetLookFeel& getWidgetLook(const String& widget) const;
+
+
+        /*!
+        \brief
+            Erase the WidgetLookFeel that has the specified name.
+
+        \param widget
+            String object holding the name of a widget look to be erased.  If no such WindowLookFeel exists, nothing
+            happens.
+
+        \return
+            Nothing.
+        */
+        void eraseWidgetLook(const String& widget);
+
+
+        /*!
+        \brief
+            Add the given WidgetLookFeel.
+
+        \note
+            If the WidgetLookFeel specification uses a name that already exists within the system, it is not an error;
+            the previous definition is overwritten by the new data.  An entry will appear in the log each time any
+            look & feel component is overwritten.
+
+        \param look
+            WidgetLookFeel object to be added to the system.  NB: The WidgetLookFeel is copied, no change of ownership of the
+            input object occurrs.
+
+        \return
+            Nothing.
+        */
+        void addWidgetLook(const WidgetLookFeel& look);
+
+        /*!
+        \brief
+            Writes the xml header and opening 'Falagard' tags to a stream.
+        */
+        void writeFalagardXMLHeadToStream(OutStream& out_stream) const;
+
+        /*!
+        \brief
+            Writes closing xml 'Falagard' tag to a stream.
+
+        \param out_stream
+            OutStream where XML data should be sent.
+        */
+        void writeFalagardXMLTailToStream(OutStream& out_stream) const;
+
+        /*!
+        \brief
+            Writes a complete Widge Look to a stream.  Note that xml file header and
+            falagard opening/closing tags will also be written.
+
+        \param name
+            String holding the name of the widget look to be output to the stream.
+
+        \param out_stream
+            OutStream where XML data should be sent.
+        */
+        void writeWidgetLookToStream(const String& name, OutStream& out_stream) const;
+
+        /*!
+        \brief
+            Writes a series of complete Widge Look objects to a stream.  Note that xml file header and
+            falagard opening/closing tags will also be written.
+
+            The \a prefix specifies a name prefix common to all widget looks to be written, you could
+            specify this as "TaharezLook/" and then any defined widget look starting with that prefix, such
+            as "TaharezLook/Button" and "TaharezLook/Listbox" will be written to the stream.
+
+        \param prefix
+            String holding the widget look name prefix, which will be used when searching for the widget looks
+            to be output to the stream.
+
+        \param out_stream
+            OutStream where XML data should be sent.
+        */
+        void writeWidgetLookSeriesToStream(const String& prefix, OutStream& out_stream) const;
+
+
+    private:
+        static const String FalagardSchemaName;     //!< Name of schema file used for XML validation.
+
+        typedef std::map<String, WidgetLookFeel> WidgetLookList;
+        WidgetLookList  d_widgetLooks;
+    };
+
+} // End of  CEGUI namespace section
+
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif  // end of guard _CEGUIFalWidgetLookManager_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalWidgetLookFeel.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalWidgetLookFeel.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalWidgetLookFeel.h	(revision 1812)
@@ -0,0 +1,318 @@
+/************************************************************************
+    filename:   CEGUIFalWidgetLookFeel.h
+    created:    Mon Jun 13 2005
+    author:     Paul D Turner <paul@cegui.org.uk>
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+ 
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+ 
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+ 
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIFalWidgetLookFeel_h_
+#define _CEGUIFalWidgetLookFeel_h_
+
+#include "falagard/CEGUIFalStateImagery.h"
+#include "falagard/CEGUIFalWidgetComponent.h"
+#include "falagard/CEGUIFalImagerySection.h"
+#include "falagard/CEGUIFalPropertyInitialiser.h"
+#include "falagard/CEGUIFalPropertyDefinition.h"
+#include "falagard/CEGUIFalNamedArea.h"
+#include <map>
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+    /*!
+    \brief
+        Class that encapsulates look & feel information for a particular widget type.
+    */
+    class CEGUIEXPORT WidgetLookFeel
+    {
+    public:
+        WidgetLookFeel(const String& name);
+        WidgetLookFeel() {}
+
+        /*!
+        \brief
+            Return a const reference to the StateImagery object for the specified state.
+
+        \return
+            StateImagery object for the requested state.
+        */
+        const StateImagery& getStateImagery(const CEGUI::String& state) const;
+
+        /*!
+        \brief
+            Return a const reference to the ImagerySection object with the specified name.
+
+        \return
+            ImagerySection object with the specified name.
+        */
+        const ImagerySection& getImagerySection(const CEGUI::String& section) const;
+
+        /*!
+        \brief
+            Return the name of the widget look.
+
+        \return
+            String object holding the name of the WidgetLookFeel.
+        */
+        const String& getName() const;
+
+        /*!
+        \brief
+            Add an ImagerySection to the WidgetLookFeel.
+
+        \param section
+            ImagerySection object to be added.
+
+        \return Nothing.
+        */
+        void addImagerySection(const ImagerySection& section);
+
+        /*!
+        \brief
+            Add a WidgetComponent to the WidgetLookFeel.
+
+        \param widget
+            WidgetComponent object to be added.
+
+        \return Nothing.
+        */
+        void addWidgetComponent(const WidgetComponent& widget);
+
+        /*!
+        \brief
+            Add a state specification (StateImagery object) to the WidgetLookFeel.
+
+        \param section
+            StateImagery object to be added.
+
+        \return Nothing.
+        */
+        void addStateSpecification(const StateImagery& state);
+
+        /*!
+        \brief
+            Add a property initialiser to the WidgetLookFeel.
+
+        \param initialiser
+            PropertyInitialiser object to be added.
+
+        \return Nothing.
+        */
+        void addPropertyInitialiser(const PropertyInitialiser& initialiser);
+
+        /*!
+        \brief
+            Clear all ImagerySections from the WidgetLookFeel.
+
+        \return
+            Nothing.
+        */
+        void clearImagerySections();
+
+        /*!
+        \brief
+            Clear all WidgetComponents from the WidgetLookFeel.
+
+        \return
+            Nothing.
+        */
+        void clearWidgetComponents();
+
+        /*!
+        \brief
+            Clear all StateImagery objects from the WidgetLookFeel.
+
+        \return
+            Nothing.
+        */
+        void clearStateSpecifications();
+
+        /*!
+        \brief
+            Clear all PropertyInitialiser objects from the WidgetLookFeel.
+
+        \return
+            Nothing.
+        */
+        void clearPropertyInitialisers();
+
+        /*!
+        \brief
+            Initialise the given window using PropertyInitialsers and component widgets
+            specified for this WidgetLookFeel.
+
+        \param widget
+            Window based object to be initialised.
+
+        \return
+            Nothing.
+        */
+        void initialiseWidget(Window& widget) const;
+
+        /*!
+        \brief
+            Return whether imagery is defined for the given state.
+
+        \param state
+            String object containing name of state to look for.
+
+        \return
+            - true if imagery exists for the specified state,
+            - false if no imagery exists for the specified state.
+        */
+        bool isStateImageryPresent(const String& state) const;
+
+        /*!
+        \brief
+            Adds a named area to the WidgetLookFeel.
+
+        \param area
+            NamedArea to be added.
+
+        \return
+            Nothing.
+        */
+        void addNamedArea(const NamedArea& area);
+
+        /*!
+        \brief
+            Clear all defined named areas from the WidgetLookFeel
+
+        \return
+            Nothing.
+        */
+        void clearNamedAreas();
+
+        /*!
+        \brief
+            Return the NamedArea with the specified name.
+
+        \param name
+            String object holding the name of the NamedArea to be returned.
+
+        \return
+            The requested NamedArea object.
+        */
+        const NamedArea& getNamedArea(const String& name) const;
+
+        /*!
+        \brief
+            return whether a NamedArea object with the specified name exists for this WidgetLookFeel.
+
+        \param name
+            String holding the name of the NamedArea to check for.
+
+        \return
+            - true if a named area with the requested name is defined for this WidgetLookFeel.
+            - false if no such named area is defined for this WidgetLookFeel.
+        */
+        bool isNamedAreaDefined(const String& name) const;
+
+        /*!
+        \brief
+            Layout the child widgets defined for this WidgetLookFeel which are attached to the given window.
+
+        \param owner
+            Window object that has the child widgets that require laying out.
+
+        \return
+            Nothing.
+        */
+        void layoutChildWidgets(const Window& owner) const;
+
+        /*!
+        \brief
+            Adds a property definition to the WidgetLookFeel.
+
+        \param propdef
+            PropertyDefinition to be added.
+
+        \return
+            Nothing.
+        */
+        void addPropertyDefinition(const PropertyDefinition& propdef);
+
+        /*!
+        \brief
+            Clear all defined property definitions from the WidgetLookFeel
+
+        \return
+            Nothing.
+        */
+        void clearPropertyDefinitions();
+
+        /*!
+        \brief
+            Writes an xml representation of this WidgetLookFeel to \a out_stream.
+
+        \param out_stream
+            Stream where xml data should be output.
+
+        \return
+            Nothing.
+        */
+        void writeXMLToStream(OutStream& out_stream) const;
+
+        /*!
+        \brief
+            Uses the WindowManager to rename the child windows that are
+            created for this WidgetLookFeel.
+
+        \param widget
+            The target Window containing the child windows that are to be
+            renamed.
+
+        \param newBaseName
+            String object holding the new base name that will be used when
+            constructing new names for the child windows.
+        */
+        void renameChildren(const Window& widget, const String& newBaseName) const;
+
+    private:
+        typedef std::map<String, StateImagery>    StateList;
+        typedef std::map<String, ImagerySection>  ImageryList;
+        typedef std::map<String, NamedArea>       NamedAreaList;
+        typedef std::vector<WidgetComponent>      WidgetList;
+        typedef std::vector<PropertyInitialiser>  PropertyList;
+        typedef std::vector<PropertyDefinition>   PropertyDefinitionList;
+
+        CEGUI::String   d_lookName;         //!< Name of this WidgetLookFeel.
+        ImageryList     d_imagerySections;  //!< Collection of ImagerySection objects.
+        WidgetList      d_childWidgets;     //!< Collection of WidgetComponent objects.
+        StateList       d_stateImagery;     //!< Collection of StateImagery objects.
+        PropertyList    d_properties;       //!< Collection of PropertyInitialser objects.
+        NamedAreaList   d_namedAreas;       //!< Collection of NamedArea objects.
+        mutable PropertyDefinitionList  d_propertyDefinitions;  //!< Collection of PropertyDefinition objects.
+    };
+
+
+} // End of  CEGUI namespace section
+
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif  // end of guard _CEGUIFalWidgetLookFeel_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalSectionSpecification.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalSectionSpecification.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalSectionSpecification.h	(revision 1812)
@@ -0,0 +1,232 @@
+/************************************************************************
+    filename:   CEGUIFalSectionSpecification.h
+    created:    Mon Jun 13 2005
+    author:     Paul D Turner <paul@cegui.org.uk>
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+ 
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+ 
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+ 
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIFalSectionSpecification_h_
+#define _CEGUIFalSectionSpecification_h_
+
+#include "CEGUIWindow.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+    // forward refs
+    class WidgetLookFeel;
+
+    /*!
+    \brief
+        Class that represents a simple 'link' to an ImagerySection.
+
+        This class enables sections to be easily re-used, by different states and/or layers, by allowing
+        sections to be specified by name rather than having mutiple copies of the same thing all over the place.
+    */
+    class CEGUIEXPORT SectionSpecification
+    {
+    public:
+        /*!
+        \brief
+            Constructor
+
+        \param owner
+            String holding the name of the WidgetLookFeel object that contains the target section.
+
+        \param sectionName
+            String holding the name of the target section.
+        */
+        SectionSpecification(const String& owner, const String& sectionName);
+
+        /*!
+        \brief
+            Constructor
+
+        \param owner
+            String holding the name of the WidgetLookFeel object that contains the target section.
+
+        \param sectionName
+            String holding the name of the target section.
+
+        \param cols
+            Override colours to be used (modulates sections master colours).
+        */
+        SectionSpecification(const String& owner, const String& sectionName, const ColourRect& cols);
+
+        /*!
+        \brief
+            Render the section specified by this SectionSpecification.
+
+        \param srcWindow
+            Window object to be used when calculating pixel values from BaseDim values.
+
+        \param base_z
+            base z co-ordinate to use for all imagery in the linked section.
+
+        \return
+            Nothing.
+        */
+        void render(Window& srcWindow, float base_z, const ColourRect* modcols = 0, const Rect* clipper = 0, bool clipToDisplay = false) const;
+
+        /*!
+        \brief
+            Render the section specified by this SectionSpecification.
+
+        \param srcWindow
+            Window object to be used when calculating pixel values from BaseDim values.
+
+        \param baseRect
+            Rect object to be used when calculating pixel values from BaseDim values.
+
+        \param base_z
+            base z co-ordinate to use for all imagery in the linked section.
+
+        \return
+            Nothing.
+        */
+        void render(Window& srcWindow, const Rect& baseRect, float base_z, const ColourRect* modcols = 0, const Rect* clipper = 0, bool clipToDisplay = false) const;
+
+        /*!
+        \brief
+            Return the name of the WidgetLookFeel object containing the target section.
+
+        \return
+            String object holding the name of the WidgetLookFeel that contains the target ImagerySection.
+        */
+        const String& getOwnerWidgetLookFeel() const;
+
+        /*!
+        \brief
+            Return the name of the target ImagerySection.
+
+        \return
+            String object holding the name of the target ImagerySection.
+        */
+        const String& getSectionName() const;
+
+        /*!
+        \brief
+            Return the current override colours.
+
+        \return
+            ColourRect holding the colours that will be modulated with the sections master colours if
+            colour override is enabled on this SectionSpecification.
+        */
+        const ColourRect& getOverrideColours() const;
+
+        /*!
+        \brief
+            Set the override colours to be used by this SectionSpecification.
+
+        \param cols
+            ColourRect describing the override colours to set for this SectionSpecification.
+
+        \return
+            Nothing.
+        */
+        void setOverrideColours(const ColourRect& cols);
+
+        /*!
+        \brief
+            return whether the use of override colours is enabled on this SectionSpecification.
+
+        \return
+            - true if override colours will be used for this SectionSpecification.
+            - false if override colours will not be used for this SectionSpecification.
+        */
+        bool isUsingOverrideColours() const;
+
+        /*!
+        \brief
+            Enable or disable the use of override colours for this section.
+
+        \param setting
+            - true if override colours should be used for this SectionSpecification.
+            - false if override colours should not be used for this SectionSpecification.
+
+        \return
+            Nothing.
+        */
+        void setUsingOverrideColours(bool setting = true);
+
+        /*!
+        \brief
+            Set the name of the property where override colour values can be obtained.
+
+        \param property
+            String containing the name of the property.
+
+        \return
+            Nothing.
+        */
+        void setOverrideColoursPropertySource(const String& property);
+
+        /*!
+        \brief
+            Set whether the override colours property source represents a full ColourRect.
+
+        \param setting
+            - true if the override colours property will access a ColourRect object.
+            - false if the override colours property will access a colour object.
+
+        \return
+            Nothing.
+        */
+        void setOverrideColoursPropertyIsColourRect(bool setting = true);
+
+        /*!
+        \brief
+            Writes an xml representation of this SectionSpecification to \a out_stream.
+
+        \param out_stream
+            Stream where xml data should be output.
+
+        \return
+            Nothing.
+        */
+        void writeXMLToStream(OutStream& out_stream) const;
+
+    protected:
+        /*!
+        \brief
+            Helper method to initialise a ColourRect with appropriate values according to the way the
+            section sepcification is set up.
+
+            This will try and get values from multiple places:
+                - a property attached to \a wnd
+                - the integral d_coloursOverride values.
+                - or default to colour(1,1,1,1);
+        */
+        void initColourRectForOverride(const Window& wnd, ColourRect& cr) const;
+
+    private:
+        String          d_owner;                //!< Name of the WidgetLookFeel containing the required section.
+        String          d_sectionName;          //!< Name of the required section within the specified WidgetLookFeel.
+        ColourRect      d_coloursOverride;      //!< Colours to use when override is enabled.
+        bool            d_usingColourOverride;  //!< true if colour override is enabled.
+        String          d_colourPropertyName;   //!< name of property to fetch colours from.
+        bool            d_colourProperyIsRect;  //!< true if the colour property will fetch a full ColourRect.
+    };
+
+
+} // End of  CEGUI namespace section
+
+
+#endif  // end of guard _CEGUIFalSectionSpecification_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalWidgetComponent.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalWidgetComponent.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalWidgetComponent.h	(revision 1812)
@@ -0,0 +1,112 @@
+/************************************************************************
+    filename:   CEGUIFalWidgetComponent.h
+    created:    Mon Jun 13 2005
+    author:     Paul D Turner <paul@cegui.org.uk>
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+ 
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+ 
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+ 
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIFalWidgetComponent_h_
+#define _CEGUIFalWidgetComponent_h_
+
+#include "falagard/CEGUIFalDimensions.h"
+#include "falagard/CEGUIFalPropertyInitialiser.h"
+#include "CEGUIWindow.h"
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+    /*!
+    \brief
+        Class that encapsulates information regarding a sub-widget required for a widget.
+
+    \todo
+        This is not finished in the slightest!  There will be many changes here...
+    */
+    class CEGUIEXPORT WidgetComponent
+    {
+    public:
+        WidgetComponent() {}
+        WidgetComponent(const String& type, const String& look, const String& suffix);
+
+        /*!
+        \brief
+            Create an instance of this widget component adding it as a child to the given Window.
+        */
+        void create(Window& parent) const;
+
+        const ComponentArea& getComponentArea() const;
+        void setComponentArea(const ComponentArea& area);
+
+        const String& getBaseWidgetType() const;
+        void setBaseWidgetType(const String& type);
+
+        const String& getWidgetLookName() const;
+        void setWidgetLookName(const String& look);
+
+        const String& getWidgetNameSuffix() const;
+        void setWidgetNameSuffix(const String& suffix);
+
+        VerticalAlignment getVerticalWidgetAlignemnt() const;
+        void setVerticalWidgetAlignment(VerticalAlignment alignment);
+
+        HorizontalAlignment getHorizontalWidgetAlignemnt() const;
+        void setHorizontalWidgetAlignemnt(HorizontalAlignment alignment);
+
+        void addPropertyInitialiser(const PropertyInitialiser& initialiser);
+        void clearPropertyInitialisers();
+
+        void layout(const Window& owner) const;
+
+        /*!
+        \brief
+            Writes an xml representation of this WidgetComponent to \a out_stream.
+
+        \param out_stream
+            Stream where xml data should be output.
+
+        \return
+            Nothing.
+        */
+        void writeXMLToStream(OutStream& out_stream) const;
+
+    private:
+        typedef std::vector<PropertyInitialiser> PropertiesList;
+
+        ComponentArea   d_area;              //!< Destination area for the widget (relative to it's parent).
+        String   d_baseType;                 //!< Type of widget to be created.
+        String   d_imageryName;              //!< Name of a WidgetLookFeel to be used for the widget.
+        String   d_nameSuffix;               //!< Suffix to apply to the parent Window name to create this widgets unique name.
+        VerticalAlignment    d_vertAlign;    //!< Vertical alignment to be used for this widget.
+        HorizontalAlignment  d_horzAlign;    //!< Horizontal alignment to be used for this widget.
+        PropertiesList  d_properties;        //!< Collection of PropertyInitialisers to be applied the the widget upon creation.
+    };
+
+} // End of  CEGUI namespace section
+
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif  // end of guard _CEGUIFalWidgetComponent_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalTextComponent.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalTextComponent.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalTextComponent.h	(revision 1812)
@@ -0,0 +1,161 @@
+/************************************************************************
+    filename:   CEGUIFalTextComponent.h
+    created:    Sun Jun 19 2005
+    author:     Paul D Turner <paul@cegui.org.uk>
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+ 
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+ 
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+ 
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIFalTextComponent_h_
+#define _CEGUIFalTextComponent_h_
+
+#include "falagard/CEGUIFalComponentBase.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+    /*!
+    \brief
+        Class that encapsulates information for a text component.
+    */
+    class CEGUIEXPORT TextComponent : public FalagardComponentBase
+    {
+    public:
+        /*!
+        \brief
+            Constructor
+        */
+        TextComponent();
+
+        /*!
+        \brief
+            Return the text object that will be rendered by this TextComponent.
+
+        \return
+            String object containing the text that will be rendered.
+        */
+        const String& getText() const;
+
+        /*!
+        \brief
+            Set the text that will be rendered by this TextComponent.
+
+            Note that setting this to the empty string ("") will cause the text from the
+            base window passed when rendering to be used instead.
+
+        \param text
+            String containing text to render, or "" to render text from window.
+
+        \return
+            Nothing.
+        */
+        void setText(const String& text);
+
+        /*!
+        \brief
+            Return the name of the font to be used when rendering this TextComponent.
+
+        \return
+            String object containing the name of a font, or "" if the window font is to be used.
+        */
+        const String& getFont() const;
+
+        /*!
+        \brief
+            Set the name of the font to be used when rendering this TextComponent.
+
+            Note that setting this to the empty string ("") will cause the font from the
+            base window passed when rendering to be used instead.
+
+        \param font
+            String containing name of a font
+
+        \return
+            Nothing.
+        */
+        void setFont(const String& font);
+
+        /*!
+        \brief
+            Return the current vertical formatting setting for this TextComponent.
+
+        \return
+            One of the VerticalTextFormatting enumerated values.
+        */
+        VerticalTextFormatting getVerticalFormatting() const;
+
+        /*!
+        \brief
+            Set the vertical formatting setting for this TextComponent.
+
+        \param fmt
+            One of the VerticalTextFormatting enumerated values.
+
+        \return
+            Nothing.
+        */
+        void setVerticalFormatting(VerticalTextFormatting fmt);
+
+        /*!
+        \brief
+            Return the current horizontal formatting setting for this TextComponent.
+
+        \return
+            One of the HorizontalTextFormatting enumerated values.
+        */
+        HorizontalTextFormatting getHorizontalFormatting() const;
+
+        /*!
+        \brief
+            Set the horizontal formatting setting for this TextComponent.
+
+        \param fmt
+            One of the HorizontalTextFormatting enumerated values.
+
+        \return
+            Nothing.
+        */
+        void setHorizontalFormatting(HorizontalTextFormatting fmt);
+
+        /*!
+        \brief
+            Writes an xml representation of this TextComponent to \a out_stream.
+
+        \param out_stream
+            Stream where xml data should be output.
+
+        \return
+            Nothing.
+        */
+        void writeXMLToStream(OutStream& out_stream) const;
+
+    protected:
+        // implemets abstract from base
+        void render_impl(Window& srcWindow, Rect& destRect, float base_z, const CEGUI::ColourRect* modColours, const Rect* clipper, bool clipToDisplay) const;
+
+    private:
+        String               d_text;            //!< text rendered by this component.
+        String               d_font;            //!< name of font to use.
+        VerticalTextFormatting   d_vertFormatting;  //!< Vertical formatting to be applied when rendering the component.
+        HorizontalTextFormatting d_horzFormatting;  //!< Horizontal formatting to be applied when rendering the component.
+    };
+
+} // End of  CEGUI namespace section
+
+
+#endif  // end of guard _CEGUIFalTextComponent_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalDimensions.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalDimensions.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalDimensions.h	(revision 1812)
@@ -0,0 +1,677 @@
+/************************************************************************
+    filename:   CEGUIFalDimensions.h
+    created:    Mon Jun 13 2005
+    author:     Paul D Turner <paul@cegui.org.uk>
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+ 
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+ 
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+ 
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIFalDimensions_h_
+#define _CEGUIFalDimensions_h_
+
+#include "falagard/CEGUIFalEnums.h"
+#include "CEGUIString.h"
+#include "CEGUIUDim.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+     /*!
+    \brief
+        Abstract interface for a generic 'dimension' class.
+    */
+    class CEGUIEXPORT BaseDim
+    {
+    public:
+        BaseDim();
+
+        virtual ~BaseDim();
+
+        /*!
+        \brief
+            Return a value that represents this dimension as absolute pixels.
+
+        \param wnd
+            Window object that may be used by the specialised class to aid in
+            calculating the final value.
+
+        \return
+            float value which represents, in pixels, the same value as this BaseDim.
+        */
+        float getValue(const Window& wnd) const;
+
+        /*!
+        \brief
+            Return a value that represents this dimension as absolute pixels.
+
+        \param wnd
+            Window object that may be used by the specialised class to aid in
+            calculating the final value (typically would be used to obtain
+            window/widget dimensions).
+
+        \param container
+            Rect object which describes an area to be considered as the base area
+            when calculating the final value.  Basically this means that relative values
+            are calculated from the dimensions of this Rect.
+
+        \return
+            float value which represents, in pixels, the same value as this BaseDim.
+        */
+        float getValue(const Window& wnd, const Rect& container) const;
+
+        /*!
+        \brief
+            Create an exact copy of the specialised class and return it as a pointer to
+            a BaseDim object.
+
+            Since the system needs to be able to copy objects derived from BaseDim, but only
+            has knowledge of the BaseDim interface, this clone method is provided to prevent
+            slicing issues.
+
+        \return
+            BaseDim object pointer
+        */
+        BaseDim* clone() const;
+
+        /*!
+        \brief
+            Return the DimensionOperator set for this BaseDim based object.
+
+        \return
+            One of the DimensionOperator enumerated values representing a mathematical operation to be
+            performed upon this BaseDim using the set operand.
+        */
+        DimensionOperator getDimensionOperator() const;
+
+        /*!
+        \brief
+            Set the DimensionOperator set for this BaseDim based object.
+
+        \param op
+            One of the DimensionOperator enumerated values representing a mathematical operation to be
+            performed upon this BaseDim using the set operand.
+
+        \return
+            Nothing.
+        */
+        void setDimensionOperator(DimensionOperator op);
+
+        /*!
+        \brief
+            Return a pointer to the BaseDim set to be used as the other operand.
+
+        \return
+            Pointer to the BaseDim object.
+        */
+        const BaseDim* getOperand() const;
+
+        /*!
+        \brief
+            Set the BaseDim set to be used as the other operand in calculations for this BaseDim.
+
+        \param operand
+            sub-class of BaseDim representing the 'other' operand.  The given object will be cloned; no
+            transfer of ownership occurrs for the passed object.
+
+        \return
+            Nothing.
+        */
+        void setOperand(const BaseDim& operand);
+
+        /*!
+        \brief
+            Writes an xml representation of this BaseDim to \a out_stream.
+
+        \param out_stream
+            Stream where xml data should be output.
+
+        \return
+            Nothing.
+        */
+        void writeXMLToStream(OutStream& out_stream) const;
+
+    protected:
+        /*!
+        \brief
+            Implementataion method to return the base value for this BaseDim.  This method should
+            not attempt to apply the mathematical operator; this is handled automatically.
+        */
+        virtual float getValue_impl(const Window& wnd) const = 0;
+
+        /*!
+        \brief
+            Implementataion method to return the base value for this BaseDim.  This method should
+            not attempt to apply the mathematical operator; this is handled automatically by BaseDim.
+        */
+        virtual float getValue_impl(const Window& wnd, const Rect& container) const = 0;
+
+        /*!
+        \brief
+            Implementataion method to return a clone of this sub-class of BaseDim.
+            This method should not attempt to clone the mathematical operator or operand; theis is
+            handled automatically by BaseDim.
+        */
+        virtual BaseDim* clone_impl() const = 0;
+
+        /*!
+        \brief
+            Implementataion method to output real xml element name to an OutStream.
+            This method should not write the element opening '<' character, nor close the element, it
+            must write just the element name itself.
+        */
+        virtual void writeXMLElementName_impl(OutStream& out_stream) const = 0;
+
+        /*!
+        \brief
+            Implementataion method to output xml element attributes to an OutStream.
+            This method should not write the element opening '<' character, nor close the element, it
+            must write just the element attributes.
+        */
+        virtual void writeXMLElementAttributes_impl(OutStream& out_stream) const = 0;
+
+    private:
+        DimensionOperator   d_operator;
+        BaseDim*            d_operand;
+    };
+
+
+    /*!
+    \brief
+        Dimension type that represents an absolute pixel value.  Implements BaseDim interface.
+    */
+    class CEGUIEXPORT AbsoluteDim : public BaseDim
+    {
+    public:
+        /*!
+        \brief
+            Constructor.
+
+        \param val
+            float value to be assigned to the AbsoluteDim.
+        */
+        AbsoluteDim(float val);
+
+        /*!
+        \brief
+            Set the current value of the AbsoluteDim.
+        */
+        void setValue(float val);
+
+    protected:
+        // Implementation of the base class interface
+        float getValue_impl(const Window& wnd) const;
+        float getValue_impl(const Window& wnd, const Rect& container) const;
+        void writeXMLElementName_impl(OutStream& out_stream) const;
+        void writeXMLElementAttributes_impl(OutStream& out_stream) const;
+
+        BaseDim* clone_impl() const;
+
+    private:
+        float d_val;    //!< holds pixel value for the AbsoluteDim.
+    };
+
+
+    /*!
+    \brief
+        Dimension type that represents some dimension of a named Image.  Implements BaseDim interface.
+    */
+    class CEGUIEXPORT ImageDim : public BaseDim
+    {
+    public:
+        /*!
+        \brief
+            Constructor.
+
+        \param imageset
+            String object holding the name of the imagseset which contains the image.
+
+        \param image
+            String object holding the name of the image.
+
+        \param dim
+            DimensionType value indicating which dimension of the described image that this ImageDim
+            is to represent.
+        */
+        ImageDim(const String& imageset, const String& image, DimensionType dim);
+
+        /*!
+        \brief
+            Sets the source image information for this ImageDim.
+
+        \param imageset
+            String object holding the name of the imagseset which contains the image.
+
+        \param image
+            String object holding the name of the image.
+
+        \return
+            Nothing.
+        */
+        void setSourceImage(const String& imageset, const String& image);
+
+        /*!
+        \brief
+            Sets the source dimension type for this ImageDim.
+
+        \param dim
+            DimensionType value indicating which dimension of the described image that this ImageDim
+            is to represent.
+
+        \return
+            Nothing.
+        */
+        void setSourceDimension(DimensionType dim);
+
+    protected:
+        // Implementation of the base class interface
+        float getValue_impl(const Window& wnd) const;
+        float getValue_impl(const Window& wnd, const Rect& container) const;
+        void writeXMLElementName_impl(OutStream& out_stream) const;
+        void writeXMLElementAttributes_impl(OutStream& out_stream) const;
+        BaseDim* clone_impl() const;
+
+    private:
+        String d_imageset;      //!< name of the Imageset containing the image.
+        String d_image;         //!< name of the Image.
+        DimensionType d_what;   //!< the dimension of the image that we are to represent.
+    };
+
+
+    /*!
+    \brief
+        Dimension type that represents some dimension of a Window/widget.  Implements BaseDim interface.
+
+        When calculating the final pixel value for the dimension, a target widget name is built by
+        appending the name suffix specified for the WidgetDim to the name of the window passed to
+        getValue, we then find the window/widget with that name - the final value of the dimension
+        is taken from this window/widget.
+    */
+    class CEGUIEXPORT WidgetDim : public BaseDim
+    {
+    public:
+        /*!
+        \brief
+            Constructor.
+
+        \param name
+            String object holding the name suffix for a window/widget.
+
+        \param dim
+            DimensionType value indicating which dimension of the described image that this ImageDim
+            is to represent.
+        */
+        WidgetDim(const String& name, DimensionType dim);
+
+        /*!
+        \brief
+            Set the name suffix to use for this WidgetDim.
+
+        \param name
+            String object holding the name suffix for a window/widget.
+
+        \return
+            Nothing.
+        */
+        void setWidgetName(const String& name);
+
+        /*!
+        \brief
+            Sets the source dimension type for this WidgetDim.
+
+        \param dim
+            DimensionType value indicating which dimension of the described image that this WidgetDim
+            is to represent.
+
+        \return
+            Nothing.
+        */
+        void setSourceDimension(DimensionType dim);
+
+    protected:
+        // Implementation of the base class interface
+        float getValue_impl(const Window& wnd) const;
+        float getValue_impl(const Window& wnd, const Rect& container) const;
+        void writeXMLElementName_impl(OutStream& out_stream) const;
+        void writeXMLElementAttributes_impl(OutStream& out_stream) const;
+        BaseDim* clone_impl() const;
+
+    private:
+        String d_widgetName;    //!< Holds target window name suffix.
+        DimensionType d_what;   //!< the dimension of the target window that we are to represent.
+    };
+
+
+    /*!
+    \brief
+        Dimension type that represents an Unified dimension.  Implements BaseDim interface.
+    */
+    class CEGUIEXPORT UnifiedDim : public BaseDim
+    {
+    public:
+        /*!
+        \brief
+            Constructor.
+
+        \param value
+            UDim holding the value to assign to this UnifiedDim.
+
+        \param dim
+            DimensionType value indicating what this UnifiedDim is to represent.  This is required
+            because we need to know what part of the base Window that the UDim scale component is
+            to operate against.
+        */
+        UnifiedDim(const UDim& value, DimensionType dim);
+
+    protected:
+        // Implementation of the base class interface
+        float getValue_impl(const Window& wnd) const;
+        float getValue_impl(const Window& wnd, const Rect& container) const;
+        void writeXMLElementName_impl(OutStream& out_stream) const;
+        void writeXMLElementAttributes_impl(OutStream& out_stream) const;
+        BaseDim* clone_impl() const;
+
+    private:
+        UDim d_value;           //!< The UDim value.
+        DimensionType d_what;   //!< what we represent.
+    };
+
+    /*!
+    \brief
+        Dimension type that represents some metric of a Font.  Implements BaseDim interface.
+    */
+    class CEGUIEXPORT FontDim : public BaseDim
+    {
+    public:
+        /*!
+        \brief
+            Constructor.
+
+        \param name
+            String holding the name suffix of the window to be accessed to obtain the font
+            and / or text strings to be used when these items are not explicitly given.
+
+        \param font
+            String holding the name of the font to use for this dimension.  If the string is
+            empty, the font assigned to the window passed to getValue will be used.
+
+        \param text
+            String holding the text to be measured for horizontal extent.  If this is empty,
+            the text from the window passed to getValue will be used.
+
+        \param metric
+            One of the FontMetricType values indicating what we should represent.
+
+        \param padding
+            constant pixel padding value to be added.
+        */
+        FontDim(const String& name, const String& font, const String& text, FontMetricType metric, float padding = 0);
+
+    protected:
+        // Implementation of the base class interface
+        float getValue_impl(const Window& wnd) const;
+        float getValue_impl(const Window& wnd, const Rect& container) const;
+        void writeXMLElementName_impl(OutStream& out_stream) const;
+        void writeXMLElementAttributes_impl(OutStream& out_stream) const;
+        BaseDim* clone_impl() const;
+
+    private:
+        String  d_font;          //!< Name of Font.  If empty font will be taken from Window.
+        String  d_text;          //!< String to measure for extents, if empty will use window text.
+        String  d_childSuffix;   //!< String to hold the name suffix of the window to use for fetching missing font and/or text.
+        FontMetricType d_metric; //!< what metric we represent.
+        float   d_padding;       //!< padding value to be added.
+    };
+
+    /*!
+    \brief
+        Dimension type that represents the value of a Window property.  Implements BaseDim interface.
+    */
+    class CEGUIEXPORT PropertyDim : public BaseDim
+    {
+    public:
+        /*!
+        \brief
+            Constructor.
+
+        \param name
+            String holding the name suffix of the window on which the property is to be accessed.
+
+        \param property
+            String object holding the name of the property this PropertyDim represents the value of.
+            The property named should represent a simple float value.
+        */
+        PropertyDim(const String& name, const String& property);
+
+    protected:
+        // Implementation of the base class interface
+        float getValue_impl(const Window& wnd) const;
+        float getValue_impl(const Window& wnd, const Rect& container) const;
+        void writeXMLElementName_impl(OutStream& out_stream) const;
+        void writeXMLElementAttributes_impl(OutStream& out_stream) const;
+        BaseDim* clone_impl() const;
+
+    private:
+        String d_property;      //!< Propery that this object represents.
+        String  d_childSuffix;  //!< String to hold the name suffix of the child to access the property form.
+    };
+
+    /*!
+    \brief
+        Class representing some kind of dimension.
+
+        The key thing to understand about Dimension is that it contains not just a dimensional value,
+        but also a record of what the dimension value is supposed to represent. (e.g. a co-ordinate on
+        the x axis, or the height of something).
+    */
+    class CEGUIEXPORT Dimension
+    {
+    public:
+        /*!
+        \brief
+            Constructor
+        */
+        Dimension();
+
+        /*!
+        \brief
+            Destructor
+        */
+        ~Dimension();
+
+        /*!
+        \brief
+            Constructor
+
+        \param dim
+            object based on subclass of BaseDim which holds the dimensional value.
+
+        \param type
+            DimensionType value indicating what dimension this object is to represent.
+        */
+        Dimension(const BaseDim& dim, DimensionType type);
+
+        /*!
+        \brief
+            Copy constructor
+        */
+        Dimension(const Dimension& other);
+
+        /*!
+        \brief
+            Assignment operator
+        */
+        Dimension& operator=(const Dimension& other);
+
+        /*!
+        \brief
+            return the BaseDim object currently used as the value for this Dimension.
+
+        \return
+            const reference to the BaseDim sub-class object which contains the value for this Dimension.
+        */
+        const BaseDim& getBaseDimension() const;
+
+        /*!
+        \brief
+            set the current value for this Dimension.
+
+        \param dim
+            object based on a subclass of BaseDim which holds the dimensional value.
+
+        \return
+            Nothing.
+        */
+        void setBaseDimension(const BaseDim& dim);
+
+        /*!
+        \brief
+            Return a DimensionType value indicating what this Dimension represents.
+
+        \return
+            one of the DimensionType enumerated values.
+        */
+        DimensionType getDimensionType() const;
+
+        /*!
+        \brief
+            Sets what this Dimension represents.
+
+        \param type
+            one of the DimensionType enumerated values.
+
+        \return
+            Nothing.
+        */
+        void setDimensionType(DimensionType type);
+
+        /*!
+        \brief
+            Writes an xml representation of this Dimension to \a out_stream.
+
+        \param out_stream
+            Stream where xml data should be output.
+
+        \return
+            Nothing.
+        */
+        void writeXMLToStream(OutStream& out_stream) const;
+
+    private:
+        BaseDim*        d_value;    //!< Pointer to the value for this Dimension.
+        DimensionType   d_type;     //!< What we represent.
+    };
+
+
+    /*!
+    \brief
+        Class that represents a target area for a widget or imagery component.
+
+        This is essentially a Rect built out of Dimension objects.  Of note is that
+        what would normally be the 'right' and 'bottom' edges may alternatively
+        represent width and height depending upon what the assigned Dimension(s)
+        represent.
+    */
+    class CEGUIEXPORT ComponentArea
+    {
+    public:
+        /*!
+        \brief
+            Return a Rect describing the absolute pixel area represented by this ComponentArea.
+
+        \param wnd
+            Window object to be used when calculating final pixel area.
+
+        \return
+            Rect object describing the pixels area represented by this ComponentArea when using \a wnd
+            as a reference for calculating the final pixel dimensions.
+        */
+        Rect getPixelRect(const Window& wnd) const;
+
+        /*!
+        \brief
+            Return a Rect describing the absolute pixel area represented by this ComponentArea.
+
+        \param wnd
+            Window object to be used when calculating final pixel area.
+
+        \param container
+            Rect object to be used as a base or container when converting relative dimensions.
+
+        \return
+            Rect object describing the pixels area represented by this ComponentArea when using \a wnd
+            and \a container as a reference for calculating the final pixel dimensions.
+        */
+        Rect getPixelRect(const Window& wnd, const Rect& container) const;
+
+        /*!
+        \brief
+            Writes an xml representation of this ComponentArea to \a out_stream.
+
+        \param out_stream
+            Stream where xml data should be output.
+
+        \return
+            Nothing.
+        */
+        void writeXMLToStream(OutStream& out_stream) const;
+
+        /*!
+        \brief
+            Return whether this ComponentArea fetches it's area via a property on the target window.
+
+        \return
+            - true if the area comes via a Propery.
+            - false if the area is defined explicitly via the Dimension fields.
+        */
+        bool isAreaFetchedFromProperty() const;
+
+        /*!
+        \brief
+            Return the name of the property that will be used to determine the pixel area for this ComponentArea.
+
+        \return
+            String object holding the name of a Propery.
+        */
+        const String& getAreaPropertySource() const;
+
+        /*!
+        \brief
+            Set the name of the property that will be used to determine the pixel area for this ComponentArea.
+
+        \param property
+            String object holding the name of a Propery.  The property should access a URect type property.
+
+        \return
+            Nothing.
+        */
+        void setAreaPropertySource(const String& property);
+
+
+        Dimension d_left;   //!< Left edge of the area.
+        Dimension d_top;    //!< Top edge of the area.
+        Dimension d_right_or_width;     //!< Either the right edge or the width of the area.
+        Dimension d_bottom_or_height;   //!< Either the bototm edge or the height of the area.
+
+    private:
+        String  d_areaProperty;         //!< Property to access.  Must be a URect style property.
+    };
+
+} // End of  CEGUI namespace section
+
+
+#endif  // end of guard _CEGUIFalDimensions_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalFrameComponent.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalFrameComponent.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalFrameComponent.h	(revision 1812)
@@ -0,0 +1,165 @@
+/************************************************************************
+    filename:   CEGUIFalFrameComponent.h
+    created:    Mon Jul 18 2005
+    author:     Paul D Turner <paul@cegui.org.uk>
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+ 
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+ 
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+ 
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIFalFrameComponent_h_
+#define _CEGUIFalFrameComponent_h_
+
+#include "falagard/CEGUIFalComponentBase.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+    /*!
+    \brief
+        Class that encapsulates information for a frame with background (9 images in total)
+
+        Corner images are always drawn at their natural size, edges are stretched between the corner
+        pieces for a particular edge, the background image will cover the inner rectangle formed by
+        the edge images and can be stretched or tiled in either dimension.
+    */
+    class CEGUIEXPORT FrameComponent : public FalagardComponentBase
+    {
+    public:
+        /*!
+        \brief
+            Constructor
+        */
+        FrameComponent();
+
+        /*!
+        \brief
+            Return the current vertical formatting setting for this FrameComponent.
+
+        \return
+            One of the VerticalFormatting enumerated values.
+        */
+        VerticalFormatting getBackgroundVerticalFormatting() const;
+
+        /*!
+        \brief
+            Set the vertical formatting setting for this FrameComponent.
+
+        \param fmt
+            One of the VerticalFormatting enumerated values.
+
+        \return
+            Nothing.
+        */
+        void setBackgroundVerticalFormatting(VerticalFormatting fmt);
+
+        /*!
+        \brief
+            Return the current horizontal formatting setting for this FrameComponent.
+
+        \return
+            One of the HorizontalFormatting enumerated values.
+        */
+        HorizontalFormatting getBackgroundHorizontalFormatting() const;
+
+        /*!
+        \brief
+            Set the horizontal formatting setting for this FrameComponent.
+
+        \param fmt
+            One of the HorizontalFormatting enumerated values.
+
+        \return
+            Nothing.
+        */
+        void setBackgroundHorizontalFormatting(HorizontalFormatting fmt);
+
+        /*!
+        \brief
+            Return the Image object that will be drawn by this FrameComponent for a specified frame part.
+
+        \param part
+            One of the FrameImageComponent enumerated values specifying the component image to be accessed.
+
+        \return
+            Image object.
+        */
+        const Image* getImage(FrameImageComponent part) const;
+
+        /*!
+        \brief
+            Set the Image that will be drawn by this ImageryComponent.
+
+        \param part
+            One of the FrameImageComponent enumerated values specifying the component image to be accessed.
+
+        \param image
+            Pointer to the Image object to be drawn by this FrameComponent.
+
+        \return
+            Nothing.
+        */
+        void setImage(FrameImageComponent part, const Image* image);
+
+        /*!
+        \brief
+            Set the Image that will be drawn by this FrameComponent.
+
+        \param part
+            One of the FrameImageComponent enumerated values specifying the component image to be accessed.
+
+        \param imageset
+            String holding the name of the Imagset that contains the Image to be rendered.
+
+        \param image
+            String holding the name of the Image to be rendered.
+
+        \return
+            Nothing.
+        */
+        void setImage(FrameImageComponent part, const String& imageset, const String& image);
+
+        /*!
+        \brief
+            Writes an xml representation of this FrameComponent to \a out_stream.
+
+        \param out_stream
+            Stream where xml data should be output.
+
+        \return
+            Nothing.
+        */
+        void writeXMLToStream(OutStream& out_stream) const;
+
+    protected:
+        // implemets abstract from base
+        void render_impl(Window& srcWindow, Rect& destRect, float base_z, const CEGUI::ColourRect* modColours, const Rect* clipper, bool clipToDisplay) const;
+
+        // renders the background image (basically a clone of render_impl from ImageryComponent - maybe we need a helper class?)
+        void doBackgroundRender(Window& srcWindow, Rect& destRect, float base_z, const ColourRect& colours, const Rect* clipper, bool clipToDisplay) const;
+
+        // formatting options for background
+        VerticalFormatting   d_vertFormatting;  //!< Vertical formatting to be applied when rendering the background for the component.
+        HorizontalFormatting d_horzFormatting;  //!< Horizontal formatting to be applied when rendering the background for the component.
+        // images for the frame
+        const Image* d_frameImages[FIC_FRAME_IMAGE_COUNT];  //!< Array that holds the assigned images.
+    };
+
+} // End of  CEGUI namespace section
+
+
+#endif  // end of guard _CEGUIFalFrameComponent_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalLayerSpecification.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalLayerSpecification.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalLayerSpecification.h	(revision 1812)
@@ -0,0 +1,149 @@
+/************************************************************************
+    filename:   CEGUIFalLayerSpecification.h
+    created:    Mon Jun 13 2005
+    author:     Paul D Turner <paul@cegui.org.uk>
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+ 
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+ 
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+ 
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIFalLayerSpecification_h_
+#define _CEGUIFalLayerSpecification_h_
+
+#include "falagard/CEGUIFalSectionSpecification.h"
+#include "CEGUIWindow.h"
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+    /*!
+    \brief
+        Class that encapsulates a single layer of imagery.
+    */
+    class CEGUIEXPORT LayerSpecification
+    {
+    public:
+        /*!
+        \brief
+            Constructor.
+
+        \param priority
+            Specifies the priority of the layer.  Layers with higher priorities will be drawn on top
+            of layers with lower priorities.
+        */
+        LayerSpecification(uint priority);
+
+        /*!
+        \brief
+            Render this layer.
+
+        \param srcWindow
+            Window to use when calculating pixel values from BaseDim values.
+
+        \param base_z
+            base level z value to use for all imagery in the layer.
+
+        \return
+            Nothing.
+        */
+        void render(Window& srcWindow, float base_z, const ColourRect* modcols = 0, const Rect* clipper = 0, bool clipToDisplay = false) const;
+
+        /*!
+        \brief
+            Render this layer.
+
+        \param srcWindow
+            Window to use when calculating pixel values from BaseDim values.
+
+        \param baseRect
+            Rect to use when calculating pixel values from BaseDim values.
+
+        \param base_z
+            base level z value to use for all imagery in the layer.
+
+        \return
+            Nothing.
+        */
+        void render(Window& srcWindow, const Rect& baseRect, float base_z, const ColourRect* modcols = 0, const Rect* clipper = 0, bool clipToDisplay = false) const;
+
+        /*!
+        \brief
+            Add a section specification to the layer.
+
+            A section specification is a reference to a named ImagerySection within the WidgetLook.
+
+        \param section
+            SectionSpecification object descibing the section that should be added to this layer.
+
+        \return
+            Nothing,
+        */
+        void addSectionSpecification(const SectionSpecification& section);
+
+        /*!
+        \brief
+            Clear all section specifications from this layer,
+
+        \return
+            Nothing.
+        */
+        void clearSectionSpecifications();
+
+        /*!
+        \brief
+            Return the priority of this layer.
+
+        \return
+            uint value descibing the priority of this LayerSpecification.
+        */
+        uint getLayerPriority() const;
+
+        // required to sort layers according to priority
+        bool operator<(const LayerSpecification& other) const;
+
+        /*!
+        \brief
+            Writes an xml representation of this Layer to \a out_stream.
+
+        \param out_stream
+            Stream where xml data should be output.
+
+        \return
+            Nothing.
+        */
+        void writeXMLToStream(OutStream& out_stream) const;
+
+    private:
+        typedef std::vector<SectionSpecification> SectionList;
+
+        SectionList d_sections;         //!< Collection of SectionSpecification objects descibing the sections to be drawn for this layer.
+        uint        d_layerPriority;    //!< Priority of the layer.
+    };
+
+} // End of  CEGUI namespace section
+
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif  // end of guard _CEGUIFalLayerSpecification_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalNamedArea.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalNamedArea.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalNamedArea.h	(revision 1812)
@@ -0,0 +1,93 @@
+/************************************************************************
+    filename:   CEGUIFalNamedArea.h
+    created:    Sun Jun 26 2005
+    author:     Paul D Turner <paul@cegui.org.uk>
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+ 
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+ 
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+ 
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIFalNamedArea_h_
+#define _CEGUIFalNamedArea_h_
+
+#include "falagard/CEGUIFalDimensions.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+    /*!
+    \brief
+        NamedArea defines an area for a component which may later be obtained
+        and referenced by a name unique to the WidgetLook holding the NamedArea.
+    */
+    class CEGUIEXPORT NamedArea
+    {
+    public:
+        NamedArea() {}
+        NamedArea(const String& name);
+
+        /*!
+        \brief
+            Return the name of this NamedArea.
+
+        \return
+            String object holding the name of this NamedArea.
+        */
+        const String& getName() const;
+
+        /*!
+        \brief
+            Return the ComponentArea of this NamedArea
+
+        \return
+            ComponentArea object describing the NamedArea's current target area.
+        */
+        const ComponentArea& getArea() const;
+
+        /*!
+        \brief
+            Set the Area for this NamedArea.
+
+        \param area
+            ComponentArea object describing a new target area for the NamedArea..
+
+        \return
+            Nothing.
+        */
+        void setArea(const ComponentArea& area);
+
+        /*!
+        \brief
+            Writes an xml representation of this NamedArea to \a out_stream.
+
+        \param out_stream
+            Stream where xml data should be output.
+
+        \return
+            Nothing.
+        */
+        void writeXMLToStream(OutStream& out_stream) const;
+
+    private:
+        String d_name;
+        ComponentArea d_area;
+    };
+
+} // End of  CEGUI namespace section
+
+
+#endif  // end of guard _CEGUIFalNamedArea_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalImageryComponent.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalImageryComponent.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalImageryComponent.h	(revision 1812)
@@ -0,0 +1,179 @@
+/************************************************************************
+    filename:   CEGUIFalImageryComponent.h
+    created:    Mon Jun 13 2005
+    author:     Paul D Turner <paul@cegui.org.uk>
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+ 
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+ 
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+ 
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIFalImageryComponent_h_
+#define _CEGUIFalImageryComponent_h_
+
+#include "falagard/CEGUIFalComponentBase.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+    /*!
+    \brief
+        Class that encapsulates information for a single image component.
+    */
+    class CEGUIEXPORT ImageryComponent : public FalagardComponentBase
+    {
+    public:
+        /*!
+        \brief
+            Constructor
+        */
+        ImageryComponent();
+
+        /*!
+        \brief
+            Return the Image object that will be drawn by this ImageryComponent.
+
+        \return
+            Image object.
+        */
+        const Image* getImage() const;
+
+        /*!
+        \brief
+            Set the Image that will be drawn by this ImageryComponent.
+
+        \param
+            Pointer to the Image object to be drawn by this ImageryComponent.
+
+        \return
+            Nothing.
+        */
+        void setImage(const Image* image);
+
+        /*!
+        \brief
+            Set the Image that will be drawn by this ImageryComponent.
+
+        \param imageset
+            String holding the name of the Imagset that contains the Image to be rendered.
+
+        \param image
+            String holding the name of the Image to be rendered.
+
+        \return
+            Nothing.
+        */
+        void setImage(const String& imageset, const String& image);
+
+        /*!
+        \brief
+            Return the current vertical formatting setting for this ImageryComponent.
+
+        \return
+            One of the VerticalFormatting enumerated values.
+        */
+        VerticalFormatting getVerticalFormatting() const;
+
+        /*!
+        \brief
+            Set the vertical formatting setting for this ImageryComponent.
+
+        \param fmt
+            One of the VerticalFormatting enumerated values.
+
+        \return
+            Nothing.
+        */
+        void setVerticalFormatting(VerticalFormatting fmt);
+
+        /*!
+        \brief
+            Return the current horizontal formatting setting for this ImageryComponent.
+
+        \return
+            One of the HorizontalFormatting enumerated values.
+        */
+        HorizontalFormatting getHorizontalFormatting() const;
+
+        /*!
+        \brief
+            Set the horizontal formatting setting for this ImageryComponent.
+
+        \param fmt
+            One of the HorizontalFormatting enumerated values.
+
+        \return
+            Nothing.
+        */
+        void setHorizontalFormatting(HorizontalFormatting fmt);
+
+        /*!
+        \brief
+            Writes an xml representation of this ImageryComponent to \a out_stream.
+
+        \param out_stream
+            Stream where xml data should be output.
+
+        \return
+            Nothing.
+        */
+        void writeXMLToStream(OutStream& out_stream) const;
+
+        /*!
+        \brief
+            Return whether this ImageryComponent fetches it's image via a property on the target window.
+
+        \return
+            - true if the image comes via a Propery.
+            - false if the image is defined explicitly.
+        */
+        bool isImageFetchedFromProperty() const;
+
+        /*!
+        \brief
+            Return the name of the property that will be used to determine the image for this ImageryComponent.
+
+        \return
+            String object holding the name of a Propery.
+        */
+        const String& getImagePropertySource() const;
+
+        /*!
+        \brief
+            Set the name of the property that will be used to determine the image for this ImageryComponent.
+
+        \param property
+            String object holding the name of a Propery.  The property should access a imageset & image specification.
+
+        \return
+            Nothing.
+        */
+        void setImagePropertySource(const String& property);
+
+    protected:
+        // implemets abstract from base
+        void render_impl(Window& srcWindow, Rect& destRect, float base_z, const CEGUI::ColourRect* modColours, const Rect* clipper, bool clipToDisplay) const;
+
+        const Image*         d_image;           //!< CEGUI::Image to be drawn by this image component.
+        VerticalFormatting   d_vertFormatting;  //!< Vertical formatting to be applied when rendering the image component.
+        HorizontalFormatting d_horzFormatting;  //!< Horizontal formatting to be applied when rendering the image component.
+        String  d_imagePropertyName;            //!< Name of the property to access to obtain the image to be used.
+    };
+
+} // End of  CEGUI namespace section
+
+
+#endif  // end of guard _CEGUIFalImageryComponent_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalPropertyInitialiser.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalPropertyInitialiser.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalPropertyInitialiser.h	(revision 1812)
@@ -0,0 +1,102 @@
+/************************************************************************
+    filename:   CEGUIFalPropertyInitialiser.h
+    created:    Mon Jun 13 2005
+    author:     Paul D Turner <paul@cegui.org.uk>
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+ 
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+ 
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+ 
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIFalPropertyInitialiser_h_
+#define _CEGUIFalPropertyInitialiser_h_
+
+#include "CEGUIPropertySet.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+    /*!
+    \brief
+        Class that holds information about a property and it's required initial value.
+    */
+    class CEGUIEXPORT PropertyInitialiser
+    {
+    public:
+        /*!
+        \brief
+            Constructor
+
+        \param property
+            String holding the name of the property targetted by this PropertyInitialiser.
+
+        \param value
+            String holding the value to be set by this PropertyInitialiser.
+        */
+        PropertyInitialiser(const String& property, const String& value);
+
+        /*!
+        \brief
+            Apply this property initialiser to the specified target CEGUI::PropertySet object.
+
+        \param target
+            CEGUI::PropertySet object to be initialised by this PropertyInitialiser.
+
+        \return
+            Nothing.
+        */
+        void apply(PropertySet& target) const;
+
+        /*!
+        \brief
+            Return the name of the property targetted by this PropertyInitialiser.
+
+        \return
+            String object holding the name of the target property.
+        */
+        const String& getTargetPropertyName() const;
+
+        /*!
+        \brief
+            Return the value string to be set on the property targetted by this PropertyInitialiser.
+
+        \return
+            String object holding the value string.
+        */
+        const String& getInitialiserValue() const;
+
+        /*!
+        \brief
+            Writes an xml representation of this PropertyInitialiser to \a out_stream.
+
+        \param out_stream
+            Stream where xml data should be output.
+
+        \return
+            Nothing.
+        */
+        void writeXMLToStream(OutStream& out_stream) const;
+
+    private:
+        CEGUI::String   d_propertyName;     //!< Name of a property to be set.
+        CEGUI::String   d_propertyValue;    //!< Value string to be set on the property.
+    };
+
+} // End of  CEGUI namespace section
+
+
+#endif  // end of guard _CEGUIFalPropertyInitialiser_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalImagerySection.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalImagerySection.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalImagerySection.h	(revision 1812)
@@ -0,0 +1,275 @@
+/************************************************************************
+    filename:   CEGUIFalImagerySection.h
+    created:    Mon Jun 13 2005
+    author:     Paul D Turner <paul@cegui.org.uk>
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+ 
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+ 
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+ 
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIFalImagerySection_h_
+#define _CEGUIFalImagerySection_h_
+
+#include "falagard/CEGUIFalImageryComponent.h"
+#include "falagard/CEGUIFalTextComponent.h"
+#include "falagard/CEGUIFalFrameComponent.h"
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+    /*!
+    \brief
+        Class that encapsulates a re-usable collection of imagery specifications.
+    */
+    class CEGUIEXPORT ImagerySection
+    {
+    public:
+        /*!
+        \brief
+            Constructor.
+        */
+        ImagerySection();
+
+        /*!
+        \brief
+            ImagerySection constructor.  Name must be supplied, masterColours are set to 0xFFFFFFFF by default.
+
+        \param name
+            Name of the new ImagerySection.
+        */
+        ImagerySection(const String& name);
+
+        /*!
+        \brief
+            Render the ImagerySection.
+
+        \param srcWindow
+            Window object to be used when calculating pixel values from BaseDim values.
+
+        \param base_z
+            base z value to be used for all imagery in the section.
+
+        \param modColours
+            ColourRect specifying colours to be modulated with the ImagerySection's master colours.  May be 0.
+
+        \return
+            Nothing.
+        */
+        void render(Window& srcWindow, float base_z, const CEGUI::ColourRect* modColours = 0, const Rect* clipper = 0, bool clipToDisplay = false) const;
+
+        /*!
+        \brief
+            Render the ImagerySection.
+
+        \param srcWindow
+            Window object to be used when calculating pixel values from BaseDim values.
+
+        \param baseRect
+            Rect object to be used when calculating pixel values from BaseDim values.
+
+        \param base_z
+            base z value to be used for all imagery in the section.
+
+        \param modColours
+            ColourRect specifying colours to be modulated with the ImagerySection's master colours.  May be 0.
+
+        \return
+            Nothing.
+        */
+        void render(Window& srcWindow, const Rect& baseRect, float base_z, const CEGUI::ColourRect* modColours = 0, const Rect* clipper = 0, bool clipToDisplay = false) const;
+
+        /*!
+        \brief
+            Add an ImageryComponent to this ImagerySection.
+
+        \param img
+            ImageryComponent to be added to the section (a copy is made)
+
+        \return
+            Nothing
+        */
+        void addImageryComponent(const ImageryComponent& img);
+
+        /*!
+        \brief
+            Clear all ImageryComponents from this ImagerySection.
+
+        \return
+            Nothing
+        */
+        void clearImageryComponents();
+
+        /*!
+        \brief
+            Add a TextComponent to this ImagerySection.
+
+        \param text
+            TextComponent to be added to the section (a copy is made)
+
+        \return
+            Nothing
+        */
+        void addTextComponent(const TextComponent& text);
+
+        /*!
+        \brief
+            Clear all TextComponents from this ImagerySection.
+
+        \return
+            Nothing
+        */
+        void clearTextComponents();
+
+        /*!
+        \brief
+            Clear all FrameComponents from this ImagerySection.
+
+        \return
+            Nothing
+        */
+        void clearFrameComponents();
+
+        /*!
+        \brief
+            Add a FrameComponent to this ImagerySection.
+
+        \param frame
+            FrameComponent to be added to the section (a copy is made)
+
+        \return
+            Nothing
+        */
+        void addFrameComponent(const FrameComponent& frame);
+
+        /*!
+        \brief
+            Return the current master colours set for this ImagerySection.
+
+        \return
+            ColourRect describing the master colour values in use for this ImagerySection.
+        */
+        const ColourRect& getMasterColours() const;
+
+        /*!
+        \brief
+            Set the master colours to be used for this ImagerySection.
+
+        \param cols
+            ColourRect describing the colours to be set as the master colours for this ImagerySection.
+
+        \return
+            Nothing.
+        */
+        void setMasterColours(const ColourRect& cols);
+
+        /*!
+        \brief
+            Return the name of this ImagerySection.
+
+        \return
+            String object holding the name of the ImagerySection.
+        */
+        const String& getName() const;
+
+        /*!
+        \brief
+            Set the name of the property where master colour values can be obtained.
+
+        \param property
+            String containing the name of the property.
+
+        \return
+            Nothing.
+        */
+        void setMasterColoursPropertySource(const String& property);
+
+        /*!
+        \brief
+            Set whether the master colours property source represents a full ColourRect.
+
+        \param setting
+            - true if the master colours property will access a ColourRect object.
+            - false if the master colours property will access a colour object.
+
+        \return
+            Nothing.
+        */
+        void setMasterColoursPropertyIsColourRect(bool setting = true);
+
+        /*!
+        \brief
+            Return smallest Rect that could contain all imagery within this section.
+        */
+        Rect getBoundingRect(const Window& wnd) const;
+
+        /*!
+        \brief
+            Return smallest Rect that could contain all imagery within this section.
+        */
+        Rect getBoundingRect(const Window& wnd, const Rect& rect) const;
+
+        /*!
+        \brief
+            Writes an xml representation of this ImagerySection to \a out_stream.
+
+        \param out_stream
+            Stream where xml data should be output.
+
+        \return
+            Nothing.
+        */
+        void writeXMLToStream(OutStream& out_stream) const;
+
+    protected:
+        /*!
+        \brief
+            Helper method to initialise a ColourRect with appropriate values according to the way the
+            ImagerySection is set up.
+
+            This will try and get values from multiple places:
+                - a property attached to \a wnd
+                - or the integral d_masterColours value.
+        */
+        void initMasterColourRect(const Window& wnd, ColourRect& cr) const;
+
+    private:
+        typedef std::vector<ImageryComponent> ImageryList;
+        typedef std::vector<TextComponent> TextList;
+        typedef std::vector<FrameComponent> FrameList;
+
+        CEGUI::String       d_name;             //!< Holds the name of the ImagerySection.
+        CEGUI::ColourRect   d_masterColours;    //!< Naster colours for the the ImagerySection (combined with colours of each ImageryComponent).
+        FrameList           d_frames;           //!< Collection of FrameComponent objects to be drawn for this ImagerySection.
+        ImageryList         d_images;           //!< Collection of ImageryComponent objects to be drawn for this ImagerySection.
+        TextList            d_texts;            //!< Collection of TextComponent objects to be drawn for this ImagerySection.
+        String              d_colourPropertyName;   //!< name of property to fetch colours from.
+        bool                d_colourProperyIsRect;  //!< true if the colour property will fetch a full ColourRect.
+    };
+
+} // End of  CEGUI namespace section
+
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif  // end of guard _CEGUIFalImagerySection_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/Makefile.am
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/Makefile.am	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/Makefile.am	(revision 1812)
@@ -0,0 +1,20 @@
+pkgincludedir=$(prefix)/include/CEGUI/falagard
+pkginclude_HEADERS = CEGUIFalEnums.h \
+                     CEGUIFalComponentBase.h \
+                     CEGUIFalDimensions.h \
+                     CEGUIFalFrameComponent.h \
+                     CEGUIFalImageryComponent.h \
+                     CEGUIFalNamedArea.h \
+                     CEGUIFalPropertyDefinition.h \
+                     CEGUIFalPropertyInitialiser.h \
+                     CEGUIFalWidgetComponent.h \
+                     CEGUIFalImagerySection.h \
+                     CEGUIFalSectionSpecification.h \
+                     CEGUIFalLayerSpecification.h \
+                     CEGUIFalStateImagery.h \
+                     CEGUIFalTextComponent.h \
+                     CEGUIFalWidgetLookFeel.h \
+                     CEGUIFalWidgetLookManager.h \
+                     CEGUIFalXMLEnumHelper.h
+
+noinst_HEADERS = CEGUIFalagard_xmlHandler.h
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalXMLEnumHelper.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalXMLEnumHelper.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalXMLEnumHelper.h	(revision 1812)
@@ -0,0 +1,66 @@
+/************************************************************************
+    filename:   CEGUIFalXMLEnumHelper.h
+    created:    Mon Jul 18 2005
+    author:     Paul D Turner <paul@cegui.org.uk>
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+ 
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+ 
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+ 
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIFalXMLEnumHelper_h_
+#define _CEGUIFalXMLEnumHelper_h_
+
+#include "CEGUIString.h"
+#include "CEGUIWindow.h"
+#include "falagard/CEGUIFalEnums.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+    /*!
+    \brief
+        Utility helper class primarily intended for use by the falagard xml parser.
+    */
+    class CEGUIEXPORT FalagardXMLHelper
+    {
+    public:
+        static VerticalFormatting stringToVertFormat(const String& str);
+        static HorizontalFormatting stringToHorzFormat(const String& str);
+        static VerticalAlignment stringToVertAlignment(const String& str);
+        static HorizontalAlignment stringToHorzAlignment(const String& str);
+        static DimensionType stringToDimensionType(const String& str);
+        static VerticalTextFormatting stringToVertTextFormat(const String& str);
+        static HorizontalTextFormatting stringToHorzTextFormat(const String& str);
+        static FontMetricType stringToFontMetricType(const String& str);
+        static DimensionOperator stringToDimensionOperator(const String& str);
+        static FrameImageComponent stringToFrameImageComponent(const String& str);
+
+        static String vertFormatToString(VerticalFormatting format);
+        static String horzFormatToString(HorizontalFormatting format);
+        static String vertAlignmentToString(VerticalAlignment alignment);
+        static String horzAlignmentToString(HorizontalAlignment alignment);
+        static String dimensionTypeToString(DimensionType dim);
+        static String vertTextFormatToString(VerticalTextFormatting format);
+        static String horzTextFormatToString(HorizontalTextFormatting format);
+        static String fontMetricTypeToString(FontMetricType metric);
+        static String dimensionOperatorToString(DimensionOperator op);
+        static String frameImageComponentToString(FrameImageComponent imageComp);
+    };
+} // End of  CEGUI namespace section
+
+
+#endif  // end of guard _CEGUIFalXMLEnumHelper_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalEnums.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalEnums.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/falagard/CEGUIFalEnums.h	(revision 1812)
@@ -0,0 +1,147 @@
+/************************************************************************
+    filename:   CEGUIFalEnums.h
+    created:    Mon Jun 13 2005
+    author:     Paul D Turner <paul@cegui.org.uk>
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+ 
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+ 
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+ 
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIFalEnums_h_
+#define _CEGUIFalEnums_h_
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+    /*!
+    \brief
+        Enumeration of possible values to indicate what a given dimension represents.
+    */
+    enum DimensionType
+    {
+        DT_LEFT_EDGE,       //!< Dimension represents the left edge of some entity (same as DT_X_POSITION).
+        DT_X_POSITION,      //!< Dimension represents the x position of some entity (same as DT_LEFT_EDGE).
+        DT_TOP_EDGE,        //!< Dimension represents the top edge of some entity (same as DT_Y_POSITION).
+        DT_Y_POSITION,      //!< Dimension represents the y position of some entity (same as DT_TOP_EDGE).
+        DT_RIGHT_EDGE,      //!< Dimension represents the right edge of some entity.
+        DT_BOTTOM_EDGE,     //!< Dimension represents the bottom edge of some entity.
+        DT_WIDTH,           //!< Dimension represents the width of some entity.
+        DT_HEIGHT,          //!< Dimension represents the height of some entity.
+        DT_X_OFFSET,        //!< Dimension represents the x offset of some entity (usually only applies to an Image entity).
+        DT_Y_OFFSET,        //!< Dimension represents the y offset of some entity (usually only applies to an Image entity).
+        DT_INVALID          //!< Invalid / uninitialised DimensionType.
+    };
+
+    /*!
+    \brief
+        Enumeration of possible values to indicate the vertical formatting to be used for an image component.
+    */
+    enum VerticalFormatting
+    {
+        VF_TOP_ALIGNED,         //!< Top of Image should be aligned with the top of the destination area.
+        VF_CENTRE_ALIGNED,      //!< Image should be vertically centred within the destination area.
+        VF_BOTTOM_ALIGNED,      //!< Bottom of Image should be aligned with the bottom of the destination area.
+        VF_STRETCHED,           //!< Image should be stretched vertically to fill the destination area.
+        VF_TILED                //!< Image should be tiled vertically to fill the destination area (bottom-most tile may be clipped).
+    };
+
+    /*!
+    \brief
+        Enumeration of possible values to indicate the horizontal formatting to be used for an image component.
+    */
+    enum HorizontalFormatting
+    {
+        HF_LEFT_ALIGNED,        //!< Left of Image should be aligned with the left of the destination area.
+        HF_CENTRE_ALIGNED,      //!< Image should be horizontally centred within the destination area.
+        HF_RIGHT_ALIGNED,       //!< Right of Image should be aligned with the right of the destination area.
+        HF_STRETCHED,           //!< Image should be stretched horizontally to fill the destination area.
+        HF_TILED                //!< Image should be tiled horizontally to fill the destination area (right-most tile may be clipped).
+    };
+
+    /*!
+    \brief
+        Enumeration of possible values to indicate the vertical formatting to be used for a text component.
+    */
+    enum VerticalTextFormatting
+    {
+        VTF_TOP_ALIGNED,         //!< Top of text should be aligned with the top of the destination area.
+        VTF_CENTRE_ALIGNED,      //!< text should be vertically centred within the destination area.
+        VTF_BOTTOM_ALIGNED       //!< Bottom of text should be aligned with the bottom of the destination area.
+    };
+
+    /*!
+    \brief
+        Enumeration of possible values to indicate the horizontal formatting to be used for a text component.
+    */
+    enum HorizontalTextFormatting
+    {
+        HTF_LEFT_ALIGNED,        //!< Left of text should be aligned with the left of the destination area (single line of text only).
+        HTF_RIGHT_ALIGNED,       //!< Right of text should be aligned with the right of the destination area  (single line of text only).
+        HTF_CENTRE_ALIGNED,      //!< text should be horizontally centred within the destination area  (single line of text only).
+        HTF_JUSTIFIED,           //!< text should be spaced so that it takes the full width of the destination area (single line of text only).
+        HTF_WORDWRAP_LEFT_ALIGNED,    //!< Left of text should be aligned with the left of the destination area (word wrapped to multiple lines as needed).
+        HTF_WORDWRAP_RIGHT_ALIGNED,   //!< Right of text should be aligned with the right of the destination area  (word wrapped to multiple lines as needed).
+        HTF_WORDWRAP_CENTRE_ALIGNED,  //!< text should be horizontally centred within the destination area  (word wrapped to multiple lines as needed).
+        HTF_WORDWRAP_JUSTIFIED        //!< text should be spaced so that it takes the full width of the destination area (word wrapped to multiple lines as needed).
+    };
+
+    /*!
+    \brief
+        Enumeration of possible values to indicate a particular font metric.
+    */
+    enum FontMetricType
+    {
+        FMT_LINE_SPACING,       //!< Vertical line spacing value for font.
+        FMT_BASELINE,           //!< Vertical baseline value for font.
+        FMT_HORZ_EXTENT         //!< Horizontal extent of a string.
+    };
+
+    /*!
+    \brief
+        Enumeration of values representing mathematical operations on dimensions.
+    */
+    enum DimensionOperator
+    {
+        DOP_NOOP,       //!< Do nothing operator.
+        DOP_ADD,        //!< Dims should be added.
+        DOP_SUBTRACT,   //!< Dims should be subtracted.
+        DOP_MULTIPLY,   //!< Dims should be multiplied.
+        DOP_DIVIDE      //!< Dims should be divided.
+    };
+
+    /*!
+    \brief
+        Enumeration of values referencing available images forming a frame component.
+    */
+    enum FrameImageComponent
+    {
+        FIC_BACKGROUND,             //!< References image used for the background.
+        FIC_TOP_LEFT_CORNER,        //!< References image used for the top-left corner.
+        FIC_TOP_RIGHT_CORNER,       //!< References image used for the top-right corner.
+        FIC_BOTTOM_LEFT_CORNER,     //!< References image used for the bottom-left corner.
+        FIC_BOTTOM_RIGHT_CORNER,    //!< References image used for the bottom-right corner.
+        FIC_LEFT_EDGE,              //!< References image used for the left edge.
+        FIC_RIGHT_EDGE,             //!< References image used for the right edge.
+        FIC_TOP_EDGE,               //!< References image used for the top edge.
+        FIC_BOTTOM_EDGE,            //!< References image used for the bottom edge.
+        FIC_FRAME_IMAGE_COUNT       //!< Max number of images for a frame.
+    };
+
+} // End of  CEGUI namespace section
+
+
+#endif  // end of guard _CEGUIFalEnums_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIWindowFactory.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIWindowFactory.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIWindowFactory.h	(revision 1812)
@@ -0,0 +1,100 @@
+/************************************************************************
+	filename: 	CEGUIWindowFactory.h
+	created:	21/2/2004
+	author:		Paul D Turner
+	
+	purpose:	Defines abstract base class for WindowFactory objects
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIWindowFactory_h_
+#define _CEGUIWindowFactory_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIString.h"
+#include "CEGUIWindow.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Abstract class that defines the required interface for all WindowFactory objects
+
+	A WindowFactory is used to create and destroy windows of a specific type.  For every
+	type of Window object wihin the system (widgets, dialogs, movable windows etc) there
+	must be an associated WindowFactory registered with the WindowManager so that the system
+	knows how to create and destroy those types of Window base object.
+*/
+class CEGUIEXPORT WindowFactory
+{
+public:
+	/*!
+	\brief
+		Create a new Window object of whatever type this WindowFactory produces.
+
+	\param name
+		A unique name that is to be assigned to the newly created Window object
+
+	\return
+		Pointer to the new Window object.
+	*/
+	virtual	Window*	createWindow(const String& name) = 0;
+
+	/*!
+	\brief
+		Destroys the given Window object.
+
+	\param window
+		Pointer to the Window object to be destroyed.
+
+	\return
+		Nothing.
+	*/
+	virtual void	destroyWindow(Window* window) = 0;
+
+	/*!
+	\brief
+		Get the string that describes the type of Window object this WindowFactory produces.
+
+	\return
+		String object that contains the unique Window object type produced by this WindowFactory
+	*/
+	const String& getTypeName(void) const		{return d_type;}
+
+protected:
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	WindowFactory(const String& type) : d_type(type) {}
+
+public:		// luabind compatibility
+	virtual ~WindowFactory(void) {}
+
+protected:
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	String		d_type;		//!< String holding the type of object created by this factory
+};
+
+} // End of  CEGUI namespace section
+
+#endif	// end of guard _CEGUIWindowFactory_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIGUILayout_xmlHandler.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIGUILayout_xmlHandler.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIGUILayout_xmlHandler.h	(revision 1812)
@@ -0,0 +1,129 @@
+/************************************************************************
+	filename: 	CEGUIGUILayout_xmlHandler.h
+	created:	5/7/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to XML parser for GUILayout files
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIGUILayout_xmlHandler_h_
+#define _CEGUIGUILayout_xmlHandler_h_
+
+#include "CEGUIWindowManager.h"
+#include "CEGUIWindow.h"
+#include "CEGUIXMLHandler.h"
+
+#include <vector>
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Handler class used to parse the GUILayout XML files using SAX2
+*/
+class GUILayout_xmlHandler : public XMLHandler
+{
+	typedef WindowManager::PropertyCallback PropertyCallback;
+public:
+	/*************************************************************************
+		Construction & Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for GUILayout_xmlHandler objects
+	*/
+	GUILayout_xmlHandler(const String& name_prefix, PropertyCallback* callback = NULL, void* userdata = NULL) : 
+	  d_root(NULL),
+	  d_namingPrefix(name_prefix),
+	  d_propertyCallback(callback),
+	  d_userData(userdata)
+	  {}
+
+	/*!
+	\brief
+		Destructor for GUILayout_xmlHandler objects
+	*/
+	virtual ~GUILayout_xmlHandler(void) {}
+
+	/*************************************************************************
+		SAX2 Handler overrides
+	*************************************************************************/ 
+	/*!
+	\brief
+		document processing (only care about elements, schema validates format)
+	*/
+    virtual void elementStart(const String& element, const XMLAttributes& attributes);
+    virtual void elementEnd(const String& element);
+
+	/*************************************************************************
+		Functions used by our implementation
+	*************************************************************************/
+	/*!
+	\brief
+		Destroy all windows created so far.
+	*/
+	void	cleanupLoadedWindows(void);
+
+
+	/*!
+	\brief
+		Return a pointer to the 'root' window created.
+	*/
+	Window*	getLayoutRootWindow(void) const;
+
+private:
+	/*************************************************************************
+		Implementation Constants
+	*************************************************************************/
+	static const String GUILayoutElement;				//!< Tag name for GUILayout elements.
+	static const String WindowElement;				//!< Tag name for Window elements.
+	static const String PropertyElement;				//!< Tag name for Property elements.
+	static const String LayoutImportElement;			//!< Tag name for LayoutImport elements.
+	static const String EventElement;					//!< Tag name for Event elements.
+	static const char	WindowTypeAttribute[];			//!< Attribute name that stores the type of Window to create.
+	static const char	WindowNameAttribute[];			//!< Attribute name that stores the name of the window to create.
+	static const char	PropertyNameAttribute[];		//!< Attribute name that stores the name of the property to set.
+	static const char	PropertyValueAttribute[];		//!< Attribute name that stores the value to pass to the property.
+	static const char	LayoutParentAttribute[];		//!< Attribute name that stores the name of the window to attach the layout to.
+	static const char	LayoutImportFilenameAttribute[];//!< Attribute name that stores the file name of the layout to import.
+	static const char	LayoutImportPrefixAttribute[];	//!< Attribute name that stores the prefix to use when loading the imported layout.
+    static const char	LayoutImportResourceGroupAttribute[]; //!< Attribute name that stores the resource group identifier used when loading imported file.
+	static const char	EventNameAttribute[];			//!< Attribute name that stores the event name to be subscribed.
+	static const char	EventFunctionAttribute[];		//!< Attribute name that stores the name of the scripted function to be bound.
+
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	typedef std::vector<Window*>	WindowStack;	
+	Window*	d_root;				//!< Will point to first window created.
+	WindowStack	d_stack;		//!< Stack used to keep track of what we're doing to which window.
+	String		d_layoutParent;	//!< Name of the parent window to attach the loaded layout to.
+	const String&		d_namingPrefix;	//!< Prefix that is to prepend all names of created windows.
+	PropertyCallback*	d_propertyCallback; //!< Callback for every property loaded
+	void*				d_userData;			//!< User data for the property callback
+};
+
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIGUILayout_xmlHandler_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUISingleton.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUISingleton.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUISingleton.h	(revision 1812)
@@ -0,0 +1,75 @@
+/************************************************************************
+	filename: 	CEGUISingleton.h
+	created:	22/2/2004
+	author:		Paul D Turner
+	
+	purpose:	Singleton Base Class
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+/*************************************************************************
+	
+	The code in this file is taken from article 1.3 in the the book:
+	Game Programming Gems from Charles River Media
+
+*************************************************************************/
+#ifndef _CEGUISingleton_h_
+#define _CEGUISingleton_h_
+
+#include "CEGUIBase.h"
+#include <cassert>
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/* 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"
+ */
+
+
+template <typename T> class CEGUIEXPORT Singleton
+{
+protected:
+    static T* ms_Singleton;
+
+public:
+    Singleton( void )
+    {
+        assert( !ms_Singleton );
+        ms_Singleton = static_cast<T*>(this);
+    }
+   ~Singleton( void )
+        {  assert( ms_Singleton );  ms_Singleton = 0;  }
+    static T& getSingleton( void )
+        {  assert( ms_Singleton );  return ( *ms_Singleton );  }
+    static T* getSingletonPtr( void )
+        {  return ( ms_Singleton );  }
+};
+
+} // End of  CEGUI namespace section
+
+
+
+#endif	// end of guard _CEGUISingleton_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIcolour.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIcolour.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIcolour.h	(revision 1812)
@@ -0,0 +1,280 @@
+/************************************************************************
+	filename: 	CEGUIcolour.h
+	created:	20/8/2004
+	author:		Paul D Turner (with code from Jeff Leigh)
+	
+	purpose:	Defines interface to the colour class used to represent
+				colour values within the system
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIcolour_h_
+#define _CEGUIcolour_h_
+
+#include "CEGUIBase.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+typedef uint32 argb_t;    //!< 32 bit ARGB representation of a colour.
+
+/*!
+\brief
+	Class representing colour values within the system.
+*/
+class CEGUIEXPORT colour
+{
+public:
+	/*************************************************************************
+		Construction & Destruction
+	*************************************************************************/
+	colour(void);
+	colour(const colour& val);
+	colour(float red, float green, float blue, float alpha = 1.0f);
+	colour(argb_t argb);
+
+	/*************************************************************************
+		Accessors
+	*************************************************************************/
+	argb_t	getARGB(void) const
+	{
+		if (!d_argbValid)
+		{
+			d_argb = calculateARGB();
+			d_argbValid = true;
+		}
+
+		return d_argb;
+	}
+	
+	float	getAlpha(void) const	{return d_alpha;}
+	float	getRed(void) const		{return d_red;}
+	float	getGreen(void) const	{return d_green;}
+	float	getBlue(void) const		{return d_blue;}
+
+	float	getHue(void) const;
+	float	getSaturation(void) const;
+	float	getLumination(void) const;
+
+
+	/*************************************************************************
+		Manipulators
+	*************************************************************************/
+	void	setARGB(argb_t argb);
+	inline void setAlpha(float alpha)
+    {
+        d_argbValid = false;
+        d_alpha = alpha;
+    }
+
+	inline void setRed(float red)
+    {   
+        d_argbValid = false;
+        d_red = red;
+    }
+
+	inline void setGreen(float green)
+    {
+        d_argbValid = false;
+        d_green = green;
+    }
+
+	inline void setBlue(float blue)
+    {
+        d_argbValid = false;
+        d_blue = blue;
+    }
+
+	inline void set(float red, float green, float blue, float alpha = 1.0f)
+    {
+        d_argbValid = false;
+        d_alpha = alpha;
+        d_red = red;
+        d_green = green;
+        d_blue = blue;
+    }
+
+	inline void setRGB(float red, float green, float blue)
+    {
+        d_argbValid = false;
+        d_red = red;
+        d_green = green;
+        d_blue = blue;
+    }
+
+	inline void setRGB(const colour& val)
+    {
+        d_red = val.d_red;
+        d_green = val.d_green;
+        d_blue = val.d_blue;
+        if (d_argbValid)
+        {
+            d_argbValid = val.d_argbValid;
+            if (d_argbValid)
+                d_argb = (d_argb & 0xFF000000) | (val.d_argb & 0x00FFFFFF);
+        }
+    }
+
+	void	setHSL(float hue, float saturation, float luminance, float alpha = 1.0f);
+
+	void	invertColour(void);
+	void	invertColourWithAlpha(void);
+
+	/*************************************************************************
+		Operators
+	*************************************************************************/
+	inline colour& operator=(argb_t val)
+    {
+        setARGB(val);
+        return *this;
+    }
+
+	inline colour& operator=(const colour& val)
+    {
+        d_alpha = val.d_alpha;
+        d_red   = val.d_red;
+        d_green = val.d_green;
+        d_blue  = val.d_blue;
+        d_argb  = val.d_argb;
+        d_argbValid = val.d_argbValid;
+
+        return *this;
+    }
+
+	inline colour& operator&=(argb_t val)
+    {
+        setARGB(getARGB() & val);
+        return *this;
+    }
+
+	inline colour& operator&=(const colour& val)
+    {
+        setARGB(getARGB() & val.getARGB());
+        return *this;
+    }
+
+	inline colour& operator|=(argb_t val)
+    {
+        setARGB(getARGB() | val);
+        return *this;
+    }
+
+	inline colour& operator|=(const colour& val)
+    {
+        setARGB(getARGB() | val.getARGB());
+        return *this;
+    }
+
+	inline colour& operator<<=(int val)
+    {
+        setARGB(getARGB() << val);
+        return *this;
+    }
+
+	inline colour& operator>>=(int val)
+    {
+        setARGB(getARGB() >> val);
+        return *this;
+    }
+
+	inline colour operator+(const colour& val) const
+    {
+        return colour(
+            d_red   + val.d_red, 
+            d_green + val.d_green, 
+            d_blue  + val.d_blue,
+            d_alpha + val.d_alpha
+        );
+    }
+
+	inline colour operator-(const colour& val) const
+    {
+        return colour(
+            d_red   - val.d_red,
+            d_green - val.d_green,
+            d_blue  - val.d_blue,
+            d_alpha - val.d_alpha
+        );
+    }
+
+	inline colour operator*(const float val) const
+    {       
+        return colour(
+            d_red   * val, 
+            d_green * val, 
+            d_blue  * val,
+            d_alpha * val 
+        );  
+    }
+
+    inline colour& operator*=(const colour& val)
+    {
+        d_red *= val.d_red;
+        d_blue *= val.d_blue;
+        d_green *= val.d_green;
+        d_alpha *= val.d_alpha;
+
+		d_argbValid = false;
+
+        return *this;
+    }
+
+	/*************************************************************************
+		Compare operators
+	*************************************************************************/
+	inline bool operator==(const colour& rhs) const
+    {
+        return d_red   == rhs.d_red   &&
+               d_green == rhs.d_green &&
+               d_blue  == rhs.d_blue  &&
+               d_alpha == rhs.d_alpha;
+    }
+
+	inline bool operator!=(const colour& rhs) const
+    {
+        return !(*this == rhs);
+    }
+
+	//
+	// Conversion operators
+	//
+	operator argb_t() const		{return getARGB();}
+
+private:
+	/*************************************************************************
+		Implementation Methods
+	*************************************************************************/
+	/*!
+	\brief
+		calculate and return the ARGB value based on the current colour component values.
+	*/
+	argb_t	calculateARGB(void) const;
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	float d_alpha, d_red, d_green, d_blue;		//!< Colour components.
+	mutable argb_t d_argb;						//!< Colour as ARGB value.
+	mutable bool d_argbValid;					//!< True if argb value is valid.
+};
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIcolour_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIScheme.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIScheme.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIScheme.h	(revision 1812)
@@ -0,0 +1,197 @@
+/************************************************************************
+	filename: 	CEGUIScheme.h
+	created:	21/2/2004
+	author:		Paul D Turner
+	
+	purpose:	Defines abstract base class for the GUI Scheme object.
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIScheme_h_
+#define _CEGUIScheme_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIString.h"
+#include "CEGUISchemeManager.h"
+
+#include <vector>
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	A class that groups a set of GUI elements and initialises the system to access those elements.
+
+	A GUI Scheme is a high-level construct that loads and initialises various lower-level objects
+	and registers them within the system for usage.  So, for example, a Scheme might create some
+	Imageset objects, some Font objects, and register a collection of WindowFactory objects within
+	the system which would then be in a state to serve those elements to client code.
+*/
+class CEGUIEXPORT Scheme
+{
+	friend class Scheme_xmlHandler;
+public:
+	/*!
+	\brief
+		Loads all resources for this scheme.
+
+	\return
+		Nothing.
+	*/
+	void	loadResources(void);
+
+
+	/*!
+	\brief
+		Unloads all resources for this scheme.  This should be used very carefully.
+
+	\return
+		Nothing.
+	*/
+	void	unloadResources(void);
+
+
+	/*!
+	\brief
+		Return whether the resources for this Scheme are all loaded.
+
+	\return
+		true if all resources for the Scheme are loaded and available, or false of one or more resource is not currently loaded.
+	*/
+	bool	resourcesLoaded(void) const;
+
+
+	/*!
+	\brief
+		Return the name of this Scheme.
+
+	\return
+		String object containing the name of this Scheme.
+	*/
+	const String& getName(void) const		{return d_name;}
+
+private:
+	/*************************************************************************
+		Implementation Constants
+	*************************************************************************/
+	static const char	GUISchemeSchemaName[];			//!< Filename of the XML schema used for validating GUIScheme files.
+
+	/*************************************************************************
+		Friends
+	*************************************************************************/
+	friend	Scheme* SchemeManager::loadScheme(const String& scheme_filename, const String& resourceGroup);
+	friend	void	SchemeManager::unloadScheme(const String& scheme_name);
+
+
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Creates a scheme object from the data specified in the file \a filename
+
+	\param filename
+		String object holding the name of the file to use when creating this Scheme object.
+
+    \param resourceGroup
+        Group identifier to be passed to the resource provider when loading the scheme
+        specification file.
+
+	\return
+		Nothing.
+	*/
+	Scheme(const String& filename, const String& resourceGroup);
+
+
+public:		// for luabind compatibility
+	/*!
+	\brief
+		Destroys a Scheme object
+
+	\return
+		Nothing
+	*/
+	~Scheme(void);
+
+	
+private:
+	/*************************************************************************
+		Structs used to hold scheme information
+	*************************************************************************/
+	struct LoadableUIElement
+	{
+		String	name;
+		String	filename;
+        String  resourceGroup;
+	};
+
+	struct	UIElementFactory
+	{
+		String name;
+	};
+
+	struct	UIModule
+	{
+		String name;
+		FactoryModule*	module;
+		std::vector<UIElementFactory>	factories;
+	};
+
+	struct AliasMapping
+	{
+		String aliasName;
+		String targetName;
+	};
+
+    struct FalagardMapping
+    {
+        String windowName;
+        String targetName;
+        String lookName;
+    };
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	String	d_name;			//!< the name of this scheme.
+
+	std::vector<LoadableUIElement>		d_imagesets;
+	std::vector<LoadableUIElement>		d_imagesetsFromImages;
+	std::vector<LoadableUIElement>		d_fonts;
+	std::vector<UIModule>				d_widgetModules;
+	std::vector<AliasMapping>			d_aliasMappings;
+    std::vector<LoadableUIElement>		d_looknfeels;
+    std::vector<FalagardMapping>        d_falagardMappings;
+};
+
+} // End of  CEGUI namespace section
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIScheme_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIFont.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIFont.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIFont.h	(revision 1812)
@@ -0,0 +1,1091 @@
+/************************************************************************
+	filename: 	CEGUIFont.h
+	created:	21/2/2004
+	author:		Paul D Turner
+	
+	purpose:	Defines interface for the Font class
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIFont_h_
+#define _CEGUIFont_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIString.h"
+#include "CEGUIRect.h"
+#include "CEGUIVector.h"
+#include "CEGUIColourRect.h"
+
+#include <map>
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Enumerated type that contains the valid flags that can be passed to createFont when creating a new font.
+*/
+enum FontFlag
+{
+	Default,			//!< Default / None.
+	NoAntiAlias 		//!< Fonts generated from TrueType files should not be anti-aliased.
+};
+
+
+/*!
+\brief
+	Enumerated type that contains valid formatting types that can be specified when rendering text into a Rect area (the formatting Rect).
+*/
+enum TextFormatting
+{
+	LeftAligned,			//!< All text is printed on a single line.  The left-most character is aligned with the left edge of the formatting Rect.
+	RightAligned,			//!< All text is printed on a single line.  The right-most character is aligned with the right edge of the formatting Rect.
+	Centred,				//!< All text is printed on a single line.  The text is centred horizontally in the formatting Rect.
+	Justified,				//!< All text is printed on a single line.  The left-most and right-most characters are aligned with the edges of the formatting Rect.
+	WordWrapLeftAligned,	//!< Text is broken into multiple lines no wider than the formatting Rect.  The left-most character of each line is aligned with the left edge of the formatting Rect.
+	WordWrapRightAligned,	//!< Text is broken into multiple lines no wider than the formatting Rect.  The right-most character of each line is aligned with the right edge of the formatting Rect.
+	WordWrapCentred, 		//!< Text is broken into multiple lines no wider than the formatting Rect.  Each line is centred horizontally in the formatting Rect.
+	WordWrapJustified 		//!< Text is broken into multiple lines no wider than the formatting Rect.  The left-most and right-most characters of each line are aligned with the edges of the formatting Rect.
+};
+
+/*!
+\brief
+	Class that encapsulates text rendering functionality for a typeface
+
+	A Font object is created for each unique typeface required.  The Font class provides
+	methods for loading typefaces from various sources, and then for outputting text via
+	the Renderer object.
+*/
+class CEGUIEXPORT Font
+{
+	friend class Font_xmlHandler;
+public:
+	/*************************************************************************
+		Constants
+	*************************************************************************/
+	static const argb_t		DefaultColour;			//!< Colour value used whenever a colour is not specified.
+
+
+	/*************************************************************************
+		Text drawing methods
+	*************************************************************************/
+	/*!
+	\brief
+		Draw text into a specified area of the display.
+
+	\param text
+		String object containing the text to be drawn.
+
+	\param draw_area
+		Rect object describing the area of the display where the text is to be rendered.  The text is not clipped to this Rect, but is formatted
+		using this Rect depending upon the option specified in \a fmt.
+
+	\param z
+		flat value specifying the z co-ordinate for the drawn text.
+
+	\param clip_rect
+		Rect object describing the clipping area for the drawing.  No drawing will occur outside this Rect.
+
+	\param fmt
+		One of the TextFormatting values specifying the text formatting required.
+
+	\param colours
+		ColourRect object describing the colours to be applied when drawing the text.  NB: The colours specified in here are applied to each glyph,
+		rather than the text as a whole.
+
+	\param x_scale
+		Scaling factor to be applied to each glyph's x axis, where 1.0f is considered to be 'normal'.
+
+	\param y_scale
+		Scaling factor to be applied to each glyph's y axis, where 1.0f is considered to be 'normal'.
+
+	\return
+		The number of lines output.  NB: This does not consider clipping, so if all text was clipped, this would still return >=1.
+	*/
+	size_t	drawText(const String& text, const Rect& draw_area, float z, const Rect& clip_rect, TextFormatting fmt, const ColourRect& colours, float x_scale = 1.0f, float y_scale = 1.0f) const;
+
+
+	/*!
+	\brief
+		Draw text into a specified area of the display using default colours.
+
+	\param text
+		String object containing the text to be drawn.
+
+	\param draw_area
+		Rect object describing the area of the display where the text is to be rendered.  The text is not clipped to this Rect, but is formatted
+		using this Rect depending upon the option specified in \a fmt.
+
+	\param z
+		flat value specifying the z co-ordinate for the drawn text.
+
+	\param clip_rect
+		Rect object describing the clipping area for the drawing.  No drawing will occur outside this Rect.
+
+	\param fmt
+		One of the TextFormatting values specifying the text formatting required.
+
+	\param x_scale
+		Scaling factor to be applied to each glyph's x axis, where 1.0f is considered to be 'normal'.
+
+	\param y_scale
+		Scaling factor to be applied to each glyph's y axis, where 1.0f is considered to be 'normal'.
+
+	\return
+		The number of lines output.  NB: This does not consider clipping, so if all text was clipped, this would still return >=1.
+	*/
+	size_t	drawText(const String& text, const Rect& draw_area, float z, const Rect& clip_rect, TextFormatting fmt, float x_scale = 1.0f, float y_scale = 1.0f) const
+	{ return drawText(text, draw_area, z, clip_rect, fmt, ColourRect(DefaultColour, DefaultColour, DefaultColour, DefaultColour), x_scale, y_scale); }
+
+
+	/*!
+	\brief
+		Draw text into a specified area of the display with default colours and default formatting (LeftAligned).
+
+	\param text
+		String object containing the text to be drawn.
+
+	\param draw_area
+		Rect object describing the area of the display where the text is to be rendered.  The text is not clipped to this Rect, but is formatted
+		using this Rect depending upon the option specified in \a fmt.
+
+	\param z
+		flat value specifying the z co-ordinate for the drawn text.
+
+	\param clip_rect
+		Rect object describing the clipping area for the drawing.  No drawing will occur outside this Rect.
+
+	\param x_scale
+		Scaling factor to be applied to each glyph's x axis, where 1.0f is considered to be 'normal'.
+
+	\param y_scale
+		Scaling factor to be applied to each glyph's y axis, where 1.0f is considered to be 'normal'.
+
+	\return
+		Nothing.
+	*/
+	void	drawText(const String& text, const Rect& draw_area, float z, const Rect& clip_rect, float x_scale = 1.0f, float y_scale = 1.0f) const
+	{ drawText(text, draw_area, z, clip_rect, LeftAligned, ColourRect(DefaultColour, DefaultColour, DefaultColour, DefaultColour), x_scale, y_scale); }
+
+
+	/*!
+	\brief
+		Draw text into a specified area of the display.
+
+	\param text
+		String object containing the text to be drawn.
+
+	\param draw_area
+		Rect object describing the area of the display where the text is to be rendered.  The text is formatted using this Rect depending
+		upon the option specified in \a fmt.  Additionally, the drawn text is clipped to be within this Rect (applies to non-word wrapped formatting
+		where the text may otherwise have fallen outside this Rect).
+
+	\param z
+		flat value specifying the z co-ordinate for the drawn text.
+
+	\param fmt
+		One of the TextFormatting values specifying the text formatting required.
+
+	\param colours
+		ColourRect object describing the colours to be applied when drawing the text.  NB: The colours specified in here are applied to each glyph,
+		rather than the text as a whole.
+
+	\param x_scale
+		Scaling factor to be applied to each glyph's x axis, where 1.0f is considered to be 'normal'.
+
+	\param y_scale
+		Scaling factor to be applied to each glyph's y axis, where 1.0f is considered to be 'normal'.
+
+	\return
+		The number of lines output.  NB: This does not consider clipping, so if all text was clipped, this would still return >=1.
+	*/
+	size_t	drawText(const String& text, const Rect& draw_area, float z, TextFormatting fmt, const ColourRect& colours, float x_scale = 1.0f, float y_scale = 1.0f) const
+	{ return drawText(text, draw_area, z, draw_area, fmt, colours, x_scale, y_scale); }
+
+
+	/*!
+	\brief
+		Draw text into a specified area of the display with default colours.
+
+	\param text
+		String object containing the text to be drawn.
+
+	\param draw_area
+		Rect object describing the area of the display where the text is to be rendered.  The text is formatted using this Rect depending
+		upon the option specified in \a fmt.  Additionally, the drawn text is clipped to be within this Rect (applies to non-word wrapped formatting
+		where the text may otherwise have fallen outside this Rect).
+
+	\param z
+		flat value specifying the z co-ordinate for the drawn text.
+
+	\param fmt
+		One of the TextFormatting values specifying the text formatting required.
+
+	\param x_scale
+		Scaling factor to be applied to each glyph's x axis, where 1.0f is considered to be 'normal'.
+
+	\param y_scale
+		Scaling factor to be applied to each glyph's y axis, where 1.0f is considered to be 'normal'.
+
+	\return
+		The number of lines output.  NB: This does not consider clipping, so if all text was clipped, this would still return >=1.
+	*/
+	size_t	drawText(const String& text, const Rect& draw_area, float z, TextFormatting fmt, float x_scale = 1.0f, float y_scale = 1.0f) const
+	{ return drawText(text, draw_area, z, draw_area, fmt, ColourRect(DefaultColour, DefaultColour, DefaultColour, DefaultColour), x_scale, y_scale); }
+
+
+	/*!
+	\brief
+		Draw text into a specified area of the display with default colours and default formatting (LeftAligned).
+
+	\param text
+		String object containing the text to be drawn.
+
+	\param draw_area
+		Rect object describing the area of the display where the text is to be rendered.  The text is formatted using this Rect depending
+		upon the option specified in \a fmt.  Additionally, the drawn text is clipped to be within this Rect (applies to non-word wrapped formatting
+		where the text may otherwise have fallen outside this Rect).
+
+	\param z
+		flat value specifying the z co-ordinate for the drawn text.
+
+	\param x_scale
+		Scaling factor to be applied to each glyph's x axis, where 1.0f is considered to be 'normal'.
+
+	\param y_scale
+		Scaling factor to be applied to each glyph's y axis, where 1.0f is considered to be 'normal'.
+
+	\return
+		Nothing.
+	*/
+	void	drawText(const String& text, const Rect& draw_area, float z, float x_scale = 1.0f, float y_scale = 1.0f) const
+	{ drawText(text, draw_area, z, draw_area, LeftAligned, ColourRect(DefaultColour, DefaultColour, DefaultColour, DefaultColour), x_scale, y_scale); }
+
+
+	/*!
+	\brief
+		Draw text at the specified location.
+
+	\param text
+		String object containing the text to be drawn.
+
+	\param position
+		Vector3 object describing the location for the text.  NB: The position specified here corresponds to the text baseline and not the
+		top of any glyph.  The baseline spacing required can be retrieved by calling getBaseline().
+		
+	\param clip_rect
+		Rect object describing the clipping area for the drawing.  No drawing will occur outside this Rect.
+
+	\param colours
+		ColourRect object describing the colours to be applied when drawing the text.  NB: The colours specified in here are applied to each glyph,
+		rather than the text as a whole.
+
+	\param x_scale
+		Scaling factor to be applied to each glyph's x axis, where 1.0f is considered to be 'normal'.
+
+	\param y_scale
+		Scaling factor to be applied to each glyph's y axis, where 1.0f is considered to be 'normal'.
+
+	\return
+		Nothing.
+	*/
+	void	drawText(const String& text, const Vector3& position, const Rect& clip_rect, const ColourRect& colours, float x_scale = 1.0f, float y_scale = 1.0f) const
+	{ drawText(text, Rect(position.d_x, position.d_y, position.d_x, position.d_y), position.d_z, clip_rect, LeftAligned, colours, x_scale, y_scale); }
+
+
+	/*!
+	\brief
+		Draw text at the specified location with default colours.
+
+	\param text
+		String object containing the text to be drawn.
+
+	\param position
+		Vector3 object describing the location for the text.  NB: The position specified here corresponds to the text baseline and not the
+		top of any glyph.  The baseline spacing required can be retrieved by calling getBaseline().
+		
+	\param clip_rect
+		Rect object describing the clipping area for the drawing.  No drawing will occur outside this Rect.
+
+	\param x_scale
+		Scaling factor to be applied to each glyph's x axis, where 1.0f is considered to be 'normal'.
+
+	\param y_scale
+		Scaling factor to be applied to each glyph's y axis, where 1.0f is considered to be 'normal'.
+
+	\return
+		Nothing.
+	*/
+	void	drawText(const String& text, const Vector3& position, const Rect& clip_rect, float x_scale = 1.0f, float y_scale = 1.0f) const
+	{ drawText(text, Rect(position.d_x, position.d_y, position.d_x, position.d_y), position.d_z, clip_rect, LeftAligned, ColourRect(DefaultColour, DefaultColour, DefaultColour, DefaultColour), x_scale, y_scale); }
+
+
+	/*************************************************************************
+		Methods to define available glyphs (truetype fonts only)
+	*************************************************************************/
+	/*!
+	\brief
+		Define the set of code points to be renderable by the font.
+
+	\note
+		This function can take some time to execute depending upon the size of the code point set, and the size of the
+		font being operated upon.
+
+	\param glyph_set
+		String object describing all the code points that will be renderable by this font
+
+	\return
+		Nothing
+
+	\exception	InvalidRequestException		thrown if the font is based on a bitmap rather than a true-type font.
+	\exception	RendererException			thrown if the Renderer can't support a texture large enough to hold the glyph imagery.
+	\exception	MemoryException				thrown if allocation of imagery construction buffer fails.
+	*/
+	void	defineFontGlyphs(const String& glyph_set);
+
+
+	/*!
+	\brief
+		Define the range of code points to be renderable by the font.
+
+	\note
+		This function can take some time to execute depending upon the size of the code point set, and the size of the
+		font being operated upon.
+
+	\note
+		The code point arguments must satisfy the following:  \a first_code_point <= \a last_code_point, otherwise results are undefined
+
+	\param first_code_point
+		utf32 value describing the first code point that will be renderable by this font.
+
+	\param last_code_point
+		utf32 value describing the last code point that will be renderable by this font.
+
+	\return
+		Nothing
+
+	\exception	InvalidRequestException		thrown if the font is based on a bitmap rather than a true-type font.
+	\exception	RendererException			thrown if the Renderer can't support a texture large enough to hold the glyph imagery.
+	\exception	MemoryException				thrown if allocation of imagery construction buffer fails.
+	*/
+	void	defineFontGlyphs(utf32 first_code_point, utf32 last_code_point);
+
+
+	/*!
+	\brief
+		Set the native resolution for this Font
+
+	\param size
+		Size object describing the new native screen resolution for this Font.
+
+	\return
+		Nothing
+	*/
+	void	setNativeResolution(const Size& size);
+
+
+	/*!
+	\brief
+		Notify the Font of the current (usually new) display resolution.
+
+	\param size
+		Size object describing the display resolution
+
+	\return
+		Nothing
+	*/
+	void	notifyScreenResolution(const Size& size);
+
+
+	/*!
+	\brief
+		Enable or disable auto-scaling for this Font.
+
+	\param setting
+		true to enable auto-scaling, false to disable auto-scaling.
+
+	\return
+		Nothing.
+	*/
+	void	setAutoScalingEnabled(bool setting);
+
+
+	/*!
+	\brief
+		Set whether the font is anti-aliased or not.  Only relevant for dynamic fonts, this setting is
+		ignored for bitmapped fonts.
+
+	\param setting
+		- true if the font should be anti-aliased.
+		- false if the font should not be anti-aliased.
+
+	\return
+		Nothing.
+	*/
+	void	setAntiAliased(bool setting);
+
+
+	/*************************************************************************
+		Informational methods
+	*************************************************************************/
+	/*!
+	\brief
+		Return the pixel width of the specified text if rendered with this Font.
+
+	\param text
+		String object containing the text to return the rendered pixel width for.
+
+	\param x_scale
+		Scaling factor to be applied to each glyph's x axis when measuring the extent, where 1.0f is considered to be 'normal'.
+
+	\return
+		Number of pixels that \a text will occupy when rendered with this Font.
+	*/
+	float	getTextExtent(const String& text, float x_scale = 1.0f) const;
+
+
+	/*!
+	\brief
+		Return the pixel line spacing value for.
+
+	\param y_scale
+		Scaling factor to be applied to the line spacing, where 1.0f is considered to be 'normal'.
+
+	\return
+		Number of pixels between vertical base lines, i.e. The minimum pixel space between two lines of text.
+	*/
+	float	getLineSpacing(float y_scale = 1.0f) const		{return d_lineSpacing * y_scale;}
+
+
+	/*!
+	\brief
+		return the exact pixel height of the font.
+
+	\param y_scale
+		Scaling factor to be applied to the height, where 1.0f is considered to be 'normal'.
+
+	\return
+		float value describing the pixel height of the font without any additional padding.
+	*/
+	float	getFontHeight(float y_scale = 1.0f) const	{return d_lineHeight * y_scale;}
+
+
+	/*!
+	\brief
+		Return the number of pixels from the top of the highest glyph to the baseline
+
+	\param y_scale
+		Scaling factor to be applied to the baseline distance, where 1.0f is considered to be 'normal'.
+
+	\return
+		pixel spacing from top of front glyphs to baseline
+	*/
+	float	getBaseline(float y_scale = 1.0f) const			{return d_max_bearingY * y_scale;}
+
+
+	/*!
+	\brief
+		Return the index of the closest text character in String \a text that corresponds to pixel location \a pixel if the text were rendered.
+
+	\param text
+		String object containing the text.
+
+	\param pixel
+		Specifies the (horizontal) pixel offset to return the character index for.
+
+	\param x_scale
+		Scaling factor to be applied to each glyph's x axis when measuring the text extent, where 1.0f is considered to be 'normal'.
+
+	\return
+		Returns a character index into String \a text for the character that would be rendered closest to horizontal pixel offset \a pixel if the
+		text were to be rendered via this Font.  Range of the return is from 0 to text.length(), so may actually return an index past the end of
+		the string, which indicates \a pixel was beyond the last character.
+	*/
+	size_t	getCharAtPixel(const String& text, float pixel, float x_scale = 1.0f) const		{return getCharAtPixel(text, 0, pixel, x_scale);}
+
+
+	/*!
+	\brief
+		Return the index of the closest text character in String \a text, starting at character index \a start_char, that corresponds
+		to pixel location \a pixel if the text were to be rendered.
+
+	\param text
+		String object containing the text.
+
+	\param start_char
+		index of the first character to consider.  This is the lowest value that will be returned from the call.
+
+	\param pixel
+		Specifies the (horizontal) pixel offset to return the character index for.
+
+	\param x_scale
+		Scaling factor to be applied to each glyph's x axis when measuring the text extent, where 1.0f is considered to be 'normal'.
+
+	\return
+		Returns a character index into String \a text for the character that would be rendered closest to horizontal pixel offset \a pixel if the
+		text were to be rendered via this Font.  Range of the return is from 0 to text.length(), so may actually return an index past the end of
+		the string, which indicates \a pixel was beyond the last character.
+	*/
+	size_t	getCharAtPixel(const String& text, size_t start_char, float pixel, float x_scale = 1.0f) const;
+
+
+	/*!
+	\brief
+		Return the name of this font.
+
+	\return
+		String object holding the name of this font.
+	*/
+	const String&	getName(void) const		{return	d_name;}
+
+
+	/*!
+	\brief
+		Return the native display size for this Font.  This is only relevant if the Font is being auto-scaled.
+
+	\return
+		Size object describing the native display size for this Font.
+	*/
+	Size	getNativeResolution(void) const	{return Size(d_nativeHorzRes, d_nativeVertRes);}
+
+
+	/*!
+	\brief
+		Return whether this Font is auto-scaled.
+
+	\return
+		true if the Font is auto-scaled, false if not.
+	*/
+	bool	isAutoScaled(void) const		{return d_autoScale;}
+
+
+	/*!
+	\brief
+		Return whether this Font can currently draw the specified code-point
+
+	\param cp
+		utf32 code point that is the subject of the query.
+
+	\return
+		true if the font contains a mapping for code point \a cp, false if it does not contain a mapping for \a cp.
+	*/
+	bool	isCodepointAvailable(utf32 cp) const		{return (d_cp_map.find(cp) != d_cp_map.end());}
+
+
+	/*!
+	\brief
+		Return the number of lines the given text would be formatted to.
+
+		Since text formatting can result in multiple lines of text being output, it can be useful to know
+		how many lines would be output without actually rendering the text.
+
+	\param text
+		String object containing the text to be measured.
+
+	\param format_area
+		Rect object describing the area to be used when formatting the text depending upon the option specified in \a fmt.
+
+	\param fmt
+		One of the TextFormatting values specifying the text formatting required.
+
+	\param x_scale
+		Scaling factor to be applied to each glyph's x axis, where 1.0f is considered to be 'normal'.
+
+	\return
+		The number of lines produced from the specified formatting
+	*/
+	size_t	getFormattedLineCount(const String& text, const Rect& format_area, TextFormatting fmt, float x_scale = 1.0f) const;
+
+
+	/*!
+	\brief
+		Return the horizontal pixel extent given text would be formatted to.
+
+		The value return by this method is basically the extent of the widest line within the formatted text.
+
+	\param text
+		String object containing the text to be measured.
+
+	\param format_area
+		Rect object describing the area to be used when formatting the text depending upon the option specified in \a fmt.
+
+	\param fmt
+		One of the TextFormatting values specifying the text formatting required.
+
+	\param x_scale
+		Scaling factor to be applied to each glyph's x axis, where 1.0f is considered to be 'normal'.
+
+	\return
+		The widest pixel extent of the lines produced from the specified formatting.
+	*/
+	float	getFormattedTextExtent(const String& text, const Rect& format_area, TextFormatting fmt, float x_scale = 1.0f) const;
+
+
+	/*!
+	\brief
+		Return whether this font is anti-aliased or not.  This is only relevant for dynamic fonts created from a TrueType font file.
+
+	\return
+		- true if the font is anti-aliased.
+		- false if the font is not anti-aliased.
+	*/
+	bool	isAntiAliased(void) const;
+
+
+	/*!
+	\brief
+		Return a String object that contains the code-points that the font is currently configured to render.
+
+	\return
+		Reference to a String object.
+	*/
+	const String& getAvailableGlyphs(void) const;
+
+
+	/*!
+	\brief
+		Return the point size of a dynamic (ttf based) font.
+
+	\return
+		uint value indicating the point size specified when the dynamic font was created.
+
+	\exception InvalidRequestException		thrown if the font is a static (bitmap based) font which do not support point sizes.
+	*/
+	uint	getPointSize(void) const;
+
+
+private:
+	/*************************************************************************
+		Implementation Constants
+	*************************************************************************/
+	static const char	FontSchemaName[];			//!< Filename of the XML schema used for validating Font files.
+	static const uint	InterGlyphPadSpace;			//!< Pad space between glyphs.
+
+
+	/*************************************************************************
+		Friends so that only FontManager can create and destroy font objects
+	*************************************************************************/
+	friend class FontManager;
+
+	/*************************************************************************
+		Private forward refs
+	*************************************************************************/
+	struct FontImplData;
+
+
+	/*************************************************************************
+		Construction & Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructs a new Font object
+
+	\param filename
+		The filename of the "font definition file" to be used in creating this font.
+
+    \param resourceGroup
+        Resource group identifier to be passed to the resource provider to load the font
+        definition file.
+
+	\exception	FileIOException				thrown if there was some problem accessing or parsing the file \a filename
+	\exception	InvalidRequestException		thrown if an invalid filename was provided.
+	\exception	AlreadyExistsException		thrown if a Font Imageset clashes with one already defined in the system.
+	\exception	GenericException			thrown if something goes wrong while accessing a true-type font referenced in file \a filename.
+	\exception	RendererException			thrown if the Renderer can't support a texture large enough to hold the requested glyph imagery.
+	\exception	MemoryException				thrown if allocation of imagery construction buffer fails.
+	*/
+	Font(const String& filename, const String& resourceGroup, FontImplData* dat);
+
+
+	/*!
+	\brief
+		Constructs a new Font object, with 7-bit ASCII glyphs
+
+	\param name
+		The unique name that will be used to identify this Font.
+
+	\param fontname
+		filename of the true-type font to be loaded.
+
+    \param resourceGroup
+        Resource group identifier to pass to the resource provider when loading the true-type
+        font file.
+
+	\param size
+		Point size of the new font.
+
+	\param flags
+		Combination of the FontFlag enumerated values specifying required options for creating this Font.
+
+	\exception	AlreadyExistsException		thrown if an auto-generated Imageset clashes with one already defined in the system.
+	\exception	GenericException			thrown if something goes wrong while accessing the true-type font \a fontname.
+	\exception	RendererException			thrown if the Renderer can't support a texture large enough to hold the requested glyph imagery.
+	\exception	MemoryException				thrown if allocation of imagery construction buffer fails.
+	*/
+	Font(const String& name, const String& fontname, const String& resourceGroup, uint size, uint flags, FontImplData* dat);
+
+
+	/*!
+	\brief
+		Constructs a new Font object, with the specified set of glyphs
+
+	\param name
+		The unique name that will be used to identify this Font.
+
+	\param fontname
+		filename of the true-type font to be loaded.
+
+    \param resourceGroup
+        Resource group identifier to pass to the resource provider when loading the true-type
+        font file.
+
+	\param size
+		Point size of the new font.
+
+	\param flags
+		Combination of the FontFlag enumerated values specifying required options for creating this Font.
+
+	\param glyph_set
+		String containing the set of glyphs to have available in this font.
+
+	\exception	AlreadyExistsException		thrown if an auto-generated Imageset clashes with one already defined in the system.
+	\exception	GenericException			thrown if something goes wrong while accessing the true-type font \a fontname.
+	\exception	RendererException			thrown if the Renderer can't support a texture large enough to hold the requested glyph imagery.
+	\exception	MemoryException				thrown if allocation of imagery construction buffer fails.
+	*/
+	Font(const String& name, const String& fontname, const String& resourceGroup, uint size, uint flags, const String& glyph_set, FontImplData* dat);
+
+
+	/*!
+	\brief
+		Constructs a new Font object, with a specified range of glyphs
+
+	\param name
+		The unique name that will be used to identify this Font.
+
+	\param fontname
+		filename of the true-type font to be loaded.
+
+    \param resourceGroup
+        Resource group identifier to pass to the resource provider when loading the true-type
+        font file.
+
+	\param size
+		Point size of the new font.
+
+	\param flags
+		Combination of the FontFlag enumerated values specifying required options for creating this Font.
+
+	\param first_code_point
+		Specifies the utf32 code point of the first glyph to be available on this font
+
+	\param last_code_point
+		Specifies the utf32 code point of the last glyph to be available on this font
+
+	\exception	AlreadyExistsException		thrown if an auto-generated Imageset clashes with one already defined in the system.
+	\exception	GenericException			thrown if something goes wrong while accessing the true-type font \a fontname.
+	\exception	RendererException			thrown if the Renderer can't support a texture large enough to hold the requested glyph imagery.
+	\exception	MemoryException				thrown if allocation of imagery construction buffer fails.
+	*/
+	Font(const String& name, const String& fontname, const String& resourceGroup, uint size, uint flags, utf32 first_code_point, utf32 last_code_point, FontImplData* dat);
+
+
+public:		// For luabind support
+	/*!
+	\brief
+		Destroys a Font object
+	*/
+	~Font(void);
+
+
+private:
+	/*************************************************************************
+		Implementation Methods
+	*************************************************************************/
+	/*!
+	\brief
+		Load and complete construction of 'this' via an XML file
+
+	\param filename
+		String object holding the name of the XML file that holds details about the font to create.
+
+    \param resourceGroup
+        Resource group identifier to be passed to the resource provider when loading the font
+        definition file.
+
+	\return
+		Nothing.
+	*/
+	void	load(const String& filename, const String& resourceGroup);
+
+
+	/*!
+	\brief
+		Unloads data associated with the font (font is then useless.  this is intended for cleanup).
+
+	\return
+		Nothing.
+	*/
+	void	unload(void);
+
+
+	/*!
+	\brief
+		Return the required texture size required to store imagery for the
+		glyphs specified in \a glyph_set
+
+	\param glyph_set
+		String object describing the set of code points who's glyph imagery is to be measured.
+
+	\return
+		Required pixel size for a square texture large enough to hold glyph imagery for the set of code points in \a glyph_set
+	*/
+	uint	getRequiredTextureSize(const String& glyph_set);
+
+
+	/*!
+	\brief
+		Return the required texture size required to store imagery for the
+		glyphs specified in by the inclusive range [first_code_point, last_code_point]
+
+	\param first_code_point
+		utf32 code point of the first character in the range to be measured
+
+	\param last_code_point
+		utf32 code point of the last character in the range to be measured
+
+	\return
+		Required pixel size for a square texture large enough to hold glyph imagery for the specified range of code points.
+	*/
+	uint	getRequiredTextureSize(utf32 first_code_point, utf32 last_code_point);
+
+
+	/*!
+	\brief
+		Paint the set of glyphs required for all code points in \a glyph_set into the buffer \a buffer,
+		which has a size of \a size pixels (not bytes) square.  This also defines an Image for each
+		glyph in the Imageset for this font, and creates an entry in the code point to Image map.
+
+	\param glyph_set
+		String object containing the set of code points whos glyphs are to be loaded into the buffer.
+
+	\param size
+		Width of \a buffer in pixels (not bytes).
+
+	\param buffer
+		Pointer to a memory buffer large enough to receive the glyph image data.
+
+	\return
+		Nothing.
+	*/
+	void	createFontGlyphSet(const String& glyph_set, uint size, argb_t* buffer);
+
+
+	/*!
+	\brief
+		Paint the set of glyphs required for all code points in the range [\a first_code_point, \a last_code_point]
+		into the buffer \a buffer, which has a size of \a size pixels (not bytes) square.  This also defines an
+		Image for each glyph in the Imageset for this font, and creates an entry in the code point to Image map.
+
+	\param first_code_point
+		utf32 code point that is the first code point in a range whos glyph are to be loaded into the buffer.
+
+	\param last_code_point
+		utf32 code point that is the last code point in a range whos glyph are to be loaded into the buffer.
+
+	\param size
+		Width of \a buffer in pixels (not bytes).
+
+	\param buffer
+		Pointer to a memory buffer large enough to receive the glyph image data.
+
+	\return
+		Nothing.
+	*/
+	void	createFontGlyphSet(utf32 first_code_point, utf32 last_code_point, uint size, argb_t* buffer);
+
+
+	/*!
+	\brief
+		Copy the current glyph data into \a buffer, which has a width of \a buf_width pixels (not bytes).
+
+	\param buffer
+		Memory buffer large enough to receive the imagery for the currently loaded glyph.
+
+	\param buf_width
+		Width of \a buffer in pixels (where each pixel is a argb_t).
+
+	\return
+		Nothing.
+	*/
+	void	drawGlyphToBuffer(argb_t* buffer, uint buf_width);
+
+
+	/*!
+	\brief
+		draws wrapped text.  returns number of lines output.
+	*/
+	size_t	drawWrappedText(const String& text, const Rect& draw_area, float z, const Rect& clip_rect, TextFormatting fmt, const ColourRect& colours, float x_scale = 1.0f, float y_scale = 1.0f) const;
+
+
+	/*!
+	\brief
+		helper function for renderWrappedText to get next word of a string
+	*/
+	size_t	getNextWord(const String& in_string, size_t start_idx, String& out_string) const;
+
+
+	/*!
+	\brief
+		Draw a line of text.  No formatting is applied.
+	*/
+	void	drawTextLine(const String& text, const Vector3& position, const Rect& clip_rect, const ColourRect& colours, float x_scale = 1.0f, float y_scale = 1.0f) const;
+
+
+	/*!
+	\brief
+		Draw a justified line of text.
+	*/
+	void	drawTextLineJustified(const String& text, const Rect& draw_area, const Vector3& position, const Rect& clip_rect, const ColourRect& colours, float x_scale = 1.0f, float y_scale = 1.0f) const;
+
+
+	/*!
+	\brief
+		Set the size of the free-type font (via d_face which should already be setup) and render the glyphs in d_glyphset.
+	*/
+	void	createFontFromFT_Face(uint size, uint horzDpi, uint vertDpi);
+
+
+	/*!
+	\brief
+		Update the font as required according to the current scaling
+	*/
+	void	updateFontScaling(void);
+
+
+	/*!
+	\brief
+		Calculate the vertical spacing fields for a static / bitmap font
+	*/
+	void	calculateStaticVertSpacing(void);
+
+	/*!
+	\brief
+		Function to do real work of constructor.  Used to save duplication in the various constructor overloads.
+	*/
+	void	constructor_impl(const String& name, const String& fontname, const String& resourceGroup, uint size, uint flags, const String& glyph_set);
+
+
+	/*!
+	\brief
+		Defines the set of code points on the font. (implementation).
+
+	\note
+		This function can take some time to execute depending upon the size of the code point set, and the size of the
+		font being operated upon.
+
+	\return
+		Nothing
+
+	\exception	InvalidRequestException		thrown if the font is based on a bitmap rather than a true-type font.
+	\exception	RendererException			thrown if the Renderer can't support a texture large enough to hold the glyph imagery.
+	\exception	MemoryException				thrown if allocation of imagery construction buffer fails.
+	*/
+	void	defineFontGlyphs_impl(void);
+
+
+	/*!
+	\brief
+		returns extent of widest line of wrapped text.
+	*/
+	float	getWrappedTextExtent(const String& text, float wrapWidth, float x_scale = 1.0f) const;
+
+
+    /*!
+    \brief
+        Writes an xml representation of this Font to \a out_stream.
+
+    \param out_stream
+        Stream where xml data should be output.
+
+    \return
+        Nothing.
+    */
+    void writeXMLToStream(OutStream& out_stream) const;
+
+
+	/*************************************************************************
+		Implementation structs
+	*************************************************************************/
+	/*!
+	\brief
+		struct to hold extra details about a glyph (required for proper rendering)
+	*/
+	struct glyphDat
+	{
+		const Image*	d_image;				//!< The image which will be rendered.
+		int			d_horz_advance;			//!< Amount to advance the pen after rendering this glyph
+		int			d_horz_advance_unscaled;	//!< original unscaled advance value (only used with static / bitmap fonts).
+	};
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	typedef		std::map<utf32, glyphDat>		CodepointMap;
+	CodepointMap	d_cp_map;	//!< Contains mappings from code points to Image objects
+
+	String		d_name;			//!< Name of this font.
+	Imageset*	d_glyph_images;	//!< Imageset that holds the glyphs for this font.
+	String     d_sourceFilename;   //!< Holds the name of the file used to create this font (either font file or imagset)
+
+	bool	d_freetype;			//!< true when the font is a FreeType based font
+	float	d_lineHeight;		//!< Exact pixel height of font.
+	float	d_lineSpacing;		//!< Spacing between multiple lines.
+	float	d_max_bearingY;		//!< Maximum bearingY value (gives required spacing down to baseline).
+	uint	d_maxGlyphHeight;	//!< Height of the largest glyph (calculated in getRequiredTextureSize)
+
+	FontImplData*	d_impldat;	//!< Implementation data
+	uint		d_ptSize;		//!< Point size of font.
+	String		d_glyphset;		//!< set of glyphs for the dynamic font.
+
+	// auto-scaling fields
+	bool	d_autoScale;			//!< true when auto-scaling is enabled.
+	float	d_horzScaling;			//!< current horizontal scaling factor.
+	float	d_vertScaling;			//!< current vertical scaling factor.
+	float	d_nativeHorzRes;		//!< native horizontal resolution for this Imageset.
+	float	d_nativeVertRes;		//!< native vertical resolution for this Imageset.
+
+	bool	d_antiAliased;			//!< True if the font should be rendered as anti-alaised by freeType.
+};
+
+} // End of  CEGUI namespace section
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+
+#endif	// end of guard _CEGUIFont_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIString.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIString.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIString.h	(revision 1812)
@@ -0,0 +1,5575 @@
+/************************************************************************
+	filename: 	CEGUIString.h
+	created:	26/2/2004
+	author:		Paul D Turner
+	
+	purpose:	Defines string class used within the GUI system.
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIString_h_
+#define _CEGUIString_h_
+
+#include "CEGUIBase.h"
+#include <string>
+#include <string.h>
+#include <stdexcept>
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+#define STR_QUICKBUFF_SIZE	32
+	/*************************************************************************
+		Basic Types
+	*************************************************************************/
+	typedef		uint8	utf8;
+	//typedef		uint16	utf16;  // removed typedef to prevent usage, as utf16 is not supported (yet)
+	typedef		uint32	utf32;
+
+/*!
+\brief
+	String class used within the GUI system.
+
+	For the most part, this class can replace std::string in basic usage.  However, currently String does not use the
+	current locale, and also comparisons do not take into account the Unicode data tables, so are not 'correct'
+	as such.
+*/
+class CEGUIEXPORT String
+{
+public:
+	/*************************************************************************
+		Integral Types
+	*************************************************************************/
+	typedef		utf32			value_type;					//!< Basic 'code point' type used for String (utf32)
+	typedef		size_t			size_type;					//!< Unsigned type used for size values and indices
+	typedef		ptrdiff_t		difference_type;			//!< Signed type used for differences
+	typedef		utf32&			reference;					//!< Type used for utf32 code point references
+	typedef		const utf32&	const_reference;			//!< Type used for constant utf32 code point references
+	typedef		utf32*			pointer;					//!< Type used for utf32 code point pointers
+	typedef		const utf32*	const_pointer;				//!< Type used for constant utf32 code point pointers
+
+	static const size_type		npos;						//!< Value used to represent 'not found' conditions and 'all code points' etc.
+
+private:
+	/*************************************************************************
+		Implementation data
+	*************************************************************************/
+	size_type	d_cplength;			//!< holds length of string in code points (not including null termination)
+	size_type	d_reserve;			//!< code point reserve size (currently allocated buffer size in code points).
+
+	mutable utf8*		d_encodedbuff;		//!< holds string data encoded as utf8 (generated only by calls to c_str() and data())
+	mutable size_type	d_encodeddatlen;	//!< holds length of encoded data (in case it's smaller than buffer).
+	mutable size_type	d_encodedbufflen;	//!< length of above buffer (since buffer can be bigger then the data it holds to save re-allocations).
+
+	utf32		d_quickbuff[STR_QUICKBUFF_SIZE];	//!< This is a integrated 'quick' buffer to save allocations for smallish strings
+	utf32*		d_buffer;							//!< Pointer the the main buffer memory.  This is only valid when quick-buffer is not being used
+
+public:
+	/*************************************************************************
+		Iterator Classes
+	*************************************************************************/
+	/*!
+	\brief
+		Constant forward iterator class for String objects
+	*/
+#if defined(_MSC_VER) && (_MSC_VER <= 1200)
+	class const_iterator : public std::iterator<std::random_access_iterator_tag, utf32>
+#else
+	class const_iterator : public std::iterator<std::random_access_iterator_tag, utf32, std::ptrdiff_t, const utf32*, const utf32&>
+#endif
+	{
+
+	public:
+		//////////////////////////////////////////////////////////////////////////
+		// data
+		//////////////////////////////////////////////////////////////////////////
+		const utf32*	d_ptr;
+
+
+		//////////////////////////////////////////////////////////////////////////
+		// Methods
+		//////////////////////////////////////////////////////////////////////////
+		const_iterator(void)
+		{
+			d_ptr = 0;
+		}
+		const_iterator(const_pointer ptr)
+		{
+			d_ptr = ptr;
+		}
+
+		const_reference	operator*() const
+		{
+			return *d_ptr;
+		}
+
+#if defined(_MSC_VER) && (_MSC_VER <= 1200)
+#	pragma warning (push)
+#	pragma warning (disable : 4284)
+#endif
+		const_pointer	operator->() const		
+		{
+			return &**this;
+		}
+
+#if defined(_MSC_VER) && (_MSC_VER <= 1200)
+#	pragma warning (pop)
+#endif
+
+		const_iterator&	operator++()
+		{
+			++d_ptr;
+			return *this;
+		}
+
+		const_iterator	operator++(int)		
+		{
+			const_iterator temp = *this;
+			++*this;
+			return temp;
+		}
+
+		const_iterator&	operator--()
+		{
+			--d_ptr;
+			return *this;
+		}
+
+		const_iterator	operator--(int)		
+		{
+			const_iterator temp = *this;
+			--*this;
+			return temp;
+		}
+
+		const_iterator& operator+=(difference_type offset)
+		{
+			d_ptr += offset;
+			return *this;
+		}
+
+		const_iterator operator+(difference_type offset) const
+		{
+			const_iterator temp = *this;
+			return temp += offset;
+		}
+
+		const_iterator& operator-=(difference_type offset)
+		{
+			return *this += -offset;
+		}
+
+		const_iterator operator-(difference_type offset) const
+		{
+			const_iterator temp = *this;
+			return temp -= offset;
+		}
+
+		difference_type operator-(const const_iterator& iter) const
+		{
+			return d_ptr - iter.d_ptr;
+		}
+
+		const_reference operator[](difference_type offset) const
+		{
+			return *(*this + offset);
+		}
+
+		bool operator==(const const_iterator& iter) const
+		{
+			return d_ptr == iter.d_ptr;
+		}
+
+		bool operator!=(const const_iterator& iter) const
+		{
+			return !(*this == iter);
+		}
+
+		bool operator<(const const_iterator& iter) const
+		{
+			return d_ptr < iter.d_ptr;
+		}
+
+		bool operator>(const const_iterator& iter) const
+		{
+			return (!(iter < *this));
+		}
+
+		bool operator<=(const const_iterator& iter) const
+		{
+			return (!(iter < *this));
+		}
+
+		bool operator>=(const const_iterator& iter) const
+		{
+			return (!(*this < iter));
+		}
+
+		friend const_iterator operator+(difference_type offset, const const_iterator& iter)
+		{
+			return iter + offset;
+		}
+
+	};
+
+	/*!
+	\brief
+		Forward iterator class for String objects
+	*/
+	class iterator : public const_iterator
+	{
+	public:
+		iterator(void) {}
+		iterator(pointer ptr) : const_iterator(ptr) {}
+
+
+		reference operator*() const
+		{
+			return ((reference)**(const_iterator *)this);
+		}
+
+#if defined(_MSC_VER) && (_MSC_VER <= 1200)
+#	pragma warning (push)
+#	pragma warning (disable : 4284)
+#endif
+
+		pointer operator->() const
+		{
+			return &**this;
+		}
+
+#if defined(_MSC_VER) && (_MSC_VER <= 1200)
+#	pragma warning (pop)
+#endif
+
+		iterator& operator++()
+		{
+			++this->d_ptr;
+			return *this;
+		}
+
+		iterator operator++(int)
+		{
+			iterator temp = *this;
+			++*this;
+			return temp;
+		}
+
+		iterator& operator--()
+		{
+			--this->d_ptr;
+			return *this;
+		}
+
+		iterator operator--(int)
+		{
+			iterator temp = *this;
+			--*this;
+			return temp;
+		}
+
+		iterator& operator+=(difference_type offset)
+		{
+			this->d_ptr += offset;
+			return *this;
+		}
+
+		iterator operator+(difference_type offset) const
+		{
+			iterator temp = *this;
+			return temp + offset;
+		}
+
+		iterator& operator-=(difference_type offset)
+		{
+			return *this += -offset;
+		}
+
+		iterator operator-(difference_type offset) const
+		{
+			iterator temp = *this;
+			return temp -= offset;
+		}
+
+		difference_type operator-(const const_iterator& iter) const
+		{
+			return ((const_iterator)*this - iter);
+		}
+
+		reference operator[](difference_type offset) const
+		{
+			return *(*this + offset);
+		}
+
+		friend iterator operator+(difference_type offset, const iterator& iter)
+		{
+			return iter + offset;
+		}
+
+	};
+
+	/*!
+	\brief
+		Constant reverse iterator class for String objects
+	*/
+#if defined(_MSC_VER) && ((_MSC_VER <= 1200) || ((_MSC_VER <= 1300) && defined(_STLPORT_VERSION)))
+	typedef	std::reverse_iterator<const_iterator, const_pointer, const_reference, difference_type>	const_reverse_iterator;
+#else
+	typedef	std::reverse_iterator<const_iterator>	const_reverse_iterator;
+#endif
+
+	/*!
+	\brief
+		Reverse iterator class for String objects
+	*/
+#if defined(_MSC_VER) && ((_MSC_VER <= 1200) || ((_MSC_VER <= 1300) && defined(_STLPORT_VERSION)))
+	typedef std::reverse_iterator<iterator, pointer, reference, difference_type>			reverse_iterator;
+#else
+	typedef std::reverse_iterator<iterator>			reverse_iterator;
+#endif
+
+public:
+	//////////////////////////////////////////////////////////////////////////
+	// Default Construction and Destructor
+	//////////////////////////////////////////////////////////////////////////
+	/*!
+	\brief
+		Constructs an empty string
+	*/
+	String(void)
+	{
+		init();
+	}
+
+	/*!
+	\brief
+		Destructor for String objects
+	*/
+	~String(void);
+
+	//////////////////////////////////////////////////////////////////////////
+	// Construction via CEGUI::String
+	//////////////////////////////////////////////////////////////////////////
+	/*!
+	\brief
+		Copy constructor - Creates a new string with the same value as \a str
+
+	\param str
+		String object used to initialise the newly created string
+
+	\return
+		Nothing
+	*/
+	String(const String& str)
+	{
+		init();
+		assign(str);
+	}
+	
+
+	/*!
+	\brief
+		Constructs a new string initialised with code points from another String object.
+
+	\param str
+		String object used to initialise the newly created string
+
+	\param str_idx
+		Starting code-point of \a str to be used when initialising the new String
+
+	\param str_num
+		Maximum number of code points from \a str that are to be assigned to the new String
+
+	\return
+		Nothing
+	*/
+	String(const String& str, size_type str_idx, size_type str_num = npos)
+	{
+		init();
+		assign(str, str_idx, str_num);
+	}
+
+	//////////////////////////////////////////////////////////////////////////
+	// Construction via std::string
+	//////////////////////////////////////////////////////////////////////////
+	/*!
+	\brief
+		Constructs a new string and initialises it using the std::string std_str
+
+	\param std_str
+		The std::string object that is to be used to initialise the new String object.
+
+	\note
+		The characters of \a std_str are taken to be unencoded data which represent Unicode code points 0x00..0xFF.  No translation of
+		the provided data will occur.
+
+	\return
+		Nothing
+
+	\exception std::length_error	Thrown if resulting String object would be too big.
+	*/
+	String(const std::string& std_str)
+	{
+		init();
+		assign(std_str);
+	}
+		
+	/*!
+	\brief
+		Constructs a new string initialised with characters from the given std::string object.
+
+	\param std_str
+		std::string object used to initialise the newly created string
+
+	\param str_idx
+		Starting character of \a std_str to be used when initialising the new String
+
+	\note
+		The characters of \a std_str are taken to be unencoded data which represent Unicode code points 0x00..0xFF.  No translation of
+		the provided data will occur.
+
+	\param str_num
+		Maximum number of characters from \a std_str that are to be assigned to the new String
+
+	\return
+		Nothing
+
+	\exception std::length_error	Thrown if resulting String object would be too big.
+	*/
+	String(const std::string& std_str, size_type str_idx, size_type str_num = npos)
+	{
+		init();
+		assign(std_str, str_idx, str_num);
+	}
+
+
+	//////////////////////////////////////////////////////////////////////////
+	// Construction via UTF-8 stream (for straight ASCII use, only codes 0x00 - 0x7f are valid)
+	//////////////////////////////////////////////////////////////////////////
+	/*!
+	\brief
+		Constructs a new String object and initialise it using the provided utf8 encoded string buffer.
+
+	\param utf8_str
+		Pointer to a buffer containing a null-terminated Unicode string encoded as utf8 data.
+
+	\note
+		A basic string literal (cast to utf8*) can be passed to this function, provided that the string is
+		comprised only of code points 0x00..0x7f.  The use of extended ASCII characters (with values >0x7f)
+		would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable
+		results.
+
+	\return
+		Nothing
+
+	\exception std::length_error	Thrown if resulting String object would be too big.
+	*/
+	String(const utf8* utf8_str)
+	{
+		init();
+		assign(utf8_str);
+	}
+
+	/*!
+	\brief
+		Constructs a new String object and initialise it using the provided utf8 encoded string buffer.
+
+		A basic string literal (cast to utf8*) can be passed to this function, provided that the string is
+		comprised only of code points 0x00..0x7f.  The use of extended ASCII characters (with values >0x7f)
+		would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable
+		results.
+
+	\param utf8_str
+		Pointer to a buffer containing Unicode string data encoded as utf8.
+
+	\note
+		A basic string literal (cast to utf8*) can be passed to this function, provided that the string is
+		comprised only of code points 0x00..0x7f.  The use of extended ASCII characters (with values >0x7f)
+		would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable
+		results.
+
+	\param chars_len
+		Length of the provided utf8 string in code units (not code-points).
+
+	\return
+		Nothing
+
+	\exception std::length_error	Thrown if resulting String object would be too big.
+	*/
+	String(const utf8* utf8_str, size_type chars_len)
+	{
+		init();
+		assign(utf8_str, chars_len);
+	}
+
+	//////////////////////////////////////////////////////////////////////////
+	// Construction via code-point (using a UTF-32 code unit)
+	//////////////////////////////////////////////////////////////////////////
+	/*!
+	\brief
+		Constructs a new String that is initialised with the specified code point
+
+	\param num
+		The number of times \a code_point is to be put into new String object
+
+	\param code_point
+		The Unicode code point to be used when initialising the String object
+
+	\return
+		Nothing
+
+	\exception std::length_error	Thrown if resulting String object would be too big.
+	*/
+	String(size_type num, utf32 code_point)
+	{
+		init();
+		assign(num, code_point);
+	}
+
+	//////////////////////////////////////////////////////////////////////////
+	// Construction via iterator
+	//////////////////////////////////////////////////////////////////////////
+	// Create string with characters in the range [beg, end)
+	/*!
+	\brief
+		Construct a new string object and initialise it with code-points from the range [beg, end).
+
+	\param beg
+		Iterator describing the start of the data to be used when initialising the String object
+
+	\param end
+		Iterator describing the (exclusive) end of the data to be used when initialising the String object
+
+	\return 
+		Nothing
+	*/
+	String(const_iterator iter_beg, const_iterator iter_end)
+	{
+		init();
+		append(iter_beg, iter_end);
+	}
+
+
+	//////////////////////////////////////////////////////////////////////////
+	// Construction via c-string
+	//////////////////////////////////////////////////////////////////////////
+	/*!
+	\brief
+		Constructs a new String object and initialise it using the provided c-string.
+
+	\param c_str
+		Pointer to a c-string.
+
+	\return
+		Nothing
+
+	\exception std::length_error	Thrown if resulting String object would be too big.
+	*/
+	String(const char* cstr)
+	{
+		init();
+		assign(cstr);
+	}
+
+	/*!
+	\brief
+		Constructs a new String object and initialise it using characters from the provided char array.
+
+	\param chars
+		char array.
+
+	\param chars_len
+		Number of chars from the array to be used.
+
+	\return
+		Nothing
+
+	\exception std::length_error	Thrown if resulting String object would be too big.
+	*/
+	String(const char* chars, size_type chars_len)
+	{
+		init();
+		assign(chars, chars_len);
+	}
+
+
+	//////////////////////////////////////////////////////////////////////////
+	// Size operations
+	//////////////////////////////////////////////////////////////////////////
+	/*!
+	\brief
+		Returns the size of the String in code points
+
+	\return
+		Number of code points currently in the String
+	*/
+	size_type	size(void) const
+	{
+		return d_cplength;
+	}
+
+	/*!
+	\brief
+		Returns the size of the String in code points
+
+	\return
+		Number of code points currently in the String
+	*/
+	size_type	length(void) const
+	{
+		return d_cplength;
+	}
+
+	/*!
+	\brief
+		Returns true if the String is empty
+
+	\return
+		true if the String is empty, else false.
+	*/
+	bool	empty(void) const
+	{
+		return	(d_cplength == 0);
+	}
+
+	/*!
+	\brief
+		Returns the maximum size of a String.
+
+		Any operation that would result in a String that is larger than this value will throw the std::length_error exception.
+
+	\return
+		The maximum number of code points that a string can contain
+	*/
+	static size_type	max_size(void)
+	{
+		return (((size_type)-1) / sizeof(utf32));
+	}
+
+	//////////////////////////////////////////////////////////////////////////
+	// Capacity Operations
+	//////////////////////////////////////////////////////////////////////////
+	// return the number of code points the string could hold without re-allocation
+	// (due to internal encoding this will always report the figure for worst-case encoding, and could even be < size()!)
+	/*!
+	\brief
+		Return the number of code points that the String could hold before a re-allocation would be required.
+
+	\return
+		Size of the current reserve buffer.  This is the maximum number of code points the String could hold before a buffer
+		re-allocation would be required
+	*/
+	size_type capacity(void) const
+	{
+		return d_reserve - 1;
+	}
+
+	// reserve internal memory for at-least 'num' code-points (characters).  if num is 0, request is shrink-to-fit.
+	/*!
+	\brief
+		Specifies the amount of reserve capacity to allocate.
+
+	\param num
+		The number of code points to allocate space for.  If \a num is larger that the current reserve, then a re-allocation will occur.  If
+		\a num is smaller than the current reserve (but not 0) the buffer may be shrunk to the larger of the specified number, or the current
+		String size (operation is currently not implemented).  If \a num is 0, then the buffer is re-allocated to fit the current String size.
+
+	\return
+		Nothing
+
+	\exception std::length_error	Thrown if resulting String object would be too big.
+	*/
+	void	reserve(size_type num = 0)
+	{
+		if (num == 0)
+			trim();
+		else
+			grow(num);
+	}
+
+	//////////////////////////////////////////////////////////////////////////
+	// Comparisons
+	//////////////////////////////////////////////////////////////////////////
+	/*!
+	\brief
+		Compares this String with the String 'str'.
+
+	\note
+		This does currently not properly consider Unicode and / or the system locale.
+
+	\param str
+		The String object that is to compared with this String.
+
+	\return
+		-  0 if the String objects are equal
+		- <0 if this String is lexicographically smaller than \a str
+		- >0 if this String is lexicographically greater than \a str
+	*/
+	int		compare(const String& str) const
+	{
+		return compare(0, d_cplength, str);
+	}
+
+	/*!
+	\brief
+		Compares code points from this String with code points from the String 'str'.
+
+	\note
+		This does currently not properly consider Unicode and / or the system locale.
+
+	\param idx
+		Index of the first code point from this String to consider.
+
+	\param len
+		Maximum number of code points from this String to consider.
+
+	\param str
+		The String object that is to compared with this String.
+
+	\param str_idx
+		Index of the first code point from String \a str to consider.
+
+	\param str_len
+		Maximum number of code points from String \a str to consider
+
+	\return
+		-  0 if the specified sub-strings are equal
+		- <0 if specified sub-strings are lexicographically smaller than \a str
+		- >0 if specified sub-strings are lexicographically greater than \a str
+
+	\exception std::out_of_range	Thrown if either \a idx or \a str_idx are invalid.
+	*/
+	int		compare(size_type idx, size_type len, const String& str, size_type str_idx = 0, size_type str_len = npos) const
+	{
+		if ((d_cplength < idx) || (str.d_cplength < str_idx))
+			throw std::out_of_range("Index is out of range for CEGUI::String");
+
+		if ((len == npos) || (idx + len > d_cplength))
+			len = d_cplength - idx;
+
+		if ((str_len == npos) || (str_idx + str_len > str.d_cplength))
+			str_len = str.d_cplength - str_idx;
+
+		int val = (len == 0) ? 0 : utf32_comp_utf32(&ptr()[idx], &str.ptr()[str_idx], (len < str_len) ? len : str_len);
+
+		return (val != 0) ? ((val < 0) ? -1 : 1) : (len < str_len) ? -1 : (len == str_len) ? 0 : 1;
+	}
+
+
+	/*!
+	\brief
+		Compares this String with the std::string 'std_str'.
+
+	\note
+		This does currently not properly consider Unicode and / or the system locale.
+
+	\param std_str
+		The std::string object that is to compared with this String.
+
+	\note
+		Characters from \a std_str are considered to represent Unicode code points in the range 0x00..0xFF.  No translation of
+		the encountered data is performed.
+
+	\return
+		-  0 if the string objects are equal
+		- <0 if this string is lexicographically smaller than \a std_str
+		- >0 if this string is lexicographically greater than \a std_str
+	*/
+	int		compare(const std::string& std_str) const
+	{
+		return compare(0, d_cplength, std_str);
+	}
+
+
+	/*!
+	\brief
+		Compares code points from this String with code points from the std::string 'std_str'.
+
+	\note
+		This does currently not properly consider Unicode and / or the system locale.
+
+	\param idx
+		Index of the first code point from this String to consider.
+
+	\param len
+		Maximum number of code points from this String to consider.
+
+	\param std_str
+		The std::string object that is to compared with this String.
+
+	\note
+		Characters from \a std_str are considered to represent Unicode code points in the range 0x00..0xFF.  No translation of
+		the encountered data is performed.
+
+	\param str_idx
+		Index of the first character from std::string \a std_str to consider.
+
+	\param str_len
+		Maximum number of characters from std::string \a std_str to consider
+
+	\return
+		-  0 if the specified sub-strings are equal
+		- <0 if specified sub-strings are lexicographically smaller than \a std_str
+		- >0 if specified sub-strings are lexicographically greater than \a std_str
+
+	\exception std::out_of_range	Thrown if either \a idx or \a str_idx are invalid.
+	*/
+	int		compare(size_type idx, size_type len, const std::string& std_str, size_type str_idx = 0, size_type str_len = npos) const
+	{
+		if (d_cplength < idx)
+			throw std::out_of_range("Index is out of range for CEGUI::String");
+
+		if (std_str.size() < str_idx)
+			throw std::out_of_range("Index is out of range for std::string");
+
+		if ((len == npos) || (idx + len > d_cplength))
+			len = d_cplength - idx;
+
+		if ((str_len == npos) || (str_idx + str_len > std_str.size()))
+			str_len = (size_type)std_str.size() - str_idx;
+
+		int val = (len == 0) ? 0 : utf32_comp_char(&ptr()[idx], &std_str.c_str()[str_idx], (len < str_len) ? len : str_len);
+
+		return (val != 0) ? ((val < 0) ? -1 : 1) : (len < str_len) ? -1 : (len == str_len) ? 0 : 1;
+	}
+
+
+	/*!
+	\brief
+		Compares this String with the null-terminated utf8 encoded 'utf8_str'.
+
+	\note
+		This does currently not properly consider Unicode and / or the system locale.
+
+	\param utf8_str
+		The buffer containing valid Unicode data encoded as utf8 that is to compared with this String.
+
+	\note
+		A basic string literal (cast to utf8*) can be passed to this function, provided that the string is
+		comprised only of code points 0x00..0x7f.  The use of extended ASCII characters (with values >0x7f)
+		would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable
+		results.
+
+	\return
+		-  0 if the strings are equal
+		- <0 if this string is lexicographically smaller than \a utf8_str
+		- >0 if this string is lexicographically greater than \a utf8_str
+	*/
+	int		compare(const utf8* utf8_str) const
+	{
+		return compare(0, d_cplength, utf8_str, encoded_size(utf8_str));
+	}
+
+
+	/*!
+	\brief
+		Compares code points from this String with the null-terminated utf8 encoded 'utf8_str'.
+
+	\note
+		This does currently not properly consider Unicode and / or the system locale.
+
+	\param idx
+		Index of the first code point from this String to consider.
+
+	\param len
+		Maximum number of code points from this String to consider.
+
+	\param utf8_str
+		The buffer containing valid Unicode data encoded as utf8 that is to compared with this String.
+
+	\note
+		A basic string literal (cast to utf8*) can be passed to this function, provided that the string is
+		comprised only of code points 0x00..0x7f.  The use of extended ASCII characters (with values >0x7f)
+		would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable
+		results.
+
+	\return
+		-  0 if the specified sub-strings are equal
+		- <0 if specified sub-strings are lexicographically smaller than \a utf8_str
+		- >0 if specified sub-strings are lexicographically greater than \a utf8_str
+
+	\exception std::out_of_range	Thrown if \a idx is invalid.
+	*/
+	int		compare(size_type idx, size_type len, const utf8* utf8_str) const
+	{
+		return compare(idx, len, utf8_str, encoded_size(utf8_str));
+	}
+
+	/*!
+	\brief
+		Compares code points from this String with the utf8 encoded data in buffer 'utf8_str'.
+
+	\note
+		This does currently not properly consider Unicode and / or the system locale.
+
+	\param idx
+		Index of the first code point from this String to consider.
+
+	\param len
+		Maximum number of code points from this String to consider.
+
+	\param utf8_str
+		The buffer containing valid Unicode data encoded as utf8 that is to compared with this String.
+
+	\note
+		A basic string literal (cast to utf8*) can be passed to this function, provided that the string is
+		comprised only of code points 0x00..0x7f.  The use of extended ASCII characters (with values >0x7f)
+		would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable
+		results.
+
+	\param str_cplen
+		The number of encoded code points in the buffer \a utf8_str (this is not the same as the number of code units).
+
+	\return
+		-  0 if the specified sub-strings are equal
+		- <0 if specified sub-strings are lexicographically smaller than \a utf8_str
+		- >0 if specified sub-strings are lexicographically greater than \a utf8_str
+
+	\exception std::out_of_range	Thrown if \a idx is invalid.
+	\exception std::length_error	Thrown if \a str_cplen is set to npos.
+	*/
+	int		compare(size_type idx, size_type len, const utf8* utf8_str, size_type str_cplen) const
+	{
+		if (d_cplength < idx)
+			throw std::out_of_range("Index is out of range for CEGUI::String");
+
+		if (str_cplen == npos)
+			throw std::length_error("Length for utf8 encoded string can not be 'npos'");
+
+		if ((len == npos) || (idx + len > d_cplength))
+			len = d_cplength - idx;
+
+		int val = (len == 0) ? 0 : utf32_comp_utf8(&ptr()[idx], utf8_str, (len < str_cplen) ? len : str_cplen);
+
+		return (val != 0) ? ((val < 0) ? -1 : 1) : (len < str_cplen) ? -1 : (len == str_cplen) ? 0 : 1;
+	}
+
+
+	/*!
+	\brief
+		Compares this String with the given c-string.
+
+	\note
+		This does currently not properly consider Unicode and / or the system locale.
+
+	\param c_str
+		The c-string that is to compared with this String.
+
+	\return
+		-  0 if the strings are equal
+		- <0 if this string is lexicographically smaller than \a c_str
+		- >0 if this string is lexicographically greater than \a c_str
+	*/
+	int		compare(const char* cstr) const
+	{
+		return compare(0, d_cplength, cstr, strlen(cstr));
+	}
+
+
+	/*!
+	\brief
+		Compares code points from this String with the given c-string.
+
+	\note
+		This does currently not properly consider Unicode and / or the system locale.
+
+	\param idx
+		Index of the first code point from this String to consider.
+
+	\param len
+		Maximum number of code points from this String to consider.
+
+	\param c_str
+		The c-string that is to compared with this String.
+
+	\return
+		-  0 if the specified sub-strings are equal
+		- <0 if specified sub-strings are lexicographically smaller than \a c_str
+		- >0 if specified sub-strings are lexicographically greater than \a c_str
+
+	\exception std::out_of_range	Thrown if \a idx is invalid.
+	*/
+	int		compare(size_type idx, size_type len, const char* cstr) const
+	{
+		return compare(idx, len, cstr, strlen(cstr));
+	}
+
+
+	/*!
+	\brief
+		Compares code points from this String with chars in the given char array.
+
+	\note
+		This does currently not properly consider Unicode and / or the system locale.
+
+	\param idx
+		Index of the first code point from this String to consider.
+
+	\param len
+		Maximum number of code points from this String to consider.
+
+	\param chars
+		The array containing the chars that are to compared with this String.
+
+	\param chars_len
+		The number of chars in the array.
+
+	\return
+		-  0 if the specified sub-strings are equal
+		- <0 if specified sub-strings are lexicographically smaller than \a chars
+		- >0 if specified sub-strings are lexicographically greater than \a chars
+
+	\exception std::out_of_range	Thrown if \a idx is invalid.
+	\exception std::length_error	Thrown if \a chars_len is set to npos.
+	*/
+	int		compare(size_type idx, size_type len, const char* chars, size_type chars_len) const
+	{
+		if (d_cplength < idx)
+			throw std::out_of_range("Index is out of range for CEGUI::String");
+
+		if (chars_len == npos)
+			throw std::length_error("Length for char array can not be 'npos'");
+
+		if ((len == npos) || (idx + len > d_cplength))
+			len = d_cplength - idx;
+
+		int val = (len == 0) ? 0 : utf32_comp_char(&ptr()[idx], chars, (len < chars_len) ? len : chars_len);
+
+		return (val != 0) ? ((val < 0) ? -1 : 1) : (len < chars_len) ? -1 : (len == chars_len) ? 0 : 1;
+	}
+
+
+	//////////////////////////////////////////////////////////////////////////
+	// Character access
+	//////////////////////////////////////////////////////////////////////////
+	/*!
+	\brief
+		Returns the code point at the given index.
+
+	\param idx
+		Zero based index of the code point to be returned.
+
+	\note
+		- For constant strings length()/size() provide a valid index and will access the default utf32 value.
+		- For non-constant strings length()/size() is an invalid index, and acceesing (especially writing) this index could cause string corruption.
+
+	\return
+		The utf32 code point at the given index within the String.
+	*/
+	reference	operator[](size_type idx)
+	{
+		return (ptr()[idx]);
+	}
+
+	/*!
+	\brief
+		Returns the code point at the given index.
+
+	\param idx
+		Zero based index of the code point to be returned.
+
+	\note
+		- For constant strings length()/size() provide a valid index and will access the default utf32 value.
+		- For non-constant strings length()/size() is an invalid index, and acceesing (especially writing) this index could cause string corruption.
+
+	\return
+		The utf32 code point at the given index within the String.
+	*/
+	value_type	operator[](size_type idx) const
+	{
+		return ptr()[idx];
+	}
+
+	/*!
+	\brief
+		Returns the code point at the given index.
+
+	\param idx
+		Zero based index of the code point to be returned.
+
+	\return
+		The utf32 code point at the given index within the String.
+
+	\exception std::out_of_range	Thrown if \a idx is >= length().
+	*/
+	reference	at(size_type idx)
+	{
+		if (d_cplength <= idx)
+			throw std::out_of_range("Index is out of range for CEGUI::String");
+
+		return ptr()[idx];
+	}
+
+	/*!
+	\brief
+		Returns the code point at the given index.
+
+	\param idx
+		Zero based index of the code point to be returned.
+
+	\return
+		The utf32 code point at the given index within the String.
+
+	\exception std::out_of_range	Thrown if \a idx is >= length().
+	*/
+	const_reference	at(size_type idx) const
+	{
+		if (d_cplength <= idx)
+			throw std::out_of_range("Index is out of range for CEGUI::String");
+
+		return ptr()[idx];
+	}
+
+
+	//////////////////////////////////////////////////////////////////////////
+	// C-Strings and arrays
+	//////////////////////////////////////////////////////////////////////////
+	/*!
+	\brief
+		Returns contents of the String as a null terminated string of utf8 encoded data.
+
+	\return
+		Pointer to a char buffer containing the contents of the String encoded as null-terminated utf8 data.
+
+	\note
+		The buffer returned from this function is owned by the String object.
+
+	\note
+		Any function that modifies the String data will invalidate the buffer returned by this call.
+	*/
+	const char* c_str(void) const
+	{
+		return (const char*)build_utf8_buff();
+	}
+
+	/*!
+	\brief
+		Returns contents of the String as utf8 encoded data.
+
+	\return
+		Pointer to a buffer containing the contents of the String encoded utf8 data.
+
+	\note
+		The buffer returned from this function is owned by the String object.
+
+	\note
+		Any function that modifies the String data will invalidate the buffer returned by this call.
+	*/
+	const utf8* data(void) const
+	{
+		return build_utf8_buff();
+	}
+
+	// copy, at most, 'len' code-points of the string, begining with code-point 'idx', into the array 'buf' as valid utf8 encoded data
+	// return number of utf8 code units placed into the buffer
+	/*!
+	\brief
+		Copies an area of the String into the provided buffer as encoded utf8 data.
+
+	\param buf
+		Pointer to a buffer that is to receive the encoded data (this must be big enough to hold the encoded data)
+
+	\param len
+		Maximum number of code points from the String that should be encoded into the buffer
+	
+	\param idx
+		Index of the first code point to be encoded into the buffer
+
+	\return
+		The number of utf8 encoded code units transferred to the buffer.
+
+		\note A code unit does not equal a code point.  A utf32 code point, when encoded as utf8, can occupy between 1 and 4 code units.
+
+	\exception std::out_of_range	Thrown if \a idx was invalid for this String.
+	*/
+	size_type	copy(utf8* buf, size_type len = npos, size_type idx = 0) const
+	{
+		if (d_cplength < idx)
+			throw std::out_of_range("Index is out of range for CEGUI::String");
+
+		if (len == npos)
+			len = d_cplength;
+
+		return encode(&ptr()[idx], buf, npos, len);
+	}
+
+	//////////////////////////////////////////////////////////////////////////
+	// UTF8 Encoding length information
+	//////////////////////////////////////////////////////////////////////////
+	// return the number of bytes required to hold 'num' code-points, starting at code-point 'idx', of the the string when encoded as utf8 data.
+	/*!
+	\brief
+		Return the number of utf8 code units required to hold an area of the String when encoded as utf8 data
+
+	\param num
+		Maximum number of code points to consider when calculating utf8 encoded size.
+
+	\param idx
+		Index of the first code point to consider when calculating the utf8 encoded size
+
+	\return
+		The number of utf8 code units (bytes) required to hold the specified sub-string when encoded as utf8 data.
+
+	\exception std::out_of_range	Thrown if \a idx was invalid for this String.
+	*/
+	size_type	utf8_stream_len(size_type num = npos, size_type idx = 0) const
+	{
+		using namespace std;
+
+		if (d_cplength < idx)
+			throw out_of_range("Index was out of range for CEGUI::String object");
+
+		size_type	maxlen = d_cplength - idx;
+
+		return encoded_size(&ptr()[idx], ceguimin(num, maxlen));
+	}
+
+	//////////////////////////////////////////////////////////////////////////
+	// Assignment Functions
+	//////////////////////////////////////////////////////////////////////////
+	/*!
+	\brief
+		Assign the value of String \a str to this String
+
+	\param str
+		String object containing the string value to be assigned.
+
+	\return
+		This String after the assignment has happened
+	*/
+	String&	operator=(const String& str)
+	{
+		return assign(str);
+	}
+
+	/*!
+	\brief
+		Assign a sub-string of String \a str to this String
+
+	\param str
+		String object containing the string data to be assigned.
+
+	\param str_idx
+		Index of the first code point in \a str that is to be assigned
+
+	\param str_num
+		Maximum number of code points from \a str that are be be assigned
+
+	\return
+		This String after the assignment has happened
+
+	\exception std::out_of_range	Thrown if str_idx is invalid for \a str
+	*/
+	String&	assign(const String& str, size_type str_idx = 0, size_type str_num = npos)
+	{
+		if (str.d_cplength < str_idx)
+			throw std::out_of_range("Index was out of range for CEGUI::String object");
+
+		if (str_num == npos)
+			str_num = str.d_cplength - str_idx;
+
+		grow(str_num);
+		setlen(str_num);
+		memcpy(ptr(), &str.ptr()[str_idx], str_num * sizeof(utf32));
+		
+		return *this;
+	}
+
+	/*!
+	\brief
+		Assign the value of std::string \a std_str to this String
+
+	\note
+		The characters of \a std_str are taken to be unencoded data which represent Unicode code points 0x00..0xFF.  No translation of
+		the provided data will occur.
+
+	\param std_str
+		std::string object containing the string value to be assigned.
+
+	\return
+		This String after the assignment has happened
+
+	\exception std::length_error	Thrown if the resulting String would have been too large.
+	*/
+	String&	operator=(const std::string& std_str)
+	{
+		return assign(std_str);
+	}
+
+	/*!
+	\brief
+		Assign a sub-string of std::string \a std_str to this String
+
+	\note
+		The characters of \a std_str are taken to be unencoded data which represent Unicode code points 0x00..0xFF.  No translation of
+		the provided data will occur.
+
+	\param std_str
+		std::string object containing the string value to be assigned.
+
+	\param str_idx
+		Index of the first character of \a std_str to be assigned
+
+	\param str_num
+		Maximum number of characters from \a std_str to be assigned
+
+	\return
+		This String after the assignment has happened
+
+	\exception std::out_of_range	Thrown if \a str_idx is invalid for \a std_str
+	\exception std::length_error	Thrown if the resulting String would have been too large.
+	*/
+	String&	assign(const std::string& std_str, size_type str_idx = 0, size_type str_num = npos)
+	{
+		if (std_str.size() < str_idx)
+			throw std::out_of_range("Index was out of range for std::string object");
+
+		if (str_num == npos)
+			str_num = (size_type)std_str.size() - str_idx;
+
+		grow(str_num);
+		setlen(str_num);
+
+		while(str_num--)
+		{
+			((*this)[str_num]) = static_cast<utf32>(static_cast<unsigned char>(std_str[str_num + str_idx]));
+		}
+
+		return *this;
+	}
+
+	/*!
+	\brief
+		Assign to this String the string value represented by the given null-terminated utf8 encoded data
+
+	\note
+		A basic string literal (cast to utf8*) can be passed to this function, provided that the string is
+		comprised only of code points 0x00..0x7f.  The use of extended ASCII characters (with values >0x7f)
+		would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable
+		results.
+
+	\param utf8_str
+		Buffer containing valid null-terminated utf8 encoded data
+
+	\return
+		This String after the assignment has happened
+
+	\exception std::length_error	Thrown if the resulting String would have been too large.
+	*/
+	String&	operator=(const utf8* utf8_str)
+	{
+		return assign(utf8_str, utf_length(utf8_str));
+	}
+
+	/*!
+	\brief
+		Assign to this String the string value represented by the given null-terminated utf8 encoded data
+
+	\note
+		A basic string literal (cast to utf8*) can be passed to this function, provided that the string is
+		comprised only of code points 0x00..0x7f.  The use of extended ASCII characters (with values >0x7f)
+		would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable
+		results.
+
+	\param utf8_str
+		Buffer containing valid null-terminated utf8 encoded data
+
+	\return
+		This String after the assignment has happened
+
+	\exception std::length_error	Thrown if the resulting String would have been too large.
+	*/
+	String&	assign(const utf8* utf8_str)
+	{
+		return assign(utf8_str, utf_length(utf8_str));
+	}
+
+	/*!
+	\brief
+		Assign to this String the string value represented by the given utf8 encoded data
+
+	\note
+		A basic string literal (cast to utf8*) can be passed to this function, provided that the string is
+		comprised only of code points 0x00..0x7f.  The use of extended ASCII characters (with values >0x7f)
+		would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable
+		results.
+
+	\param utf8_str
+		Buffer containing valid utf8 encoded data
+
+	\param str_num
+		Number of code units (not code points) in the buffer pointed to by \a utf8_str
+
+	\return
+		This String after the assignment has happened
+
+	\exception std::length_error	Thrown if the resulting String would have been too large, or if str_num is 'npos'.
+	*/
+	String&	assign(const utf8* utf8_str, size_type str_num)
+	{
+		if (str_num == npos)
+			throw std::length_error("Length for utf8 encoded string can not be 'npos'");
+
+		size_type enc_sze = encoded_size(utf8_str, str_num);
+
+		grow(enc_sze);
+		encode(utf8_str, ptr(), d_reserve, str_num);
+		setlen(enc_sze);
+		return *this;
+	}
+
+	/*!
+	\brief
+		Assigns the specified utf32 code point to this String.  Result is always a String 1 code point in length.
+
+	\param code_point
+		Valid utf32 Unicode code point to be assigned to the string
+
+	\return
+		This String after assignment
+	*/
+	String&	operator=(utf32 code_point)
+	{
+		return assign(1, code_point);
+	}
+
+	/*!
+	\brief
+		Assigns the specified code point repeatedly to the String
+
+	\param num
+		The number of times to assign the code point
+
+	\param code_point
+		Valid utf32 Unicode code point to be assigned to the string
+
+	\return
+		This String after assignment.
+
+	\exception std::length_error	Thrown if \a num was 'npos'
+	*/
+	String&	assign(size_type num, utf32 code_point)
+	{
+		if (num == npos)
+			throw std::length_error("Code point count can not be 'npos'");
+
+		grow(num);
+		setlen(num);
+		utf32* p = ptr();
+
+		while(num--)
+			*p++ = code_point;
+
+		return *this;
+	}
+
+
+	/*!
+	\brief
+		Assign to this String the given C-string.
+
+	\param c_str
+		Pointer to a valid C style string.
+
+	\return
+		This String after the assignment has happened
+
+	\exception std::length_error	Thrown if the resulting String would have been too large.
+	*/
+	String&	operator=(const char* cstr)
+	{
+		return assign(cstr, strlen(cstr));
+	}
+
+
+	/*!
+	\brief
+		Assign to this String the given C-string.
+
+	\param c_str
+		Pointer to a valid C style string.
+
+	\return
+		This String after the assignment has happened
+
+	\exception std::length_error	Thrown if the resulting String would have been too large.
+	*/
+	String&	assign(const char* cstr)
+	{
+		return assign(cstr, strlen(cstr));
+	}
+
+
+	/*!
+	\brief
+		Assign to this String a number of chars from a char array.
+
+	\param chars
+		char array.
+
+	\param chars_len
+		Number of chars to be assigned.
+
+	\return
+		This String after the assignment has happened
+
+	\exception std::length_error	Thrown if the resulting String would have been too large.
+	*/
+	String&	assign(const char* chars, size_type chars_len)
+	{
+		grow(chars_len);
+		utf32* pt = ptr();
+
+		for (size_type i = 0; i < chars_len; ++i)
+		{
+			*pt++ = static_cast<utf32>(static_cast<unsigned char>(*chars++));
+		}
+
+		setlen(chars_len);
+		return *this;
+	}
+
+
+	/*!
+	\brief
+		Swaps the value of this String with the given String \a str
+
+	\param str
+		String object whos value is to be swapped with this String.
+
+	\return
+		Nothing
+	*/
+	void	swap(String& str)
+	{
+		size_type	temp_len	= d_cplength;
+		d_cplength = str.d_cplength;
+		str.d_cplength = temp_len;
+
+		size_type	temp_res	= d_reserve;
+		d_reserve = str.d_reserve;
+		str.d_reserve = temp_res;
+
+		utf32*		temp_buf	= d_buffer;
+		d_buffer = str.d_buffer;
+		str.d_buffer = temp_buf;
+
+		// see if we need to swap 'quick buffer' data
+		if (temp_res <= STR_QUICKBUFF_SIZE)
+		{
+			utf32		temp_qbf[STR_QUICKBUFF_SIZE];
+
+			memcpy(temp_qbf, d_quickbuff, STR_QUICKBUFF_SIZE * sizeof(utf32));
+			memcpy(d_quickbuff, str.d_quickbuff, STR_QUICKBUFF_SIZE * sizeof(utf32));
+			memcpy(str.d_quickbuff, temp_qbf, STR_QUICKBUFF_SIZE * sizeof(utf32));
+		}
+
+	}
+
+	//////////////////////////////////////////////////////////////////////////
+	// Appending Functions
+	//////////////////////////////////////////////////////////////////////////
+	/*!
+	\brief
+		Appends the String \a str
+
+	\param str
+		String object that is to be appended
+
+	\return
+		This String after the append operation
+
+	\exception std::length_error	Thrown if resulting String would be too large.
+	*/
+	String&	operator+=(const String& str)
+	{
+		return append(str);
+	}
+
+	/*!
+	\brief
+		Appends a sub-string of the String \a str
+
+	\param str
+		String object containing data to be appended
+
+	\param str_idx
+		Index of the first code point to be appended
+
+	\param str_num
+		Maximum number of code points to be appended
+
+	\return
+		This String after the append operation
+
+	\exception std::out_of_range	Thrown if \a str_idx is invalid for \a str.
+	\exception std::length_error	Thrown if resulting String would be too large.
+	*/
+	String& append(const String& str, size_type str_idx = 0, size_type str_num = npos)
+	{
+		if (str.d_cplength < str_idx)
+			throw std::out_of_range("Index is out of range for CEGUI::String");
+
+		if (str_num == npos)
+			str_num = str.d_cplength - str_idx;
+
+		grow(d_cplength + str_num);
+		memcpy(&ptr()[d_cplength], &str.ptr()[str_idx], str_num * sizeof(utf32));
+		setlen(d_cplength + str_num);
+		return *this;
+	}
+
+
+	/*!
+	\brief
+		Appends the std::string \a std_str
+
+	\param std_str
+		std::string object that is to be appended
+
+	\note
+		The characters of \a std_str are taken to be unencoded data which represent Unicode code points 0x00..0xFF.  No translation of
+		the provided data will occur.
+
+	\return
+		This String after the append operation
+
+	\exception std::length_error	Thrown if resulting String would be too large.
+	*/
+	String&	operator+=(const std::string& std_str)
+	{
+		return append(std_str);
+	}
+
+	/*!
+	\brief
+		Appends a sub-string of the std::string \a std_str
+
+	\param std_str
+		std::string object containing data to be appended
+
+	\note
+		The characters of \a std_str are taken to be unencoded data which represent Unicode code points 0x00..0xFF.  No translation of
+		the provided data will occur.
+
+	\param str_idx
+		Index of the first character to be appended
+
+	\param str_num
+		Maximum number of characters to be appended
+
+	\return
+		This String after the append operation
+
+	\exception std::out_of_range	Thrown if \a str_idx is invalid for \a std_str.
+	\exception std::length_error	Thrown if resulting String would be too large.
+	*/
+	String& append(const std::string& std_str, size_type str_idx = 0, size_type str_num = npos)
+	{
+		if (std_str.size() < str_idx)
+			throw std::out_of_range("Index is out of range for std::string");
+
+		if (str_num == npos)
+			str_num = (size_type)std_str.size() - str_idx;
+
+		size_type newsze = d_cplength + str_num;
+
+		grow(newsze);
+		utf32* pt = &ptr()[newsze-1];
+
+		while(str_num--)
+			*pt-- = static_cast<utf32>(static_cast<unsigned char>(std_str[str_num]));
+
+		setlen(newsze);
+		return *this;
+	}
+
+
+	/*!
+	\brief
+		Appends to the String the null-terminated utf8 encoded data in the buffer utf8_str.
+
+	\param utf8_str
+		buffer holding the null-terminated utf8 encoded data that is to be appended
+
+	\note
+		A basic string literal (cast to utf8*) can be passed to this function, provided that the string is
+		comprised only of code points 0x00..0x7f.  The use of extended ASCII characters (with values >0x7f)
+		would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable
+		results.
+
+	\return
+		This String after the append operation
+
+	\exception std::length_error	Thrown if resulting String would be too large.
+	*/
+	String&	operator+=(const utf8* utf8_str)
+	{
+		return append(utf8_str, utf_length(utf8_str));
+	}
+
+	/*!
+	\brief
+		Appends to the String the null-terminated utf8 encoded data in the buffer utf8_str.
+
+	\param utf8_str
+		Buffer holding the null-terminated utf8 encoded data that is to be appended
+
+	\note
+		A basic string literal (cast to utf8*) can be passed to this function, provided that the string is
+		comprised only of code points 0x00..0x7f.  The use of extended ASCII characters (with values >0x7f)
+		would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable
+		results.
+
+	\return
+		This String after the append operation
+
+	\exception std::length_error	Thrown if resulting String would be too large.
+	*/
+	String& append(const utf8* utf8_str)
+	{
+		return append(utf8_str, utf_length(utf8_str));
+	}
+
+
+	/*!
+	\brief
+		Appends to the String the utf8 encoded data in the buffer utf8_str.
+
+	\param utf8_str
+		Buffer holding the utf8 encoded data that is to be appended
+
+	\note
+		A basic string literal (cast to utf8*) can be passed to this function, provided that the string is
+		comprised only of code points 0x00..0x7f.  The use of extended ASCII characters (with values >0x7f)
+		would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable
+		results.
+
+	\param len
+		Number of code units (not code points) in the buffer to be appended
+
+	\return
+		This String after the append operation
+
+	\exception std::length_error	Thrown if resulting String would be too large, or if \a len was 'npos'
+	*/
+	String& append(const utf8* utf8_str, size_type len)
+	{
+		if (len == npos)
+			throw std::length_error("Length for utf8 encoded string can not be 'npos'");
+
+		size_type encsz = encoded_size(utf8_str, len);
+		size_type newsz = d_cplength + encsz;
+
+		grow(newsz);
+		encode(utf8_str, &ptr()[d_cplength], encsz, len);
+		setlen(newsz);
+
+		return *this;
+	}
+
+
+	/*!
+	\brief
+		Appends a single code point to the string
+
+	\param code_point
+		utf32 Unicode code point that is to be appended
+
+	\return
+		This String after the append operation
+
+	\exception std::length_error	Thrown if resulting String would be too long.
+	*/
+	String& operator+=(utf32 code_point)
+	{
+		return append(1, code_point);
+	}
+
+	/*!
+	\brief
+		Appends a single code point multiple times to the string
+
+	\param num
+		Number of copies of the code point to be appended
+
+	\param code_point
+		utf32 Unicode code point that is to be appended
+
+	\return
+		This String after the append operation
+
+	\exception std::length_error	Thrown if resulting String would be too long, or if \a num was 'npos'.
+	*/
+	String& append(size_type num, utf32 code_point)
+	{
+		if (num == npos)
+			throw std::length_error("Code point count can not be 'npos'");
+
+		size_type newsz = d_cplength + num;
+		grow(newsz);
+
+		utf32* p = &ptr()[d_cplength];
+
+		while(num--)
+			*p++ = code_point;
+
+		setlen(newsz);
+
+		return *this;
+	}
+
+	/*!
+	\brief
+		Appends a single code point to the string
+
+	\param code_point
+		utf32 Unicode code point that is to be appended
+
+	\return
+		Nothing
+
+	\exception std::length_error	Thrown if resulting String would be too long.
+	*/
+	void	push_back(utf32 code_point)
+	{
+		append(1, code_point);
+	}
+
+	/*!
+	\brief
+		Appends the code points in the reange [beg, end)
+
+	\param beg
+		Iterator describing the start of the range to be appended
+
+	\param end
+		Iterator describing the (exclusive) end of the range to be appended.
+
+	\return
+		This String after the append operation
+
+	\exception std::length_error	Thrown if the resulting string would be too large.
+	*/
+	String&	append(const_iterator iter_beg, const_iterator iter_end)
+	{
+		return replace(end(), end(), iter_beg, iter_end);
+	}
+
+
+	/*!
+	\brief
+		Appends to the String the given c-string.
+
+	\param c_str
+		c-string that is to be appended.
+
+	\return
+		This String after the append operation
+
+	\exception std::length_error	Thrown if resulting String would be too large.
+	*/
+	String&	operator+=(const char* cstr)
+	{
+		return append(cstr, strlen(cstr));
+	}
+
+
+	/*!
+	\brief
+		Appends to the String the given c-string.
+
+	\param c_str
+		c-string that is to be appended.
+
+	\return
+		This String after the append operation
+
+	\exception std::length_error	Thrown if resulting String would be too large.
+	*/
+	String& append(const char* cstr)
+	{
+		return append(cstr, strlen(cstr));
+	}
+
+
+	/*!
+	\brief
+		Appends to the String chars from the given char array.
+
+	\param chars
+		char array holding the chars that are to be appended
+
+	\param chars_len
+		Number of chars to be appended
+
+	\return
+		This String after the append operation
+
+	\exception std::length_error	Thrown if resulting String would be too large, or if \a chars_len was 'npos'
+	*/
+	String& append(const char* chars, size_type chars_len)
+	{
+		if (chars_len == npos)
+			throw std::length_error("Length for char array can not be 'npos'");
+
+		size_type newsz = d_cplength + chars_len;
+
+		grow(newsz);
+
+		utf32* pt = &ptr()[newsz-1];
+
+		while(chars_len--)
+			*pt-- = static_cast<utf32>(static_cast<unsigned char>(chars[chars_len]));
+
+		setlen(newsz);
+
+		return *this;
+	}
+
+
+	//////////////////////////////////////////////////////////////////////////
+	// Insertion Functions
+	//////////////////////////////////////////////////////////////////////////
+	/*!
+	\brief
+		Inserts the given String object at the specified position.
+
+	\param idx
+		Index where the string is to be inserted.
+
+	\param str
+		String object that is to be inserted.
+
+	\return
+		This String after the insert.
+
+	\exception std::out_of_range	Thrown if \a idx is invalid for this String.
+	\exception std::length_error	Thrown if resulting String would be too large.
+	*/
+	String&	insert(size_type idx, const String& str)
+	{
+		return insert(idx, str, 0, npos);
+	}
+
+	/*!
+	\brief
+		Inserts a sub-string of the given String object at the specified position.
+
+	\param idx
+		Index where the string is to be inserted.
+
+	\param str
+		String object containing data to be inserted.
+
+	\param str_idx
+		Index of the first code point from \a str to be inserted.
+
+	\param str_num
+		Maximum number of code points from \a str to be inserted.
+
+	\return
+		This String after the insert.
+
+	\exception std::out_of_range	Thrown if \a idx or \a str_idx are out of range.
+	\exception std::length_error	Thrown if resulting String would be too large.
+	*/
+	String& insert(size_type idx, const String& str, size_type str_idx, size_type str_num)
+	{
+		if ((d_cplength < idx) || (str.d_cplength < str_idx))
+			throw std::out_of_range("Index is out of range for CEGUI::String");
+
+		if (str_num == npos)
+			str_num = str.d_cplength - str_idx;
+
+		size_type newsz = d_cplength + str_num;
+		grow(newsz);
+		memmove(&ptr()[idx + str_num], &ptr()[idx], (d_cplength - idx) * sizeof(utf32));
+		memcpy(&ptr()[idx], &str.ptr()[str_idx], str_num * sizeof(utf32));
+		setlen(newsz);
+
+		return *this;
+	}
+
+	/*!
+	\brief
+		Inserts the given std::string object at the specified position.
+
+	\param idx
+		Index where the std::string is to be inserted.
+
+	\param std_str
+		std::string object that is to be inserted.
+
+	\note
+		The characters of \a std_str are taken to be unencoded data which represent Unicode code points 0x00..0xFF.  No translation of
+		the provided data will occur.
+
+	\return
+		This String after the insert.
+
+	\exception std::out_of_range	Thrown if \a idx is invalid for this String.
+	\exception std::length_error	Thrown if resulting String would be too large.
+	*/
+	String&	insert(size_type idx, const std::string& std_str)
+	{
+		return insert(idx, std_str, 0, npos);
+	}
+
+	/*!
+	\brief
+		Inserts a sub-string of the given std::string object at the specified position.
+
+	\param idx
+		Index where the string is to be inserted.
+
+	\param std_str
+		std::string object containing data to be inserted.
+
+	\note
+		The characters of \a std_str are taken to be unencoded data which represent Unicode code points 0x00..0xFF.  No translation of
+		the provided data will occur.
+
+	\param str_idx
+		Index of the first character from \a std_str to be inserted.
+
+	\param str_num
+		Maximum number of characters from \a str to be inserted.
+
+	\return
+		This String after the insert.
+
+	\exception std::out_of_range	Thrown if \a idx or \a str_idx are out of range.
+	\exception std::length_error	Thrown if resulting String would be too large.
+	*/
+	String& insert(size_type idx, const std::string& std_str, size_type str_idx, size_type str_num)
+	{
+		if (d_cplength < idx)
+			throw std::out_of_range("Index is out of range for CEGUI::String");
+
+		if (std_str.size() < str_idx)
+			throw std::out_of_range("Index is out of range for std::string");
+
+		if (str_num == npos)
+			str_num = (size_type)std_str.size() - str_idx;
+
+		size_type newsz = d_cplength + str_num;
+		grow(newsz);
+
+		memmove(&ptr()[idx + str_num], &ptr()[idx], (d_cplength - idx) * sizeof(utf32));
+
+		utf32* pt = &ptr()[idx + str_num - 1];
+		
+		while(str_num--)
+			*pt-- = static_cast<utf32>(static_cast<unsigned char>(std_str[str_idx + str_num]));
+
+		setlen(newsz);
+
+		return *this;
+	}
+
+	/*!
+	\brief
+		Inserts the given null-terminated utf8 encoded data at the specified position.
+
+	\param idx
+		Index where the data is to be inserted.
+
+	\param utf8_str
+		Buffer containing the null-terminated utf8 encoded data that is to be inserted.
+
+	\note
+		A basic string literal (cast to utf8*) can be passed to this function, provided that the string is
+		comprised only of code points 0x00..0x7f.  The use of extended ASCII characters (with values >0x7f)
+		would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable
+		results.
+
+	\return
+		This String after the insert.
+
+	\exception std::out_of_range	Thrown if \a idx is invalid for this String.
+	\exception std::length_error	Thrown if resulting String would be too large.
+	*/
+	String&	insert(size_type idx, const utf8* utf8_str)
+	{
+		return insert(idx, utf8_str, utf_length(utf8_str));
+	}
+
+	/*!
+	\brief
+		Inserts the given utf8 encoded data at the specified position.
+
+	\param idx
+		Index where the data is to be inserted.
+
+	\param utf8_str
+		Buffer containing the utf8 encoded data that is to be inserted.
+
+	\note
+		A basic string literal (cast to utf8*) can be passed to this function, provided that the string is
+		comprised only of code points 0x00..0x7f.  The use of extended ASCII characters (with values >0x7f)
+		would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable
+		results.
+
+	\param len
+		Length of the data to be inserted in uf8 code units (not code points)
+
+	\return
+		This String after the insert.
+
+	\exception std::out_of_range	Thrown if \a idx is invalid for this String.
+	\exception std::length_error	Thrown if resulting String would be too large, or if \a len is 'npos'
+	*/
+	String& insert(size_type idx, const utf8* utf8_str, size_type len)
+	{
+		if (d_cplength < idx)
+			throw std::out_of_range("Index is out of range for CEGUI::String");
+
+		if (len == npos)
+			throw std::length_error("Length of utf8 encoded string can not be 'npos'");
+
+		size_type encsz = encoded_size(utf8_str, len);
+		size_type newsz = d_cplength + encsz;
+
+		grow(newsz);
+		memmove(&ptr()[idx + encsz], &ptr()[idx], (d_cplength - idx) * sizeof(utf32));
+		encode(utf8_str, &ptr()[idx], encsz, len);
+		setlen(newsz);
+
+		return *this;
+	}
+
+	/*!
+	\brief
+		Inserts a code point multiple times into the String
+
+	\param idx
+		Index where the code point(s) are to be inserted
+
+	\param num
+		The number of times to insert the code point
+
+	\param code_point
+		The utf32 code point that is to be inserted
+
+	\return
+		This String after the insertion.
+
+	\exception std::out_of_range	Thrown if \a idx is invalid for this String.
+	\exception std::length_error	Thrown if resulting String would be too large, or if \a num is 'npos'
+	*/
+	String& insert(size_type idx, size_type num, utf32 code_point)
+	{
+		if (d_cplength < idx)
+			throw std::out_of_range("Index is out of range for CEGUI::String");
+
+		if (num == npos)
+			throw std::length_error("Code point count can not be 'npos'");
+
+		size_type newsz = d_cplength + num;
+		grow(newsz);
+
+		memmove(&ptr()[idx + num], &ptr()[idx], (d_cplength - idx) * sizeof(utf32));
+
+		utf32* pt = &ptr()[idx + num - 1];
+
+		while(num--)
+			*pt-- = code_point;
+
+		setlen(newsz);
+
+		return *this;
+	}
+
+	/*!
+	\brief
+		Inserts a code point multiple times into the String
+
+	\param pos
+		Iterator describing the position where the code point(s) are to be inserted
+
+	\param num
+		The number of times to insert the code point
+
+	\param code_point
+		The utf32 code point that is to be inserted
+
+	\return
+		This String after the insertion.
+
+	\exception std::length_error	Thrown if resulting String would be too large, or if \a num is 'npos'
+	*/
+	void insert(iterator pos, size_type num, utf32 code_point)
+	{
+		insert(safe_iter_dif(pos, begin()), num, code_point);
+	}
+
+	/*!
+	\brief
+		Inserts a single code point into the String
+
+	\param pos
+		Iterator describing the position where the code point is to be inserted
+
+	\param code_point
+		The utf32 code point that is to be inserted
+
+	\return
+		This String after the insertion.
+
+	\exception std::length_error	Thrown if resulting String would be too large.
+	*/
+	iterator insert(iterator pos, utf32 code_point)
+	{
+		insert(pos, 1, code_point);
+		return pos;
+	}
+
+	/*!
+	\brief
+		Inserts code points specified by the range [beg, end).
+
+	\param pos
+		Iterator describing the position where the data is to be inserted
+
+	\param beg
+		Iterator describing the begining of the range to be inserted
+
+	\param end
+		Iterator describing the (exclusive) end of the range to be inserted.
+
+	\return
+		Nothing.
+
+	\exception std::length_error	Thrown if resulting String would be too large.
+	*/
+	void	insert(iterator iter_pos, const_iterator iter_beg, const_iterator iter_end)
+	{
+		replace(iter_pos, iter_pos, iter_beg, iter_end);
+	}
+
+
+	/*!
+	\brief
+		Inserts the given c-string at the specified position.
+
+	\param idx
+		Index where the c-string is to be inserted.
+
+	\param c_str
+		c-string that is to be inserted.
+
+	\return
+		This String after the insert.
+
+	\exception std::out_of_range	Thrown if \a idx is invalid for this String.
+	\exception std::length_error	Thrown if resulting String would be too large.
+	*/
+	String&	insert(size_type idx, const char* cstr)
+	{
+		return insert(idx, cstr, strlen(cstr));
+	}
+
+
+	/*!
+	\brief
+		Inserts chars from the given char array at the specified position.
+
+	\param idx
+		Index where the data is to be inserted.
+
+	\param chars
+		char array containing the chars that are to be inserted.
+
+	\param chars_len
+		Length of the char array to be inserted.
+
+	\return
+		This String after the insert.
+
+	\exception std::out_of_range	Thrown if \a idx is invalid for this String.
+	\exception std::length_error	Thrown if resulting String would be too large, or if \a chars_len is 'npos'
+	*/
+	String& insert(size_type idx, const char* chars, size_type chars_len)
+	{
+		if (d_cplength < idx)
+			throw std::out_of_range("Index is out of range for CEGUI::String");
+
+		if (chars_len == npos)
+			throw std::length_error("Length of char array can not be 'npos'");
+
+		size_type newsz = d_cplength + chars_len;
+
+		grow(newsz);
+		memmove(&ptr()[idx + chars_len], &ptr()[idx], (d_cplength - idx) * sizeof(utf32));
+
+		utf32* pt = &ptr()[idx + chars_len - 1];
+
+		while(chars_len--)
+			*pt-- = static_cast<utf32>(static_cast<unsigned char>(chars[chars_len]));
+
+		setlen(newsz);
+
+		return *this;
+	}
+
+
+	//////////////////////////////////////////////////////////////////////////
+	// Erasing characters
+	//////////////////////////////////////////////////////////////////////////
+	/*!
+	\brief
+		Removes all data from the String
+
+	\return
+		Nothing
+	*/
+	void	clear(void)
+	{
+		setlen(0);
+		trim();
+	}
+
+	/*!
+	\brief
+		Removes all data from the String
+
+	\return
+		The empty String (*this)
+	*/
+	String& erase(void)
+	{
+		clear();
+		return *this;
+	}
+
+	/*!
+	\brief
+		Erase a single code point from the string
+
+	\param idx
+		The index of the code point to be removed.
+
+	\return
+		This String after the erase operation
+
+	\exception std::out_of_range	Thrown if \a idx is invalid for this String.
+	*/
+	String&	erase(size_type idx)
+	{
+		return erase(idx, 1);
+	}
+
+	/*!
+	\brief
+		Erase a range of code points
+
+	\param idx
+		Index of the first code point to be removed.
+
+	\param len
+		Maximum number of code points to be removed.
+
+	\return
+		This String after the erase operation.
+
+	\exception std::out_of_range	Thrown if \a idx is invalid for this String.
+	*/
+	String& erase(size_type idx, size_type len = npos)
+	{
+		if (d_cplength < idx)
+			throw std::out_of_range("Index is out of range foe CEGUI::String");
+
+		if (len == npos)
+			len = d_cplength - idx;
+
+		size_type newsz = d_cplength - len;
+
+		memmove(&ptr()[idx], &ptr()[idx + len], (d_cplength - idx - len) * sizeof(utf32));
+		setlen(newsz);
+		return	*this;
+	}
+
+	/*!
+	\brief
+		Erase the code point described by the given iterator
+
+	\param pos
+		Iterator describing the code point to be erased
+
+	\return
+		This String after the erase operation.
+	*/
+	String& erase(iterator pos)
+	{
+		return erase(safe_iter_dif(pos, begin()), 1);
+	}
+
+	/*!
+	\brief
+		Erase a range of code points described by the iterators [beg, end).
+
+	\param beg
+		Iterator describing the postion of the beginning of the range to erase
+
+	\param end
+		Iterator describing the postion of the (exclusive) end of the range to erase
+
+	\return
+		This String after the erase operation.
+	*/
+	String& erase(iterator iter_beg, iterator iter_end)
+	{
+		return erase(safe_iter_dif(iter_beg, begin()), safe_iter_dif(iter_end, iter_beg));
+	}
+
+	//////////////////////////////////////////////////////////////////////////
+	// Resizing
+	//////////////////////////////////////////////////////////////////////////
+	/*!
+	\brief
+		Resizes the String either by inserting default utf32 code points to make it larger, or by truncating to make it smaller
+
+	\param num
+		The length, in code points, that the String is to be made.
+
+	\return
+		Nothing.
+
+	\exception std::length_error	Thrown if the String would be too large.
+	*/
+	void	resize(size_type num)
+	{
+		resize(num, utf32());
+	}
+
+	/*!
+	\brief
+		Resizes the String either by inserting the given utf32 code point to make it larger, or by truncating to make it smaller
+
+	\param num
+		The length, in code points, that the String is to be made.
+
+	\param code_point
+		The utf32 code point that should be used when majing the String larger
+
+	\return
+		Nothing.
+
+	\exception std::length_error	Thrown if the String would be too large.
+	*/
+	void	resize(size_type num, utf32 code_point)
+	{
+		if (num < d_cplength)
+		{
+			setlen(num);
+		}
+		else
+		{
+			append(num - d_cplength, code_point);
+		}
+
+	}
+
+	//////////////////////////////////////////////////////////////////////////
+	// Replacing Characters
+	//////////////////////////////////////////////////////////////////////////
+	/*!
+	\brief
+		Replace code points in the String with the specified String object
+
+	\param idx
+		Index of the first code point to be replaced
+
+	\param len
+		Maximum number of code points to be replaced (if this is 0, operation is an insert at position \a idx)
+
+	\param str
+		The String object that is to replace the specified code points
+
+	\return
+		This String after the replace operation
+
+	\exception std::out_of_range	Thrown if \a idx is invalid for this String
+	\exception std::length_error	Thrown if the resulting String would be too large.
+	*/
+	String& replace(size_type idx, size_type len, const String& str)
+	{
+		return replace(idx, len, str, 0, npos);
+	}
+
+	/*!
+	\brief
+		Replace the code points in the range [beg, end) with the specified String object
+
+	\note
+		If \a beg == \a end, the operation is a insert at iterator position \a beg
+
+	\param beg
+		Iterator describing the start of the range to be replaced
+
+	\param end
+		Iterator describing the (exclusive) end of the range to be replaced.
+
+	\param str
+		The String object that is to replace the specified range of code points
+
+	\return
+		This String after the replace operation
+
+	\exception std::length_error	Thrown if the resulting String would be too large.
+	*/
+	String& replace(iterator iter_beg, iterator iter_end, const String& str)
+	{
+		return replace(safe_iter_dif(iter_beg, begin()), safe_iter_dif(iter_end, iter_beg), str, 0, npos);
+	}
+
+	/*!
+	\brief
+		Replace code points in the String with a specified sub-string of a given String object.
+
+	\param idx
+		Index of the first code point to be replaced
+
+	\param len
+		Maximum number of code points to be replaced.  If this is 0, the operation is an insert at position \a idx.
+
+	\param str
+		String object containing the data that will replace the specified range of code points
+
+	\param str_idx
+		Index of the first code point of \a str that is to replace the specified code point range
+
+	\param str_num
+		Maximum number of code points of \a str that are to replace the specified code point range
+
+	\return
+		This String after the replace operation
+
+	\exception std::out_of_range	Thrown if either \a idx, or \a str_idx are invalid
+	\exception std::length_error	Thrown if the resulting String would have been too large.
+	*/
+	String& replace(size_type idx, size_type len, const String& str, size_type str_idx, size_type str_num)
+	{
+		if ((d_cplength < idx) || (str.d_cplength < str_idx))
+			throw std::out_of_range("Index is out of range for CEGUI::String");
+
+		if (((str_idx + str_num) > str.d_cplength) || (str_num == npos))
+			str_num = str.d_cplength - str_idx;
+
+		if (((len + idx) > d_cplength) || (len == npos))
+			len = d_cplength - idx;
+
+		size_type newsz = d_cplength + str_num - len;
+
+		grow(newsz);
+
+		if ((idx + len) < d_cplength)
+			memmove(&ptr()[idx + str_num], &ptr()[len + idx], (d_cplength - idx - len) * sizeof(utf32));
+
+		memcpy(&ptr()[idx], &str.ptr()[str_idx], str_num * sizeof(utf32));
+		setlen(newsz);
+
+		return *this;
+	}
+
+
+	/*!
+	\brief
+		Replace code points in the String with the specified std::string object
+
+	\param idx
+		Index of the first code point to be replaced
+
+	\param len
+		Maximum number of code points to be replaced (if this is 0, operation is an insert at position \a idx)
+
+	\param std_str
+		The std::string object that is to replace the specified code points
+
+	\note
+		Characters from \a std_str are considered to represent Unicode code points in the range 0x00..0xFF.  No translation of
+		the encountered data is performed.
+
+	\return
+		This String after the replace operation
+
+	\exception std::out_of_range	Thrown if \a idx is invalid for this String
+	\exception std::length_error	Thrown if the resulting String would be too large.
+	*/
+	String& replace(size_type idx, size_type len, const std::string& std_str)
+	{
+		return replace(idx, len, std_str, 0, npos);
+	}
+
+	/*!
+	\brief
+		Replace the code points in the range [beg, end) with the specified std::string object
+
+	\note
+		If \a beg == \a end, the operation is a insert at iterator position \a beg
+
+	\param beg
+		Iterator describing the start of the range to be replaced
+
+	\param end
+		Iterator describing the (exclusive) end of the range to be replaced.
+
+	\param std_str
+		The std::string object that is to replace the specified range of code points
+
+	\note
+		Characters from \a std_str are considered to represent Unicode code points in the range 0x00..0xFF.  No translation of
+		the encountered data is performed.
+
+	\return
+		This String after the replace operation
+
+	\exception std::length_error	Thrown if the resulting String would be too large.
+	*/
+	String& replace(iterator iter_beg, iterator iter_end, const std::string& std_str)
+	{
+		return replace(safe_iter_dif(iter_beg, begin()), safe_iter_dif(iter_end, iter_beg), std_str, 0, npos);
+	}
+
+	/*!
+	\brief
+		Replace code points in the String with a specified sub-string of a given std::string object.
+
+	\param idx
+		Index of the first code point to be replaced
+
+	\param len
+		Maximum number of code points to be replaced.  If this is 0, the operation is an insert at position \a idx.
+
+	\param std_str
+		std::string object containing the data that will replace the specified range of code points
+
+	\note
+		Characters from \a std_str are considered to represent Unicode code points in the range 0x00..0xFF.  No translation of
+		the encountered data is performed.
+
+	\param str_idx
+		Index of the first code point of \a std_str that is to replace the specified code point range
+
+	\param str_num
+		Maximum number of code points of \a std_str that are to replace the specified code point range
+
+	\return
+		This String after the replace operation
+
+	\exception std::out_of_range	Thrown if either \a idx, or \a str_idx are invalid
+	\exception std::length_error	Thrown if the resulting String would have been too large.
+	*/
+	String& replace(size_type idx, size_type len, const std::string& std_str, size_type str_idx, size_type str_num)
+	{
+		if (d_cplength < idx)
+			throw std::out_of_range("Index is out of range for CEGUI::String");
+
+		if (std_str.size() < str_idx)
+			throw std::out_of_range("Index is out of range for std::string");
+
+		if (((str_idx + str_num) > std_str.size()) || (str_num == npos))
+			str_num = (size_type)std_str.size() - str_idx;
+
+		if (((len + idx) > d_cplength) || (len == npos))
+			len = d_cplength - idx;
+
+		size_type newsz = d_cplength + str_num - len;
+
+		grow(newsz);
+
+		if ((idx + len) < d_cplength)
+			memmove(&ptr()[idx + str_num], &ptr()[len + idx], (d_cplength - idx - len) * sizeof(utf32));
+
+		utf32* pt = &ptr()[idx + str_num - 1];
+
+		while (str_num--)
+			*pt-- = static_cast<utf32>(static_cast<unsigned char>(std_str[str_idx + str_num]));
+
+		setlen(newsz);
+
+		return *this;
+	}
+
+
+	/*!
+	\brief
+		Replace code points in the String with the specified null-terminated utf8 encoded data.
+
+	\param idx
+		Index of the first code point to be replaced
+
+	\param len
+		Maximum number of code points to be replaced (if this is 0, operation is an insert at position \a idx)
+
+	\param utf8_str
+		Buffer containing the null-terminated utf8 encoded data that is to replace the specified code points
+
+	\note
+		A basic string literal (cast to utf8*) can be passed to this function, provided that the string is
+		comprised only of code points 0x00..0x7f.  The use of extended ASCII characters (with values >0x7f)
+		would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable
+		results.
+
+	\return
+		This String after the replace operation
+
+	\exception std::out_of_range	Thrown if \a idx is invalid for this String
+	\exception std::length_error	Thrown if the resulting String would be too large.
+	*/
+	String& replace(size_type idx, size_type len, const utf8* utf8_str)
+	{
+		return replace(idx, len, utf8_str, utf_length(utf8_str));
+	}
+
+	/*!
+	\brief
+		Replace the code points in the range [beg, end) with the specified null-terminated utf8 encoded data.
+
+	\note
+		If \a beg == \a end, the operation is a insert at iterator position \a beg
+
+	\param beg
+		Iterator describing the start of the range to be replaced
+
+	\param end
+		Iterator describing the (exclusive) end of the range to be replaced.
+
+	\param utf8_str
+		Buffer containing the null-terminated utf8 encoded data that is to replace the specified range of code points
+
+	\note
+		A basic string literal (cast to utf8*) can be passed to this function, provided that the string is
+		comprised only of code points 0x00..0x7f.  The use of extended ASCII characters (with values >0x7f)
+		would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable
+		results.
+
+	\return
+		This String after the replace operation
+
+	\exception std::length_error	Thrown if the resulting String would be too large.
+	*/
+	String& replace(iterator iter_beg, iterator iter_end, const utf8* utf8_str)
+	{
+		return replace(iter_beg, iter_end, utf8_str, utf_length(utf8_str));
+	}
+
+	/*!
+	\brief
+		Replace code points in the String with the specified utf8 encoded data.
+
+	\param idx
+		Index of the first code point to be replaced
+
+	\param len
+		Maximum number of code points to be replaced (if this is 0, operation is an insert at position \a idx)
+
+	\param utf8_str
+		Buffer containing the null-terminated utf8 encoded data that is to replace the specified code points
+
+	\note
+		A basic string literal (cast to utf8*) can be passed to this function, provided that the string is
+		comprised only of code points 0x00..0x7f.  The use of extended ASCII characters (with values >0x7f)
+		would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable
+		results.
+
+	\param str_len
+		Length of the utf8 encoded data in utf8 code units (not code points).
+
+	\return
+		This String after the replace operation
+
+	\exception std::out_of_range	Thrown if \a idx is invalid for this String
+	\exception std::length_error	Thrown if the resulting String would be too large, or if \a str_len was 'npos'.
+	*/
+	String& replace(size_type idx, size_type len, const utf8* utf8_str, size_type str_len)
+	{
+		if (d_cplength < idx)
+			throw std::out_of_range("Index is out of range for CEGUI::String");
+
+		if (str_len == npos)
+			throw std::length_error("Length for utf8 encoded string can not be 'npos'");
+
+		if (((len + idx) > d_cplength) || (len == npos))
+			len = d_cplength - idx;
+
+		size_type encsz = encoded_size(utf8_str, str_len);
+		size_type newsz = d_cplength + encsz - len;
+
+		grow(newsz);
+
+		if ((idx + len) < d_cplength)
+			memmove(&ptr()[idx + encsz], &ptr()[len + idx], (d_cplength - idx - len) * sizeof(utf32));
+
+		encode(utf8_str, &ptr()[idx], encsz, str_len);
+
+		setlen(newsz);
+		return *this;
+	}
+
+	/*!
+	\brief
+		Replace the code points in the range [beg, end) with the specified null-terminated utf8 encoded data.
+
+	\note
+		If \a beg == \a end, the operation is a insert at iterator position \a beg
+
+	\param beg
+		Iterator describing the start of the range to be replaced
+
+	\param end
+		Iterator describing the (exclusive) end of the range to be replaced.
+
+	\param utf8_str
+		Buffer containing the null-terminated utf8 encoded data that is to replace the specified range of code points
+
+	\note
+		A basic string literal (cast to utf8*) can be passed to this function, provided that the string is
+		comprised only of code points 0x00..0x7f.  The use of extended ASCII characters (with values >0x7f)
+		would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable
+		results.
+
+	\param str_len
+		Length of the utf8 encoded data in utf8 code units (not code points).
+
+	\return
+		This String after the replace operation
+
+		\exception std::length_error	Thrown if the resulting String would be too large, or if \a str_len was 'npos'.
+	*/
+	String& replace(iterator iter_beg, iterator iter_end, const utf8* utf8_str, size_type str_len)
+	{
+		return replace(safe_iter_dif(iter_beg, begin()), safe_iter_dif(iter_end, iter_beg), utf8_str, str_len);
+	}
+
+	/*!
+	\brief
+		Replaces a specified range of code points with occurrences of a given code point
+
+	\param idx
+		Index of the first code point to be replaced
+
+	\param len
+		Maximum number of code points to replace.  If this is 0 the operation is an insert
+
+	\param num
+		Number of occurrences of \a code_point that are to replace the specified range of code points
+
+	\param code_point
+		Code point that is to be used when replacing the specified range of code points
+
+	\return
+		This String after the replace operation.
+
+	\exception std::out_of_range	Thrown if \a idx is invalid for this String
+	\exception std::length_error	Thrown if resulting String would have been too long, or if \a num was 'npos'.
+	*/
+	String& replace(size_type idx, size_type len, size_type num, utf32 code_point)
+	{
+		if (d_cplength < idx)
+			throw std::out_of_range("Index is out of range for CEGUI::String");
+
+		if (num == npos)
+			throw std::length_error("Code point count can not be 'npos'");
+
+		if (((len + idx) > d_cplength) || (len == npos))
+			len = d_cplength - idx;
+
+		size_type newsz = d_cplength + num - len;
+
+		grow(newsz);
+
+		if ((idx + len) < d_cplength)
+			memmove(&ptr()[idx + num], &ptr()[len + idx], (d_cplength - idx - len) * sizeof(utf32));
+
+		utf32* pt = &ptr()[idx + num - 1];
+
+		while (num--)
+			*pt-- = code_point;
+
+		setlen(newsz);
+
+		return *this;
+	}
+
+	/*!
+	\brief
+		Replace the code points in the range [beg, end) with occurrences of a given code point
+
+	\note
+		If \a beg == \a end, the operation is an insert at iterator position \a beg
+
+	\param beg
+		Iterator describing the start of the range to be replaced
+
+	\param end
+		Iterator describing the (exclusive) end of the range to be replaced.
+
+	\param num
+		Number of occurrences of \a code_point that are to replace the specified range of code points
+
+	\param code_point
+		Code point that is to be used when replacing the specified range of code points
+
+	\return
+		This String after the replace operation
+
+	\exception std::length_error	Thrown if resulting String would have been too long, or if \a num was 'npos'.
+	*/
+	String& replace(iterator iter_beg, iterator iter_end, size_type num, utf32 code_point)
+	{
+		return replace(safe_iter_dif(iter_beg, begin()), safe_iter_dif(iter_end, iter_beg), num, code_point);
+	}
+
+
+	/*!
+	\brief
+		Replace the code points in the range [beg, end) with code points from the range [newBeg, newEnd).
+
+	\note
+		If \a beg == \a end, the operation is an insert at iterator position \a beg
+
+	\param beg
+		Iterator describing the start of the range to be replaced
+
+	\param end
+		Iterator describing the (exclusive) end of the range to be replaced.
+
+	\param newBeg
+		Iterator describing the beginning of the range to insert.
+
+	\param newEnd	
+		Iterator describing the (exclusive) end of the range to insert.
+
+	\return
+		This String after the insert operation.
+
+	\exception std::length_error	Thrown if the resulting string would be too long.
+	*/
+	String& replace(iterator iter_beg, iterator iter_end, const_iterator iter_newBeg, const_iterator iter_newEnd)
+	{
+		if (iter_beg == iter_end)
+		{
+			erase(safe_iter_dif(iter_beg, begin()), safe_iter_dif(iter_end, iter_beg));
+		}
+		else
+		{
+			size_type str_len = safe_iter_dif(iter_newEnd, iter_newBeg);
+			size_type idx = safe_iter_dif(iter_beg, begin());
+			size_type len = safe_iter_dif(iter_end, iter_beg);
+
+			if ((len + idx) > d_cplength)
+				len = d_cplength - idx;
+
+			size_type newsz = d_cplength + str_len - len;
+
+			grow(newsz);
+
+			if ((idx + len) < d_cplength)
+				memmove(&ptr()[idx + str_len], &ptr()[len + idx], (d_cplength - idx - len) * sizeof(utf32));
+
+			memcpy(&ptr()[idx], iter_newBeg.d_ptr, str_len * sizeof(utf32));
+			setlen(newsz);
+		}
+
+		return *this;
+	}
+
+
+	/*!
+	\brief
+		Replace code points in the String with the specified c-string.
+
+	\param idx
+		Index of the first code point to be replaced
+
+	\param len
+		Maximum number of code points to be replaced (if this is 0, operation is an insert at position \a idx)
+
+	\param c_str
+		c-string that is to replace the specified code points
+
+	\return
+		This String after the replace operation
+
+	\exception std::out_of_range	Thrown if \a idx is invalid for this String
+	\exception std::length_error	Thrown if the resulting String would be too large.
+	*/
+	String& replace(size_type idx, size_type len, const char* cstr)
+	{
+		return replace(idx, len, cstr, strlen(cstr));
+	}
+
+
+	/*!
+	\brief
+		Replace the code points in the range [beg, end) with the specified c-string.
+
+	\note
+		If \a beg == \a end, the operation is a insert at iterator position \a beg
+
+	\param beg
+		Iterator describing the start of the range to be replaced
+
+	\param end
+		Iterator describing the (exclusive) end of the range to be replaced.
+
+	\param c_str
+		c-string that is to replace the specified range of code points
+
+	\return
+		This String after the replace operation
+
+	\exception std::length_error	Thrown if the resulting String would be too large.
+	*/
+	String& replace(iterator iter_beg, iterator iter_end, const char* cstr)
+	{
+		return replace(iter_beg, iter_end, cstr, strlen(cstr));
+	}
+
+
+	/*!
+	\brief
+		Replace code points in the String with chars from the given char array.
+
+	\param idx
+		Index of the first code point to be replaced
+
+	\param len
+		Maximum number of code points to be replaced (if this is 0, operation is an insert at position \a idx)
+
+	\param chars
+		char array containing the cars that are to replace the specified code points
+
+	\param chars_len
+		Number of chars in the char array.
+
+	\return
+		This String after the replace operation
+
+	\exception std::out_of_range	Thrown if \a idx is invalid for this String
+	\exception std::length_error	Thrown if the resulting String would be too large, or if \a chars_len was 'npos'.
+	*/
+	String& replace(size_type idx, size_type len, const char* chars, size_type chars_len)
+	{
+		if (d_cplength < idx)
+			throw std::out_of_range("Index is out of range for CEGUI::String");
+
+		if (chars_len == npos)
+			throw std::length_error("Length for the char array can not be 'npos'");
+
+		if (((len + idx) > d_cplength) || (len == npos))
+			len = d_cplength - idx;
+
+		size_type newsz = d_cplength + chars_len - len;
+
+		grow(newsz);
+
+		if ((idx + len) < d_cplength)
+			memmove(&ptr()[idx + chars_len], &ptr()[len + idx], (d_cplength - idx - len) * sizeof(utf32));
+
+		utf32* pt = &ptr()[idx + chars_len - 1];
+
+		while (chars_len--)
+			*pt-- = static_cast<utf32>(static_cast<unsigned char>(chars[chars_len]));
+
+		setlen(newsz);
+		return *this;
+	}
+
+
+	/*!
+	\brief
+		Replace the code points in the range [beg, end) with chars from the given char array.
+
+	\note
+		If \a beg == \a end, the operation is a insert at iterator position \a beg
+
+	\param beg
+		Iterator describing the start of the range to be replaced
+
+	\param end
+		Iterator describing the (exclusive) end of the range to be replaced.
+
+	\param chars
+		char array containing the chars that are to replace the specified range of code points
+
+	\param chars_len
+		Number of chars in the char array.
+
+	\return
+		This String after the replace operation
+
+	\exception std::length_error	Thrown if the resulting String would be too large, or if \a chars_len was 'npos'.
+	*/
+	String& replace(iterator iter_beg, iterator iter_end, const char* chars, size_type chars_len)
+	{
+		return replace(safe_iter_dif(iter_beg, begin()), safe_iter_dif(iter_end, iter_beg), chars, chars_len);
+	}
+
+
+	//////////////////////////////////////////////////////////////////////////
+	// Find a code point
+	//////////////////////////////////////////////////////////////////////////
+	/*!
+	\brief
+		Search forwards for a given code point
+
+	\param code_point
+		The utf32 code point to search for
+
+	\param idx
+		Index of the code point where the search is to start.
+
+	\return
+		- Index of the first occurrence of \a code_point travelling forwards from \a idx.
+		- npos if the code point could not be found
+	*/
+	size_type	find(utf32 code_point, size_type idx = 0) const
+	{
+		if (idx < d_cplength)
+		{
+			const utf32* pt = &ptr()[idx];
+
+			while (idx < d_cplength)
+			{
+				if (*pt++ == code_point)
+					return idx;
+
+				++idx;
+			}
+
+		}
+
+		return npos;
+	}
+
+	/*!
+	\brief
+		Search backwards for a given code point
+
+	\param code_point
+		The utf32 code point to search for
+
+	\param idx
+		Index of the code point where the search is to start.
+
+	\return
+		- Index of the first occurrence of \a code_point travelling backwards from \a idx.
+		- npos if the code point could not be found
+	*/
+	size_type	rfind(utf32 code_point, size_type idx = npos) const
+	{
+		if (idx >= d_cplength)
+			idx = d_cplength - 1;
+
+		if (d_cplength > 0)
+		{
+			const utf32* pt = &ptr()[idx];
+
+			do
+			{
+				if (*pt-- == code_point)
+					return idx;
+
+			} while (idx-- != 0);
+
+		}
+
+		return npos;
+	}
+
+	//////////////////////////////////////////////////////////////////////////
+	// Find a substring
+	//////////////////////////////////////////////////////////////////////////
+	/*!
+	\brief
+		Search forwards for a sub-string
+
+	\param str
+		String object describing the sub-string to search for
+
+	\param idx
+		Index of the code point where the search is to start
+
+	\return
+		- Index of the first occurrence of sub-string \a str travelling forwards from \a idx.
+		- npos if the sub-string could not be found
+	*/
+	size_type	find(const String& str, size_type idx = 0) const
+	{
+		if ((str.d_cplength == 0) && (idx < d_cplength))
+			return idx;
+
+		if (idx < d_cplength)
+		{
+			// loop while search string could fit in to search area
+			while (d_cplength - idx >= str.d_cplength)
+			{
+				if (0 == compare(idx, str.d_cplength, str))
+					return idx;
+
+				++idx;
+			}
+
+		}
+
+		return npos;
+	}
+
+	/*!
+	\brief
+		Search backwards for a sub-string
+
+	\param str
+		String object describing the sub-string to search for
+
+	\param idx
+		Index of the code point where the search is to start
+
+	\return
+		- Index of the first occurrence of sub-string \a str travelling backwards from \a idx.
+		- npos if the sub-string could not be found
+	*/
+	size_type	rfind(const String& str, size_type idx = npos) const
+	{
+		if (str.d_cplength == 0)
+			return (idx < d_cplength) ? idx : d_cplength;
+
+		if (str.d_cplength <= d_cplength)
+		{
+			if (idx > (d_cplength - str.d_cplength))
+				idx = d_cplength - str.d_cplength;
+
+			do
+			{
+				if (0 == compare(idx, str.d_cplength, str))
+					return idx;
+
+			} while (idx-- != 0);
+
+		}
+
+		return npos;
+	}
+
+	/*!
+	\brief
+		Search forwards for a sub-string
+
+	\param std_str
+		std::string object describing the sub-string to search for
+
+	\note
+		Characters from \a std_str are considered to represent Unicode code points in the range 0x00..0xFF.  No translation of
+		the encountered data is performed.
+
+	\param idx
+		Index of the code point where the search is to start
+
+	\return
+		- Index of the first occurrence of sub-string \a std_str travelling forwards from \a idx.
+		- npos if the sub-string could not be found
+	*/
+	size_type	find(const std::string& std_str, size_type idx = 0) const
+	{
+		std::string::size_type sze = std_str.size();
+
+		if ((sze == 0) && (idx < d_cplength))
+			return idx;
+
+		if (idx < d_cplength)
+		{
+			// loop while search string could fit in to search area
+			while (d_cplength - idx >= sze)
+			{
+				if (0 == compare(idx, (size_type)sze, std_str))
+					return idx;
+
+				++idx;
+			}
+
+		}
+
+		return npos;
+	}
+
+	/*!
+	\brief
+		Search backwards for a sub-string
+
+	\param std_str
+		std::string object describing the sub-string to search for
+
+	\note
+		Characters from \a std_str are considered to represent Unicode code points in the range 0x00..0xFF.  No translation of
+		the encountered data is performed.
+
+	\param idx
+		Index of the code point where the search is to start
+
+	\return
+		- Index of the first occurrence of sub-string \a std_str travelling backwards from \a idx.
+		- npos if the sub-string could not be found
+	*/
+	size_type	rfind(const std::string& std_str, size_type idx = npos) const
+	{
+		std::string::size_type sze = std_str.size();
+
+		if (sze == 0)
+			return (idx < d_cplength) ? idx : d_cplength;
+
+		if (sze <= d_cplength)
+		{
+			if (idx > (d_cplength - sze))
+				idx = d_cplength - sze;
+
+			do
+			{
+				if (0 == compare(idx, (size_type)sze, std_str))
+					return idx;
+
+			} while (idx-- != 0);
+
+		}
+
+		return npos;
+	}
+
+	/*!
+	\brief
+		Search forwards for a sub-string
+
+	\param utf8_str
+		Buffer containing null-terminated utf8 encoded data describing the sub-string to search for
+
+	\note
+		A basic string literal (cast to utf8*) can be passed to this function, provided that the string is
+		comprised only of code points 0x00..0x7f.  The use of extended ASCII characters (with values >0x7f)
+		would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable
+		results.
+
+	\param idx
+		Index of the code point where the search is to start
+
+	\return
+		- Index of the first occurrence of sub-string \a utf8_str travelling forwards from \a idx.
+		- npos if the sub-string could not be found
+
+	\exception std::out_of_range	Thrown if \a idx is invalid for this String.
+	*/
+	size_type	find(const utf8* utf8_str, size_type idx = 0) const
+	{
+		return find(utf8_str, idx, utf_length(utf8_str));
+	}
+
+	/*!
+	\brief
+		Search backwards for a sub-string
+
+	\param utf8_str
+		Buffer containing null-terminated utf8 encoded data describing the sub-string to search for
+
+	\note
+		A basic string literal (cast to utf8*) can be passed to this function, provided that the string is
+		comprised only of code points 0x00..0x7f.  The use of extended ASCII characters (with values >0x7f)
+		would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable
+		results.
+
+	\param idx
+		Index of the code point where the search is to start
+
+	\return
+		- Index of the first occurrence of sub-string \a utf8_str travelling backwards from \a idx.
+		- npos if the sub-string could not be found
+
+	\exception std::out_of_range	Thrown if \a idx is invalid for this String.
+	*/
+	size_type	rfind(const utf8* utf8_str, size_type idx = npos) const
+	{
+		return rfind(utf8_str, idx, utf_length(utf8_str));
+	}
+
+	/*!
+	\brief
+		Search forwards for a sub-string
+
+	\param utf8_str
+		Buffer containing utf8 encoded data describing the sub-string to search for
+
+	\note
+		A basic string literal (cast to utf8*) can be passed to this function, provided that the string is
+		comprised only of code points 0x00..0x7f.  The use of extended ASCII characters (with values >0x7f)
+		would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable
+		results.
+
+	\param idx
+		Index of the code point where the search is to start
+
+	\param str_len
+		Length of the utf8 encoded sub-string in utf8 code units (not code points)
+
+	\return
+		- Index of the first occurrence of sub-string \a utf8_str travelling forwards from \a idx.
+		- npos if the sub-string could not be found
+
+	\exception std::length_error	Thrown if \a str_len is 'npos'
+	*/
+	size_type	find(const utf8* utf8_str, size_type idx, size_type str_len) const
+	{
+		if (str_len == npos)
+			throw std::length_error("Length for utf8 encoded string can not be 'npos'");
+
+		size_type sze = encoded_size(utf8_str, str_len);
+
+		if ((sze == 0) && (idx < d_cplength))
+			return idx;
+
+		if (idx < d_cplength)
+		{
+			// loop while search string could fit in to search area
+			while (d_cplength - idx >= sze)
+			{
+				if (0 == compare(idx, sze, utf8_str, sze))
+					return idx;
+
+				++idx;
+			}
+
+		}
+
+		return npos;
+	}
+
+	/*!
+	\brief
+		Search backwards for a sub-string
+
+	\param utf8_str
+		Buffer containing utf8 encoded data describing the sub-string to search for
+
+	\note
+		A basic string literal (cast to utf8*) can be passed to this function, provided that the string is
+		comprised only of code points 0x00..0x7f.  The use of extended ASCII characters (with values >0x7f)
+		would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable
+		results.
+
+	\param idx
+		Index of the code point where the search is to start
+
+	\param str_len
+		Length of the utf8 encoded sub-string in utf8 code units (not code points)
+
+	\return
+		- Index of the first occurrence of sub-string \a utf8_str travelling backwards from \a idx.
+		- npos if the sub-string could not be found
+
+	\exception std::length_error	Thrown if \a str_len is 'npos'
+	*/
+	size_type	rfind(const utf8* utf8_str, size_type idx, size_type str_len) const
+	{
+		if (str_len == npos)
+			throw std::length_error("Length for utf8 encoded string can not be 'npos'");
+
+		size_type sze = encoded_size(utf8_str, str_len);
+
+		if (sze == 0)
+			return (idx < d_cplength) ? idx : d_cplength;
+
+		if (sze <= d_cplength)
+		{
+			if (idx > (d_cplength - sze))
+				idx = d_cplength - sze;
+
+			do
+			{
+				if (0 == compare(idx, sze, utf8_str, sze))
+					return idx;
+
+			} while (idx-- != 0);
+
+		}
+
+		return npos;
+	}
+
+
+	/*!
+	\brief
+		Search forwards for a sub-string
+
+	\param c_str
+		c-string describing the sub-string to search for
+
+	\param idx
+		Index of the code point where the search is to start
+
+	\return
+		- Index of the first occurrence of sub-string \a c_str travelling forwards from \a idx.
+		- npos if the sub-string could not be found
+
+	\exception std::out_of_range	Thrown if \a idx is invalid for this String.
+	*/
+	size_type	find(const char* cstr, size_type idx = 0) const
+	{
+		return find(cstr, idx, strlen(cstr));
+	}
+
+
+	/*!
+	\brief
+		Search backwards for a sub-string
+
+	\param c_str
+		c-string describing the sub-string to search for
+
+	\param idx
+		Index of the code point where the search is to start
+
+	\return
+		- Index of the first occurrence of sub-string \a c_str travelling backwards from \a idx.
+		- npos if the sub-string could not be found
+
+	\exception std::out_of_range	Thrown if \a idx is invalid for this String.
+	*/
+	size_type	rfind(const char* cstr, size_type idx = npos) const
+	{
+		return rfind(cstr, idx, strlen(cstr));
+	}
+
+
+	/*!
+	\brief
+		Search forwards for a sub-string
+
+	\param chars
+		char array describing the sub-string to search for
+
+	\param idx
+		Index of the code point where the search is to start
+
+	\param chars_len
+		Number of chars in the char array.
+
+	\return
+		- Index of the first occurrence of sub-string \a chars travelling forwards from \a idx.
+		- npos if the sub-string could not be found
+
+	\exception std::length_error	Thrown if \a chars_len is 'npos'
+	*/
+	size_type	find(const char* chars, size_type idx, size_type chars_len) const
+	{
+		if (chars_len == npos)
+			throw std::length_error("Length for char array can not be 'npos'");
+
+		if ((chars_len == 0) && (idx < d_cplength))
+			return idx;
+
+		if (idx < d_cplength)
+		{
+			// loop while search string could fit in to search area
+			while (d_cplength - idx >= chars_len)
+			{
+				if (0 == compare(idx, chars_len, chars, chars_len))
+					return idx;
+
+				++idx;
+			}
+
+		}
+
+		return npos;
+	}
+
+
+	/*!
+	\brief
+		Search backwards for a sub-string
+
+	\param chars
+		char array describing the sub-string to search for
+
+	\param idx
+		Index of the code point where the search is to start
+
+	\param chars_len
+		Number of chars in the char array.
+
+	\return
+		- Index of the first occurrence of sub-string \a chars travelling backwards from \a idx.
+		- npos if the sub-string could not be found
+
+	\exception std::length_error	Thrown if \a chars_len is 'npos'
+	*/
+	size_type	rfind(const char* chars, size_type idx, size_type chars_len) const
+	{
+		if (chars_len == npos)
+			throw std::length_error("Length for char array can not be 'npos'");
+
+		if (chars_len == 0)
+			return (idx < d_cplength) ? idx : d_cplength;
+
+		if (chars_len <= d_cplength)
+		{
+			if (idx > (d_cplength - chars_len))
+				idx = d_cplength - chars_len;
+
+			do
+			{
+				if (0 == compare(idx, chars_len, chars, chars_len))
+					return idx;
+
+			} while (idx-- != 0);
+
+		}
+
+		return npos;
+	}
+
+
+	//////////////////////////////////////////////////////////////////////////
+	// Find first of different code-points
+	//////////////////////////////////////////////////////////////////////////
+	/*!
+	\brief
+		Find the first occurrence of one of a set of code points.
+
+	\param str
+		String object describing the set of code points.
+
+	\param idx
+		Index of the start point for the search
+
+	\return
+		- Index of the first occurrence of any one of the code points in \a str starting from from \a idx.
+		- npos if none of the code points in \a str were found.
+	*/
+	size_type	find_first_of(const String& str, size_type idx = 0) const
+	{
+		if (idx < d_cplength)
+		{
+			const utf32* pt = &ptr()[idx];
+
+			do
+			{
+				if (npos != str.find(*pt++))
+					return idx;
+
+			} while (++idx != d_cplength);
+
+		}
+
+		return npos;
+	}
+
+	/*!
+	\brief
+		Find the first code point that is not one of a set of code points.
+
+	\param str
+		String object describing the set of code points.
+
+	\param idx
+		Index of the start point for the search
+
+	\return
+		- Index of the first code point that does not match any one of the code points in \a str starting from from \a idx.
+		- npos if all code points matched one of the code points in \a str.
+	*/
+	size_type	find_first_not_of(const String& str, size_type idx = 0) const
+	{
+		if (idx < d_cplength)
+		{
+			const utf32* pt = &ptr()[idx];
+
+			do
+			{
+				if (npos == str.find(*pt++))
+					return idx;
+
+			} while (++idx != d_cplength);
+
+		}
+
+		return npos;
+	}
+
+
+	/*!
+	\brief
+		Find the first occurrence of one of a set of code points.
+
+	\param std_str
+		std::string object describing the set of code points.
+
+	\note
+		The characters of \a std_str are taken to be unencoded data which represent Unicode code points 0x00..0xFF.  No translation of
+		the provided data will occur.
+
+	\param idx
+		Index of the start point for the search
+
+	\return
+		- Index of the first occurrence of any one of the code points in \a std_str starting from from \a idx.
+		- npos if none of the code points in \a std_str were found.
+	*/
+	size_type	find_first_of(const std::string& std_str, size_type idx = 0) const
+	{
+		if (idx < d_cplength)
+		{
+			const utf32* pt = &ptr()[idx];
+
+			do
+			{
+				if (npos != find_codepoint(std_str, *pt++))
+					return idx;
+
+			} while (++idx != d_cplength);
+
+		}
+
+		return npos;
+	}
+
+	/*!
+	\brief
+		Find the first code point that is not one of a set of code points.
+
+	\param std_str
+		std::string object describing the set of code points.
+
+	\note
+		The characters of \a std_str are taken to be unencoded data which represent Unicode code points 0x00..0xFF.  No translation of
+		the provided data will occur.
+
+	\param idx
+		Index of the start point for the search
+
+	\return
+		- Index of the first code point that does not match any one of the code points in \a std_str starting from from \a idx.
+		- npos if all code points matched one of the code points in \a std_str.
+	*/
+	size_type	find_first_not_of(const std::string& std_str, size_type idx = 0) const
+	{
+		if (idx < d_cplength)
+		{
+			const utf32* pt = &ptr()[idx];
+
+			do
+			{
+				if (npos == find_codepoint(std_str, *pt++))
+					return idx;
+
+			} while (++idx != d_cplength);
+
+		}
+
+		return npos;
+	}
+
+
+	/*!
+	\brief
+		Find the first occurrence of one of a set of code points.
+
+	\param utf8_str
+		Buffer containing null-terminated utf8 encoded data describing the set of code points.
+
+	\note
+		A basic string literal (cast to utf8*) can be passed to this function, provided that the string is
+		comprised only of code points 0x00..0x7f.  The use of extended ASCII characters (with values >0x7f)
+		would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable
+		results.
+
+	\param idx
+		Index of the start point for the search
+
+	\return
+		- Index of the first occurrence of any one of the code points in \a utf8_str starting from from \a idx.
+		- npos if none of the code points in \a utf8_str were found.
+
+	\exception std::out_of_range	Thrown if \a idx is invalid for this String.
+	*/
+	size_type	find_first_of(const utf8* utf8_str, size_type idx = 0) const
+	{
+		return find_first_of(utf8_str, idx, utf_length(utf8_str));
+	}
+
+	/*!
+	\brief
+		Find the first code point that is not one of a set of code points.
+
+	\param utf8_str
+		Buffer containing null-terminated utf8 encoded data describing the set of code points.
+
+	\note
+		A basic string literal (cast to utf8*) can be passed to this function, provided that the string is
+		comprised only of code points 0x00..0x7f.  The use of extended ASCII characters (with values >0x7f)
+		would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable
+		results.
+
+	\param idx
+		Index of the start point for the search
+
+	\return
+		- Index of the first code point that does not match any one of the code points in \a utf8_str starting from from \a idx.
+		- npos if all code points matched one of the code points in \a utf8_str.
+
+	\exception std::out_of_range	Thrown if \a idx is invalid for this String.
+	*/
+	size_type	find_first_not_of(const utf8* utf8_str, size_type idx = 0) const
+	{
+		return find_first_not_of(utf8_str, idx, utf_length(utf8_str));
+	}
+
+	/*!
+	\brief
+		Find the first occurrence of one of a set of code points.
+
+	\param utf8_str
+		Buffer containing utf8 encoded data describing the set of code points.
+
+	\note
+		A basic string literal (cast to utf8*) can be passed to this function, provided that the string is
+		comprised only of code points 0x00..0x7f.  The use of extended ASCII characters (with values >0x7f)
+		would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable
+		results.
+
+	\param idx
+		Index of the start point for the search
+
+	\param str_len
+		Length of the utf8 encoded data in utf8 code units (not code points).
+
+	\return
+		- Index of the first occurrence of any one of the code points in \a utf8_str starting from from \a idx.
+		- npos if none of the code points in \a utf8_str were found.
+
+	\exception std::length_error	Thrown if \a str_len was 'npos'.
+	*/
+	size_type	find_first_of(const utf8* utf8_str, size_type idx, size_type str_len) const
+	{
+		if (str_len == npos)
+			throw std::length_error("Length for utf8 encoded string can not be 'npos'");
+
+		if (idx < d_cplength)
+		{
+			size_type encsze = encoded_size(utf8_str, str_len);
+
+			const utf32* pt = &ptr()[idx];
+
+			do
+			{
+				if (npos != find_codepoint(utf8_str, encsze, *pt++))
+					return idx;
+
+			} while (++idx != d_cplength);
+
+		}
+
+		return npos;
+	}
+
+	/*!
+	\brief
+		Find the first code point that is not one of a set of code points.
+
+	\param utf8_str
+		Buffer containing utf8 encoded data describing the set of code points.
+
+	\note
+		A basic string literal (cast to utf8*) can be passed to this function, provided that the string is
+		comprised only of code points 0x00..0x7f.  The use of extended ASCII characters (with values >0x7f)
+		would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable
+		results.
+
+	\param idx
+		Index of the start point for the search
+
+	\param str_len
+		Length of the utf8 encoded data in utf8 code units (not code points).
+
+	\return
+		- Index of the first code point that does not match any one of the code points in \a utf8_str starting from from \a idx.
+		- npos if all code points matched one of the code points in \a utf8_str.
+
+	\exception std::length_error	Thrown if \a str_len was 'npos'.
+	*/
+	size_type	find_first_not_of(const utf8* utf8_str, size_type idx, size_type str_len) const
+	{
+		if (str_len == npos)
+			throw std::length_error("Length for utf8 encoded string can not be 'npos'");
+
+		if (idx < d_cplength)
+		{
+			size_type encsze = encoded_size(utf8_str, str_len);
+
+			const utf32* pt = &ptr()[idx];
+
+			do
+			{
+				if (npos == find_codepoint(utf8_str, encsze, *pt++))
+					return idx;
+
+			} while (++idx != d_cplength);
+
+		}
+
+		return npos;
+	}
+
+
+	/*!
+	\brief
+		Search forwards for a given code point
+
+	\param code_point
+		The utf32 code point to search for
+
+	\param idx
+		Index of the code point where the search is to start.
+
+	\return
+		- Index of the first occurrence of \a code_point starting from from \a idx.
+		- npos if the code point could not be found
+	*/
+	size_type	find_first_of(utf32 code_point, size_type idx = 0) const
+	{
+		return find(code_point, idx);
+	}
+
+	/*!
+	\brief
+		Search forwards for the first code point that does not match a given code point
+
+	\param code_point
+		The utf32 code point to search for
+
+	\param idx
+		Index of the code point where the search is to start.
+
+	\return
+		- Index of the first code point that does not match \a code_point starting from from \a idx.
+		- npos if all code points matched \a code_point
+
+	\exception std::out_of_range	Thrown if \a idx is invalid for this String.
+	*/
+	size_type	find_first_not_of(utf32 code_point, size_type idx = 0) const
+	{
+		if (idx < d_cplength)
+		{
+			do
+			{
+				if ((*this)[idx] != code_point)
+					return idx;
+
+			} while(idx++ < d_cplength);
+
+		}
+
+		return npos;
+	}
+
+
+	/*!
+	\brief
+		Find the first occurrence of one of a set of chars.
+
+	\param c_str
+		c-string describing the set of chars.
+
+	\param idx
+		Index of the start point for the search
+
+	\return
+		- Index of the first occurrence of any one of the chars in \a c_str starting from from \a idx.
+		- npos if none of the chars in \a c_str were found.
+
+	\exception std::out_of_range	Thrown if \a idx is invalid for this String.
+	*/
+	size_type	find_first_of(const char* cstr, size_type idx = 0) const
+	{
+		return find_first_of(cstr, idx, strlen(cstr));
+	}
+
+
+	/*!
+	\brief
+		Find the first code point that is not one of a set of chars.
+
+	\param c_str
+		c-string describing the set of chars.
+
+	\param idx
+		Index of the start point for the search
+
+	\return
+		- Index of the first code point that does not match any one of the chars in \a c_str starting from from \a idx.
+		- npos if all code points matched any of the chars in \a c_str.
+
+	\exception std::out_of_range	Thrown if \a idx is invalid for this String.
+	*/
+	size_type	find_first_not_of(const char* cstr, size_type idx = 0) const
+	{
+		return find_first_not_of(cstr, idx, strlen(cstr));
+	}
+
+
+	/*!
+	\brief
+		Find the first occurrence of one of a set of chars.
+
+	\param chars
+		char array containing the set of chars.
+
+	\param idx
+		Index of the start point for the search
+
+	\param chars_len
+		Number of chars in the char array.
+
+	\return
+		- Index of the first occurrence of any one of the chars in \a chars starting from from \a idx.
+		- npos if none of the chars in \a chars were found.
+
+	\exception std::length_error	Thrown if \a chars_len was 'npos'.
+	*/
+	size_type	find_first_of(const char* chars, size_type idx, size_type chars_len) const
+	{
+		if (chars_len == npos)
+			throw std::length_error("Length for char array can not be 'npos'");
+
+		if (idx < d_cplength)
+		{
+			const utf32* pt = &ptr()[idx];
+
+			do
+			{
+				if (npos != find_codepoint(chars, chars_len, *pt++))
+					return idx;
+
+			} while (++idx != d_cplength);
+
+		}
+
+		return npos;
+	}
+
+
+	/*!
+	\brief
+		Find the first code point that is not one of a set of chars.
+
+	\param chars
+		char array containing the set of chars.
+
+	\param idx
+		Index of the start point for the search
+
+	\param chars_len
+		Number of chars in the car array.
+
+	\return
+		- Index of the first code point that does not match any one of the chars in \a chars starting from from \a idx.
+		- npos if all code points matched any of the chars in \a chars.
+
+	\exception std::length_error	Thrown if \a chars_len was 'npos'.
+	*/
+	size_type	find_first_not_of(const char* chars, size_type idx, size_type chars_len) const
+	{
+		if (chars_len == npos)
+			throw std::length_error("Length for char array can not be 'npos'");
+
+		if (idx < d_cplength)
+		{
+			const utf32* pt = &ptr()[idx];
+
+			do
+			{
+				if (npos == find_codepoint(chars, chars_len, *pt++))
+					return idx;
+
+			} while (++idx != d_cplength);
+
+		}
+
+		return npos;
+	}
+
+
+	//////////////////////////////////////////////////////////////////////////
+	// Find last of different code-points
+	//////////////////////////////////////////////////////////////////////////
+	/*!
+	\brief
+		Find the last occurrence of one of a set of code points.
+
+	\param str
+		String object describing the set of code points.
+
+	\param idx
+		Index of the start point for the search
+
+	\return
+		- Index of the last occurrence of any one of the code points in \a str starting from \a idx.
+		- npos if none of the code points in \a str were found.
+	*/
+	size_type	find_last_of(const String& str, size_type idx = npos) const
+	{
+		if (d_cplength > 0)
+		{
+			if (idx >= d_cplength)
+				idx = d_cplength - 1;
+
+			const utf32* pt = &ptr()[idx];
+
+			do
+			{
+				if (npos != str.find(*pt--))
+					return idx;
+
+			} while (idx-- != 0);
+
+		}
+
+		return npos;
+	}
+
+	/*!
+	\brief
+		Find the last code point that is not one of a set of code points.
+
+	\param str
+		String object describing the set of code points.
+
+	\param idx
+		Index of the start point for the search
+
+	\return
+		- Index of the last code point that does not match any one of the code points in \a str starting from \a idx.
+		- npos if all code points matched one of the code points in \a str.
+	*/
+	size_type	find_last_not_of(const String& str, size_type idx = npos) const
+	{
+		if (d_cplength > 0)
+		{
+			if (idx >= d_cplength)
+				idx = d_cplength - 1;
+
+			const utf32* pt = &ptr()[idx];
+
+			do
+			{
+				if (npos == str.find(*pt--))
+					return idx;
+
+			} while (idx-- != 0);
+
+		}
+
+		return npos;
+	}
+
+
+	/*!
+	\brief
+		Find the last occurrence of one of a set of code points.
+
+	\param std_str
+		std::string object describing the set of code points.
+
+	\note
+		The characters of \a std_str are taken to be unencoded data which represent Unicode code points 0x00..0xFF.  No translation of
+		the provided data will occur.
+
+	\param idx
+		Index of the start point for the search
+
+	\return
+		- Index of the last occurrence of any one of the code points in \a std_str starting from \a idx.
+		- npos if none of the code points in \a std_str were found.
+	*/
+	size_type	find_last_of(const std::string& std_str, size_type idx = npos) const
+	{
+		if (d_cplength > 0)
+		{
+			if (idx >= d_cplength)
+				idx = d_cplength - 1;
+
+			const utf32* pt = &ptr()[idx];
+
+			do
+			{
+				if (npos != find_codepoint(std_str, *pt--))
+					return idx;
+
+			} while (idx-- != 0);
+
+		}
+
+		return npos;
+	}
+
+	/*!
+	\brief
+		Find the last code point that is not one of a set of code points.
+
+	\param std_str
+		std::string object describing the set of code points.
+
+	\note
+		The characters of \a std_str are taken to be unencoded data which represent Unicode code points 0x00..0xFF.  No translation of
+		the provided data will occur.
+
+	\param idx
+		Index of the start point for the search
+
+	\return
+		- Index of the last code point that does not match any one of the code points in \a std_str starting from \a idx.
+		- npos if all code points matched one of the code points in \a std_str.
+	*/
+	size_type	find_last_not_of(const std::string& std_str, size_type idx = npos) const
+	{
+		if (d_cplength > 0)
+		{
+			if (idx >= d_cplength)
+				idx = d_cplength - 1;
+
+			const utf32* pt = &ptr()[idx];
+
+			do
+			{
+				if (npos == find_codepoint(std_str, *pt--))
+					return idx;
+
+			} while (idx-- != 0);
+
+		}
+
+		return npos;
+	}
+
+
+	/*!
+	\brief
+		Find the last occurrence of one of a set of code points.
+
+	\param utf8_str
+		Buffer containing null-terminated utf8 encoded data describing the set of code points.
+
+	\note
+		A basic string literal (cast to utf8*) can be passed to this function, provided that the string is
+		comprised only of code points 0x00..0x7f.  The use of extended ASCII characters (with values >0x7f)
+		would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable
+		results.
+
+	\param idx
+		Index of the start point for the search
+
+	\return
+		- Index of the last occurrence of any one of the code points in \a utf8_str starting from \a idx.
+		- npos if none of the code points in \a utf8_str were found.
+
+	\exception std::out_of_range	Thrown if \a idx is invalid for this String.
+	*/
+	size_type	find_last_of(const utf8* utf8_str, size_type idx = npos) const
+	{
+		return find_last_of(utf8_str, idx, utf_length(utf8_str));
+	}
+
+	/*!
+	\brief
+		Find the last code point that is not one of a set of code points.
+
+	\param utf8_str
+		Buffer containing null-terminated utf8 encoded data describing the set of code points.
+
+	\note
+		A basic string literal (cast to utf8*) can be passed to this function, provided that the string is
+		comprised only of code points 0x00..0x7f.  The use of extended ASCII characters (with values >0x7f)
+		would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable
+		results.
+
+	\param idx
+		Index of the start point for the search
+
+	\return
+		- Index of the last code point that does not match any one of the code points in \a utf8_str starting from \a idx.
+		- npos if all code points matched one of the code points in \a utf8_str.
+
+	\exception std::out_of_range	Thrown if \a idx is invalid for this String.
+	*/
+	size_type	find_last_not_of(const utf8* utf8_str, size_type idx = npos) const
+	{
+		return find_last_not_of(utf8_str, idx, utf_length(utf8_str));
+	}
+
+	/*!
+	\brief
+		Find the last occurrence of one of a set of code points.
+
+	\param utf8_str
+		Buffer containing utf8 encoded data describing the set of code points.
+
+	\note
+		A basic string literal (cast to utf8*) can be passed to this function, provided that the string is
+		comprised only of code points 0x00..0x7f.  The use of extended ASCII characters (with values >0x7f)
+		would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable
+		results.
+
+	\param idx
+		Index of the start point for the search
+
+	\param str_len
+		Length of the utf8 encoded data in utf8 code units (not code points).
+
+	\return
+		- Index of the last occurrence of any one of the code points in \a utf8_str starting from from \a idx.
+		- npos if none of the code points in \a utf8_str were found.
+
+	\exception std::length_error	Thrown if \a str_len was 'npos'.
+	*/
+	size_type	find_last_of(const utf8* utf8_str, size_type idx, size_type str_len) const
+	{
+		if (str_len == npos)
+			throw std::length_error("Length for utf8 encoded string can not be 'npos'");
+
+		if (d_cplength > 0)
+		{
+			if (idx >= d_cplength)
+				idx = d_cplength - 1;
+
+			size_type encsze = encoded_size(utf8_str, str_len);
+
+			const utf32* pt = &ptr()[idx];
+
+			do
+			{
+				if (npos != find_codepoint(utf8_str, encsze, *pt--))
+					return idx;
+
+			} while (idx-- != 0);
+
+		}
+
+		return npos;
+	}
+
+	/*!
+	\brief
+		Find the last code point that is not one of a set of code points.
+
+	\param utf8_str
+		Buffer containing utf8 encoded data describing the set of code points.
+
+	\note
+		A basic string literal (cast to utf8*) can be passed to this function, provided that the string is
+		comprised only of code points 0x00..0x7f.  The use of extended ASCII characters (with values >0x7f)
+		would result in incorrect behaviour as the String will attempt to 'decode' the data, with unpredictable
+		results.
+
+	\param idx
+		Index of the start point for the search
+
+	\param str_len
+		Length of the utf8 encoded data in utf8 code units (not code points).
+
+	\return
+		- Index of the last code point that does not match any one of the code points in \a utf8_str starting from from \a idx.
+		- npos if all code points matched one of the code points in \a utf8_str.
+
+	\exception std::length_error	Thrown if \a str_len was 'npos'.
+	*/
+	size_type	find_last_not_of(const utf8* utf8_str, size_type idx, size_type str_len) const
+	{
+		if (str_len == npos)
+			throw std::length_error("Length for utf8 encoded string can not be 'npos'");
+
+		if (d_cplength > 0)
+		{
+			if (idx >= d_cplength)
+				idx = d_cplength - 1;
+
+			size_type encsze = encoded_size(utf8_str, str_len);
+
+			const utf32* pt = &ptr()[idx];
+
+			do
+			{
+				if (npos == find_codepoint(utf8_str, encsze, *pt--))
+					return idx;
+
+			} while (idx-- != 0);
+
+		}
+
+		return npos;
+	}
+
+
+	/*!
+	\brief
+		Search for last occurrence of a given code point
+
+	\param code_point
+		The utf32 code point to search for
+
+	\param idx
+		Index of the code point where the search is to start.
+
+	\return
+		- Index of the last occurrence of \a code_point starting from \a idx.
+		- npos if the code point could not be found
+	*/
+	size_type	find_last_of(utf32 code_point, size_type idx = npos) const
+	{
+		return rfind(code_point, idx);
+	}
+
+	/*!
+	\brief
+		Search for the last code point that does not match a given code point
+
+	\param code_point
+		The utf32 code point to search for
+
+	\param idx
+		Index of the code point where the search is to start.
+
+	\return
+		- Index of the last code point that does not match \a code_point starting from from \a idx.
+		- npos if all code points matched \a code_point
+	*/
+	size_type	find_last_not_of(utf32 code_point, size_type idx = npos) const
+	{
+		if (d_cplength > 0)
+		{
+			if (idx >= d_cplength)
+				idx = d_cplength - 1;
+
+			do
+			{
+				if ((*this)[idx] != code_point)
+					return idx;
+
+			} while(idx-- != 0);
+
+		}
+
+		return npos;
+	}
+
+
+	/*!
+	\brief
+		Find the last occurrence of one of a set of chars.
+
+	\param c_str
+		c-string describing the set of chars.
+
+	\param idx
+		Index of the start point for the search
+
+	\return
+		- Index of the last occurrence of any one of the chars in \a c_str starting from \a idx.
+		- npos if none of the chars in \a c_str were found.
+
+	\exception std::out_of_range	Thrown if \a idx is invalid for this String.
+	*/
+	size_type	find_last_of(const char* cstr, size_type idx = npos) const
+	{
+		return find_last_of(cstr, idx, strlen(cstr));
+	}
+
+
+	/*!
+	\brief
+		Find the last code point that is not one of a set of chars.
+
+	\param c_str
+		c-string describing the set of chars.
+
+	\param idx
+		Index of the start point for the search
+
+	\return
+		- Index of the last code point that does not match any one of the chars in \a c_str starting from \a idx.
+		- npos if all code points matched any of the chars in \a c_str.
+
+	\exception std::out_of_range	Thrown if \a idx is invalid for this String.
+	*/
+	size_type	find_last_not_of(const char* cstr, size_type idx = npos) const
+	{
+		return find_last_not_of(cstr, idx, strlen(cstr));
+	}
+
+
+	/*!
+	\brief
+		Find the last occurrence of one of a set of chars.
+
+	\param chars
+		char array containing the set of chars.
+
+	\param idx
+		Index of the start point for the search
+
+	\param chars_len
+		Number of chars in the char array.
+
+	\return
+		- Index of the last occurrence of any one of the chars in \a chars, starting from from \a idx.
+		- npos if none of the chars in \a chars were found.
+
+	\exception std::length_error	Thrown if \a chars_len was 'npos'.
+	*/
+	size_type	find_last_of(const char* chars, size_type idx, size_type chars_len) const
+	{
+		if (chars_len == npos)
+			throw std::length_error("Length for char array can not be 'npos'");
+
+		if (d_cplength > 0)
+		{
+			if (idx >= d_cplength)
+				idx = d_cplength - 1;
+
+			const utf32* pt = &ptr()[idx];
+
+			do
+			{
+				if (npos != find_codepoint(chars, chars_len, *pt--))
+					return idx;
+
+			} while (idx-- != 0);
+
+		}
+
+		return npos;
+	}
+
+
+	/*!
+	\brief
+		Find the last code point that is not one of a set of chars.
+
+	\param chars
+		char array containing the set of chars.
+
+	\param idx
+		Index of the start point for the search
+
+	\param chars_len
+		Number of chars in the char array.
+
+	\return
+		- Index of the last code point that does not match any one of the chars in \a chars, starting from from \a idx.
+		- npos if all code points matched any of the chars in \a chars.
+
+	\exception std::length_error	Thrown if \a chars_len was 'npos'.
+	*/
+	size_type	find_last_not_of(const char* chars, size_type idx, size_type chars_len) const
+	{
+		if (chars_len == npos)
+			throw std::length_error("Length for char array can not be 'npos'");
+
+		if (d_cplength > 0)
+		{
+			if (idx >= d_cplength)
+				idx = d_cplength - 1;
+
+			const utf32* pt = &ptr()[idx];
+
+			do
+			{
+				if (npos == find_codepoint(chars, chars_len, *pt--))
+					return idx;
+
+			} while (idx-- != 0);
+
+		}
+
+		return npos;
+	}
+
+
+	//////////////////////////////////////////////////////////////////////////
+	// Substring
+	//////////////////////////////////////////////////////////////////////////
+	/*!
+	\brief
+		Returns a substring of this String.
+
+	\param idx
+		Index of the first code point to use for the sub-string.
+
+	\param len
+		Maximum number of code points to use for the sub-string
+
+	\return
+		A String object containing the specified sub-string.
+
+	\exception std::out_of_range	Thrown if \a idx is invalid for this String.
+	*/
+	String	substr(size_type idx = 0, size_type len = npos) const
+	{
+		if (d_cplength < idx)
+			throw std::out_of_range("Index is out of range for this CEGUI::String");
+
+		return String(*this, idx, len);
+	}
+
+	//////////////////////////////////////////////////////////////////////////
+	// Iterator creation
+	//////////////////////////////////////////////////////////////////////////
+	/*!
+	\brief
+		Return a forwards iterator that describes the beginning of the String
+
+	\return
+		iterator object that describes the beginning of the String.
+	*/
+	iterator		begin(void)
+	{
+		return iterator(ptr());
+	}
+
+	/*!
+	\brief
+		Return a constant forwards iterator that describes the beginning of the String
+
+	\return
+		const_iterator object that describes the beginning of the String.
+	*/
+	const_iterator	begin(void) const
+	{
+		return const_iterator(ptr());
+	}
+
+	/*!
+	\brief
+		Return a forwards iterator that describes the end of the String
+
+	\return
+		iterator object that describes the end of the String.
+	*/
+	iterator		end(void)
+	{
+		return iterator(&ptr()[d_cplength]);
+	}
+
+	/*!
+	\brief
+		Return a constant forwards iterator that describes the end of the String
+
+	\return
+		const_iterator object that describes the end of the String.
+	*/
+	const_iterator	end(void) const
+	{
+		return const_iterator(&ptr()[d_cplength]);
+	}
+
+	/*!
+	\brief
+		Return a reverse iterator that describes the beginning of the String
+
+	\return
+		reverse_iterator object that describes the beginning of the String (so is actually at the end)
+	*/
+	reverse_iterator		rbegin(void)
+	{
+		return reverse_iterator(end());
+	}
+
+	/*!
+	\brief
+		Return a constant reverse iterator that describes the beginning of the String
+
+	\return
+		const_reverse_iterator object that describes the beginning of the String (so is actually at the end)
+	*/
+	const_reverse_iterator	rbegin(void) const
+	{
+		return const_reverse_iterator(end());
+	}
+
+	/*!
+	\brief
+		Return a reverse iterator that describes the end of the String
+
+	\return
+		reverse_iterator object that describes the end of the String (so is actually at the beginning)
+	*/
+	reverse_iterator		rend(void)
+	{
+		return reverse_iterator(begin());
+	}
+
+	/*!
+	\brief
+		Return a constant reverse iterator that describes the end of the String
+
+	\return
+		const_reverse_iterator object that describes the end of the String (so is actually at the beginning)
+	*/
+	const_reverse_iterator	rend(void) const
+	{
+		return const_reverse_iterator(begin());
+	}
+
+private:
+	/*************************************************************************
+		Implementation Functions
+	*************************************************************************/
+	// string management
+
+	// change size of allocated buffer so it is at least 'new_size'.
+	// May or may not cause re-allocation and copy of buffer if size is larger
+	// will never re-allocate to make size smaller.  (see trim())
+    bool	grow(size_type new_size);
+
+	// perform re-allocation to remove wasted space.
+    void	trim(void);
+
+	// set the length of the string, and terminate it, according to the given value (will not re-allocate, use grow() first).
+	void	setlen(size_type len)
+	{
+		d_cplength = len;
+		ptr()[len] = (utf32)(0);
+	}
+
+	// return a ptr to the buffer in use.
+	utf32*	ptr(void)
+	{
+		return (d_reserve > STR_QUICKBUFF_SIZE) ? d_buffer : d_quickbuff;
+	}
+
+	// return a ptr tot he buffer in use (const version)
+	const utf32*	ptr(void) const
+	{
+		return (d_reserve > STR_QUICKBUFF_SIZE) ? d_buffer : d_quickbuff;
+	}
+
+	// initialise string object
+	void	init(void)
+	{
+		d_reserve			= STR_QUICKBUFF_SIZE;
+		d_encodedbuff		= NULL;
+		d_encodedbufflen	= 0;
+		d_encodeddatlen		= 0;
+		setlen(0);
+	}
+
+	// return true if the given pointer is inside the string data
+	bool	inside(utf32* inptr)
+	{
+		if (inptr < ptr() || ptr() + d_cplength <= inptr)
+			return false;
+		else
+			return true;
+	}
+
+	// compute distance between two iterators, returning a 'safe' value
+	size_type safe_iter_dif(const const_iterator& iter1, const const_iterator& iter2) const
+	{
+		return (iter1.d_ptr == 0) ? 0 : (iter1 - iter2);
+	}
+	
+	// encoding functions
+	// for all:
+	//	src_len is in code units, or 0 for null terminated string.
+	//	dest_len is in code units.
+	//	returns number of code units put into dest buffer.
+	size_type encode(const utf32* src, utf8* dest, size_type dest_len, size_type src_len = 0) const
+	{
+		// count length for null terminated source...
+		if (src_len == 0)
+		{
+			src_len = utf_length(src);
+		}
+
+		size_type destCapacity = dest_len;
+
+		// while there is data in the source buffer,
+		for (uint idx = 0; idx < src_len; ++idx)
+		{
+			utf32	cp = src[idx];
+
+			// check there is enough destination buffer to receive this encoded unit (exit loop & return if not)
+			if (destCapacity < encoded_size(cp))
+			{
+				break;
+			}
+
+			if (cp < 0x80)
+			{
+				*dest++ = (utf8)cp;
+				--destCapacity;
+			}
+			else if (cp < 0x0800)
+			{
+				*dest++ = (utf8)((cp >> 6) | 0xC0);
+				*dest++ = (utf8)((cp & 0x3F) | 0x80);
+				destCapacity -= 2;
+			}
+			else if (cp < 0x10000)
+			{
+				*dest++ = (utf8)((cp >> 12) | 0xE0);
+				*dest++ = (utf8)(((cp >> 6) & 0x3F) | 0x80);
+				*dest++ = (utf8)((cp & 0x3F) | 0x80);
+				destCapacity -= 3;
+			}
+			else
+			{
+				*dest++ = (utf8)((cp >> 18) | 0xF0);
+				*dest++ = (utf8)(((cp >> 12) & 0x3F) | 0x80);
+				*dest++ = (utf8)(((cp >> 6) & 0x3F) | 0x80);
+				*dest++ = (utf8)((cp & 0x3F) | 0x80);
+				destCapacity -= 4;
+			}
+
+		}
+
+		return dest_len - destCapacity;
+	}
+
+	size_type encode(const utf8* src, utf32* dest, size_type dest_len, size_type src_len = 0) const
+	{
+		// count length for null terminated source...
+		if (src_len == 0)
+		{
+			src_len = utf_length(src);
+		}
+
+		size_type destCapacity = dest_len;
+
+		// while there is data in the source buffer, and space in the dest buffer
+		for (uint idx = 0; ((idx < src_len) && (destCapacity > 0));)
+		{
+			utf32	cp;
+			utf8	cu = src[idx++];
+
+			if (cu < 0x80)
+			{
+				cp = (utf32)(cu);
+			}
+			else if (cu < 0xE0)
+			{
+				cp = ((cu & 0x1F) << 6);
+				cp |= (src[idx++] & 0x3F);
+			}
+			else if (cu < 0xF0)
+			{
+				cp = ((cu & 0x0F) << 12);
+				cp |= ((src[idx++] & 0x3F) << 6);
+				cp |= (src[idx++] & 0x3F);
+			}
+			else
+			{
+				cp = ((cu & 0x07) << 18);
+				cp |= ((src[idx++] & 0x3F) << 12);
+				cp |= ((src[idx++] & 0x3F) << 6);
+				cp |= (src[idx++] & 0x3F);
+			}
+
+			*dest++ = cp;
+			--destCapacity;
+		}
+
+		return dest_len - destCapacity;
+	}
+
+	// return the number of utf8 code units required to encode the given utf32 code point
+	size_type encoded_size(utf32 code_point) const
+	{
+		if (code_point < 0x80)
+			return 1;
+		else if (code_point < 0x0800)
+			return 2;
+		else if (code_point < 0x10000)
+			return 3;
+		else
+			return 4;
+	}
+
+	// return number of code units required to re-encode given null-terminated utf32 data as utf8.  return does not include terminating null.
+	size_type encoded_size(const utf32* buf) const
+	{
+		return encoded_size(buf, utf_length(buf));
+	}
+
+	// return number of code units required to re-encode given utf32 data as utf8.   len is number of code units in 'buf'.
+	size_type encoded_size(const utf32* buf, size_type len) const
+	{
+		size_type count = 0;
+
+		while (len--)
+		{
+			count += encoded_size(*buf++);
+		}
+
+		return count;
+	}
+
+	// return number of utf32 code units required to re-encode given utf8 data as utf32.  return does not include terminating null.
+	size_type encoded_size(const utf8* buf) const
+	{
+		return encoded_size(buf, utf_length(buf));
+	}
+
+	// return number of utf32 code units required to re-encode given utf8 data as utf32.  len is number of code units in 'buf'.
+	size_type encoded_size(const utf8* buf, size_type len) const
+	{
+		utf8 tcp;
+		size_type count = 0;
+
+		while (len--)
+		{
+			tcp = *buf++;
+			++count;
+
+			if (tcp < 0x80)
+			{
+			}
+			else if (tcp < 0xE0)
+			{
+				--len;
+				++buf;
+			}
+			else if (tcp < 0xF0)
+			{
+				len -= 2;
+				buf += 2;
+			}
+			else
+			{
+				len -= 2;
+				buf += 3;
+			}
+
+		}
+
+		return count;
+	}
+
+	// return number of code units in a null terminated string
+	size_type utf_length(const utf8* utf8_str) const
+	{
+		size_type cnt = 0;
+		while (*utf8_str++)
+			cnt++;
+
+		return cnt;
+	}
+
+	// return number of code units in a null terminated string
+	size_type utf_length(const utf32* utf32_str) const
+	{
+		size_type cnt = 0;
+		while (*utf32_str++)
+			cnt++;
+
+		return cnt;
+	}
+
+	// build an internal buffer with the string encoded as utf8 (remains valid until string is modified).
+    utf8* build_utf8_buff(void) const;
+
+	// compare two utf32 buffers
+	int	utf32_comp_utf32(const utf32* buf1, const utf32* buf2, size_type cp_count) const
+	{
+		if (!cp_count)
+			return 0;
+
+		while ((--cp_count) && (*buf1 == *buf2))
+			buf1++, buf2++;
+		
+		return *buf1 - *buf2;
+	}
+
+	// compare utf32 buffer with char buffer (chars are taken to be code-points in the range 0x00-0xFF)
+	int utf32_comp_char(const utf32* buf1, const char* buf2, size_type cp_count) const
+	{
+		if (!cp_count)
+			return 0;
+
+		while ((--cp_count) && (*buf1 == static_cast<utf32>(static_cast<unsigned char>(*buf2))))
+			buf1++, buf2++;
+
+		return *buf1 - static_cast<utf32>(static_cast<unsigned char>(*buf2));
+	}
+
+	// compare utf32 buffer with encoded utf8 data
+	int utf32_comp_utf8(const utf32* buf1, const utf8* buf2, size_type cp_count) const
+	{
+		if (!cp_count)
+			return 0;
+
+		utf32	cp;
+		utf8	cu;
+
+		do
+		{
+			cu = *buf2++;
+
+			if (cu < 0x80)
+			{
+				cp = (utf32)(cu);
+			}
+			else if (cu < 0xE0)
+			{
+				cp = ((cu & 0x1F) << 6);
+				cp |= (*buf2++ & 0x3F);
+			}
+			else if (cu < 0xF0)
+			{
+				cp = ((cu & 0x0F) << 12);
+				cp |= ((*buf2++ & 0x3F) << 6);
+				cp |= (*buf2++ & 0x3F);
+			}
+			else
+			{
+				cp = ((cu & 0x07) << 18);
+				cp |= ((*buf2++ & 0x3F) << 12);
+				cp |= ((*buf2++ & 0x3F) << 6);
+				cp |= (*buf2++ & 0x3F);
+			}
+
+		} while ((*buf1++ == cp) && (--cp_count));
+
+		return (*--buf1) - cp;
+	}
+
+	// return index of first occurrence of 'code_point' in std::string 'str', or npos if none
+	size_type find_codepoint(const std::string& str, utf32 code_point) const
+	{
+		size_type idx = 0, sze = (size_type)str.size();
+
+		while (idx != sze)
+		{
+			if (code_point == static_cast<utf32>(static_cast<unsigned char>(str[idx])))
+				return idx;
+
+			++idx;
+		}
+
+		return npos;
+	}
+
+	// return index of first occurrence of 'code_point' in utf8 encoded string 'str', or npos if none.  len is in code points.
+	size_type find_codepoint(const utf8* str, size_type len, utf32 code_point) const 
+	{
+		size_type idx = 0;
+
+		utf32	cp;
+		utf8	cu;
+
+		while (idx != len) {
+			cu = *str++;
+
+			if (cu < 0x80)
+			{
+				cp = (utf32)(cu);
+			}
+			else if (cu < 0xE0)
+			{
+				cp = ((cu & 0x1F) << 6);
+				cp |= (*str++ & 0x3F);
+			}
+			else if (cu < 0xF0)
+			{
+				cp = ((cu & 0x0F) << 12);
+				cp |= ((*str++ & 0x3F) << 6);
+				cp |= (*str++ & 0x3F);
+			}
+			else
+			{
+				cp = ((cu & 0x07) << 18);
+				cp |= ((*str++ & 0x3F) << 12);
+				cp |= ((*str++ & 0x3F) << 6);
+				cp |= (*str++ & 0x3F);
+			}
+
+			if (code_point == cp)
+				return idx;
+
+			++idx;
+		}
+
+		return npos;
+	}
+
+
+	// return index of first occurrence of 'code_point' in char array 'chars', or npos if none
+	size_type find_codepoint(const char* chars, size_type chars_len, utf32 code_point) const
+	{
+		for (size_type idx = 0; idx != chars_len; ++idx)
+		{
+			if (code_point == static_cast<utf32>(static_cast<unsigned char>(chars[idx])))
+				return idx;
+		}
+
+		return npos;
+	}
+
+};
+
+
+//////////////////////////////////////////////////////////////////////////
+// Comparison operators
+//////////////////////////////////////////////////////////////////////////
+/*!
+\brief
+	Return true if String \a str1 is equal to String \a str2
+*/
+bool CEGUIEXPORT	operator==(const String& str1, const String& str2);
+
+/*!
+\brief
+	Return true if String \a str is equal to std::string \a std_str
+*/
+bool CEGUIEXPORT	operator==(const String& str, const std::string& std_str);
+
+/*!
+\brief
+	Return true if String \a str is equal to std::string \a std_str
+*/
+bool CEGUIEXPORT	operator==(const std::string& std_str, const String& str);
+
+/*!
+\brief
+	Return true if String \a str is equal to null-terminated utf8 data \a utf8_str
+*/
+bool CEGUIEXPORT	operator==(const String& str, const utf8* utf8_str);
+
+/*!
+\brief
+	Return true if String \a str is equal to null-terminated utf8 data \a utf8_str
+*/
+bool CEGUIEXPORT	operator==(const utf8* utf8_str, const String& str);
+
+/*!
+\brief
+	Return true if String \a str1 is not equal to String \a str2
+*/
+bool CEGUIEXPORT	operator!=(const String& str1, const String& str2);
+
+/*!
+\brief
+	Return true if String \a str is not equal to std::string \a std_str
+*/
+bool CEGUIEXPORT	operator!=(const String& str, const std::string& std_str);
+
+/*!
+\brief
+	Return true if String \a str is not equal to std::string \a std_str
+*/
+bool CEGUIEXPORT	operator!=(const std::string& std_str, const String& str);
+
+/*!
+\brief
+	Return true if String \a str is not equal to null-terminated utf8 data \a utf8_str
+*/
+bool CEGUIEXPORT	operator!=(const String& str, const utf8* utf8_str);
+
+/*!
+\brief
+	Return true if String \a str is not equal to null-terminated utf8 data \a utf8_str
+*/
+bool CEGUIEXPORT	operator!=(const utf8* utf8_str, const String& str);
+
+/*!
+\brief
+	Return true if String \a str1 is lexicographically less than String \a str2
+*/
+bool CEGUIEXPORT	operator<(const String& str1, const String& str2);
+
+/*!
+\brief
+	Return true if String \a str is lexicographically less than std::string \a std_str
+*/
+bool CEGUIEXPORT	operator<(const String& str, const std::string& std_str);
+
+/*!
+\brief
+	Return true if String \a str is lexicographically less than std::string \a std_str
+*/
+bool CEGUIEXPORT	operator<(const std::string& std_str, const String& str);
+
+/*!
+\brief
+	Return true if String \a str is lexicographically less than null-terminated utf8 data \a utf8_str
+*/
+bool CEGUIEXPORT	operator<(const String& str, const utf8* utf8_str);
+
+/*!
+\brief
+	Return true if String \a str is lexicographically less than null-terminated utf8 data \a utf8_str
+*/
+bool CEGUIEXPORT	operator<(const utf8* utf8_str, const String& str);
+
+/*!
+\brief
+	Return true if String \a str1 is lexicographically greater than String \a str2
+*/
+bool CEGUIEXPORT	operator>(const String& str1, const String& str2);
+
+/*!
+\brief
+	Return true if String \a str is lexicographically greater than std::string \a std_str
+*/
+bool CEGUIEXPORT	operator>(const String& str, const std::string& std_str);
+
+/*!
+\brief
+	Return true if String \a str is lexicographically greater than std::string \a std_str
+*/
+bool CEGUIEXPORT	operator>(const std::string& std_str, const String& str);
+
+/*!
+\brief
+	Return true if String \a str is lexicographically greater than null-terminated utf8 data \a utf8_str
+*/
+bool CEGUIEXPORT	operator>(const String& str, const utf8* utf8_str);
+
+/*!
+\brief
+	Return true if String \a str is lexicographically greater than null-terminated utf8 data \a utf8_str
+*/
+bool CEGUIEXPORT	operator>(const utf8* utf8_str, const String& str);
+
+/*!
+\brief
+	Return true if String \a str1 is lexicographically less than or equal to String \a str2
+*/
+bool CEGUIEXPORT	operator<=(const String& str1, const String& str2);
+
+/*!
+\brief
+	Return true if String \a str is lexicographically less than or equal to std::string \a std_str
+*/
+bool CEGUIEXPORT	operator<=(const String& str, const std::string& std_str);
+
+/*!
+\brief
+	Return true if String \a str is lexicographically less than or equal to std::string \a std_str
+*/
+bool CEGUIEXPORT	operator<=(const std::string& std_str, const String& str);
+
+/*!
+\brief
+	Return true if String \a str is lexicographically less than or equal to null-terminated utf8 data \a utf8_str
+*/
+bool CEGUIEXPORT	operator<=(const String& str, const utf8* utf8_str);
+
+/*!
+\brief
+	Return true if String \a str is lexicographically less than or equal to null-terminated utf8 data \a utf8_str
+*/
+bool CEGUIEXPORT	operator<=(const utf8* utf8_str, const String& str);
+
+/*!
+\brief
+	Return true if String \a str1 is lexicographically greater than or equal to String \a str2
+*/
+bool CEGUIEXPORT	operator>=(const String& str1, const String& str2);
+
+/*!
+\brief
+	Return true if String \a str is lexicographically greater than or equal to std::string \a std_str
+*/
+bool CEGUIEXPORT	operator>=(const String& str, const std::string& std_str);
+
+/*!
+\brief
+	Return true if String \a str is lexicographically greater than or equal to std::string \a std_str
+*/
+bool CEGUIEXPORT	operator>=(const std::string& std_str, const String& str);
+
+/*!
+\brief
+	Return true if String \a str is lexicographically greater than or equal to null-terminated utf8 data \a utf8_str
+*/
+bool CEGUIEXPORT	operator>=(const String& str, const utf8* utf8_str);
+
+/*!
+\brief
+	Return true if String \a str is lexicographically greater than or equal to null-terminated utf8 data \a utf8_str
+*/
+bool CEGUIEXPORT	operator>=(const utf8* utf8_str, const String& str);
+
+/*!
+\brief
+	Return true if String \a str is equal to c-string \a c_str
+*/
+bool CEGUIEXPORT	operator==(const String& str, const char* c_str);
+
+/*!
+\brief
+	Return true if c-string \a c_str is equal to String \a str
+*/
+bool CEGUIEXPORT	operator==(const char* c_str, const String& str);
+
+/*!
+\brief
+	Return true if String \a str is not equal to c-string \a c_str
+*/
+bool CEGUIEXPORT	operator!=(const String& str, const char* c_str);
+
+/*!
+\brief
+	Return true if c-string \a c_str is not equal to String \a str
+*/
+bool CEGUIEXPORT	operator!=(const char* c_str, const String& str);
+
+/*!
+\brief
+	Return true if String \a str is lexicographically less than c-string \a c_str
+*/
+bool CEGUIEXPORT	operator<(const String& str, const char* c_str);
+
+/*!
+\brief
+	Return true if c-string \a c_str is lexicographically less than String \a str
+*/
+bool CEGUIEXPORT	operator<(const char* c_str, const String& str);
+
+/*!
+\brief
+Return true if String \a str is lexicographically greater than c-string \a c_str
+*/
+bool CEGUIEXPORT	operator>(const String& str, const char* c_str);
+
+/*!
+\brief
+Return true if c-string \a c_str is lexicographically greater than String \a str
+*/
+bool CEGUIEXPORT	operator>(const char* c_str, const String& str);
+
+/*!
+\brief
+	Return true if String \a str is lexicographically less than or equal to c-string \a c_str
+*/
+bool CEGUIEXPORT	operator<=(const String& str, const char* c_str);
+
+/*!
+\brief
+	Return true if c-string \a c_str is lexicographically less than or equal to String \a str
+*/
+bool CEGUIEXPORT	operator<=(const char* c_str, const String& str);
+
+/*!
+\brief
+	Return true if String \a str is lexicographically greater than or equal to c-string \a c_str
+*/
+bool CEGUIEXPORT	operator>=(const String& str, const char* c_str);
+
+/*!
+\brief
+	Return true if c-string \a c_str is lexicographically greater than or equal to String \a str
+*/
+bool CEGUIEXPORT	operator>=(const char* c_str, const String& str);
+
+//////////////////////////////////////////////////////////////////////////
+// Concatenation operator functions
+//////////////////////////////////////////////////////////////////////////
+/*!
+\brief
+	Return String object that is the concatenation of the given inputs
+
+\param str1
+	String object describing first part of the new string
+
+\param str2
+	String object describing the second part of the new string
+
+\return
+	A String object that is the concatenation of \a str1 and \a str2
+
+\exception std::length_error	Thrown if the resulting String would be too large.
+*/
+String CEGUIEXPORT	operator+(const String& str1, const String& str2);
+
+/*!
+\brief
+	Return String object that is the concatenation of the given inputs
+
+\param str
+	String object describing first part of the new string
+
+\param std_str
+	std::string object describing the second part of the new string
+
+\return
+	A String object that is the concatenation of \a str and \a std_str
+
+\exception std::length_error	Thrown if the resulting String would be too large.
+*/
+String CEGUIEXPORT	operator+(const String& str, const std::string& std_str);
+
+/*!
+\brief
+	Return String object that is the concatenation of the given inputs
+
+\param std_str
+	std::string object describing the first part of the new string
+
+\param str
+	String object describing the second part of the new string
+
+\return
+	A String object that is the concatenation of \a std_str and \a str
+
+\exception std::length_error	Thrown if the resulting String would be too large.
+*/
+String CEGUIEXPORT	operator+(const std::string& std_str, const String& str);
+
+/*!
+\brief
+	Return String object that is the concatenation of the given inputs
+
+\param str
+	String object describing first part of the new string
+
+\param utf8_str
+	Buffer containing null-terminated utf8 encoded data describing the second part of the new string
+
+\return
+	A String object that is the concatenation of \a str and \a utf8_str
+
+\exception std::length_error	Thrown if the resulting String would be too large.
+*/
+String CEGUIEXPORT	operator+(const String& str, const utf8* utf8_str);
+
+/*!
+\brief
+	Return String object that is the concatenation of the given inputs
+
+\param utf8_str
+	Buffer containing null-terminated utf8 encoded data describing the first part of the new string
+
+\param str
+	String object describing the second part of the new string
+
+\return
+	A String object that is the concatenation of \a str and \a utf8_str
+
+\exception std::length_error	Thrown if the resulting String would be too large.
+*/
+String CEGUIEXPORT	operator+(const utf8* utf8_str, const String& str);
+
+/*!
+\brief
+	Return String object that is the concatenation of the given inputs
+
+\param str
+	String object describing the first part of the new string
+
+\param code_point
+	utf32 code point describing the second part of the new string
+
+\return
+	A String object that is the concatenation of \a str and \a code_point
+
+\exception std::length_error	Thrown if the resulting String would be too large.
+*/
+String CEGUIEXPORT	operator+(const String& str, utf32 code_point);
+
+/*!
+\brief
+	Return String object that is the concatenation of the given inputs
+
+\param code_point
+	utf32 code point describing the first part of the new string
+
+\param str
+	String object describing the second part of the new string
+
+\return
+	A String object that is the concatenation of \a code_point and \a str
+
+\exception std::length_error	Thrown if the resulting String would be too large.
+*/
+String CEGUIEXPORT	operator+(utf32 code_point, const String& str);
+
+/*!
+\brief
+	Return String object that is the concatenation of the given inputs
+
+\param str
+	String object describing first part of the new string
+
+\param c_str
+	c-string describing the second part of the new string
+
+\return
+	A String object that is the concatenation of \a str and \a c_str
+
+\exception std::length_error	Thrown if the resulting String would be too large.
+*/
+String CEGUIEXPORT	operator+(const String& str, const char* c_str);
+
+/*!
+\brief
+	Return String object that is the concatenation of the given inputs
+
+\param c_str
+	c-string describing the first part of the new string
+
+\param str
+	String object describing the second part of the new string
+
+\return
+	A String object that is the concatenation of \a c_str and \a str
+
+\exception std::length_error	Thrown if the resulting String would be too large.
+*/
+String CEGUIEXPORT	operator+(const char* c_str, const String& str);
+
+
+//////////////////////////////////////////////////////////////////////////
+// Output (stream) functions
+//////////////////////////////////////////////////////////////////////////
+CEGUIEXPORT std::ostream& operator<<(std::ostream& s, const String& str);
+
+
+//////////////////////////////////////////////////////////////////////////
+// Modifying operations
+//////////////////////////////////////////////////////////////////////////
+/*!
+\brief
+	Swap the contents for two String objects
+
+\param str1
+	String object who's contents are to be swapped with \a str2
+
+\param str2
+	String object who's contents are to be swapped with \a str1
+
+\return
+	Nothing
+*/
+void CEGUIEXPORT swap(String& str1, String& str2);
+
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIString_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIBase.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIBase.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIBase.h	(revision 1812)
@@ -0,0 +1,171 @@
+/************************************************************************
+	filename: 	CEGUIBase.h
+	created:	20/2/2004
+	author:		Paul D Turner
+	
+	purpose:	Base include used within the system
+				This contains various lower level bits required
+				by other parts of the system.  All other library 
+				headers will include this file.
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIBase_h_
+#define _CEGUIBase_h_
+
+#include <cassert>
+
+// bring in configuration options
+#include "CEGUIConfig.h"
+
+// add CEGUI version defines
+#include "CEGUIVersion.h"
+
+/*************************************************************************
+	Dynamic Library import / export control conditional
+	(Define CEGUIBASE_EXPORTS to export symbols, else they are imported)
+*************************************************************************/
+#if defined( __WIN32__ ) || defined( _WIN32 )
+#   ifdef CEGUIBASE_EXPORTS
+#       define CEGUIEXPORT __declspec(dllexport)
+#   else
+#       define CEGUIEXPORT __declspec(dllimport)
+#   endif
+#       define CEGUIPRIVATE
+#else
+#       define CEGUIEXPORT
+#       define CEGUIPRIVATE
+#endif
+
+
+// totally kill this warning (debug info truncated to 255 chars etc...) on <= VC6
+#if defined(_MSC_VER) && (_MSC_VER <= 1200)
+#   pragma warning(disable : 4786)
+#endif
+
+
+// Detect macros for min / max and undefine (with a warning where possible)
+#if defined(max)
+#   if defined(_MSC_VER)
+#       pragma message("Macro defintion of max detected - undefining")
+#   elif defined (__GNUC__)
+#       warning ("Macro defintion of max detected - undefining")
+#   endif
+#   undef max
+#endif
+#if defined(min)
+#   if defined(_MSC_VER)
+#       pragma message("Macro defintion of min detected - undefining")
+#   elif defined (__GNUC__)
+#       warning ("Macro defintion of min detected - undefining")
+#   endif
+#   undef min
+#endif
+
+
+// include this to see if it defines _STLPORT_VERION
+#	include <string>
+
+// fix to undefine _STLP_DEBUG if STLport is not actually being used
+// (resolves some unresolved externals concerning boost)
+#if defined(_STLP_DEBUG) && defined(_MSC_VER) && (_MSC_VER >= 1200)
+#	if !defined(_STLPORT_VERSION)
+#		undef _STLP_DEBUG
+#	endif
+#endif
+
+
+// The following defines macros used within CEGUI for std::min/std::max
+// usage, and is done as a compatibility measure for VC6 with native STL.
+#if defined(_MSC_VER) && (_MSC_VER <= 1200) && !defined(_STLPORT_VERSION)
+#    define ceguimin	std::_cpp_min
+#    define ceguimax	std::_cpp_max
+#else
+#    define ceguimin	std::min
+#    define ceguimax	std::max
+#endif
+
+
+/*************************************************************************
+	Documentation for the CEGUI namespace itself
+*************************************************************************/
+/*!
+\brief
+	Main namespace for Crazy Eddie's GUI Library
+
+	The CEGUI namespace contains all the classes and other items that comprise the core
+	of Crazy Eddie's GUI system.
+*/
+namespace CEGUI
+{
+
+/*************************************************************************
+	Simplification of some 'unsigned' types
+*************************************************************************/
+typedef	unsigned long	ulong;
+typedef unsigned short	ushort;
+typedef unsigned int	uint;
+typedef unsigned char	uchar;
+
+typedef unsigned int    uint32;
+typedef unsigned short  uint16;
+typedef unsigned char   uint8;
+
+
+/*************************************************************************
+	System wide constants
+*************************************************************************/
+static const float		DefaultNativeHorzRes	= 640.0f;		//!< Default native horizontal resolution (for fonts and imagesets)
+static const float		DefaultNativeVertRes	= 480.0f;		//!< Default native vertical resolution (for fonts and imagesets)
+
+
+/*************************************************************************
+    Additional typedefs
+*************************************************************************/
+typedef std::ostream OutStream;     //!< Output stream class.
+}  // end of CEGUI namespace section
+
+
+/*!
+\brief
+	Macro used to return a float value rounded to the nearest integer.
+
+	This macro is used throughout the library to ensure that elements are
+	kept at integer pixel positions on the display.
+
+\param x
+	Expression to be rounded to nearest whole number
+
+\return
+	\a x after having been rounded
+*/
+#if defined(CEGUI_ALIGN_ELEMENTS_TO_PIXELS)
+#	define PixelAligned(x)	( (float)(int)(( x ) + 0.5f) )
+#else
+#	define PixelAligned(x)	( x )
+#endif
+
+
+/*************************************************************************
+	Bring in forward references to all GUI base system classes
+*************************************************************************/
+#include "CEGUIForwardRefs.h"
+
+
+#endif	// end of guard _CEGUIBase_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIScriptModule.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIScriptModule.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIScriptModule.h	(revision 1812)
@@ -0,0 +1,182 @@
+/************************************************************************
+	filename: 	CEGUIScriptModule.h
+	created:	16/7/2004
+	author:		Paul D Turner
+
+	purpose:	Abstract class interface for scripting support
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIScriptModule_h_
+#define _CEGUIScriptModule_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIString.h"
+#include "CEGUIEvent.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Abstract interface required for all scripting support modules to be used with
+	the CEGUI system.
+*/
+class CEGUIEXPORT ScriptModule
+{
+public:
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for ScriptModule base class
+	*/
+	ScriptModule(void);
+
+
+	/*!
+	\brief
+		Destructor for ScriptModule base class.
+	*/
+	virtual ~ScriptModule(void) {}
+
+
+	/*************************************************************************
+		Abstract interface
+	*************************************************************************/
+	/*!
+	\brief
+		Execute a script file.
+
+	\param filename
+		String object holding the filename of the script file that is to be executed
+		
+	\param resourceGroup
+		Resource group idendifier to be passed to the ResourceProvider when loading the script file.
+	*/
+	virtual	void	executeScriptFile(const String& filename, const String& resourceGroup = "")	= 0;
+
+
+	/*!
+	\brief
+		Execute a scripted global function.  The function should not take any parameters and should return an integer.
+
+	\param function_name
+		String object holding the name of the function, in the global script environment, that
+		is to be executed.
+
+	\return
+		The integer value returned from the script function.
+	*/
+	virtual int	executeScriptGlobal(const String& function_name)	= 0;
+
+
+	/*!
+	\brief
+		Execute a scripted global 'event handler' function.  The function should take some kind of EventArgs like parameter
+		that the concrete implementation of this function can create from the passed EventArgs based object.  The function
+		should not return anything.
+
+	\param handler_name
+		String object holding the name of the scripted handler function.
+
+	\param e
+		EventArgs based object that should be passed, by any appropriate means, to the scripted function.
+
+	\return
+		- true if the event was handled.
+		- false if the event was not handled.
+	*/
+	virtual	bool	executeScriptedEventHandler(const String& handler_name, const EventArgs& e)		= 0;
+
+
+    /*!
+    \brief
+        Execute script code contained in the given CEGUI::String object.
+
+    \param str
+        String object holding the valid script code that should be executed.
+
+    \return
+        Nothing.
+    */
+    virtual void executeString(const String& str) = 0;
+
+
+    /*!
+    \brief
+        Method called during system initialisation, prior to running any scripts via the ScriptModule, to enable the ScriptModule
+        to perform any operations required to complete initialisation or binding of the script language to the gui system objects.
+
+    \return
+        Nothing.
+    */
+    virtual void createBindings(void) {}
+
+
+    /*!
+    \brief
+        Method called during system destruction, after all scripts have been run via the ScriptModule, to enable the ScriptModule
+        to perform any operations required to cleanup bindings of the script language to the gui system objects, as set-up in the
+        earlier createBindings call.
+
+    \return
+        Nothing.
+    */
+    virtual void destroyBindings(void) {}
+
+    /*!
+    \brief
+        Return identification string for the ScriptModule.  If the internal id string has not been
+        set by the ScriptModule creator, a generic string of "Unknown scripting module" will be returned.
+
+    \return
+        String object holding a string that identifies the ScriptModule in use.
+    */
+    const String& getIdentifierString() const;
+
+protected:
+    String d_identifierString;                 //!< String that holds some id information about the module.
+};
+
+
+/*!
+\brief
+	Functor class used for binding named script functions to events
+*/
+class ScriptFunctor
+{
+public:
+	ScriptFunctor(const String& functionName) : scriptFunctionName(functionName) {}
+    ScriptFunctor(const ScriptFunctor& obj) : scriptFunctionName(obj.scriptFunctionName) {}
+	bool	operator()(const EventArgs& e) const;
+
+private:
+    // no assignment possible
+    ScriptFunctor& operator=(const ScriptFunctor& rhs);
+
+	const String	scriptFunctionName;
+};
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIScriptModule_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIDataContainer.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIDataContainer.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIDataContainer.h	(revision 1812)
@@ -0,0 +1,154 @@
+/************************************************************************
+	filename: 	CEGUIDataContainer.h
+	created:	10/8/2004
+	author:		James '_mental_' O'Sullivan
+	
+	purpose:	Defines abstract base class for Window objects
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIDataContainer_h_
+#define _CEGUIDataContainer_h_
+
+#include "CEGUIBase.h"
+
+#include <malloc.h>
+//#include <xercesc/sax/InputSource.hpp>
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+template <class T>
+class CEGUIEXPORT DataContainer
+{
+public:
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for DataContainer class
+	*/
+    DataContainer()
+      : mData(0),
+        mSize(0)
+    {
+    }
+
+	/*!
+	\brief
+		Destructor for DataContainer class
+	*/
+	virtual ~DataContainer(void) 
+    { 
+        release();
+    }
+
+	/*************************************************************************
+		Accessor functions
+	*************************************************************************/
+	/*!
+	\brief
+		Set a pointer to the external data.
+
+	\param data
+        Pointer to a object of type T, where T defined when the template is specialized.
+	*/
+    void setData(T* data) { mData = data; }
+
+	/*!
+	\brief
+		Return a pointer to the external data
+
+	\return
+		Pointer to an object of type T, where T defined when the template is specialized.
+	*/
+    T* getDataPtr(void) { return mData; }
+
+	/*!
+	\brief
+	    Set the size of the external data.  This maybe zero depending on the type of T.
+
+	\param size
+	    size_t containing the size of the external data
+	*/
+    void setSize(size_t size) { mSize = size; }
+
+	/*!
+	\brief
+		Get the size of the external data.  This maybe zero depending on the type of T.
+
+	\return
+	    size_t containing the size of the external data
+	*/
+    size_t getSize(void) const { return mSize; }
+
+	/*!
+	\brief
+		Release supplied data.
+
+	*/
+    virtual void release(void)
+    {
+        if(mData)
+        {
+            delete mData;
+            mData = 0;
+        }
+    }
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+protected:
+    T* mData;
+    size_t mSize;
+};
+
+// Specialized templates
+class RawDataContainer : public DataContainer<unsigned char> 
+{
+public:
+    RawDataContainer() : DataContainer<unsigned char>()
+    {
+    }
+
+    ~RawDataContainer() 
+    {
+        release();
+    }
+
+    void release(void)
+    {
+        if(mData)
+        {
+            delete [] mData;
+            mData = 0;
+        }
+    }
+};
+
+//typedef DataContainer<unsigned char> RawDataContainer;
+//typedef DataContainer<XERCES_CPP_NAMESPACE::InputSource> InputSourceContainer;
+
+} // End of  CEGUI namespace section
+
+#endif	// end of guard _CEGUIDataContainer_h_
+
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIRenderableFrame.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIRenderableFrame.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIRenderableFrame.h	(revision 1812)
@@ -0,0 +1,190 @@
+/************************************************************************
+	filename: 	CEGUIRenderableFrame.h
+	created:	14/4/2004
+	author:		Paul D Turner
+	
+	purpose:	Interface to RenderableFrame UI construct
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIRenderableFrame_h_
+#define _CEGUIRenderableFrame_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIRenderableElement.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Enumeration of positions for a frame.
+*/
+enum FrameLocation
+{
+	Invalid,			// Value reserved to indicate some invalid or unknown location.
+	TopLeftCorner,		// Top-Left corner of a frame / rectangle.
+	TopRightCorner,		// Top-Right corner of a frame / rectangle.
+	BottomLeftCorner,	// Bottom-Left corner of a frame / rectangle.
+	BottomRightCorner,	// Bottom-Right corner of a frame / rectangle.
+	LeftEdge,			// Left edge of a frame / rectangle.	
+	TopEdge,			// Top edge of a frame / rectangle.
+	RightEdge,			// Right edge of a frame / rectangle.
+	BottomEdge			// Bottom edge of a frame / rectangle.
+};
+
+
+/*!
+\brief
+	A higher order GUI entity that represents a renderable frame.
+
+	This class is intended to be used where a (usually top-level) GUI element needs to draw a frame that is constructed from
+	a collection of Images.  It is possible to specify the image to use for each of the four corners, which are placed appropriately
+	at their natural size, and the images for the four edges, which are stretched to cover the area between any corner images.  Any
+	of the Images may be omitted, in which case that part of the frame is not drawn.  If the GUI element uses only one image for its
+	frame (usually stretched over the entire area of the element) then a better choice would be to use a RenderableImage, or perform the
+	rendering directly instead.
+*/
+class CEGUIEXPORT RenderableFrame : public RenderableElement
+{
+public:
+	/*************************************************************************
+		Construction / Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Default constructor for RenderableFrame
+	*/
+	RenderableFrame(void);
+
+
+	/*!
+	\brief
+		Destructor for RenderableFrame
+	*/
+	virtual ~RenderableFrame(void);
+
+
+	/*!
+	\brief
+		specify the Image objects to use for each part of the frame.  A NULL may be used to omit any part.
+
+	\param topleft
+		Pointer to an Image object to render as the top-left corner of the frame.  Specify NULL to omit this part of the frame.
+
+	\param topright
+		Pointer to an Image object to render as the top-right corner of the frame.  Specify NULL to omit this part of the frame.
+
+	\param bottomleft
+		Pointer to an Image object to render as the bottom-left corner of the frame.  Specify NULL to omit this part of the frame.
+
+	\param bottomright
+		Pointer to an Image object to render as the bottom-right corner of the frame.  Specify NULL to omit this part of the frame.
+
+	\param left
+		Pointer to an Image object to render as the left edge of the frame.  Specify NULL to omit this part of the frame.
+
+	\param top
+		Pointer to an Image object to render as the top edge of the frame.  Specify NULL to omit this part of the frame.
+
+	\param right
+		Pointer to an Image object to render as the right edge of the frame.  Specify NULL to omit this part of the frame.
+
+	\param bottom
+		Pointer to an Image object to render as the bottom edge of the frame.  Specify NULL to omit this part of the frame.
+
+	\return
+		Nothing
+	*/
+	void	setImages(const Image* topleft, const Image* topright, const Image* bottomleft, const Image* bottomright, const Image* left, const Image* top, const Image* right, const Image* bottom);
+
+
+	/*!
+	\brief
+		Set the Image to use for the specified location of the frame.
+
+	\param location
+		One of the FrameLocation enumerated values specifying the image to be returned.
+
+	\param image
+		Pointer to the Image to use for the frame location specified in \a location.  May be NULL to indicate the
+		frame component is not required.
+
+	\return
+		Nothing.
+	*/
+	void	setImageForLocation(FrameLocation location, const Image* image);
+
+
+
+	/*!
+	\brief
+		Return the Image being used for the specified location of the frame.
+
+	\param location
+		One of the FrameLocation enumerated values specifying the image to be returned.
+
+	\return
+		Pointer to the Image object currently set for the frame location specified in \a location.  May return NULL if no
+		Image is set for the requested position.
+	*/
+	const Image*	getImageForLocation(FrameLocation location) const;
+
+
+protected:
+	/*************************************************************************
+		Implementation functions
+	*************************************************************************/
+	/*!
+	\brief
+		Renders the imagery for a RenderableFrame element.
+
+	\param position
+		Vector3 object describing the final rendering position for the object.
+
+	\param clip_rect
+		Rect object describing the clipping area for the rendering.  No rendering will be performed outside this area.
+
+	\return
+		Nothing.
+	*/
+	void draw_impl(const Vector3& position, const Rect& clip_rect) const;
+
+    // implements abstract method
+    void draw_impl(RenderCache& renderCache) const;
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	// image pointers
+	const Image*	d_topleft;			//!< Image to draw for the top-left corner.
+	const Image*	d_topright;			//!< Image to draw for the top-right corner.
+	const Image*	d_bottomleft;		//!< Image to draw for the bottom-left corner.
+	const Image*	d_bottomright;		//!< Image to draw for the bottom-right corner.
+	const Image*	d_left;				//!< Image to draw for the left edge.
+	const Image*	d_right;			//!< Image to draw for the right edge.
+	const Image*	d_top;				//!< Image to draw for the top edge.
+	const Image*	d_bottom;			//!< Image to draw for the bottom edge.
+};
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIRenderableFrame_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUILogger.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUILogger.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUILogger.h	(revision 1812)
@@ -0,0 +1,180 @@
+/************************************************************************
+	filename: 	CEGUILogger.h
+	created:	21/2/2004
+	author:		Paul D Turner
+
+	purpose:	Defines interface for the Logger class
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUILogger_h_
+#define _CEGUILogger_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIString.h"
+#include <fstream>
+#include <sstream>
+#include <vector>
+#include <utility>
+#include "CEGUISingleton.h"
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4275)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+	Enumeration of logging levels
+*/
+enum LoggingLevel
+{
+	Errors,			//!< Only actual error conditions will be logged.
+	Standard,		//!< Basic events will be logged (default level).
+	Informative,	//!< Useful tracing (object creations etc) information will be logged.
+	Insane			//!< Mostly everything gets logged (use for heavy tracing only, log WILL be big).
+};
+
+/*!
+\brief
+	Class that implements logging for the GUI system
+*/
+class CEGUIEXPORT Logger : public Singleton <Logger>
+{
+public:
+	/*!
+	\brief
+		Constructor for Logger object.
+	*/
+	Logger(void);
+
+	/*!
+	\brief Destructor for Logger object.
+	*/
+	~Logger(void);
+
+
+	/*!
+	\brief
+		Return the singleton Logger object
+
+	\return
+		Reference to the one and only Logger object
+	*/
+	static Logger&	getSingleton(void);
+
+
+	/*!
+	\brief
+		Set the level of logging information that will get out to the log file
+
+	\param level
+		One of the LoggingLevel enumerated values that specified the level of logging information required.
+
+	\return
+		Nothing
+	*/
+	void	setLoggingLevel(LoggingLevel level)		{d_level = level;}
+
+
+	/*!
+	\brief
+		return the current logging level setting
+
+	\return
+		One of the LoggingLevel enumerated values specifying the current level of logging
+	*/
+	LoggingLevel	getLoggingLevel(void) const		{return d_level;}
+
+
+	/*!
+	\brief
+		Add an event to the log.
+
+	\param message
+		String object containing the message to be added to the event log.
+
+	\param level
+		LoggingLevel for this message.  If \a level is greater than the current set logging level, the message is not logged.
+
+	\return
+		Nothing
+	*/
+	void	logEvent(const String& message, LoggingLevel level = Standard);
+
+    /*!
+    \brief
+        Set the name of the log file where all subsequent log entries should be written.
+
+    \note
+        When this is called, and the log file is created, any cached log entries are
+        flushed to the log file.
+
+    \param filename
+        Name of the file to put log messages.
+
+    \param append
+        - true if events should be added to the end of the current file.
+        - false if the current contents of the file should be discarded.
+     */
+    void    setLogFilename(const String& filename, bool append = false);
+
+protected:
+    /*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	LoggingLevel	d_level;		//!< Holds current logging level
+	std::ofstream	d_ostream;		//!< Stream used to implement the logger
+    std::vector<std::pair<String, LoggingLevel> > d_cache;    //!< Used to cache log entries before log file is created.
+    std::ostringstream d_workstream;//!< Used to build log entry strings.
+    bool d_caching;                 //!< true while log entries are beign cached (prior to logfile creation)
+
+private:
+	/*************************************************************************
+		Copy constructor and assignment usage is denied.
+	*************************************************************************/
+	Logger(const Logger& logger) : Singleton <Logger>() {}
+	Logger& operator=(const Logger& logger) {return *this;}
+
+};
+
+/*************************************************************************
+	This macro is used for 'Insane' level logging so that those items are
+	excluded from non-debug builds
+*************************************************************************/
+#if defined(DEBUG) || defined (_DEBUG)
+#	define CEGUI_LOGINSANE( message ) CEGUI::Logger::getSingleton().logEvent((message), CEGUI::Insane);
+#else
+#	define CEGUI_LOGINSANE( message )
+#endif
+
+} // End of  CEGUI namespace section
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUILogger_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUITinyXMLParser.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUITinyXMLParser.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUITinyXMLParser.h	(revision 1812)
@@ -0,0 +1,55 @@
+/************************************************************************
+    filename:   CEGUITinyXMLParser.h
+    created:    Sun Mar 13 2005
+    author:     Paul D Turner
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+ 
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+ 
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+ 
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUITinyXMLParser_h_
+#define _CEGUITinyXMLParser_h_
+
+#include "CEGUIXMLParser.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+    /*!
+    \brief
+    Implementation of XMLParser using TinyXML
+     */
+    class TinyXMLParser : public XMLParser
+    {
+    public:
+        TinyXMLParser(void);
+        ~TinyXMLParser(void);
+
+        // Implementation of public abstract interface
+        void parseXMLFile(XMLHandler& handler, const String& filename, const String& schemaName, const String& resourceGroup);
+
+    protected:
+        // Implementation of abstract interface.
+        bool initialiseImpl(void);
+        void cleanupImpl(void);
+    };
+
+} // End of  CEGUI namespace section
+
+
+#endif  // end of guard _CEGUITinyXMLParser_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIIteratorBase.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIIteratorBase.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIIteratorBase.h	(revision 1812)
@@ -0,0 +1,276 @@
+/************************************************************************
+	filename: 	CEGUIIteratorBase.h
+	created:	26/7/2004
+	author:		Paul D Turner
+	
+	purpose:	Defines interface for base iterator class
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+/*************************************************************************
+	This is based somewhat on MapIterator in the Ogre library (www.ogre3d.org)
+*************************************************************************/
+#ifndef _CEGUIIteratorBase_h_
+#define _CEGUIIteratorBase_h_
+
+#include "CEGUIBase.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Base class constant iterator used to offer iteration over various collections within the system.
+*/
+template<class T>
+class ConstBaseIterator
+{
+public:
+#if defined(_MSC_VER) && (_MSC_VER <= 1200) && !defined(_STLPORT_VERSION)
+	typedef typename T::referent_type	mapped_type;
+#else
+	typedef typename T::mapped_type		mapped_type;
+#endif
+
+	/*!
+	\brief
+		ConstBaseIterator constructor
+
+	\param start_iter
+		'real' iterator that will be the start of the range to be iterated over by this iterator.
+
+	\param end_iter
+		'real' iterator that will be the end of the range to be iterated over by this iterator.
+	*/
+	ConstBaseIterator(typename T::const_iterator start_iter, typename T::const_iterator end_iter) :
+		d_currIter(start_iter),
+		d_startIter(start_iter),
+		d_endIter(end_iter)
+	{
+	}
+
+	
+	/*!
+	\brief
+		ConstBaseIterator destructor
+	*/
+	~ConstBaseIterator(void)
+	{
+	}
+
+
+	/*!
+	\brief
+		ConstBaseIterator copy constructor
+	*/
+	ConstBaseIterator(const ConstBaseIterator<T>& org) :
+		d_currIter(org.d_currIter),
+		d_startIter(org.d_startIter),
+		d_endIter(org.d_endIter)
+	{
+	}
+
+
+	/*!
+	\brief
+		ConstBaseIterator assignment operator
+	*/
+	ConstBaseIterator<T>&	operator=(const ConstBaseIterator<T>& rhs)
+	{
+		d_currIter	= rhs.d_currIter;
+		d_startIter	= rhs.d_startIter;
+		d_endIter	= rhs.d_endIter;
+
+		return *this;
+	}
+
+
+	/*!
+	\brief
+		Return the key for the item at the current iterator position.
+	*/
+	typename T::key_type	getCurrentKey(void) const
+	{
+		return d_currIter->first;
+	}
+
+
+	/*!
+	\brief
+		Return the value for the item at the current iterator position.
+	*/
+	mapped_type	getCurrentValue(void) const
+	{
+		return d_currIter->second;
+	}
+
+
+	/*!
+	\brief
+		Return whether the current iterator position is at the end of the iterators range.
+	*/
+	bool	isAtEnd(void) const
+	{
+		return d_currIter == d_endIter;
+	}
+
+
+	/*!
+	\brief
+		Return whether the current iterator position is at the start of the iterators range.
+	*/
+	bool	isAtStart(void) const
+	{
+		return d_currIter == d_startIter;
+	}
+
+
+	/*!
+	\brief
+		Increase the iterator position (prefix increment).
+
+	\note
+		The iterator is checked, and this call will always succeed, so do not rely on some exception to exit a loop.
+	*/
+	ConstBaseIterator<T>&	operator++()
+	{
+		if (d_currIter != d_endIter)
+			++d_currIter;
+
+		return *this;
+	}
+
+
+	/*!
+	\brief
+		Increase the iterator position (postfix increment).
+
+	\note
+		The iterator is checked, and this call will always succeed, so do not rely on some exception to exit a loop.
+	*/
+	ConstBaseIterator<T>	operator++(int)
+	{
+		ConstBaseIterator<T> tmp = *this;
+		++*this;
+
+		return tmp;
+	}
+
+
+	/*!
+	\brief
+		Decrease the iterator position (prefix decrement).
+
+	\note
+		The iterator is checked, and this call will always succeed, so do not rely on some exception to exit a loop.
+	*/
+	ConstBaseIterator<T>&	operator--()
+	{
+		if (d_currIter != d_startIter)
+			--d_currIter;
+
+		return *this;
+	}
+
+
+	/*!
+	\brief
+		Decrease the iterator position (postfix decrement).
+
+	\note
+		The iterator is checked, and this call will always succeed, so do not rely on some exception to exit a loop.
+	*/
+	ConstBaseIterator<T>	operator--(int)
+	{
+		ConstBaseIterator<T> tmp = *this;
+		--*this;
+
+		return tmp;
+	}
+
+
+	/*!
+	\brief
+		Compares two iterators.  Return true if the current position of both iterators are equivalent.
+	*/
+	bool	operator==(const ConstBaseIterator<T>& rhs) const
+	{
+		return d_currIter == rhs.d_currIter;
+	}
+
+
+	/*!
+	\brief
+		Compares two iterators.  Return true if the current position of the iterators are different.
+	*/
+	bool	operator!=(const ConstBaseIterator<T>& rhs) const
+	{
+		return !this == rhs;
+	}
+
+
+	/*!
+	\brief
+		Return the value for the current iterator position.
+	*/
+	mapped_type	operator*() const
+	{
+		return d_currIter->second;
+	}
+
+
+	/*!
+	\brief
+		Set the iterator current position to the start position.
+	*/
+	void	toStart(void)
+	{
+		d_currIter = d_startIter;
+	}
+
+
+	/*!
+	\brief
+		Set the iterator current position to the end position.
+	*/
+	void	toEnd(void)
+	{
+		d_currIter = d_endIter;
+	}
+
+
+private:
+	/*************************************************************************
+		No default construction available
+	*************************************************************************/
+	ConstBaseIterator(void) {}
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	typename T::const_iterator	d_currIter;		//!< 'real' iterator describing the current position within the collection.
+	typename T::const_iterator	d_startIter;	//!< 'real' iterator describing the start position within the collection (or what we were told was the start).
+	typename T::const_iterator	d_endIter;		//!< 'real' iterator describing the end position within the collection (or what we were told was the end).
+};
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIIteratorBase_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUISystem.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUISystem.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUISystem.h	(revision 1812)
@@ -0,0 +1,1028 @@
+/************************************************************************
+	filename: 	CEGUISystem.h
+	created:	20/2/2004
+	author:		Paul D Turner
+
+	purpose:	Defines interface for main GUI system class
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUISystem_h_
+#define _CEGUISystem_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIString.h"
+#include "CEGUISingleton.h"
+#include "CEGUIRenderer.h"
+#include "CEGUIMouseCursor.h"
+#include "CEGUIInputEvent.h"
+#include "CEGUIResourceProvider.h"
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4275)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+//! Implementation struct that tracks and controls multiclick for mouse buttons.
+struct MouseClickTrackerImpl;
+
+
+/*!
+\brief
+	The System class is the CEGUI class that provides access to all other elements in this system.
+
+	This object must be created by the client application.  The System object requires that you pass it
+	an initialised Renderer object which it can use to interface to whatever rendering system will be
+	used to display the GUI imagery.
+*/
+class CEGUIEXPORT System : public Singleton<System>, public EventSet
+{
+public:
+	static const String EventNamespace;				//!< Namespace for global events
+
+	/*************************************************************************
+		Constants
+	*************************************************************************/
+	static const double		DefaultSingleClickTimeout;		//!< Default timeout for generation of single click events.
+	static const double		DefaultMultiClickTimeout;		//!< Default timeout for generation of multi-click events.
+	static const Size		DefaultMultiClickAreaSize;		//!< Default allowable mouse movement for multi-click event generation.
+
+	// event names
+	static const String EventGUISheetChanged;				//!< Name of event fired whenever the GUI sheet is changed.
+	static const String EventSingleClickTimeoutChanged;	//!< Name of event fired when the single-click timeout is changed.
+	static const String EventMultiClickTimeoutChanged;	//!< Name of event fired when the multi-click timeout is changed.
+	static const String EventMultiClickAreaSizeChanged;	//!< Name of event fired when the size of the multi-click tolerance area is changed.
+	static const String EventDefaultFontChanged;			//!< Name of event fired when the default font changes.
+	static const String EventDefaultMouseCursorChanged;	//!< Name of event fired when the default mouse cursor changes.
+	static const String EventMouseMoveScalingChanged;		//!< Name of event fired when the mouse move scaling factor changes.
+
+
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructs a System object.
+
+	\param renderer
+		Pointer to the valid Renderer object that will be used to render GUI imagery
+
+	\param logFile
+		pointer to a utf8 encoded buffer containing the name to use for the log file.
+	*/
+	System(Renderer* renderer, const utf8* logFile = (const utf8*)"CEGUI.log");
+
+	/*!
+	\brief
+		Construct a new System object
+
+	\param renderer
+		Pointer to the valid Renderer object that will be used to render GUI imagery
+
+	\param resourceProvider
+		Pointer to a ResourceProvider object.
+
+	\param logFile
+		pointer to a utf8 encoded buffer containing the name to use for the log file.
+	*/
+    System(Renderer* renderer, ResourceProvider* resourceProvider, const utf8* logFile = (const utf8*)"CEGUI.log");
+
+
+	/*!
+	\brief
+		Construct a new System object
+
+	\param renderer
+		Pointer to the valid Renderer object that will be used to render GUI imagery
+
+	\param scriptModule
+		Pointer to a ScriptModule object.  may be NULL.
+
+	\param configFile
+		pointer to a utf8 encoded buffer containing the name to use for the configuration file.
+	*/
+	System(Renderer* renderer, ScriptModule* scriptModule, const utf8* configFile = (const utf8*)"cegui.config");
+
+
+	/*!
+	\brief
+		Construct a new System object
+
+	\param renderer
+		Pointer to the valid Renderer object that will be used to render GUI imagery
+
+	\param scriptModule
+		Pointer to a ScriptModule object.  may be NULL.
+
+	\param resourceProvider
+		Pointer to a ResourceProvider object.
+
+	\param configFile
+		pointer to a utf8 encoded buffer containing the name to use for the configuration file.
+	*/
+	System(Renderer* renderer, ScriptModule* scriptModule, ResourceProvider* resourceProvider, const utf8* configFile = (const utf8*)"cegui.config");
+
+
+    /*!
+    \brief
+        Constructs a System object.
+
+    \param renderer
+        Pointer to the valid Renderer object that will be used to render GUI imagery
+
+    \param xmlParser
+        Pointer to a valid XMLParser object to be used when parsing XML files, or NULL to use a default parser.
+
+    \param logFile
+        pointer to a utf8 encoded buffer containing the name to use for the log file.
+    */
+    System(Renderer* renderer, XMLParser* xmlParser, const utf8* logFile = (const utf8*)"CEGUI.log");
+
+    
+    /*!
+    \brief
+        Constructs a System object.
+
+    \param renderer
+        Pointer to the valid Renderer object that will be used to render GUI imagery
+
+    \param resourceProvider
+        Pointer to a ResourceProvider object.
+    
+    \param xmlParser
+        Pointer to a valid XMLParser object to be used when parsing XML files, or NULL to use a default parser.
+
+    \param logFile
+        pointer to a utf8 encoded buffer containing the name to use for the log file.
+    */
+    System(Renderer* renderer, ResourceProvider* resourceProvider, XMLParser* xmlParser, const utf8* logFile = (const utf8*)"CEGUI.log");
+
+    
+    /*!
+    \brief
+        Construct a new System object
+
+    \param renderer
+        Pointer to the valid Renderer object that will be used to render GUI imagery
+
+    \param xmlParser
+        Pointer to a valid XMLParser object to be used when parsing XML files, or NULL to use a default parser.
+    
+    \param scriptModule
+        Pointer to a ScriptModule object.  may be NULL.
+
+    \param configFile
+        pointer to a utf8 encoded buffer containing the name to use for the configuration file.
+    */
+    System(Renderer* renderer, XMLParser* xmlParser, ScriptModule* scriptModule, const utf8* configFile = (const utf8*)"cegui.config");
+
+        
+    /*!
+    \brief
+        Construct a new System object
+
+    \param renderer
+        Pointer to the valid Renderer object that will be used to render GUI imagery
+
+    \param resourceProvider
+        Pointer to a ResourceProvider object.
+    
+    \param xmlParser
+        Pointer to a valid XMLParser object to be used when parsing XML files, or NULL to use a default parser.
+    
+    \param scriptModule
+        Pointer to a ScriptModule object.  may be NULL.
+
+    \param configFile
+        pointer to a utf8 encoded buffer containing the name to use for the configuration file.
+    */
+    System(Renderer* renderer, ResourceProvider* resourceProvider, XMLParser* xmlParser, ScriptModule* scriptModule, const utf8* configFile = (const utf8*)"cegui.config");
+
+
+	/*!
+	\brief
+		Destructor for System objects.
+	*/
+	~System(void);
+
+
+	/*!
+	\brief
+		Return a pointer to the Renderer object being used by the system
+
+	\return
+		Pointer to the Renderer object used by the system.
+	*/
+	Renderer*	getRenderer(void) const			{return d_renderer;}
+
+
+	/*!
+	\brief
+		Return singleton System object
+
+	\return
+		Singleton System object
+	*/
+	static	System&	getSingleton(void);
+
+
+	/*!
+	\brief
+		Return pointer to singleton System object
+
+	\return
+		Pointer to singleton System object
+	*/
+	static	System*	getSingletonPtr(void);
+
+
+	/*!
+	\brief
+		Set the default font to be used by the system
+
+	\param name
+		String object containing the name of the font to be used as the system default.
+
+	\return
+		Nothing.
+	*/
+	void	setDefaultFont(const String& name);
+
+
+	/*!
+	\brief
+		Set the default font to be used by the system
+
+	\param font
+		Pointer to the font to be used as the system default.
+
+	\return
+		Nothing.
+	*/
+	void	setDefaultFont(Font* font);
+
+
+	/*!
+	\brief
+		Return a pointer to the default Font for the GUI system
+
+	\return
+		Pointer to a Font object that is the default font in the system.
+	*/
+	Font*	getDefaultFont(void) const				{return d_defaultFont;}
+
+
+	/*!
+	\brief
+		Causes a full re-draw next time renderGUI() is called
+
+	\return
+		Nothing
+	*/
+	void	signalRedraw()		{d_gui_redraw = true;}
+
+
+	/*!
+	\brief
+		Return a boolean value to indicate whether a full re-draw is requested next time renderGUI() is called.
+
+	\return
+		true if a re-draw has been requested
+	*/
+	bool	isRedrawRequested() const		{return d_gui_redraw;}
+
+
+	/*!
+	\brief
+		Render the GUI
+
+		Depending upon the internal state, this may either re-use rendering from last time, or trigger a full re-draw from all elements.
+
+	\return
+		Nothing
+	*/
+	void	renderGUI(void);
+
+
+	/*!
+	\brief
+		Set the active GUI sheet (root) window.
+
+	\param sheet
+		Pointer to a Window object that will become the new GUI 'root'
+
+	\return
+		Pointer to the window that was previously set as the GUI root.
+	*/
+	Window*	setGUISheet(Window* sheet);
+
+
+	/*!
+	\brief
+		Return a pointer to the active GUI sheet (root) window.
+
+	\return
+		Pointer to the window object that has been set as the GUI root element.
+	*/
+	Window*	getGUISheet(void) const		{return d_activeSheet;}
+
+
+	/*!
+	\brief
+		Return the current timeout for generation of single-click events.
+
+		A single-click is defined here as a button being pressed and then released.
+
+	\return
+		double value equal to the current single-click timeout value.
+	*/
+	double	getSingleClickTimeout(void) const		{return d_click_timeout;}
+
+
+	/*!
+	\brief
+		Return the current timeout for generation of multi-click events.
+
+		A multi-click event is a double-click, or a triple-click.  The value returned
+		here is the maximum allowable time between mouse button down events for which
+		a multi-click event will be generated.
+
+	\return
+		double value equal to the current multi-click timeout value.
+	*/
+	double	getMultiClickTimeout(void) const		{return d_dblclick_timeout;}
+
+
+	/*!
+	\brief
+		Return the size of the allowable mouse movement tolerance used when generating multi-click events.
+
+		This size defines an area with the mouse at the centre.  The mouse must stay within the tolerance defined
+		for a multi-click (double click, or triple click) event to be generated.
+
+	\return
+		Size object describing the current multi-click tolerance area size.
+	*/
+	const Size&	getMultiClickToleranceAreaSize(void) const		{return d_dblclick_size;}
+
+
+	/*!
+	\brief
+		Set the timeout used for generation of single-click events.
+
+		A single-click is defined here as a button being pressed and then released.
+
+	\param timeout
+		double value equal to the single-click timeout value to be used from now onwards.
+
+	\return
+		Nothing.
+	*/
+	void	setSingleClickTimeout(double timeout);
+
+
+	/*!
+	\brief
+		Set the timeout to be used for the generation of multi-click events.
+
+		A multi-click event is a double-click, or a triple-click.  The value returned
+		here is the maximum allowable time between mouse button down events for which
+		a multi-click event will be generated.
+
+	\param timeout
+		double value equal to the multi-click timeout value to be used from now onwards.
+
+	\return
+		Nothing.
+	*/
+	void setMultiClickTimeout(double timeout);
+
+
+	/*!
+	\brief
+		Set the size of the allowable mouse movement tolerance used when generating multi-click events.
+
+		This size defines an area with the mouse at the centre.  The mouse must stay within the tolerance defined
+		for a multi-click (double click, or triple click) event to be generated.
+
+	\param sz
+		Size object describing the multi-click tolerance area size to be used.
+
+	\return
+		Nothing.
+	*/
+	void setMultiClickToleranceAreaSize(const Size&	sz);
+
+
+	/*!
+	\brief
+		Return the currently set default mouse cursor image
+
+	\return
+		Pointer to the current default image used for the mouse cursor.  May return NULL if default cursor has not been set,
+		or has intentionally been set to NULL - which results in a blank default cursor.
+	*/
+	const Image*	getDefaultMouseCursor(void) const	{return d_defaultMouseCursor;}
+
+
+	/*!
+	\brief
+		Set the image to be used as the default mouse cursor.
+
+	\param image
+		Pointer to an image object that is to be used as the default mouse cursor.  To have no cursor rendered by default, you
+		can specify NULL here.
+
+	\return
+		Nothing.
+	*/
+	void	setDefaultMouseCursor(const Image* image);
+
+
+	/*!
+	\brief
+		Set the image to be used as the default mouse cursor.
+
+	\param image
+		One of the MouseCursorImage enumerated values.
+
+	\return
+		Nothing.
+	*/
+	void	setDefaultMouseCursor(MouseCursorImage image)		{setDefaultMouseCursor((const Image*)image);}
+
+
+	/*!
+	\brief
+		Set the image to be used as the default mouse cursor.
+
+	\param imageset
+		String object that contains the name of the Imageset  that contains the image to be used.
+
+	\param image_name
+		String object that contains the name of the Image on \a imageset that is to be used.
+
+	\return
+		Nothing.
+
+	\exception UnknownObjectException	thrown if \a imageset is not known, or if \a imageset contains no Image named \a image_name.
+	*/
+	void	setDefaultMouseCursor(const String& imageset, const String& image_name);
+
+
+	/*!
+	\brief
+		Return the Window object that the mouse is presently within
+
+	\return
+		Pointer to the Window object that currently contains the mouse cursor, or NULL if none.
+	*/
+	Window*	getWindowContainingMouse(void) const	{return d_wndWithMouse;}
+
+
+	/*!
+	\brief
+		Return a pointer to the ScriptModule being used for scripting within the GUI system.
+
+	\return
+		Pointer to a ScriptModule based object.
+	*/
+	ScriptModule*	getScriptingModule(void) const;
+
+	/*!
+	\brief
+		Return a pointer to the ResourceProvider being used within the GUI system.
+
+	\return
+		Pointer to a ResourceProvider based object.
+	*/
+	ResourceProvider* getResourceProvider(void) const;
+
+	/*!
+	\brief
+		Execute a script file if possible.
+
+	\param filename
+		String object holding the filename of the script file that is to be executed
+		
+	\param resourceGroup
+		Resource group identifier to be passed to the ResourceProvider when loading the script file.
+	*/
+	void	executeScriptFile(const String& filename, const String& resourceGroup = "") const;
+
+
+	/*!
+	\brief
+		Execute a scripted global function if possible.  The function should not take any parameters and should return an integer.
+
+	\param function_name
+		String object holding the name of the function, in the global script environment, that
+		is to be executed.
+
+	\return
+		The integer value returned from the script function.
+	*/
+	int		executeScriptGlobal(const String& function_name) const;
+
+
+    /*!
+    \brief
+        If possible, execute script code contained in the given CEGUI::String object.
+
+    \param str
+        String object holding the valid script code that should be executed.
+
+    \return
+        Nothing.
+    */
+    void executeScriptString(const String& str) const;
+
+
+    /*!
+	\brief
+		return the current mouse movement scaling factor.
+
+	\return
+		float value that is equal to the currently set mouse movement scaling factor.  Defaults to 1.0f.
+	*/
+	float	getMouseMoveScaling(void) const;
+
+
+	/*!
+	\brief
+		Set the current mouse movement scaling factor
+
+	\param scaling
+		float value specifying the scaling to be applied to mouse movement inputs.
+
+	\return
+		nothing.
+	*/
+	void	setMouseMoveScaling(float scaling);
+
+
+	/*!
+	\brief
+		Internal method used to inform the System object whenever a window is destroyed, so that System can perform any required
+		housekeeping.
+
+	\note
+		This method is not intended for client code usage.  If you use this method anything can, and probably will, go wrong!
+	*/
+	void	notifyWindowDestroyed(const Window* window);
+
+
+    /*!
+    \brief
+        Return the current system keys value.
+
+    \return
+        uint value representing a combination of the SystemKey bits.
+    */
+    uint    getSystemKeys(void) const   { return d_sysKeys; }
+
+    /*!
+    \brief
+        Return the XMLParser object.
+     */
+    XMLParser* getXMLParser(void) const     { return d_xmlParser; }
+
+
+    /*!
+    \brief
+        Set the system default Tooltip object.  This value may be NULL to indicate that no default Tooltip will be
+        available.
+
+    \param tooltip
+        Pointer to a valid Tooltip based object which should be used as the default tooltip for the system, or NULL to
+        indicate that no system default tooltip is required.  Note that when passing a pointer to a Tooltip object,
+        ownership of the Tooltip does not pass to System.
+
+    \return
+        Nothing.
+    */
+    void setTooltip(Tooltip* tooltip);
+
+    /*!
+    \brief
+        Set the system default Tooltip to be used by specifying a Window type.
+
+        System will internally attempt to create an instance of the specified window type (which must be
+        derived from the base Tooltip class).  If the Tooltip creation fails, the error is logged and no
+        system default Tooltip will be available.
+
+    \param tooltipType
+        String object holding the name of the Tooltip based Window type which should be used as the Tooltip for
+        the system default.
+
+    \return
+        Nothing.
+    */
+    void setTooltip(const String& tooltipType);
+
+    /*!
+    \brief
+        return a poiter to the system default tooltip.  May return 0.
+
+    \return
+        Pointer to the current system default tooltip.  May return 0 if
+        no system default tooltip is available.
+     */
+    Tooltip* getDefaultTooltip(void) const  { return d_defaultTooltip; }
+
+
+	/*!
+	\brief
+		Internal method to directly set the current modal target.
+
+	\note
+		This method is called internally by Window, and must be used by client code.
+		Doing so will most likely not have the expected results.
+	*/
+	void setModalTarget(Window* target)		{d_modalTarget = target;}
+
+	/*!
+	\brief
+		Return a pointer to the Window that is currently the modal target.
+
+	\return
+		Pointer to the current modal target. NULL if there is no modal target.
+	*/
+	Window* getModalTarget(void) const		{return d_modalTarget;}
+
+
+	/*************************************************************************
+		Input injection interface
+	*************************************************************************/
+	/*!
+	\brief
+		Method that injects a mouse movement event into the system
+
+	\param delta_x
+		amount the mouse moved on the x axis.
+
+	\param delta_y
+		amount the mouse moved on the y axis.
+
+	\return
+		- true if the input was processed by the gui system.
+		- false if the input was not processed by the gui system.
+	*/
+	bool	injectMouseMove(float delta_x, float delta_y);
+
+
+	/*!
+	\brief
+		Method that injects that the mouse has left the application window
+
+	\return
+		- true if the generated mouse move event was handled.
+		- false if the generated mouse move event was not handled.
+	*/
+	bool	injectMouseLeaves(void);
+
+
+	/*!
+	\brief
+		Method that injects a mouse button down event into the system.
+
+	\param button
+		One of the MouseButton values indicating which button was pressed.
+
+	\return
+		- true if the input was processed by the gui system.
+		- false if the input was not processed by the gui system.
+	*/
+	bool	injectMouseButtonDown(MouseButton button);
+
+
+	/*!
+	\brief
+		Method that injects a mouse button up event into the system.
+
+	\param button
+		One of the MouseButton values indicating which button was released.
+
+	\return
+		- true if the input was processed by the gui system.
+		- false if the input was not processed by the gui system.
+	*/
+	bool	injectMouseButtonUp(MouseButton button);
+
+
+	/*!
+	\brief
+		Method that injects a key down event into the system.
+
+	\param key_code
+		uint value indicating which key was pressed.
+
+	\return
+		- true if the input was processed by the gui system.
+		- false if the input was not processed by the gui system.
+	*/
+	bool	injectKeyDown(uint key_code);
+
+
+	/*!
+	\brief
+		Method that injects a key up event into the system.
+
+	\param key_code
+		uint value indicating which key was released.
+
+	\return
+		- true if the input was processed by the gui system.
+		- false if the input was not processed by the gui system.
+	*/
+	bool	injectKeyUp(uint key_code);
+
+
+	/*!
+	\brief
+		Method that injects a typed character event into the system.
+
+	\param code_point
+		Unicode code point of the character that was typed.
+
+	\return
+		- true if the input was processed by the gui system.
+		- false if the input was not processed by the gui system.
+	*/
+	bool	injectChar(utf32 code_point);
+
+
+	/*!
+	\brief
+		Method that injects a mouse-wheel / scroll-wheel event into the system.
+
+	\param delta
+		float value representing the amount the wheel moved.
+
+	\return
+		- true if the input was processed by the gui system.
+		- false if the input was not processed by the gui system.
+	*/
+	bool	injectMouseWheelChange(float delta);
+
+
+	/*!
+	\brief
+		Method that injects a new position for the mouse cursor.
+
+	\param x_pos
+		New absolute pixel position of the mouse cursor on the x axis.
+
+	\param y_pos
+		New absolute pixel position of the mouse cursoe in the y axis.
+
+	\return
+		- true if the generated mouse move event was handled.
+		- false if the generated mouse move event was not handled.
+	*/
+	bool	injectMousePosition(float x_pos, float y_pos);
+
+
+	/*!
+	\brief
+		Method to inject time pulses into the system.
+
+	\param timeElapsed
+		float value indicating the amount of time passed, in seconds, since the last time this method was called.
+
+	\return
+		Currently, this method always returns true.
+	*/
+	bool	injectTimePulse(float timeElapsed);
+
+
+private:
+    // unimplemented constructors / assignment
+    System(const System& obj);
+    System& operator=(const System& obj);
+
+	/*************************************************************************
+		Implementation Constants
+	*************************************************************************/
+	static const char	CEGUIConfigSchemaName[];			//!< Filename of the XML schema used for validating Config files.
+
+
+	/*************************************************************************
+		Implementation Functions
+	*************************************************************************/
+	/*!
+	\brief
+		Given Point \a pt, return a pointer to the Window that should receive a mouse input if \a pt is the mouse location.
+
+	\param pt
+		Point object describing a screen location in pixels.
+
+	\return
+		Pointer to a Window object that should receive mouse input with the system in its current state and the mouse at location \a pt.
+	*/
+	Window*	getTargetWindow(const Point& pt) const;
+
+
+	/*!
+	\brief
+		Return a pointer to the Window that should receive keyboard input considering the current modal target.
+
+	\return
+		Pointer to a Window object that should receive the keyboard input.
+	*/
+	Window* getKeyboardTargetWindow(void) const;
+
+
+	/*!
+	\brief
+		Return a pointer to the next window that is to receive the input if the given Window did not use it.
+
+	\param w
+		Pointer to the Window that just received the input.
+
+	\return
+		Pointer to the next window to receive the input.
+	*/
+	Window* getNextTargetWindow(Window* w) const;
+
+
+	/*!
+	\brief
+		Translate a MouseButton value into the corresponding SystemKey value
+
+	\param btn
+		MouseButton value describing the value to be converted
+
+	\return
+		SystemKey value that corresponds to the same button as \a btn
+	*/
+	SystemKey	mouseButtonToSyskey(MouseButton btn) const;
+
+
+	/*!
+	\brief
+		Translate a Key::Scan value into the corresponding SystemKey value.
+
+		This takes key direction into account, since we map two keys onto one value.
+
+	\param key
+		Key::Scan value describing the value to be converted
+
+	\param direction
+		true if the key is being pressed, false if the key is being released.
+
+	\return
+		SystemKey value that corresponds to the same key as \a key, or 0 if key was not a system key.
+	*/
+	SystemKey	keyCodeToSyskey(Key::Scan key, bool direction);
+
+
+	/*!
+	\brief
+		Method to do the work of the constructor
+	*/
+       void	constructor_impl(Renderer* renderer, ResourceProvider* resourceProvider, XMLParser* xmlParser, ScriptModule* scriptModule, const String& configFile, const String& logFile);
+
+
+	/*!
+	\brief
+		add events for the System object
+	*/
+	void	addSystemEvents(void);
+
+
+	/*!
+	\brief
+		Handler method for display size change notifications
+	*/
+	bool	handleDisplaySizeChange(const EventArgs& e);
+
+
+	/*************************************************************************
+		Handlers for System events
+	*************************************************************************/
+	/*!
+	\brief
+		Handler called when the main system GUI Sheet (or root window) is changed.
+
+		\a e is a WindowEventArgs with 'window' set to the old root window.
+	*/
+	void	onGUISheetChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the single-click timeout value is changed.
+	*/
+	void	onSingleClickTimeoutChanged(EventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the multi-click timeout value is changed.
+	*/
+	void	onMultiClickTimeoutChanged(EventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the size of the multi-click tolerance area is changed.
+	*/
+	void	onMultiClickAreaSizeChanged(EventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the default system font is changed.
+	*/
+	void	onDefaultFontChanged(EventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the default system mouse cursor image is changed.
+	*/
+	void	onDefaultMouseCursorChanged(EventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the mouse movement scaling factor is changed.
+	*/
+	void	onMouseMoveScalingChanged(EventArgs& e);
+
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	Renderer*	d_renderer;			//!< Holds the pointer to the Renderer object given to us in the constructor
+    ResourceProvider* d_resourceProvider;      //!< Holds the pointer to the ResourceProvider object given to us by the renderer or the System constructor.
+	Font*		d_defaultFont;		//!< Holds a pointer to the default GUI font.
+	bool		d_gui_redraw;		//!< True if GUI should be re-drawn, false if render should re-use last times queue.
+
+	Window*		d_wndWithMouse;		//!< Pointer to the window that currently contains the mouse.
+	Window*		d_activeSheet;		//!< The active GUI sheet (root window)
+	Window*		d_modalTarget;		//!< Pointer to the window that is the current modal target. NULL is there is no modal target.
+
+	String d_strVersion;    //!< CEGUI version
+
+	uint		d_sysKeys;			//!< Current set of system keys pressed (in mk1 these were passed in, here we track these ourself).
+	bool		d_lshift;			//!< Tracks state of left shift.
+	bool		d_rshift;			//!< Tracks state of right shift.
+	bool		d_lctrl;			//!< Tracks state of left control.
+	bool		d_rctrl;			//!< Tracks state of right control.
+	bool		d_lalt;				//!< Tracks state of left alt.
+	bool		d_ralt;				//!< Tracks state of right alt.
+
+	double		d_click_timeout;	//!< Timeout value, in seconds, used to generate a single-click (button down then up)
+	double		d_dblclick_timeout;	//!< Timeout value, in seconds, used to generate multi-click events (botton down, then up, then down, and so on).
+	Size		d_dblclick_size;	//!< Size of area the mouse can move and still make multi-clicks.
+
+	MouseClickTrackerImpl* const	d_clickTrackerPimpl;		//!< Tracks mouse button click generation.
+
+	// mouse cursor related
+	const Image*	d_defaultMouseCursor;		//!< Image to be used as the default mouse cursor.
+
+	// scripting
+	ScriptModule*	d_scriptModule;			//!< Points to the scripting support module.
+	String			d_termScriptName;		//!< Name of the script to run upon system shutdown.
+
+	float	d_mouseScalingFactor;			//!< Scaling applied to mouse movement inputs.
+
+    XMLParser*  d_xmlParser;        //!< XMLParser object we use to process xml files.
+    bool        d_ourXmlParser;     //!< true when we created the xml parser.
+
+    Tooltip* d_defaultTooltip;      //!< System default tooltip object.
+    bool     d_weOwnTooltip;        //!< true if System created the custom Tooltip.
+};
+
+} // End of  CEGUI namespace section
+
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUISystem_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIVersion.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIVersion.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIVersion.h	(revision 1812)
@@ -0,0 +1,40 @@
+/************************************************************************
+	filename: 	CEGUIVersion.h
+	created:	7/3/2005
+	author:		jacmoe
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+//////////////////////////////////////////////////////////////////////////
+/*************************************************************************
+
+This file contains CEGUI version defines
+*************************************************************************/
+//////////////////////////////////////////////////////////////////////////
+#ifndef _CEGUIVersion_h_
+#define _CEGUIVersion_h_
+
+//////////////////////////////////////////////////////////////////////////
+// Define CEGUI version
+//////////////////////////////////////////////////////////////////////////
+#define CEGUI_VERSION_MAJOR 0
+#define CEGUI_VERSION_MINOR 4
+#define CEGUI_VERSION_PATCH 1
+
+#endif	// end of guard _CEGUIVersion_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIUDim.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIUDim.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIUDim.h	(revision 1812)
@@ -0,0 +1,173 @@
+/************************************************************************
+    filename:   CEGUIUDim.h
+    created:    Tue May 31 2005
+    author:     Paul D Turner <paul@cegui.org.uk>
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+ 
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+ 
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+ 
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIUDim_h_
+#define _CEGUIUDim_h_
+
+#include "CEGUIRect.h"
+#include "CEGUIVector.h"
+
+// some macros to aid in the creation of UDims
+#define cegui_absdim(x)     UDim(0,(x))
+#define cegui_reldim(x)     UDim((x),0)
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+    /*!
+    \brief
+        Class representing a unified dimension; that is a dimension that has both
+        a relative 'scale' portion and and absolute 'offset' portion.
+    */
+    class CEGUIEXPORT UDim
+    {
+    public:
+        UDim() {}
+        UDim(float scale, float offset) : d_scale(scale), d_offset(offset) {}
+        ~UDim() {}
+
+        float asAbsolute(float base) const    { return PixelAligned(base * d_scale) + d_offset; }
+        float asRelative(float base) const    { return (base != 0.0f) ? d_offset / base + d_scale : 0.0f; }
+
+        UDim operator+(const UDim& other) const     { return UDim(d_scale + other.d_scale, d_offset + other.d_offset); }
+        UDim operator-(const UDim& other) const     { return UDim(d_scale - other.d_scale, d_offset - other.d_offset); }
+        UDim operator/(const UDim& other) const     { return UDim(d_scale / other.d_scale, d_offset / other.d_offset); }
+        UDim operator*(const UDim& other) const     { return UDim(d_scale * other.d_scale, d_offset * other.d_offset); }
+
+        const UDim& operator+=(const UDim& other)   { d_scale += other.d_scale; d_offset += other.d_offset; return *this; }
+        const UDim& operator-=(const UDim& other)   { d_scale -= other.d_scale; d_offset -= other.d_offset; return *this; }
+        const UDim& operator/=(const UDim& other)   { d_scale /= other.d_scale; d_offset /= other.d_offset; return *this; }
+        const UDim& operator*=(const UDim& other)   { d_scale *= other.d_scale; d_offset *= other.d_offset; return *this; }
+
+        bool operator==(const UDim& other) const    { return d_scale == other.d_scale && d_offset == other.d_offset; }
+        bool operator!=(const UDim& other) const    { return !operator==(other); }
+
+        float d_scale, d_offset;
+    };
+
+    /*!
+    \brief
+        Two dimensional vector class built using unified dimensions (UDims).
+        The UVector2 class is used for representing both positions and sizes.
+    */
+    class CEGUIEXPORT UVector2
+    {
+    public:
+        UVector2() {}
+        UVector2(const UDim& x, const UDim& y) : d_x(x), d_y(y) {}
+        ~UVector2() {}
+
+        Vector2 asAbsolute(const Size& base) const    { return Vector2(d_x.asAbsolute(base.d_width), d_y.asAbsolute(base.d_height)); }
+        Vector2 asRelative(const Size& base) const    { return Vector2(d_x.asRelative(base.d_width), d_y.asRelative(base.d_height)); }
+
+        UVector2 operator+(const UVector2& other) const     { return UVector2(d_x + other.d_x, d_y + other.d_y); }
+        UVector2 operator-(const UVector2& other) const     { return UVector2(d_x - other.d_x, d_y - other.d_y); }
+        UVector2 operator/(const UVector2& other) const     { return UVector2(d_x / other.d_x, d_y / other.d_y); }
+        UVector2 operator*(const UVector2& other) const     { return UVector2(d_x * other.d_x, d_y * other.d_y); }
+
+        const UVector2& operator+=(const UVector2& other)   { d_x += other.d_x; d_y += other.d_y; return *this; }
+        const UVector2& operator-=(const UVector2& other)   { d_x -= other.d_x; d_y -= other.d_y; return *this; }
+        const UVector2& operator/=(const UVector2& other)   { d_x /= other.d_x; d_y /= other.d_y; return *this; }
+        const UVector2& operator*=(const UVector2& other)   { d_x *= other.d_x; d_y *= other.d_y; return *this; }
+        
+        bool operator==(const UVector2& other) const    { return d_x == other.d_x && d_y == other.d_y; }
+        bool operator!=(const UVector2& other) const    { return !operator==(other); }
+
+        UDim d_x, d_y;
+    };
+
+    /*!
+    \brief
+        Area rectangle class built using unified dimensions (UDims).
+    */
+    class CEGUIEXPORT URect
+    {
+    public:
+        URect() {}
+        
+        URect(const UVector2& min, const UVector2& max) : d_min(min), d_max(max) {}
+        
+        URect(const UDim& left, const UDim& top, const UDim& right, const UDim& bottom)
+        {
+            d_min.d_x = left;
+            d_min.d_y = top;
+            d_max.d_x = right;
+            d_max.d_y = bottom;
+        }
+        
+        ~URect() {}
+    
+        Rect asAbsolute(const Size& base) const
+        {
+            return Rect(
+                    d_min.d_x.asAbsolute(base.d_width),
+                    d_min.d_y.asAbsolute(base.d_height),
+                    d_max.d_x.asAbsolute(base.d_width),
+                    d_max.d_y.asAbsolute(base.d_height)
+                );
+        }
+
+        Rect asRelative(const Size& base) const
+        {
+            return Rect(
+                    d_min.d_x.asRelative(base.d_width),
+                    d_min.d_y.asRelative(base.d_height),
+                    d_max.d_x.asRelative(base.d_width),
+                    d_max.d_y.asRelative(base.d_height)
+                );
+        }
+
+        const UVector2& getPosition() const     { return d_min; }
+        UVector2 getSize() const                { return d_max - d_min; }
+        UDim getWidth() const                   { return d_max.d_x - d_min.d_x; }
+        UDim getHeight() const                  { return d_max.d_y - d_min.d_y; }
+
+        void setPosition(const UVector2& pos)
+        {
+            UVector2 sz(d_max - d_min);
+            d_min = pos;
+            d_max = d_min + sz;
+        }
+
+        void setSize(const UVector2& sz)
+        {
+            d_max = d_min + sz;
+        }
+
+        void setWidth(const UDim& w)        { d_max.d_x = d_min.d_x + w; }
+        void setHeight(const UDim& h)       { d_max.d_y = d_min.d_y + h; }
+
+        void offset(const UVector2& sz)
+        {
+            d_min += sz;
+            d_max += sz;
+        }
+        
+        UVector2 d_min, d_max;
+    };
+
+} // End of  CEGUI namespace section
+
+
+#endif  // end of guard _CEGUIUDim_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIPropertySet.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIPropertySet.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIPropertySet.h	(revision 1812)
@@ -0,0 +1,216 @@
+/************************************************************************
+	filename: 	CEGUIPropertySet.h
+	created:	21/2/2004
+	author:		Paul D Turner
+	
+	purpose:	Defines interface for the PropertySet class
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIPropertySet_h_
+#define _CEGUIPropertySet_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIString.h"
+#include "CEGUIIteratorBase.h"
+#include "CEGUIProperty.h"
+#include <map>
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Class that contains a collection of Property objects.
+*/
+class CEGUIEXPORT PropertySet : public PropertyReceiver
+{
+public:
+	/*!
+	\brief
+		Constructs a new PropertySet object
+	*/
+	PropertySet(void) {}
+
+
+	/*!
+	\brief
+		Destructor for PropertySet objects.
+	*/
+	virtual ~PropertySet(void) {}
+
+
+	/*!
+	\brief
+		Adds a new Property to the PropertySet
+
+	\param property
+		Pointer to the Property object to be added to the PropertySet.
+
+	\return
+		Nothing.
+
+	\exception NullObjectException		Thrown if \a property is NULL.
+	\exception AlreadyExistsException	Thrown if a Property with the same name as \a property already exists in the PropertySet
+	*/
+	void	addProperty(Property* property);
+
+
+	/*!
+	\brief
+		Removes a Property from the PropertySet.
+
+	\param name
+		String containing the name of the Property to be removed.  If Property \a name is not in the set, nothing happens.
+
+	\return
+		Nothing.
+	*/
+	void	removeProperty(const String& name);
+
+
+	/*!
+	\brief
+		Removes all Property objects from the PropertySet.
+
+	\return
+		Nothing.
+	*/
+	void	clearProperties(void);
+
+
+	/*!
+	\brief
+		Checks to see if a Property with the given name is in the PropertySet
+
+	\param name
+		String containing the name of the Property to check for.
+
+	\return
+		true if a Property named \a name is in the PropertySet.  false if no Property named \a name is in the PropertySet.
+	*/
+	bool	isPropertyPresent(const String& name) const;
+
+
+	/*!
+	\brief
+		Return the help text for the specified Property.
+
+	\param name
+		String holding the name of the Property who's help text is to be returned.
+
+	\return
+		String object containing the help text for the Property \a name.
+
+	\exception UnknownObjectException	Thrown if no Property named \a name is in the PropertySet.
+	*/
+	const String&	getPropertyHelp(const String& name) const;
+
+
+	/*!
+	\brief
+		Gets the current value of the specified Property.
+
+	\param name
+		String containing the name of the Property who's value is to be returned.
+
+	\return
+		String object containing a textual representation of the requested Property.
+
+	\exception UnknownObjectException	Thrown if no Property named \a name is in the PropertySet.
+	*/
+	String	getProperty(const String& name) const;
+
+
+	/*!
+	\brief
+		Sets the current value of a Property.
+
+	\param name
+		String containing the name of the Property who's value is to be set.
+
+	\param value
+		String containing a textual representation of the new value for the Property
+
+	\return
+		Nothing
+
+	\exception UnknownObjectException	Thrown if no Property named \a name is in the PropertySet.
+	\exception InvalidRequestException	Thrown when the Property was unable to interpret the content of \a value.
+	*/
+	void	setProperty(const String& name, const String& value);
+
+
+	/*!
+	\brief
+		Returns whether a Property is at it's default value.
+
+	\param name
+		String containing the name of the Property who's default state is to be tested.
+
+	\return
+		- true if the property has it's default value.
+		- false if the property has been modified from it's default value.
+	*/
+	bool	isPropertyDefault(const String& name) const;
+
+
+	/*!
+	\brief
+		Returns the default value of a Property as a String.
+
+	\param name
+		String containing the name of the Property who's default string is to be returned.
+
+	\return
+		String object containing a textual representation of the default value for this property.
+	*/
+	String	getPropertyDefault(const String& name) const;
+
+private:
+	typedef std::map<String, Property*>	PropertyRegistry;
+	PropertyRegistry	d_properties;
+
+
+public:
+	/*************************************************************************
+		Iterator stuff
+	*************************************************************************/
+	typedef	ConstBaseIterator<PropertyRegistry>	PropertyIterator;
+
+	/*!
+	\brief
+		Return a PropertySet::PropertyIterator object to iterate over the available Properties.
+	*/
+	PropertyIterator	getIterator(void) const;
+};
+
+} // End of  CEGUI namespace section
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIPropertySet_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUITexture.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUITexture.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUITexture.h	(revision 1812)
@@ -0,0 +1,139 @@
+/************************************************************************
+	filename: 	CEGUITexture.h
+	created:	21/2/2004
+	author:		Paul D Turner
+	
+	purpose:	Defines abstract interface for texture objects.  Texture
+				objects are created & destroyed by the Renderer.
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUITexture_h_
+#define _CEGUITexture_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIString.h"
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Abstract base class specifying the required interface for Texture objects.
+
+	Texture objects are created via the Renderer.  The actual inner workings of any Texture object
+	are dependant upon the Renderer (and underlying API) in use.  This base class defines the minimal
+	set of functions that is required for the rest of the system to work.  Texture objects are only
+	created through the Renderer object's texture creation functions.
+*/
+class CEGUIEXPORT Texture
+{
+public:
+	/*************************************************************************
+		Abstract Interface
+	*************************************************************************/
+	/*!
+	\brief
+		Returns the current pixel width of the texture
+
+	\return
+		ushort value that is the current width of the texture in pixels
+	*/
+	virtual	ushort	getWidth(void) const = 0;
+
+
+	/*!
+	\brief
+		Returns the current pixel height of the texture
+
+	\return
+		ushort value that is the current height of the texture in pixels
+	*/
+	virtual	ushort	getHeight(void) const = 0;
+
+
+	/*!
+	\brief
+		Loads the specified image file into the texture.  The texture is resized as required to hold the image.
+
+	\param filename
+		The filename of the image file that is to be loaded into the texture
+
+    \param resourceGroup
+        Resource group identifier to be passed to the resource provider when loading the image file.
+
+	\return
+		Nothing.
+	*/
+	virtual void	loadFromFile(const String& filename, const String& resourceGroup) = 0;
+
+
+	/*!
+	\brief
+		Loads (copies) an image in memory into the texture.  The texture is resized as required to hold the image.
+
+	\param buffPtr
+		Pointer to the buffer containing the image data
+
+	\param buffWidth
+		Width of the buffer (in 0xAARRGGBB pixels)
+
+	\param buffHeight
+		Height of the buffer (in 0xAARRGGBB pixels)
+
+	\return
+		Nothing.
+	*/
+	virtual void	loadFromMemory(const void* buffPtr, uint buffWidth, uint buffHeight) = 0;
+
+
+	/*!
+	\brief
+		Return a pointer to the Renderer object that created and owns this Texture
+
+	\return
+		Pointer to the Renderer object that owns the Texture
+	*/
+	Renderer*	getRenderer(void) const			{return d_owner;}
+
+
+protected:
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for Texture base class.  This is never called by client code.
+	*/
+	Texture(Renderer* owner) : d_owner(owner) {}
+
+public:		// luabind compatibility
+	/*!
+	\brief
+		Destructor for Texture base class.  This is never called by client code.
+	*/
+	virtual ~Texture(void) {}
+
+private:
+	Renderer* d_owner;		//<! Renderer object that created and owns this texture
+};
+
+} // End of  CEGUI namespace section
+
+#endif	// end of guard _CEGUITexture_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIFontManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIFontManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIFontManager.h	(revision 1812)
@@ -0,0 +1,268 @@
+/************************************************************************
+	filename: 	CEGUIFontManager.h
+	created:	21/2/2004
+	author:		Paul D Turner
+	
+	purpose:	Defines interface for the FontManager class
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIFontManager_h_
+#define _CEGUIFontManager_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIString.h"
+#include "CEGUISingleton.h"
+#include "CEGUIIteratorBase.h"
+#include <map>
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4275)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Class providing a shared library of Font objects to the system.
+
+	The FontManager is used to create, access, and destroy Font objects.  The idea is that the
+	FontManager will function as a central repository for Font objects used within the GUI system,
+	and that those Font objects can be accessed, via a unique name, by any interested party within
+	the system.
+*/
+class CEGUIEXPORT FontManager : public Singleton<FontManager>
+{
+public:
+	/*!
+	\brief
+		Constructor for FontManager objects
+	*/
+	FontManager(void);
+
+
+	/*!
+	\brief
+		Destructor for FontManager objects
+	*/
+	~FontManager(void);
+
+
+	/*!
+	\brief
+		Return singleton FontManager object
+
+	\return
+		Singleton FontManager object
+	*/
+	static	FontManager&	getSingleton(void);
+
+
+	/*!
+	\brief
+		Return pointer to singleton FontManager object
+
+	\return
+		Pointer to singleton FontManager object
+	*/
+	static	FontManager*	getSingletonPtr(void);
+
+
+	/*!
+	\brief
+		Creates a new font from a font definition file, and returns a pointer to the new Font object.
+
+	\param filename
+		String object containing the filename of a 'font definition file' what will be used to create the new font
+
+    \param resourceGroup
+        Resource group identifier to pass to the resource provider when loading the font definition file.
+
+	\return
+		Pointer the the newly created Font object
+
+	\exception	FileIOException				thrown if there was some problem accessing or parsing the file \a filename
+	\exception	InvalidRequestException		thrown if an invalid filename was provided.
+	\exception	AlreadyExistsException		thrown if a Font already exists with the name specified, or if a font Imageset clashes with one already defined in the system.
+	\exception	GenericException			thrown if something goes wrong while accessing a true-type font referenced in file \a filename.
+	\exception	RendererException			thrown if the Renderer can't support a texture large enough to hold the requested glyph imagery.
+	\exception	MemoryException				thrown if allocation of imagery construction buffer fails.
+	*/
+	Font*	createFont(const String& filename, const String& resourceGroup = "");
+
+
+	/*!
+	\brief
+		Creates a new Font based on a true-type font, and returns a pointer to the new Font object.
+
+	\param name
+		String object containing a unique name for the new font.
+
+	\param fontname
+		String object containing the name and path of the true-type font to access.
+
+	\param size
+		Specifies the glyph size (point-size) for the new font.
+
+	\param flags
+		Some combination of FontFlag values to be used for the creation of this font.
+
+    \param resourceGroup
+        Resource group identifier to be passed to the resource provider when loading the font definition file.
+
+	\return
+		Pointer to the newly created Font object.
+
+	\exception	AlreadyExistsException		thrown if a Font already exists with the name specified, or if a font Imageset clashes with one already defined in the system.
+	\exception	GenericException			thrown if something goes wrong while accessing a true-type font referenced in file \a fontname.
+	\exception	RendererException			thrown if the Renderer can't support a texture large enough to hold the requested glyph imagery.
+	\exception	MemoryException				thrown if allocation of imagery construction buffer fails.
+	*/
+	Font*	createFont(const String& name, const String& fontname, uint size, uint flags, const String& resourceGroup = "");
+
+
+	/*!
+	\brief
+		Destroy's the font with the given name
+
+	\param name
+		String object containing the name of the font to be destroyed.  If the specified font does not exist, nothing happens.
+
+	\return
+		Nothing
+	*/
+	void	destroyFont(const String& name);
+
+
+	/*!
+	\brief
+		Destroys the given Font object
+
+	\param font
+		Pointer to the Font to be destroyed.  If no such Font exists, nothing happens.
+
+	\return
+		Nothing.
+	*/
+	void	destroyFont(Font* font);
+
+
+	/*!
+	\brief
+		Destroys all Font objects registered in the system
+
+	\return
+		Nothing
+	*/
+	void	destroyAllFonts(void);
+
+
+	/*!
+	\brief
+		Checks the existence of a given font.
+
+	\param name
+		String object holding the name of the Font object to look for.
+
+	\return
+		true if a Font object named \a name exists in the system, false if no such font exists.
+	*/
+	bool	isFontPresent(const String& name) const;
+
+
+	/*!
+	\brief
+		Returns a pointer to the font object with the specified name
+
+	\param name
+		String object containing the name of the Font object to be returned
+
+	\return
+		Pointer to the requested Font object
+
+	\exception UnknownObjectException	Thrown if no font with the given name exists.
+	*/
+	Font*	getFont(const String& name) const;
+
+
+	/*!
+	\brief
+		Notify the FontManager of the current (usually new) display resolution.
+
+	\param size
+		Size object describing the display resolution
+
+	\return
+		Nothing
+	*/
+	void	notifyScreenResolution(const Size& size);
+
+
+    /*!
+    \brief
+        Writes a full XML font file for the specified Font to the given OutStream.
+
+    \param name
+        String holding the name of the Font to be written to the stream.
+
+    \param out_stream
+        OutStream (std::ostream based) object where data is to be sent.
+
+    \return
+        Nothing.
+    */
+    void writeFontToStream(const String& name, OutStream& out_stream) const;
+
+
+private:
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	typedef	std::map<String, Font*>		FontRegistry;
+	FontRegistry		d_fonts;
+
+	struct FontManagerImplData;
+	FontManagerImplData*	d_implData;
+
+
+public:
+	/*************************************************************************
+		Iterator stuff
+	*************************************************************************/
+	typedef	ConstBaseIterator<FontRegistry>	FontIterator;
+
+	/*!
+	\brief
+		Return a FontManager::FontIterator object to iterate over the available Font objects.
+	*/
+	FontIterator	getIterator(void) const;
+};
+
+} // End of  CEGUI namespace section
+
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIFontManager_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIVector.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIVector.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIVector.h	(revision 1812)
@@ -0,0 +1,132 @@
+/************************************************************************
+	filename: 	CEGUIVector.h
+	created:	14/3/2004
+	author:		Paul D Turner
+	
+	purpose:	Defines interfaces for Vector classes
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIVector_h_
+#define _CEGUIVector_h_
+
+#include "CEGUIBase.h"
+#include "CEGUISize.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+	Class used as a two dimensional vector (aka a Point)
+*/
+class CEGUIEXPORT Vector2
+{
+public:
+	Vector2(void) {}
+	Vector2(float x, float y) : d_x(x), d_y(y) {}
+
+	Vector2& operator*=(const Vector2& vec)
+	{
+		d_x *= vec.d_x;
+		d_y *= vec.d_y;
+
+		return *this;
+	}
+
+	Vector2& operator/=(const Vector2& vec)
+	{
+		d_x /= vec.d_x;
+		d_y /= vec.d_y;
+
+		return *this;
+	}
+
+	Vector2& operator+=(const Vector2& vec)
+	{
+		d_x += vec.d_x;
+		d_y += vec.d_y;
+
+		return *this;
+	}
+
+	Vector2& operator-=(const Vector2& vec)
+	{
+		d_x -= vec.d_x;
+		d_y -= vec.d_y;
+
+		return *this;
+	}
+
+	Vector2	operator+(const Vector2& vec) const
+	{
+		return Vector2(d_x + vec.d_x, d_y + vec.d_y);
+	}
+
+	Vector2	operator-(const Vector2& vec) const
+	{
+		return Vector2(d_x - vec.d_x, d_y - vec.d_y);
+	}
+
+	Vector2	operator*(const Vector2& vec) const
+	{
+		return Vector2(d_x * vec.d_x, d_y * vec.d_y);
+	}
+
+	bool	operator==(const Vector2& vec) const
+	{
+		return ((d_x == vec.d_x) && (d_y == vec.d_y));
+	}
+
+	bool	operator!=(const Vector2& vec) const
+	{
+		return !(operator==(vec));
+	}
+
+    Size asSize() const     { return Size(d_x, d_y); }
+
+	float d_x, d_y;
+};
+
+/*!
+\brief
+	Point class
+*/
+typedef	Vector2		Point;
+
+
+/*!
+\brief
+	Class used as a three dimensional vector
+*/
+class CEGUIEXPORT Vector3
+{
+public:
+	Vector3(void) {}
+	Vector3(float x, float y, float z) : d_x(x), d_y(y), d_z(z) {}
+
+	float	d_x, d_y, d_z;
+};
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIVector_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIWindowManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIWindowManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIWindowManager.h	(revision 1812)
@@ -0,0 +1,397 @@
+/************************************************************************
+	filename: 	CEGUIWindowManager.h
+	created:	21/2/2004
+	author:		Paul D Turner
+	
+	purpose:	Defines the interface for the WindowManager object
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIWindowManager_h_
+#define _CEGUIWindowManager_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIString.h"
+#include "CEGUISingleton.h"
+#include "CEGUILogger.h"
+#include "CEGUIIteratorBase.h"
+#include <map>
+#include <vector>
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4275)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	The WindowManager class describes an object that manages creation and lifetime of Window objects.
+
+	The WindowManager is the means by which Window objects are created and destroyed.  For each sub-class
+	of Window that is to be created, there must exist a WindowFactory object which is registered with the
+	WindowFactoryManager.  Additionally, the WindowManager tracks every Window object created, and can be
+	used to access those Window objects by name.
+*/
+class CEGUIEXPORT WindowManager : public Singleton <WindowManager>
+{
+public:
+    /*************************************************************************
+        Public static data
+    *************************************************************************/
+    static const String GeneratedWindowNameBase;      //!< Base name to use for generated window names.
+
+	/*!
+	\brief
+		Function type that is used as a callback when loading layouts from XML; the function is called
+		for each Property element encountered.
+
+	\param window
+		Window object that the property is to be applied to.
+
+	\param propname
+		String holding the name of the property that is being set.
+
+	\param propvalue
+		String holding the new value that will be applied to the property specified by /a propname.
+
+	\param userdata
+		Some client code supplied data.
+
+	\return
+		- true if the property should be set.
+		- false if the property should not be set,
+	*/
+	typedef bool PropertyCallback(Window* window, String& propname, String& propvalue, void* userdata);
+	
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructs a new WindowManager object.
+
+		NB: Client code should not create WindowManager objects - they are of limited use to you!  The
+		intended pattern of access is to get a pointer to the GUI system's WindowManager via the System
+		object, and use that.
+	*/
+	WindowManager(void);
+
+
+	/*!
+	\brief
+		Destructor for WindowManager objects
+
+		This will properly destry all remaining Window objects.  Note that WindowFactory objects will not
+		be destroyed (since they are owned by whoever created them).
+	*/
+	~WindowManager(void);
+
+
+	/*!
+	\brief
+		Return singleton WindowManager object
+
+	\return
+		Singleton WindowManager object
+	*/
+	static	WindowManager&	getSingleton(void);
+
+
+	/*!
+	\brief
+		Return pointer to singleton WindowManager object
+
+	\return
+		Pointer to singleton WindowManager object
+	*/
+	static	WindowManager*	getSingletonPtr(void);
+
+
+	/*************************************************************************
+		Window Related Methods
+	*************************************************************************/
+	/*!
+	\brief
+		Creates a new Window object of the specified type, and gives it the specified unique name.
+
+	\param type
+		String that describes the type of Window to be created.  A valid WindowFactory for the specified type must be registered.
+
+	\param name
+		String that holds a unique name that is to be given to the new window.  If this string is empty (""), a name
+		will be generated for the window.
+
+	\return
+		Pointer to the newly created Window object.
+
+	\exception	AlreadyExistsException		A Window object with the name \a name already exists.
+	\exception	UnknownObjectException		No WindowFactory is registered for \a type Window objects.
+	\exception	GenericException			Some other error occurred (Exception message has details).
+	*/
+	Window*	createWindow(const String& type, const String& name = "");
+
+
+	/*!
+	\brief
+		Destroy the specified Window object.
+
+	\param window
+		Pointer to the Window object to be destroyed.  If the \a window is null, or is not recognised, nothing happens.
+
+	\return
+		Nothing
+
+	\exception	InvalidRequestException		Can be thrown if the WindowFactory for \a window's object type was removed.
+	*/
+	void	destroyWindow(Window* window);
+
+
+	/*!
+	\brief
+		Destroy the specified Window object.
+
+	\param
+		window	String containing the name of the Window object to be destroyed.  If \a window is not recognised, nothing happens.
+
+	\return
+		Nothing.
+
+	\exception	InvalidRequestException		Can be thrown if the WindowFactory for \a window's object type was removed.
+	*/
+	void	destroyWindow(const String& window);
+
+
+	/*!
+	\brief
+		Return a pointer to the specified Window object.
+
+	\param name
+		String holding the name of the Window object to be returned.
+
+	\return
+		Pointer to the Window object with the name \a name.
+
+	\exception UnknownObjectException	No Window object with a name matching \a name was found.
+	*/
+	Window*	getWindow(const String& name) const;
+
+
+	/*!
+	\brief
+		Examines the list of Window objects to see if one exists with the given name
+
+	\param name
+		String holding the name of the Window object to look for.
+
+	\return
+		true if a Window object was found with a name matching \a name.  false if no matching Window object was found.
+	*/
+	bool	isWindowPresent(const String& name) const;
+
+
+	/*!
+	\brief
+		Destroys all Window objects within the system
+
+	\return
+		Nothing.
+
+	\exception	InvalidRequestException		Thrown if the WindowFactory for any Window object type has been removed.
+	*/
+	void	destroyAllWindows(void);
+
+
+	/*!
+	\brief
+		Creates a set of windows (a Gui layout) from the information in the specified XML file.	
+
+	\param filename
+		String object holding the filename of the XML file to be processed.
+
+	\param name_prefix
+		String object holding the prefix that is to be used when creating the windows in the layout file, this
+		function allows a layout to be loaded multiple times without having name clashes.  Note that if you use
+		this facility, then all windows defined within the layout must have names assigned; you currently can not
+		use this feature in combination with automatically generated window names.
+
+    \param resourceGroup
+        Resource group identifier to be passed to the resource provider when loading the layout file.
+
+	\param callback
+		PropertyCallback function to be called for each Property element loaded from the layout.  This is
+		called prior to the property value being applied to the window enabling client code manipulation of
+		properties.
+
+	\param userdata
+		Client code data pointer passed to the PropertyCallback function.
+
+	\return
+		Pointer to the root Window object defined in the layout.
+
+	\exception FileIOException			thrown if something goes wrong while processing the file \a filename.
+	\exception InvalidRequestException	thrown if \a filename appears to be invalid.
+	*/
+	Window*	loadWindowLayout(const String& filename, const String& name_prefix = "", const String& resourceGroup = "", PropertyCallback* callback = NULL, void* userdata = NULL);
+
+    /*!
+    \brief
+        Return whether the window dead pool is empty.
+
+    \return
+        - true if there are no windows in the dead pool.
+        - false if the dead pool contains >=1 window awaiting destruction.
+    */
+    bool isDeadPoolEmpty(void) const;
+
+    /*!
+    \brief
+        Permanently destroys any windows placed in the dead pool.
+
+    \note
+        It is probably not a good idea to call this from a Window based event handler
+        if the specific window has been or is being destroyed.
+
+    \return
+        Nothing.
+    */
+    void cleanDeadPool(void);
+
+    /*!
+    \brief
+        Writes a full XML window layout, starting at the given Window to the given OutStream.
+
+    \param window
+        Window object to become the root of the layout.
+
+    \param out_stream
+        OutStream (std::ostream based) object where data is to be sent.
+
+    \param writeParent
+        If the starting window has a parent window, specifies whether to write the parent name into
+        the Parent attribute of the GUILayout XML element.
+
+    \return
+        Nothing.
+    */
+    void writeWindowLayoutToStream(const Window& window, OutStream& out_stream, bool writeParent = false) const;
+
+    /*!
+    \brief
+        Writes a full XML window layout, starting at the given Window to the given OutStream.
+
+    \param window
+        String holding the name of the Window object to become the root of the layout.
+
+    \param out_stream
+        OutStream (std::ostream based) object where data is to be sent.
+
+    \param writeParent
+        If the starting window has a parent window, specifies whether to write the parent name into
+        the Parent attribute of the GUILayout XML element.
+
+    \return
+        Nothing.
+    */
+    void writeWindowLayoutToStream(const String& window, OutStream& out_stream, bool writeParent = false) const;
+
+    /*!
+    \brief
+        Rename a window.
+
+    \param window
+        String holding the current name of the window to be renamed.
+
+    \param new_name
+        String holding the new name for the window
+
+    \exception UnknownObjectException
+        thrown if \a window is not known in the system.
+
+    \exception AlreadyExistsException
+        thrown if a Window named \a new_name already exists.
+    */
+    void renameWindow(const String& window, const String& new_name);
+
+    /*!
+    \brief
+        Rename a window.
+
+    \param window
+        Pointer to the window to be renamed.
+
+    \param new_name
+        String holding the new name for the window
+
+    \exception AlreadyExistsException
+        thrown if a Window named \a new_name already exists.
+    */
+    void renameWindow(Window* window, const String& new_name);
+
+private:
+    /*************************************************************************
+        Implementation Methods
+    *************************************************************************/
+    /*!
+    \brief
+        Implementation method to generate a unique name to use for a window.
+    */
+    String generateUniqueWindowName();
+
+	/*************************************************************************
+		Implementation Constants
+	*************************************************************************/
+	static const char	GUILayoutSchemaName[];			//!< Filename of the XML schema used for validating GUILayout files.
+
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	typedef std::map<String, Window*>			WindowRegistry;				//!< Type used to implement registry of Window objects
+    typedef std::vector<Window*>    WindowVector;   //!< Type to use for a collection of Window pointers.
+
+	WindowRegistry			d_windowRegistry;			//!< The container that forms the Window registry
+    WindowVector    d_deathrow;     //!< Collection of 'destroyed' windows.
+
+    unsigned long   d_uid_counter;  //!< Counter used to generate unique window names.
+
+public:
+	/*************************************************************************
+		Iterator stuff
+	*************************************************************************/
+	typedef	ConstBaseIterator<WindowRegistry>	WindowIterator;
+
+	/*!
+	\brief
+		Return a WindowManager::WindowIterator object to iterate over the currently defined Windows.
+	*/
+	WindowIterator	getIterator(void) const;
+};
+
+} // End of  CEGUI namespace section
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIWindowManager_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/Makefile.am
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/Makefile.am	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/Makefile.am	(revision 1812)
@@ -0,0 +1,71 @@
+SUBDIRS = . elements renderers falagard
+pkginclude_HEADERS = CEGUI.h \
+                 CEGUIBase.h \
+                 CEGUIColourRect.h \
+                 CEGUIConfig.h \
+                 CEGUIConfig_xmlHandler.h \
+                 CEGUIDataContainer.h \
+                 CEGUIDefaultResourceProvider.h \
+                 CEGUIEvent.h \
+                 CEGUIEventArgs.h \
+                 CEGUIEventSet.h \
+                 CEGUIExceptions.h \
+                 CEGUIFactoryModule.h \
+                 CEGUIFont.h \
+                 CEGUIFontManager.h \
+                 CEGUIFont_xmlHandler.h \
+                 CEGUIForwardRefs.h \
+                 CEGUIGlobalEventSet.h \
+                 CEGUIGUILayout_xmlHandler.h \
+                 CEGUIImage.h \
+                 CEGUIImageset.h \
+                 CEGUIImagesetManager.h \
+                 CEGUIImageset_xmlHandler.h \
+                 CEGUIInputEvent.h \
+                 CEGUIIteratorBase.h \
+                 CEGUILogger.h \
+                 CEGUIMouseCursor.h \
+                 CEGUIProperty.h \
+                 CEGUIPropertyHelper.h \
+                 CEGUIPropertySet.h \
+                 CEGUIRect.h \
+                 CEGUIRefPtr.h \
+                 CEGUIRenderCache.h \
+                 CEGUIRenderableElement.h \
+                 CEGUIRenderableFrame.h \
+                 CEGUIRenderableImage.h \
+                 CEGUIRenderer.h \
+                 CEGUIResourceProvider.h \
+                 CEGUIScheme.h \
+                 CEGUISchemeManager.h \
+                 CEGUIScheme_xmlHandler.h \
+                 CEGUIScriptModule.h \
+                 CEGUISingleton.h \
+                 CEGUISize.h \
+                 CEGUIString.h \
+                 CEGUISystem.h \
+                 CEGUITextUtils.h \
+                 CEGUITexture.h \
+                 CEGUIUDim.h \
+                 CEGUIVector.h \
+                 CEGUIVersion.h \
+                 CEGUIWindow.h \
+                 CEGUIWindowFactory.h \
+                 CEGUIWindowFactoryManager.h \
+                 CEGUIWindowManager.h \
+                 CEGUIWindowProperties.h \
+                 CEGUIXMLAttributes.h \
+                 CEGUIXMLHandler.h \
+                 CEGUIXMLParser.h \
+                 CEGUIcolour.h 
+
+noinst_HEADERS = CEGUIFontManager_implData.h \
+             CEGUIFont_implData.h
+
+if CEGUI_USING_TINYXML
+noinst_HEADERS += CEGUITinyXMLParser.h
+endif
+
+if CEGUI_USING_XERCES
+noinst_HEADERS += CEGUIXercesParser.h
+endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIRenderer.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIRenderer.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIRenderer.h	(revision 1812)
@@ -0,0 +1,401 @@
+/************************************************************************
+	filename: 	CEGUIRenderer.h
+	created:	20/2/2004
+	author:		Paul D Turner
+	
+	purpose:	Defines interface for abstract Renderer class
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIRenderer_h_
+#define _CEGUIRenderer_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIString.h"
+#include "CEGUIRect.h"
+#include "CEGUIColourRect.h"
+#include "CEGUIEventSet.h"
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+/*!
+\brief
+	Enumerated type that contains the valid flags that can be to use when rendering image
+*/
+enum OrientationFlags {
+	FlipHorizontal		= 1,	//!< Horizontal flip the image
+	FlipVertical		= 2,	//!< Vertical flip the image
+	RotateRightAngle	= 4		//!< Rotate the image anticlockwise 90 degree
+};
+
+/*!
+\brief
+	Enumerated type that contains the valid diagonal-mode that specify how a quad is split into triangles when rendered with fx. a 3D API
+*/
+enum QuadSplitMode
+{
+	TopLeftToBottomRight,	//!< Diagonal goes from top-left to bottom-right
+	BottomLeftToTopRight	//!< Diagonal goes from bottom-left to top-right
+};
+
+
+/*!
+\brief
+	Abstract class defining the interface for Renderer objects.
+
+	Objects derived from Renderer are the means by which the GUI system interfaces
+	with specific rendering technologies.  To use a rendering system or API to draw
+	CEGUI imagery requires that an appropriate Renderer object be available.
+*/
+class CEGUIEXPORT Renderer : public EventSet
+{
+public:
+	static const String EventNamespace;				//!< Namespace for global events
+
+	/*************************************************************************
+		Event name constants
+	*************************************************************************/
+	/*!
+		event that fires when the underlying display size had changed.
+		
+		It is important that all Renderer implementers fire this properly as the
+		system itself subscribes to this event.
+	*/
+	static const String EventDisplaySizeChanged;
+
+
+	/*************************************************************************
+		Abstract interface methods
+	*************************************************************************/
+	/*!
+	\brief
+		Add a quad to the rendering queue.  All clipping and other adjustments should have been made prior to calling this.
+
+	\param dest_rect
+		Rect object describing the destination area (values are in pixels)
+
+	\param z
+		float value specifying the z co-ordinate / z order of the quad
+
+	\param tex
+		pointer to the Texture object that holds the imagery to be rendered
+
+	\param texture_rect
+		Rect object holding the area of \a tex that is to be rendered (values are in texture co-ordinates).
+
+	\param colours
+		ColourRect object describing the colour values that are to be applied when rendering.
+	
+	\param quad_split_mode
+		One of the QuadSplitMode values specifying the way quads are split into triangles
+
+	\return
+		Nothing
+	*/
+	virtual	void	addQuad(const Rect& dest_rect, float z, const Texture* tex, const Rect& texture_rect, const ColourRect& colours, QuadSplitMode quad_split_mode) = 0;
+
+
+	/*!
+	\brief
+		Perform final rendering for all quads that have been queued for rendering
+
+		The contents of the rendering queue is retained and can be rendered again as required.  If the contents is not required call clearRenderList().
+
+	\return
+		Nothing
+	*/
+	virtual	void	doRender(void) = 0;
+
+
+	/*!
+	\brief
+		Clears all queued quads from the render queue.
+	
+	\return
+		Nothing
+	*/
+	virtual	void	clearRenderList(void) = 0;
+
+
+	/*!
+	\brief
+		Enable or disable the queueing of quads from this point on.
+
+		This only affects queueing.  If queueing is turned off, any calls to addQuad will cause the quad to be rendered directly.  Note that
+		disabling queueing will not cause currently queued quads to be rendered, nor is the queue cleared - at any time the queue can still
+		be drawn by calling doRender, and the list can be cleared by calling clearRenderList.  Re-enabling the queue causes subsequent quads
+		to be added as if queueing had never been disabled.
+
+	\param setting
+		true to enable queueing, or false to disable queueing (see notes above).
+
+	\return
+		Nothing
+	*/
+	virtual void	setQueueingEnabled(bool setting) = 0;
+
+
+	/*!
+	\brief
+		Creates a 'null' Texture object.
+
+	\return
+		a newly created Texture object.  The returned Texture object has no size or imagery associated with it, and is
+		generally of little or no use.
+	*/
+	virtual	Texture*	createTexture(void) = 0;
+
+
+	/*!
+	\brief
+		Create a Texture object using the given image file.
+
+	\param filename
+		String object that specifies the path and filename of the image file to use when creating the texture.
+
+    \param resourceGroup
+        Resource group identifier to be passed to the resource provider when loading the texture file.
+
+	\return
+		a newly created Texture object.  The initial contents of the texture memory is the requested image file.
+
+	\note
+		Textures are always created with a size that is a power of 2.  If the file you specify is of a size that is not
+		a power of two, the final size will be rounded up.  Additionally, textures are always square, so the ultimate
+		size is governed by the larger of the width and height of the specified file.  You can check the ultimate sizes
+		by querying the texture after creation.
+	*/
+	virtual	Texture*	createTexture(const String& filename, const String& resourceGroup) = 0;
+
+
+	/*!
+	\brief
+		Create a Texture object with the given pixel dimensions as specified by \a size.  NB: Textures are always square.
+
+	\param size
+		float value that specifies the size to use for the width and height when creating the new texture.
+
+	\return
+		a newly created Texture object.  The initial contents of the texture memory is undefined / random.
+
+	\note
+		Textures are always created with a size that is a power of 2.  If you specify a size that is not a power of two, the final
+		size will be rounded up.  So if you specify a size of 1024, the texture will be (1024 x 1024), however, if you specify a size
+		of 1025, the texture will be (2048 x 2048).  You can check the ultimate size by querying the texture after creation.
+	*/	
+	virtual	Texture*	createTexture(float size) = 0;
+
+
+	/*!
+	\brief
+		Destroy the given Texture object.
+
+	\param texture
+		pointer to the Texture object to be destroyed
+
+	\return
+		Nothing
+	*/
+	virtual	void		destroyTexture(Texture* texture) = 0;
+
+	
+	/*!
+	\brief
+		Destroy all Texture objects.
+
+	\return
+		Nothing
+	*/
+	virtual void		destroyAllTextures(void) = 0;
+
+
+	/*!
+	\brief
+		Return whether queueing is enabled.
+
+	\return
+		true if queueing is enabled, false if queueing is disabled.
+	*/
+	virtual bool	isQueueingEnabled(void) const = 0;
+
+
+	/*!
+	\brief
+		Return the current width of the display in pixels
+
+	\return
+		float value equal to the current width of the display in pixels.
+	*/
+	virtual float	getWidth(void) const	= 0;
+
+
+	/*!
+	\brief
+		Return the current height of the display in pixels
+
+	\return
+		float value equal to the current height of the display in pixels.
+	*/
+	virtual float	getHeight(void) const	= 0;
+
+
+	/*!
+	\brief
+		Return the size of the display in pixels
+
+	\return
+		Size object describing the dimensions of the current display.
+	*/
+	virtual Size	getSize(void) const		= 0;
+
+
+	/*!
+	\brief
+		Return a Rect describing the screen
+
+	\return
+		A Rect object that describes the screen area.  Typically, the top-left values are always 0, and the size of the area described is
+		equal to the screen resolution.
+	*/
+	virtual Rect	getRect(void) const		= 0;
+
+
+	/*!
+	\brief
+		Return the maximum texture size available
+
+	\return
+		Size of the maximum supported texture in pixels (textures are always assumed to be square)
+	*/
+	virtual	uint	getMaxTextureSize(void) const	= 0;
+
+
+	/*!
+	\brief
+		Return the horizontal display resolution dpi
+
+	\return
+		horizontal resolution of the display in dpi.
+	*/
+	virtual	uint	getHorzScreenDPI(void) const	= 0;
+
+
+	/*!
+	\brief
+		Return the vertical display resolution dpi
+
+	\return
+		vertical resolution of the display in dpi.
+	*/
+	virtual	uint	getVertScreenDPI(void) const	= 0;
+
+
+	/*************************************************************************
+		Basic stuff we provide in base class
+	*************************************************************************/
+	/*!
+	\brief
+		Reset the z co-ordinate for rendering.
+	
+	\return
+		Nothing
+	*/
+	void	resetZValue(void)				{d_current_z = GuiZInitialValue;}
+
+
+	/*!
+	\brief
+		Update the z co-ordinate for the next major UI element (window).
+
+	\return
+		Nothing
+	*/
+	void	advanceZValue(void)				{d_current_z -= GuiZElementStep;}
+
+
+	/*!
+	\brief
+		return the current Z value to use (equates to layer 0 for this UI element).
+
+	\return
+		float value that specifies the z co-ordinate to be used for layer 0 on the current GUI element.
+	*/
+	float	getCurrentZ(void) const			{return d_current_z;}
+
+
+	/*!
+	\brief
+		return the z co-ordinate to use for the requested layer on the current GUI element.
+
+	\param layer
+		Specifies the layer to return the Z co-ordinate for.  Each GUI element can use up to 10 layers, so valid inputs are 0 to 9 inclusive.
+		If you specify an invalid value for \a layer, results are undefined.
+
+	\return
+		float value that specifies the Z co-ordinate for layer \a layer on the current GUI element.
+	*/
+	float	getZLayer(uint layer) const		{return d_current_z - ((float)layer * GuiZLayerStep);}
+
+
+    /*!
+    \brief
+        Return identification string for the renderer module.  If the internal id string has not been
+        set by the Renderer module creator, a generic string of "Unknown renderer" will be returned.
+
+    \return
+        String object holding a string that identifies the Renderer in use.
+    */
+    const String& getIdentifierString() const;
+
+    virtual ResourceProvider* createResourceProvider(void);
+
+protected:
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	Renderer(void);
+
+public:		// for luabind support
+	virtual ~Renderer(void);
+
+private:
+	/*************************************************************************
+		Implementation constants
+	*************************************************************************/
+	static const float	GuiZInitialValue;		//!< Initial value to use for 'z' each frame.
+	static const float	GuiZElementStep;		//!< Value to step 'z' for each GUI element.
+	static const float	GuiZLayerStep;			//!< Value to step 'z' for each GUI layer.
+
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	float	d_current_z;		//!< The current z co-ordinate value.
+
+protected:
+    ResourceProvider* d_resourceProvider;      //!< Holds the pointer to the ResourceProvider object.
+    String d_identifierString;                 //!< String that holds some id information about the renderer.
+};
+
+} // End of  CEGUI namespace section
+
+
+#endif	// end of guard _CEGUIRenderer_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIWindow.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIWindow.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/CEGUI/CEGUIWindow.h	(revision 1812)
@@ -0,0 +1,4000 @@
+/************************************************************************
+	filename: 	CEGUIWindow.h
+	created:	21/2/2004
+	author:		Paul D Turner
+
+	purpose:	Defines abstract base class for Window objects
+*************************************************************************/
+/*************************************************************************
+    Crazy Eddie's GUI System (http://www.cegui.org.uk)
+    Copyright (C)2004 - 2005 Paul D Turner (paul@cegui.org.uk)
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Lesser General Public
+    License as published by the Free Software Foundation; either
+    version 2.1 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Lesser General Public License for more details.
+
+    You should have received a copy of the GNU Lesser General Public
+    License along with this library; if not, write to the Free Software
+    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+*************************************************************************/
+#ifndef _CEGUIWindow_h_
+#define _CEGUIWindow_h_
+
+#include "CEGUIBase.h"
+#include "CEGUIString.h"
+#include "CEGUIVector.h"
+#include "CEGUIRect.h"
+#include "CEGUISize.h"
+#include "CEGUIEventSet.h"
+#include "CEGUIPropertySet.h"
+#include "CEGUISystem.h"
+#include "CEGUIInputEvent.h"
+#include "CEGUIWindowProperties.h"
+#include "CEGUIUDim.h"
+#include "CEGUIRenderCache.h"
+#include <vector>
+
+
+#if defined(_MSC_VER)
+#	pragma warning(push)
+#	pragma warning(disable : 4251)
+#endif
+
+
+// Start of CEGUI namespace section
+namespace CEGUI
+{
+
+/*!
+\brief
+	Mode used for Window size and position metrics.
+
+	Position information for a Window is always 'relative' to it's parent even in Absolute mode.
+	In Relative mode, layout is maintained for different screen resolutions, and also  offers the
+	ability for child windows to properly adjust their layout as their parent is sized.
+*/
+enum MetricsMode
+{
+	Relative,		//!< Metrics are specified as a decimal fraction of parent Window size.
+	Absolute,		//!< Metrics are specified as whole pixels.
+	Inherited		//!< Metrics are inherited from parent.
+};
+
+/*!
+\brief
+    Enumerated type used when specifying vertical alignments.
+ */
+enum VerticalAlignment
+{
+    VA_TOP,        //!< Elements position specifies an offset of it's top edge from the top edge of it's parent.
+    VA_CENTRE,     //!< Elements position specifies an offset of it's vertical centre from the vertical centre of it's parent.
+    VA_BOTTOM      //!< Elements position specifies an offset of it's bottom edge from the bottom edge of it's parent.
+};
+
+/*!
+\brief
+    Enumerated type used when specifying horizontal alignments.
+ */
+enum HorizontalAlignment
+{
+    HA_LEFT,        //!< Elements position specifies an offset of it's left edge from the left edge of it's parent.
+    HA_CENTRE,      //!< Elements position specifies an offset of it's horizontal centre from the horizontal centre of it's parent.
+    HA_RIGHT        //!< Elements position specifies an offset of it's right edge from the right edge of it's parent.
+};
+
+/*!
+\brief
+	An abstract base class providing common functionality and specifying the required interface for derived classes.
+
+	The Window base class is the only UI object class that the core of the system knows about, for this reason every
+	other window, widget, or similar item within the system must be derived from Window.  The base class provides the
+	common functionality required by all UI objects, and specifies the minimal interface required to be implemented by
+	derived classes.
+*/
+class CEGUIEXPORT Window : public PropertySet, public EventSet
+{
+public:
+	static const String EventNamespace;				//!< Namespace for global events
+
+	/*************************************************************************
+		Event name constants
+	*************************************************************************/
+	// generated internally by Window
+	static const String EventParentSized;				//!< Parent of this Window has been re-sized.
+	static const String EventSized;					//!< Window size has changed
+	static const String EventMoved;					//!< Window position has changed
+	static const String EventTextChanged;				//!< Text string for the Window has changed
+	static const String EventFontChanged;				//!< Font object for the Window has been changed
+	static const String EventAlphaChanged;			//!< Alpha blend value for the Window has changed
+	static const String EventIDChanged;				//!< Client assigned ID code for the Window has changed
+	static const String EventActivated;				//!< Window has been activated (has input focus)
+	static const String EventDeactivated;				//!< Window has been deactivated (loses input focus)
+	static const String EventShown;					//!< Window has been made visible
+	static const String EventHidden;					//!< Window has been hidden from view
+	static const String EventEnabled;					//!< Window has been enabled (interaction is possible)
+	static const String EventDisabled;				//!< Window has been disabled (interaction is no longer possible)
+	static const String EventMetricsModeChanged;		//!< Active metrics mode has been modified
+	static const String EventClippedByParentChanged;	//!< Clipping by parent mode has been modified
+	static const String EventDestroyedByParentChanged;//!< Destruction by parent mode has been modified
+	static const String EventInheritsAlphaChanged;	//!< Alpha inherited from parent mode has been modified.
+	static const String EventAlwaysOnTopChanged;		//!< Always on top mode has been modified
+	static const String EventInputCaptureGained;		//!< Window has captured all inputs
+	static const String EventInputCaptureLost;		//!< Window has lost it's capture on inputs
+	static const String EventRenderingStarted;		//!< Rendering of the Window has started
+	static const String EventRenderingEnded;			//!< Rendering for the Window has finished
+	static const String EventChildAdded;				//!< A child Window has been added
+	static const String EventChildRemoved;			//!< A child window has been removed
+	static const String EventDestructionStarted;		//!< Destruction of the Window is about to begin.
+	static const String EventZOrderChanged;			//!< The z-order of the window has changed
+	static const String EventDragDropItemEnters;	//!< A DragContainer has been dragged over this window.
+	static const String EventDragDropItemLeaves;	//!< A DragContainer has left this window.
+	static const String EventDragDropItemDropped;	//!< A DragContainer was dropped on this Window.
+    static const String EventVerticalAlignmentChanged;    //!< The vertical alignment of the window has changed.
+    static const String EventHorizontalAlignmentChanged;  //!< The vertical alignment of the window has changed.
+
+	// generated externally (inputs)
+	static const String EventMouseEnters;				//!< Mouse cursor has entered the Window.
+	static const String EventMouseLeaves;				//!< Mouse cursor has left the Window.
+	static const String EventMouseMove;				//!< Mouse cursor was moved within the area of the Window.
+	static const String EventMouseWheel;				//!< Mouse wheel was scrolled within the Window.
+	static const String EventMouseButtonDown;			//!< A mouse button was pressed down within the Window.
+	static const String EventMouseButtonUp;			//!< A mouse button was released within the Window.
+	static const String EventMouseClick;				//!< A mouse button was clicked (down then up) within the Window.
+	static const String EventMouseDoubleClick;		//!< A mouse button was double-clicked within the Window.
+	static const String EventMouseTripleClick;		//!< A mouse button was triple-clicked within the Window.
+	static const String EventKeyDown;					//!< A key on the keyboard was pressed.
+	static const String EventKeyUp;					//!< A key on the keyboard was released.
+	static const String EventCharacterKey;			//!< A text character was typed on the keyboard.
+
+
+	/*************************************************************************
+		Construction and Destruction
+	*************************************************************************/
+	/*!
+	\brief
+		Constructor for Window base class
+
+	\param type
+		String object holding Window type (usually provided by WindowFactory).
+
+	\param name
+		String object holding unique name for the Window.
+	*/
+	Window(const String& type, const String& name);
+
+
+	/*!
+	\brief
+		Destructor for Window base class
+	*/
+	virtual ~Window(void);
+
+
+	/*************************************************************************
+		Accessor functions
+	*************************************************************************/
+	/*!
+	\brief
+		return a String object holding the type name for this Window.
+
+	\return
+		String object holding the Window type.
+	*/
+	const String& getType(void) const;
+
+
+	/*!
+	\brief
+		return a String object holding the name of this Window.
+
+	\return
+		String object holding the unique Window name.
+	*/
+	const String& getName(void) const		{return d_name;}
+
+
+	/*!
+	\brief
+		returns whether or not this Window is set to be destroyed when its parent is destroyed.
+
+	\return
+		true if the Window will be destroyed when its parent is destroyed, false if it will remain.
+	*/
+	bool	isDestroyedByParent(void) const		{return d_destroyedByParent;}
+
+
+	/*!
+	\brief
+		returns whether or not this Window is an always on top (a.k.a 'topmost') Window.
+
+	\return
+		true if this Window is always show on top of other normal windows.  false if the Window has normal z-order behaviour.
+	*/
+	bool	isAlwaysOnTop(void) const			{return d_alwaysOnTop;}
+
+
+	/*!
+	\brief
+		return true if the Window is currently disabled
+
+	\param localOnly
+	   States whether to only return the state set for this window, and so not factor in
+	   inherited state from ancestor windows.
+
+	\return
+		true if the window is disabled, false if the window is enabled.
+	*/
+	bool	isDisabled(bool localOnly = false) const;
+
+
+	/*!
+	\brief
+		return true if the Window is currently visible.
+
+		A true return from this function does not mean that the window is not completely obscured by other windows, just that the window
+		is processed when rendering and is not hidden.
+
+	\param localOnly
+	   States whether to only return the state set for this window, and so not factor in
+	   inherited state from ancestor windows.
+
+	\return
+		true if the window is drawn, false if the window is hidden and therefore ignored when rendering.
+	*/
+	bool	isVisible(bool localOnly = false) const;
+
+
+	/*!
+	\brief
+		return true if this is the active Window (the window that receives inputs)
+
+		Mouse events are always sent to the window containing the mouse cursor regardless of what this reports (unless the window has captured
+		inputs).  This mainly refers to where other (keyboard) inputs are sent.
+
+	\return
+		true if this window has input focus, or false if it does not.
+	*/
+	bool	isActive(void) const;
+
+
+	/*!
+	\brief
+		return true if this Window is clipped so that its rendering does not pass outside its parent windows area.
+
+	\return
+		true if the window will be clipped by its parent window, or false if this windows rendering may pass outside its parents area
+	*/
+	bool	isClippedByParent(void) const		{return d_clippedByParent;}
+
+
+	/*!
+	\brief
+		return the ID code currently assigned to this Window by client code.
+
+	\return
+		uint value equal to the currently assigned ID code for this Window.
+	*/
+	uint	getID(void) const		{return d_ID;}
+
+
+	/*!
+	\brief
+		return the number of child Window objects currently attached to this Window.
+
+	\return
+		uint value equal to the number of Window objects directly attached to this Window as children.
+	*/
+	uint   getChildCount(void) const      {return (uint)d_children.size();}
+
+
+	/*!
+	\brief
+		returns whether a Window with the specified name is currently attached to this Window as a child.
+
+	\param name
+		String object containing the name of the Window to look for.
+
+	\return
+		true if a Window named \a name is currently attached to this Window as a child, else false.
+	*/
+	bool	isChild(const String& name) const;
+
+
+	/*!
+	\brief
+		returns whether at least one window with the given ID code is attached as a child.
+
+	\note
+		ID codes are client assigned and may or may not be unique, and as such, the return from this function
+		will only have meaning to the client code.
+
+	\param ID
+		uint ID code to look for.
+
+	\return
+		true if a child window was found with the ID code \a ID, or false if no child window was found with the ID \a ID.
+	*/
+	bool	isChild(uint ID) const;
+
+
+	/*!
+	\brief
+		return true if the given Window is a child of this window.
+
+	\param window
+		Pointer to the Window object to look for.
+
+	\return
+		true if Window object \a window is attached to this window as a child.
+	*/
+	bool	isChild(const Window* window) const;
+
+
+	/*!
+	\brief
+		return a pointer to the child window with the specified name.
+
+		This function will throw an exception if no child object with the given name is attached.  This decision
+		was made (over returning NULL if no window was found) so that client code can assume that if the call
+		returns it has a valid window pointer.  We provide the isChild() functions for checking if a given window
+		is attached.
+
+	\param name
+		String object holding the name of the child window to return a pointer to.
+
+	\return
+		Pointer to the Window object attached to this window that has the name \a name.
+
+	\exception UnknownObjectException	thrown if no window named \a name is attached to this Window.
+	*/
+	Window*	getChild(const String& name) const;
+
+
+	/*!
+	\brief
+		return a pointer to the first attached child window with the specified ID.
+
+		This function will throw an exception if no child object with the given ID is attached.  This decision
+		was made (over returning NULL if no window was found) so that client code can assume that if the call
+		returns it has a valid window pointer.  We provide the isChild() functions for checking if a given window
+		is attached.
+
+	\param ID
+		uint value specifying the ID code of the window to return a pointer to.
+
+	\return
+		Pointer to the (first) Window object attached to this window that has the ID code \a ID.
+
+	\exception UnknownObjectException	thrown if no window with the ID code \a ID is attached to this Window.
+	*/
+	Window* getChild(uint ID) const;
+
+
+	/*!
+	\brief
+		return a pointer to the child window that is attached to 'this' at the given index.
+
+	\param idx
+		Index of the child window whos pointer should be returned.  This value is not bounds checked,
+		client code should ensure that this is less than the value returned by getChildCount().
+
+	\return
+		Pointer to the child window currently attached at index position \a idx
+	*/
+	Window*	getChildAtIdx(uint idx) const		{return d_children[idx];}
+
+
+	/*!
+	\brief
+		return a pointer to the Window that currently has input focus starting with this Window.
+
+	\return
+		Pointer to the window that is active (has input focus) starting at 'this.  Will return 'this' if this Window is active
+		and either no children are attached or if none of the attached children are active.  Returns NULL if this Window (and
+		therefore all children) are not active.
+	*/
+	Window*	getActiveChild(void);
+	const Window* getActiveChild(void) const;
+
+
+	/*!
+	\brief
+		return true if the specified Window is some ancestor of this Window
+
+	\param name
+		String object holding the name of the Window to check for.
+
+	\return
+		true if a Window named \a name is an ancestor (parent, or parent of parent, etc) of this Window, or false if not.
+	*/
+	bool	isAncestor(const String& name) const;
+
+
+	/*!
+	\brief
+		return true if any Window with the given ID is some ancestor of this Window.
+
+	\param ID
+		uint value specifying the ID to look for.
+
+	\return
+		true if an ancestor (parent, or parent of parent, etc) was found with the ID code \a ID, else false.
+	*/
+	bool	isAncestor(uint ID) const;
+
+
+	/*!
+	\brief
+		return true if the specified Window is some ancestor of this Window.
+
+	\param window
+		Pointer to the Window object to look for.
+
+	\return
+		true if \a window was found to be an ancestor (parent, or parent of parent, etc) of this Window, otherwise false.
+	*/
+	bool	isAncestor(const Window* window) const;
+
+
+	/*!
+	\brief
+		return the Font object active for the Window.
+
+	\param useDefault
+	   Sepcifies whether to return the default font if Window has no preference set.
+
+	\return
+		Pointer to the Font being used by this Window.  If the window has no assigned font, the default font is returned.
+	*/
+	const Font*		getFont(bool useDefault = true) const;
+
+
+	/*!
+	\brief
+		return the current text for the Window
+
+	\return
+		A String object that holds the current text for this Window.
+	*/
+	const String&	getText(void) const		{return d_text;}
+
+
+	/*!
+	\brief
+		return true if the Window inherits alpha from its parent(s).
+
+	\return
+		true if the Window inherits alpha from its parent(s), false if the alpha for this Window is independant.
+	*/
+	bool	inheritsAlpha(void) const		{return d_inheritsAlpha;}
+
+
+	/*!
+	\brief
+		return the current alpha value set for this Window
+
+	\note
+		The alpha value set for any given window may or may not be the final alpha value that is used when rendering.  All window
+		objects, by default, inherit alpha from thier parent window(s) - this will blend child windows, relatively, down the line of
+		inheritance.  This behaviour can be overridden via the setInheritsAlpha() method.  To return the true alpha value that will be
+		applied when rendering, use the getEffectiveAlpha() method.
+
+	\return
+		the currently set alpha value for this Window.  Will be between 0.0f and 1.0f.
+	*/
+	float	getAlpha(void) const			{return d_alpha;}
+
+
+	/*!
+	\brief
+		return the effective alpha value that will be used when rendering this window, taking into account inheritance of parent
+		window(s) alpha.
+
+	\return
+		the effective alpha that will be applied to this Window when rendering.  Will be between 0.0f and 1.0f.
+	*/
+	float	getEffectiveAlpha(void) const;
+
+
+	/*!
+	\brief
+		return a Rect object that describes the Window area.
+
+	\return
+		Rect object that describes the area covered by the Window.  The values in the returned Rect are in whatever form is set
+		as the current metric type.  The returned Rect is unclipped and relative to the Window objects parent.
+	*/
+	Rect	getRect(void) const;
+
+
+	/*!
+	\brief
+		return a Rect object describing the Window area in screen space.
+
+	\return
+		Rect object that describes the area covered by the Window.  The values in the returned Rect are in screen pixels.  The
+		returned Rect is clipped as appropriate and depending upon the 'ClippedByParent' setting.
+
+	\note
+		This has now been made virtual to ease some customisations that require more specialised clipping requirements.
+	*/
+	virtual Rect	getPixelRect(void) const;
+
+
+	/*!
+	\brief
+		return a Rect object describing the clipped inner area for this window.
+
+	\return
+		Rect object that describes, in appropriately clipped screen pixel co-ordinates, the window object's inner rect area.
+	*/
+	Rect	getInnerRect(void) const;
+
+
+	/*!
+	\brief
+		return a Rect object describing the Window area unclipped, in screen space.
+
+	\return
+		Rect object that describes the area covered by the Window.  The values in the returned Rect are in screen pixels.  The
+		returned rect is fully unclipped.
+	*/
+	Rect	getUnclippedPixelRect(void) const;
+
+
+	/*!
+	\brief
+		Return a Rect object that describes, unclipped, the inner rectangle for this window.  The inner rectangle is
+		typically an area that excludes some frame or other rendering that should not be touched by subsequent rendering.
+
+	\return
+		Rect object that describes, in unclipped screen pixel co-ordinates, the window object's inner rect area.
+	*/
+	virtual Rect	getUnclippedInnerRect(void) const;
+
+
+	/*!
+	\brief
+		return the Window that currently has inputs captured.
+
+	\return
+		Pointer to the Window object that currently has inputs captured, or NULL if no Window has captured input.
+	*/
+	static	Window*	getCaptureWindow(void)		{return d_captureWindow;}
+
+
+	/*!
+	\brief
+		return true if this Window has input captured.
+
+	\return
+		true if this Window has captured inputs, or false if some other Window, or no Window, has captured inputs.
+	*/
+	bool	isCapturedByThis(void) const		{return getCaptureWindow() == this;}
+
+
+	/*!
+	\brief
+		return true if a child window has captured inputs.
+
+	\return
+		true if inputs are captured by a Window that is attached as a child of this Window, else false.
+	*/
+	bool	isCapturedByAncestor(void) const	{return isAncestor(getCaptureWindow());}
+
+
+	/*!
+	\brief
+		return true if an ancestor window has captured inputs.
+
+	\return
+		true if inputs are captured by a Window that is some ancestor (parent, parent of parent, etc) of this Window, else false.
+	*/
+	bool	isCapturedByChild(void) const		{return isChild(getCaptureWindow());}
+
+
+	/*!
+	\brief
+		check if the given position would hit this window.
+
+	\param position
+		Point object describing the position to check in screen pixels
+
+	\return
+		true if \a position 'hits' this Window, else false.
+	*/
+	virtual bool	isHit(const Point& position) const;
+
+
+	/*!
+	\brief
+		return the child Window that is 'hit' by the given position
+
+	\param position
+		Point object that describes the position to check in screen pixels
+
+	\return
+		Pointer to the child Window that was hit according to the Point \a position, or NULL if no child window was hit.
+	*/
+	Window*	getChildAtPosition(const Point& position) const;
+
+
+    /*!
+    \brief
+        return the child Window that is 'hit' by the given position, and is allowed to handle mouse events.
+
+    \param position
+        Point object that describes the position to check in screen pixels
+
+    \return
+        Pointer to the child Window that was hit according to the Point \a position, or NULL if no child window was hit.
+    */
+    Window* getTargetChildAtPosition(const Point& position) const;
+
+
+	/*!
+	\brief
+		return the current metrics mode employed by the Window
+
+	\return
+		One of the values of the MectricsMode enumerated type, that describes the current metrics in use by the Window.
+	*/
+	MetricsMode	getMetricsMode(void) const;
+
+
+	/*!
+	\brief
+		return the x position of the window.  Interpretation of return value depends upon the metric type in use by this window.
+
+	\return
+		float value that specifies the x position of the Window relative to it's parent, depending on the metrics system in use for this
+		Window, this value will specify either pixels or a decimal fraction of the width of the parent Window.
+	*/
+	float	getXPosition(void) const;
+
+
+	/*!
+	\brief
+		return the y position of the window.  Interpretation of return value depends upon the metric type in use by this window.
+
+	\return
+		float value that specifies the y position of the Window relative to it's parent, depending on the metrics system in use for this
+		Window, this value will specify either pixels or a decimal fraction of the height of the parent Window.
+	*/
+	float	getYPosition(void) const;
+
+
+	/*!
+	\brief
+		return the position of the window.  Interpretation of return value depends upon the metric type in use by this window.
+
+	\return
+		Point object that describes the position of the Window relative to it's parent, depending on the metrics system in use for this
+		Window, the values in the Point will specify either pixels or decimal fractions of the total width and height of the parent.
+	*/
+	Point	getPosition(void) const;
+
+
+	/*!
+	\brief
+		return the width of the Window.  Interpretation of return value depends upon the metric type in use by this window.
+
+	\return
+		float value that specifies the width of the Window.  Depending upon the metrics system in use for this window, the return
+		value will either be in pixels, or as a decimal fraction of the width of the parent Window.
+	*/
+	float	getWidth(void) const;
+
+	/*!
+	\brief
+		return the height of the Window.  Interpretation of return value depends upon the metric type in use by this window.
+
+	\return
+		float value that specifies the height of the Window.  Depending upon the metrics system in use for this window, the return
+		value will either be in pixels, or as a decimal fraction of the height of the parent Window.
+	*/
+	float	getHeight(void) const;
+
+
+	/*!
+	\brief
+		return the size of the Window.  Interpretation of return value depends upon the metric type in use by this window.
+
+	\return
+		Size object that describes the dimensions of the Window.  Depending upon the metrics system in use for this window, the
+		values will either be in pixels, or as decimal fractions of the width and height of the parent Window.
+	*/
+	Size	getSize(void) const;
+
+
+	/*!
+	\brief
+		return the parent of this Window.
+
+	\return
+		Pointer to the Window object that is the parent of this Window.  This value can be NULL, in which case the Window is a GUI
+		Sheet / Root.
+	*/
+	Window*	getParent(void) const				{return d_parent;}
+
+
+	/*!
+	\brief
+		Return the current maximum size for this window.
+
+	\return
+		Size object describing the maximum size for this window.  If using absolute co-ordinates the returned object has it's values expressed
+		as screen pixels.  If using relative co-ordinates the returned object has it's values expressed as fractions of the current display size.
+	*/
+	Size	getMaximumSize(void) const;
+
+
+	/*!
+	\brief
+		Return the current minimum size for this window.
+
+	\return
+		Size object describing the minimum size for this window.  If using absolute co-ordinates the returned object has it's values expressed
+		as screen pixels.  If using relative co-ordinates the returned object has it's values expressed as fractions of the current display size.
+	*/
+	Size	getMinimumSize(void) const;
+
+
+	/*!
+	\brief
+		Return a pointer to the mouse cursor image to use when the mouse is within this window.
+
+	\param useDefault
+	   Sepcifies whether to return the default font if Window has no preference set.
+
+	\return
+		Pointer to the mouse cursor image that will be used when the mouse enters this window.  May return NULL indicating no cursor.
+	*/
+	const Image*	getMouseCursor(bool useDefault = true) const;
+
+
+	/*!
+	\brief
+		Return the window area rect in relative metrics.
+
+	\return
+		Rect object describing this windows area, relative to the parent window, in parent relative metrics.
+	*/
+    Rect	getRelativeRect(void) const				{ return d_area.asRelative(getParentSize()); }
+
+
+	/*!
+	\brief
+		Return the window position in relative metrics.
+
+	\return
+		Point object describing this windows position, relative to the parent window, in parent relative metrics.
+	*/
+	Point	getRelativePosition(void) const			{ return d_area.getPosition().asRelative(getParentSize()); }
+
+
+	/*!
+	\brief
+		Return the window X position in relative metrics.
+
+	\return
+		float value describing this windows X position, relative to the parent window, in parent relative metrics.
+	*/
+	float	getRelativeXPosition(void) const		{ return d_area.d_min.d_x.asRelative(getParentWidth()); }
+
+
+	/*!
+	\brief
+		Return the window Y position in relative metrics.
+
+	\return
+		float value describing this windows Y position, relative to the parent window, in parent relative metrics.
+	*/
+	float	getRelativeYPosition(void) const		{ return d_area.d_min.d_y.asRelative(getParentHeight()); }
+
+
+	/*!
+	\brief
+		Return the window size in relative metrics.
+
+	\return
+		Size object describing this windows size in parent relative metrics.
+	*/
+    Size	getRelativeSize(void) const				{ return d_area.getSize().asRelative(getParentSize()).asSize(); }
+
+
+	/*!
+	\brief
+		Return the window width in relative metrics.
+
+	\return
+		float value describing this windows width in parent relative metrics.
+	*/
+	float	getRelativeWidth(void) const			{ return d_area.getWidth().asRelative(getParentWidth()); }
+
+
+	/*!
+	\brief
+		Return the window height in relative metrics.
+
+	\return
+		float value describing this windows height in parent relative metrics.
+	*/
+	float	getRelativeHeight(void) const			{ return d_area.getHeight().asRelative(getParentHeight()); }
+
+
+	/*!
+	\brief
+		Return the window area rect in absolute metrics.
+
+	\return
+		Rect object describing this windows area, relative to the parent window, in absolute metrics
+	*/
+    Rect	getAbsoluteRect(void) const				{ return Rect(d_area.getPosition().asAbsolute(getParentSize()), d_pixelSize); }
+
+
+	/*!
+	\brief
+		Return the window position in absolute metrics.
+
+	\return
+		Point object describing this windows position, relative to the parent window, in absolute metrics.
+	*/
+	Point	getAbsolutePosition(void) const			{ return d_area.getPosition().asAbsolute(getParentSize()); }
+
+
+	/*!
+	\brief
+		Return the window X position in absolute metrics.
+
+	\return
+		float value describing this windows X position, relative to the parent window, in absolute metrics.
+	*/
+	float	getAbsoluteXPosition(void) const		{ return d_area.d_min.d_x.asAbsolute(getParentWidth()); }
+
+
+	/*!
+	\brief
+		Return the window Y position in absolute metrics.
+
+	\return
+		float value describing this windows Y position, relative to the parent window, in absolute metrics.
+	*/
+	float	getAbsoluteYPosition(void) const		{ return d_area.d_min.d_y.asAbsolute(getParentHeight()); }
+
+
+	/*!
+	\brief
+		Return the window size in absolute metrics.
+
+	\return
+		Size object describing this windows size in absolute metrics.
+	*/
+	Size	getAbsoluteSize(void) const				{ return d_pixelSize; }
+
+
+	/*!
+	\brief
+		Return the window width in absolute metrics.
+
+	\return
+		float value describing this windows width in absolute metrics.
+	*/
+	float	getAbsoluteWidth(void) const			{ return d_pixelSize.d_width; }
+
+
+	/*!
+	\brief
+		Return the window height in absolute metrics.
+
+	\return
+	float value describing this windows height in absolute metrics.
+	*/
+	float	getAbsoluteHeight(void) const			{ return d_pixelSize.d_height; }
+
+
+	/*!
+	\brief
+		Return the user data set for this Window.
+
+		Each Window can have some client assigned data attached to it, this data is not used by the GUI system
+		in any way.  Interpretation of the data is entirely application specific.
+
+	\return
+		pointer to the user data that is currently set for this window.
+	*/
+	void*	getUserData(void) const			{return d_userData;}
+
+
+	/*!
+	\brief
+		return the x position of the window using the specified metrics system.
+
+	\param mode
+		One of the MetricsMode enumerated values specifying the metrics system to be used for the return value.
+
+	\return
+		float value that specifies the x position of the Window relative to it's parent, using the specified MetricsMode.
+	*/
+	float	getXPosition(MetricsMode mode) const;
+
+
+	/*!
+	\brief
+		return the y position of the window using the specified metrics system.
+
+	\param mode
+		One of the MetricsMode enumerated values specifying the metrics system to be used for the return value.
+
+	\return
+		float value that specifies the y position of the Window relative to it's parent,  using the specified MetricsMode.
+	*/
+	float	getYPosition(MetricsMode mode) const;
+
+
+	/*!
+	\brief
+		return the position of the window using the specified metrics system.
+
+	\param mode
+		One of the MetricsMode enumerated values specifying the metrics system to be used for the return value.
+
+	\return
+		Point object that describes the position of the Window relative to it's parent, using the specified MetricsMode.
+	*/
+	Point	getPosition(MetricsMode mode) const;
+
+
+	/*!
+	\brief
+		return the width of the Window using the specified metrics system.
+
+	\param mode
+		One of the MetricsMode enumerated values specifying the metrics system to be used for the return value.
+
+	\return
+		float value that specifies the width of the Window using the specified MetricsMode.
+	*/
+	float	getWidth(MetricsMode mode) const;
+
+
+	/*!
+	\brief
+		return the height of the Window using the specified metrics system.
+
+	\param mode
+		One of the MetricsMode enumerated values specifying the metrics system to be used for the return value.
+
+	\return
+		float value that specifies the height of the Window using the specified MetricsMode.
+	*/
+	float	getHeight(MetricsMode mode) const;
+
+
+	/*!
+	\brief
+		return the size of the Window using the specified metrics system.
+
+	\param mode
+		One of the MetricsMode enumerated values specifying the metrics system to be used for the return value.
+
+	\return
+		Size object that describes the dimensions of the Window using the specified MetricsMode.
+	*/
+	Size	getSize(MetricsMode mode) const;
+
+
+	/*!
+	\brief
+		return a Rect object that describes the Window area using the specified metrics system.
+
+	\param mode
+		One of the MetricsMode enumerated values specifying the metrics system to be used for the return value.
+
+	\return
+		Rect object that describes the area covered by the Window using the specified MetricsMode.
+	*/
+	Rect	getRect(MetricsMode mode) const;
+
+
+	/*!
+	\brief
+		Return whether this window is set to restore old input capture when it loses input capture.
+
+		This is only really useful for certain sub-components for widget writers.
+
+	\return
+		- true if the window will restore the previous capture window when it loses input capture.
+		- false if the window will set the capture window to NULL when it loses input capture (this is the default behaviour).
+	*/
+	bool	restoresOldCapture(void) const		{return d_restoreOldCapture;}
+
+
+	/*!
+	\brief
+		Return whether z-order changes are enabled or disabled for this Window.
+
+	\return
+		- true if z-order changes are enabled for this window.  moveToFront/moveToBack work normally as expected.
+		- false: z-order changes are disabled for this window.  moveToFront/moveToBack are ignored for this window.
+	*/
+	bool	isZOrderingEnabled(void) const;
+
+
+    /*!
+    \brief
+        Return whether this window will receive multi-click events or multiple 'down' events instead.
+
+    \return
+        - true if the Window will receive double-click and triple-click events.
+        - false if the Window will receive multiple mouse button down events instead of double/triple click events.
+    */
+    bool    wantsMultiClickEvents(void) const;
+
+
+    /*!
+    \brief
+        Return whether mouse button down event autorepeat is enabled for this window.
+
+    \return
+        - true if autorepeat of mouse button down events is enabled for this window.
+        - false if autorepeat of mouse button down events is not enabled for this window.
+    */
+    bool    isMouseAutoRepeatEnabled(void) const;
+
+
+    /*!
+    \brief
+        Return the current auto-repeat delay setting for this window.
+
+    \return
+        float value indicating the delay, in seconds, defore the first repeat mouse button down event will be triggered when autorepeat is enabled.
+    */
+    float   getAutoRepeatDelay(void) const;
+
+
+    /*!
+    \brief
+        Return the current auto-repeat rate setting for this window.
+
+    \return
+        float value indicating the rate, in seconds, at which repeat mouse button down events will be generated after the initial delay has expired.
+    */
+    float   getAutoRepeatRate(void) const;
+
+
+    /*!
+    \brief
+        Return whether the window wants inputs passed to its attached
+        child windows when the window has inputs captured.
+
+    \return
+        - true if System should pass captured input events to child windows.
+        - false if System should pass captured input events to this window only.
+    */
+    bool    distributesCapturedInputs(void) const;
+
+
+    /*!
+    \brief
+        Return whether this Window is using the system default Tooltip for its Tooltip window.
+
+    \return
+        - true if the Window will use the system default tooltip.
+        - false if the window has a custom Tooltip object.
+    */
+    bool isUsingDefaultTooltip(void) const;
+
+    /*!
+    \brief
+        Return a pointer to the Tooltip object used by this Window.  The value returned may
+        point to the system default Tooltip, a custom Window specific Tooltip, or be NULL.
+
+    \return
+        Pointer to a Tooltip based object, or NULL.
+    */
+    Tooltip* getTooltip(void) const;
+
+    /*!
+    \brief
+        Return the custom tooltip type.
+
+    \return
+        String object holding the current custom tooltip window type, or an empty string if no custom tooltip is set.
+     */
+    String getTooltipType(void) const;
+
+    /*!
+    \brief
+        Return the current tooltip text set for this Window.
+
+    \return
+        String object holding the current tooltip text set for this window.
+     */
+    const String& getTooltipText(void) const;
+
+    /*!
+    \brief
+        Return whether this window inherits Tooltip text from its parent when its own tooltip text is not set.
+
+    \return
+        - true if the window inherits tooltip text from its parent when its own text is not set.
+        - false if the window does not inherit tooltip text from its parent (and shows no tooltip when no text is set).
+     */
+    bool inheritsTooltipText(void) const;
+
+    /*!
+    \brief
+        Return whether this window will rise to the top of the z-order when clicked with the left mouse button.
+
+    \return
+        - true if the window will come to the top of other windows when the left mouse button is pushed within its area.
+        - false if the window does not change z-order position when the left mouse button is pushed within its area.
+     */
+    bool isRiseOnClickEnabled(void) const   { return d_riseOnClick; }
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	bool testClassName(const String& class_name) const		{return testClassName_impl(class_name);}
+
+    /*!
+    \brief
+        Get the vertical alignment.
+
+        Returns the vertical alignment for the window.  This setting affects how the windows position is
+        interpreted relative to its parent.
+
+    \return
+        One of the VerticalAlignment enumerated values.
+     */
+    VerticalAlignment getVerticalAlignment() const  {return d_vertAlign;}
+
+    /*!
+    \brief
+        Get the horizontal alignment.
+
+        Returns the horizontal alignment for the window.  This setting affects how the windows position is
+        interpreted relative to its parent.
+
+    \return
+        One of the HorizontalAlignment enumerated values.
+     */
+    HorizontalAlignment getHorizontalAlignment() const  {return d_horzAlign;}
+
+    /*!
+    \brief
+        Return the RenderCache object for this Window.
+
+    \return
+        Reference to the RenderCache object for this Window.
+    */
+    RenderCache& getRenderCache()   { return d_renderCache; }
+
+    /*!
+    \brief
+        Get the name of the LookNFeel assigned to this window.
+
+    \return
+        String object holding the name of the look assigned to this window.
+        Returns the empty string if no look is assigned.
+    */
+    const String& getLookNFeel();
+
+	/*!
+	\brief
+		Get whether or not this Window is the modal target.
+
+	\return
+		Returns true if this Window is the modal target, otherwise false.
+	*/
+	bool getModalState(void) const	{return (System::getSingleton().getModalTarget() == this);}
+
+
+	/*!
+	\brief
+	   Returns a named user string.
+
+    \param name
+        String object holding the name of the string to be returned.
+
+    \return
+        String object holding the data stored for the requested user string.
+
+    \exception UnknownObjectException thrown if a user string named \a name does not exist.
+    */
+    const String& getUserString(const String& name) const;
+
+    /*!
+    \brief
+        Return whether a user string with the specified name exists.
+
+    \param name
+        String object holding the name of the string to be checked.
+
+    \return
+        - true if a user string named \a name exists.
+        - false if no such user string exists.
+    */
+    bool isUserStringDefined(const String& name) const;
+
+    /*!
+    \brief
+        Returns the active sibling window.
+
+        This searches the immediate children of this window's parent, and returns a pointer
+        to the active window.  The method will return this if we are the immediate child of our
+        parent that is active.  If our parent is not active, or if no immediate child of our
+        parent is active then 0 is returned.  If this window has no parent, and this window is
+        not active then 0 is returned, else this is returned.
+
+    \return
+        A pointer to the immediate child window attached to our parent that is currently active,
+        or 0 if no immediate child of our parent is active.
+    */
+    Window* getActiveSibling();
+
+    /*!
+    \brief
+        Returns whether this window should ignore mouse event and pass them through to and other windows behind it.
+        In effect making the window transparent to the mouse.
+
+    \return
+        true if mouse pass through is enabled.
+        false if mouse pass through is not enabled.
+    */
+    bool isMousePassThroughEnabled(void) const      {return d_mousePassThroughEnabled;}
+
+    /*************************************************************************
+		Manipulator functions
+	*************************************************************************/
+	/*!
+	\brief
+        Renames the window.
+
+    \param new_name
+        String object holding the new name for the window.
+
+    \exception AlreadyExistsException
+        thrown if a Window named \a new_name already exists in the system.
+    */
+    void rename(const String& new_name);
+
+    /*!
+    \brief
+		Initialises the Window based object ready for use.
+
+	\note
+		This must be called for every window created.  Normally this is handled automatically by the WindowFactory for each Window type.
+
+	\return
+		Nothing
+	*/
+	virtual void	initialise(void) {}
+
+
+	/*!
+	\brief
+		Set whether or not this Window will automatically be destroyed when its parent Window is destroyed.
+
+	\param setting
+		set to true to have the Window auto-destroyed when its parent is destroyed (default), or false to have the Window
+		remain after its parent is destroyed.
+
+	\return
+		Nothing
+	*/
+	void	setDestroyedByParent(bool setting);
+
+
+	/*!
+	\brief
+		Set whether this window is always on top, or not.
+
+	\param setting
+		true to have the Window appear on top of all other non always on top windows, or false to allow the window to be covered by other windows.
+
+	\return
+		Nothing
+	*/
+	void	setAlwaysOnTop(bool setting);
+
+
+	/*!
+	\brief
+		Set whether this window is enabled or disabled.  A disabled window normally can not be interacted with, and may have different rendering.
+
+	\param setting
+		true to enable the Window, and false to disable the Window.
+
+	\return
+		Nothing
+	*/
+	void	setEnabled(bool setting);
+
+
+	/*!
+	\brief
+		enable the Window to allow interaction.
+
+	\return
+		Nothing
+	*/
+	void	enable(void)		{setEnabled(true);}
+
+
+	/*!
+	\brief
+		disable the Window to prevent interaction.
+
+	\return
+		Nothing
+	*/
+	void	disable(void)		{setEnabled(false);}
+
+
+	/*!
+	\brief
+		Set whether the Window is visible or hidden.
+
+	\param setting
+		true to make the Window visible, or false to make the Window hidden
+
+	\return
+		Nothing
+	*/
+	void	setVisible(bool setting);
+
+
+	/*!
+	\brief
+		show the Window
+
+	\return
+		Nothing
+	*/
+	void	show(void)			{setVisible(true);}
+
+
+	/*!
+	\brief
+		hide the Window.
+
+	\return
+		Nothing
+	*/
+	void	hide(void)			{setVisible(false);}
+
+
+	/*!
+	\brief
+		Activate the Window giving it input focus and bringing it to the top of all non always-on-top Windows.
+
+	\return
+		Nothing
+	*/
+	void	activate(void);
+
+
+	/*!
+	\brief
+		Deactivate the window.  No further inputs will be received by the window until it is re-activated either programmatically or
+		by the user interacting with the gui.
+
+	\return
+		Nothing.
+	*/
+	void	deactivate(void);
+
+
+	/*!
+	\brief
+		Set whether this Window will be clipped by its parent window(s).
+
+	\param setting
+		true to have the Window clipped so that rendering is constrained to within the area of its parent(s), or false to have rendering constrained
+		to the screen only.
+
+	\return
+		Nothing
+	*/
+	void	setClippedByParent(bool setting);
+
+
+	/*!
+	\brief
+		Set the current ID for the Window.
+
+	\param ID
+		Client assigned ID code for this Window.  The GUI system assigns no meaning to any IDs, they are a device purely for client code usage.
+
+	\return
+		Nothing
+	*/
+	void	setID(uint ID);
+
+
+	/*!
+	\brief
+		Set the current text string for the Window.
+
+	\param text
+		String object containing the text that is to be set as the Window text.
+
+	\return
+		Nothing
+	*/
+	void	setText(const String& text);
+
+
+	/*!
+	\brief
+		Set the current width of the Window.  Interpretation of the input value \a width is dependant upon the current metrics system set for the Window.
+
+	\param width
+		float value that specifies the new width for the window, in units consistent with whatever metrics mode is in operation.
+
+	\return
+		Nothing
+	*/
+	void	setWidth(float width);
+
+
+	/*!
+	\brief
+		Set the current height of the Window.  Interpretation of the input value \a height is dependant upon the current metrics system set for the Window.
+
+	\param height
+		float value that specifies the new height for the window, in units consistent with whatever metrics mode is in operation.
+
+	\return
+		Nothing
+	*/
+	void	setHeight(float height);
+
+
+	/*!
+	\brief
+		Set the current size of the Window.  Interpretation of the input value \a size is dependant upon the current metrics system set for the Window.
+
+	\param size
+		Size object that describes the new dimensions for the window, in units consistent with whatever metrics mode is in operation.
+
+	\return
+		Nothing
+	*/
+	void	setSize(const Size& size);
+
+
+	/*!
+	\brief
+		Set the current 'x' position of the Window.  Interpretation of the input value \a x is dependant upon the current metrics system set for the Window.
+
+	\param x
+		float value that specifies the new x postion of the Window, in units consistent with the current metrics mode.
+
+	\return
+		Nothing
+	*/
+	void	setXPosition(float x);
+
+
+	/*!
+	\brief
+		Set the current 'y' position of the Window.  Interpretation of the input value \a y is dependant upon the current metrics system set for the Window.
+
+	\param y
+		float value that specifies the new y postion of the Window, in units consistent with the current metrics mode.
+
+	\return
+		Nothing
+	*/
+	void	setYPosition(float y);
+
+
+	/*!
+	\brief
+		Set the current position of the Window.  Interpretation of the input value \a position is dependant upon the current metrics system set for the Window.
+
+	\param position
+		Point object that describes the new postion of the Window, in units consistent with the current metrics mode.
+
+	\return
+		Nothing
+	*/
+	void	setPosition(const Point& position);
+
+
+	/*!
+	\brief
+		Set the current area for the Window, this allows for setting of position and size at the same time.
+		Interpretation of the input value \a area is dependant upon the current metrics system set for the Window.
+
+	\param area
+		Rect object that describes the new area for Window, in units consistent with the current metrics mode.
+
+	\return
+		Nothing
+	*/
+	void	setAreaRect(const Rect& area);
+
+
+	/*!
+	\brief
+		Set the font used by this Window.
+
+	\param font
+		Pointer to the Font object to be used by this Window.  If \a font is NULL, the default font will be used.
+
+	\return
+		Nothing
+	*/
+	void	setFont(const Font* font);
+
+
+	/*!
+	\brief
+		Set the font used by this Window.
+
+	\param name
+		String object holding the name of the Font object to be used by this Window.  If \a name == "", the default font will be used.
+
+	\return
+		Nothing
+
+	\exception UnknownObjectException	thrown if the specified Font is unknown within the system.
+	*/
+	void	setFont(const String& name);
+
+
+	/*!
+	\brief
+		Add the named Window as a child of this Window.  If the Window \a name is already attached to a Window, it is detached before
+		being added to this Window.
+
+	\param name
+		String object holding the name of the Window to be added.
+
+	\return
+		Nothing.
+
+	\exception UnknownObjectException	thrown if no Window named \a name exists.
+	\exception InvalidRequestException	thrown if Window \a name is an ancestor of this Window, to prevent cyclic Window structures.
+	*/
+	void	addChildWindow(const String& name);
+
+
+	/*!
+	\brief
+		Add the specified Window as a child of this Window.  If the Window \a window is already attached to a Window, it is detached before
+		being added to this Window.
+
+	\param window
+		Pointer to the Window object to be added.
+
+	\return
+		Nothing
+
+	\exception InvalidRequestException	thrown if Window \a window is an ancestor of this Window, to prevent cyclic Window structures.
+	*/
+	void	addChildWindow(Window* window);
+
+
+	/*!
+	\brief
+		Remove the named Window from this windows child list.
+
+	\param name
+		String object holding the name of the Window to be removed.  If the Window specified is not attached to this Window, nothing happens.
+
+	\return
+		Nothing.
+	*/
+	void	removeChildWindow(const String& name);
+
+
+	/*!
+	\brief
+		Remove the specified Window form this windows child list.
+
+	\param window
+		Pointer to the Window object to be removed.  If the \a window is not attached to this Window, then nothing happens.
+
+	\return
+		Nothing.
+	*/
+	void	removeChildWindow(Window* window);
+
+
+	/*!
+	\brief
+		Remove the first child Window with the specified ID.  If there is more than one attached Window objects with the specified ID, only the fist
+		one encountered will be removed.
+
+	\param ID
+		ID number assigned to the Window to be removed.  If no Window with ID code \a ID is attached, nothing happens.
+
+	\return
+		Nothing.
+	*/
+	void	removeChildWindow(uint ID);
+
+
+	/*!
+	\brief
+		Move the Window to the top of the z order.
+
+		- If the Window is a non always-on-top window it is moved the the top of all other non always-on-top sibling windows, and the process
+			repeated for all ancestors.
+		- If the Window is an always-on-top window it is moved to the of of all sibling Windows, and the process repeated for all ancestors.
+
+	\return
+		Nothing
+	*/
+	void	moveToFront();
+
+
+	/*!
+	\brief
+		Move the Window to the bottom of the Z order.
+
+		- If the window is non always-on-top the Window is sent to the very bottom of its sibling windows and the process repeated for all ancestors.
+		- If the window is always-on-top, the Window is sent to the bottom of all sibling always-on-top windows and the process repeated for all ancestors.
+
+	\return
+		Nothing
+	*/
+	void	moveToBack();
+
+
+	/*!
+	\brief
+		Captures input to this window
+
+	\return
+		- true if input was successfully captured to this window.
+		- false if input could not be captured to this window (maybe because the window is not active).
+	*/
+	bool	captureInput(void);
+
+
+	/*!
+	\brief
+		Releases input capture from this Window.  If this Window does not have inputs captured, nothing happens.
+
+	\return
+		Nothing
+	*/
+	void	releaseInput(void);
+
+
+	/*!
+	\brief
+		Set whether this window will remember and restore the previous window that had inputs captured.
+
+	\param setting
+		- true: The window will remember and restore the previous capture window.  The CaptureLost event is not fired
+		  on the previous window when this window steals input capture.  When this window releases capture, the old capture
+		  window is silently restored.
+
+		- false: Input capture works as normal, each window losing capture is signalled via CaptureLost, and upon the final
+		  release of capture, no previous setting is restored (this is the default 'normal' behaviour).
+
+	\return
+		Nothing
+	*/
+	void	setRestoreCapture(bool setting);
+
+
+	/*!
+	\brief
+		Set the current alpha value for this window.
+
+	\note
+		The alpha value set for any given window may or may not be the final alpha value that is used when rendering.  All window
+		objects, by default, inherit alpha from thier parent window(s) - this will blend child windows, relatively, down the line of
+		inheritance.  This behaviour can be overridden via the setInheritsAlpha() method.  To return the true alpha value that will be
+		applied when rendering, use the getEffectiveAlpha() method.
+
+	\param alpha
+		The new alpha value for the window.  Value should be between 0.0f and 1.0f.
+
+	\return
+		Nothing
+	*/
+	void	setAlpha(float alpha);
+
+
+	/*!
+	\brief
+		Sets whether this Window will inherit alpha from its parent windows.
+
+	\param setting
+		true if the Window should use inherited alpha, or false if the Window should have an independant alpha value.
+
+	\return
+		Nothing
+	*/
+	void	setInheritsAlpha(bool setting);
+
+
+	/*!
+	\brief
+		Signal the System object to redraw (at least) this Window on the next render cycle.
+
+	\return
+		Nothing
+	*/
+	void	requestRedraw(void) const;
+
+
+	/*!
+	\brief
+		set the current metrics mode employed by the Window
+
+	\param mode
+		One of the values of the MectricsMode enumerated type, that describes the metrics mode to be used by the Window.
+
+	\return
+		Nothing
+	*/
+	void setMetricsMode(MetricsMode	mode);
+
+
+	/*!
+	\brief
+		Set the minimum size for this window.
+
+	\param sz
+		Size object describing the minimum size for the window.  For absolute metrics, the Size values are in screen pixels,
+		for relative metrics the Size values are relative to the display size.
+	*/
+	void	setMinimumSize(const Size& sz);
+
+
+	/*!
+	\brief
+		Set the maximum size for this window.
+
+	\param sz
+		Size object describing the maximum size for the window.  For absolute metrics, the Size values are in screen pixels,
+		for relative metrics the Size values are relative to the display size.
+	*/
+	void	setMaximumSize(const Size& sz);
+
+
+	/*!
+	\brief
+		Set the mouse cursor image to be used when the mouse enters this window.
+
+	\param image
+		Pointer to the Image object to use as the mouse cursor image when the mouse enters the area for this Window.
+
+	\return
+		Nothing.
+	*/
+	void	setMouseCursor(const Image* image)		{d_mouseCursor = image;}
+
+
+	/*!
+	\brief
+		Set the mouse cursor image to be used when the mouse enters this window.
+
+	\param image
+		One of the MouseCursorImage enumerated values.
+
+	\return
+		Nothing.
+	*/
+	void	setMouseCursor(MouseCursorImage image)		{d_mouseCursor = (const Image*)image;}
+
+
+	/*!
+	\brief
+		Set the mouse cursor image to be used when the mouse enters this window.
+
+	\param imageset
+		String object that contains the name of the Imageset that contains the image to be used.
+
+	\param image_name
+		String object that contains the name of the Image on \a imageset that is to be used.
+
+	\return
+		Nothing.
+
+	\exception UnknownObjectException	thrown if \a imageset is not known, or if \a imageset contains no Image named \a image_name.
+	*/
+	void	setMouseCursor(const String& imageset, const String& image_name);
+
+
+	/*!
+	\brief
+		Set the user data set for this Window.
+
+		Each Window can have some client assigned data attached to it, this data is not used by the GUI system
+		in any way.  Interpretation of the data is entirely application specific.
+
+	\param user_data
+		pointer to the user data that is to be set for this window.
+
+	\return
+		Nothing.
+	*/
+	void	setUserData(void* user_data)		{d_userData = user_data;}
+
+
+	/*!
+	\brief
+		set the x position of the window using the specified metrics system.
+
+	\param mode
+		One of the MetricsMode enumerated values specifying the metrics system to be used for the return value.
+
+	\param x
+		float value that specifies the x position of the Window relative to it's parent, using the specified MetricsMode.
+
+	\return
+		Nothing.
+	*/
+	void	setXPosition(MetricsMode mode, float x);
+
+
+	/*!
+	\brief
+		set the y position of the window using the specified metrics system.
+
+	\param mode
+		One of the MetricsMode enumerated values specifying the metrics system to be used for the return value.
+
+	\param y
+		float value that specifies the y position of the Window relative to it's parent,  using the specified MetricsMode.
+
+	\return
+		Nothing.
+	*/
+	void	setYPosition(MetricsMode mode, float y);
+
+
+	/*!
+	\brief
+		set the position of the window using the specified metrics system.
+
+	\param mode
+		One of the MetricsMode enumerated values specifying the metrics system to be used for the return value.
+
+	\param position
+		Point object that describes the position of the Window relative to it's parent, using the specified MetricsMode.
+
+	\return
+		Nothing
+	*/
+	void	setPosition(MetricsMode mode, const Point& position);
+
+
+	/*!
+	\brief
+		set the width of the Window using the specified metrics system.
+
+	\param mode
+		One of the MetricsMode enumerated values specifying the metrics system to be used for the return value.
+
+	\param width
+		float value that specifies the width of the Window using the specified MetricsMode.
+
+	\return
+		Nothing.
+	*/
+	void	setWidth(MetricsMode mode, float width);
+
+
+	/*!
+	\brief
+		set the height of the Window using the specified metrics system.
+
+	\param mode
+		One of the MetricsMode enumerated values specifying the metrics system to be used for the return value.
+
+	\param height
+		float value that specifies the height of the Window using the specified MetricsMode.
+
+	\return
+		Nothing.
+	*/
+	void	setHeight(MetricsMode mode, float height);
+
+
+	/*!
+	\brief
+		set the size of the Window using the specified metrics system.
+
+	\param mode
+		One of the MetricsMode enumerated values specifying the metrics system to be used for the return value.
+
+	\param size
+		Size object that describes the dimensions of the Window using the specified MetricsMode.
+
+	\return
+		Nothing.
+	*/
+	void	setSize(MetricsMode mode, const Size& size);
+
+
+	/*!
+	\brief
+		set the Rect that describes the Window area using the specified metrics system.
+
+	\param mode
+		One of the MetricsMode enumerated values specifying the metrics system to be used for the return value.
+
+	\param area
+		Rect object that describes the area to be covered by the Window using the specified MetricsMode.
+
+	\return
+		Nothing.
+	*/
+	void	setRect(MetricsMode mode, const Rect& area);
+
+
+	/*!
+	\brief
+		Set whether z-order changes are enabled or disabled for this Window.
+
+	\param setting
+		- true if z-order changes are enabled for this window.  moveToFront/moveToBack work normally as expected.
+		- false: z-order changes are disabled for this window.  moveToFront/moveToBack are ignored for this window.
+
+	\return
+		Nothing.
+	*/
+	void	setZOrderingEnabled(bool setting);
+
+
+    /*!
+    \brief
+        Set whether this window will receive multi-click events or multiple 'down' events instead.
+
+    \param setting
+        - true if the Window will receive double-click and triple-click events.
+        - false if the Window will receive multiple mouse button down events instead of double/triple click events.
+
+    \return
+        Nothing.
+    */
+    void setWantsMultiClickEvents(bool setting);
+
+
+    /*!
+    \brief
+        Set whether mouse button down event autorepeat is enabled for this window.
+
+    \param setting
+        - true to enable autorepeat of mouse button down events.
+        - false to disable autorepeat of mouse button down events.
+
+    \return
+        Nothing.
+    */
+    void    setMouseAutoRepeatEnabled(bool setting);
+
+
+    /*!
+    \brief
+        Set the current auto-repeat delay setting for this window.
+
+    \param delay
+        float value indicating the delay, in seconds, defore the first repeat mouse button down event should be triggered when autorepeat is enabled.
+
+    \return
+        Nothing.
+    */
+    void   setAutoRepeatDelay(float delay);
+
+
+    /*!
+    \brief
+        Set the current auto-repeat rate setting for this window.
+
+    \param rate
+        float value indicating the rate, in seconds, at which repeat mouse button down events should be generated after the initial delay has expired.
+
+    \return
+        Nothing.
+    */
+    void   setAutoRepeatRate(float rate);
+
+
+    /*!
+    \brief
+        Set whether the window wants inputs passed to its attached
+        child windows when the window has inputs captured.
+
+    \param setting
+        - true if System should pass captured input events to child windows.
+        - false if System should pass captured input events to this window only.
+    */
+    void    setDistributesCapturedInputs(bool setting);
+
+    /*!
+    \brief
+        Internal support method for drag & drop.  You do not normally call
+        this directly from client code.  See the DragContainer class.
+    */
+    void    notifyDragDropItemEnters(DragContainer* item);
+
+    /*!
+    \brief
+        Internal support method for drag & drop.  You do not normally call
+        this directly from client code.  See the DragContainer class.
+    */
+    void    notifyDragDropItemLeaves(DragContainer* item);
+
+    /*!
+    \brief
+        Internal support method for drag & drop.  You do not normally call
+        this directly from client code.  See the DragContainer class.
+    */
+    void    notifyDragDropItemDropped(DragContainer* item);
+
+    /*!
+    \brief
+        Internal destroy method which actually just adds the window and any
+        parent destructed child windows to the dead pool.
+
+        This is virtual to allow for specialised cleanup which may be required
+        in some advanced cases.  If you override this for the above reason, you
+        MUST call this base class version.
+
+    \note
+        You never have to call this method yourself, use WindowManager to
+        destroy your Window objects (which will call this for you).
+    */
+    virtual void    destroy(void);
+
+    /*!
+    \brief
+        Set the custom Tooltip object for this Window.  This value may be NULL to indicate that the
+        Window should use the system default Tooltip object.
+
+    \param tooltip
+        Pointer to a valid Tooltip based object which should be used as the tooltip for this Window, or NULL to
+        indicate that the Window should use the system default Tooltip object.  Note that when passing a pointer
+        to a Tooltip object, ownership of the Tooltip does not pass to this Window object.
+
+    \return
+        Nothing.
+    */
+    void setTooltip(Tooltip* tooltip);
+
+    /*!
+    \brief
+        Set the custom Tooltip to be used by this Window by specifying a Window type.
+
+        The Window will internally attempt to create an instance of the specified window type (which must be
+        derived from the base Tooltip class).  If the Tooltip creation fails, the error is logged and the
+        Window will revert to using either the existing custom Tooltip or the system default Tooltip.
+
+    \param tooltipType
+        String object holding the name of the Tooltip based Window type which should be used as the Tooltip for
+        this Window.
+
+    \return
+        Nothing.
+    */
+    void setTooltipType(const String& tooltipType);
+
+    /*!
+    \brief
+        Set the tooltip text for this window.
+
+    \param tip
+        String object holding the text to be displayed in the tooltip for this Window.
+
+    \return
+        Nothing.
+    */
+    void setTooltipText(const String& tip);
+
+	/*!
+    \brief
+        Set whether this window inherits Tooltip text from its parent when its own tooltip text is not set.
+
+    \param setting
+        - true if the window should inherit tooltip text from its parent when its own text is not set.
+        - false if the window should not inherit tooltip text from its parent (and so show no tooltip when no text is set).
+
+    \return
+        Nothing.
+     */
+    void setInheritsTooltipText(bool setting);
+
+    /*!
+    \brief
+        Set whether this window will rise to the top of the z-order when clicked with the left mouse button.
+
+    \param setting
+        - true if the window should come to the top of other windows when the left mouse button is pushed within its area.
+        - false if the window should not change z-order position when the left mouse button is pushed within its area.
+
+    \return
+        Nothing.
+     */
+    void setRiseOnClickEnabled(bool setting)    { d_riseOnClick = setting; }
+
+    /*!
+    \brief
+        Set the vertical alignment.
+
+        Modifies the vertical alignment for the window.  This setting affects how the windows position is
+        interpreted relative to its parent.
+
+    \param alignment
+        One of the VerticalAlignment enumerated values.
+
+    \return
+        Nothing.
+     */
+    void setVerticalAlignment(const VerticalAlignment alignment);
+
+    /*!
+    \brief
+        Set the horizontal alignment.
+
+        Modifies the horizontal alignment for the window.  This setting affects how the windows position is
+        interpreted relative to its parent.
+
+    \param alignment
+        One of the HorizontalAlignment enumerated values.
+
+    \return
+        Nothing.
+     */
+    void setHorizontalAlignment(const HorizontalAlignment alignment);
+
+    /*!
+    \brief
+        Set the LookNFeel that shoule be used for this window.
+
+    \param falagardType
+        String object holding the mapped falagard type name (since actual window type will be "Falagard/something")
+        and not what was passed to WindowManager.  This will be returned from getType instead of the base type.
+
+    \param look
+        String object holding the name of the look to be assigned to the window.
+
+    \return
+        Nothing.
+
+    \exception InvalidRequestException thrown if the window already has a look assigned to it.
+    */
+    void setLookNFeel(const String& falagardType, const String& look);
+
+	/*!
+	\brief
+		Set the modal state for this Window.
+
+	\param state
+		Boolean value defining if this Window should be the modal target.
+		If true, this Window will be activated and set as the modal target.
+		If false, the modal target will be cleared if this Window is currently the modal target.
+
+	\return
+		Nothing.
+	*/
+	void setModalState(bool state);
+
+    /*!
+    \brief
+        method called to perform extended laying out of attached child windows.
+
+        The system may call this at various times (like when it is resized for example), and it
+        may be invoked directly where required.
+
+    \return
+        Nothing.
+    */
+    virtual void performChildWindowLayout();
+
+    /*!
+    \brief
+       Sets the value a named user string, creating it as required.
+
+    \param name
+        String object holding the name of the string to be returned.
+
+    \param value
+        String object holding the value to be assigned to the user string.
+
+    \return
+        Nothing.
+    */
+    void setUserString(const String& name, const String& value);
+
+    /*!
+    \brief
+        Sets whether this window should ignore mouse events and pass them through to any windows behind it.
+        In effect making the window transparent to the mouse.
+
+    \param setting
+        true if mouse pass through is enabled.
+        false if mouse pass through is not enabled.
+    */
+    void setMousePassThroughEnabled(bool setting)       {d_mousePassThroughEnabled = setting;}
+
+    /*************************************************************************
+		Co-ordinate and Size Conversion Functions
+	*************************************************************************/
+	/*!
+	\brief
+		Convert the given X co-ordinate from absolute to relative metrics.
+
+	\param val
+		X co-ordinate specified in pixels relative to this Window (so 0 is this windows left edge).
+
+	\return
+		A relative metric value that is equivalent to \a val, given the Window objects current width.
+	*/
+	float	absoluteToRelativeX(float val) const;
+
+
+	/*!
+	\brief
+		Convert the given Y co-ordinate from absolute to relative metrics.
+
+	\param val
+		Y co-ordinate specified in pixels relative to this Window (so 0 is this windows top edge).
+
+	\return
+		A relative metric value that is equivalent to \a val, given the Window objects current height.
+	*/
+	float	absoluteToRelativeY(float val) const;
+
+
+	/*!
+	\brief
+		Convert the given position from absolute to relative metrics.
+
+	\param pt
+		Point object that describes a position specified in pixels relative to this Window (so 0,0 is this windows top-left corner).
+
+	\return
+		A Point object describing a relative metric position that is equivalent to \a pt, given the Window objects current size.
+	*/
+	Point	absoluteToRelative(const Point& pt) const;
+
+
+	/*!
+	\brief
+		Convert the given size from absolute to relative metrics.
+
+	\param sze
+		Size object that describes a size specified in pixels.
+
+	\return
+		A Size object describing a relative metric size that is equivalent to \a sze, given the Window objects current size.
+	*/
+	Size	absoluteToRelative(const Size& sze) const;
+
+
+	/*!
+	\brief
+		Convert the given area from absolute to relative metrics.
+
+	\param rect
+		Rect object describing the area specified in pixels relative to this Window.
+
+	\return
+		A Rect object describing a relative metric area that is equivalent to \a rect, given the Window objects current size.
+	*/
+	Rect	absoluteToRelative(const Rect& rect) const;
+
+
+	/*!
+	\brief
+		Convert the given X co-ordinate from relative to absolute metrics.
+
+	\param val
+		X co-ordinate specified in relative metrics for this Window (so 0 is this windows left edge).
+
+	\return
+		An absolute metric value that is equivalent to \a val, given the Window objects current width.
+	*/
+	float	relativeToAbsoluteX(float val) const;
+
+
+	/*!
+	\brief
+		Convert the given Y co-ordinate from relative to absolute metrics.
+
+	\param val
+		Y co-ordinate specified in relative metrics for this Window (so 0 is this windows top edge).
+
+	\return
+		An absolute metric value that is equivalent to \a val, given the Window objects current height.
+	*/
+	float	relativeToAbsoluteY(float val) const;
+
+
+	/*!
+	\brief
+		Convert the given position from relative to absolute metrics.
+
+	\param pt
+		Point object describing a position specified in relative metrics for this Window (so 0,0 is this windows top-left corner).
+
+	\return
+		A Point object describing a position in absolute metric values that is equivalent to \a pt, given the Window objects current size.
+	*/
+	Point	relativeToAbsolute(const Point& pt) const;
+
+
+	/*!
+	\brief
+		Convert the given size from relative to absolute metrics.
+
+	\param sze
+		Size object describing a size specified in relative metrics for this Window.
+
+	\return
+		A Size object that describes a size in absolute metric values that is equivalent to \a sze, given the Window objects current size.
+	*/
+	Size	relativeToAbsolute(const Size& sze) const;
+
+
+	/*!
+	\brief
+		Convert the given area from relative to absolute metrics.
+
+	\param rect
+		Rect object describing the area specified in relative metrics for this Window.
+
+	\return
+		A Rect object that describes an area in absolute metric values that is equivalent to \a rect, given the Window objects current size.
+	*/
+	Rect	relativeToAbsolute(const Rect& rect) const;
+
+
+	/*!
+	\brief
+		Convert a window co-ordinate value, specified in whichever metrics mode is active, to a screen relative pixel co-ordinate.
+
+	\param x
+		x co-ordinate value to be converted
+
+	\return
+		float value describing a pixel screen co-ordinate that is equivalent to window co-ordinate \a x.
+	*/
+	float	windowToScreenX(float x) const;
+
+
+	/*!
+	\brief
+		Convert a window co-ordinate value, specified in whichever metrics mode is active, to a screen relative pixel co-ordinate.
+
+	\param y
+		y co-ordinate value to be converted
+
+	\return
+		float value describing a screen co-ordinate that is equivalent to window co-ordinate \a y.
+	*/
+	float	windowToScreenY(float y) const;
+
+
+	/*!
+	\brief
+		Convert a window co-ordinate position, specified in whichever metrics mode is active, to a screen relative pixel co-ordinate position.
+
+	\param pt
+		Point object describing the position to be converted
+
+	\return
+		Point object describing a screen co-ordinate position that is equivalent to window co-ordinate position \a pt.
+	*/
+	Point	windowToScreen(const Point& pt) const;
+
+
+	/*!
+	\brief
+		Convert a window size value, specified in whichever metrics mode is active, to a size in pixels.
+
+	\param sze
+		Size object describing the size to be converted
+
+	\return
+		Size object describing describing a size in pixels that is equivalent to the window based size \a sze.
+	*/
+	Size	windowToScreen(const Size& sze) const;
+
+
+	/*!
+	\brief
+		Convert a window area, specified in whichever metrics mode is active, to a screen area.
+
+	\param rect
+		Rect object describing the area to be converted
+
+	\return
+		Rect object describing a screen area that is equivalent to window area \a rect.
+	*/
+	Rect	windowToScreen(const Rect& rect) const;
+
+
+	/*!
+	\brief
+		Convert a screen relative pixel co-ordinate value to a window co-ordinate value, specified in whichever metrics mode is active.
+
+	\param x
+		x co-ordinate value to be converted
+
+	\return
+		float value describing a window co-ordinate value that is equivalent to screen co-ordinate \a x.
+	*/
+	float	screenToWindowX(float x) const;
+
+
+	/*!
+	\brief
+		Convert a screen relative pixel co-ordinate value to a window co-ordinate value, specified in whichever metrics mode is active.
+
+	\param y
+		y co-ordinate value to be converted
+
+	\return
+		float value describing a window co-ordinate value that is equivalent to screen co-ordinate \a y.
+	*/
+	float	screenToWindowY(float y) const;
+
+
+	/*!
+	\brief
+		Convert a screen relative pixel position to a window co-ordinate position, specified in whichever metrics mode is active.
+
+	\param pt
+		Point object describing the position to be converted
+
+	\return
+		Point object describing a window co-ordinate position that is equivalent to screen co-ordinate \a x.
+	*/
+	Point	screenToWindow(const Point& pt) const;
+
+
+	/*!
+	\brief
+		Convert a pixel screen size to a window based size, specified in whichever metrics mode is active.
+
+	\param sze
+		Size object describing the size to be converted
+
+	\return
+		Size object describing a window based size that is equivalent to screen based size \a sze.
+	*/
+	Size	screenToWindow(const Size& sze) const;
+
+
+	/*!
+	\brief
+		Convert a screen area to a window area, specified in whichever metrics mode is active.
+
+	\param rect
+		Rect object describing the area to be converted
+
+	\return
+		Rect object describing a window area that is equivalent to screen area \a rect.
+	*/
+	Rect	screenToWindow(const Rect& rect) const;
+
+
+    /*!
+    \brief
+        Convert the given X co-ordinate from unified to relative metrics.
+
+    \param val
+        X co-ordinate specified as a UDim relative to this Window (so {0, 0} is this windows left edge).
+
+    \return
+        A relative metric value that is equivalent to \a val, given the Window objects current width.
+    */
+    float unifiedToRelativeX(const UDim& val) const;
+
+
+    /*!
+    \brief
+        Convert the given Y co-ordinate from unified to relative metrics.
+
+    \param val
+        Y co-ordinate specified in as a UDim relative to this Window (so {0, 0} is this windows top edge).
+
+    \return
+        A relative metric value that is equivalent to \a val, given the Window objects current height.
+    */
+    float	unifiedToRelativeY(const UDim& val) const;
+
+
+    /*!
+    \brief
+        Convert the given UVector2 value from unified to relative metrics.
+
+    \param val
+        UVector2 object that describes a position specified in unified dimensions relative to this Window (so {{0, 0}, {0, 0}) is this windows top-left corner).
+
+    \return
+        A Vector2 object describing a relative metric point that is equivalent to \a val, given the Window objects current size.
+    */
+    Vector2 unifiedToRelative(const UVector2& val) const;
+
+
+    /*!
+    \brief
+        Convert the given area from unfied to relative metrics.
+
+    \param val
+        URect object describing the area specified in unified dimensions relative to this Window.
+
+    \return
+        A Rect object describing a relative metric area that is equivalent to \a val, given the Window objects current size.
+    */
+    Rect unifiedToRelative(const URect& val) const;
+
+
+    /*!
+    \brief
+        Convert the given X co-ordinate from unified to absolute metrics.
+
+    \param val
+        X co-ordinate specified as a UDim relative to this Window (so {0, 0} is this windows left edge).
+
+    \return
+        An absolute metric value that is equivalent to \a val, given the Window objects current width.
+    */
+    float unifiedToAbsoluteX(const UDim& val) const;
+
+
+    /*!
+    \brief
+        Convert the given Y co-ordinate from unified to absolute metrics.
+
+    \param val
+        Y co-ordinate specified in as a UDim relative to this Window (so {0, 0} is this windows top edge).
+
+    \return
+        An absolute metric value that is equivalent to \a val, given the Window objects current height.
+    */
+    float	unifiedToAbsoluteY(const UDim& val) const;
+
+
+    /*!
+    \brief
+        Convert the given UVector2 value from unified to absolute metrics.
+
+    \param val
+        UVector2 object that describes a position specified in unified dimensions relative to this Window (so {{0, 0}, {0, 0}) is this windows top-left corner).
+
+    \return
+        A Vector2 object describing a absolute metric point that is equivalent to \a val, given the Window objects current size.
+    */
+    Vector2 unifiedToAbsolute(const UVector2& val) const;
+
+
+    /*!
+    \brief
+        Convert the given area from unfied to absolute metrics.
+
+    \param val
+        URect object describing the area specified in unified dimensions relative to this Window.
+
+    \return
+        A Rect object describing an absolute metric area that is equivalent to \a val, given the Window objects current size.
+    */
+    Rect unifiedToAbsolute(const URect& val) const;
+
+
+    /*!
+    \brief
+        Convert a window co-ordinate value, specified as a UDim, to a screen relative pixel co-ordinate.
+
+    \param x
+        UDim x co-ordinate value to be converted
+
+    \return
+        float value describing a pixel screen co-ordinate that is equivalent to window UDim co-ordinate \a x.
+    */
+    float windowToScreenX(const UDim& x) const;
+
+
+    /*!
+    \brief
+        Convert a window co-ordinate value, specified as a UDim, to a screen relative pixel co-ordinate.
+
+    \param y
+        UDim y co-ordinate value to be converted
+
+    \return
+        float value describing a screen co-ordinate that is equivalent to window UDim co-ordinate \a y.
+    */
+    float windowToScreenY(const UDim& y) const;
+
+
+    /*!
+    \brief
+        Convert a window co-ordinate point, specified as a UVector2, to a screen relative pixel co-ordinate point.
+
+    \param vec
+        UVector2 object describing the point to be converted
+
+    \return
+        Vector2 object describing a screen co-ordinate position that is equivalent to window based UVector2 \a vec.
+    */
+    Vector2 windowToScreen(const UVector2& vec) const;
+
+
+    /*!
+    \brief
+        Convert a window area, specified as a URect, to a screen area.
+
+    \param rect
+        URect object describing the area to be converted
+
+    \return
+        Rect object describing a screen area that is equivalent to window area \a rect.
+    */
+    Rect windowToScreen(const URect& rect) const;
+
+
+    /*!
+    \brief
+        Convert a screen relative UDim co-ordinate value to a window co-ordinate value, specified in whichever metrics mode is active.
+
+    \param x
+        UDim x co-ordinate value to be converted
+
+    \return
+        float value describing a window co-ordinate value that is equivalent to screen UDim co-ordinate \a x.
+    */
+    float screenToWindowX(const UDim& x) const;
+
+
+    /*!
+    \brief
+        Convert a screen relative UDim co-ordinate value to a window co-ordinate value, specified in whichever metrics mode is active.
+
+    \param y
+        UDim y co-ordinate value to be converted
+
+    \return
+        float value describing a window co-ordinate value that is equivalent to screen UDim co-ordinate \a y.
+    */
+    float screenToWindowY(const UDim& y) const;
+
+
+    /*!
+    \brief
+        Convert a screen relative UVector2 point to a window co-ordinate point, specified in whichever metrics mode is active.
+
+    \param vec
+        UVector2 object describing the point to be converted
+
+    \return
+        Vector2 object describing a window co-ordinate point that is equivalent to screen based UVector2 point \a vec.
+    */
+    Vector2 screenToWindow(const UVector2& vec) const;
+
+
+    /*!
+    \brief
+        Convert a URect screen area to a window area, specified in whichever metrics mode is active.
+
+    \param rect
+        URect object describing the area to be converted
+
+    \return
+        Rect object describing a window area that is equivalent to URect screen area \a rect.
+    */
+    Rect screenToWindow(const URect& rect) const;
+
+
+    /*************************************************************************
+        Interface to unified co-ordinate system
+    *************************************************************************/
+    /*!
+    \brief
+        Set the window area.
+
+        Sets the area occupied by this window.  The defined area is offset from the
+        top-left corner of this windows parent window or from the top-left corner of
+        the display if this window has no parent (i.e. it is the root window).
+
+    \note
+        This method makes use of "Unified Dimensions".  These contain both parent relative and
+        absolute pixel components, which are used in determining the final value used.
+
+    \param xpos
+        UDim describing the new x co-ordinate (left edge) of the window area.
+
+    \param ypos
+        UDim describing the new y co-ordinate (top-edge) of the window area.
+
+    \param width
+        UDim describing the new width of the window area.
+
+    \param height
+        UDim describing the new height of the window area.
+     */
+    void setWindowArea(const UDim& xpos, const UDim& ypos, const UDim& width, const UDim& height);
+
+    /*!
+    \brief
+        Set the window area.
+
+        Sets the area occupied by this window.  The defined area is offset from the
+        top-left corner of this windows parent window or from the top-left corner of
+        the display if this window has no parent (i.e. it is the root window).
+
+    \note
+        This method makes use of "Unified Dimensions".  These contain both parent relative and
+        absolute pixel components, which are used in determining the final value used.
+
+    \param pos
+        UVector2 describing the new position (top-left corner) of the window area.
+
+    \param size
+        UVector2 describing the new size of the window area.
+     */
+    void setWindowArea(const UVector2& pos, const UVector2& size);
+
+    /*!
+    \brief
+        Set the window area.
+
+        Sets the area occupied by this window.  The defined area is offset from the
+        top-left corner of this windows parent window or from the top-left corner of
+        the display if this window has no parent (i.e. it is the root window).
+
+    \note
+        This method makes use of "Unified Dimensions".  These contain both parent relative and
+        absolute pixel components, which are used in determining the final value used.
+
+    \param area
+        URect describing the new area rectangle of the window area.
+     */
+    void setWindowArea(const URect& area);
+
+    /*!
+    \brief
+        Set the window's position.
+
+        Sets the position of the area occupied by this window.  The position is offset from the
+        top-left corner of this windows parent window or from the top-left corner of
+        the display if this window has no parent (i.e. it is the root window).
+
+    \note
+        This method makes use of "Unified Dimensions".  These contain both parent relative and
+        absolute pixel components, which are used in determining the final value used.
+
+    \param pos
+        UVector2 describing the new position (top-left corner) of the window area.
+     */
+    void setWindowPosition(const UVector2& pos);
+
+    /*!
+    \brief
+        Set the window's X position.
+
+        Sets the x position (left edge) of the area occupied by this window.  The position is
+        offset from the left edge of this windows parent window or from the left edge of
+        the display if this window has no parent (i.e. it is the root window).
+
+    \note
+        This method makes use of "Unified Dimensions".  These contain both parent relative and
+        absolute pixel components, which are used in determining the final value used.
+
+    \param x
+        UDim describing the new x position of the window area.
+     */
+    void setWindowXPosition(const UDim& x);
+
+    /*!
+    \brief
+        Set the window's Y position.
+
+        Sets the y position (top edge) of the area occupied by this window.  The position is
+        offset from the top edge of this windows parent window or from the top edge of
+        the display if this window has no parent (i.e. it is the root window).
+
+    \note
+        This method makes use of "Unified Dimensions".  These contain both parent relative and
+        absolute pixel components, which are used in determining the final value used.
+
+    \param y
+        UDim describing the new y position of the window area.
+     */
+    void setWindowYPosition(const UDim& y);
+
+    /*!
+    \brief
+        Set the window's size.
+
+        Sets the size of the area occupied by this window.
+
+    \note
+        This method makes use of "Unified Dimensions".  These contain both parent relative and
+        absolute pixel components, which are used in determining the final value used.
+
+    \param size
+        UVector2 describing the new size of the window area.
+     */
+    void setWindowSize(const UVector2& size);
+
+    /*!
+    \brief
+        Set the window's width.
+
+        Sets the width of the area occupied by this window.
+
+    \note
+        This method makes use of "Unified Dimensions".  These contain both parent relative and
+        absolute pixel components, which are used in determining the final value used.
+
+    \param width
+        UDim describing the new width of the window area.
+     */
+    void setWindowWidth(const UDim& width);
+
+    /*!
+    \brief
+        Set the window's height.
+
+        Sets the height of the area occupied by this window.
+
+    \note
+        This method makes use of "Unified Dimensions".  These contain both parent relative and
+        absolute pixel components, which are used in determining the final value used.
+
+    \param height
+        UDim describing the new height of the window area.
+     */
+    void setWindowHeight(const UDim& height);
+
+    /*!
+    \brief
+        Set the window's maximum size.
+
+        Sets the maximum size that this windows area may occupy (whether size changes occur by user
+        interaction, general system operation, or by direct setting by client code).
+
+    \note
+        This method makes use of "Unified Dimensions".  These contain both parent relative and
+        absolute pixel components, which are used in determining the final value used.
+
+    \param size
+        UVector2 describing the new maximum size of the window area.
+     */
+    void setWindowMaxSize(const UVector2& size);
+
+    /*!
+    \brief
+        Set the window's minimum size.
+
+        Sets the minimum size that this windows area may occupy (whether size changes occur by user
+        interaction, general system operation, or by direct setting by client code).
+
+    \note
+        This method makes use of "Unified Dimensions".  These contain both parent relative and
+        absolute pixel components, which are used in determining the final value used.
+
+    \param size
+        UVector2 describing the new minimum size of the window area.
+     */
+    void setWindowMinSize(const UVector2& size);
+
+    /*!
+    \brief
+        Return the windows area.
+
+        Returns the area occupied by this window.  The defined area is offset from the
+        top-left corner of this windows parent window or from the top-left corner of
+        the display if this window has no parent (i.e. it is the root window).
+
+    \note
+        This method makes use of "Unified Dimensions".  These contain both parent relative and
+        absolute pixel components, which are used in determining the final value used.
+
+    \return
+        URect describing the rectangle of the window area.
+     */
+    const URect& getWindowArea() const;
+
+    /*!
+    \brief
+        Get the window's position.
+
+        Gets the position of the area occupied by this window.  The position is offset from the
+        top-left corner of this windows parent window or from the top-left corner of
+        the display if this window has no parent (i.e. it is the root window).
+
+    \note
+        This method makes use of "Unified Dimensions".  These contain both parent relative and
+        absolute pixel components, which are used in determining the final value used.
+
+    \return
+        UVector2 describing the position (top-left corner) of the window area.
+     */
+    const UVector2& getWindowPosition() const;
+
+    /*!
+    \brief
+        Get the window's X position.
+
+        Gets the x position (left edge) of the area occupied by this window.  The position is
+        offset from the left edge of this windows parent window or from the left edge of
+        the display if this window has no parent (i.e. it is the root window).
+
+    \note
+        This method makes use of "Unified Dimensions".  These contain both parent relative and
+        absolute pixel components, which are used in determining the final value used.
+
+    \return
+        UDim describing the x position of the window area.
+     */
+    const UDim& getWindowXPosition() const;
+
+    /*!
+    \brief
+        Get the window's Y position.
+
+        Gets the y position (top edge) of the area occupied by this window.  The position is
+        offset from the top edge of this windows parent window or from the top edge of
+        the display if this window has no parent (i.e. it is the root window).
+
+    \note
+        This method makes use of "Unified Dimensions".  These contain both parent relative and
+        absolute pixel components, which are used in determining the final value used.
+
+    \return
+        UDim describing the y position of the window area.
+     */
+    const UDim& getWindowYPosition() const;
+
+    /*!
+    \brief
+        Get the window's size.
+
+        Gets the size of the area occupied by this window.
+
+    \note
+        This method makes use of "Unified Dimensions".  These contain both parent relative and
+        absolute pixel components, which are used in determining the final value used.
+
+    \return
+        UVector2 describing the size of the window area.
+     */
+    UVector2 getWindowSize() const;
+
+    /*!
+    \brief
+        Get the window's width.
+
+        Gets the width of the area occupied by this window.
+
+    \note
+        This method makes use of "Unified Dimensions".  These contain both parent relative and
+        absolute pixel components, which are used in determining the final value used.
+
+    \return
+        UDim describing the width of the window area.
+     */
+    UDim getWindowWidth() const;
+
+    /*!
+    \brief
+        Get the window's height.
+
+        Gets the height of the area occupied by this window.
+
+    \note
+        This method makes use of "Unified Dimensions".  These contain both parent relative and
+        absolute pixel components, which are used in determining the final value used.
+
+    \return
+        UDim describing the height of the window area.
+     */
+    UDim getWindowHeight() const;
+
+    /*!
+    \brief
+        Get the window's maximum size.
+
+        Gets the maximum size that this windows area may occupy (whether size changes occur by user
+        interaction, general system operation, or by direct setting by client code).
+
+    \note
+        This method makes use of "Unified Dimensions".  These contain both parent relative and
+        absolute pixel components, which are used in determining the final value used.
+
+    \return
+        UVector2 describing the maximum size of the window area.
+     */
+    const UVector2& getWindowMaxSize() const;
+
+    /*!
+    \brief
+        Get the window's minimum size.
+
+        Gets the minimum size that this windows area may occupy (whether size changes occur by user
+        interaction, general system operation, or by direct setting by client code).
+
+    \note
+        This method makes use of "Unified Dimensions".  These contain both parent relative and
+        absolute pixel components, which are used in determining the final value used.
+
+    \return
+        UVector2 describing the minimum size of the window area.
+     */
+    const UVector2& getWindowMinSize() const;
+
+
+	/*************************************************************************
+		Main render function.
+	*************************************************************************/
+	/*!
+	\brief
+		Causes the Window object to render itself and all of it's attached children
+
+	\return
+		Nothing
+	*/
+	void	render(void);
+
+
+	/*!
+	\brief
+		Cause window to update itself and any attached children.  Client code does not need to call this method; to
+		ensure full, and proper updates, call the injectTimePulse methodname method provided by the System class.
+
+	\note
+		The update order is such that 'this' window is updated prior to any child windows, this is so
+		that child windows that access the parent in their update code get the correct updated state.
+
+	\param elapsed
+		float value indicating the number of seconds passed since the last update.
+
+	\return
+		Nothing.
+	*/
+	void	update(float elapsed);
+
+
+    /*!
+    \brief
+        Writes an xml representation of this window object to \a out_stream.
+
+    \param out_stream
+        Stream where xml data should be output.
+
+    \return
+        Nothing.
+    */
+    virtual void writeXMLToStream(OutStream& out_stream) const;
+
+protected:
+	/*************************************************************************
+		System object can trigger events directly
+	*************************************************************************/
+	friend	class System;
+
+
+	/*************************************************************************
+		Event trigger methods
+	*************************************************************************/
+	/*!
+	\brief
+		Handler called when the window's size changes.
+
+	\param e
+		WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event.  For this
+		event the trigger window is always 'this'.
+	*/
+	virtual void	onSized(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the window's position changes.
+
+	\param e
+		WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event.  For this
+		event the trigger window is always 'this'.
+	*/
+	virtual void	onMoved(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the window's text is changed.
+
+	\param e
+		WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event.  For this
+		event the trigger window is always 'this'.
+	*/
+	virtual void	onTextChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the window's font is changed.
+
+	\param e
+		WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event.  For this
+		event the trigger window is always 'this'.
+	*/
+	virtual void	onFontChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the window's alpha blend value is changed.
+
+	\param e
+		WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event.  For this
+		event the trigger window is always 'this'.
+	*/
+	virtual void	onAlphaChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the window's client assigned ID is changed.
+
+	\param e
+		WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event.  For this
+		event the trigger window is always 'this'.
+	*/
+	virtual void	onIDChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the window is shown (made visible).
+
+	\param e
+		WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event.  For this
+		event the trigger window is always 'this'.
+	*/
+	virtual void	onShown(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the window is hidden.
+
+	\param e
+		WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event.  For this
+		event the trigger window is always 'this'.
+	*/
+	virtual void	onHidden(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the window is enabled.
+
+	\param e
+		WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event.  For this
+		event the trigger window is always 'this'.
+	*/
+	virtual void	onEnabled(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the window is disabled.
+
+	\param e
+		WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event.  For this
+		event the trigger window is always 'this'.
+	*/
+	virtual void	onDisabled(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the window's active metrics system is changed.
+
+	\param e
+		WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event.  For this
+		event the trigger window is always 'this'.
+	*/
+	virtual void	onMetricsChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the window's setting for being clipped by it's parent is changed.
+
+	\param e
+		WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event.  For this
+		event the trigger window is always 'this'.
+	*/
+	virtual void	onClippingChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the window's setting for being destroyed automatically be it's parent is changed.
+
+	\param e
+		WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event.  For this
+		event the trigger window is always 'this'.
+	*/
+	virtual void	onParentDestroyChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the window's setting for inheriting alpha-blending is changed.
+
+	\param e
+		WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event.  For this
+		event the trigger window is always 'this'.
+	*/
+	virtual void	onInheritsAlphaChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the window's always-on-top setting is changed.
+
+	\param e
+		WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event.  For this
+		event the trigger window is always 'this'.
+	*/
+	virtual void	onAlwaysOnTopChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when this window gains capture of mouse inputs.
+
+	\param e
+		WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event.  For this
+		event the trigger window is always 'this'.
+	*/
+	virtual void	onCaptureGained(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when this window loses capture of mouse inputs.
+
+	\param e
+		WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event.  For this
+		event the trigger window is always 'this'.
+	*/
+	virtual void	onCaptureLost(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when rendering for this window has started.
+
+	\param e
+		WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event.  For this
+		event the trigger window is always 'this'.
+	*/
+	virtual void	onRenderingStarted(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when rendering for this window has ended.
+
+	\param e
+		WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event.  For this
+		event the trigger window is always 'this'.
+	*/
+	virtual void	onRenderingEnded(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the z-order position of this window has changed.
+
+	\param e
+		WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event.  For this
+		event the trigger window is always 'this'.
+	*/
+	virtual void	onZChanged(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when this window's destruction sequence has begun.
+
+	\param e
+		WindowEventArgs object whose 'window' pointer field is set to the window that triggered the event.  For this
+		event the trigger window is always 'this'.
+	*/
+	virtual void	onDestructionStarted(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when this window has become the active window.
+
+	\param e
+		ActivationEventArgs class whose 'otherWindow' field is set to the window that previously was active, or NULL for none.
+	*/
+	virtual void	onActivated(ActivationEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when this window has lost input focus and has been deactivated.
+
+	\param e
+		ActivationEventArgs object whose 'otherWindow' field is set to the window that has now become active, or NULL for none.
+	*/
+	virtual void	onDeactivated(ActivationEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when this window's parent window has been resized.  If this window is the root / GUI Sheet
+		window, this call will be made when the screen size changes.
+
+	\param e
+		WindowEventArgs object whose 'window' pointer field is set the the window that caused the event; this is typically either
+		this window's parent window, or NULL to indicate the screen size has changed.
+	*/
+	virtual void	onParentSized(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when a child window is added to this window.
+
+	\param e
+		WindowEventArgs object whose 'window' pointer field is set to the window that has been added.
+	*/
+	virtual void	onChildAdded(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when a child window is removed from this window.
+
+	\param e
+		WindowEventArgs object whose 'window' pointer field is set the window that has been removed.
+	*/
+	virtual void	onChildRemoved(WindowEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the mouse cursor has entered this window's area.
+
+	\param e
+		MouseEventArgs object.  All fields are valid.
+	*/
+	virtual void	onMouseEnters(MouseEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the mouse cursor has left this window's area.
+
+	\param e
+		MouseEventArgs object.  All fields are valid.
+	*/
+	virtual void	onMouseLeaves(MouseEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the mouse cursor has been moved within this window's area.
+
+	\param e
+		MouseEventArgs object.  All fields are valid.
+	*/
+	virtual void	onMouseMove(MouseEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when the mouse wheel (z-axis) position changes within this window's area.
+
+	\param e
+		MouseEventArgs object.  All fields are valid.
+	*/
+	virtual void	onMouseWheel(MouseEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when a mouse button has been depressed within this window's area.
+
+	\param e
+		MouseEventArgs object.  All fields are valid.
+	*/
+	virtual void	onMouseButtonDown(MouseEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when a mouse button has been released within this window's area.
+
+	\param e
+		MouseEventArgs object.  All fields are valid.
+	*/
+	virtual void	onMouseButtonUp(MouseEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when a mouse button has been clicked (that is depressed and then released, within a specified time)
+		within this window's area.
+
+	\param e
+		MouseEventArgs object.  All fields are valid.
+	*/
+	virtual void	onMouseClicked(MouseEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when a mouse button has been double-clicked within this window's area.
+
+	\param e
+		MouseEventArgs object.  All fields are valid.
+	*/
+	virtual void	onMouseDoubleClicked(MouseEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when a mouse button has been triple-clicked within this window's area.
+
+	\param e
+		MouseEventArgs object.  All fields are valid.
+	*/
+	virtual void	onMouseTripleClicked(MouseEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when a key as been depressed while this window has input focus.
+
+	\param e
+		KeyEventArgs object whose 'scancode' field is set to the Key::Scan value representing the key that was pressed, and whose
+		'sysKeys' field represents the combination of SystemKey that were active when the event was generated.
+	*/
+	virtual void	onKeyDown(KeyEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when a key as been released while this window has input focus.
+
+	\param e
+		KeyEventArgs object whose 'scancode' field is set to the Key::Scan value representing the key that was released, and whose
+		'sysKeys' field represents the combination of SystemKey that were active when the event was generated.  All other fields should be
+		considered as 'junk'.
+	*/
+	virtual void	onKeyUp(KeyEventArgs& e);
+
+
+	/*!
+	\brief
+		Handler called when a character-key has been pressed while this window has input focus.
+
+	\param e
+		KeyEventArgs object whose 'codepoint' field is set to the Unicode code point (encoded as utf32) for the character typed, and whose
+		'sysKeys' field represents the combination of SystemKey that were active when the event was generated.  All other fields should be
+		considered as 'junk'.
+	*/
+	virtual void	onCharacter(KeyEventArgs& e);
+
+    /*!
+    \brief
+        Handler called when a DragContainer is dragged over this window.
+
+    \param e
+        DragDropEventArgs object initialised as follows:
+        - window field is normaly set to point to 'this' window.
+        - dragDropItem is a pointer to a DragContainer window that triggered the event.
+    */
+    virtual void    onDragDropItemEnters(DragDropEventArgs& e);
+
+
+    /*!
+    \brief
+        Handler called when a DragContainer is dragged over this window.
+
+    \param e
+        DragDropEventArgs object initialised as follows:
+        - window field is normaly set to point to 'this' window.
+        - dragDropItem is a pointer to a DragContainer window that triggered the event.
+    */
+    virtual void    onDragDropItemLeaves(DragDropEventArgs& e);
+
+
+    /*!
+    \brief
+        Handler called when a DragContainer is dragged over this window.
+
+    \param e
+        DragDropEventArgs object initialised as follows:
+        - window field is normaly set to point to 'this' window.
+        - dragDropItem is a pointer to a DragContainer window that triggered the event.
+    */
+    virtual void    onDragDropItemDropped(DragDropEventArgs& e);
+
+
+    /*!
+    \brief
+        Handler called when the vertical alignment setting for the window is changed.
+
+    \param e
+        WindowEventArgs object initialised as follows:
+        - window field is set to point to the Window object whos alignment has changed (typically 'this').
+    */
+    virtual void    onVerticalAlignmentChanged(WindowEventArgs& e);
+
+
+    /*!
+    \brief
+        Handler called when the horizontal alignment setting for the window is changed.
+
+    \param e
+        WindowEventArgs object initialised as follows:
+        - window field is set to point to the Window object whos alignment has changed (typically 'this').
+    */
+    virtual void    onHorizontalAlignmentChanged(WindowEventArgs& e);
+
+
+	/*************************************************************************
+		Implementation Functions
+	*************************************************************************/
+	/*!
+	\brief
+		Perform actual update processing for this Window.
+
+	\param elapsed
+		float value indicating the number of seconds elapsed since the last update call.
+
+	\return
+		Nothing.
+	*/
+	virtual void	updateSelf(float elapsed);
+
+
+	/*!
+	\brief
+		Perform the actual rendering for this Window.
+
+	\param z
+		float value specifying the base Z co-ordinate that should be used when rendering
+
+	\return
+		Nothing
+	*/
+	virtual	void	drawSelf(float z);
+
+
+	/*!
+	\brief
+	   Update the rendering cache.
+
+	   Populates the Window's RenderCache with imagery to be sent to the renderer.
+    */
+    virtual void populateRenderCache()  {}
+
+
+	/*!
+	\brief
+		Return whether this window was inherited from the given class name at some point in the inheritance heirarchy.
+
+	\param class_name
+		The class name that is to be checked.
+
+	\return
+		true if this window was inherited from \a class_name. false if not.
+	*/
+	virtual bool	testClassName_impl(const String& class_name) const
+	{
+		if (class_name==(const utf8*)"Window")	return true;
+		return false;
+	}
+
+
+	/*!
+	\brief
+		Set the parent window for this window object.
+
+	\param parent
+		Pointer to a Window object that is to be assigned as the parent to this Window.
+
+	\return
+		Nothing
+	*/
+	void	setParent(Window* parent);
+
+
+	/*!
+	\brief
+		Return the pixel Width of the parent element.  This always returns a valid number.
+
+	\return
+		float value that is equal to the pixel width of this Window objects parent
+	*/
+	float	getParentWidth(void) const;
+
+
+	/*!
+	\brief
+		Return the pixel Height of the parent element.  This always returns a valid number.
+
+	\return
+		float value that is equal to the pixel height of this Window objects parent
+	*/
+	float	getParentHeight(void) const;
+
+
+	/*!
+	\brief
+		Return the pixel size of the parent element.  This always returns a valid object.
+
+	\return
+		Size object that describes the pixel dimensions of this Window objects parent
+	*/
+	Size	getParentSize(void) const;
+
+
+	/*!
+	\brief
+		Return a Rect object that describes, in values relative to \a window, the absolute area described by \a rect.
+
+	\param window
+		Pointer to a window object that is to be used as the base for the conversion.  If this is NULL then the size of the
+		display, as returned by the renderer object, is used.
+
+	\param rect
+		Rect object describing the area, in absolute values, that is to be returned as relative values.
+
+	\return
+		Rect object that describes in values relative to \a window, the same area described as absolute values in \a rect.
+	*/
+	Rect	absoluteToRelative_impl(const Window* window, const Rect& rect) const;
+	Size	absoluteToRelative_impl(const Window* window, const Size& sz) const;
+	Point	absoluteToRelative_impl(const Window* window, const Point& pt) const;
+	float	absoluteToRelativeX_impl(const Window* window, float x) const;
+	float	absoluteToRelativeY_impl(const Window* window, float y) const;
+
+
+	/*!
+	\brief
+		Return a Rect object that describes, in absolute values offset from \a window, the relative area described by \a rect.
+
+	\param window
+		Pointer to a window object that is to be used as the base for the conversion.  If this is NULL then the size of the
+		display, as returned by the renderer object, is used.
+
+	\param rect
+		Rect object describing the area, in relative values, that is to be returned as absolute values.
+
+	\return
+		Rect object that describes in absolute values offset from \a window, the same area described as relative values in \a rect.
+	*/
+	Rect	relativeToAbsolute_impl(const Window* window, const Rect& rect) const;
+	Size	relativeToAbsolute_impl(const Window* window, const Size& sz) const;
+	Point	relativeToAbsolute_impl(const Window* window, const Point& pt) const;
+	float	relativeToAbsoluteX_impl(const Window* window, float x) const;
+	float	relativeToAbsoluteY_impl(const Window* window, float y) const;
+
+	Size	getWindowSize_impl(const Window* window) const;
+
+
+	/*!
+	\brief
+		Return the inherited metrics mode.  This is either the metrics mode of our parent, or Relative
+		if we have no parent.
+	*/
+	MetricsMode getInheritedMetricsMode(void) const;
+
+
+    /*!
+    \brief
+        Fires off a repeated mouse button down event for this window.
+    */
+    void    generateAutoRepeatEvent(MouseButton button);
+
+
+	/*************************************************************************
+		Implementation Data
+	*************************************************************************/
+	// child stuff
+	typedef	std::vector<Window*>	ChildList;
+	ChildList		d_children;			//!< The list of child Window objects attached to this.
+    ChildList       d_drawList;         //!< Child window objects arranged in rendering order.
+
+	// general data
+	MetricsMode		d_metricsMode;		//!< Holds the active metrics mode for this window
+	static Window*	d_captureWindow;	//!< Window that has captured inputs
+	Window*			d_oldCapture;		//!< The Window that previously had capture (used for restoreOldCapture mode)
+	Window*			d_parent;			//!< Holds pointer to the parent window.
+	const Font*		d_font;				//!< Holds pointer to the Window objects current Font.
+	String			d_text;				//!< Holds the text / label / caption for this Window.
+	uint			d_ID;				//!< User ID assigned to this Window
+	float			d_alpha;			//!< Alpha transparency setting for the Window
+    URect			d_area;             //!< This Window objects area as defined by a URect.
+    Size            d_pixelSize;        //!< Current constrained pixel size of the window.
+	const Image*	d_mouseCursor;		//!< Holds pointer to the Window objects current mouse cursor image.
+	void*			d_userData;			//!< Holds pointer to some user assigned data.
+
+	typedef std::map<String, String>   UserStringMap;
+	UserStringMap  d_userStrings;      //!< Holds a collection of named user string values.
+
+    // positional alignments
+    HorizontalAlignment d_horzAlign;    //!< Specifies the base for horizontal alignment.
+    VerticalAlignment   d_vertAlign;    //!< Specifies the base for vertical alignment.
+
+	// maximum and minimum sizes
+	UVector2       d_minSize;          //!< current minimum size for the window.
+	UVector2       d_maxSize;          //!< current maximum size for the window.
+
+	// settings
+	bool	d_enabled;					//!< true when Window is enabled
+	bool	d_visible;					//!< true when Window is visible (that is it will be rendered, but may be obscured so no necesarily really visible)
+	bool	d_active;					//!< true when Window is the active Window (receiving inputs).
+	bool	d_clippedByParent;			//!< true when Window will be clipped by parent Window area Rect.
+	bool	d_destroyedByParent;		//!< true when Window will be auto-destroyed by parent.
+	bool	d_alwaysOnTop;				//!< true if Window will be drawn on top of all other Windows
+	bool	d_inheritsAlpha;			//!< true if the Window inherits alpha from the parent Window
+	bool	d_restoreOldCapture;		//!< true if the Window restores capture to the previous window when it releases capture.
+	bool	d_zOrderingEnabled;			//!< true if the Window responds to z-order change requests.
+    bool    d_wantsMultiClicks;         //!< true if the Window wishes to hear about multi-click mouse events.
+    bool    d_distCapturedInputs;       //!< true if unhandled captured inputs should be distributed to child windows.
+    bool    d_riseOnClick;              //!< True if the window should come to the front of the z order in respose to a left mouse button down event.
+
+    // mouse button autorepeat data
+    bool    d_autoRepeat;       //!< true if button will auto-repeat mouse button down events while mouse button is held down,
+    float   d_repeatDelay;      //!< seconds before first repeat event is fired
+    float   d_repeatRate;       //!< secons between further repeats after delay has expired.
+    bool    d_repeating;        //!< implements repeating - is true after delay has elapsed,
+    float   d_repeatElapsed;    //!< implements repeating - tracks time elapsed.
+    MouseButton d_repeatButton; //!< Button we're tracking (implication of this is that we only support one button at a time).
+
+    // Tooltip stuff
+    String   d_tooltipText;     //!< Text string used as tip for this window.
+    Tooltip* d_customTip;       //!< Possible custom Tooltip for this window.
+    bool     d_weOwnTip;        //!< true if this Window created the custom Tooltip.
+    bool     d_inheritsTipText; //!< true if the Window inherits tooltip text from its parent (when none set for itself).
+
+    // rendering
+    RenderCache d_renderCache;  //!< Object which acts as a cache for Images to be drawn by this Window.
+    mutable bool d_needsRedraw;      //!< true if window image cache needs to be regenerated.
+
+    // Look'N'Feel stuff
+    String  d_lookName;         //!< Name of the Look assigned to this window (if any).
+
+    // Event pass through
+    bool    d_mousePassThroughEnabled;  //!< true if this window can never be "hit" by the cursor. false for normal mouse event handling.
+
+protected:
+	/*************************************************************************
+		Properties for Window base class
+	*************************************************************************/
+	static	WindowProperties::AbsoluteHeight	d_absHeightProperty;
+	static	WindowProperties::AbsoluteMaxSize	d_absMaxSizeProperty;
+	static	WindowProperties::AbsoluteMinSize	d_absMinSizeProperty;
+	static	WindowProperties::AbsolutePosition	d_absPositionProperty;
+	static	WindowProperties::AbsoluteRect		d_absRectProperty;
+	static	WindowProperties::AbsoluteSize		d_absSizeProperty;
+	static	WindowProperties::AbsoluteWidth		d_absWidthProperty;
+	static	WindowProperties::AbsoluteXPosition	d_absXPosProperty;
+	static	WindowProperties::AbsoluteYPosition	d_absYPosProperty;
+	static	WindowProperties::Alpha				d_alphaProperty;
+	static	WindowProperties::AlwaysOnTop		d_alwaysOnTopProperty;
+	static	WindowProperties::ClippedByParent	d_clippedByParentProperty;
+	static	WindowProperties::DestroyedByParent	d_destroyedByParentProperty;
+	static	WindowProperties::Disabled			d_disabledProperty;
+	static	WindowProperties::Font				d_fontProperty;
+	static	WindowProperties::Height			d_heightProperty;
+	static	WindowProperties::ID				d_IDProperty;
+	static	WindowProperties::InheritsAlpha		d_inheritsAlphaProperty;
+	static	WindowProperties::MetricsMode		d_metricsModeProperty;
+	static	WindowProperties::MouseCursorImage	d_mouseCursorProperty;
+	static	WindowProperties::Position			d_positionProperty;
+	static	WindowProperties::Rect				d_rectProperty;
+	static	WindowProperties::RelativeHeight	d_relHeightProperty;
+	static	WindowProperties::RelativeMaxSize	d_relMaxSizeProperty;
+	static	WindowProperties::RelativeMinSize	d_relMinSizeProperty;
+	static	WindowProperties::RelativePosition	d_relPositionProperty;
+	static	WindowProperties::RelativeRect		d_relRectProperty;
+	static	WindowProperties::RelativeSize		d_relSizeProperty;
+	static	WindowProperties::RelativeWidth		d_relWidthProperty;
+	static	WindowProperties::RelativeXPosition	d_relXPosProperty;
+	static	WindowProperties::RelativeYPosition	d_relYPosProperty;
+	static	WindowProperties::RestoreOldCapture	d_restoreOldCaptureProperty;
+	static	WindowProperties::Size				d_sizeProperty;
+	static	WindowProperties::Text				d_textProperty;
+	static	WindowProperties::Visible			d_visibleProperty;
+	static	WindowProperties::Width				d_widthProperty;
+	static	WindowProperties::XPosition			d_xPosProperty;
+	static	WindowProperties::YPosition			d_yPosProperty;
+	static	WindowProperties::ZOrderChangeEnabled	d_zOrderChangeProperty;
+    static  WindowProperties::WantsMultiClickEvents d_wantsMultiClicksProperty;
+    static  WindowProperties::MouseButtonDownAutoRepeat d_autoRepeatProperty;
+    static  WindowProperties::AutoRepeatDelay   d_autoRepeatDelayProperty;
+    static  WindowProperties::AutoRepeatRate    d_autoRepeatRateProperty;
+    static  WindowProperties::DistributeCapturedInputs d_distInputsProperty;
+    static  WindowProperties::CustomTooltipType d_tooltipTypeProperty;
+    static  WindowProperties::Tooltip           d_tooltipProperty;
+    static  WindowProperties::InheritsTooltipText d_inheritsTooltipProperty;
+    static  WindowProperties::RiseOnClick       d_riseOnClickProperty;
+    static  WindowProperties::VerticalAlignment   d_vertAlignProperty;
+    static  WindowProperties::HorizontalAlignment d_horzAlignProperty;
+    static	WindowProperties::UnifiedAreaRect	d_unifiedAreaRectProperty;
+    static	WindowProperties::UnifiedPosition	d_unifiedPositionProperty;
+    static	WindowProperties::UnifiedXPosition	d_unifiedXPositionProperty;
+    static	WindowProperties::UnifiedYPosition	d_unifiedYPositionProperty;
+    static	WindowProperties::UnifiedSize		d_unifiedSizeProperty;
+    static	WindowProperties::UnifiedWidth		d_unifiedWidthProperty;
+    static	WindowProperties::UnifiedHeight		d_unifiedHeightProperty;
+    static	WindowProperties::UnifiedMinSize	d_unifiedMinSizeProperty;
+    static	WindowProperties::UnifiedMaxSize	d_unifiedMaxSizeProperty;
+    static  WindowProperties::MousePassThroughEnabled   d_mousePassThroughEnabledProperty;
+
+
+	/*************************************************************************
+		implementation functions
+	*************************************************************************/
+	/*!
+	\brief
+		Add standard CEGUI::Window events
+	*/
+	void	addStandardEvents(void);
+
+	/*!
+	\brief
+		Cleanup child windows
+	*/
+	virtual void	cleanupChildren(void);
+
+	/*!
+	\brief
+		Add given window to child list at an appropriate position
+	*/
+	virtual void	addChild_impl(Window* wnd);
+
+	/*!
+	\brief
+		Remove given window from child list
+	*/
+	virtual void	removeChild_impl(Window* wnd);
+
+	/*!
+	\brief
+		Notify 'this' and all siblings of a ZOrder change event
+	*/
+	virtual void	onZChange_impl(void);
+
+
+	/*!
+	\brief
+		Add standard CEGUI::Window properties.
+	*/
+	void	addStandardProperties(void);
+
+
+    /*!
+    \brief
+        Implements move to fron behavior.
+     */
+    virtual void moveToFront_impl(bool wasClicked);
+
+
+    /*!
+    \brief
+        Implementation of rise on click functionality.
+     */
+    void doRiseOnClick(void);
+
+
+    /*!
+    \brief
+        Implementation method to modify window area while correctly applying min / max size processing, and
+        firing any appropriate events.
+
+    /note
+        This is the implementation function for setting size and position.
+        In order to simplify area management, from this point on, all modifications to window size and
+        position (area rect) should come through here.
+
+    /param pos
+        UVector2 object describing the new area position.
+
+    /param size
+        UVector2 object describing the new area size.
+
+    /param topLeftSizing
+        - true to indicate the the operation is a sizing operation on the top and/or left edges of the area,
+            and so window movement should be inhibited if size is at max or min.
+        - false to indicate the operation is not a strict sizing operation on the top and/or left edges and
+            that the window position may change as required
+
+    /param fireEvents
+        - true if events should be fired as normal.
+        - false to inhibit firing of events (required, for example, if you need to call this from
+            the onSize/onMove handlers).
+     */
+    void setWindowArea_impl(const UVector2& pos, const UVector2& size, bool topLeftSizing = false, bool fireEvents = true);
+
+    /*!
+    \brief
+        Add the given window to the drawing list at an appropriate position for it's settings and the
+        required direction.  Basically, when \a at_back is false, the window will appear in front of
+        all other windows with the same 'always on top' setting.  When \a at_back is true, the window
+        will appear behind all other windows wih the same 'always on top' setting.
+
+    \param wnd
+        Window object to be added to the drawing list.
+
+    \param at_back
+        Indicates whether the window should be placed at the back of other windows in the same group.
+        If this is false, the window is place in front of other windows in the group.
+
+    \return
+        Nothing.
+    */
+    void addWindowToDrawList(Window& wnd, bool at_back = false);
+
+    /*!
+    \brief
+        Removes the window from the drawing list.  If the window is not attached to the drawing list
+        then nothing happens.
+
+    \param wnd
+        Window object to be removed from the drawing list.
+
+    \return
+        Nothing.
+    */
+    void removeWindowFromDrawList(const Window& wnd);
+
+    virtual int writePropertiesXML(OutStream& out_stream) const;
+    virtual int writeChildWindowsXML(OutStream& out_stream) const;
+
+	/*************************************************************************
+		May not copy or assign Window objects
+	*************************************************************************/
+	Window(const Window& wnd) : PropertySet(), EventSet() {}
+	Window& operator=(const Window& wnd) {return *this;}
+
+	/*************************************************************************
+		Private implementation Data
+	*************************************************************************/
+	const String	d_type;			//!< String holding the type name for the Window (is also the name of the WindowFactory that created us)
+	String	d_name;					//!< The name of the window (GUI system unique).
+	String    d_falagardType;       //!< Type name of the window as defined in a Falagard mapping.
+};
+
+} // End of  CEGUI namespace section
+
+
+#if defined(_MSC_VER)
+#	pragma warning(pop)
+#endif
+
+#endif	// end of guard _CEGUIWindow_h_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreBillboard.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreBillboard.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreBillboard.h	(revision 1812)
@@ -0,0 +1,213 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __Billboard_H__
+#define __Billboard_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreVector3.h"
+#include "OgreColourValue.h"
+#include "OgreCommon.h"
+
+namespace Ogre {
+
+    /** 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
+    {
+        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 irresective 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 width, 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 return true.
+        */
+        const FloatRect& getTexcoordRect(void) const { return mTexcoordRect; }
+    };
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreScriptLoader.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreScriptLoader.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreScriptLoader.h	(revision 1812)
@@ -0,0 +1,85 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __ScriptLoader_H__
+#define __ScriptLoader_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreDataStream.h"
+#include "OgreStringVector.h"
+
+namespace Ogre {
+
+	/** 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.
+		@returns
+			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. 
+		@returns 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;
+
+	};
+
+
+}
+
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/ExampleRefAppFrameListener.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/ExampleRefAppFrameListener.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/ExampleRefAppFrameListener.h	(revision 1812)
@@ -0,0 +1,386 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+You may use this sample code for anything you like, it is not covered by the
+LGPL like the rest of the engine.
+-----------------------------------------------------------------------------
+*/
+
+/*
+-----------------------------------------------------------------------------
+Filename:    ExampleFrameListener.h
+Description: Defines an example frame listener which responds to frame events.
+             This frame listener just moves a specified camera around based on
+             keyboard and mouse movements.
+             Mouse:    Freelook
+             W or Up:  Forward
+             S or Down:Backward
+             A:           Step left
+             D:        Step right
+             PgUp:     Move upwards
+             PgDown:   Move downwards
+             O/P:       Yaw the root scene node (and it's children)
+             I/K:       Pitch the root scene node (and it's children)
+             F:           Toggle frame rate stats on/off
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __ExampleRefAppFrameListener_H__
+#define __ExampleRefAppFrameListener_H__
+
+#include "OgreReferenceAppLayer.h"
+#include "OgreKeyEvent.h"
+#include "OgreEventListeners.h"
+#include "OgreException.h"
+
+using namespace Ogre;
+using namespace OgreRefApp;
+
+class ExampleRefAppFrameListener: public FrameListener, public KeyListener
+{
+private:
+    void updateStats(void)
+    {
+        static String currFps = "Current FPS: ";
+        static String avgFps = "Average FPS: ";
+        static String bestFps = "Best FPS: ";
+        static String worstFps = "Worst FPS: ";
+        static String tris = "Triangle Count: ";
+
+        // update stats when necessary
+        OverlayElement* guiAvg = OverlayManager::getSingleton().getOverlayElement("Core/AverageFps");
+        OverlayElement* guiCurr = OverlayManager::getSingleton().getOverlayElement("Core/CurrFps");
+        OverlayElement* guiBest = OverlayManager::getSingleton().getOverlayElement("Core/BestFps");
+        OverlayElement* guiWorst = OverlayManager::getSingleton().getOverlayElement("Core/WorstFps");
+        
+        guiAvg->setCaption(avgFps + StringConverter::toString(mWindow->getAverageFPS()));
+        guiCurr->setCaption(currFps + StringConverter::toString(mWindow->getLastFPS()));
+        guiBest->setCaption(bestFps + StringConverter::toString(mWindow->getBestFPS())
+            +" "+StringConverter::toString(mWindow->getBestFrameTime())+" ms");
+        guiWorst->setCaption(worstFps + StringConverter::toString(mWindow->getWorstFPS())
+            +" "+StringConverter::toString(mWindow->getWorstFrameTime())+" ms");
+            
+        OverlayElement* guiTris = OverlayManager::getSingleton().getOverlayElement("Core/NumTris");
+        guiTris->setCaption(tris + StringConverter::toString(mWindow->getTriangleCount()));
+
+        OverlayElement* guiDbg = OverlayManager::getSingleton().getOverlayElement("Core/DebugText");
+        guiDbg->setCaption(mWindow->getDebugText());
+    }
+    
+public:
+    // Constructor takes a RenderWindow because it uses that to determine input context
+    ExampleRefAppFrameListener(RenderWindow* win, CollideCamera* cam, bool useBufferedInputKeys = false, bool useBufferedInputMouse = false)
+    {
+        mUseBufferedInputKeys = useBufferedInputKeys;
+		mUseBufferedInputMouse = useBufferedInputMouse;
+		mInputTypeSwitchingOn = mUseBufferedInputKeys || mUseBufferedInputMouse;
+
+		if (mInputTypeSwitchingOn)
+		{
+            mEventProcessor = new EventProcessor();
+			mEventProcessor->initialise(win);
+			mEventProcessor->startProcessingEvents();
+			mEventProcessor->addKeyListener(this);
+			mInputDevice = mEventProcessor->getInputReader();
+
+		}
+        else
+        {
+            mInputDevice = PlatformManager::getSingleton().createInputReader();
+            mInputDevice->initialise(win,true, true);
+        }
+        mCamera = cam;
+        mWindow = win;
+        mStatsOn = true;
+		mNumScreenShots = 0;
+		mTimeUntilNextToggle = 0;
+
+        showDebugOverlay(true);
+    }
+    virtual ~ExampleRefAppFrameListener()
+    {
+		if (mInputTypeSwitchingOn)
+		{
+            delete mEventProcessor;
+		}
+        else
+        {
+            PlatformManager::getSingleton().destroyInputReader( mInputDevice );
+        }
+    }
+
+    bool processUnbufferedKeyInput(const FrameEvent& evt)
+    {
+        if (mInputDevice->isKeyDown(KC_A))
+        {
+            // Move camera left
+            mTranslateVector.x = -mMoveScale;
+        }
+
+        if (mInputDevice->isKeyDown(KC_D))
+        {
+            // Move camera RIGHT
+            mTranslateVector.x = mMoveScale;
+        }
+
+        /* Move camera forward by keypress. */
+        if (mInputDevice->isKeyDown(KC_UP) || mInputDevice->isKeyDown(KC_W) )
+        {
+            mTranslateVector.z = -mMoveScale;
+        }
+        /* Move camera forward by mousewheel. */
+        if( mInputDevice->getMouseRelativeZ() > 0 )
+        {
+            mTranslateVector.z = -mMoveScale * 8.0;
+        }
+
+        /* Move camera backward by keypress. */
+        if (mInputDevice->isKeyDown(KC_DOWN) || mInputDevice->isKeyDown(KC_S) )
+        {
+            mTranslateVector.z = mMoveScale;
+        }
+
+        /* Move camera backward by mouse wheel. */
+        if( mInputDevice->getMouseRelativeZ() < 0 )
+        {
+            mTranslateVector.z = mMoveScale * 8.0;
+        }
+
+        if (mInputDevice->isKeyDown(KC_PGUP))
+        {
+            // Move camera up
+            mTranslateVector.y = mMoveScale;
+        }
+
+        if (mInputDevice->isKeyDown(KC_PGDOWN))
+        {
+            // Move camera down
+            mTranslateVector.y = -mMoveScale;
+        }
+
+        if (mInputDevice->isKeyDown(KC_RIGHT))
+        {
+            mCamera->yaw(-mRotScale);
+        }
+		
+        if (mInputDevice->isKeyDown(KC_LEFT))
+        {
+            mCamera->yaw(mRotScale);
+        }
+
+        if( mInputDevice->isKeyDown( KC_ESCAPE) )
+        {            
+            return false;
+        }
+
+		// see if switching is on, and you want to toggle 
+        if (mInputTypeSwitchingOn && mInputDevice->isKeyDown(KC_M) && mTimeUntilNextToggle <= 0)
+        {
+			switchMouseMode();
+            mTimeUntilNextToggle = 1;
+        }
+
+        if (mInputTypeSwitchingOn && mInputDevice->isKeyDown(KC_K) && mTimeUntilNextToggle <= 0)
+        {
+			// must be going from immediate keyboard to buffered keyboard
+			switchKeyMode();
+            mTimeUntilNextToggle = 1;
+        }
+        if (mInputDevice->isKeyDown(KC_F) && mTimeUntilNextToggle <= 0)
+        {
+            mStatsOn = !mStatsOn;
+            showDebugOverlay(mStatsOn);
+
+            mTimeUntilNextToggle = 1;
+        }
+
+        if (mInputDevice->isKeyDown(KC_SYSRQ) && mTimeUntilNextToggle <= 0)
+        {
+			StringUtil::StrStreamType tmp;
+			tmp << "screenshot_" << ++mNumScreenShots << ".png";
+            mWindow->writeContentsToFile(tmp.str());
+            mTimeUntilNextToggle = 0.5;
+			mWindow->setDebugText(String("Wrote ") + tmp.str());
+        }
+
+
+
+        // Return true to continue rendering
+        return true;
+    }
+
+    bool processUnbufferedMouseInput(const FrameEvent& evt)
+    {
+        /* Rotation factors, may not be used if the second mouse button is pressed. */
+
+        /* If the second mouse button is pressed, then the mouse movement results in 
+           sliding the camera, otherwise we rotate. */
+        if( mInputDevice->getMouseButton( 1 ) )
+        {
+            mTranslateVector.x += mInputDevice->getMouseRelativeX() * 0.13;
+            mTranslateVector.y -= mInputDevice->getMouseRelativeY() * 0.13;
+        }
+        else
+        {
+            mRotX = Degree(-mInputDevice->getMouseRelativeX() * 0.13);
+            mRotY = Degree(-mInputDevice->getMouseRelativeY() * 0.13);
+        }
+
+
+		return true;
+	}
+
+	void moveCamera()
+	{
+
+        // Make all the changes to the camera
+        // Note that YAW direction is around a fixed axis (freelook style) rather than a natural YAW (e.g. airplane)
+        mCamera->yaw(mRotX);
+        mCamera->pitch(mRotY);
+        mCamera->translate(mTranslateVector);
+
+
+	}
+
+    void showDebugOverlay(bool show)
+    {   
+        Overlay* o = OverlayManager::getSingleton().getByName("Core/DebugOverlay");
+        if (!o)
+            OGRE_EXCEPT( Exception::ERR_ITEM_NOT_FOUND, "Could not find overlay Core/DebugOverlay",
+                "showDebugOverlay" );
+        if (show)
+        {
+            o->show();
+        }
+        else
+        {
+            o->hide();
+        }
+    }
+
+    // Override frameEnded event 
+    bool frameEnded(const FrameEvent& evt)
+    {
+
+        if (!mInputTypeSwitchingOn)
+    	{
+            mInputDevice->capture();
+        }
+
+
+		if ( !mUseBufferedInputMouse || !mUseBufferedInputKeys)
+		{
+			// one of the input modes is immediate, so setup what is needed for immediate mouse/key movement
+			if (mTimeUntilNextToggle >= 0) 
+				mTimeUntilNextToggle -= evt.timeSinceLastFrame;
+
+			// If this is the first frame, pick a speed
+			if (evt.timeSinceLastFrame == 0)
+			{
+				mMoveScale = 0.5;
+				mRotScale = 0.1;
+			}
+			// Otherwise scale movement units by time passed since last frame
+			else
+			{
+				// Move about 50 units per second,
+				mMoveScale = 50.0 * evt.timeSinceLastFrame;
+				// Take about 10 seconds for full rotation
+				mRotScale = Degree(36 * evt.timeSinceLastFrame);
+			}
+			mRotX = 0;
+            mRotY = 0;
+	        mTranslateVector = Vector3::ZERO;
+		}
+
+        if (mUseBufferedInputKeys)
+        {
+            // no need to do any processing here, it is handled by event processor and 
+			// you get the results as KeyEvents
+        }
+        else
+        {
+            if (processUnbufferedKeyInput(evt) == false)
+			{
+				return false;
+			}
+        }
+        if (mUseBufferedInputMouse)
+        {
+            // no need to do any processing here, it is handled by event processor and 
+			// you get the results as MouseEvents
+        }
+        else
+        {
+            if (processUnbufferedMouseInput(evt) == false)
+			{
+				return false;
+			}
+        }
+
+		if ( !mUseBufferedInputMouse || !mUseBufferedInputKeys)
+		{
+			// one of the input modes is immediate, so update the movement vector
+
+			moveCamera();
+
+		}
+
+        // Perform simulation step
+        World::getSingleton().simulationStep(evt.timeSinceLastFrame);
+
+        updateStats();
+		return true;
+    }
+
+	void switchMouseMode() 
+	{
+        mUseBufferedInputMouse = !mUseBufferedInputMouse;
+		mInputDevice->setBufferedInput(mUseBufferedInputKeys, mUseBufferedInputMouse);
+	}
+	void switchKeyMode() 
+	{
+        mUseBufferedInputKeys = !mUseBufferedInputKeys;
+		mInputDevice->setBufferedInput(mUseBufferedInputKeys, mUseBufferedInputMouse);
+	}
+
+	void keyClicked(KeyEvent* e) 
+	{
+		if (e->getKeyChar() == 'm')
+		{
+			switchMouseMode();
+		}
+		else if (e->getKeyChar() == 'k')
+		{
+
+			switchKeyMode();
+		}
+
+	}
+	void keyPressed(KeyEvent* e) {}
+	void keyReleased(KeyEvent* e) {}
+
+protected:
+    EventProcessor* mEventProcessor;
+    InputReader* mInputDevice;
+    CollideCamera* mCamera;
+    Vector3 mTranslateVector;
+    RenderWindow* mWindow;
+    bool mStatsOn;
+    bool mUseBufferedInputKeys, mUseBufferedInputMouse, mInputTypeSwitchingOn;
+	unsigned int mNumScreenShots;
+    float mMoveScale;
+    Radian mRotScale;
+    // just to stop toggles flipping too fast
+    Real mTimeUntilNextToggle ;
+    Radian mRotX, mRotY;
+
+};
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreKeyTarget.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreKeyTarget.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreKeyTarget.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+/***************************************************************************
+OgreKeyTarget.h  -  
+	Handles the adding and removing of KeyListeners.
+
+	Components that process the Key Event should subclass this class 
+	and call processKeyEvent when that event is identified.
+
+-------------------
+begin                : Nov 19 2002
+copyright            : (C) 2002 by Kenny Sabir
+email                : kenny@sparksuit.com
+***************************************************************************/
+
+#ifndef __KeyTarget_H__
+#define __KeyTarget_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreEventTarget.h"
+
+namespace Ogre {
+
+    class _OgreExport KeyTarget : public EventTarget
+    {
+    private:
+        std::set<KeyListener*> mRemovedListeners;
+
+    protected:
+        std::set<KeyListener*> mKeyListeners;
+
+    public:
+		KeyTarget() { }
+        virtual ~KeyTarget() { }
+
+	    void processKeyEvent(KeyEvent* e) ;
+	    void addKeyListener(KeyListener* l) ;
+	    void removeKeyListener(KeyListener* l) ;
+    };
+
+
+
+}
+
+
+#endif //__KeyTarget_H__
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderOperation.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderOperation.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderOperation.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _RenderOperation_H__
+#define _RenderOperation_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreVertexIndexData.h"
+
+namespace Ogre {
+
+
+	/** '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
+        };
+
+		/// 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;
+
+
+        RenderOperation() :
+            vertexData(0), operationType(OT_TRIANGLE_LIST), useIndexes(true),
+                indexData(0) {}
+
+	};
+}
+
+
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderTexture.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderTexture.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderTexture.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __RenderTexture_H__
+#define __RenderTexture_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreRenderTarget.h"
+
+namespace Ogre
+{    
+    /** 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, size_t zoffset);
+        virtual ~RenderTexture();
+
+		void writeContentsToFile( const String & filename );
+	protected:
+		HardwarePixelBuffer *mBuffer;
+		size_t 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 internal format 
+		- 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->numMultiRenderTargets()-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)=0;
+
+
+
+		/** Unbind attachment.
+
+		*/
+
+		virtual void unbindSurface(size_t attachment)=0; 
+
+		/** Error throwing implementation, it's not possible to write a MultiRenderTarget
+			to disk. 
+		*/
+		virtual void writeContentsToFile( const String & filename );
+	};
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreHardwareOcclusionQuery.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreHardwareOcclusionQuery.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreHardwareOcclusionQuery.h	(revision 1812)
@@ -0,0 +1,121 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://ogre.sourceforge.net/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _HardwareOcclusionQuery__
+#define _HardwareOcclusionQuery__
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+
+
+/**
+  * 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 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* m_pOcclusionQuery;
+	  *				createOcclusionQuery( &m_pOcclusionQuery );
+	  *				In the rendering loop:
+	  *				Draw all occluders
+	  *				m_pOcclusionQuery->startOcclusionQuery();
+	  *				Draw the polygons to be tested
+	  *				m_pOcclusionQuery->endOcclusionQuery();
+	  *
+	  *				Results must be pulled using:
+	  *				UINT	m_uintNumberOfPixelsVisable;
+	  *				pullOcclusionQuery( &m_dwNumberOfPixelsVisable );
+	  *			
+	  */
+	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 :
+        // numbers of visible pixels determined by last query
+        unsigned int mPixelCount;
+        // is query hasn't yet returned a result.
+		bool		 mIsQueryResultStillOutstanding;
+};
+
+}
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/ExampleApplication.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/ExampleApplication.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/ExampleApplication.h	(revision 1812)
@@ -0,0 +1,206 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+You may use this sample code for anything you like, it is not covered by the
+LGPL like the rest of the engine.
+-----------------------------------------------------------------------------
+*/
+/*
+-----------------------------------------------------------------------------
+Filename:    ExampleApplication.h
+Description: Base class for all the OGRE examples
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __ExampleApplication_H__
+#define __ExampleApplication_H__
+
+#include "Ogre.h"
+#include "OgreConfigFile.h"
+#include "ExampleFrameListener.h"
+
+
+using namespace Ogre;
+
+/** Base class which manages the standard startup of an Ogre application.
+    Designed to be subclassed for specific examples if required.
+*/
+class ExampleApplication
+{
+public:
+    /// Standard constructor
+    ExampleApplication()
+    {
+        mFrameListener = 0;
+        mRoot = 0;
+    }
+    /// Standard destructor
+    virtual ~ExampleApplication()
+    {
+        if (mFrameListener)
+            delete mFrameListener;
+        if (mRoot)
+            delete mRoot;
+    }
+
+    /// Start the example
+    virtual void go(void)
+    {
+        if (!setup())
+            return;
+
+        mRoot->startRendering();
+
+        // clean up
+        destroyScene();
+    }
+
+protected:
+    Root *mRoot;
+    Camera* mCamera;
+    SceneManager* mSceneMgr;
+    ExampleFrameListener* mFrameListener;
+    RenderWindow* mWindow;
+
+    // These internal methods package up the stages in the startup process
+    /** Sets up the application - returns false if the user chooses to abandon configuration. */
+    virtual bool setup(void)
+    {
+        mRoot = new Root();
+
+        setupResources();
+
+        bool carryOn = configure();
+        if (!carryOn) return false;
+
+        chooseSceneManager();
+        createCamera();
+        createViewports();
+
+        // Set default mipmap level (NB some APIs ignore this)
+        TextureManager::getSingleton().setDefaultNumMipmaps(5);
+
+		// Create any resource listeners (for loading screens)
+		createResourceListener();
+		// Load resources
+		loadResources();
+
+		// Create the scene
+        createScene();
+
+        createFrameListener();
+
+        return true;
+
+    }
+    /** Configures the application - returns false if the user chooses to abandon configuration. */
+    virtual bool configure(void)
+    {
+        // Show the configuration dialog and initialise the system
+        // You can skip this and use root.restoreConfig() to load configuration
+        // settings if you were sure there are valid ones saved in ogre.cfg
+        if(mRoot->showConfigDialog())
+        {
+            // If returned true, user clicked OK so initialise
+            // Here we choose to let the system create a default rendering window by passing 'true'
+            mWindow = mRoot->initialise(true);
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+    virtual void chooseSceneManager(void)
+    {
+        // Create the SceneManager, in this case a generic one
+        mSceneMgr = mRoot->createSceneManager(ST_GENERIC, "ExampleSMInstance");
+    }
+    virtual void createCamera(void)
+    {
+        // Create the camera
+        mCamera = mSceneMgr->createCamera("PlayerCam");
+
+        // Position it at 500 in Z direction
+        mCamera->setPosition(Vector3(0,0,500));
+        // Look back along -Z
+        mCamera->lookAt(Vector3(0,0,-300));
+        mCamera->setNearClipDistance(5);
+
+    }
+    virtual void createFrameListener(void)
+    {
+        mFrameListener= new ExampleFrameListener(mWindow, mCamera);
+        mFrameListener->showDebugOverlay(true);
+        mRoot->addFrameListener(mFrameListener);
+    }
+
+    virtual void createScene(void) = 0;    // pure virtual - this has to be overridden
+
+    virtual void destroyScene(void){}    // Optional to override this
+
+    virtual void createViewports(void)
+    {
+        // Create one viewport, entire window
+        Viewport* vp = mWindow->addViewport(mCamera);
+        vp->setBackgroundColour(ColourValue(0,0,0));
+
+        // Alter the camera aspect ratio to match the viewport
+        mCamera->setAspectRatio(
+            Real(vp->getActualWidth()) / Real(vp->getActualHeight()));
+    }
+
+    /// Method which will define the source of resources (other than current folder)
+    virtual void setupResources(void)
+    {
+        // Load resource paths from config file
+        ConfigFile cf;
+        cf.load("resources.cfg");
+
+        // Go through all sections & settings in the file
+        ConfigFile::SectionIterator seci = cf.getSectionIterator();
+
+        String secName, typeName, archName;
+        while (seci.hasMoreElements())
+        {
+            secName = seci.peekNextKey();
+            ConfigFile::SettingsMultiMap *settings = seci.getNext();
+            ConfigFile::SettingsMultiMap::iterator i;
+            for (i = settings->begin(); i != settings->end(); ++i)
+            {
+                typeName = i->first;
+                archName = i->second;
+                ResourceGroupManager::getSingleton().addResourceLocation(
+                    archName, typeName, secName);
+            }
+        }
+    }
+
+	/// Optional override method where you can create resource listeners (e.g. for loading screens)
+	virtual void createResourceListener(void)
+	{
+
+	}
+
+	/// Optional override method where you can perform resource group loading
+	/// Must at least do ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
+	virtual void loadResources(void)
+	{
+		// Initialise, parse scripts etc
+		ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
+
+	}
+
+
+
+};
+
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreZip.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreZip.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreZip.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __Zip_H__
+#define __Zip_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreArchive.h"
+#include "OgreArchiveFactory.h"
+
+// Forward declaration for zziplib to avoid header file dependency.
+typedef struct zzip_dir		ZZIP_DIR;
+typedef struct zzip_file	ZZIP_FILE;
+
+namespace Ogre {
+
+    /** 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;
+    public:
+        ZipArchive(const String& name, const String& archType );
+        ~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) const;
+
+        /// @copydoc Archive::list
+        StringVectorPtr list(bool recursive = true );
+
+        /// @copydoc Archive::listFileInfo
+        FileInfoListPtr listFileInfo(bool recursive = true );
+
+        /// @copydoc Archive::find
+        StringVectorPtr find(const String& pattern, bool recursive = true);
+
+        /// @copydoc Archive::findFileInfo
+        FileInfoListPtr findFileInfo(const String& pattern, bool recursive = true);
+
+        /// @copydoc Archive::exists
+		bool exists(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 ) 
+        {
+            return new ZipArchive(name, "Zip");
+        }
+        /// @copydoc FactoryObj::destroyInstance
+        void destroyInstance( Archive* arch) { delete arch; }
+    };
+
+    /** Specialisation of DataStream to handle streaming data from zip archives. */
+    class _OgrePrivate ZipDataStream : public DataStream
+    {
+    protected:
+        ZZIP_FILE* mZzipFile;
+    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::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);
+
+
+    };
+
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMovablePlane.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMovablePlane.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMovablePlane.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+// Original free version by:
+// Magic Software, Inc.
+// http://www.geometrictools.com/
+// Copyright (c) 2000, All Rights Reserved
+
+#ifndef __MovablePlane_H__
+#define __MovablePlane_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgrePlane.h"
+#include "OgreMovableObject.h"
+
+namespace Ogre {
+
+
+    /** 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* cam) { /* don't care */ }
+        /// Overridden from MovableObject
+        const AxisAlignedBox& getBoundingBox(void) const { return mNullBB; }
+        /// Overridden from MovableObject
+        Real getBoundingRadius(void) const { return Math::POS_INFINITY; }
+        /// Overridden from MovableObject
+        void _updateRenderQueue(RenderQueue* queue) { /* 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;
+
+    };
+}
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreBillboardParticleRenderer.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreBillboardParticleRenderer.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreBillboardParticleRenderer.h	(revision 1812)
@@ -0,0 +1,246 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE 
+(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under 
+the terms of the GNU Lesser General Public License as published by the Free Software 
+Foundation; either version 2 of the License, or (at your option) any later 
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT 
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with 
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple 
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to 
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __BillboardParticleRenderer_H__
+#define __BillboardParticleRenderer_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreParticleSystemRenderer.h"
+#include "OgreBillboardSet.h"
+
+namespace Ogre {
+
+    /** 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 independant 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.
+        @returns
+        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);
+
+        /** Sets billboard rotation type.
+            @returns
+                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, 
+            std::list<Particle*>& currentParticles, bool cullIndividually);
+        /// @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 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* inst);    
+    };
+
+}
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePass.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePass.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePass.h	(revision 1812)
@@ -0,0 +1,1188 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://ogre.sourceforge.net/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __Pass_H__
+#define __Pass_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreGpuProgram.h"
+#include "OgreColourValue.h"
+#include "OgreBlendMode.h"
+#include "OgreCommon.h"
+#include "OgreLight.h"
+
+namespace Ogre {
+    /** Class defining a single pass of a Technique (of a Material), ie
+        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
+    {
+    protected:
+        Technique* mParent;
+        unsigned short mIndex; // pass index
+        String mName; // optional name for the pass
+        uint32 mHash; // pass hash
+        //-------------------------------------------------------------------------
+        // 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;
+        //-------------------------------------------------------------------------
+
+        //-------------------------------------------------------------------------    
+        // Depth buffer settings
+        bool mDepthCheck;
+        bool mDepthWrite;
+        CompareFunction mDepthFunc;
+        ushort mDepthBias;
+
+        // Colour buffer settings
+        bool mColourWrite;
+		
+		// Alpha reject settings
+		CompareFunction mAlphaRejectFunc;
+		unsigned char mAlphaRejectVal;
+        //-------------------------------------------------------------------------    
+
+        //-------------------------------------------------------------------------
+        // Culling mode
+        CullingMode mCullMode;
+        ManualCullingMode mManualCullMode;
+        //-------------------------------------------------------------------------
+
+        /// Lighting enabled?
+        bool mLightingEnabled;
+        /// Max simultaneous lights
+        unsigned short mMaxSimultaneousLights;
+		/// Run this pass once per light?
+		bool mIteratePerLight;
+        // Should it only be run for a certain light type?
+        bool mRunOnlyForOneLightType;
+        Light::LightTypes mOnlyLightType;
+
+        /// Shading options
+        ShadeOptions mShadeOptions;
+		/// Polygon mode
+		PolygonMode mPolygonMode;
+
+        //-------------------------------------------------------------------------    
+        // Fog
+        bool mFogOverride;
+        FogMode mFogMode;
+        ColourValue mFogColour;
+        Real mFogStart;
+        Real mFogEnd;
+        Real mFogDensity;
+        //-------------------------------------------------------------------------    
+
+        /// Storage of texture unit states 
+        typedef std::vector<TextureUnitState*> TextureUnitStates;
+        TextureUnitStates mTextureUnitStates;    
+
+		// Vertex program details
+		GpuProgramUsage *mVertexProgramUsage;
+        // Vertex program details
+        GpuProgramUsage *mShadowCasterVertexProgramUsage;
+        // Vertex program details
+        GpuProgramUsage *mShadowReceiverVertexProgramUsage;
+		// Fragment program details
+		GpuProgramUsage *mFragmentProgramUsage;
+		// Fragment program details
+		GpuProgramUsage *mShadowReceiverFragmentProgramUsage;
+        // 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];
+	public:
+		typedef std::set<Pass*> PassSet;
+    protected:
+		/// List of Passes whose hashes need recalculating
+		static PassSet msDirtyHashList;
+        /// The place where passes go to die
+        static PassSet msPassGraveyard;
+    public:
+        /// 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);
+        ~Pass();
+
+        /// Returns true if this pass is programmable ie includes either a vertex or fragment program.
+        bool isProgrammable(void) const { return mVertexProgramUsage || mFragmentProgramUsage; }
+        /// 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 shadow caster vertex program
+        bool hasShadowCasterVertexProgram(void) const { return mShadowCasterVertexProgramUsage != 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; }
+
+
+        /// 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 usefull in material scripts where a material could inherit
+        from another material and only want to modify a particalar 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.
+        @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 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, linear, quadratic Parameters to the attentuation 
+			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 '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
+        name 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);
+
+        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.
+        */
+        size_t getNumTextureUnitStates(void) const
+        {
+            return mTextureUnitStates.size();
+        }
+
+        /** Sets the kind of blending this pass has with the existing contents of the scene.
+        @remarks
+        Wheras 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 );
+
+        /** Allows very fine control of blending this Pass with the existing contents of the scene.
+        @remarks
+        Wheras 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);
+
+        /** 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;
+
+		/** 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.
+        @pemarks
+        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 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 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 passs.
+        @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.
+        @param bias The bias value, should be between 0 and 16.
+        */
+        void setDepthBias(ushort bias);
+
+        /** Retrieves the depth bias value as set by setDepthValue. */
+        ushort getDepthBias(void) 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)
+        @note
+			This option applies in both the fixed function and the programmable pipeline.
+        */
+        void setAlphaRejectSettings(CompareFunction func, unsigned char value);
+
+		/** 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 or not this pass should iterate per light 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> 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 a lot 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.
+        @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; }
+		
+		/// Gets the parent Technique
+        Technique* getParent(void) { 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 implemetors 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 explict 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 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 implemetors 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 vertex 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 vertex program parameters used by this pass. */
+		GpuProgramParametersSharedPtr getFragmentProgramParameters(void) const;
+		/** Gets the vertex program used by this pass, only available after _load(). */
+		const GpuProgramPtr& getFragmentProgram(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
+		@returns 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 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;
+		/// 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 any automatic parameters (except lights) on this pass */
+        void _updateAutoParamsNoLights(const AutoParamDataSource& source) const;
+        /** Update any automatic light parameters on this pass */
+        void _updateAutoParamsLightsOnly(const AutoParamDataSource& source) 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);
+		/** 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) { msDirtyHashList.clear(); }
+
+        /** 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 0 will cause the pass to be executed count number of
+            times without changing the render state.  This is very usefull 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 0 turns off multi pass operation and the pass does
+            the normal pass operation.
+        */
+        void setPassIterationCount(const size_t count) { mPassIterationCount = count; }
+
+        /** Gets the multi pass 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;
+        
+    };
+
+    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
+    };
+    /** 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
+    {
+        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;
+    };
+
+    typedef std::vector<IlluminationPass*> IlluminationPassList;
+
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreShadowVolumeExtrudeProgram.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreShadowVolumeExtrudeProgram.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreShadowVolumeExtrudeProgram.h	(revision 1812)
@@ -0,0 +1,229 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __SHADOWVOLUMEEXTRUDEPROGRAM_H__
+#define __SHADOWVOLUMEEXTRUDEPROGRAM_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreLight.h"
+
+namespace Ogre {
+    /** 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 // homogenous, 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, // homogenous, 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, // homogenous, 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
+    {
+    private:
+        static String mPointArbvp1;
+        static String mPointVs_1_1;
+        static String mDirArbvp1;
+        static String mDirVs_1_1;
+        // 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 mDirArbvp1Debug;
+        static String mDirVs_1_1Debug;
+		
+        static String mPointArbvp1Finite;
+        static String mPointVs_1_1Finite;
+        static String mDirArbvp1Finite;
+        static String mDirVs_1_1Finite;
+        // 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 mDirArbvp1FiniteDebug;
+        static String mDirVs_1_1FiniteDebug;
+
+		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];
+
+        /// 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 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 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 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; }
+        /// 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 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 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 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; }
+
+
+
+		
+    };
+}
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreStableHeaders.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreStableHeaders.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreStableHeaders.h	(revision 1812)
@@ -0,0 +1,76 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+/* 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 || OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+#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 "OgreUserDefinedObject.h"
+#include "OgreVector2.h"
+#include "OgreVector3.h"
+#include "OgreVector4.h"
+#include "OgreWireBoundingBox.h"
+#include "OgreZip.h"
+#endif
+
+#endif 
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreParticleSystem.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreParticleSystem.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreParticleSystem.h	(revision 1812)
@@ -0,0 +1,751 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE 
+	(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under 
+the terms of the GNU Lesser General Public License as published by the Free Software 
+Foundation; either version 2 of the License, or (at your option) any later 
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT 
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with 
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple 
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to 
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#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"
+
+
+namespace Ogre {
+
+    /** 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 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);
+
+		/** 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 origina particle system style as possible.
+        @param quota The maximum number of particles this system is allowed to have.
+        */
+        void setParticleQuota(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);
+
+        /** Sets the name of the material to be used for this billboard set.
+            @returns 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);
+
+        /** 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);
+
+		/** 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 defalt 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);
+
+		/// 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 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 mpMaterial;
+        /// 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;
+
+        typedef std::list<Particle*> ActiveParticleList;
+        typedef std::list<Particle*> FreeParticleList;
+        typedef std::vector<Particle*> 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 instertions and deletions from anywhere in 
+                the list to activate / deactivate particles as well as resuse 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 std::vector<ParticleEmitter*> ParticleEmitterList;
+        typedef std::vector<ParticleAffector*> 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;
+
+		/// 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);
+
+        /** 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);
+
+        /** 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);
+
+    };
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePatchSurface.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePatchSurface.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePatchSurface.h	(revision 1812)
@@ -0,0 +1,229 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __PatchSurface_H__
+#define __PatchSurface_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreVector3.h"
+#include "OgreString.h"
+#include "OgreRenderOperation.h"
+#include "OgreAxisAlignedBox.h"
+
+namespace Ogre {
+
+    /** 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:
+        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
+                decaration 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 vertexStart 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;
+
+        std::vector<Vector3> 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
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCompositionTechnique.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCompositionTechnique.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCompositionTechnique.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __CompositionTechnique_H__
+#define __CompositionTechnique_H__
+
+#include "OgrePrerequisites.h"
+#include "OgrePixelFormat.h"
+#include "OgreIteratorWrappers.h"
+
+namespace Ogre {
+    /** Base composition technique, can be subclassed in plugins.
+     */
+    class _OgreExport CompositionTechnique
+    {
+    public:
+        CompositionTechnique(Compositor *parent);
+        virtual ~CompositionTechnique();
+    
+        /// Local texture definition
+        class TextureDefinition
+        {
+        public:
+            String name;
+            size_t width;       // 0 means adapt to target width
+            size_t height;      // 0 means adapt to target height
+            PixelFormat format;
+
+			TextureDefinition() :width(0), height(0), format(PF_R8G8B8A8){}
+        };
+        /// Typedefs for several iterators
+        typedef std::vector<CompositionTargetPass *> TargetPasses;
+        typedef VectorIterator<TargetPasses> TargetPassIterator;
+        typedef std::vector<TextureDefinition*> 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 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);
+        
+        /** Create an instance of this technique.
+         */
+        virtual CompositorInstance *createInstance(CompositorChain *chain);
+        
+        /** Destroy an instance of this technique.
+         */
+        virtual void destroyInstance(CompositorInstance *instance);
+        
+        /** 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;    
+
+		/// List of instances
+		typedef std::vector<CompositorInstance *> Instances;
+		Instances mInstances;
+    };
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreVertexBoneAssignment.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreVertexBoneAssignment.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreVertexBoneAssignment.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __VertexBoneAssignment_H__
+#define __VertexBoneAssignment_H__
+
+#include "OgrePrerequisites.h"
+
+
+namespace Ogre 
+{
+    
+    /** 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: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCursor.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCursor.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCursor.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+
+/***************************************************************************
+OgreCursor.h  -  
+	The Cursor is an non-visual object that contains a the XYZ values that 
+	are modified by a InputReader.
+	An InputReader creates and contains a Cursor object that it uses when it 
+	is set to buffered input (using the EventQueue).
+
+	To get a graphical representation of the cursor, a CursorGuiElement is
+	used, which is a MouseMotionListener to the Cursor.
+
+-------------------
+begin                : Nov 19 2002
+copyright            : (C) 2002 by Kenny Sabir
+email                : kenny@sparksuit.com
+***************************************************************************/
+
+#ifndef __Cursor_H__
+#define __Cursor_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreMouseMotionTarget.h"
+#include "OgreMouseTarget.h"
+
+namespace Ogre {
+	/** The Cursor is an non-visual object that contains a the XYZ values that 
+		are modified by a InputReader.
+	@remarks
+		An InputReader creates and contains a Cursor object that it uses when it 
+		is set to buffered input (using the EventQueue).
+
+		To get a graphical representation of the cursor, a CursorGuiElement is
+		used, which is a MouseMotionListener to the Cursor.
+	*/
+	class _OgreExport Cursor : public MouseMotionTarget, public MouseTarget
+    {
+    protected:
+		/** Cursor position */
+        Real mMouseX, mMouseY, mMouseZ;
+
+        /** relative cursor position */
+        Real mRelX, mRelY, mRelZ;
+
+		/** Cursor limits 0-1 */
+		Real mXLowLimit, mXHighLimit, mYLowLimit, mYHighLimit, mZLowLimit, mZHighLimit;
+
+		/** Scale the cursor movements. Initially set at 1 (no scaling).
+			The scaling effects all axis, XYZ */
+		Real mScale;
+
+		/** inline function to clip a value to its low and high limits */
+		inline Real limit(Real val, Real low, Real high)
+		{	return (val < low) ? low: ((val > high) ? high : val); }
+	public :
+		Cursor();
+		virtual ~Cursor();
+
+		/** add relative amount to X */
+		void addToX(Real val);
+
+		/** add relative amount to Y */
+		void addToY(Real val);
+
+		/** add relative amount to Z */
+		void addToZ(Real val);
+
+		/** process the mouse events that are for any listeners to the cursor */
+		void processEvent(InputEvent* e);
+
+
+		/** get the current X position of the cursor 0 left, 1 right */
+		Real getX() const;
+
+		/** get the current Y position of the cursor 0 top, 1 bottom */
+		Real getY() const;
+
+		/** get the current Z position of the cursor 0 none, 1 full */
+		Real getZ() const;
+
+        /** get relative X cursor movement */
+        Real getRelX() const {return mRelX;}
+
+        /** get relative Y cursor movement */
+        Real getRelY() const {return mRelY;}
+
+        /** get relative Z cursor movement */
+        Real getRelZ() const {return mRelZ;}
+
+
+
+	// PositionTarget methods
+        /** Gets the left of this element in relation to the screen (where 0 = far left, 1.0 = far right)  */
+        Real getLeft(void) const ;
+
+        /** Gets the top of this element in relation to the screen (where 0 = top, 1.0 = bottom)  */
+        Real getTop(void) const ;
+
+		/** The parent of the cursor is NULL as it's position is absolute in the window */
+		PositionTarget* getPositionTargetParent() const;
+
+		inline virtual bool isKeyEnabled() const
+		{ return false; }
+
+		/** Gets the current cursor movement scaling factor. */
+		Real getScale(void) const { return mScale; }
+		/** Sets the current cursor movement scaling factor. */
+		void setScale(Real scale) { mScale = scale; }
+		
+
+    };
+
+}
+
+
+#endif  // __Cursor_H__
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreAnimation.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreAnimation.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreAnimation.h	(revision 1812)
@@ -0,0 +1,357 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __Animation_H__
+#define __Animation_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreString.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreAnimable.h"
+#include "OgreAnimationTrack.h"
+
+
+namespace Ogre {
+
+    /** 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:
+        /** 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;
+
+        /** 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 eaily 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, bool accumulate = false, 
+			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 eaily 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, 
+			bool accumulate = false, Real scale = 1.0f);
+
+		/** Applies all vertex tracks given a specific time point and weight to a given entity.
+		@remarks
+		@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);
+
+        /** 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 lieanrly 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 std::map<unsigned short, NodeAnimationTrack*> NodeTrackList;
+        typedef ConstMapIterator<NodeTrackList> NodeTrackIterator;
+
+		typedef std::map<unsigned short, NumericAnimationTrack*> NumericTrackList;
+		typedef ConstMapIterator<NumericTrackList> NumericTrackIterator;
+
+		typedef std::map<unsigned short, VertexAnimationTrack*> 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 keyfamed 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.
+		*/
+		void optimise(void);
+
+		/** 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;
+		
+
+
+    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;
+
+		void optimiseNodeTracks(void);
+		void optimiseVertexTracks(void);
+
+        
+    };
+
+
+}
+
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreStaticFaceGroup.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreStaticFaceGroup.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreStaticFaceGroup.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __StaticFaceGroup_H__
+#define __StaticFaceGroup_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgrePlane.h"
+#include "OgrePatchSurface.h"
+
+namespace Ogre {
+
+    /** A type of face group, ie face list of procedural etc */
+    enum FaceGroupType {
+        FGT_FACE_LIST,
+        FGT_PATCH,
+        FGT_UNKNOWN
+    };
+
+    /** Collectes a group of static ie 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.
+        */
+        int materialHandle;
+
+        Plane plane;
+
+        /// Patch surface (only applicable when fType = FGT_PATCH)
+        PatchSurface* patchSurf;
+
+
+        friend std::ostream& operator<<(std::ostream& o, 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: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSceneQuery.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSceneQuery.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSceneQuery.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __SceneQuery_H__
+#define __SceneQuery_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreAxisAlignedBox.h"
+#include "OgreSphere.h"
+#include "OgreRay.h"
+#include "OgreRenderOperation.h"
+#include "OgrePlaneBoundedVolume.h"
+
+namespace Ogre {
+
+    // forward declaration
+    class SceneQueryListener;
+    /** 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:
+        /** 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
+            std::list<Plane>* 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;
+        std::set<WorldFragmentType> 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 std::set<WorldFragmentType>* 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 std::list<MovableObject*> SceneQueryResultMovableList;
+    typedef std::list<SceneQuery::WorldFragment*> SceneQueryResultWorldFragmentList;
+    /** Holds the results of a scene query. */
+    struct _OgreExport SceneQueryResult
+    {
+        /// 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 std::vector<RaySceneQueryResultEntry> 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 std::list<SceneQueryMovableObjectPair> SceneQueryMovableIntersectionList;
+    typedef std::list<SceneQueryMovableObjectWorldFragmentPair> SceneQueryMovableWorldFragmentIntersectionList;
+    /** Holds the results of an intersection scene query (pair values). */
+    struct _OgreExport IntersectionSceneQueryResult
+    {
+        /// 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);
+    };
+    
+
+}
+    
+
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRoot.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRoot.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRoot.h	(revision 1812)
@@ -0,0 +1,815 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __ROOT__
+#define __ROOT__
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+
+#include "OgreSingleton.h"
+#include "OgreString.h"
+#include "OgreSceneManagerEnumerator.h"
+#include "OgreResourceGroupManager.h"
+
+#include <exception>
+
+#if OGRE_COMPILER == OGRE_COMPILER_MSVC || OGRE_COMPILER == OGRE_COMPILER_BORL
+#   define SET_TERM_HANDLER { set_terminate( &Ogre::Root::termHandler ); }
+#else
+#   define SET_TERM_HANDLER { std::set_terminate( &Ogre::Root::termHandler ); }
+#endif
+
+namespace Ogre
+{
+    typedef std::vector<RenderSystem*> 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>
+    {
+        // To allow update of active renderer if
+        // RenderSystem::initialise is used directly
+        friend class RenderSystem;
+    private:
+        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;
+        SceneManager* mCurrentSceneManager;
+        DynLibManager* mDynLibManager;
+        PlatformManager* mPlatformManager;
+        ArchiveManager* mArchiveManager;
+        MaterialManager* mMaterialManager;
+        MeshManager* mMeshManager;
+        ParticleSystemManager* mParticleManager;
+        SkeletonManager* mSkeletonManager;
+        OverlayElementFactory* mPanelFactory;
+        OverlayElementFactory* mBorderPanelFactory;
+        OverlayElementFactory* mTextAreaFactory;
+        OverlayManager* mOverlayManager;
+        FontManager* mFontManager;
+        ArchiveFactory *mZipArchiveFactory;
+        ArchiveFactory *mFileSystemArchiveFactory;
+		ResourceGroupManager* mResourceGroupManager;
+		ResourceBackgroundQueue* mResourceBackgroundQueue;
+
+        Timer* mTimer;
+        RenderWindow* mAutoWindow;
+        Profiler* mProfiler;
+        HighLevelGpuProgramManager* mHighLevelGpuProgramManager;
+		ExternalTextureSourceManager* mExternalTextureSourceManager;
+        CompositorManager* mCompositorManager;      
+        unsigned long mCurrentFrame;
+		Real mFrameSmoothingTime;
+
+        std::vector<DynLib*> mPluginLibs;
+
+		typedef std::map<String, MovableObjectFactory*> MovableObjectFactoryMap;
+		MovableObjectFactoryMap mMovableObjectFactoryMap;
+		uint32 mNextMovableObjectTypeFlag;
+		// stock movable factories
+		MovableObjectFactory* mEntityFactory;
+		MovableObjectFactory* mLightFactory;
+		MovableObjectFactory* mBillboardSetFactory;
+		MovableObjectFactory* mManualObjectFactory;
+		MovableObjectFactory* mBillboardChainFactory;
+		MovableObjectFactory* mRibbonTrailFactory;
+
+		typedef std::map<String, RenderQueueInvocationSequence*> RenderQueueInvocationSequenceMap;
+		RenderQueueInvocationSequenceMap mRQSequenceMap;
+
+		/// Are we initialised yet?
+		bool mIsInitialised;
+
+        /** Method reads a plugins configuration file and instantiates all
+            plugins.
+            @param
+                pluginsfile The file that contains plugins information.
+                Defaults to "plugins.cfg".
+        */
+        void loadPlugins( const String& pluginsfile = "plugins.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 */
+        std::set<FrameListener*> mFrameListeners;
+
+        /** Set of frame listeners marked for removal*/
+        std::set<FrameListener*> mRemovedFrameListeners;
+
+        /** Indicates the type of event to be considered by calculateEventTime(). */
+        enum FrameEventTimeType {
+            FETT_ANY, FETT_STARTED, FETT_ENDED
+        };
+
+        /// Contains the times of recently fired events
+        std::deque<unsigned long> mEventTimes[3];
+
+        /** 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);
+    public:
+
+        static void termHandler();
+
+        /** Constructor
+            @param
+                pluginFileName The file that contains plugins information.
+                Defaults to "plugins.cfg".
+		*/
+        Root(const String& pluginFileName = "plugins.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.
+
+            @returns
+                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 renderering 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.
+            @returns
+                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
+                (sublcass) 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.
+        */
+        RenderSystemList* getAvailableRenderers(void);
+
+        /** Retrieve a pointer to the render system by the given name
+            @param
+                name Name of the render system intend to retrieve.
+            @returns
+                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
+                RenderSystem::createRenderWindow). The window will be
+                created based on the options currently set on the render
+                system.
+            @returns
+                A pointer to the automatically created window, if
+                requested, otherwise <b>NULL</b>.
+        */
+	    RenderWindow* initialise(bool autoCreateWindow, const String& windowTitle = "OGRE Render Window");
+
+		/** Returns whether the system is initialised or not. */
+		bool isInitialised(void) const { return mIsInitialised; }
+
+		/** 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;
+
+		/** 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(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);
+        /** 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);
+
+        /** 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 retreives 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) ;
+
+        /** Destroys a rendering window.
+        */
+        void detachRenderTarget( RenderTarget* pWin );
+
+        /** Destroys a named rendering window.
+        */
+        void detachRenderTarget( const String & name );
+
+        /** Retrieves a pointer to the a named render window.
+        */
+        RenderTarget * getRenderTarget(const String &name);
+
+        /** Sets whether or not the debug overlay is shown.
+        @remarks
+            The debug overlay displays frame rate stats and various other debug
+            information. You can enable it or disable it using this method.
+            Alternatively you could access the overlay directly using mSceneManager::getOverlay
+            but this is simpler.
+        void showDebugOverlay(bool show);
+        */
+
+		/** Manually load a plugin.
+		 @remarks
+		 	Plugins are loaded at startup using the plugin configuration
+			file specified when you create Root (default: plugins.cfg).
+			This method allows you to load plugins in code.
+		@param pluginName Name of the plugin library to load
+		*/
+		void loadPlugin(const String& pluginName);
+
+		/** Manually unloads a plugin.
+		 @remarks
+		 	Plugins are unloaded at shutdown automatically.
+			This method allows you to unload plugins in code, but
+			make sure their dependencies are decoupled frist.
+		@param pluginName Name of the plugin library to unload
+		*/
+		void unloadPlugin(const String& pluginName);
+
+        /** 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
+        @returns 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 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
+        @returns 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.
+        @returns False if one or more frame listeners elected that the rendering loop should
+            be terminated, true otherwise.
+        */
+        bool _fireFrameStarted();
+        /** 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.
+        @returns False if one or more frame listeners elected that the rendering loop should
+            be terminated, true otherwise.
+        */
+        bool _fireFrameEnded();
+
+        /** Gets the number of the current frame. */
+        unsigned long getCurrentFrameNumber(void) const { return mCurrentFrame; }
+
+        /** 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 { return mCurrentSceneManager; }
+        /** Sets the scene manager currently being used to render a frame.
+        @remarks
+            This is only intended for internal use.
+        */
+        void _setCurrentSceneManager(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.
+        */
+        void _updateAllRenderTargets(void);
+
+		/** 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.
+		@param name The name to identify the sequence
+		*/
+		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;
+    };
+} // Namespace Ogre
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreGpuProgram.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreGpuProgram.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreGpuProgram.h	(revision 1812)
@@ -0,0 +1,1188 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://ogre.sourceforge.net/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __GpuProgram_H_
+#define __GpuProgram_H_
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+#include "OgreResource.h"
+#include "OgreSharedPtr.h"
+#include "OgreIteratorWrappers.h"
+
+namespace Ogre {
+
+	/** Enumerates the types of programs which can run on the GPU. */
+	enum GpuProgramType
+	{
+		GPT_VERTEX_PROGRAM,
+		GPT_FRAGMENT_PROGRAM
+	};
+
+    
+    /** 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 GpuProgramManager and
+        may be shared between multiple GpuProgram instances. For this reason they
+        are managed using a shared pointer, which will ensure they are automatically
+        deleted when no program is using them anymore.
+    */
+    class _OgreExport GpuProgramParameters
+    {
+    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 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 & tranposed
+            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,
+
+
+            /// Fog colour
+            ACT_FOG_COLOUR,
+            /// Fog params: density, linear start, linear end, 1/(end-start)
+            ACT_FOG_PARAMS,
+
+
+			/// 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 diffuse colour (index determined by setAutoConstant call)
+            ACT_LIGHT_SPECULAR_COLOUR,
+            /// Light attenuation parameters, Vector4(range, constant, linear, quadric)
+            ACT_LIGHT_ATTENUATION,
+            /// 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,
+			/** 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,
+            /// 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 acitve pass.
+            */
+            ACT_PASS_ITERATION_NUMBER,
+
+
+			/** Provides a parametric animation value [0..1], only available
+				where the renderable specifically implements it.
+			*/
+			ACT_ANIMATION_PARAMETRIC
+
+        };
+
+        /** 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
+        };
+
+        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 _OgrePrivate AutoConstantEntry
+        {
+        public:
+            /// The type of parameter
+            AutoConstantType paramType;
+            /// The target constant index
+            size_t index;
+            /// Additional information to go with the parameter
+			union{
+				size_t data;
+				Real fData;
+			};
+
+            AutoConstantEntry(AutoConstantType theType, size_t theIndex, size_t theData)
+                : paramType(theType), index(theIndex), data(theData) {}
+
+			AutoConstantEntry(AutoConstantType theType, size_t theIndex, Real theData)
+				: paramType(theType), index(theIndex), fData(theData) {}
+
+        };
+        /** Real parameter entry; contains both a group of 4 values and 
+        an indicator to say if it's been set or not. This allows us to 
+        filter out constant entries which have not been set by the renderer
+        and may actually be being used internally by the program. */
+        struct RealConstantEntry
+        {
+            float val[4];
+            bool isSet;
+            RealConstantEntry() : isSet(false)  {}
+        };
+        /** Int parameter entry; contains both a group of 4 values and 
+        an indicator to say if it's been set or not. This allows us to 
+        filter out constant entries which have not been set by the renderer
+        and may actually be being used internally by the program. */
+        struct IntConstantEntry
+        {
+            int val[4];
+            bool isSet;
+            IntConstantEntry() : isSet(false) {}
+        };
+
+        // nfz
+        /** stucture used to keep track of attributes for a constant definition.
+
+        */
+
+        struct ConstantDefinition
+        {
+            String name;
+            size_t entryIndex;
+            size_t elementCount;
+            size_t arraySize;
+            ElementType elementType;
+            size_t autoIndex;
+            bool   isAllocated;
+            bool   isAuto;
+
+            ConstantDefinition()
+                : entryIndex(0)
+                , elementCount(0)
+                , arraySize(1)
+                , elementType(ET_INT)
+                , autoIndex(0)
+                , isAllocated(false)
+                , isAuto(false)
+            {}
+
+        };
+
+    protected:
+        static AutoConstantDefinition AutoConstantDictionary[];
+        // Constant lists
+        typedef std::vector<RealConstantEntry> RealConstantList;
+        typedef std::vector<IntConstantEntry> IntConstantList;
+        // Auto parameter storage
+        typedef std::vector<AutoConstantEntry> AutoConstantList;
+        // parameter dictionary container
+        typedef std::vector<ConstantDefinition> ConstantDefinitionContainer;
+        /// Packed list of floating-point constants
+        RealConstantList mRealConstants;
+        /// Packed list of integer constants
+        IntConstantList mIntConstants;
+        /// List of automatically updated parameters
+        AutoConstantList mAutoConstants;
+        /// Container of parameter definitions
+        ConstantDefinitionContainer mConstantDefinitions;
+        /// Mapping from parameter names to NamedConstantEntry - high-level programs are expected to populate this
+        typedef std::map<String, size_t> ParamNameMap;
+        ParamNameMap mParamNameMap;
+        /// Do we need to transpose matrices?
+        bool mTransposeMatrices;
+		/// flag to indicate if names not found will be automatically added
+		bool mAutoAddParamName;
+        /// active pass iteration parameter real constant entry;
+        RealConstantEntry* mActivePassIterationEntry;
+        /// index for active pass iteration parameter real constant entry;
+        size_t mActivePassIterationEntryIndex;
+
+
+    public:
+		GpuProgramParameters();
+		~GpuProgramParameters() {}
+
+        /// Copy constructor
+        GpuProgramParameters(const GpuProgramParameters& oth);
+        /// Operator = overload
+        GpuProgramParameters& operator=(const GpuProgramParameters& oth);
+
+
+		/** Sets a 4-element floating-point parameter to the program.
+		@param index The 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 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 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 homogenous vector)
+		@param vec The value to set
+		*/
+		void setConstant(size_t index, const Vector3& vec);
+		/** Sets a Matrix4 parameter to the program.
+		@param index The 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 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 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 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 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 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);
+
+        /** Deletes the contents of the Real constants registers. */
+        void resetRealConstants(void) { mRealConstants.clear(); }
+        /** Deletes the contents of the int constants registers. */
+        void resetIntConstants(void) { mIntConstants.clear(); }
+
+        typedef ConstVectorIterator<RealConstantList> RealConstantIterator;
+        typedef ConstVectorIterator<IntConstantList> IntConstantIterator;
+        /// Gets an iterator over the Real constant parameters
+        RealConstantIterator getRealConstantIterator(void) const;
+        /// Gets an iterator over the integer constant parameters
+        IntConstantIterator getIntConstantIterator(void) const;
+
+		/** Gets a specific Real Constant entry if index is in valid range
+			otherwise returns a NULL
+		@parem index which entry is to be retrieved
+		*/
+		RealConstantEntry* getRealConstantEntry(const size_t index);
+		/** Gets a specific Int Constant entry if index is in valid range
+			otherwise returns a NULL
+		@parem index which entry is to be retrieved
+		*/
+		IntConstantEntry* getIntConstantEntry(const size_t index);
+        
+		/** Gets a Named Real Constant entry if the name is found otherwise returns a NULL
+		@parem name The name of the entry  to be retrieved
+		*/
+		RealConstantEntry* getNamedRealConstantEntry(const String& name);
+		/** Gets a named Int Constant entry if name is found otherwise returns a NULL
+		@parem name The name of the entry to be retrieved
+		*/
+		IntConstantEntry* getNamedIntConstantEntry(const String& name);
+        /// Gets the number of Real constants that have been set
+        size_t getRealConstantCount(void) const { return mRealConstants.size(); }
+        /// Gets the number of int constants that have been set
+        size_t getIntConstantCount(void) const { return mIntConstants.size(); }
+        /// Returns true if there are any Real constants contained here
+        bool hasRealConstantParams(void) const { return !(mRealConstants.empty()); }
+        /// Returns true if there are any int constants contained here
+        bool hasIntConstantParams(void) const { return !(mIntConstants.empty()); }
+
+        /** 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 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
+		@parem 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()); }
+        /** Updates the automatic parameters (except lights) based on the details provided. */
+        void _updateAutoParamsNoLights(const AutoParamDataSource& source);
+        /** Updates the automatic parameters for lights based on the details provided. */
+        void _updateAutoParamsLightsOnly(const AutoParamDataSource& source);
+
+		/** Sets the auto add parameter name flag
+		@remarks
+			Not all GPU programs make named parameters available after the high level
+			source is compiled.  GLSL is one such case.  If parameter names are not loaded
+			prior to the material serializer reading in parameter names in a script then
+			an exception is generated.  Set AutoAddParamName to true to have names not found
+			in the map added to the map.
+		@note
+			The index of the parameter name will be set to the end of the Real Constant List.
+		@param state true to enable automatic name
+		*/
+		void setAutoAddParamName(bool state) { mAutoAddParamName = 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 index The index at which to place the parameter
+			NB this index refers to the number of floats, so a Vector3 is 3. Note that many 
+            rendersystems & programs assume that every floating point parameter is passed in
+            as a vector of 4 items, so you are strongly advised to check with 
+            RenderSystemCapabilities before using this version - if in doubt use Vector4
+            or ColourValue instead (both are 4D).
+		@param vec The value to set
+		*/
+		void setNamedConstant(const String& name, const Vector3& 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.
+        @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 Pointer to the values to write
+		@param count The number of floats to write
+		*/
+		void setNamedConstant(const String& name, const float *val, size_t count);
+		/** Sets a multiple 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 Pointer to the values to write
+		@param count The number of floats to write
+		*/
+		void setNamedConstant(const String& name, const double *val, size_t count);
+		/** 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 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 Pointer to the values to write
+		@param count The number of integers to write
+		*/
+		void setNamedConstant(const String& name, const int *val, size_t count);
+
+        /** 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);
+
+        /** 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);
+        /// Internal method for associating a parameter name with an index
+        void _mapParameterNameToIndex(const String& name, const size_t index );
+
+        /** Gets the constant index associated with a named parameter. */
+        size_t getParamIndex(const String& name);
+
+
+        /** 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.
+		*/
+		void copyConstantsFrom(const GpuProgramParameters& source);
+
+        /** Add (or update) a constant definition which describes a constant.  
+		@remarks
+			Mainly used for Material serialization but could also be used by material
+            editors. Returns the index of the constant definition.
+        @param name The name of the parameter.
+        @param index The constant index at which to place the parameter (each constant is
+            a 4D float).
+        @param elementCount The number of elements that make up the parameter. 
+			An example is if the parameter is a matrix4x4 then there are 16 
+			elements. 
+        @param isReal If true then indicates that the elements are float else they are int.
+        */
+        size_t addConstantDefinition(const String& name, const size_t index, 
+			const size_t elementCount, const ElementType elementType);
+
+        /** gets the constant definition associated with name if found else returns NULL
+        @param name The name of the constant
+        */
+        const ConstantDefinition* getConstantDefinition(const String& name) const;
+        /** gets the constant definition using an index into the constant definition array.
+            If the index is out of bounds then NULL is returned;
+        @param idx The constant index
+        */
+        const ConstantDefinition* getConstantDefinition(const size_t idx) const;
+        /** Find a matching constant defintion.  Matches name, entry index, and element type.
+        @returns NULL if no match is found.
+        */
+        const ConstantDefinition* findMatchingConstantDefinition(const String& name, 
+            const size_t entryIndex, const ElementType elementType) const;
+
+        /** Returns the number of constant definitions
+        */
+        size_t getNumConstantDefinitions(void) const { return mConstantDefinitions.size(); }
+        /** Set the constant definition's Auto state.
+        @param index The index of the constant definition.
+        @param isAuto If true then constant is being updated automatically.
+        @param autoIndex Index for AutoConstantEntry.
+        */
+        void setConstantDefinitionAutoState( const size_t index, 
+			const bool isAuto, const size_t autoIndex );
+        /** 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);
+        /** gets the MultipassEntry if it exists.
+        @returns NULL if a Multipass constant entry does not exist.
+        */
+        RealConstantEntry* getPassIterationEntry(void);
+        /** gets the MultipassEntry index.  The value returned is only valid if if 
+            getMultipassEntry() does not return NULL.
+        */
+        size_t getPassIterationEntryIndex(void) const { return mActivePassIterationEntryIndex; }
+    };
+
+    /// Shared pointer used to hold references to GpuProgramParameters instances
+    typedef SharedPtr<GpuProgramParameters> GpuProgramParametersSharedPtr;
+
+    // Forward declaration 
+    class GpuProgramPtr;
+
+	/** 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);
+		};
+		// Command object for setting / getting parameters
+		static CmdType msTypeCmd;
+		static CmdSyntax msSyntaxCmd;
+		static CmdSkeletal msSkeletalCmd;
+	
+		/// 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 eg 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;
+		/// The default parameters for use with this object
+		GpuProgramParametersSharedPtr mDefaultParams;
+		/// Does this program want light states passed through fixed pipeline
+		bool mPassSurfaceAndLightStates;
+		/// Did we encounter a compilation error?
+		bool mCompileError;
+
+		/** 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);
+
+		/// @copydoc Resource::calculateSize
+		size_t calculateSize(void) const { return 0; } // TODO 
+
+		/// @copydoc Resource::loadImpl
+		void loadImpl(void);
+	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; }
+
+		/** 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(); }
+
+		/** Sets whether a vertex program requires light and material states to be passed
+		to through fixed pipeline low level API rendering calls.
+		@remarks
+		If this is set to true, OGRE will pass all active light states to the fixed function
+		pipeline.  This is useful for high level shaders like GLSL that can read the OpenGL
+		light and material states.  This way the user does not have to use autoparameters to 
+		pass light position, color etc.
+		*/
+		virtual void setSurfaceAndPassLightStates(bool state)
+			{ mPassSurfaceAndLightStates = state; }
+
+		/** Returns whether a vertex program wants light and material states to be passed
+		through fixed pipeline low level API rendering calls
+		*/
+		virtual bool getPassSurfaceAndLightStates(void) const { return mPassSurfaceAndLightStates; }
+
+        /** 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; }
+    protected:
+        /// Virtual method which must be implemented by subclasses, load from mSource
+        virtual void loadFromSource(void) = 0;
+
+	};
+
+
+	/** Specialisation of SharedPtr to allow SharedPtr to be assigned to GpuProgramPtr 
+	@note Has to be a subclass since we need operator=.
+	We could templatise this instead of repeating per Resource subclass, 
+	except to do so requires a form VC6 does not support i.e.
+	ResourceSubclassPtr<T> : public SharedPtr<T>
+	*/
+	class _OgreExport GpuProgramPtr : public SharedPtr<GpuProgram> 
+	{
+	public:
+		GpuProgramPtr() : SharedPtr<GpuProgram>() {}
+		explicit GpuProgramPtr(GpuProgram* rep) : SharedPtr<GpuProgram>(rep) {}
+		GpuProgramPtr(const GpuProgramPtr& r) : SharedPtr<GpuProgram>(r) {} 
+		GpuProgramPtr(const ResourcePtr& r) : SharedPtr<GpuProgram>()
+		{
+			// lock & copy other mutex pointer
+            OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME)
+            {
+			    OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
+			    OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
+			    pRep = static_cast<GpuProgram*>(r.getPointer());
+			    pUseCount = r.useCountPointer();
+			    if (pUseCount)
+			    {
+				    ++(*pUseCount);
+			    }
+            }
+		}
+
+		/// Operator used to convert a ResourcePtr to a GpuProgramPtr
+		GpuProgramPtr& operator=(const ResourcePtr& r)
+		{
+			if (pRep == static_cast<GpuProgram*>(r.getPointer()))
+				return *this;
+			release();
+			// lock & copy other mutex pointer
+            OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME)
+            {
+                OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
+			    OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
+			    pRep = static_cast<GpuProgram*>(r.getPointer());
+			    pUseCount = r.useCountPointer();
+			    if (pUseCount)
+			    {
+				    ++(*pUseCount);
+			    }
+            }
+			return *this;
+		}
+        /// Operator used to convert a HighLevelGpuProgramPtr to a GpuProgramPtr
+        GpuProgramPtr& operator=(const HighLevelGpuProgramPtr& r);
+	};
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreOverlayContainer.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreOverlayContainer.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreOverlayContainer.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __OverlayContainer_H__
+#define __OverlayContainer_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreOverlayElement.h"
+#include "OgreIteratorWrappers.h"
+
+
+namespace Ogre {
+
+
+    /** 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 _OgreExport OverlayContainer : public OverlayElement
+    {
+    public:
+        typedef std::map<String, OverlayElement*> ChildMap;
+        typedef MapIterator<ChildMap> ChildIterator;
+        typedef std::map<String, OverlayContainer*> 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 void _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: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreTextureManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreTextureManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreTextureManager.h	(revision 1812)
@@ -0,0 +1,308 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _TextureManager_H__
+#define _TextureManager_H__
+
+
+#include "OgrePrerequisites.h"
+
+#include "OgreResourceManager.h"
+#include "OgreTexture.h"
+#include "OgreSingleton.h"
+
+
+namespace Ogre {
+
+    /** 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(bool enable32Bit = true);
+        virtual ~TextureManager();
+
+        /** 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 default (-1) 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)
+        */
+        virtual TexturePtr load( 
+            const String& name, const String& group, 
+            TextureType texType = TEX_TYPE_2D, int numMipmaps = -1, 
+            Real gamma = 1.0f, bool isAlpha = 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 default (-1) 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)
+        */
+        virtual TexturePtr loadImage( 
+            const String &name, const String& group, const Image &img, 
+            TextureType texType = TEX_TYPE_2D,
+            int iNumMipmaps = -1, Real gamma = 1.0f, bool isAlpha = 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, height The dimensions 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 default (-1) 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)
+        */
+        virtual TexturePtr loadRawData(const String &name, const String& group,
+            DataStreamPtr& stream, ushort uWidth, ushort uHeight, 
+            PixelFormat format, TextureType texType = TEX_TYPE_2D, 
+            int iNumMipmaps = -1, Real gamma = 1.0f);
+
+		/** 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, height, depth The dimensions of the texture
+            @param
+                numMipmaps The number of pre-filtered mipmaps to generate. If left to default (-1) 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.
+        */
+        virtual TexturePtr createManual(const String & name, const String& group,
+            TextureType texType, uint width, uint height, uint depth, 
+			int num_mips, PixelFormat format, int usage = TU_DEFAULT, ManualResourceLoader* loader = 0 );
+			
+        /** 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, height The dimensions of the texture
+            @param
+                numMipmaps The number of pre-filtered mipmaps to generate. If left to default (-1) 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.
+        */
+        TexturePtr createManual(const String & name, const String& group,
+            TextureType texType, uint width, uint height, int num_mips,
+            PixelFormat format, int usage = TU_DEFAULT, ManualResourceLoader* loader = 0 )
+		{
+			return createManual(name, group, texType, width, height, 1, 
+				num_mips, format, usage, loader);
+		}
+
+        /** Enables / disables 32-bit textures.
+        */
+        virtual void enable32BitTextures(bool setting = true);
+
+        /** Checks 32-bit textures enable setting.
+        */
+        virtual bool isEnable32BitTextures(void)
+        {
+            return mIs32Bit;
+        }
+
+		/** 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.
+		@returns 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
+			contraints of the current device.
+		*/
+		virtual PixelFormat getNativeFormat(TextureType ttype, PixelFormat format, int usage) = 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:
+
+        bool mIs32Bit;
+        size_t mDefaultNumMipmaps;
+    };
+}// Namespace
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreParticleEmitter.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreParticleEmitter.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreParticleEmitter.h	(revision 1812)
@@ -0,0 +1,473 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE 
+	(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under 
+the terms of the GNU Lesser General Public License as published by the Free Software 
+Foundation; either version 2 of the License, or (at your option) any later 
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT 
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with 
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple 
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to 
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#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"
+
+
+namespace Ogre {
+
+
+    /** 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 paramters within those
+        types.
+    */
+    class _OgreExport ParticleEmitter : public StringInterface
+    {
+    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::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;
+
+
+        /// 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, just used to speed up generation of variant directions
+        Vector3 mUp;
+        /// 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;
+
+        // 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(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 thte 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.
+        @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 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, wheras if you set it to 180 degrees or more,
+            particles will be emitted in a sphere, i.e. in all directions.
+        @param degrees
+            Maximum angle which initial particle direction can deviate from the emitter base direction vector.
+        */
+        virtual void setAngle(const Radian& angle);
+#ifndef OGRE_FORCE_ANGLE_TYPES
+        inline void setAngle(Real angle) {
+            setAngle ( Angle(angle) );
+        }
+#endif//OGRE_FORCE_ANGLE_TYPES
+
+        /** 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 incase 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;
+
+
+
+    };
+
+}
+
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePlane.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePlane.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePlane.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+// Original free version by:
+// Magic Software, Inc.
+// http://www.geometrictools.com/
+// Copyright (c) 2000, All Rights Reserved
+
+#ifndef __Plane_H__
+#define __Plane_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreVector3.h"
+
+namespace Ogre {
+
+    /** 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);
+        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
+        };
+
+        Side getSide (const Vector3& rkPoint) 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);
+
+		/** 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);
+
+		Vector3 normal;
+        Real d;
+        /// Comparison operator
+        bool operator==(const Plane& rhs) const
+        {
+            return (rhs.d == d && rhs.normal == normal);
+        }
+
+        _OgreExport friend std::ostream& operator<< (std::ostream& o, Plane& p);
+    };
+
+    typedef std::vector<Plane> PlaneList;
+
+} // namespace Ogre
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreInput.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreInput.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreInput.h	(revision 1812)
@@ -0,0 +1,382 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __Input_H__
+#define __Input_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+    /** Keyboard scan codes - copied from DirectInput for now for speed.
+    */
+    enum KeyCode
+    {
+        KC_ESCAPE          =0x01,
+        KC_1               =0x02,
+        KC_2               =0x03,
+        KC_3               =0x04,
+        KC_4               =0x05,
+        KC_5               =0x06,
+        KC_6               =0x07,
+        KC_7               =0x08,
+        KC_8               =0x09,
+        KC_9               =0x0A,
+        KC_0               =0x0B,
+        KC_MINUS           =0x0C,    /* - on main keyboard */
+        KC_EQUALS          =0x0D,
+        KC_BACK            =0x0E,    /* backspace */
+        KC_TAB             =0x0F,
+        KC_Q               =0x10,
+        KC_W               =0x11,
+        KC_E               =0x12,
+        KC_R               =0x13,
+        KC_T               =0x14,
+        KC_Y               =0x15,
+        KC_U               =0x16,
+        KC_I               =0x17,
+        KC_O               =0x18,
+        KC_P               =0x19,
+        KC_LBRACKET        =0x1A,
+        KC_RBRACKET        =0x1B,
+        KC_RETURN          =0x1C,    /* Enter on main keyboard */
+        KC_LCONTROL        =0x1D,
+        KC_A               =0x1E,
+        KC_S               =0x1F,
+        KC_D               =0x20,
+        KC_F               =0x21,
+        KC_G               =0x22,
+        KC_H               =0x23,
+        KC_J               =0x24,
+        KC_K               =0x25,
+        KC_L               =0x26,
+        KC_SEMICOLON       =0x27,
+        KC_APOSTROPHE      =0x28,
+        KC_GRAVE           =0x29,    /* accent grave */
+        KC_LSHIFT          =0x2A,
+        KC_BACKSLASH       =0x2B,
+        KC_Z               =0x2C,
+        KC_X               =0x2D,
+        KC_C               =0x2E,
+        KC_V               =0x2F,
+        KC_B               =0x30,
+        KC_N               =0x31,
+        KC_M               =0x32,
+        KC_COMMA           =0x33,
+        KC_PERIOD          =0x34,    /* . on main keyboard */
+        KC_SLASH           =0x35,    /* '/' on main keyboard */
+        KC_RSHIFT          =0x36,
+        KC_MULTIPLY        =0x37,    /* * on numeric keypad */
+        KC_LMENU           =0x38,    /* left Alt */
+        KC_SPACE           =0x39,
+        KC_CAPITAL         =0x3A,
+        KC_F1              =0x3B,
+        KC_F2              =0x3C,
+        KC_F3              =0x3D,
+        KC_F4              =0x3E,
+        KC_F5              =0x3F,
+        KC_F6              =0x40,
+        KC_F7              =0x41,
+        KC_F8              =0x42,
+        KC_F9              =0x43,
+        KC_F10             =0x44,
+        KC_NUMLOCK         =0x45,
+        KC_SCROLL          =0x46,    /* Scroll Lock */
+        KC_NUMPAD7         =0x47,
+        KC_NUMPAD8         =0x48,
+        KC_NUMPAD9         =0x49,
+        KC_SUBTRACT        =0x4A,    /* - on numeric keypad */
+        KC_NUMPAD4         =0x4B,
+        KC_NUMPAD5         =0x4C,
+        KC_NUMPAD6         =0x4D,
+        KC_ADD             =0x4E,    /* + on numeric keypad */
+        KC_NUMPAD1         =0x4F,
+        KC_NUMPAD2         =0x50,
+        KC_NUMPAD3         =0x51,
+        KC_NUMPAD0         =0x52,
+        KC_DECIMAL         =0x53,    /* . on numeric keypad */
+        KC_OEM_102         =0x56,    /* < > | on UK/Germany keyboards */
+        KC_F11             =0x57,
+        KC_F12             =0x58,
+        KC_F13             =0x64,    /*                     (NEC PC98) */
+        KC_F14             =0x65,    /*                     (NEC PC98) */
+        KC_F15             =0x66,    /*                     (NEC PC98) */
+        KC_KANA            =0x70,    /* (Japanese keyboard)            */
+        KC_ABNT_C1         =0x73,    /* / ? on Portugese (Brazilian) keyboards */
+        KC_CONVERT         =0x79,    /* (Japanese keyboard)            */
+        KC_NOCONVERT       =0x7B,    /* (Japanese keyboard)            */
+        KC_YEN             =0x7D,    /* (Japanese keyboard)            */
+        KC_ABNT_C2         =0x7E,    /* Numpad . on Portugese (Brazilian) keyboards */
+        KC_NUMPADEQUALS    =0x8D,    /* = on numeric keypad (NEC PC98) */
+        KC_PREVTRACK       =0x90,    /* Previous Track (KC_CIRCUMFLEX on Japanese keyboard) */
+        KC_AT              =0x91,    /*                     (NEC PC98) */
+        KC_COLON           =0x92,    /*                     (NEC PC98) */
+        KC_UNDERLINE       =0x93,    /*                     (NEC PC98) */
+        KC_KANJI           =0x94,    /* (Japanese keyboard)            */
+        KC_STOP            =0x95,    /*                     (NEC PC98) */
+        KC_AX              =0x96,    /*                     (Japan AX) */
+        KC_UNLABELED       =0x97,    /*                        (J3100) */
+        KC_NEXTTRACK       =0x99,    /* Next Track */
+        KC_NUMPADENTER     =0x9C,    /* Enter on numeric keypad */
+        KC_RCONTROL        =0x9D,
+        KC_MUTE            =0xA0,    /* Mute */
+        KC_CALCULATOR      =0xA1,    /* Calculator */
+        KC_PLAYPAUSE       =0xA2,    /* Play / Pause */
+        KC_MEDIASTOP       =0xA4,    /* Media Stop */
+        KC_VOLUMEDOWN      =0xAE,    /* Volume - */
+        KC_VOLUMEUP        =0xB0,    /* Volume + */
+        KC_WEBHOME         =0xB2,    /* Web home */
+        KC_NUMPADCOMMA     =0xB3,    /* , on numeric keypad (NEC PC98) */
+        KC_DIVIDE          =0xB5,    /* / on numeric keypad */
+        KC_SYSRQ           =0xB7,
+        KC_RMENU           =0xB8,    /* right Alt */
+        KC_PAUSE           =0xC5,    /* Pause */
+        KC_HOME            =0xC7,    /* Home on arrow keypad */
+        KC_UP              =0xC8,    /* UpArrow on arrow keypad */
+        KC_PGUP            =0xC9,    /* PgUp on arrow keypad */
+        KC_LEFT            =0xCB,    /* LeftArrow on arrow keypad */
+        KC_RIGHT           =0xCD,    /* RightArrow on arrow keypad */
+        KC_END             =0xCF,    /* End on arrow keypad */
+        KC_DOWN            =0xD0,    /* DownArrow on arrow keypad */
+        KC_PGDOWN          =0xD1,    /* PgDn on arrow keypad */
+        KC_INSERT          =0xD2,    /* Insert on arrow keypad */
+        KC_DELETE          =0xD3,    /* Delete on arrow keypad */
+        KC_LWIN            =0xDB,    /* Left Windows key */
+        KC_RWIN            =0xDC,    /* Right Windows key */
+        KC_APPS            =0xDD,    /* AppMenu key */
+        KC_POWER           =0xDE,    /* System Power */
+        KC_SLEEP           =0xDF,    /* System Sleep */
+        KC_WAKE            =0xE3,    /* System Wake */
+        KC_WEBSEARCH       =0xE5,    /* Web Search */
+        KC_WEBFAVORITES    =0xE6,    /* Web Favorites */
+        KC_WEBREFRESH      =0xE7,    /* Web Refresh */
+        KC_WEBSTOP         =0xE8,    /* Web Stop */
+        KC_WEBFORWARD      =0xE9,    /* Web Forward */
+        KC_WEBBACK         =0xEA,    /* Web Back */
+        KC_MYCOMPUTER      =0xEB,    /* My Computer */
+        KC_MAIL            =0xEC,    /* Mail */
+        KC_MEDIASELECT     =0xED     /* Media Select */
+    };
+
+    /** Structure representing a snapshot of the state of the mouse
+        input controller. */
+    struct _OgreExport MouseState
+    {
+        /** Absolute position of the mouse pointer. */
+        long Xabs, Yabs, Zabs;
+        /** Relative position of the mouse pointer. */
+        long Xrel, Yrel, Zrel;
+        /** The buttons that have been pressed. Each bit maps to a mouse
+        button. */
+        long Buttons;
+
+        /** Retrieves the pressed state of a mouse button. */
+        inline long isButtonDown( uchar button ) const
+        {
+            return Buttons & ( 1 << button );
+        }
+    };
+
+    /** Abstract class which allows input to be read from various
+        controllers.
+        @remarks
+            You can access an appropriate concrete subclass of this interface by
+            calling PlatformManager::createInputReader.
+        @warning Temporary implementation only. This class is likely to be
+            refactored into a better design when I get time to look at it
+            properly. For now it's a quick-and-dirty way to get what I need.
+        @see
+            PlatformManager::createInputReader
+    */
+    class _OgreExport InputReader
+    {
+    public:
+        InputReader();
+	    virtual ~InputReader();
+
+	    /** Tells the reader to use buffered input and update the passed in queue.
+        @remarks
+            The default behaviour of the input reader is simply to capture the
+            current state of the mouse / keyboard on demand. An alternative is to use 
+            buffered input where all events are registered on a queue.
+        */
+	    void useBufferedInput(EventQueue* pEventQueue, bool keys = true, bool mouse = true) ;
+
+	    virtual void setBufferedInput(bool keys, bool mouse) ;
+			
+
+		/** Initialise the input system.
+            @note
+                Only keyboard and mouse currently implemented.
+            @param
+                pWindow The window to capture input for
+            @param
+                useKeyboard If true, keyboard input will be supported.
+            @param
+                useMouse If true, mouse input will be supported.
+            @param
+                useGameController If true, joysticks/gamepads will be supported.
+        */
+        virtual void initialise( 
+            RenderWindow* pWindow, 
+            bool useKeyboard = true, 
+            bool useMouse = true, 
+            bool useGameController = false ) = 0;
+
+        /** Captures the state of all the input devices.
+            @remarks
+                This method captures the state of all input devices and
+                stores it internally for use when the enquiry methods are
+                next called. This is done to ensure that all input is
+                captured at once and therefore combinations of input are not
+                subject to time differences when methods are called.
+
+        */
+        virtual void capture() = 0;
+
+        /** Determines if the specified key is currently depressed.
+            @note In immediate mode, this enquiry method uses the state of the 
+                keyboard at the last 'capture' call.
+        */
+        virtual bool isKeyDown( KeyCode kc ) const;
+
+        /** Retrieves the relative position of the mouse when capture was
+            called relative to the last time. */
+        virtual long getMouseRelativeX() const { return getMouseRelX(); }
+
+        /** Retrieves the relative position of the mouse when capture was
+            called relative to the last time. */
+        virtual long getMouseRelativeY() const { return getMouseRelY(); }
+
+        /** Retrieves the relative position of the mouse when capture was
+            called relative to the last time. */
+        virtual long getMouseRelativeZ() const { return getMouseRelZ(); }
+
+        /** Retrieves the relative (compared to the last input poll) mouse movement
+            on the X (horizontal) axis. */
+        virtual long getMouseRelX() const = 0;
+
+        /** Retrieves the relative (compared to the last input poll) mouse movement
+            on the Y (vertical) axis. */
+        virtual long getMouseRelY() const = 0;
+
+        /** Retrieves the relative (compared to the last input poll) mouse movement
+            on the Z (mouse wheel) axis. */
+        virtual long getMouseRelZ() const = 0;
+
+        /** Retrieves the absolute mouse position on the X (horizontal) axis. */
+        virtual long getMouseAbsX() const = 0;
+        /** Retrieves the absolute mouse position on the Y (vertical) axis. */
+        virtual long getMouseAbsY() const = 0;
+        /** Retrieves the absolute mouse position on the Z (mouse wheel) axis. */
+        virtual long getMouseAbsZ() const = 0;
+
+        /** Retrieves the current state of the mouse. */
+        virtual void getMouseState( MouseState& state ) const = 0;
+
+        /** Retrieves the state of a mouse button. */
+        virtual bool getMouseButton( uchar button ) const = 0;
+
+		/** Adds a mouse motion listener to the cursor object.
+		    This keeps the Cursor object hidden. */
+		void addCursorMoveListener( MouseMotionListener* c );
+	
+		/** Remove a mouse motion listener to the cursor object.
+		    This keeps the Cursor object hidden. */
+		void removeCursorMoveListener( MouseMotionListener* c );
+		static char getKeyChar(int keyCode, long modifiers = 0);
+
+		/** Set mouse scale factor.
+		@param scale The new mouse scale (The default on is around 0.001/0.002).
+		*/
+		virtual void setMouseScale( Real scale ) { mMouseScale = scale; }
+		
+		/** Get mouse scale factor.
+		*/
+		virtual Real getMouseScale( void ) const { return mMouseScale; }
+		
+
+
+	protected:
+
+		/** The modifiers are a binary flags that represent what buttons are pressed, 
+            and what key modifiers are down (e.g. shift/alt). */
+		long mModifiers;
+
+		/// Speed of mouse
+		Real mMouseScale;
+
+		/** Internal Cursor object. 
+            @remarks
+                This is a mathematical representation of where the cursor is, it does 
+                not draw a cursor.
+            @see CursorGuiElement. */
+
+		Cursor* mCursor;
+
+		/** EventQueue is used for buffered input support. */
+		EventQueue* mEventQueue;
+
+		/** Wether to use buffering input support - buffering support relies on using 
+            an EventQueue. 
+            @see class EventQueue */
+		bool mUseBufferedKeys, mUseBufferedMouse;
+
+        /** The mouse state in immediate mode. */
+        MouseState mMouseState;
+
+        /// Set of all the keys currently depressed based on buffered input events
+        typedef std::set<KeyCode> BufferedKeysDownSet;
+        BufferedKeysDownSet mBufferedKeysDown;
+
+		/** Creates mouse moved or dragged events depending if any button is pressed. */
+		void mouseMoved();
+
+		/** Creates a MouseEvent that first gets processed by the cursor, then gets 
+            pushed on the queue. */
+		void createMouseEvent(int id, int button);
+
+		/** Creates mouse pressed, released, and clicked events. */
+		void triggerMouseButton(int nMouseCode, bool mousePressed);
+
+		void createKeyEvent(int id, int key);
+		void keyChanged(int key, bool down);
+		
+		/** Return whether a key is down in immediate mode. */
+        virtual bool isKeyDownImmediate( KeyCode kc ) const = 0;
+    };
+
+
+    /** Defines the interface a platform-specific library must implement.
+        @remarks
+            Any library (.dll, .so) wishing to implement a
+            platform-specific version of this input reader must export the
+            symbol 'createInputReader' with the signature void
+            createPlatformInputReader(InputReader** ppReader).
+    */
+    typedef void (*DLL_CREATEINPUTREADER)(InputReader** ppReader);
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreTextureUnitState.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreTextureUnitState.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreTextureUnitState.h	(revision 1812)
@@ -0,0 +1,1062 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://ogre.sourceforge.net/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#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"
+
+namespace Ogre {
+    /** 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
+    {
+        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 entended to supply reflection vectors for cube mapping
+            ENV_REFLECTION,
+            /// Envmap entended 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
+        };
+
+		/** 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 std::multimap<TextureEffectType, TextureEffect> EffectMap;
+
+        /** Default constructor.
+        */
+        TextureUnitState(Pass* parent);
+
+        TextureUnitState(Pass* parent, const TextureUnitState& oth );
+
+        TextureUnitState & operator = ( const TextureUnitState& oth );
+
+        /** Default destructor.
+        */
+        ~TextureUnitState();
+
+        /** Name-based constructor.
+        @param
+        name 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, int mipmaps = -1, bool isAlpha = false);
+
+        /** Gets how many mipmaps have been requested for the texture.
+		*/
+		int getNumRequestedMipMaps() const { return mTextureSrcMipmaps; }
+
+		/** Gets whether this texture is requested to be loaded as alpha if single channel
+		*/
+		bool isAlpha() const { return mIsAlpha; }
+
+		/** 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 orthoganal 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>
+        </ul>
+        @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 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 orthoganal 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>
+        </ul>
+        @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 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 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 layed 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< uint, uint > 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;
+
+        /** 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;
+
+        /** Gets the index of the set of texture co-ords this layer uses.
+        @note
+        Applies to both fixed-function and programmable pipeline.
+        */
+        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
+        Applies to both fixed-function and programmable pipeline.
+        */
+        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);
+#ifndef OGRE_FORCE_ANGLE_TYPES
+        inline void setTextureRotate(Real angle) {
+            setTextureRotate ( Degree(angle) );
+        }
+#endif//OGRE_FORCE_ANGLE_TYPES
+        // 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 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.
+        @param
+        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, wheras 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 environemnt 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 orthoganal 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
+        planar If set to true, instead of being based on normals the environment effect is based on
+        vertex positions. This is good for planar surfaces.
+        @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);
+
+        // 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. 
+        @params ftype The filtering type to set
+        @params opts The filtering option to set
+        */
+        void setTextureFiltering(FilterType ftype, FilterOptions opts);
+        /** Set a the detailed filtering options on this texture unit. 
+        @params minFilter The filtering to use when reducing the size of the texture. 
+            Can be FO_POINT, FO_LINEAR or FO_ANISOTROPIC
+        @params magFilter The filtering to use when increasing the size of the texture
+            Can be FO_POINT, FO_LINEAR or FO_ANISOTROPIC
+        @params 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;
+
+        /** Sets the anisotropy level to be used for this texture level.
+        @par 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;
+
+        /// Gets the parent Pass object
+        Pass* getParent(void) const { return mParent; }
+
+		/** 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);
+
+        // Is this loaded?
+        bool isLoaded(void);
+        /** 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 usefull 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 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 Texture Unit State.
+        */
+        bool applyTextureAliases(const AliasTextureNamePairList& aliasList, const bool apply = true);
+
+		/** Notify this object that its parent has changed */
+		void _notifyParent(Pass* parent);
+	
+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; 
+		int mTextureSrcMipmaps; // Request number of mipmaps
+
+        unsigned int mTextureCoordSetIndex;
+        UVWAddressingMode mAddressMode;
+        ColourValue mBorderColour;
+
+        LayerBlendModeEx colourBlendMode;
+        SceneBlendFactor colourBlendFallbackSrc;
+        SceneBlendFactor colourBlendFallbackDest;
+
+        LayerBlendModeEx alphaBlendMode;
+        bool mIsBlank;
+        bool mIsAlpha;
+
+        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;
+        ///Texture anisotropy
+        unsigned int mMaxAniso;
+
+        bool mIsDefaultAniso;
+        bool mIsDefaultFiltering;
+
+
+        //-----------------------------------------------------------------------------
+        // Complex members (those that can't be copied using memcpy) are at the end to 
+        // allow for fast copying of the basic members.
+        //
+        std::vector<String> mFrames;
+        String mName;               // optional name for the TUS
+        String mTextureNameAlias;       // optional alias for texture frames
+        EffectMap mEffects;
+        //-----------------------------------------------------------------------------
+
+        //-----------------------------------------------------------------------------
+        // 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);
+
+
+    };
+
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSingleton.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSingleton.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSingleton.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+/* 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)
+#endif
+
+namespace Ogre {
+// End SJS additions
+    /** Template class for creating single-instance global classes.
+    */
+    template <typename T> class Singleton
+    {
+    protected:
+
+        static T* ms_Singleton;
+
+    public:
+        Singleton( void )
+        {
+            assert( !ms_Singleton );
+#if defined( _MSC_VER ) && _MSC_VER < 1200	 
+            int offset = (int)(T*)1 - (int)(Singleton <T>*)(T*)1;
+            ms_Singleton = (T*)((int)this + offset);
+#else
+	    ms_Singleton = static_cast< T* >( this );
+#endif
+        }
+        ~Singleton( void )
+            {  assert( ms_Singleton );  ms_Singleton = 0;  }
+        static T& getSingleton( void )
+		{	assert( ms_Singleton );  return ( *ms_Singleton ); }
+        static T* getSingletonPtr( void )
+		{ return ms_Singleton; }
+    };
+}
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRectangle.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRectangle.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRectangle.h	(revision 1812)
@@ -0,0 +1,65 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://ogre.sourceforge.net/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _Rectangle_H__
+#define _Rectangle_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+    struct _OgreExport Rectangle
+    {
+        Real left;
+        Real top;
+        Real right;
+        Real bottom;
+
+        inline bool inside(Real x, Real y) const { return x >= left && x <= right && y >= top && y <= bottom; }
+    };
+
+    /** Geometric intersection of two rectanglar regions.
+     *
+     * @remarks Calculates the geometric intersection of two rectangular
+     * regions.  Rectangle coordinates must be ([0-N], [0-N]), such that
+     * (0,0) is in the upper left hand corner.
+     *
+     * If the two input rectangles do not intersect, then the result will be
+     * a degenerate rectangle, i.e. left >= right or top >= bottom, or both.
+     */
+    inline Rectangle intersect(const Rectangle& lhs, const Rectangle& rhs)
+    {
+        Rectangle r;
+
+        r.left   = lhs.left   > rhs.left   ? lhs.left   : rhs.left;
+        r.top    = lhs.top    > rhs.top    ? lhs.top    : rhs.top;
+        r.right  = lhs.right  < rhs.right  ? lhs.right  : rhs.right;
+        r.bottom = lhs.bottom < rhs.bottom ? lhs.bottom : rhs.bottom;
+
+        return r;
+    }
+
+}
+
+#endif // _Rectangle_H__
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreString.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreString.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreString.h	(revision 1812)
@@ -0,0 +1,145 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _String_H__
+#define _String_H__
+
+#include "OgrePrerequisites.h"
+
+// If we're using the GCC 3.1 C++ Std lib
+#if OGRE_COMPILER == OGRE_COMPILER_GNUC && OGRE_COMP_VER >= 310 && !defined(STLPORT)
+
+#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
+
+namespace Ogre {
+
+    /** Utility class for manipulating Strings.  */
+    class _OgreExport StringUtil
+    {
+	public:
+        typedef std::ostringstream StrStreamType;
+
+        /** Removes any whitespace characters, be it standard space or
+            TABs and so on.
+            @remarks
+                The user may specify wether 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.
+        */
+		static std::vector< String > split( const String& str, const String& delims = "\t\n ", unsigned int maxSplits = 0);
+
+        /** Upper-cases all the characters in the string.
+        */
+        static void toLowerCase( String& str );
+
+        /** Lower-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 end 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);
+
+        /** 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);
+
+        /** 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);
+
+
+
+
+
+        /// 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)
+    typedef ::__gnu_cxx::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
+
+#endif // _String_H__
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreFont.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreFont.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreFont.h	(revision 1812)
@@ -0,0 +1,359 @@
+/*-------------------------------------------------------------------------
+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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License (LGPL) as 
+published by the Free Software Foundation; either version 2.1 of the 
+License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful, but 
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public 
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License 
+along with this library; if not, write to the Free Software Foundation, 
+Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA or go to
+http://www.gnu.org/copyleft/lesser.txt
+-------------------------------------------------------------------------*/
+
+#ifndef _Font_H__
+#define _Font_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreResource.h"
+#include "OgreTexture.h"
+#include "OgreMaterial.h"
+
+namespace Ogre
+{
+    // Define the number of glyphs allowed
+    // We ignore 0-31 since these are control characters
+#if OGRE_WCHAR_T_STRINGS
+    // Allow wide chars
+    #define OGRE_NUM_GLYPHS (1024 - 32)
+#else
+    // Allow 8-bit ASCII 
+    // (we don't want to offend people with charcodes 127-256 in their name eh cearny? ;)
+    // Only chars 33+ are any use though
+    #define OGRE_NUM_GLYPHS (256 - 32)
+#endif
+
+    // How to look up chars
+    #define OGRE_GLYPH_INDEX(c) c - 33
+
+    /** 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 _OgreExport Font : public Resource, public ManualResourceLoader
+    {
+    protected:
+		/// Command object for Font - see ParamCommand 
+		class _OgreExport CmdType : public ParamCommand
+		{
+		public:
+			String doGet(const void* target) const;
+			void doSet(void* target, const String& val);
+		};
+		/// Command object for Font - see ParamCommand 
+		class _OgreExport CmdSource : public ParamCommand
+		{
+		public:
+			String doGet(const void* target) const;
+			void doSet(void* target, const String& val);
+		};
+		/// Command object for Font - see ParamCommand 
+		class _OgreExport CmdSize : public ParamCommand
+		{
+		public:
+			String doGet(const void* target) const;
+			void doSet(void* target, const String& val);
+		};
+		/// Command object for Font - see ParamCommand 
+		class _OgreExport CmdResolution : 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 CmdSize msSizeCmd;
+		static CmdResolution msResolutionCmd;
+
+		/// The type of font
+        FontType mType;
+
+        /// Source of the font (either an image name or a truetype font)
+        String mSource;
+
+        /// Size of the truetype font, in points
+        Real mTtfSize;
+        /// Resolution (dpi) of truetype font
+        uint mTtfResolution;
+
+
+        /// Start u coords
+        Real mTexCoords_u1[OGRE_NUM_GLYPHS];
+        /// End u coords
+        Real mTexCoords_u2[OGRE_NUM_GLYPHS];
+        /// Start v coords
+        Real mTexCoords_v1[OGRE_NUM_GLYPHS];
+        /// End v coords
+        Real mTexCoords_v2[OGRE_NUM_GLYPHS];
+
+        /// Aspect ratio between x and y (width / height)
+        Real mAspectRatio[OGRE_NUM_GLYPHS];
+
+        /// The material which is generated for this font
+        MaterialPtr mpMaterial;
+
+		/// Texture pointer
+		TexturePtr mTexture;
+
+        /// for TRUE_TYPE font only
+        bool mAntialiasColour;
+
+        /// 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.
+        @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 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;
+
+        /** Returns the size in pixels of a box that could contain the whole string.
+        */
+        std::pair< uint, uint > StrBBox( const String & text, Real char_height, RenderWindow & window  );
+
+
+        /** Returns the teture coordinates of the associated glyph. 
+            @remarks Parameter is a short to allow both ASCII and wide chars.
+            @param id The character code
+            @param u1, u2, v1, v2 location to place the results
+        */
+        inline void getGlyphTexCoords(OgreChar id, Real& u1, Real& v1, Real& u2, Real& v2 ) const
+        {
+            unsigned OgreChar idx = OGRE_GLYPH_INDEX(id);
+            u1 = mTexCoords_u1[ idx ];
+            v1 = mTexCoords_v1[ idx ];
+            u2 = mTexCoords_u2[ idx ];
+            v2 = mTexCoords_v2[ idx ];
+        }
+
+        /** 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. 
+        */
+        inline void setGlyphTexCoords( OgreChar id, Real u1, Real v1, Real u2, Real v2 )
+        {
+            unsigned OgreChar idx = OGRE_GLYPH_INDEX(id);
+            mTexCoords_u1[ idx ] = u1;
+            mTexCoords_v1[ idx ] = v1;
+            mTexCoords_u2[ idx ] = u2;
+            mTexCoords_v2[ idx ] = v2;
+            mAspectRatio[ idx ] = ( u2 - u1 ) / ( v2 - v1 );
+        }
+        /** Gets the aspect ratio (width / height) of this character. */
+        inline Real getGlyphAspectRatio( OgreChar id ) const
+        {
+            unsigned OgreChar idx = OGRE_GLYPH_INDEX(id);
+            return mAspectRatio[ idx ];
+        }
+        /** 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,
+            and your aspect ratio is really freaky.
+        */
+        inline void setGlyphAspectRatio( OgreChar id, Real ratio )
+        {
+            unsigned OgreChar idx = OGRE_GLYPH_INDEX(id);
+            mAspectRatio[ idx ] = ratio;
+        }
+        /** 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 mpMaterial;
+        }
+        /** 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 mpMaterial;
+        }
+        /** 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);
+    };
+	/** Specialisation of SharedPtr to allow SharedPtr to be assigned to FontPtr 
+	@note Has to be a subclass since we need operator=.
+	We could templatise this instead of repeating per Resource subclass, 
+	except to do so requires a form VC6 does not support i.e.
+	ResourceSubclassPtr<T> : public SharedPtr<T>
+	*/
+	class _OgreExport FontPtr : public SharedPtr<Font> 
+	{
+	public:
+		FontPtr() : SharedPtr<Font>() {}
+		explicit FontPtr(Font* rep) : SharedPtr<Font>(rep) {}
+		FontPtr(const FontPtr& r) : SharedPtr<Font>(r) {} 
+		FontPtr(const ResourcePtr& r) : SharedPtr<Font>()
+		{
+			// lock & copy other mutex pointer
+            OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME)
+            {
+			    OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
+			    OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
+			    pRep = static_cast<Font*>(r.getPointer());
+			    pUseCount = r.useCountPointer();
+			    if (pUseCount)
+			    {
+				    ++(*pUseCount);
+			    }
+            }
+		}
+
+		/// Operator used to convert a ResourcePtr to a FontPtr
+		FontPtr& operator=(const ResourcePtr& r)
+		{
+			if (pRep == static_cast<Font*>(r.getPointer()))
+				return *this;
+			release();
+			// lock & copy other mutex pointer
+            OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME)
+            {
+                OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
+			    OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
+			    pRep = static_cast<Font*>(r.getPointer());
+			    pUseCount = r.useCountPointer();
+			    if (pUseCount)
+			    {
+				    ++(*pUseCount);
+			    }
+            }
+			return *this;
+		}
+	};
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/stl_user_config.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/stl_user_config.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/stl_user_config.h	(revision 1812)
@@ -0,0 +1,204 @@
+/*
+ * Copyright (c) 1999 
+ * Boris Fomitchev
+ *
+ * This material is provided "as is", with absolutely no warranty expressed
+ * or implied. Any use is at your own risk.
+ *
+ * Permission to use or copy this software for any purpose is hereby granted 
+ * without fee, provided the above notices are retained on all copies.
+ * Permission to modify the code and to distribute modified code is granted,
+ * provided the above notices are retained, and a notice that the code was
+ * modified is included with the above copyright notice.
+ *
+ */
+
+/*
+ * Purpose of this file :
+ *
+ * To hold user-definable portion of STLport settings which may be overridden
+ * on per-project basis.
+ * Please note that if you use STLport iostreams (compiled library) then you have
+ * to use consistent settings when you compile STLport library and your project. 
+ * Those settings are defined in _site_config.h and have to be the same for a given
+ * STLport installation.
+ *
+ */
+
+
+//==========================================================
+// User-settable macros that control compilation:
+//              Features selection
+//==========================================================
+
+/* _STLP_NO_OWN_IOSTREAMS: 
+ * __STL_NO_SGI_IOSTREAMS (in older versions)
+ *  This is major configuration switch.
+ *  Turn it on to disable use of SGI iostreams and use wrappers 
+ *  around your compiler's iostreams, like before.
+ *  Keep it off if you want to use  SGI iostreams 
+ *  (Note that in this case you have to compile library in ../src
+ *  and supply resulting library at link time).
+ *
+ */
+
+// # define   _STLP_NO_OWN_IOSTREAMS	1
+
+
+/* 
+ * This macro only works in non-SGI iostreams mode.
+ *
+ * Uncomment to suppress using new-style streams even if they are
+ * available.
+ * Beware - _STLP_USE_OWN_NAMESPACE depends on this macro, too.
+ * Do that only if you are absolutely sure backwards-compatible 
+ * <iostream.h> is not actually a wrapper with <iostream>
+ * Hint : In VC++ 6.x, they are not.
+ */
+
+// #define   _STLP_NO_NEW_IOSTREAMS	1
+
+/*
+ * Use this switch for embedded systems where no iostreams are available
+ * at all. STLport own iostreams will also get disabled automatically then.
+ */
+// # define _STLP_NO_IOSTREAMS 1
+
+/* 
+ * Set _STLP_DEBUG to turn the "Debug Mode" on.
+ * That gets you checked iterators/ranges in the manner
+ * of "Safe STL". Very useful for debugging. Thread-safe.
+ * Please do not forget to link proper STLport library flavor
+ * (e.g libstlport_gcc_stldebug.a) when you set this flag in STLport iostreams mode.
+ */
+#ifdef _DEBUG
+	#define _STLP_DEBUG 1
+#endif
+
+
+/* 
+ *
+ *  _STLP_NO_CUSTOM_IO : define this if you do not instantiate basic_xxx iostream classes  with custom types (which is most likely the case).
+ *  Custom means types other than char, wchar and char_traits<>,
+ *  like basic_ostream<my_char_type, my_traits<my_char_type> >
+ *  When this option is on, most non-inline template functions definitions for iostreams are not seen by the client.
+ *  Default is off, just not to break compilation for those who do use those types.
+ *  which saves a lot of compile time for most compilers, also object and executable size for some.
+ *  That also guarantees that you still use optimized standard i/o when you compile your program without optimization. 
+ *  Option does not affect STLport library build; you may use the same binary library with and without this option, 
+ *  on per-project basis.
+ *
+ */
+//#define _STLP_NO_CUSTOM_IO
+
+
+/* 
+ * _STLP_NO_RELOPS_NAMESPACE: if defined, don't put the relational
+ * operator templates (>, <=. >=, !=) in namespace std::rel_ops, even
+ * if the compiler supports namespaces.
+ * Note : if the compiler do not support namespaces, those operators are not be provided by default,
+ * to simulate hiding them into rel_ops. This was proved to resolve many compiler bugs with ambiguity.
+ */
+
+// #define _STLP_NO_RELOPS_NAMESPACE 1
+
+
+/*
+ * If _STLP_USE_OWN_NAMESPACE is in effect, STLport by default will not try
+ * to rename std:: for the user
+ * to _STL::. If you do want this feature, please define the following switch :
+ */
+// # define _STLP_REDEFINE_STD 1
+
+
+/*
+ * _STLP_WHOLE_NATIVE_STD : only meaningful in _STLP_USE_OWN_NAMESPACE mode.
+ * Normally, STLport only imports necessary components from native std:: namespace -
+ * those not yet provided by STLport (<iostream>, <complex>, etc.) 
+ * and their dependencies (<string>, <stdexcept>). 
+ * You might want everything from std:: being available in std:: namespace when you
+ * include corresponding STLport header (like STLport <map> provides std::map as well, etc.),
+ * if you are going to use both stlport:: and std:: components in your code.
+ * Otherwise this option is not recommended as it increases the size of your object files
+ * and slows down compilation.
+ */
+// # define _STLP_WHOLE_NATIVE_STD
+
+
+/*
+ * Use this option to catch uninitialized members in your classes.
+ * When it is set, construct() and destroy() fill the class storage
+ * with _STLP_SHRED_BYTE (see below). 
+ * Note : _STLP_DEBUG and _STLP_DEBUG_ALLOC don't set this option automatically.
+ */
+
+// # define _STLP_DEBUG_UNINITIALIZED 1
+
+/*
+ * Uncomment and provide a definition for the byte with which raw memory
+ * will be filled if _STLP_DEBUG_ALLOC or _STLP_DEBUG_UNINITIALIZED is defined. 
+ * Choose a value which is likely to cause a noticeable problem if dereferenced 
+ * or otherwise abused. A good value may already be defined for your platform; see
+ * stl_config.h
+ */
+// #define _STLP_SHRED_BYTE 0xA3
+
+/*
+ *  This option is for gcc users only and only affects systems where native linker
+ *  does not let gcc to implement automatic instantiation of static template data members/
+ *  It is being put in this file as there is no way to check if we are using GNU ld automatically,
+ *  so it becomes user's responsibility.
+ * 
+ */
+
+// #define _STLP_GCC_USES_GNU_LD
+
+
+//==========================================================
+// Compatibility section
+//==========================================================
+
+/*
+ *  Define this macro to disable anachronistic constructs (like the ones used in HP STL and
+ *  not included in final standard, etc. 
+ */
+// define _STLP_NO_ANACHRONISMS 1
+
+/*
+ *  Define this macro to disable STLport extensions (for example, to make sure your code will 
+ *  compile with some other implementation )
+ */
+// define _STLP_NO_EXTENSIONS   1
+
+
+/* 
+ * You should define this macro if compiling with MFC - STLport <stl/_config.h>
+ * then include <afx.h> instead of <windows.h> to get synchronisation primitives 
+ *
+ */
+
+// # define _STLP_USE_MFC 1
+
+
+// boris : this setting is here as we cannot detect precense of new Platform SDK automatically 
+// If you are using new PSDK with VC++ 6.0 or lower, please define this to get correct prototypes for InterlockedXXX functions
+//# define _STLP_NEW_PLATFORM_SDK 1
+
+/*
+ * Use minimum set of default arguments on template classes that have more
+ * than one - for example map<>, set<>.
+ * This has effect only if _STLP_LIMITED_DEFAULT_TEMPLATES is on.
+ * If _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS is set, you'll be able to compile
+ * set<T> with those compilers, but you'll have to use __set__<T, less<T>>
+ *
+ * Affects : map<>, multimap<>, set<>, multiset<>, hash_*<>, 
+ * queue<>, priority_queue<>, stack<>, istream_iterator<>
+ */
+
+// # define _STLP_MINIMUM_DEFAULT_TEMPLATE_PARAMS 1
+
+//==========================================================
+
+// Local Variables:
+// mode:C++
+// End:
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMeshSerializerImpl.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMeshSerializerImpl.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMeshSerializerImpl.h	(revision 1812)
@@ -0,0 +1,199 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#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 {
+
+
+    /** 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.
+    */
+    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 filename The destination filename
+		@param endianMode The endian mode for the written file
+        */
+        void exportMesh(const Mesh* pMesh, const String& filename,
+			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);
+
+    protected:
+
+        bool mIsSkeletallyAnimated;
+
+        // 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);
+        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 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(void);
+        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);
+        virtual void readSubMesh(DataStreamPtr& stream, Mesh* pMesh);
+        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);
+        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 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);
+
+
+        /// 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.2 of the .mesh format. */
+    class _OgrePrivate MeshSerializerImpl_v1_2 : public MeshSerializerImpl
+    {
+    public:
+        MeshSerializerImpl_v1_2();
+        ~MeshSerializerImpl_v1_2();
+    protected:
+        virtual void readMesh(DataStreamPtr& stream, Mesh* pMesh);
+        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. */
+    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: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePositionTarget.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePositionTarget.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePositionTarget.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+/***************************************************************************
+OgrePositionTarget.h  -  
+	A position target is a component that can be targeted by any mouse click or 
+	event that relies on an xy position.
+
+	It supports nesting, so the left and top are relative to its parent.
+
+-------------------
+begin                : Nov 19 2002
+copyright            : (C) 2002 by Kenny Sabir
+email                : kenny@sparksuit.com
+***************************************************************************/
+
+
+#ifndef __PositionTarget_H__
+#define __PositionTarget_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreEventTarget.h"
+
+namespace Ogre {
+
+    class _OgreExport PositionTarget : public EventTarget
+    {
+	public:
+		virtual ~PositionTarget() {}
+        /** Gets the left of this element in relation to the screen (where 0 = far left, 1.0 = far right)  */
+        virtual Real getLeft(void) const = 0;
+
+        /** Gets the top of this element in relation to the screen (where 0 = top, 1.0 = bottom)  */
+        virtual Real getTop(void) const = 0;
+
+		virtual PositionTarget* getPositionTargetParent() const = 0;
+
+		virtual bool isKeyEnabled() const = 0;
+
+    };
+}
+
+
+#endif //__EventTarget_H__
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePatchMesh.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePatchMesh.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePatchMesh.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __PatchMesh_H__
+#define __PatchMesh_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreMesh.h"
+#include "OgrePatchSurface.h"
+
+namespace Ogre {
+
+    /** 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);
+
+        /// 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);
+
+    };
+    /** Specialisation of SharedPtr to allow SharedPtr to be assigned to PatchMeshPtr 
+    @note Has to be a subclass since we need operator=.
+    We could templatise this instead of repeating per Resource subclass, 
+    except to do so requires a form VC6 does not support i.e.
+    ResourceSubclassPtr<T> : public SharedPtr<T>
+    */
+    class _OgreExport PatchMeshPtr : public SharedPtr<PatchMesh> 
+    {
+    public:
+        PatchMeshPtr() : SharedPtr<PatchMesh>() {}
+        explicit PatchMeshPtr(PatchMesh* rep) : SharedPtr<PatchMesh>(rep) {}
+        PatchMeshPtr(const PatchMeshPtr& r) : SharedPtr<PatchMesh>(r) {} 
+        PatchMeshPtr(const ResourcePtr& r) : SharedPtr<PatchMesh>()
+        {
+			// lock & copy other mutex pointer
+            OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME)
+            {
+			    OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
+			    OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
+                pRep = static_cast<PatchMesh*>(r.getPointer());
+                pUseCount = r.useCountPointer();
+                if (pUseCount)
+                {
+                    ++(*pUseCount);
+                }
+            }
+        }
+
+        /// Operator used to convert a ResourcePtr to a PatchMeshPtr
+        PatchMeshPtr& operator=(const ResourcePtr& r)
+        {
+            if (pRep == static_cast<PatchMesh*>(r.getPointer()))
+                return *this;
+            release();
+
+            OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME)
+            {
+			    // lock & copy other mutex pointer
+			    OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
+			    OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
+                pRep = static_cast<PatchMesh*>(r.getPointer());
+                pUseCount = r.useCountPointer();
+                if (pUseCount)
+                {
+                    ++(*pUseCount);
+                }
+            }
+            return *this;
+        }
+        /// Operator used to convert a MeshPtr to a PatchMeshPtr
+        PatchMeshPtr& operator=(const MeshPtr& r)
+        {
+            if (pRep == static_cast<PatchMesh*>(r.getPointer()))
+                return *this;
+            release();
+			// lock & copy other mutex pointer
+            OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME)
+            {
+			    OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
+			    OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
+                pRep = static_cast<PatchMesh*>(r.getPointer());
+                pUseCount = r.useCountPointer();
+                if (pUseCount)
+                {
+                    ++(*pUseCount);
+                }
+            }
+            return *this;
+        }
+    };
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreDynLibManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreDynLibManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreDynLibManager.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __DynLibManager_H__
+#define __DynLibManager_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreSingleton.h"
+
+namespace Ogre {
+    /** 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>
+    {
+	protected:
+		typedef std::map<String, DynLib*> 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 ommitted
+        */
+        DynLib* load(const String& filename);
+
+		/** Unloads the passed library.
+		@param
+		filename The name of the library. The extension can be ommitted
+		*/
+		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);
+    };
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSkeletonManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSkeletonManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSkeletonManager.h	(revision 1812)
@@ -0,0 +1,94 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __SkeletonManager_H__
+#define __SkeletonManager_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreResourceManager.h"
+#include "OgreSingleton.h"
+
+namespace Ogre {
+
+    /** 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();
+
+        /** 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: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreTimer.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreTimer.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreTimer.h	(revision 1812)
@@ -0,0 +1,71 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __Timer_H__
+#define __Timer_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre
+{
+    /** Platform-independent Timer class. 
+    @remarks
+        You should never create a Timer instance manually; instead, use PlatformManager::createTimer.
+    */
+    class _OgreExport Timer 
+	{
+	protected:	
+		clock_t zeroClock ;
+	
+	public:
+		/** Creates a timer. 
+        @remarks
+            You must call reset() after creating it; the constructor cannot do it because the 
+            call would not be polymorphic.
+		*/
+		Timer() ;
+        virtual ~Timer() { }
+		
+		/** Resets timer 
+		*/
+		virtual void reset();
+		
+		/** Returns milliseconds since initialisation or last reset
+		*/
+		virtual unsigned long getMilliseconds() ;
+		
+		/** Returns milliseconds since initialisation or last reset, only CPU time measured
+		*/	
+		virtual unsigned long getMillisecondsCPU();
+		
+		/** Returns microseconds since initialisation or last reset
+		*/
+		virtual unsigned long getMicroseconds() ;
+		
+		/** Returns microseconds since initialisation or last reset, only CPU time measured
+		*/	
+		virtual unsigned long getMicrosecondsCPU();
+	} ;
+}
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreAnimationState.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreAnimationState.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreAnimationState.h	(revision 1812)
@@ -0,0 +1,206 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __AnimationSet_H__
+#define __AnimationSet_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreString.h"
+#include "OgreController.h"
+#include "OgreIteratorWrappers.h"
+
+namespace Ogre {
+
+    /** Represents the state of an animation and the weight of it's influence. 
+    @remarks
+        Other classes can hold instances of this class to store the state of any animations
+        they are using.
+    */
+    class _OgreExport AnimationState 
+    {
+    public:
+        /// Normal constructor with all params supplied
+        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);
+		/** Destructor - is here because class has virtual functions and some compilers 
+			would whine if it won't exist.
+		*/
+		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
+        @remarks
+            This method loops at the edges if animation looping is enabled.
+        */
+        void addTime(Real offset);
+
+        /// 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; }
+
+    protected:
+        String mAnimationName;
+		AnimationStateSet* mParent;
+        Real mTimePos;
+        Real mLength;
+        Real mInvLength;
+        Real mWeight;
+        bool mEnabled;
+        bool mLoop;
+
+    };
+
+	// A map of animation states
+	typedef std::map<String, AnimationState*> AnimationStateMap;
+	typedef MapIterator<AnimationStateMap> AnimationStateIterator;
+	typedef ConstMapIterator<AnimationStateMap> ConstAnimationStateIterator;
+    // A list of enabled animation states
+    typedef std::list<AnimationState*> EnabledAnimationStateList;
+    typedef ConstVectorIterator<EnabledAnimationStateList> ConstEnabledAnimationStateIterator;
+
+	/** Class encapsulating a set of AnimationState objects.
+	*/
+	class _OgreExport AnimationStateSet
+	{
+	public:
+		/// 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
+		AnimationStateIterator getAnimationStateIterator(void);
+		/// Get an iterator over all the animation states in this set
+		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
+		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);
+
+	};
+
+
+}
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCompiler2Pass.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCompiler2Pass.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCompiler2Pass.h	(revision 1812)
@@ -0,0 +1,645 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.stevestreeting.com/ogre/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/gpl.html.
+-----------------------------------------------------------------------------
+*/
+
+
+#ifndef __Compiler2Pass_H__
+#define __Compiler2Pass_H__
+
+#include <vector>
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+    /** Compiler2Pass is a generic 2 pass compiler/assembler
+    @remarks
+	    provides a tokenizer in pass 1 and relies on the subclass to provide the virtual method for pass 2
+
+	    PASS 1 - tokenize source: this is a simple brute force lexical scanner/analyzer that also parses
+			    the formed token for proper semantics and context in one pass
+			    it uses top down (recursive descent) ruling based on Backus - Naur Form (BNF) notation for semantic
+			    checking.
+
+			    During Pass1, if a terminal token is identified as having an action then that action gets triggered
+			    when the next terminal token is uncountered that has an action.
+
+	    PASS 2 - generate application specific instructions ie native instructions based on the tokens in the instruction container.
+
+    @par
+	    this class must be subclassed with the subclass providing some implementation details for Pass 2.  The subclass
+	    is responsible for setting up the token libraries along with defining the language syntax and handling
+        token actions during the second pass.
+
+    @par
+        The sub class normally supplies a simplified BNF text description in its constructor prior to doing any parsing/tokenizing of source.
+        The simplified BNF text description defines the language syntax and rule structure.
+        The meta-symbols used in the BNF text description are:
+    @par
+        ::=  meaning "is defined as". "::=" starts the definition of a rule.  The left side of ::= must contain an <identifier>
+    @par
+        <>   angle brackets are used to surround syntax rule names. A syntax rule name is also called a non-terminal in that
+             it does not generate a terminal token in the instruction container for pass 2 processing.
+    @par
+        |    meaning "or". if the item on the left of the | fails then the item on the right is tested.
+             Example: <true_false> ::= 'true' | 'false';
+             whitespace is used to imply AND operation between left and right items.
+             Example: <terrain_shadaws> ::= 'terrain_shadows' <true_false>
+             the 'terrain_shadows' terminal token must be found and <true_false> rule must pass in order for <terrain_shadows> rule
+             to pass.
+    @par
+        []   optional rule identifier is enclosed in meta symbols [ and ].
+             Note that only one identifier or terminal token can take [] modifier.
+    @par
+        {}   repetitive identifier (zero or more times) is enclosed in meta symbols { and }
+             Note that only one identifier or terminal token can take {} modifier.
+    @par
+        ''   terminal tokens are surrounded by single quotes.  A terminal token is always one or more characters.
+             For example: 'Colour' defines a character sequence that must be matched in whole.  Note that matching is case
+             sensitive.
+    @par
+        @    turn on single character scanning and don't skip white space.
+             Mainly used for label processing that allow white space.
+             Example: '@ ' prevents the white space between the quotes from being skipped
+    @par
+        -''  no terminal token is generated when a - precedes the first single quote but the text in between the quotes is still
+             tested against the characters in the source being parsed.
+    @par
+        (?! ) negative lookahead (not test) inspired by Perl 5. Scans ahead for a non-terminal or terminal expression
+             that should fail in order to make the rule production pass.
+             Does not generate a token or advance the cursur.  If the lookahead result fails ie token is found,
+             then the current rule fails and rollback occurs.  Mainly used to solve multiple contexts of a token.
+             An Example of where not test is used to solve multiple contexts:
+
+             <rule>       ::=  <identifier>  "::="  <expression>\n
+             <expression> ::=  <and_term> { <or_term> }\n
+             <or_term>    ::=  "|" <and_term>\n
+             <and_term>   ::=  <term> { <term> }\n
+             <term>       ::=  <identifier_right> | <terminal_symbol> | <repeat_expression> | <optional_expression>\n
+             <identifier_right> ::= <identifier> (?!"::=")
+
+             <identiefier> appears on both sides of the ::= so (?!"::=") test to make sure that ::= is not on the
+             right which would indicate that a new rule was being formed.
+
+             Works on both terminals and non-terminals.
+             Note: lookahead failure causes the whole rule to fail and rollback to occur
+
+    @par
+        <#name> # indicates that a numerical value is to be parsed to form a terminal token.  Name is optional and is just a descriptor
+             to help with understanding what the value will be used for.
+             Example: <Colour> ::= <#red> <#green> <#blue>
+
+    @par
+        ()   parentheses enclose a set of characters that can be used to generate a user identifier. for example:
+             (0123456789) matches a single character found in that set.
+             An example of a user identifier:
+
+    @par
+             <Label> ::= <Character> {<Character>}\n
+             <Character> ::= (abcdefghijklmnopqrstuvwxyz)
+
+             This will generate a rule that accepts one or more lowercase letters to make up the Label.  The User identifier
+             stops collecting the characters into a string when a match cannot be found in the rule.
+
+    @par
+        (! ) if the first character in the set is a ! then any input character not found in the set will be
+             accepted.
+             An example:
+
+             <Label> ::= <AnyCharacter_NoLineBreak> {<AnyCharacter_NoLineBreak>}\n
+             <AnyCharacter_NoLineBreak> ::= (!\n\r)
+
+             any character but \n or \r is accepted in the input.
+
+    @par
+        :   Insert the terminal token on the left before the next terminal token on the right if the next terminal token on right parses.
+             Usefull for when terminal tokens don't have a definate text state but only context state based on another terminal or character token.
+             An example:
+
+             <Last_Resort> ::= 'external_command' : <Special_Label>\n
+             <Special_Label> ::= (!\n\r\t)
+
+             In the example, <Last_Resort> gets processed when all other rules fail to parse.
+             if <Special_Label> parses (reads in any character but \n\r\t) then the terminal token 'external_command'
+             is inserted prior to the Special_Label for pass 2 processing.  'external_command' does not have have an explicit text
+             representation but based on the context of no other rules matching and <Special_Label> parsing, 'external_command' is
+             considered parsed.
+    */
+    class _OgreExport Compiler2Pass
+    {
+
+    protected:
+
+	    // BNF operation types
+	    enum OperationType {otUNKNOWN, otRULE, otAND, otOR, otOPTIONAL,
+                            otREPEAT, otDATA, otNOT_TEST, otINSERT_TOKEN, otEND};
+
+	    /** structure used to build rule paths
+
+	    */
+	    struct TokenRule
+        {
+		    OperationType operation;
+		    size_t tokenID;
+
+            TokenRule(void) : operation(otUNKNOWN), tokenID(0) {}
+            TokenRule(const OperationType ot, const size_t token)
+                : operation(ot), tokenID(token) {}
+	    };
+
+	    typedef std::vector<TokenRule> TokenRuleContainer;
+	    typedef TokenRuleContainer::iterator TokenRuleIterator;
+
+        static const size_t SystemTokenBase = 1000;
+        enum SystemRuleToken {
+            _no_token_ = SystemTokenBase,
+            _character_,
+            _value_,
+            _no_space_skip_
+        };
+
+	    enum BNF_ID {BNF_UNKOWN = 0,
+            BNF_SYNTAX, BNF_RULE, BNF_IDENTIFIER, BNF_IDENTIFIER_RIGHT, BNF_IDENTIFIER_CHARACTERS, BNF_ID_BEGIN, BNF_ID_END,
+            BNF_CONSTANT_BEGIN, BNF_SET_RULE, BNF_EXPRESSION,
+            BNF_AND_TERM, BNF_OR_TERM, BNF_TERM, BNF_TERM_ID, BNF_CONSTANT, BNF_OR, BNF_TERMINAL_SYMBOL, BNF_TERMINAL_START,
+            BNF_REPEAT_EXPRESSION, BNF_REPEAT_BEGIN, BNF_REPEAT_END, BNF_SET, BNF_SET_BEGIN, BNF_SET_END,
+            BNF_NOT_TEST, BNF_NOT_TEST_BEGIN, BNF_CONDITIONAL_TOKEN_INSERT, BNF_OPTIONAL_EXPRESSION,
+            BNF_NOT_EXPRESSION, BNF_NOT_CHK,
+            BNF_OPTIONAL_BEGIN, BNF_OPTIONAL_END, BNF_NO_TOKEN_START, BNF_SINGLEQUOTE, BNF_SINGLE_QUOTE_EXC, BNF_SET_END_EXC,
+            BNF_ANY_CHARACTER, BNF_SPECIAL_CHARACTERS1,
+            BNF_SPECIAL_CHARACTERS2, BNF_WHITE_SPACE_CHK,
+
+            BNF_LETTER, BNF_LETTER_DIGIT, BNF_DIGIT, BNF_WHITE_SPACE,
+            BNF_ALPHA_SET, BNF_NUMBER_SET, BNF_SPECIAL_CHARACTER_SET1,
+			BNF_SPECIAL_CHARACTER_SET2, BNF_SPECIAL_CHARACTER_SET3, BNF_NOT_CHARS
+        };
+
+
+	    /** structure used to build lexeme Type library */
+	    struct LexemeTokenDef
+        {
+	        size_t ID;					/// Token ID which is the index into the Lexeme Token Definition Container
+            bool hasAction;            /// has an action associated with it. only applicable to terminal tokens
+            bool isNonTerminal;        /// if true then token is non-terminal
+	        size_t ruleID;				/// index into Rule database for non-terminal token rulepath and lexeme
+	        bool isCaseSensitive;        /// if true use case sensitivity when comparing lexeme to source
+            String lexeme;             /// text representation of token or valid characters for label parsing
+
+            LexemeTokenDef(void) : ID(0), hasAction(false), isNonTerminal(false), ruleID(0), isCaseSensitive(false) {}
+            LexemeTokenDef( const size_t ID, const String& lexeme, const bool hasAction = false, const bool caseSensitive = false )
+                : ID(ID)
+                , hasAction(hasAction)
+                , isNonTerminal(false)
+                , ruleID(0)
+                , isCaseSensitive(caseSensitive)
+                , lexeme(lexeme)
+            {
+            }
+
+	    };
+
+        typedef std::vector<LexemeTokenDef> LexemeTokenDefContainer;
+        typedef LexemeTokenDefContainer::iterator LexemeTokenDefIterator;
+
+        typedef std::map<std::string, size_t> LexemeTokenMap;
+        typedef LexemeTokenMap::iterator TokenKeyIterator;
+        /// map used to lookup client token based on previously defined lexeme
+
+
+	    /** structure for Token instructions that are constructed during first pass*/
+	    struct TokenInst
+        {
+	    size_t NTTRuleID;			/// Non-Terminal Token Rule ID that generated Token
+	    size_t tokenID;					/// expected Token ID. Could be UNKNOWN if valid token was not found.
+	    size_t line;				/// line number in source code where Token was found
+	    size_t pos;				/// Character position in source where Token was found
+        bool found;                /// is true if expected token was found
+	    };
+
+	    typedef std::vector<TokenInst> TokenInstContainer;
+	    typedef TokenInstContainer::iterator TokenInstIterator;
+
+        // token que, definitions, rules
+        struct TokenState
+        {
+            TokenInstContainer       tokenQue;
+            LexemeTokenDefContainer  lexemeTokenDefinitions;
+	        TokenRuleContainer       rootRulePath;
+            LexemeTokenMap           lexemeTokenMap;
+        };
+
+        TokenState* mClientTokenState;
+
+	    /// Active token que, definitions, rules currntly being used by parser
+        TokenState* mActiveTokenState;
+        /// the location within the token instruction container where pass 2 is
+        mutable size_t mPass2TokenQuePosition;
+        /** the que position of the previous token that had an action.
+            A token's action is fired on the next token having an action.
+        */
+        size_t mPreviousActionQuePosition;
+        /** the que position for the next token that has an action.
+        */
+        size_t mNextActionQuePosition;
+
+	    /// pointer to the source to be compiled
+	    const String* mSource;
+	    /// name of the source to be compiled
+	    String mSourceName;
+	    size_t mEndOfSource;
+
+	    size_t mCurrentLine; /// current line number in source being tokenized
+        size_t mCharPos;     /// position in current line in source being tokenized
+        size_t mErrorCharPos; /// character position in source where last error occured
+
+	    /// storage container for constants defined in source
+        /// container uses Token index as a key associated with a float constant
+	    std::map<size_t, float> mConstants;
+	    /// storage container for string labels defined in source
+        /// container uses Token index as a key associated with a label
+        std::map<size_t, String> mLabels;
+        /// flag indicates when a label is being parsed.
+        /// It gets set false when a terminal token not of _character_ is encountered
+        bool mLabelIsActive;
+        /// the key of the active label being built during pass 1.
+        /// a new key is calculated when mLabelIsActive switches from false to true
+        size_t mActiveLabelKey;
+        /// flag being true indicates that spaces are not to be skipped
+        /// automatically gets set to false when mLabelIsActive goes to false
+        bool mNoSpaceSkip;
+        /// if flag is true then next terminal token is not added to token que if found
+        /// but does effect rule path flow
+        bool mNoTerminalToken;
+        /// TokenID to insert if next rule finds a terminal token
+        /// if zero then no token inserted
+        size_t mInsertTokenID;
+
+	    /// Active Contexts pattern used in pass 1 to determine which tokens are valid for a certain context
+	    uint mActiveContexts;
+
+	    /** perform pass 1 of compile process
+		    scans source for lexemes that can be tokenized and then
+		    performs general semantic and context verification on each lexeme before it is tokenized.
+		    A tokenized instruction list is built to be used by Pass 2.
+            A rule path can trigger Pass 2 execution if enough tokens have been generated in Pass 1.
+            Pass 1 will then pass control to pass 2 temporarily until the current tokens have been consumed.
+
+	    */
+	    bool doPass1();
+
+	    /** performs Pass 2 of compile process which is execution of the tokens
+	    @remark
+		    Pass 2 takes the token instructions generated in Pass 1 and
+		    builds the application specific instructions along with verifying
+		    symantic and context rules that could not be checked in Pass 1.
+        @par
+            Pass 2 execution consumes tokens and moves the Pass 2 token instruction position towards the end
+            of the token container.  Token execution can insert new tokens into the token container.
+	    */
+	    bool doPass2();
+
+        /** execute the action associated with the token pointed to by the Pass 2 token instruction position.
+        @remarks
+            Its upto the child class to implement how it will associate a token key with and action.
+            Actions should be placed at positions withing the BNF grammer (instruction que) that indicate
+            enough tokens exist for pass 2 processing to take place.
+        */
+        virtual void executeTokenAction(const size_t tokenID) = 0;
+        /** setup client token definitions.  Gets called when BNF grammer is being setup.
+        */
+        virtual void setupTokenDefinitions(void) = 0;
+        /** Gets the next token from the instruction que.
+        @remarks
+            If an unkown token is found then an exception is raised but
+            the instruction pointer is still moved passed the unknown token.  The subclass should catch the exception,
+            provide an error message, and attempt recovery.
+
+        @param expectedTokenID if greater than 0 then an exception is raised if tokenID does not match.
+        */
+        const TokenInst& getNextToken(const size_t expectedTokenID = 0) const
+        {
+            skipToken();
+            return getCurrentToken(expectedTokenID);
+        }
+        /** Gets the current token from the instruction que.
+        @remarks
+            If an unkown token is found then an exception is raised.
+            The subclass should catch the exception, provide an error message, and attempt recovery.
+
+        @param expectedTokenID if greater than 0 then an exception is raised if tokenID does not match.
+
+        */
+        const TokenInst& getCurrentToken(const size_t expectedTokenID = 0) const;
+        /** If a next token instruction exist then test if its token ID matches.
+        @remarks
+            This method is usefull for peeking ahead during pass 2 to see if a certain
+            token exists.
+        @param expectedTokenID is the ID of the token to match.
+        */
+        bool testNextTokenID(const size_t expectedTokenID) const;
+
+        /** If a current token instruction exist then test if its token ID matches.
+        @param expectedTokenID is the ID of the token to match.
+        */
+        bool testCurrentTokenID(const size_t expectedTokenID) const
+        {
+            return mActiveTokenState->tokenQue[mPass2TokenQuePosition].tokenID == expectedTokenID;
+        }
+        /** skip to the next token in the pass2 queue.
+        */
+        void skipToken(void) const;
+        /** go back to the previous token in the pass2 queue.
+        */
+        void replaceToken(void);
+        /** Gets the next token's associated floating point value in the instruction que that was parsed from the
+            text source.  If an unkown token is found or no associated value was found then an exception is raised but
+            the instruction pointer is still moved passed the unknown token.  The subclass should catch the exception,
+            provide an error message, and attempt recovery.
+        */
+        float getNextTokenValue(void) const
+        {
+            skipToken();
+            return getCurrentTokenValue();
+        }
+        /** Gets the current token's associated floating point value in the instruction que that was parsed from the
+            text source.
+        @remarks
+            If an unkown token is found or no associated value was found then an exception is raised.
+            The subclass should catch the exception, provide an error message, and attempt recovery.
+        */
+        float getCurrentTokenValue(void) const;
+        /** Gets the next token's associated text label in the instruction que that was parsed from the
+            text source.
+        @remarks
+            If an unkown token is found or no associated label was found then an exception is raised but
+            the instruction pointer is still moved passed the unknown token.  The subclass should catch the exception,
+            provide an error message, and attempt recovery.
+        */
+        const String& getNextTokenLabel(void) const
+        {
+            skipToken();
+            return getCurrentTokenLabel();
+        }
+        /** Gets the next token's associated text label in the instruction que that was parsed from the
+            text source.  If an unkown token is found or no associated label was found then an exception is raised.
+            The subclass should catch the exception, provide an error message, and attempt recovery.
+        */
+        const String& getCurrentTokenLabel(void) const;
+        /** Get the next token's ID value.
+        */
+        size_t getNextTokenID(void) const { return getNextToken().tokenID; }
+        /** Get the current token's ID value.
+        */
+        size_t getCurrentTokenID(void) const { return getCurrentToken().tokenID; }
+        /** Get the next token's lexeme string.  Handy when you don't want the ID but want the string
+            representation.
+        */
+        const String& getNextTokenLexeme(void) const
+        {
+            skipToken();
+            return getCurrentTokenLexeme();
+        }
+        /** Get the current token's lexeme string.  Handy when you don't want the ID but want the string
+            representation.
+        */
+        const String& getCurrentTokenLexeme(void) const;
+        /** Gets the number of tokens waiting in the instruction que that need to be processed by an token action in pass 2.
+        */
+        size_t getPass2TokenQueCount(void) const;
+        /** Get the number of tokens not processed by action token.
+            Client Actions should use this method to retreive the number of parameters(tokens)
+            remaining to be processed in the action.
+        */
+        size_t getRemainingTokensForAction(void) const;
+        /** Manualy set the Pass2 Token que position.
+        @remarks
+            This method will also set the position of the next token in the pass2 que that
+            has an action ensuring that getRemainingTokensForAction works currectly.
+            This method is useful for when the token que must be reprocessed after
+            pass1 and the position in the que must be changed so that an action will be triggered.
+        @param pos is the new position within the Pass2 que
+        @param activateAction if set true and the token at the new position has an action then the
+            action is activated.
+        */
+        void setPass2TokenQuePosition(size_t pos, const bool activateAction = false);
+        /** Get the current position in the Pass2 Token Que.
+        */
+        size_t getPass2TokenQuePosition(void) const { return mPass2TokenQuePosition; }
+        /** Set the position of the next token action in the Pass2 Token Que.
+        @remarks
+            If the position is not within the que or there is no action associated with
+            the token at the position in the que then NextActionQuePosition is not set.
+        @param pos is the position in the Pass2 Token Que where the next action is.
+        @param search if true then the que is searched from pos until an action is found.
+            If the end of the que is reached and no action has been found then NextActionQuePosition
+            is set to the end of the que and false is returned.
+        */
+        bool setNextActionQuePosition(size_t pos, const bool search = false);
+        /** Add a lexeme token association.
+        @remarks
+            The backend compiler uses the associations between lexeme and token when
+            building the rule base from the BNF script so all associations must  be done
+            prior to compiling a source.
+        @param lexeme is the name of the token and use when parsing the source to determin a match for a token.
+        @param token is the ID associated with the lexeme
+        @param hasAction must be set true if the client wants an action triggered when this token is generated
+        @param caseSensitive should be set true if lexeme match should use case sensitivity
+        */
+        void addLexemeToken(const String& lexeme, const size_t token, const bool hasAction = false, const bool caseSensitive = false);
+
+        /** Sets up the parser rules for the client based on the BNF Grammer text passed in.
+        @remarks
+            Raises an exception if the grammer did not compile successfully.  This method gets called
+            when a call to compile occurs and no compiled BNF grammer exists, otherwise nothing will happen since the compiler has no rules to work
+            with.  The grammer only needs to be set once during the lifetime of the compiler unless the
+            grammer changes.
+        @note
+            BNF Grammer rules are cached once the BNF grammer source is compiled.
+            The client should never have to call this method directly.
+        */
+        void setClientBNFGrammer(void);
+
+
+
+        /// find the eol charater
+	    void findEOL();
+
+	    /** check to see if the text at the present position in the source is a numerical constant
+	    @param fvalue is a reference that will receive the float value that is in the source
+	    @param charsize reference to receive number of characters that make of the value in the source
+	    @return
+		    true if characters form a valid float representation
+		    false if a number value could not be extracted
+	    */
+	    bool isFloatValue(float& fvalue, size_t& charsize) const;
+
+        /** Check if source at current position is supposed to be a user defined character label.
+        A new label is processed when previous operation was not _character_ otherwise the processed
+        character (if match was found) is added to the current label.  This allows _character_ operations
+        to be chained together to form a crude regular expression to build a label.
+	    @param rulepathIDX index into rule path database of token to validate.
+	    @return
+		    true if token was found for character label.
+        */
+        bool isCharacterLabel(const size_t rulepathIDX);
+	    /** check to see if the text is in the lexeme text library
+	    @param lexeme points to begining of text where a lexem token might exist
+	    @param caseSensitive set to true if match should be case sensitive
+	    @return
+		    true if a matching token could be found in the token type library
+		    false if could not be tokenized
+	    */
+	    bool isLexemeMatch(const String& lexeme, const bool caseSensitive) const;
+	    /// position to the next possible valid sysmbol
+	    bool positionToNextLexeme();
+	    /** process input source text using rulepath to determine allowed tokens
+	    @remarks
+		    the method is reentrant and recursive
+		    if a non-terminal token is encountered in the current rule path then the method is
+		    called using the new rule path referenced by the non-terminal token
+		    Tokens can have the following operation states which effects the flow path of the rule
+			    RULE: defines a rule path for the non-terminal token
+			    AND: the token is required for the rule to pass
+			    OR: if the previous tokens failed then try these ones
+			    OPTIONAL: the token is optional and does not cause the rule to fail if the token is not found
+			    REPEAT: the token is required but there can be more than one in a sequence
+                DATA: Used by a previous token ie for character sets
+                NOTTEST: performs negative lookahead ie make sure the next token is not of a certain type
+			    END: end of the rule path - the method returns the succuss of the rule
+
+	    @param rulepathIDX index into an array of Token Rules that define a rule path to be processed
+	    @return
+		    true if rule passed - all required tokens found
+		    false if one or more tokens required to complete the rule were not found
+	    */
+	    bool processRulePath( size_t rulepathIDX);
+
+
+	    /** setup ActiveContexts - should be called by subclass to setup initial language contexts
+        */
+	    void setActiveContexts(const uint contexts){ mActiveContexts = contexts; }
+
+	    /// comment specifiers are hard coded
+	    void skipComments();
+
+	    /// find end of line marker and move past it
+	    void skipEOL();
+
+	    /// skip all the white space which includes spaces and tabs
+	    void skipWhiteSpace();
+
+
+	    /** check if current position in source has the lexeme text equivalent to the TokenID
+	    @param rulepathIDX index into rule path database of token to validate
+	    @param activeRuleID index of non-terminal rule that generated the token
+	    @return
+		    true if token was found
+		    false if token lexeme text does not match the source text
+		    if token is non-terminal then processRulePath is called
+	    */
+	    bool ValidateToken(const size_t rulepathIDX, const size_t activeRuleID);
+
+	    /** scan through all the rules and initialize token definition with index to rules for non-terminal tokens.
+            Gets called when internal grammer is being verified or after client grammer has been parsed.
+        @param grammerName is the name of the grammer the token rules are for
+	    */
+	    void verifyTokenRuleLinks(const String& grammerName);
+	    /** Checks the last token instruction and if it has an action then it triggers the action of the previously
+            found token having an action.
+	    */
+	    void checkTokenActionTrigger(void);
+	    /** Get the text representation of the rule path.  This is a good way to way to visually verify
+	    that the BNF grammer did compile correctly.
+	    @param ruleID is the index into the rule path.
+	    @param level is the number of levels a non-terminal will expand to. Defaults to 0 if not set which
+            will cause non-terminals to not expand.
+	    */
+	    String getBNFGrammerTextFromRulePath(size_t ruleID, const size_t level = 0);
+
+
+    private:
+        // used for interpreting BNF script
+        // keep it as static so that only one structure is created
+        // no matter how many times this class is instantiated.
+        static TokenState mBNFTokenState;
+        // maintain a map of BNF grammer
+        typedef std::map<String, TokenState> TokenStateContainer;
+        static TokenStateContainer mClientTokenStates;
+        /// if a previous token action was setup then activate it now
+        void activatePreviousTokenAction(void);
+        /// initialize token definitions and rule paths
+        void initBNFCompiler(void);
+        /// Convert BNF grammer token que created in pass 1 into a BNF rule path
+        void buildClientBNFRulePaths(void);
+        /// modify the last rule in the container. An end operation is added to the rule path.
+        void modifyLastRule(const OperationType pendingRuleOp, const size_t tokenID);
+        /** get the token ID for a lexeme in the client state. If the lexeme is not found then
+            it is added to the map and definition container and a new tokenID created.
+        @return the ID of the token.
+        */
+        size_t getClientLexemeTokenID(const String& lexeme, const bool isCaseSensitive = false);
+        /// Extract a Non Terminal identifier from the token que
+        void extractNonTerminal(const OperationType pendingRuleOp);
+        /// Extract a Terminal lexeme from the token que and add to current rule expression
+        void extractTerminal(const OperationType pendingRuleOp, const bool notoken = false);
+        /// Extract a set from the token que and add to current rule expression
+        void extractSet(const OperationType pendingRuleOp);
+        /// Extract a numeric constant from the token que and add it to the current rule expression
+        void extractNumericConstant(const OperationType pendingRuleOp);
+        /// changes previous terminal token rule into a conditional terminal token insert rule
+        void setConditionalTokenInsert(void);
+        /// get the lexem text of a rule.
+        String getLexemeText(size_t& ruleID, const size_t level = 0);
+
+    public:
+
+	    /// constructor
+	    Compiler2Pass();
+        virtual ~Compiler2Pass() {}
+
+	    /** compile the source - performs 2 passes.
+		    First pass is to tokinize, check semantics and context.
+		    The second pass is performed by using tokens to look up function implementors and executing
+            them which convert tokens to application specific instructions.
+	    @remark
+		    Pass 2 only gets executed if Pass 1 has built enough tokens to complete a rule path and found no errors
+	    @param source a pointer to the source text to be compiled
+	    @return
+		    true if Pass 1 and Pass 2 are successfull
+		    false if any errors occur in Pass 1 or Pass 2
+	    */
+	    bool compile(const String& source, const String& sourceName);
+        /** gets BNF Grammer.  Gets called when BNF grammer has to be compiled for the first time.
+        */
+        virtual const String& getClientBNFGrammer(void) = 0;
+
+        /** get the name of the BNF grammer.
+        */
+        virtual const String& getClientGrammerName(void) const = 0;
+
+    };
+
+}
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreFileSystem.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreFileSystem.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreFileSystem.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __FileSystem_H__
+#define __FileSystem_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreArchive.h"
+#include "OgreArchiveFactory.h"
+
+namespace Ogre {
+
+    /** Specialisation of the Archive class to allow reading of files from 
+        filesystem folders / directories.
+    */
+    class _OgreExport FileSystemArchive : public Archive 
+    {
+	public:
+		OGRE_AUTO_MUTEX
+    protected:
+        /// Base path; actually the same as mName, but for clarity
+        String mBasePath;
+
+        /// Directory stack of previous directories
+        typedef std::deque<String> DirectoryStack;
+        mutable DirectoryStack mDirectoryStack;
+
+        #define OGRE_MAX_PATH 256
+        /// temporary C-string to retrieve paths
+        mutable char mTmpPath[OGRE_MAX_PATH];
+
+        /** Utility method to retrieve all files in a directory matching pattern.
+        @param pattern File pattern
+        @param recursive Whether to cascade down directories
+        @param simpleList Populated if retrieving a simple list
+        @param detailList Populated if retrieving a detailed list
+        @param currentDir The current directory relative to the base of the 
+            archive, for file naming
+        */
+        void findFiles(const String& pattern, bool recursive, StringVector* simpleList,
+            FileInfoList* detailList, const String& currentDir = "");
+
+        /// Utility method to change the current directory
+        void changeDirectory(const String& dir) const;
+        /// Utility method to change directory and push the current directory onto a stack
+        void pushDirectory(const String& dir) const;
+        /// Utility method to pop a previous directory off the stack and change to it
+        void popDirectory(void) const;
+
+    public:
+        FileSystemArchive(const String& name, const String& archType );
+        ~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) const;
+
+        /// @copydoc Archive::list
+        StringVectorPtr list(bool recursive = true );
+
+        /// @copydoc Archive::listFileInfo
+        FileInfoListPtr listFileInfo(bool recursive = true );
+
+        /// @copydoc Archive::find
+        StringVectorPtr find(const String& pattern, bool recursive = true);
+
+        /// @copydoc Archive::findFileInfo
+        FileInfoListPtr findFileInfo(const String& pattern, bool recursive = true);
+
+        /// @copydoc Archive::exists
+		bool exists(const String& filename);
+
+    };
+
+    /** Specialisation of ArchiveFactory for FileSystem files. */
+    class _OgrePrivate FileSystemArchiveFactory : public ArchiveFactory
+    {
+    public:
+        virtual ~FileSystemArchiveFactory() {}
+        /// @copydoc FactoryObj::getType
+        const String& getType(void) const;
+        /// @copydoc FactoryObj::createInstance
+        Archive *createInstance( const String& name ) 
+        {
+            return new FileSystemArchive(name, "FileSystem");
+        }
+        /// @copydoc FactoryObj::destroyInstance
+        void destroyInstance( Archive* arch) { delete arch; }
+    };
+
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreExternalTextureSource.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreExternalTextureSource.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreExternalTextureSource.h	(revision 1812)
@@ -0,0 +1,180 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _OgreExternalTextureSource_H
+#define _OgreExternalTextureSource_H
+ 
+/***************************************************************************
+OgreExternalTextureSource.h  -  
+	Base class that texture plugins need to derive from. This provides the hooks
+	neccessary 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 exmaple 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"
+
+namespace Ogre
+{
+	/** Enum for type of texture play mode */
+	enum eTexturePlayMode
+	{
+		TextureEffectPause = 0,			//! Video starts out paused
+		TextureEffectPlay_ASAP = 1,		//! Video starts playing as soon as posible
+		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
+		const 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 Textute 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 tecnique, 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;
+	};
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreTechnique.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreTechnique.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreTechnique.h	(revision 1812)
@@ -0,0 +1,482 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __Technique_H__
+#define __Technique_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreBlendMode.h"
+#include "OgreCommon.h"
+#include "OgrePass.h"
+
+namespace Ogre {
+    /** 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
+    {
+    protected:
+        // illumination pass state type
+        enum IlluminationPassesState
+        {
+            IPS_COMPILE_DISABLED = -1,
+            IPS_NOT_COMPILED = 0,
+            IPS_COMPILED = 1
+        };
+
+        typedef std::vector<Pass*> Passes;
+        /// List of primary passes
+        Passes mPasses;
+        /// List of derived passes, categorised into IlluminationStage (ordered)
+        IlluminationPassList mIlluminationPasses;
+        Material* mParent; // raw pointer since we don't want child to stop parent's destruction
+        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;
+        String mName; // optional name for the technique
+
+        /// Internal method for clearing illumination pass list
+        void clearIlluminationPasses(void);
+    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. */
+        void _compile(bool autoManageTextureUnits);
+        /** Internal method for splitting the passes into illumination passes. */        
+        void _compileIlluminationPasses(void);
+
+
+        /** Creates a new Pass for this Technique.
+        @remarks
+            A Pass is a single rendering pass, ie 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;
+
+        /** 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);
+
+
+        // -------------------------------------------------------------------------------
+        // 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(ushort bias);
+
+        /** 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 );
+
+        /** 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);
+
+        /** 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 usefull in material scripts where a material could inherit
+        from another material and only want to modify a particalar 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;
+
+
+    };
+
+
+}
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreProgressiveMesh.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreProgressiveMesh.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreProgressiveMesh.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+// The underlying algorithms in this class are based heavily on:
+/*
+ *  Progressive Mesh type Polygon Reduction Algorithm
+ *  by Stan Melax (c) 1998
+ */
+
+#ifndef __ProgressiveMesh_H_
+#define __ProgressiveMesh_H_
+
+#include "OgrePrerequisites.h"
+#include "OgreVector3.h"
+#include "OgreHardwareVertexBuffer.h"
+#include "OgreHardwareIndexBuffer.h"
+#include "OgreRenderOperation.h"
+
+namespace Ogre {
+
+    /** This class reduces the complexity of the geometry it is given.
+        This class is dedicated to reducing the number of triangles in a given mesh
+        taking into account seams in both geometry and texture co-ordinates and meshes 
+        which have multiple frames.
+    @par
+        The primary use for this is generating LOD versions of Mesh objects, but it can be
+        used by any geometry provider. The only limitation at the moment is that the 
+        provider uses a common vertex buffer for all LODs and one index buffer per LOD.
+        Therefore at the moment this class can only handle indexed geometry.
+    @par
+        NB the interface of this class will certainly change when compiled vertex buffers are
+        supported.
+    */
+    class _OgreExport ProgressiveMesh
+    {
+    public:
+
+		/** The way to derive the quota of vertices which are reduced at each LOD. */
+        enum VertexReductionQuota
+		{
+			/// A set number of vertices are removed at each reduction
+			VRQ_CONSTANT,
+			/// A proportion of the remaining number of vertices are removed at each reduction
+			VRQ_PROPORTIONAL
+		};
+
+        typedef std::vector<IndexData*> LODFaceList;
+
+        /** Constructor, takes the geometry data and index buffer. 
+		@remarks
+			DO NOT pass write-only, unshadowed buffers to this method! They will not
+			work. Pass only shadowed buffers, or better yet perform mesh reduction as
+			an offline process using DefaultHardwareBufferManager to manage vertex
+			buffers in system memory.
+		*/
+        ProgressiveMesh(const VertexData* vertexData, const IndexData* indexData);
+        virtual ~ProgressiveMesh();
+
+        /** Adds an extra vertex position buffer. 
+        @remarks
+            As well as the main vertex buffer, the client of this class may add extra versions
+            of the vertex buffer which will also be taken into account when the cost of 
+            simplifying the mesh is taken into account. This is because the cost of
+            simplifying an animated mesh cannot be calculated from just the reference position,
+            multiple positions needs to be assessed in order to find the best simplification option.
+		@par
+			DO NOT pass write-only, unshadowed buffers to this method! They will not
+			work. Pass only shadowed buffers, or better yet perform mesh reduction as
+			an offline process using DefaultHardwareBufferManager to manage vertex
+			buffers in system memory.
+        @param buffer Pointer to x/y/z buffer with vertex positions. The number of vertices
+            must be the same as in the original GeometryData passed to the constructor.
+        */
+        virtual void addExtraVertexPositionBuffer(const VertexData* vertexData);
+
+        /** Builds the progressive mesh with the specified number of levels.
+        @param numLevels The number of levels to include in the output excluding the full detail version.
+        @param outList Pointer to a list of LOD geometry data which will be completed by the application.
+			Each entry is a reduced form of the mesh, in decreasing order of detail.
+		@param quota The way to derive the number of vertices removed at each LOD
+		@param reductionValue Either the proportion of vertices to remove at each level, or a fixed
+			number of vertices to remove at each level, depending on the value of quota
+        */
+        virtual void build(ushort numLevels, LODFaceList* outList, 
+			VertexReductionQuota quota = VRQ_PROPORTIONAL, Real reductionValue = 0.5f );
+
+    protected:
+        const VertexData *mpVertexData;
+        const IndexData *mpIndexData;
+
+        size_t mCurrNumIndexes;
+		size_t mNumCommonVertices;
+
+        // Internal classes
+        class PMTriangle;
+        class PMVertex;
+
+        public: // VC6 hack
+
+        /** A vertex as used by a face. This records the index of the actual vertex which is used
+		by the face, and a pointer to the common vertex used for surface evaluation. */
+		class _OgrePrivate PMFaceVertex {
+		public:
+			size_t realIndex;
+			PMVertex* commonVertex;
+		};
+
+        protected:
+
+        /** A triangle in the progressive mesh, holds extra info like face normal. */
+        class _OgrePrivate PMTriangle {
+        public:
+            PMTriangle();
+            void setDetails(size_t index, PMFaceVertex *v0, PMFaceVertex *v1, PMFaceVertex *v2);
+	        void computeNormal(void);
+	        void replaceVertex(PMFaceVertex *vold, PMFaceVertex *vnew);
+	        bool hasCommonVertex(PMVertex *v) const;
+	        bool hasFaceVertex(PMFaceVertex *v) const;
+			PMFaceVertex* getFaceVertexFromCommon(PMVertex* commonVert);
+	        void notifyRemoved(void);
+
+	        PMFaceVertex* vertex[3]; // the 3 points that make this tri
+	        Vector3   normal;    // unit vector othogonal to this face
+            bool      removed;   // true if this tri is now removed
+			size_t index;
+        };
+
+        /** A vertex in the progressive mesh, holds info like collapse cost etc. 
+		This 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.
+		*/
+        class _OgrePrivate PMVertex {
+        public:
+            PMVertex();
+	        void setDetails(const Vector3& v, size_t index);
+	        void removeIfNonNeighbor(PMVertex *n);
+			bool isBorder(void);/// true if this vertex is on the edge of an open geometry patch
+			bool isManifoldEdgeWith(PMVertex* v); // is edge this->src a manifold edge?
+			void notifyRemoved(void);
+
+            Vector3  position;  // location of point in euclidean space
+	        size_t index;       // place of vertex in original list
+            typedef std::set<PMVertex *> NeighborList;
+            typedef std::set<PMVertex *> DuplicateList;
+            NeighborList neighbor; // adjacent vertices
+	        typedef std::set<PMTriangle *> FaceList;
+            FaceList face;     // adjacent triangles
+
+	        Real collapseCost;  // cached cost of collapsing edge
+	        PMVertex * collapseTo; // candidate vertex for collapse
+            bool      removed;   // true if this vert is now removed
+			bool	  toBeRemoved; // denug
+
+			bool seam;	/// true if this vertex is on a model seam where vertices are duplicated
+
+        };
+
+        typedef std::vector<PMTriangle> TriangleList;
+        typedef std::vector<PMFaceVertex> FaceVertexList;
+        typedef std::vector<PMVertex> CommonVertexList;
+        typedef std::vector<Real> WorstCostList;
+
+        /// Data used to calculate the collapse costs
+        struct PMWorkingData
+        {
+            TriangleList mTriList; /// List of faces
+            FaceVertexList mFaceVertList; // The vertex details referenced by the triangles
+			CommonVertexList mVertList; // The master list of common vertices
+        };
+
+        typedef std::vector<PMWorkingData> WorkingDataList;
+        /// Multiple copies, 1 per vertex buffer
+        WorkingDataList mWorkingData;
+
+        /// The worst collapse cost from all vertex buffers for each vertex
+        WorstCostList mWorstCosts;
+
+        /// Internal method for building PMWorkingData from geometry data
+        void addWorkingData(const VertexData* vertexData, const IndexData* indexData);
+
+        /// Internal method for initialising the edge collapse costs
+        void initialiseEdgeCollapseCosts(void);
+        /// Internal calculation method for deriving a collapse cost  from u to v
+        Real computeEdgeCollapseCost(PMVertex *src, PMVertex *dest);
+        /// Internal method evaluates all collapse costs from this vertex and picks the lowest for a single buffer
+        Real computeEdgeCostAtVertexForBuffer(WorkingDataList::iterator idata, size_t vertIndex);
+        /// Internal method evaluates all collapse costs from this vertex for every buffer and returns the worst
+        void computeEdgeCostAtVertex(size_t vertIndex);
+        /// Internal method to compute edge collapse costs for all buffers /
+        void computeAllCosts(void);
+        /// Internal method for getting the index of next best vertex to collapse
+        size_t getNextCollapser(void);
+        /// Internal method builds an new LOD based on the current state
+        void bakeNewLOD(IndexData* pData);
+
+        /** Internal method, collapses vertex onto it's saved collapse target. 
+        @remarks
+            This updates the working triangle list to drop a triangle and recalculates
+            the edge collapse costs around the collapse target. 
+            This also updates all the working vertex lists for the relevant buffer. 
+        */
+        void collapse(PMVertex *collapser);
+
+		/** Internal debugging method */
+		void dumpContents(const String& log);
+
+
+
+
+
+
+
+
+
+    };
+
+
+
+}
+
+#endif 
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreConfigDialog.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreConfigDialog.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreConfigDialog.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __ConfigDialog_H__
+#define __ConfigDialog_H__
+
+// Precompiler options
+#include "OgrePrerequisites.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:
+    	virtual ~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
+        */
+        virtual bool display(void) = 0;
+    protected:
+        RenderSystem* mSelectedRenderSystem;
+    };
+
+    /// Defines the interface OgrePlatform.dll/OgrePlatform.so must implement
+    typedef void (*DLL_CREATECONFIGDIALOG)(ConfigDialog** ppDlg);
+
+}
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCompositorSerializer.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCompositorSerializer.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCompositorSerializer.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __CompositorSerializer_H__
+#define __CompositorSerializer_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreDataStream.h"
+
+namespace Ogre {
+
+    class CompositorScriptCompiler;
+
+    /** Class for serializing Compositors to / from a .compositor script.*/
+    class _OgreExport CompositorSerializer
+    {
+
+    public:
+		/** default constructor*/
+		CompositorSerializer();
+		/** default destructor*/
+		virtual ~CompositorSerializer();
+        /** Parses a Compositor script file passed as a stream.
+        */
+        void parseScript(DataStreamPtr& stream, const String& groupName);
+
+    protected:
+        CompositorScriptCompiler* mScriptCompiler;
+
+    };
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMatrix4.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMatrix4.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMatrix4.h	(revision 1812)
@@ -0,0 +1,526 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __Matrix4__
+#define __Matrix4__
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+
+#include "OgreVector3.h"
+#include "OgreMatrix3.h"
+#include "OgreVector4.h"
+#include "OgrePlane.h"
+namespace Ogre
+{
+    /** Class encapsulating a standard 4x4 homogenous 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 tranformations 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 cummatative, 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 id 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);
+        }
+        
+
+        inline Real* operator [] ( size_t iRow )
+        {
+            assert( iRow < 4 );
+            return m[iRow];
+        }
+
+        inline const Real *const 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.0 / ( 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();
+            ret.normal.x =
+                invTrans[0][0] * p.normal.x + invTrans[0][1] * p.normal.y + invTrans[0][2] * p.normal.z;
+            ret.normal.y = 
+                invTrans[1][0] * p.normal.x + invTrans[1][1] * p.normal.y + invTrans[1][2] * p.normal.z;
+            ret.normal.z = 
+                invTrans[2][0] * p.normal.x + invTrans[2][1] * p.normal.y + invTrans[2][2] * p.normal.z;
+            Vector3 pt = p.normal * -p.d;
+            pt = *this * pt;
+            ret.d = - pt.dotProduct(ret.normal);
+            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];
+
+        }
+
+        /** 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 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)
+        {
+            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& m )
+        {
+            o << "Matrix4(";
+			for (size_t i = 0; i < 4; ++i)
+            {
+                o << " row" << (unsigned)i << "{";
+                for(size_t j = 0; j < 4; ++j)
+                {
+                    o << m[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);
+    };
+
+    /* 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: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreBlendMode.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreBlendMode.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreBlendMode.h	(revision 1812)
@@ -0,0 +1,241 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __BLENDMODE_H__
+#define __BLENDMODE_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreColourValue.h"
+
+namespace Ogre {
+
+    /** 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,
+        /// dotproduct 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
+
+    };
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSceneManagerEnumerator.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSceneManagerEnumerator.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSceneManagerEnumerator.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __SceneManagerEnumerator_H__
+#define __SceneManagerEnumerator_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreSceneManager.h"
+#include "OgreSingleton.h"
+#include "OgreIteratorWrappers.h"
+
+namespace Ogre {
+    
+	/// 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:
+		/// Scene manager instances, indexed by instance name
+		typedef std::map<String, SceneManager*> Instances;
+		/// List of available scene manager types as meta data
+		typedef std::vector<const SceneManagerMetaData*> MetaDataList;
+    private:
+		/// Scene manager factories
+		typedef std::list<SceneManagerFactory*> 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;
+
+		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);
+
+    };
+
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreKeyEvent.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreKeyEvent.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreKeyEvent.h	(revision 1812)
@@ -0,0 +1,108 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General  License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General  License for more details.
+
+You should have received a copy of the GNU Lesser General  License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+/***************************************************************************
+OgreKeyEvent.h  -  
+ *
+-------------------
+begin                : Dec 03 2002
+copyright            : (C) 2002 by Kenny Sabir
+email                : kenny@sparksuit.com
+***************************************************************************/
+#ifndef __KeyEvent_H__
+#define __KeyEvent_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreInputEvent.h"
+
+namespace Ogre {
+
+/**
+ * @version 1.22 04/22/99
+ * @author Carl Quinn
+ */
+    class _OgreExport KeyEvent : public InputEvent
+    {
+    protected:
+
+		/**
+		 * Which key was pressed
+		 */
+
+		int mKey;
+
+	public:
+
+		enum
+		{
+			KE_FIRST_EVENT = 2500,
+			KE_LAST_EVENT = 2504
+		};
+
+		enum 
+		{
+			KE_KEY_CLICKED 	= KE_FIRST_EVENT,
+			KE_KEY_PRESSED,
+			KE_KEY_RELEASED,
+            KE_KEY_FOCUSIN,
+            KE_KEY_FOCUSOUT
+		};
+
+		/**
+		 * Constructs a KeyEvent object with the specified source KeyTarget,
+		 * type, modifiers, coordinates, and click count.
+		 *
+		 * @param source       the KeyTarget that originated the event
+		 * @param id           the integer that identifies the event
+		 * @param when         a long int that gives the time the event occurred
+		 * @param modifiers    the modifier keys down during event
+		 *                     (shift, ctrl, alt, meta)
+		 * @param x            the horizontal x coordinate for the key location
+		 * @param y            the vertical y coordinate for the key location
+		 * @param clickCount   the number of key clicks associated with event
+		 */
+		KeyEvent(PositionTarget* source, int id, int key, Real when, int modifiers);
+
+		/**
+		 * Returns a parameter string identifying this event.
+		 * This method is useful for event-logging and for debugging.
+		 *
+		 * @return a string identifying the event and its attributes
+		 */
+		 String paramString() const;
+
+
+		 /** return the ID of the button */
+		 int getKey();
+
+		 /** return the char of the button */
+		 char getKeyChar();
+    };
+
+
+}
+
+
+#endif 
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRay.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRay.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRay.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __Ray_H_
+#define __Ray_H_
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+
+#include "OgreVector3.h"
+#include "OgrePlaneBoundedVolume.h"
+
+namespace Ogre {
+
+    /** Representation of a ray in space, ie 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. 
+		@returns 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. 
+        @returns 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. 
+		@returns 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. 
+		@returns 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: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderTargetListener.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderTargetListener.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderTargetListener.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __RenderTargetListener_H__
+#define __RenderTargetListener_H__
+
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+    /** 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.
+            </p>
+            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) { }
+        /** 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) { }
+
+        /* 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) { }
+
+        /* 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) { }
+
+		/** Called to notify listener that a Viewport has been added to the 
+			target in question.
+		*/
+		virtual void viewportAdded(const RenderTargetViewportEvent& evt) {}
+		/** Called to notify listener that a Viewport has been removed from the 
+			target in question.
+		*/
+		virtual void viewportRemoved(const RenderTargetViewportEvent& evt) {}
+    };
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreParticleSystemRenderer.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreParticleSystemRenderer.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreParticleSystemRenderer.h	(revision 1812)
@@ -0,0 +1,112 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE 
+(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under 
+the terms of the GNU Lesser General Public License as published by the Free Software 
+Foundation; either version 2 of the License, or (at your option) any later 
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT 
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with 
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple 
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to 
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __ParticleSystemRenderer_H__
+#define __ParticleSystemRenderer_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreStringInterface.h"
+#include "OgreFactoryObj.h"
+#include "OgreRenderQueue.h"
+#include "OgreCommon.h"
+
+namespace Ogre {
+
+    /** Abstract class defining the interface required to be implemented
+        by classes which provide rendering capability to ParticleSystem instances.
+    */
+    class _OgreExport ParticleSystemRenderer : public StringInterface
+    {
+    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, 
+            std::list<Particle*>& 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;
+		/** 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;
+
+		/** 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;
+
+    };
+
+    /** Abstract class definition of a factory object for ParticleSystemRenderer. */
+    class _OgreExport ParticleSystemRendererFactory : public FactoryObj<ParticleSystemRenderer>
+    {
+    public:
+        // No methods, must just override all methods inherited from FactoryObj
+    };
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/ExampleFrameListener.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/ExampleFrameListener.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/ExampleFrameListener.h	(revision 1812)
@@ -0,0 +1,456 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+You may use this sample code for anything you like, it is not covered by the
+LGPL like the rest of the engine.
+-----------------------------------------------------------------------------
+*/
+/*
+-----------------------------------------------------------------------------
+Filename:    ExampleFrameListener.h
+Description: Defines an example frame listener which responds to frame events.
+This frame listener just moves a specified camera around based on
+keyboard and mouse movements.
+Mouse:    Freelook
+W or Up:  Forward
+S or Down:Backward
+A:        Step left
+D:        Step right
+             PgUp:     Move upwards
+             PgDown:   Move downwards
+             F:        Toggle frame rate stats on/off
+			 R:        Render mode
+             T:        Cycle texture filtering
+                       Bilinear, Trilinear, Anisotropic(8)
+             P:        Toggle on/off display of camera position / orientation
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __ExampleFrameListener_H__
+#define __ExampleFrameListener_H__
+
+#include "Ogre.h"
+#include "OgreKeyEvent.h"
+#include "OgreEventListeners.h"
+#include "OgreStringConverter.h"
+#include "OgreException.h"
+
+using namespace Ogre;
+
+class ExampleFrameListener: public FrameListener, public KeyListener
+{
+protected:
+	int mSceneDetailIndex ;
+    Real mMoveSpeed;
+    Degree mRotateSpeed;
+    Overlay* mDebugOverlay;
+
+    void updateStats(void)
+    {
+        static String currFps = "Current FPS: ";
+        static String avgFps = "Average FPS: ";
+        static String bestFps = "Best FPS: ";
+        static String worstFps = "Worst FPS: ";
+        static String tris = "Triangle Count: ";
+
+        // update stats when necessary
+        try {
+            OverlayElement* guiAvg = OverlayManager::getSingleton().getOverlayElement("Core/AverageFps");
+            OverlayElement* guiCurr = OverlayManager::getSingleton().getOverlayElement("Core/CurrFps");
+            OverlayElement* guiBest = OverlayManager::getSingleton().getOverlayElement("Core/BestFps");
+            OverlayElement* guiWorst = OverlayManager::getSingleton().getOverlayElement("Core/WorstFps");
+
+            const RenderTarget::FrameStats& stats = mWindow->getStatistics();
+
+            guiAvg->setCaption(avgFps + StringConverter::toString(stats.avgFPS));
+            guiCurr->setCaption(currFps + StringConverter::toString(stats.lastFPS));
+            guiBest->setCaption(bestFps + StringConverter::toString(stats.bestFPS)
+                +" "+StringConverter::toString(stats.bestFrameTime)+" ms");
+            guiWorst->setCaption(worstFps + StringConverter::toString(stats.worstFPS)
+                +" "+StringConverter::toString(stats.worstFrameTime)+" ms");
+
+            OverlayElement* guiTris = OverlayManager::getSingleton().getOverlayElement("Core/NumTris");
+            guiTris->setCaption(tris + StringConverter::toString(stats.triangleCount));
+
+            OverlayElement* guiDbg = OverlayManager::getSingleton().getOverlayElement("Core/DebugText");
+            guiDbg->setCaption(mWindow->getDebugText());
+        }
+        catch(...)
+        {
+            // ignore
+        }
+    }
+
+public:
+    // Constructor takes a RenderWindow because it uses that to determine input context
+    ExampleFrameListener(RenderWindow* win, Camera* cam, bool useBufferedInputKeys = false, bool useBufferedInputMouse = false)
+    {
+        mDebugOverlay = OverlayManager::getSingleton().getByName("Core/DebugOverlay");
+        mUseBufferedInputKeys = useBufferedInputKeys;
+		mUseBufferedInputMouse = useBufferedInputMouse;
+		mInputTypeSwitchingOn = mUseBufferedInputKeys || mUseBufferedInputMouse;
+        mRotateSpeed = 36;
+        mMoveSpeed = 100;
+
+		if (mInputTypeSwitchingOn)
+		{
+            mEventProcessor = new EventProcessor();
+			mEventProcessor->initialise(win);
+			mEventProcessor->startProcessingEvents();
+			mEventProcessor->addKeyListener(this);
+			mInputDevice = mEventProcessor->getInputReader();
+
+		}
+        else
+        {
+            mInputDevice = PlatformManager::getSingleton().createInputReader();
+            mInputDevice->initialise(win,true, true);
+        }
+
+        mCamera = cam;
+        mWindow = win;
+        mStatsOn = true;
+		mNumScreenShots = 0;
+		mTimeUntilNextToggle = 0;
+        mSceneDetailIndex = 0;
+        mMoveScale = 0.0f;
+        mRotScale = 0.0f;
+	    mTranslateVector = Vector3::ZERO;
+        mAniso = 1;
+        mFiltering = TFO_BILINEAR;
+
+        showDebugOverlay(true);
+    }
+    virtual ~ExampleFrameListener()
+    {
+		if (mInputTypeSwitchingOn)
+		{
+            delete mEventProcessor;
+		}
+        else
+        {
+            PlatformManager::getSingleton().destroyInputReader( mInputDevice );
+        }
+    }
+
+    virtual bool processUnbufferedKeyInput(const FrameEvent& evt)
+    {
+        if (mInputDevice->isKeyDown(KC_A))
+        {
+            // Move camera left
+            mTranslateVector.x = -mMoveScale;
+        }
+
+        if (mInputDevice->isKeyDown(KC_D))
+        {
+            // Move camera RIGHT
+            mTranslateVector.x = mMoveScale;
+        }
+
+        /* Move camera forward by keypress. */
+        if (mInputDevice->isKeyDown(KC_UP) || mInputDevice->isKeyDown(KC_W) )
+        {
+            mTranslateVector.z = -mMoveScale;
+        }
+
+        /* Move camera backward by keypress. */
+        if (mInputDevice->isKeyDown(KC_DOWN) || mInputDevice->isKeyDown(KC_S) )
+        {
+            mTranslateVector.z = mMoveScale;
+        }
+
+        if (mInputDevice->isKeyDown(KC_PGUP))
+        {
+            // Move camera up
+            mTranslateVector.y = mMoveScale;
+        }
+
+        if (mInputDevice->isKeyDown(KC_PGDOWN))
+        {
+            // Move camera down
+            mTranslateVector.y = -mMoveScale;
+        }
+
+        if (mInputDevice->isKeyDown(KC_RIGHT))
+        {
+            mCamera->yaw(-mRotScale);
+        }
+		
+        if (mInputDevice->isKeyDown(KC_LEFT))
+        {
+            mCamera->yaw(mRotScale);
+        }
+
+        if( mInputDevice->isKeyDown( KC_ESCAPE) )
+        {            
+            return false;
+        }
+
+		// see if switching is on, and you want to toggle 
+        if (mInputTypeSwitchingOn && mInputDevice->isKeyDown(KC_M) && mTimeUntilNextToggle <= 0)
+        {
+			switchMouseMode();
+            mTimeUntilNextToggle = 1;
+        }
+
+        if (mInputTypeSwitchingOn && mInputDevice->isKeyDown(KC_K) && mTimeUntilNextToggle <= 0)
+        {
+			// must be going from immediate keyboard to buffered keyboard
+			switchKeyMode();
+            mTimeUntilNextToggle = 1;
+        }
+        if (mInputDevice->isKeyDown(KC_F) && mTimeUntilNextToggle <= 0)
+        {
+            mStatsOn = !mStatsOn;
+            showDebugOverlay(mStatsOn);
+
+            mTimeUntilNextToggle = 1;
+        }
+        if (mInputDevice->isKeyDown(KC_T) && mTimeUntilNextToggle <= 0)
+        {
+            switch(mFiltering)
+            {
+            case TFO_BILINEAR:
+                mFiltering = TFO_TRILINEAR;
+                mAniso = 1;
+                break;
+            case TFO_TRILINEAR:
+                mFiltering = TFO_ANISOTROPIC;
+                mAniso = 8;
+                break;
+            case TFO_ANISOTROPIC:
+                mFiltering = TFO_BILINEAR;
+                mAniso = 1;
+                break;
+            default:
+                break;
+            }
+            MaterialManager::getSingleton().setDefaultTextureFiltering(mFiltering);
+            MaterialManager::getSingleton().setDefaultAnisotropy(mAniso);
+
+
+            showDebugOverlay(mStatsOn);
+
+            mTimeUntilNextToggle = 1;
+        }
+
+        if (mInputDevice->isKeyDown(KC_SYSRQ) && mTimeUntilNextToggle <= 0)
+        {
+			char tmp[20];
+			sprintf(tmp, "screenshot_%d.png", ++mNumScreenShots);
+            mWindow->writeContentsToFile(tmp);
+            mTimeUntilNextToggle = 0.5;
+			mWindow->setDebugText(String("Wrote ") + tmp);
+        }
+		
+		if (mInputDevice->isKeyDown(KC_R) && mTimeUntilNextToggle <=0)
+		{
+			mSceneDetailIndex = (mSceneDetailIndex+1)%3 ;
+			switch(mSceneDetailIndex) {
+				case 0 : mCamera->setPolygonMode(PM_SOLID) ; break ;
+				case 1 : mCamera->setPolygonMode(PM_WIREFRAME) ; break ;
+				case 2 : mCamera->setPolygonMode(PM_POINTS) ; break ;
+			}
+			mTimeUntilNextToggle = 0.5;
+		}
+
+        static bool displayCameraDetails = false;
+        if (mInputDevice->isKeyDown(KC_P) && mTimeUntilNextToggle <= 0)
+        {
+            displayCameraDetails = !displayCameraDetails;
+            mTimeUntilNextToggle = 0.5;
+            if (!displayCameraDetails)
+                mWindow->setDebugText("");
+        }
+        if (displayCameraDetails)
+        {
+            // Print camera details
+            mWindow->setDebugText("P: " + StringConverter::toString(mCamera->getDerivedPosition()) + " " + 
+                "O: " + StringConverter::toString(mCamera->getDerivedOrientation()));
+        }
+
+        // Return true to continue rendering
+        return true;
+    }
+
+    bool processUnbufferedMouseInput(const FrameEvent& evt)
+    {
+        /* Rotation factors, may not be used if the second mouse button is pressed. */
+
+        /* If the second mouse button is pressed, then the mouse movement results in 
+           sliding the camera, otherwise we rotate. */
+        if( mInputDevice->getMouseButton( 1 ) )
+        {
+            mTranslateVector.x += mInputDevice->getMouseRelativeX() * 0.13;
+            mTranslateVector.y -= mInputDevice->getMouseRelativeY() * 0.13;
+        }
+        else
+        {
+            mRotX = Degree(-mInputDevice->getMouseRelativeX() * 0.13);
+            mRotY = Degree(-mInputDevice->getMouseRelativeY() * 0.13);
+        }
+
+
+		return true;
+	}
+
+	void moveCamera()
+	{
+
+        // Make all the changes to the camera
+        // Note that YAW direction is around a fixed axis (freelook style) rather than a natural YAW (e.g. airplane)
+        mCamera->yaw(mRotX);
+        mCamera->pitch(mRotY);
+        mCamera->moveRelative(mTranslateVector);
+
+
+	}
+
+    void showDebugOverlay(bool show)
+    {
+        if (mDebugOverlay)
+        {
+            if (show)
+            {
+                mDebugOverlay->show();
+            }
+            else
+            {
+                mDebugOverlay->hide();
+            }
+        }
+    }
+
+    // Override frameStarted event to process that (don't care about frameEnded)
+    bool frameStarted(const FrameEvent& evt)
+    {
+        if(mWindow->isClosed())
+            return false;
+
+        if (!mInputTypeSwitchingOn)
+    	{
+            mInputDevice->capture();
+        }
+
+
+		if ( !mUseBufferedInputMouse || !mUseBufferedInputKeys)
+		{
+			// one of the input modes is immediate, so setup what is needed for immediate mouse/key movement
+			if (mTimeUntilNextToggle >= 0) 
+				mTimeUntilNextToggle -= evt.timeSinceLastFrame;
+
+			// If this is the first frame, pick a speed
+			if (evt.timeSinceLastFrame == 0)
+			{
+				mMoveScale = 1;
+				mRotScale = 0.1;
+			}
+			// Otherwise scale movement units by time passed since last frame
+			else
+			{
+				// Move about 100 units per second,
+				mMoveScale = mMoveSpeed * evt.timeSinceLastFrame;
+				// Take about 10 seconds for full rotation
+				mRotScale = mRotateSpeed * evt.timeSinceLastFrame;
+			}
+			mRotX = 0;
+            mRotY = 0;
+	        mTranslateVector = Vector3::ZERO;
+		}
+
+        if (mUseBufferedInputKeys)
+        {
+            // no need to do any processing here, it is handled by event processor and 
+			// you get the results as KeyEvents
+        }
+        else
+        {
+            if (processUnbufferedKeyInput(evt) == false)
+			{
+				return false;
+			}
+        }
+        if (mUseBufferedInputMouse)
+        {
+            // no need to do any processing here, it is handled by event processor and 
+			// you get the results as MouseEvents
+        }
+        else
+        {
+            if (processUnbufferedMouseInput(evt) == false)
+			{
+				return false;
+			}
+        }
+
+		if ( !mUseBufferedInputMouse || !mUseBufferedInputKeys)
+		{
+			// one of the input modes is immediate, so update the movement vector
+
+			moveCamera();
+
+		}
+
+		return true;
+    }
+
+    bool frameEnded(const FrameEvent& evt)
+    {
+        updateStats();
+        return true;
+    }
+
+	void switchMouseMode() 
+	{
+        mUseBufferedInputMouse = !mUseBufferedInputMouse;
+		mInputDevice->setBufferedInput(mUseBufferedInputKeys, mUseBufferedInputMouse);
+	}
+	void switchKeyMode() 
+	{
+        mUseBufferedInputKeys = !mUseBufferedInputKeys;
+		mInputDevice->setBufferedInput(mUseBufferedInputKeys, mUseBufferedInputMouse);
+	}
+
+	void keyClicked(KeyEvent* e) 
+	{
+		if (e->getKeyChar() == 'm')
+		{
+			switchMouseMode();
+		}
+		else if (e->getKeyChar() == 'k')
+		{
+
+			switchKeyMode();
+		}
+
+	}
+	void keyPressed(KeyEvent* e) {}
+	void keyReleased(KeyEvent* e) {}
+
+protected:
+    EventProcessor* mEventProcessor;
+    InputReader* mInputDevice;
+    Camera* mCamera;
+
+    Vector3 mTranslateVector;
+    RenderWindow* mWindow;
+    bool mStatsOn;
+    bool mUseBufferedInputKeys, mUseBufferedInputMouse, mInputTypeSwitchingOn;
+	unsigned int mNumScreenShots;
+    float mMoveScale;
+    Degree mRotScale;
+    // just to stop toggles flipping too fast
+    Real mTimeUntilNextToggle ;
+    Radian mRotX, mRotY;
+    TextureFilterOptions mFiltering;
+    int mAniso;
+
+};
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreTexture.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreTexture.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreTexture.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _Texture_H__
+#define _Texture_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreHardwareBuffer.h"
+#include "OgreResource.h"
+#include "OgreImage.h"
+
+namespace Ogre {
+
+    /** 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 = 0x100,
+		/// this texture will be a render target, ie. used as a target for render to texture
+		/// setting this flag will ignore all other texture usages except TU_AUTOMIPMAP
+		TU_RENDERTARGET = 0x200,
+		/// 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
+    };
+
+	/** Enum identifying special mipmap numbers
+    */
+	enum TextureMipmap
+	{
+		/// Generate mipmaps up to 1x1
+		MIP_UNLIMITED = 0x7FFFFFFF
+	};
+
+    // Forward declaration
+    class TexturePtr;
+
+    /** 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);
+
+        /** 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 size_t 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(size_t 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.
+        */
+        virtual float getGamma(void) const { return mGamma; }
+
+        /** Sets the gamma adjustment factor applied to this texture.
+            @note
+                Must be called before any 'load' method.
+        */
+        virtual void setGamma(float g) { mGamma = g; }
+
+        /** Returns the height of the texture.
+        */
+        virtual unsigned int getHeight(void) const { return mHeight; }
+
+        /** Returns the width of the texture.
+        */
+        virtual unsigned int getWidth(void) const { return mWidth; }
+
+        /** Returns the depth of the texture (only applicable for 3D textures).
+        */
+        virtual unsigned int getDepth(void) const { return mDepth; }
+
+        /** Returns the height of the original input texture (may differ due to hardware requirements).
+        */
+        virtual unsigned int getSrcHeight(void) const { return mSrcHeight; }
+
+        /** Returns the width of the original input texture (may differ due to hardware requirements).
+        */
+        virtual unsigned int getSrcWidth(void) const { return mSrcWidth; }
+
+        /** Returns the original depth of the input texture (only applicable for 3D textures).
+        */
+        virtual unsigned int getSrcDepth(void) const { return mSrcDepth; }
+
+        /** Set the height of the texture; can only do this before load();
+        */
+        virtual void setHeight(unsigned int h) { mHeight = mSrcHeight = h; }
+
+        /** Set the width of the texture; can only do this before load();
+        */
+        virtual void setWidth(unsigned int w) { mWidth = mSrcWidth = w; }
+
+        /** Set the depth of the texture (only applicable for 3D textures);
+            ; can only do this before load();
+        */
+        virtual void setDepth(unsigned int d)  { mDepth = mSrcDepth = d; }
+
+        /** Returns the TextureUsage indentifier for this Texture
+        */
+        virtual int getUsage() const
+        {
+            return mUsage;
+        }
+
+        /** Sets the TextureUsage indentifier 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.
+        */
+        virtual void loadImage( const Image &img ) = 0;
+			
+		/** Loads the data from a raw stream.
+		*/
+		virtual void loadRawData( DataStreamPtr& stream, 
+			ushort uWidth, ushort uHeight, PixelFormat eFormat);
+
+        virtual void enable32Bit( bool setting = true ) 
+        {
+            setting ? mFinalBpp = 32 : mFinalBpp = 16;
+        }
+
+		/** Returns the pixel format for the texture surface. */
+		virtual PixelFormat getFormat() const
+		{
+			return mFormat;
+		}
+
+        /** 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
+        {
+            return mHasAlpha;
+        }
+        
+        /** 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.
+			@returns	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;
+
+    protected:
+        unsigned long mHeight;
+        unsigned long mWidth;
+        unsigned long mDepth;
+
+        size_t mNumRequestedMipmaps;
+		size_t mNumMipmaps;
+		bool mMipmapsHardwareGenerated;
+        float mGamma;
+
+        TextureType mTextureType;
+		PixelFormat mFormat;
+        int mUsage; // Bit field, so this can't be TextureUsage
+
+        unsigned short mSrcBpp;
+        unsigned long mSrcWidth, mSrcHeight, mSrcDepth;
+        unsigned short mFinalBpp;
+        bool mHasAlpha;
+
+		bool mInternalResourcesCreated;
+
+		/// @copydoc Resource::calculateSize
+		size_t calculateSize(void) const;
+		
+		/** Generic method to load the texture from a set of images. This can be
+		 	used by the specific implementation for convience. Implementations
+			might decide not to use this function if they can use their own image loading
+			functions.
+			@param images	Vector of pointers to Images. If there is only one image
+			in this vector, the faces of that image will be used. If there are multiple
+			images in the vector each image will be loaded as a face.
+		*/
+        virtual void _loadImages( const std::vector<const Image*>& images );
+
+
+		/** 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);
+
+    };
+
+    /** Specialisation of SharedPtr to allow SharedPtr to be assigned to TexturePtr 
+    @note Has to be a subclass since we need operator=.
+    We could templatise this instead of repeating per Resource subclass, 
+    except to do so requires a form VC6 does not support i.e.
+    ResourceSubclassPtr<T> : public SharedPtr<T>
+    */
+    class _OgreExport TexturePtr : public SharedPtr<Texture> 
+    {
+    public:
+        TexturePtr() : SharedPtr<Texture>() {}
+        explicit TexturePtr(Texture* rep) : SharedPtr<Texture>(rep) {}
+        TexturePtr(const TexturePtr& r) : SharedPtr<Texture>(r) {} 
+        TexturePtr(const ResourcePtr& r) : SharedPtr<Texture>()
+        {
+			// lock & copy other mutex pointer
+            OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME)
+            {
+			    OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
+			    OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
+                pRep = static_cast<Texture*>(r.getPointer());
+                pUseCount = r.useCountPointer();
+                if (pUseCount)
+                {
+                    ++(*pUseCount);
+                }
+            }
+        }
+
+        /// Operator used to convert a ResourcePtr to a TexturePtr
+        TexturePtr& operator=(const ResourcePtr& r)
+        {
+            if (pRep == static_cast<Texture*>(r.getPointer()))
+                return *this;
+            release();
+			// lock & copy other mutex pointer
+            OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME)
+            {
+			    OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
+			    OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
+                pRep = static_cast<Texture*>(r.getPointer());
+                pUseCount = r.useCountPointer();
+                if (pUseCount)
+                {
+                    ++(*pUseCount);
+                }
+            }
+            return *this;
+        }
+    };
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/ExampleRefAppApplication.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/ExampleRefAppApplication.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/ExampleRefAppApplication.h	(revision 1812)
@@ -0,0 +1,210 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+You may use this sample code for anything you like, it is not covered by the
+LGPL like the rest of the engine.
+-----------------------------------------------------------------------------
+*/
+
+/*
+-----------------------------------------------------------------------------
+Filename:    ExampleApplication.h
+Description: Base class for all the OGRE ReferenceApplication examples
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __ExampleRefAppApplication_H__
+#define __ExampleRefAppApplication_H__
+
+#include "OgreReferenceAppLayer.h"
+#include "OgreConfigFile.h"
+#include "ExampleRefAppFrameListener.h"
+
+#if OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+#    include <SDL.h>
+#endif
+
+using namespace Ogre;
+using namespace OgreRefApp;
+
+/** Base class which manages the standard startup of an Ogre application
+    based on the ReferenceApplication layer.
+    Designed to be subclassed for specific examples if required.
+*/
+class ExampleRefAppApplication
+{
+public:
+    /// Standard constructor
+    ExampleRefAppApplication()
+    {
+        mFrameListener = 0;
+        mRoot = 0;
+        mWorld = 0;
+    }
+    /// Standard destructor
+    virtual ~ExampleRefAppApplication()
+    {
+        if (mFrameListener)
+            delete mFrameListener;
+        if (mWorld)
+            delete mWorld;
+        if (mRoot)
+            delete mRoot;
+    }
+
+    /// Start the example
+    virtual void go(void)
+    {
+        if (!setup())
+            return;
+
+        mRoot->startRendering();
+    }
+
+protected:
+    Root *mRoot;
+    CollideCamera* mCamera;
+    SceneManager* mSceneMgr;
+    FrameListener* mFrameListener;
+    RenderWindow* mWindow;
+    World* mWorld;
+
+    // These internal methods package up the stages in the startup process
+    /** Sets up the application - returns false if the user chooses to abandon configuration. */
+    virtual bool setup(void)
+    {
+        mRoot = new Root();
+
+        setupResources();
+
+        bool carryOn = configure();
+        if (!carryOn) return false;
+
+        chooseSceneManager();
+        createWorld();
+        createCamera();
+        createViewports();
+
+        // Set default mipmap level (NB some APIs ignore this)
+        TextureManager::getSingleton().setDefaultNumMipmaps(5);
+
+		// Create any resource listeners (for loading screens)
+		createResourceListener();
+		// Load resources
+		loadResources();
+
+        // Create the scene
+        createScene();
+
+        createFrameListener();
+
+        return true;
+
+    }
+    /** Configures the application - returns false if the user chooses to abandon configuration. */
+    virtual bool configure(void)
+    {
+        // Show the configuration dialog and initialise the system
+        // You can skip this and use root.restoreConfig() to load configuration
+        // settings if you were sure there are valid ones saved in ogre.cfg
+        if(mRoot->showConfigDialog())
+        {
+            // If returned true, user clicked OK so initialise
+            // Here we choose to let the system create a default rendering window by passing 'true'
+            mWindow = mRoot->initialise(true);
+            return true;
+        }
+        else
+        {
+            return false;
+        }
+    }
+
+    virtual void chooseSceneManager(void)
+    {
+        // Get the SceneManager, in this case a generic one
+        mSceneMgr = mRoot->createSceneManager(ST_GENERIC, "RefAppSMInstance");
+    }
+    virtual void createCamera(void)
+    {
+        // Create the camera
+        mCamera = mWorld->createCamera("PlayerCam");
+
+        // Position it at 500 in Z direction
+        mCamera->setPosition(Vector3(0,0,500));
+        // Look back along -Z
+        mCamera->lookAt(Vector3(0,0,-300));
+        mCamera->setNearClipDistance(5);
+
+    }
+    virtual void createFrameListener(void)
+    {
+        mFrameListener= new ExampleRefAppFrameListener(mWindow, mCamera);
+        mRoot->addFrameListener(mFrameListener);
+    }
+
+    virtual void createScene(void) = 0;    // pure virtual - this has to be overridden
+
+    virtual void createViewports(void)
+    {
+        // Create one viewport, entire window
+        Viewport* vp = mWindow->addViewport(mCamera->getRealCamera());
+        vp->setBackgroundColour(ColourValue(0,0,0));
+    }
+
+    /// Method which will define the source of resources (other than current folder)
+    virtual void setupResources(void)
+    {
+        // Load resource paths from config file
+        ConfigFile cf;
+        cf.load("resources.cfg");
+
+        // Go through all sections & settings in the file
+        ConfigFile::SectionIterator seci = cf.getSectionIterator();
+
+        String secName, typeName, archName;
+        while (seci.hasMoreElements())
+        {
+            secName = seci.peekNextKey();
+            ConfigFile::SettingsMultiMap *settings = seci.getNext();
+            ConfigFile::SettingsMultiMap::iterator i;
+            for (i = settings->begin(); i != settings->end(); ++i)
+            {
+                typeName = i->first;
+                archName = i->second;
+                ResourceGroupManager::getSingleton().addResourceLocation(
+                    archName, typeName, secName);
+            }
+        }
+    }
+    virtual void createWorld(void)
+    {
+        mWorld = new World(mSceneMgr);
+    }
+	/// Optional override method where you can create resource listeners (e.g. for loading screens)
+	virtual void createResourceListener(void)
+	{
+
+	}
+
+	/// Optional override method where you can perform resource group loading
+	/// Must at least do ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
+	virtual void loadResources(void)
+	{
+		// Initialise, parse scripts etc
+		ResourceGroupManager::getSingleton().initialiseAllResourceGroups();
+
+	}
+
+
+
+};
+
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreFontManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreFontManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreFontManager.h	(revision 1812)
@@ -0,0 +1,93 @@
+/*-------------------------------------------------------------------------
+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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License (LGPL) as 
+published by the Free Software Foundation; either version 2.1 of the 
+License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful, but 
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public 
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License 
+along with this library; if not, write to the Free Software Foundation, 
+Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA or go to
+http://www.gnu.org/copyleft/lesser.txt
+-------------------------------------------------------------------------*/
+
+#ifndef _FontManager_H__
+#define _FontManager_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreSingleton.h"
+#include "OgreResourceManager.h"
+#include "OgreFont.h"
+
+namespace Ogre
+{
+    /** Manages Font resources, parsing .fontdef files and generally organising them.*/
+    class _OgreExport FontManager : public ResourceManager, public Singleton< FontManager >
+    {
+    public:
+
+		FontManager();
+		~FontManager();
+
+        /** @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: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreStaticGeometry.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreStaticGeometry.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreStaticGeometry.h	(revision 1812)
@@ -0,0 +1,745 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __StaticGeometry_H__
+#define __StaticGeometry_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreMovableObject.h"
+#include "OgreRenderable.h"
+
+namespace Ogre {
+
+	/** 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 contructs 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 everthing
+		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 triangle lists at the moment,
+		do not pass it triangle strips, fans or lines / points.
+	*/
+	class _OgreExport StaticGeometry
+	{
+	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:
+			OptimisedSubMeshGeometry() :vertexData(0), indexData(0) {}
+			~OptimisedSubMeshGeometry() 
+			{
+				delete vertexData;
+				delete indexData;
+			}
+			VertexData *vertexData;
+			IndexData *indexData;
+		};
+		typedef std::list<OptimisedSubMeshGeometry*> 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 std::vector<SubMeshLodGeometryLink> SubMeshLodGeometryLinkList;
+		typedef std::map<SubMesh*, SubMeshLodGeometryLinkList*> SubMeshGeometryLookup;
+		/// Structure recording a queued submesh for the build
+		struct QueuedSubMesh
+		{
+			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 std::vector<QueuedSubMesh*> QueuedSubMeshList;
+		/// Structure recording a queued geometry for low level builds
+		struct QueuedGeometry
+		{
+			SubMeshLodGeometryLink* geometry;
+			Vector3 position;
+			Quaternion orientation;
+			Vector3 scale;
+		};
+		typedef std::vector<QueuedGeometry*> 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
+		{
+		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;
+	        const Quaternion& getWorldOrientation(void) const;
+	        const Vector3& getWorldPosition(void) const;
+			Real getSquaredViewDepth(const Camera* cam) const;
+	        const LightList& getLights(void) const;
+			bool getCastsShadows(void) const;
+			
+			/** Try to assign geometry to this bucket.
+			@returns 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:
+			/// list of Geometry Buckets in this region
+			typedef std::vector<GeometryBucket*> 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 std::map<String, GeometryBucket*> 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 camSquaredDist);
+			/// 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;
+		};
+		/** 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:
+			/// Lookup of Material Buckets in this region
+			typedef std::map<String, MaterialBucket*> MaterialBucketMap;
+		protected:
+			/// Pointer to parent region
+			Region* mParent;
+			/// LOD level (0 == full LOD)
+			unsigned short mLod;
+			/// distance at which this LOD starts to apply (squared)
+			Real mSquaredDistance;
+			/// Lookup of Material Buckets in this region
+			MaterialBucketMap mMaterialBucketMap;
+			/// Geometry queued for a single LOD (deallocated here)
+			QueuedGeometryList mQueuedGeometryList;
+		public:
+			LODBucket(Region* parent, unsigned short lod, Real lodDist);
+			virtual ~LODBucket();
+			Region* getParent(void) { return mParent; }
+			/// Get the lod index
+			ushort getLod(void) const { return mLod; }
+			/// Get the lod squared distance
+			Real getSquaredDistance(void) const { return mSquaredDistance; }
+			/// 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 camSquaredDistance);
+			/// 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;
+			
+		};
+		/** 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
+		{
+		public:
+			/// list of LOD Buckets in this region
+			typedef std::vector<LODBucket*> LODBucketList;
+		protected:
+			/** Nested class to allow region shadows. */
+			class _OgreExport RegionShadowRenderable : public ShadowRenderable
+			{
+			protected:
+				Region* mParent;
+				// Shared link to position buffer
+				HardwareVertexBufferSharedPtr mPositionBuffer;
+				// Shared link to w-coord buffer (optional)
+				HardwareVertexBufferSharedPtr mWBuffer;
+
+			public:
+				RegionShadowRenderable(Region* parent, 
+					HardwareIndexBufferSharedPtr* indexBuffer, const VertexData* vertexData, 
+					bool createSeparateLightCap, bool isLightCap = false);
+				~RegionShadowRenderable();
+				/// Overridden from ShadowRenderable
+				void getWorldTransforms(Matrix4* xform) const;
+				/// Overridden from ShadowRenderable
+				const Quaternion& getWorldOrientation(void) const;
+				/// Overridden from ShadowRenderable
+				const Vector3& getWorldPosition(void) const;
+				HardwareVertexBufferSharedPtr getPositionBuffer(void) { return mPositionBuffer; }
+				HardwareVertexBufferSharedPtr getWBuffer(void) { return mWBuffer; }
+
+			};
+			/// 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 distances (squared) as built up - use the max at each level
+			std::vector<Real> mLodSquaredDistances;
+			/// 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 camera distance, passed on to do material lod later
+			Real mCamDistanceSquared;
+			/// 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;
+			/// Edge list, used if stencil shadow casting is enabled 
+			EdgeData* mEdgeList;
+			/// List of shadow renderables
+			ShadowRenderableList mShadowRenderables;
+			/// Is a vertex program in use somewhere in this region?
+			bool mVertexProgramInUse;
+
+
+
+		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);
+			bool isVisible(void) const;
+			uint32 getTypeFlags(void) const;
+
+			typedef VectorIterator<LODBucketList> LODIterator;
+			/// Get an iterator over the LODs in this region
+			LODIterator getLODIterator(void);
+			/// Shared set of lights for all GeometryBuckets
+			const LightList& getLights(void) const;
+			/// @copydoc ShadowCaster::getShadowVolumeRenderableIterator
+			ShadowRenderableListIterator getShadowVolumeRenderableIterator(
+				ShadowTechnique shadowTechnique, const Light* light, 
+				HardwareIndexBufferSharedPtr* indexBuffer, 
+				bool extrudeVertices, Real extrusionDistance, unsigned long flags = 0 );
+			/// Overridden from MovableObject
+			EdgeData* getEdgeList(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 std::map<uint32, Region*> 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;
+
+		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 std::map<size_t, size_t> 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 size 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 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;
+
+
+	};
+
+}
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreKeyFrame.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreKeyFrame.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreKeyFrame.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __KeyFrame_H__
+#define __KeyFrame_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreVector3.h"
+#include "OgreQuaternion.h"
+#include "OgreAny.h"
+#include "OgreHardwareVertexBuffer.h"
+#include "OgreIteratorWrappers.h"
+
+namespace Ogre 
+{
+
+    /** 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:
+
+        /** 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 std::vector<PoseRef> 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;
+		
+	protected:
+		PoseRefList mPoseRefs;
+
+	};
+
+}
+
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/error.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/error.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/error.h	(revision 1812)
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *                                                                       *
+ * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith.       *
+ * All rights reserved.  Email: russ@q12.org   Web: www.q12.org          *
+ *                                                                       *
+ * This library is free software; you can redistribute it and/or         *
+ * modify it under the terms of EITHER:                                  *
+ *   (1) The GNU Lesser General Public License as published by the Free  *
+ *       Software Foundation; either version 2.1 of the License, or (at  *
+ *       your option) any later version. The text of the GNU Lesser      *
+ *       General Public License is included with this library in the     *
+ *       file LICENSE.TXT.                                               *
+ *   (2) The BSD-style license that is included with this library in     *
+ *       the file LICENSE-BSD.TXT.                                       *
+ *                                                                       *
+ * This library is distributed in the hope that it will be useful,       *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
+ * LICENSE.TXT and LICENSE-BSD.TXT for more details.                     *
+ *                                                                       *
+ *************************************************************************/
+
+/* this comes from the `reuse' library. copy any changes back to the source */
+
+#ifndef _ODE_ERROR_H_
+#define _ODE_ERROR_H_
+
+#include <ode/config.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* all user defined error functions have this type. error and debug functions
+ * should not return.
+ */
+typedef void dMessageFunction (int errnum, const char *msg, va_list ap);
+
+/* set a new error, debug or warning handler. if fn is 0, the default handlers
+ * are used.
+ */
+void dSetErrorHandler (dMessageFunction *fn);
+void dSetDebugHandler (dMessageFunction *fn);
+void dSetMessageHandler (dMessageFunction *fn);
+
+/* return the current error, debug or warning handler. if the return value is
+ * 0, the default handlers are in place.
+ */
+dMessageFunction *dGetErrorHandler();
+dMessageFunction *dGetDebugHandler();
+dMessageFunction *dGetMessageHandler();
+
+/* generate a fatal error, debug trap or a message. */
+void dError (int num, const char *msg, ...);
+void dDebug (int num, const char *msg, ...);
+void dMessage (int num, const char *msg, ...);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/objects.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/objects.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/objects.h	(revision 1812)
@@ -0,0 +1,279 @@
+/*************************************************************************
+ *                                                                       *
+ * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith.       *
+ * All rights reserved.  Email: russ@q12.org   Web: www.q12.org          *
+ *                                                                       *
+ * This library is free software; you can redistribute it and/or         *
+ * modify it under the terms of EITHER:                                  *
+ *   (1) The GNU Lesser General Public License as published by the Free  *
+ *       Software Foundation; either version 2.1 of the License, or (at  *
+ *       your option) any later version. The text of the GNU Lesser      *
+ *       General Public License is included with this library in the     *
+ *       file LICENSE.TXT.                                               *
+ *   (2) The BSD-style license that is included with this library in     *
+ *       the file LICENSE-BSD.TXT.                                       *
+ *                                                                       *
+ * This library is distributed in the hope that it will be useful,       *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
+ * LICENSE.TXT and LICENSE-BSD.TXT for more details.                     *
+ *                                                                       *
+ *************************************************************************/
+
+#ifndef _ODE_OBJECTS_H_
+#define _ODE_OBJECTS_H_
+
+#include <ode/common.h>
+#include <ode/mass.h>
+#include <ode/contact.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* world */
+
+dWorldID dWorldCreate();
+void dWorldDestroy (dWorldID);
+
+void dWorldSetGravity (dWorldID, dReal x, dReal y, dReal z);
+void dWorldGetGravity (dWorldID, dVector3 gravity);
+void dWorldSetERP (dWorldID, dReal erp);
+dReal dWorldGetERP (dWorldID);
+void dWorldSetCFM (dWorldID, dReal cfm);
+dReal dWorldGetCFM (dWorldID);
+void dWorldStep (dWorldID, dReal stepsize);
+void dWorldImpulseToForce (dWorldID, dReal stepsize,
+			   dReal ix, dReal iy, dReal iz, dVector3 force);
+
+/* World QuickStep functions */
+
+void dWorldQuickStep (dWorldID w, dReal stepsize);
+void dWorldSetQuickStepNumIterations (dWorldID, int num);
+int dWorldGetQuickStepNumIterations (dWorldID);
+void dWorldSetQuickStepW (dWorldID, dReal param);
+dReal dWorldGetQuickStepW (dWorldID);
+
+/* World contact parameter functions */
+
+void dWorldSetContactMaxCorrectingVel (dWorldID, dReal vel);
+dReal dWorldGetContactMaxCorrectingVel (dWorldID);
+void dWorldSetContactSurfaceLayer (dWorldID, dReal depth);
+dReal dWorldGetContactSurfaceLayer (dWorldID);
+
+/* StepFast1 functions */
+
+void dWorldStepFast1(dWorldID, dReal stepsize, int maxiterations);
+void dWorldSetAutoEnableDepthSF1(dWorldID, int autoEnableDepth);
+int dWorldGetAutoEnableDepthSF1(dWorldID);
+
+/* Auto-disable functions */
+
+dReal dWorldGetAutoDisableLinearThreshold (dWorldID);
+void  dWorldSetAutoDisableLinearThreshold (dWorldID, dReal linear_threshold);
+dReal dWorldGetAutoDisableAngularThreshold (dWorldID);
+void  dWorldSetAutoDisableAngularThreshold (dWorldID, dReal angular_threshold);
+int   dWorldGetAutoDisableSteps (dWorldID);
+void  dWorldSetAutoDisableSteps (dWorldID, int steps);
+dReal dWorldGetAutoDisableTime (dWorldID);
+void  dWorldSetAutoDisableTime (dWorldID, dReal time);
+int   dWorldGetAutoDisableFlag (dWorldID);
+void  dWorldSetAutoDisableFlag (dWorldID, int do_auto_disable);
+
+dReal dBodyGetAutoDisableLinearThreshold (dBodyID);
+void  dBodySetAutoDisableLinearThreshold (dBodyID, dReal linear_threshold);
+dReal dBodyGetAutoDisableAngularThreshold (dBodyID);
+void  dBodySetAutoDisableAngularThreshold (dBodyID, dReal angular_threshold);
+int   dBodyGetAutoDisableSteps (dBodyID);
+void  dBodySetAutoDisableSteps (dBodyID, int steps);
+dReal dBodyGetAutoDisableTime (dBodyID);
+void  dBodySetAutoDisableTime (dBodyID, dReal time);
+int   dBodyGetAutoDisableFlag (dBodyID);
+void  dBodySetAutoDisableFlag (dBodyID, int do_auto_disable);
+void  dBodySetAutoDisableDefaults (dBodyID);
+
+/* bodies */
+
+dBodyID dBodyCreate (dWorldID);
+void dBodyDestroy (dBodyID);
+
+void  dBodySetData (dBodyID, void *data);
+void *dBodyGetData (dBodyID);
+
+void dBodySetPosition   (dBodyID, dReal x, dReal y, dReal z);
+void dBodySetRotation   (dBodyID, const dMatrix3 R);
+void dBodySetQuaternion (dBodyID, const dQuaternion q);
+void dBodySetLinearVel  (dBodyID, dReal x, dReal y, dReal z);
+void dBodySetAngularVel (dBodyID, dReal x, dReal y, dReal z);
+const dReal * dBodyGetPosition   (dBodyID);
+const dReal * dBodyGetRotation   (dBodyID);	/* ptr to 4x3 rot matrix */
+const dReal * dBodyGetQuaternion (dBodyID);
+const dReal * dBodyGetLinearVel  (dBodyID);
+const dReal * dBodyGetAngularVel (dBodyID);
+
+void dBodySetMass (dBodyID, const dMass *mass);
+void dBodyGetMass (dBodyID, dMass *mass);
+
+void dBodyAddForce            (dBodyID, dReal fx, dReal fy, dReal fz);
+void dBodyAddTorque           (dBodyID, dReal fx, dReal fy, dReal fz);
+void dBodyAddRelForce         (dBodyID, dReal fx, dReal fy, dReal fz);
+void dBodyAddRelTorque        (dBodyID, dReal fx, dReal fy, dReal fz);
+void dBodyAddForceAtPos       (dBodyID, dReal fx, dReal fy, dReal fz,
+			                dReal px, dReal py, dReal pz);
+void dBodyAddForceAtRelPos    (dBodyID, dReal fx, dReal fy, dReal fz,
+			                dReal px, dReal py, dReal pz);
+void dBodyAddRelForceAtPos    (dBodyID, dReal fx, dReal fy, dReal fz,
+			                dReal px, dReal py, dReal pz);
+void dBodyAddRelForceAtRelPos (dBodyID, dReal fx, dReal fy, dReal fz,
+			                dReal px, dReal py, dReal pz);
+
+const dReal * dBodyGetForce   (dBodyID);
+const dReal * dBodyGetTorque  (dBodyID);
+void dBodySetForce  (dBodyID b, dReal x, dReal y, dReal z);
+void dBodySetTorque (dBodyID b, dReal x, dReal y, dReal z);
+
+void dBodyGetRelPointPos    (dBodyID, dReal px, dReal py, dReal pz,
+			     dVector3 result);
+void dBodyGetRelPointVel    (dBodyID, dReal px, dReal py, dReal pz,
+			     dVector3 result);
+void dBodyGetPointVel       (dBodyID, dReal px, dReal py, dReal pz,
+			     dVector3 result);
+void dBodyGetPosRelPoint    (dBodyID, dReal px, dReal py, dReal pz,
+			     dVector3 result);
+void dBodyVectorToWorld     (dBodyID, dReal px, dReal py, dReal pz,
+			     dVector3 result);
+void dBodyVectorFromWorld   (dBodyID, dReal px, dReal py, dReal pz,
+			     dVector3 result);
+
+void dBodySetFiniteRotationMode (dBodyID, int mode);
+void dBodySetFiniteRotationAxis (dBodyID, dReal x, dReal y, dReal z);
+
+int dBodyGetFiniteRotationMode (dBodyID);
+void dBodyGetFiniteRotationAxis (dBodyID, dVector3 result);
+
+int dBodyGetNumJoints (dBodyID b);
+dJointID dBodyGetJoint (dBodyID, int index);
+
+void dBodyEnable (dBodyID);
+void dBodyDisable (dBodyID);
+int dBodyIsEnabled (dBodyID);
+
+void dBodySetGravityMode (dBodyID b, int mode);
+int dBodyGetGravityMode (dBodyID b);
+
+
+/* joints */
+
+dJointID dJointCreateBall (dWorldID, dJointGroupID);
+dJointID dJointCreateHinge (dWorldID, dJointGroupID);
+dJointID dJointCreateSlider (dWorldID, dJointGroupID);
+dJointID dJointCreateContact (dWorldID, dJointGroupID, const dContact *);
+dJointID dJointCreateHinge2 (dWorldID, dJointGroupID);
+dJointID dJointCreateUniversal (dWorldID, dJointGroupID);
+dJointID dJointCreateFixed (dWorldID, dJointGroupID);
+dJointID dJointCreateNull (dWorldID, dJointGroupID);
+dJointID dJointCreateAMotor (dWorldID, dJointGroupID);
+
+void dJointDestroy (dJointID);
+
+dJointGroupID dJointGroupCreate (int max_size);
+void dJointGroupDestroy (dJointGroupID);
+void dJointGroupEmpty (dJointGroupID);
+
+void dJointAttach (dJointID, dBodyID body1, dBodyID body2);
+void dJointSetData (dJointID, void *data);
+void *dJointGetData (dJointID);
+int dJointGetType (dJointID);
+dBodyID dJointGetBody (dJointID, int index);
+
+void dJointSetFeedback (dJointID, dJointFeedback *);
+dJointFeedback *dJointGetFeedback (dJointID);
+
+void dJointSetBallAnchor (dJointID, dReal x, dReal y, dReal z);
+void dJointSetHingeAnchor (dJointID, dReal x, dReal y, dReal z);
+void dJointSetHingeAxis (dJointID, dReal x, dReal y, dReal z);
+void dJointSetHingeParam (dJointID, int parameter, dReal value);
+void dJointAddHingeTorque(dJointID joint, dReal torque);
+void dJointSetSliderAxis (dJointID, dReal x, dReal y, dReal z);
+void dJointSetSliderParam (dJointID, int parameter, dReal value);
+void dJointAddSliderForce(dJointID joint, dReal force);
+void dJointSetHinge2Anchor (dJointID, dReal x, dReal y, dReal z);
+void dJointSetHinge2Axis1 (dJointID, dReal x, dReal y, dReal z);
+void dJointSetHinge2Axis2 (dJointID, dReal x, dReal y, dReal z);
+void dJointSetHinge2Param (dJointID, int parameter, dReal value);
+void dJointAddHinge2Torques(dJointID joint, dReal torque1, dReal torque2);
+void dJointSetUniversalAnchor (dJointID, dReal x, dReal y, dReal z);
+void dJointSetUniversalAxis1 (dJointID, dReal x, dReal y, dReal z);
+void dJointSetUniversalAxis2 (dJointID, dReal x, dReal y, dReal z);
+void dJointSetUniversalParam (dJointID, int parameter, dReal value);
+void dJointAddUniversalTorques(dJointID joint, dReal torque1, dReal torque2);
+void dJointSetFixed (dJointID);
+void dJointSetAMotorNumAxes (dJointID, int num);
+void dJointSetAMotorAxis (dJointID, int anum, int rel,
+			  dReal x, dReal y, dReal z);
+void dJointSetAMotorAngle (dJointID, int anum, dReal angle);
+void dJointSetAMotorParam (dJointID, int parameter, dReal value);
+void dJointSetAMotorMode (dJointID, int mode);
+void dJointAddAMotorTorques (dJointID, dReal torque1, dReal torque2, dReal torque3);
+
+void dJointGetBallAnchor (dJointID, dVector3 result);
+void dJointGetBallAnchor2 (dJointID, dVector3 result);
+void dJointGetHingeAnchor (dJointID, dVector3 result);
+void dJointGetHingeAnchor2 (dJointID, dVector3 result);
+void dJointGetHingeAxis (dJointID, dVector3 result);
+dReal dJointGetHingeParam (dJointID, int parameter);
+dReal dJointGetHingeAngle (dJointID);
+dReal dJointGetHingeAngleRate (dJointID);
+dReal dJointGetSliderPosition (dJointID);
+dReal dJointGetSliderPositionRate (dJointID);
+void dJointGetSliderAxis (dJointID, dVector3 result);
+dReal dJointGetSliderParam (dJointID, int parameter);
+void dJointGetHinge2Anchor (dJointID, dVector3 result);
+void dJointGetHinge2Anchor2 (dJointID, dVector3 result);
+void dJointGetHinge2Axis1 (dJointID, dVector3 result);
+void dJointGetHinge2Axis2 (dJointID, dVector3 result);
+dReal dJointGetHinge2Param (dJointID, int parameter);
+dReal dJointGetHinge2Angle1 (dJointID);
+dReal dJointGetHinge2Angle1Rate (dJointID);
+dReal dJointGetHinge2Angle2Rate (dJointID);
+void dJointGetUniversalAnchor (dJointID, dVector3 result);
+void dJointGetUniversalAnchor2 (dJointID, dVector3 result);
+void dJointGetUniversalAxis1 (dJointID, dVector3 result);
+void dJointGetUniversalAxis2 (dJointID, dVector3 result);
+dReal dJointGetUniversalParam (dJointID, int parameter);
+dReal dJointGetUniversalAngle1 (dJointID);
+dReal dJointGetUniversalAngle2 (dJointID);
+dReal dJointGetUniversalAngle1Rate (dJointID);
+dReal dJointGetUniversalAngle2Rate (dJointID);
+int dJointGetAMotorNumAxes (dJointID);
+void dJointGetAMotorAxis (dJointID, int anum, dVector3 result);
+int dJointGetAMotorAxisRel (dJointID, int anum);
+dReal dJointGetAMotorAngle (dJointID, int anum);
+dReal dJointGetAMotorAngleRate (dJointID, int anum);
+dReal dJointGetAMotorParam (dJointID, int parameter);
+int dJointGetAMotorMode (dJointID);
+
+int dAreConnected (dBodyID, dBodyID);
+int dAreConnectedExcluding (dBodyID, dBodyID, int joint_type);
+
+/*
+    This code is part of the Plane2D ODE joint
+    by psero@gmx.de
+    Wed Apr 23 18:53:43 CEST 2003
+    
+    Add this code to the file: include/ode/objects.h
+*/
+
+
+dJointID dJointCreatePlane2D (dWorldID, dJointGroupID);
+
+void dJointSetPlane2DXParam (dJointID, int parameter, dReal value);
+void dJointSetPlane2DYParam (dJointID, int parameter, dReal value);
+void dJointSetPlane2DAngleParam (dJointID, int parameter, dReal value);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/collision.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/collision.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/collision.h	(revision 1812)
@@ -0,0 +1,198 @@
+/*************************************************************************
+ *                                                                       *
+ * Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith.       *
+ * All rights reserved.  Email: russ@q12.org   Web: www.q12.org          *
+ *                                                                       *
+ * This library is free software; you can redistribute it and/or         *
+ * modify it under the terms of EITHER:                                  *
+ *   (1) The GNU Lesser General Public License as published by the Free  *
+ *       Software Foundation; either version 2.1 of the License, or (at  *
+ *       your option) any later version. The text of the GNU Lesser      *
+ *       General Public License is included with this library in the     *
+ *       file LICENSE.TXT.                                               *
+ *   (2) The BSD-style license that is included with this library in     *
+ *       the file LICENSE-BSD.TXT.                                       *
+ *                                                                       *
+ * This library is distributed in the hope that it will be useful,       *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
+ * LICENSE.TXT and LICENSE-BSD.TXT for more details.                     *
+ *                                                                       *
+ *************************************************************************/
+
+#ifndef _ODE_COLLISION_H_
+#define _ODE_COLLISION_H_
+
+#include <ode/common.h>
+#include <ode/collision_space.h>
+#include <ode/contact.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* ************************************************************************ */
+/* general functions */
+
+void dGeomDestroy (dGeomID);
+void dGeomSetData (dGeomID, void *);
+void *dGeomGetData (dGeomID);
+void dGeomSetBody (dGeomID, dBodyID);
+dBodyID dGeomGetBody (dGeomID);
+void dGeomSetPosition (dGeomID, dReal x, dReal y, dReal z);
+void dGeomSetRotation (dGeomID, const dMatrix3 R);
+void dGeomSetQuaternion (dGeomID, const dQuaternion);
+const dReal * dGeomGetPosition (dGeomID);
+const dReal * dGeomGetRotation (dGeomID);
+void dGeomGetQuaternion (dGeomID, dQuaternion result);
+void dGeomGetAABB (dGeomID, dReal aabb[6]);
+int dGeomIsSpace (dGeomID);
+dSpaceID dGeomGetSpace (dGeomID);
+int dGeomGetClass (dGeomID);
+void dGeomSetCategoryBits (dGeomID, unsigned long bits);
+void dGeomSetCollideBits (dGeomID, unsigned long bits);
+unsigned long dGeomGetCategoryBits (dGeomID);
+unsigned long dGeomGetCollideBits (dGeomID);
+void dGeomEnable (dGeomID);
+void dGeomDisable (dGeomID);
+int dGeomIsEnabled (dGeomID);
+
+/* ************************************************************************ */
+/* collision detection */
+
+int dCollide (dGeomID o1, dGeomID o2, int flags, dContactGeom *contact,
+	      int skip);
+void dSpaceCollide (dSpaceID space, void *data, dNearCallback *callback);
+void dSpaceCollide2 (dGeomID o1, dGeomID o2, void *data,
+		     dNearCallback *callback);
+
+/* ************************************************************************ */
+/* standard classes */
+
+/* the maximum number of user classes that are supported */
+enum {
+  dMaxUserClasses = 4
+};
+
+/* class numbers - each geometry object needs a unique number */
+enum {
+  dSphereClass = 0,
+  dBoxClass,
+  dCCylinderClass,
+  dCylinderClass,
+  dPlaneClass,
+  dRayClass,
+  dGeomTransformClass,
+  dTriMeshClass,
+  // Terrain callback mod
+  dTerrainCallbackClass,
+  
+  dFirstSpaceClass,
+  dSimpleSpaceClass = dFirstSpaceClass,
+  dHashSpaceClass,
+  dQuadTreeSpaceClass,
+  dLastSpaceClass = dQuadTreeSpaceClass,
+
+  dFirstUserClass,
+  dLastUserClass = dFirstUserClass + dMaxUserClasses - 1,
+  dGeomNumClasses
+};
+
+// Terrain Callback mod (start)
+typedef dReal dTerrainHeightCallback(void* data,dReal x,dReal z);
+
+dGeomID dCreateTerrainCallback (dSpaceID space, dReal *pHeights,dReal vHeight,dReal vLength,int nNumNodesPerSide, int bFinite, int bPlaceable);
+dReal dGeomTerrainCallbackPointDepth (dGeomID g, dReal x, dReal y, dReal z);
+void dGeomTerrainCallbackSetHeightCallback(dGeomID g,dTerrainHeightCallback* callback);
+// Terrain Callback mod (end)
+
+dGeomID dCreateSphere (dSpaceID space, dReal radius);
+void dGeomSphereSetRadius (dGeomID sphere, dReal radius);
+dReal dGeomSphereGetRadius (dGeomID sphere);
+dReal dGeomSpherePointDepth (dGeomID sphere, dReal x, dReal y, dReal z);
+
+dGeomID dCreateBox (dSpaceID space, dReal lx, dReal ly, dReal lz);
+void dGeomBoxSetLengths (dGeomID box, dReal lx, dReal ly, dReal lz);
+void dGeomBoxGetLengths (dGeomID box, dVector3 result);
+dReal dGeomBoxPointDepth (dGeomID box, dReal x, dReal y, dReal z);
+
+dGeomID dCreatePlane (dSpaceID space, dReal a, dReal b, dReal c, dReal d);
+void dGeomPlaneSetParams (dGeomID plane, dReal a, dReal b, dReal c, dReal d);
+void dGeomPlaneGetParams (dGeomID plane, dVector4 result);
+dReal dGeomPlanePointDepth (dGeomID plane, dReal x, dReal y, dReal z);
+
+dGeomID dCreateCCylinder (dSpaceID space, dReal radius, dReal length);
+void dGeomCCylinderSetParams (dGeomID ccylinder, dReal radius, dReal length);
+void dGeomCCylinderGetParams (dGeomID ccylinder, dReal *radius, dReal *length);
+dReal dGeomCCylinderPointDepth (dGeomID ccylinder, dReal x, dReal y, dReal z);
+
+dGeomID dCreateRay (dSpaceID space, dReal length);
+void dGeomRaySetLength (dGeomID ray, dReal length);
+dReal dGeomRayGetLength (dGeomID ray);
+void dGeomRaySet (dGeomID ray, dReal px, dReal py, dReal pz,
+		  dReal dx, dReal dy, dReal dz);
+void dGeomRayGet (dGeomID ray, dVector3 start, dVector3 dir);
+
+/*
+ * Set/get ray flags that influence ray collision detection.
+ * These flags are currently only noticed by the trimesh collider, because
+ * they can make a major differences there.
+ */
+void dGeomRaySetParams (dGeomID g, int FirstContact, int BackfaceCull);
+void dGeomRayGetParams (dGeomID g, int *FirstContact, int *BackfaceCull);
+void dGeomRaySetClosestHit (dGeomID g, int closestHit);
+int dGeomRayGetClosestHit (dGeomID g);
+
+#include "collision_trimesh.h"
+
+dGeomID dCreateGeomTransform (dSpaceID space);
+void dGeomTransformSetGeom (dGeomID g, dGeomID obj);
+dGeomID dGeomTransformGetGeom (dGeomID g);
+void dGeomTransformSetCleanup (dGeomID g, int mode);
+int dGeomTransformGetCleanup (dGeomID g);
+void dGeomTransformSetInfo (dGeomID g, int mode);
+int dGeomTransformGetInfo (dGeomID g);
+
+/* ************************************************************************ */
+/* utility functions */
+
+void dClosestLineSegmentPoints (const dVector3 a1, const dVector3 a2,
+				const dVector3 b1, const dVector3 b2,
+				dVector3 cp1, dVector3 cp2);
+
+int dBoxTouchesBox (const dVector3 _p1, const dMatrix3 R1,
+		    const dVector3 side1, const dVector3 _p2,
+		    const dMatrix3 R2, const dVector3 side2);
+
+void dInfiniteAABB (dGeomID geom, dReal aabb[6]);
+void dCloseODE();
+
+/* ************************************************************************ */
+/* custom classes */
+
+typedef void dGetAABBFn (dGeomID, dReal aabb[6]);
+typedef int dColliderFn (dGeomID o1, dGeomID o2,
+			 int flags, dContactGeom *contact, int skip);
+typedef dColliderFn * dGetColliderFnFn (int num);
+typedef void dGeomDtorFn (dGeomID o);
+typedef int dAABBTestFn (dGeomID o1, dGeomID o2, dReal aabb[6]);
+
+typedef struct dGeomClass {
+  int bytes;
+  dGetColliderFnFn *collider;
+  dGetAABBFn *aabb;
+  dAABBTestFn *aabb_test;
+  dGeomDtorFn *dtor;
+} dGeomClass;
+
+int dCreateGeomClass (const dGeomClass *classptr);
+void * dGeomGetClassData (dGeomID);
+dGeomID dCreateGeom (int classnum);
+
+/* ************************************************************************ */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/contact.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/contact.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/contact.h	(revision 1812)
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *                                                                       *
+ * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith.       *
+ * All rights reserved.  Email: russ@q12.org   Web: www.q12.org          *
+ *                                                                       *
+ * This library is free software; you can redistribute it and/or         *
+ * modify it under the terms of EITHER:                                  *
+ *   (1) The GNU Lesser General Public License as published by the Free  *
+ *       Software Foundation; either version 2.1 of the License, or (at  *
+ *       your option) any later version. The text of the GNU Lesser      *
+ *       General Public License is included with this library in the     *
+ *       file LICENSE.TXT.                                               *
+ *   (2) The BSD-style license that is included with this library in     *
+ *       the file LICENSE-BSD.TXT.                                       *
+ *                                                                       *
+ * This library is distributed in the hope that it will be useful,       *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
+ * LICENSE.TXT and LICENSE-BSD.TXT for more details.                     *
+ *                                                                       *
+ *************************************************************************/
+
+#ifndef _ODE_CONTACT_H_
+#define _ODE_CONTACT_H_
+
+#include <ode/common.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+enum {
+  dContactMu2		= 0x001,
+  dContactFDir1		= 0x002,
+  dContactBounce	= 0x004,
+  dContactSoftERP	= 0x008,
+  dContactSoftCFM	= 0x010,
+  dContactMotion1	= 0x020,
+  dContactMotion2	= 0x040,
+  dContactSlip1		= 0x080,
+  dContactSlip2		= 0x100,
+
+  dContactApprox0	= 0x0000,
+  dContactApprox1_1	= 0x1000,
+  dContactApprox1_2	= 0x2000,
+  dContactApprox1	= 0x3000
+};
+
+
+typedef struct dSurfaceParameters {
+  /* must always be defined */
+  int mode;
+  dReal mu;
+
+  /* only defined if the corresponding flag is set in mode */
+  dReal mu2;
+  dReal bounce;
+  dReal bounce_vel;
+  dReal soft_erp;
+  dReal soft_cfm;
+  dReal motion1,motion2;
+  dReal slip1,slip2;
+} dSurfaceParameters;
+
+
+/* contact info set by collision functions */
+
+typedef struct dContactGeom {
+  dVector3 pos;
+  dVector3 normal;
+  dReal depth;
+  dGeomID g1,g2;
+} dContactGeom;
+
+
+/* contact info used by contact joint */
+
+typedef struct dContact {
+  dSurfaceParameters surface;
+  dContactGeom geom;
+  dVector3 fdir1;
+} dContact;
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/misc.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/misc.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/misc.h	(revision 1812)
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *                                                                       *
+ * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith.       *
+ * All rights reserved.  Email: russ@q12.org   Web: www.q12.org          *
+ *                                                                       *
+ * This library is free software; you can redistribute it and/or         *
+ * modify it under the terms of EITHER:                                  *
+ *   (1) The GNU Lesser General Public License as published by the Free  *
+ *       Software Foundation; either version 2.1 of the License, or (at  *
+ *       your option) any later version. The text of the GNU Lesser      *
+ *       General Public License is included with this library in the     *
+ *       file LICENSE.TXT.                                               *
+ *   (2) The BSD-style license that is included with this library in     *
+ *       the file LICENSE-BSD.TXT.                                       *
+ *                                                                       *
+ * This library is distributed in the hope that it will be useful,       *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
+ * LICENSE.TXT and LICENSE-BSD.TXT for more details.                     *
+ *                                                                       *
+ *************************************************************************/
+
+/* miscellaneous math functions. these are mostly useful for testing */
+
+#ifndef _ODE_MISC_H_
+#define _ODE_MISC_H_
+
+#include <ode/common.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* return 1 if the random number generator is working. */
+int dTestRand();
+
+/* return next 32 bit random number. this uses a not-very-random linear
+ * congruential method.
+ */
+unsigned long dRand();
+
+/* get and set the current random number seed. */
+unsigned long  dRandGetSeed();
+void dRandSetSeed (unsigned long s);
+
+/* return a random integer between 0..n-1. the distribution will get worse
+ * as n approaches 2^32.
+ */
+int dRandInt (int n);
+
+/* return a random real number between 0..1 */
+dReal dRandReal();
+
+/* print out a matrix */
+#ifdef __cplusplus
+void dPrintMatrix (const dReal *A, int n, int m, char *fmt = "%10.4f ",
+		   FILE *f=stdout);
+#else
+void dPrintMatrix (const dReal *A, int n, int m, char *fmt, FILE *f);
+#endif
+
+/* make a random vector with entries between +/- range. A has n elements. */
+void dMakeRandomVector (dReal *A, int n, dReal range);
+
+/* make a random matrix with entries between +/- range. A has size n*m. */
+void dMakeRandomMatrix (dReal *A, int n, int m, dReal range);
+
+/* clear the upper triangle of a square matrix */
+void dClearUpperTriangle (dReal *A, int n);
+
+/* return the maximum element difference between the two n*m matrices */
+dReal dMaxDifference (const dReal *A, const dReal *B, int n, int m);
+
+/* return the maximum element difference between the lower triangle of two
+ * n*n matrices */
+dReal dMaxDifferenceLowerTriangle (const dReal *A, const dReal *B, int n);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/rotation.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/rotation.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/rotation.h	(revision 1812)
@@ -0,0 +1,70 @@
+/*************************************************************************
+ *                                                                       *
+ * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith.       *
+ * All rights reserved.  Email: russ@q12.org   Web: www.q12.org          *
+ *                                                                       *
+ * This library is free software; you can redistribute it and/or         *
+ * modify it under the terms of EITHER:                                  *
+ *   (1) The GNU Lesser General Public License as published by the Free  *
+ *       Software Foundation; either version 2.1 of the License, or (at  *
+ *       your option) any later version. The text of the GNU Lesser      *
+ *       General Public License is included with this library in the     *
+ *       file LICENSE.TXT.                                               *
+ *   (2) The BSD-style license that is included with this library in     *
+ *       the file LICENSE-BSD.TXT.                                       *
+ *                                                                       *
+ * This library is distributed in the hope that it will be useful,       *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
+ * LICENSE.TXT and LICENSE-BSD.TXT for more details.                     *
+ *                                                                       *
+ *************************************************************************/
+
+#ifndef _ODE_ROTATION_H_
+#define _ODE_ROTATION_H_
+
+#include <ode/common.h>
+#include <ode/compatibility.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+void dRSetIdentity (dMatrix3 R);
+
+void dRFromAxisAndAngle (dMatrix3 R, dReal ax, dReal ay, dReal az,
+			 dReal angle);
+
+void dRFromEulerAngles (dMatrix3 R, dReal phi, dReal theta, dReal psi);
+
+void dRFrom2Axes (dMatrix3 R, dReal ax, dReal ay, dReal az,
+		  dReal bx, dReal by, dReal bz);
+
+void dRFromZAxis (dMatrix3 R, dReal ax, dReal ay, dReal az);
+
+void dQSetIdentity (dQuaternion q);
+
+void dQFromAxisAndAngle (dQuaternion q, dReal ax, dReal ay, dReal az,
+			 dReal angle);
+
+/* Quaternion multiplication, analogous to the matrix multiplication routines. */
+/* qa = rotate by qc, then qb */
+void dQMultiply0 (dQuaternion qa, const dQuaternion qb, const dQuaternion qc);
+/* qa = rotate by qc, then by inverse of qb */
+void dQMultiply1 (dQuaternion qa, const dQuaternion qb, const dQuaternion qc);
+/* qa = rotate by inverse of qc, then by qb */
+void dQMultiply2 (dQuaternion qa, const dQuaternion qb, const dQuaternion qc);
+/* qa = rotate by inverse of qc, then by inverse of qb */
+void dQMultiply3 (dQuaternion qa, const dQuaternion qb, const dQuaternion qc);
+
+void dRfromQ (dMatrix3 R, const dQuaternion q);
+void dQfromR (dQuaternion q, const dMatrix3 R);
+void dDQfromW (dReal dq[4], const dVector3 w, const dQuaternion q);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/mass.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/mass.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/mass.h	(revision 1812)
@@ -0,0 +1,107 @@
+/*************************************************************************
+ *                                                                       *
+ * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith.       *
+ * All rights reserved.  Email: russ@q12.org   Web: www.q12.org          *
+ *                                                                       *
+ * This library is free software; you can redistribute it and/or         *
+ * modify it under the terms of EITHER:                                  *
+ *   (1) The GNU Lesser General Public License as published by the Free  *
+ *       Software Foundation; either version 2.1 of the License, or (at  *
+ *       your option) any later version. The text of the GNU Lesser      *
+ *       General Public License is included with this library in the     *
+ *       file LICENSE.TXT.                                               *
+ *   (2) The BSD-style license that is included with this library in     *
+ *       the file LICENSE-BSD.TXT.                                       *
+ *                                                                       *
+ * This library is distributed in the hope that it will be useful,       *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
+ * LICENSE.TXT and LICENSE-BSD.TXT for more details.                     *
+ *                                                                       *
+ *************************************************************************/
+
+#ifndef _ODE_MASS_H_
+#define _ODE_MASS_H_
+
+#include <ode/common.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct dMass;
+typedef struct dMass dMass;
+
+
+void dMassSetZero (dMass *);
+
+void dMassSetParameters (dMass *, dReal themass,
+			 dReal cgx, dReal cgy, dReal cgz,
+			 dReal I11, dReal I22, dReal I33,
+			 dReal I12, dReal I13, dReal I23);
+
+void dMassSetSphere (dMass *, dReal density, dReal radius);
+void dMassSetSphereTotal (dMass *, dReal total_mass, dReal radius);
+
+void dMassSetCappedCylinder (dMass *, dReal density, int direction,
+			     dReal radius, dReal length);
+void dMassSetCappedCylinderTotal (dMass *, dReal total_mass, int direction,
+				  dReal radius, dReal length);
+
+void dMassSetCylinder (dMass *, dReal density, int direction,
+		       dReal radius, dReal length);
+void dMassSetCylinderTotal (dMass *, dReal total_mass, int direction,
+			    dReal radius, dReal length);
+
+void dMassSetBox (dMass *, dReal density,
+		  dReal lx, dReal ly, dReal lz);
+void dMassSetBoxTotal (dMass *, dReal total_mass,
+		       dReal lx, dReal ly, dReal lz);
+
+void dMassAdjust (dMass *, dReal newmass);
+
+void dMassTranslate (dMass *, dReal x, dReal y, dReal z);
+
+void dMassRotate (dMass *, const dMatrix3 R);
+
+void dMassAdd (dMass *a, const dMass *b);
+
+
+
+struct dMass {
+  dReal mass;
+  dVector4 c;
+  dMatrix3 I;
+
+#ifdef __cplusplus
+  dMass()
+    { dMassSetZero (this); }
+  void setZero()
+    { dMassSetZero (this); }
+  void setParameters (dReal themass, dReal cgx, dReal cgy, dReal cgz,
+		      dReal I11, dReal I22, dReal I33,
+		      dReal I12, dReal I13, dReal I23)
+    { dMassSetParameters (this,themass,cgx,cgy,cgz,I11,I22,I33,I12,I13,I23); }
+  void setSphere (dReal density, dReal radius)
+    { dMassSetSphere (this,density,radius); }
+  void setCappedCylinder (dReal density, int direction, dReal a, dReal b)
+    { dMassSetCappedCylinder (this,density,direction,a,b); }
+  void setBox (dReal density, dReal lx, dReal ly, dReal lz)
+    { dMassSetBox (this,density,lx,ly,lz); }
+  void adjust (dReal newmass)
+    { dMassAdjust (this,newmass); }
+  void translate (dReal x, dReal y, dReal z)
+    { dMassTranslate (this,x,y,z); }
+  void rotate (const dMatrix3 R)
+    { dMassRotate (this,R); }
+  void add (const dMass *b)
+    { dMassAdd (this,b); }
+#endif
+};
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/matrix.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/matrix.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/matrix.h	(revision 1812)
@@ -0,0 +1,194 @@
+/*************************************************************************
+ *                                                                       *
+ * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith.       *
+ * All rights reserved.  Email: russ@q12.org   Web: www.q12.org          *
+ *                                                                       *
+ * This library is free software; you can redistribute it and/or         *
+ * modify it under the terms of EITHER:                                  *
+ *   (1) The GNU Lesser General Public License as published by the Free  *
+ *       Software Foundation; either version 2.1 of the License, or (at  *
+ *       your option) any later version. The text of the GNU Lesser      *
+ *       General Public License is included with this library in the     *
+ *       file LICENSE.TXT.                                               *
+ *   (2) The BSD-style license that is included with this library in     *
+ *       the file LICENSE-BSD.TXT.                                       *
+ *                                                                       *
+ * This library is distributed in the hope that it will be useful,       *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
+ * LICENSE.TXT and LICENSE-BSD.TXT for more details.                     *
+ *                                                                       *
+ *************************************************************************/
+
+/* optimized and unoptimized vector and matrix functions */
+
+#ifndef _ODE_MATRIX_H_
+#define _ODE_MATRIX_H_
+
+#include <ode/common.h>
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* set a vector/matrix of size n to all zeros, or to a specific value. */
+
+void dSetZero (dReal *a, int n);
+void dSetValue (dReal *a, int n, dReal value);
+
+
+/* get the dot product of two n*1 vectors. if n <= 0 then
+ * zero will be returned (in which case a and b need not be valid).
+ */
+
+dReal dDot (const dReal *a, const dReal *b, int n);
+
+
+/* get the dot products of (a0,b), (a1,b), etc and return them in outsum.
+ * all vectors are n*1. if n <= 0 then zeroes will be returned (in which case
+ * the input vectors need not be valid). this function is somewhat faster
+ * than calling dDot() for all of the combinations separately.
+ */
+
+/* NOT INCLUDED in the library for now.
+void dMultidot2 (const dReal *a0, const dReal *a1,
+		 const dReal *b, dReal *outsum, int n);
+*/
+
+
+/* matrix multiplication. all matrices are stored in standard row format.
+ * the digit refers to the argument that is transposed:
+ *   0:   A = B  * C   (sizes: A:p*r B:p*q C:q*r)
+ *   1:   A = B' * C   (sizes: A:p*r B:q*p C:q*r)
+ *   2:   A = B  * C'  (sizes: A:p*r B:p*q C:r*q)
+ * case 1,2 are equivalent to saying that the operation is A=B*C but
+ * B or C are stored in standard column format.
+ */
+
+void dMultiply0 (dReal *A, const dReal *B, const dReal *C, int p,int q,int r);
+void dMultiply1 (dReal *A, const dReal *B, const dReal *C, int p,int q,int r);
+void dMultiply2 (dReal *A, const dReal *B, const dReal *C, int p,int q,int r);
+
+
+/* do an in-place cholesky decomposition on the lower triangle of the n*n
+ * symmetric matrix A (which is stored by rows). the resulting lower triangle
+ * will be such that L*L'=A. return 1 on success and 0 on failure (on failure
+ * the matrix is not positive definite).
+ */
+
+int dFactorCholesky (dReal *A, int n);
+
+
+/* solve for x: L*L'*x = b, and put the result back into x.
+ * L is size n*n, b is size n*1. only the lower triangle of L is considered.
+ */
+
+void dSolveCholesky (const dReal *L, dReal *b, int n);
+
+
+/* compute the inverse of the n*n positive definite matrix A and put it in
+ * Ainv. this is not especially fast. this returns 1 on success (A was
+ * positive definite) or 0 on failure (not PD).
+ */
+
+int dInvertPDMatrix (const dReal *A, dReal *Ainv, int n);
+
+
+/* check whether an n*n matrix A is positive definite, return 1/0 (yes/no).
+ * positive definite means that x'*A*x > 0 for any x. this performs a
+ * cholesky decomposition of A. if the decomposition fails then the matrix
+ * is not positive definite. A is stored by rows. A is not altered.
+ */
+
+int dIsPositiveDefinite (const dReal *A, int n);
+
+
+/* factorize a matrix A into L*D*L', where L is lower triangular with ones on
+ * the diagonal, and D is diagonal.
+ * A is an n*n matrix stored by rows, with a leading dimension of n rounded
+ * up to 4. L is written into the strict lower triangle of A (the ones are not
+ * written) and the reciprocal of the diagonal elements of D are written into
+ * d.
+ */
+void dFactorLDLT (dReal *A, dReal *d, int n, int nskip);
+
+
+/* solve L*x=b, where L is n*n lower triangular with ones on the diagonal,
+ * and x,b are n*1. b is overwritten with x.
+ * the leading dimension of L is `nskip'.
+ */
+void dSolveL1 (const dReal *L, dReal *b, int n, int nskip);
+
+
+/* solve L'*x=b, where L is n*n lower triangular with ones on the diagonal,
+ * and x,b are n*1. b is overwritten with x.
+ * the leading dimension of L is `nskip'.
+ */
+void dSolveL1T (const dReal *L, dReal *b, int n, int nskip);
+
+
+/* in matlab syntax: a(1:n) = a(1:n) .* d(1:n) */
+
+void dVectorScale (dReal *a, const dReal *d, int n);
+
+
+/* given `L', a n*n lower triangular matrix with ones on the diagonal,
+ * and `d', a n*1 vector of the reciprocal diagonal elements of an n*n matrix
+ * D, solve L*D*L'*x=b where x,b are n*1. x overwrites b.
+ * the leading dimension of L is `nskip'.
+ */
+
+void dSolveLDLT (const dReal *L, const dReal *d, dReal *b, int n, int nskip);
+
+
+/* given an L*D*L' factorization of an n*n matrix A, return the updated
+ * factorization L2*D2*L2' of A plus the following "top left" matrix:
+ *
+ *    [ b a' ]     <-- b is a[0]
+ *    [ a 0  ]     <-- a is a[1..n-1]
+ *
+ *   - L has size n*n, its leading dimension is nskip. L is lower triangular
+ *     with ones on the diagonal. only the lower triangle of L is referenced.
+ *   - d has size n. d contains the reciprocal diagonal elements of D.
+ *   - a has size n.
+ * the result is written into L, except that the left column of L and d[0]
+ * are not actually modified. see ldltaddTL.m for further comments. 
+ */
+void dLDLTAddTL (dReal *L, dReal *d, const dReal *a, int n, int nskip);
+
+
+/* given an L*D*L' factorization of a permuted matrix A, produce a new
+ * factorization for row and column `r' removed.
+ *   - A has size n1*n1, its leading dimension in nskip. A is symmetric and
+ *     positive definite. only the lower triangle of A is referenced.
+ *     A itself may actually be an array of row pointers.
+ *   - L has size n2*n2, its leading dimension in nskip. L is lower triangular
+ *     with ones on the diagonal. only the lower triangle of L is referenced.
+ *   - d has size n2. d contains the reciprocal diagonal elements of D.
+ *   - p is a permutation vector. it contains n2 indexes into A. each index
+ *     must be in the range 0..n1-1.
+ *   - r is the row/column of L to remove.
+ * the new L will be written within the old L, i.e. will have the same leading
+ * dimension. the last row and column of L, and the last element of d, are
+ * undefined on exit.
+ *
+ * a fast O(n^2) algorithm is used. see ldltremove.m for further comments.
+ */
+void dLDLTRemove (dReal **A, const int *p, dReal *L, dReal *d,
+		  int n1, int n2, int r, int nskip);
+
+
+/* given an n*n matrix A (with leading dimension nskip), remove the r'th row
+ * and column by moving elements. the new matrix will have the same leading
+ * dimension. the last row and column of A are untouched on exit.
+ */
+void dRemoveRowCol (dReal *A, int n, int nskip, int r);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/config.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/config.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/config.h	(revision 1812)
@@ -0,0 +1,50 @@
+/* per-machine configuration. this file is automatically generated. */
+
+#ifndef _ODE_CONFIG_H_
+#define _ODE_CONFIG_H_
+
+/* standard system headers */
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+#include <stdarg.h>
+#include <malloc.h>
+#include <float.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* is this a pentium on a gcc-based platform? */
+/* #define PENTIUM 1 -- not a pentium */
+
+/* integer types (we assume int >= 32 bits) */
+typedef char int8;
+typedef unsigned char uint8;
+typedef short int16;
+typedef unsigned short uint16;
+typedef int int32;
+typedef unsigned int uint32;
+
+/* an integer type that we can safely cast a pointer to and
+ * from without loss of bits.
+ */
+typedef unsigned int intP;
+
+/* select the base floating point type */
+#define dSINGLE 1
+
+/* the floating point infinity */
+#define dInfinity FLT_MAX
+
+/* available functions */
+#define copysignf copysign
+#define copysign _copysign
+#define snprintf _snprintf
+#define vsnprintf _vsnprintf
+
+#ifdef __cplusplus
+}
+#endif
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/collision_space.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/collision_space.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/collision_space.h	(revision 1812)
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *                                                                       *
+ * Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith.       *
+ * All rights reserved.  Email: russ@q12.org   Web: www.q12.org          *
+ *                                                                       *
+ * This library is free software; you can redistribute it and/or         *
+ * modify it under the terms of EITHER:                                  *
+ *   (1) The GNU Lesser General Public License as published by the Free  *
+ *       Software Foundation; either version 2.1 of the License, or (at  *
+ *       your option) any later version. The text of the GNU Lesser      *
+ *       General Public License is included with this library in the     *
+ *       file LICENSE.TXT.                                               *
+ *   (2) The BSD-style license that is included with this library in     *
+ *       the file LICENSE-BSD.TXT.                                       *
+ *                                                                       *
+ * This library is distributed in the hope that it will be useful,       *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
+ * LICENSE.TXT and LICENSE-BSD.TXT for more details.                     *
+ *                                                                       *
+ *************************************************************************/
+
+#ifndef _ODE_COLLISION_SPACE_H_
+#define _ODE_COLLISION_SPACE_H_
+
+#include <ode/common.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct dContactGeom;
+
+typedef void dNearCallback (void *data, dGeomID o1, dGeomID o2);
+
+
+dSpaceID dSimpleSpaceCreate (dSpaceID space);
+dSpaceID dHashSpaceCreate (dSpaceID space);
+dSpaceID dQuadTreeSpaceCreate (dSpaceID space, dVector3 Center, dVector3 Extents, int Depth);
+
+void dSpaceDestroy (dSpaceID);
+
+void dHashSpaceSetLevels (dSpaceID space, int minlevel, int maxlevel);
+void dHashSpaceGetLevels (dSpaceID space, int *minlevel, int *maxlevel);
+
+void dSpaceSetCleanup (dSpaceID space, int mode);
+int dSpaceGetCleanup (dSpaceID space);
+
+void dSpaceAdd (dSpaceID, dGeomID);
+void dSpaceRemove (dSpaceID, dGeomID);
+int dSpaceQuery (dSpaceID, dGeomID);
+void dSpaceClean (dSpaceID);
+int dSpaceGetNumGeoms (dSpaceID);
+dGeomID dSpaceGetGeom (dSpaceID, int i);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/README
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/README	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/README	(revision 1812)
@@ -0,0 +1,18 @@
+
+this is the public C interface to the ODE library.
+
+all these files should be includable from C, i.e. they should not use any
+C++ features. everything should be protected with
+
+	#ifdef __cplusplus
+	extern "C" {
+	#endif
+
+	...
+
+	#ifdef __cplusplus
+	}
+	#endif
+
+the only exceptions are the odecpp.h and odecpp_collisioh.h files, which define a C++ wrapper for
+the C interface. remember to keep this in sync!
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/ode.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/ode.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/ode.h	(revision 1812)
@@ -0,0 +1,47 @@
+/*************************************************************************
+ *                                                                       *
+ * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith.       *
+ * All rights reserved.  Email: russ@q12.org   Web: www.q12.org          *
+ *                                                                       *
+ * This library is free software; you can redistribute it and/or         *
+ * modify it under the terms of EITHER:                                  *
+ *   (1) The GNU Lesser General Public License as published by the Free  *
+ *       Software Foundation; either version 2.1 of the License, or (at  *
+ *       your option) any later version. The text of the GNU Lesser      *
+ *       General Public License is included with this library in the     *
+ *       file LICENSE.TXT.                                               *
+ *   (2) The BSD-style license that is included with this library in     *
+ *       the file LICENSE-BSD.TXT.                                       *
+ *                                                                       *
+ * This library is distributed in the hope that it will be useful,       *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
+ * LICENSE.TXT and LICENSE-BSD.TXT for more details.                     *
+ *                                                                       *
+ *************************************************************************/
+
+#ifndef _ODE_ODE_H_
+#define _ODE_ODE_H_
+
+/* include *everything* here */
+
+#include <ode/config.h>
+#include <ode/compatibility.h>
+#include <ode/common.h>
+#include <ode/contact.h>
+#include <ode/error.h>
+#include <ode/memory.h>
+#include <ode/odemath.h>
+#include <ode/matrix.h>
+#include <ode/timer.h>
+#include <ode/rotation.h>
+#include <ode/mass.h>
+#include <ode/misc.h>
+#include <ode/objects.h>
+#include <ode/odecpp.h>
+#include <ode/collision_space.h>
+#include <ode/collision.h>
+#include <ode/odecpp_collision.h>
+#include <ode/export-dif.h>
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/odecpp_old.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/odecpp_old.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/odecpp_old.h	(revision 1812)
@@ -0,0 +1,316 @@
+/*************************************************************************
+ *                                                                       *
+ * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith.       *
+ * All rights reserved.  Email: russ@q12.org   Web: www.q12.org          *
+ *                                                                       *
+ * This library is free software; you can redistribute it and/or         *
+ * modify it under the terms of EITHER:                                  *
+ *   (1) The GNU Lesser General Public License as published by the Free  *
+ *       Software Foundation; either version 2.1 of the License, or (at  *
+ *       your option) any later version. The text of the GNU Lesser      *
+ *       General Public License is included with this library in the     *
+ *       file LICENSE.TXT.                                               *
+ *   (2) The BSD-style license that is included with this library in     *
+ *       the file LICENSE-BSD.TXT.                                       *
+ *                                                                       *
+ * This library is distributed in the hope that it will be useful,       *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
+ * LICENSE.TXT and LICENSE-BSD.TXT for more details.                     *
+ *                                                                       *
+ *************************************************************************/
+
+/* this is the old C++ interface, the new C++ interface is not quite
+ * compatible with this. but this file is kept around in case you were
+ * using the old interface.
+ */
+
+#ifndef _ODE_ODECPP_H_
+#define _ODE_ODECPP_H_
+#ifdef __cplusplus
+
+#include <ode/error.h>
+
+
+class dWorld {
+  dWorldID _id;
+
+  dWorld (dWorld &) { dDebug (0,"bad"); }
+  void operator= (dWorld &) { dDebug (0,"bad"); }
+
+public:
+  dWorld()
+    { _id = dWorldCreate(); }
+  ~dWorld()
+    { dWorldDestroy (_id); }
+  dWorldID id()
+    { return _id; }
+
+  void setGravity (dReal x, dReal y, dReal z)
+    { dWorldSetGravity (_id,x,y,z); }
+  void getGravity (dVector3 g)
+    { dWorldGetGravity (_id,g); }
+  void step (dReal stepsize)
+    { dWorldStep (_id,stepsize); }
+};
+
+
+class dBody {
+  dBodyID _id;
+
+  dBody (dBody &) { dDebug (0,"bad"); }
+  void operator= (dBody &) { dDebug (0,"bad"); }
+
+public:
+  dBody()
+    { _id = 0; }
+  dBody (dWorld &world)
+    { _id = dBodyCreate (world.id()); }
+  ~dBody()
+    { dBodyDestroy (_id); }
+  void create (dWorld &world)
+    { if (_id) dBodyDestroy (_id); _id = dBodyCreate (world.id()); }
+  dBodyID id()
+    { return _id; }
+
+  void setData (void *data)
+    { dBodySetData (_id,data); }
+  void *getData()
+    { return dBodyGetData (_id); }
+
+  void setPosition (dReal x, dReal y, dReal z)
+    { dBodySetPosition (_id,x,y,z); }
+  void setRotation (const dMatrix3 R)
+    { dBodySetRotation (_id,R); }
+  void setQuaternion (const dQuaternion q)
+    { dBodySetQuaternion (_id,q); }
+  void setLinearVel  (dReal x, dReal y, dReal z)
+    { dBodySetLinearVel (_id,x,y,z); }
+  void setAngularVel (dReal x, dReal y, dReal z)
+    { dBodySetAngularVel (_id,x,y,z); }
+
+  const dReal * getPosition()
+    { return dBodyGetPosition (_id); }
+  const dReal * getRotation()
+    { return dBodyGetRotation (_id); }
+  const dReal * getQuaternion()
+    { return dBodyGetQuaternion (_id); }
+  const dReal * getLinearVel()
+    { return dBodyGetLinearVel (_id); }
+  const dReal * getAngularVel()
+    { return dBodyGetAngularVel (_id); }
+
+  void setMass (const dMass *mass)
+    { dBodySetMass (_id,mass); }
+  void getMass (dMass *mass)
+    { dBodyGetMass (_id,mass); }
+
+  void addForce (dReal fx, dReal fy, dReal fz)
+    { dBodyAddForce (_id, fx, fy, fz); }
+  void addTorque (dReal fx, dReal fy, dReal fz)
+    { dBodyAddTorque (_id, fx, fy, fz); }
+  void addRelForce (dReal fx, dReal fy, dReal fz)
+    { dBodyAddRelForce (_id, fx, fy, fz); }
+  void addRelTorque (dReal fx, dReal fy, dReal fz)
+    { dBodyAddRelTorque (_id, fx, fy, fz); }
+  void addForceAtPos (dReal fx, dReal fy, dReal fz,
+		      dReal px, dReal py, dReal pz)
+    { dBodyAddForceAtPos (_id, fx, fy, fz, px, py, pz); }
+  void addRelForceAtPos (dReal fx, dReal fy, dReal fz,
+			 dReal px, dReal py, dReal pz)
+    { dBodyAddRelForceAtPos (_id, fx, fy, fz, px, py, pz); }
+  void addRelForceAtRelPos (dReal fx, dReal fy, dReal fz,
+			    dReal px, dReal py, dReal pz)
+    { dBodyAddRelForceAtRelPos (_id, fx, fy, fz, px, py, pz); }
+
+  void getRelPointPos (dReal px, dReal py, dReal pz, dVector3 result)
+    { dBodyGetRelPointPos (_id, px, py, pz, result); }
+  void getRelPointVel (dReal px, dReal py, dReal pz, dVector3 result)
+    { dBodyGetRelPointVel (_id, px, py, pz, result); }
+
+  int isConnectedTo (const dBody &b)
+    { return dAreConnected (_id,b._id); }
+};
+
+
+class dJointGroup {
+  dJointGroupID _id;
+
+  dJointGroup (dJointGroup &) { dDebug (0,"bad"); }
+  void operator= (dJointGroup &) { dDebug (0,"bad"); }
+
+public:
+  dJointGroup()
+    { _id = 0; }
+  dJointGroup (int max_size)
+    { _id = dJointGroupCreate (max_size); }
+  ~dJointGroup()
+    { dJointGroupDestroy (_id); }
+  void create (int max_size)
+    { if (_id) dJointGroupDestroy (_id); _id = dJointGroupCreate (max_size); }
+  dJointGroupID id()
+    { return _id; }
+
+  void empty()
+    { dJointGroupEmpty (_id); }
+};
+
+
+class dJoint {
+  dJointID _id;
+
+  dJoint (dJoint &) { dDebug (0,"bad"); }
+  void operator= (dJoint &) { dDebug (0,"bad"); }
+
+public:
+  dJoint()
+    { _id = 0; }
+  ~dJoint()
+    { dJointDestroy (_id); }
+  dJointID id()
+    { return _id; }
+
+  void createBall (dWorld &world, dJointGroup *group=0) {
+    if (_id) dJointDestroy (_id);
+    _id = dJointCreateBall (world.id(), group ? group->id() : 0);
+  }
+  void createHinge (dWorld &world, dJointGroup *group=0) {
+    if (_id) dJointDestroy (_id);
+    _id = dJointCreateHinge (world.id(), group ? group->id() : 0);
+  }
+  void createSlider (dWorld &world, dJointGroup *group=0) {
+    if (_id) dJointDestroy (_id);
+    _id = dJointCreateSlider (world.id(), group ? group->id() : 0);
+  }
+  void createContact (dWorld &world, dJointGroup *group, dContact *contact) {
+    if (_id) dJointDestroy (_id);
+    _id = dJointCreateContact (world.id(), group ? group->id() : 0, contact);
+  }
+
+  void attach (dBody &body1, dBody &body2)
+    { dJointAttach (_id, body1.id(), body2.id()); }
+
+  void setBallAnchor (dReal x, dReal y, dReal z)
+    { dJointSetBallAnchor (_id, x, y, z); }
+  void setHingeAnchor (dReal x, dReal y, dReal z)
+    { dJointSetHingeAnchor (_id, x, y, z); }
+
+  void setHingeAxis (dReal x, dReal y, dReal z)
+    { dJointSetHingeAxis (_id, x, y, z); }
+  void setSliderAxis (dReal x, dReal y, dReal z)
+    { dJointSetSliderAxis (_id, x, y, z); }
+
+  void getBallAnchor (dVector3 result)
+    { dJointGetBallAnchor (_id, result); }
+  void getHingeAnchor (dVector3 result)
+    { dJointGetHingeAnchor (_id, result); }
+
+  void getHingeAxis (dVector3 result)
+    { dJointGetHingeAxis (_id, result); }
+  void getSliderAxis (dVector3 result)
+    { dJointGetSliderAxis (_id, result); }
+};
+
+
+class dSpace {
+  dSpaceID _id;
+
+  dSpace (dSpace &) { dDebug (0,"bad"); }
+  void operator= (dSpace &) { dDebug (0,"bad"); }
+
+public:
+  dSpace ()
+    { _id = dHashSpaceCreate(); }
+  ~dSpace()
+    { dSpaceDestroy (_id); }
+  dSpaceID id()
+    { return _id; }
+  void collide (void *data, dNearCallback *callback)
+    { dSpaceCollide (_id,data,callback); }
+};
+
+
+class dGeom {
+  dGeomID _id;
+
+  dGeom (dGeom &) { dDebug (0,"bad"); }
+  void operator= (dGeom &) { dDebug (0,"bad"); }
+
+public:
+  dGeom()
+    { _id = 0; }
+  ~dGeom()
+    { dGeomDestroy (_id); }
+  dGeomID id()
+    { return _id; }
+
+  void createSphere (dSpace &space, dReal radius) {
+    if (_id) dGeomDestroy (_id);
+    _id = dCreateSphere (space.id(),radius);
+  }
+
+  void createBox (dSpace &space, dReal lx, dReal ly, dReal lz) {
+    if (_id) dGeomDestroy (_id);
+    _id = dCreateBox (space.id(),lx,ly,lz);
+  }
+
+  void createPlane (dSpace &space, dReal a, dReal b, dReal c, dReal d) {
+    if (_id) dGeomDestroy (_id);
+    _id = dCreatePlane (space.id(),a,b,c,d);
+  }
+
+  void createCCylinder (dSpace &space, dReal radius, dReal length) {
+    if (_id) dGeomDestroy (_id);
+    _id = dCreateCCylinder (space.id(),radius,length);
+  }
+
+  void destroy() {
+    if (_id) dGeomDestroy (_id);
+    _id = 0;
+  }
+
+  int getClass()
+    { return dGeomGetClass (_id); }
+
+  dReal sphereGetRadius()
+    { return dGeomSphereGetRadius (_id); }
+
+  void boxGetLengths (dVector3 result)
+    { dGeomBoxGetLengths (_id,result); }
+
+  void planeGetParams (dVector4 result)
+    { dGeomPlaneGetParams (_id,result); }
+
+  void CCylinderGetParams (dReal *radius, dReal *length)
+    { dGeomCCylinderGetParams (_id,radius,length); }
+
+  void setData (void *data)
+    { dGeomSetData (_id,data); }
+
+  void *getData()
+    { return dGeomGetData (_id); }
+
+  void setBody (dBody &b)
+    { dGeomSetBody (_id,b.id()); }
+  void setBody (dBodyID b)
+    { dGeomSetBody (_id,b); }
+
+  dBodyID getBody()
+    { return dGeomGetBody (_id); }
+
+  void setPosition (dReal x, dReal y, dReal z)
+    { dGeomSetPosition (_id,x,y,z); }
+
+  void setRotation (const dMatrix3 R)
+    { dGeomSetRotation (_id,R); }
+
+  const dReal * getPosition()
+    { return dGeomGetPosition (_id); }
+
+  const dReal * getRotation()
+    { return dGeomGetRotation (_id); }
+};
+
+
+#endif
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/memory.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/memory.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/memory.h	(revision 1812)
@@ -0,0 +1,59 @@
+/*************************************************************************
+ *                                                                       *
+ * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith.       *
+ * All rights reserved.  Email: russ@q12.org   Web: www.q12.org          *
+ *                                                                       *
+ * This library is free software; you can redistribute it and/or         *
+ * modify it under the terms of EITHER:                                  *
+ *   (1) The GNU Lesser General Public License as published by the Free  *
+ *       Software Foundation; either version 2.1 of the License, or (at  *
+ *       your option) any later version. The text of the GNU Lesser      *
+ *       General Public License is included with this library in the     *
+ *       file LICENSE.TXT.                                               *
+ *   (2) The BSD-style license that is included with this library in     *
+ *       the file LICENSE-BSD.TXT.                                       *
+ *                                                                       *
+ * This library is distributed in the hope that it will be useful,       *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
+ * LICENSE.TXT and LICENSE-BSD.TXT for more details.                     *
+ *                                                                       *
+ *************************************************************************/
+
+/* this comes from the `reuse' library. copy any changes back to the source */
+
+#ifndef _ODE_MEMORY_H_
+#define _ODE_MEMORY_H_
+
+#include "ode/config.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* function types to allocate and free memory */
+typedef void * dAllocFunction (size_t size);
+typedef void * dReallocFunction (void *ptr, size_t oldsize, size_t newsize);
+typedef void dFreeFunction (void *ptr, size_t size);
+
+/* set new memory management functions. if fn is 0, the default handlers are
+ * used. */
+void dSetAllocHandler (dAllocFunction *fn);
+void dSetReallocHandler (dReallocFunction *fn);
+void dSetFreeHandler (dFreeFunction *fn);
+
+/* get current memory management functions */
+dAllocFunction *dGetAllocHandler ();
+dReallocFunction *dGetReallocHandler ();
+dFreeFunction *dGetFreeHandler ();
+
+/* allocate and free memory. */
+void * dAlloc (size_t size);
+void * dRealloc (void *ptr, size_t oldsize, size_t newsize);
+void dFree (void *ptr, size_t size);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/compatibility.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/compatibility.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/compatibility.h	(revision 1812)
@@ -0,0 +1,40 @@
+/*************************************************************************
+ *                                                                       *
+ * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith.       *
+ * All rights reserved.  Email: russ@q12.org   Web: www.q12.org          *
+ *                                                                       *
+ * This library is free software; you can redistribute it and/or         *
+ * modify it under the terms of EITHER:                                  *
+ *   (1) The GNU Lesser General Public License as published by the Free  *
+ *       Software Foundation; either version 2.1 of the License, or (at  *
+ *       your option) any later version. The text of the GNU Lesser      *
+ *       General Public License is included with this library in the     *
+ *       file LICENSE.TXT.                                               *
+ *   (2) The BSD-style license that is included with this library in     *
+ *       the file LICENSE-BSD.TXT.                                       *
+ *                                                                       *
+ * This library is distributed in the hope that it will be useful,       *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
+ * LICENSE.TXT and LICENSE-BSD.TXT for more details.                     *
+ *                                                                       *
+ *************************************************************************/
+
+#ifndef _ODE_COMPATIBILITY_H_
+#define _ODE_COMPATIBILITY_H_
+
+/*
+ * ODE's backward compatibility system ensures that as ODE's API
+ * evolves, user code will not break.
+ */
+
+/*
+ * These new rotation function names are more consistent with the
+ * rest of the API.
+ */
+#define dQtoR(q,R) dRfromQ((R),(q))
+#define dRtoQ(R,q) dQfromR((q),(R))
+#define dWtoDQ(w,q,dq) dDQfromW((dq),(w),(q))
+
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/odecpp.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/odecpp.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/odecpp.h	(revision 1812)
@@ -0,0 +1,621 @@
+/*************************************************************************
+ *									 *
+ * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith.	 *
+ * All rights reserved.  Email: russ@q12.org   Web: www.q12.org 	 *
+ *									 *
+ * This library is free software; you can redistribute it and/or	 *
+ * modify it under the terms of EITHER: 				 *
+ *   (1) The GNU Lesser General Public License as published by the Free  *
+ *	 Software Foundation; either version 2.1 of the License, or (at  *
+ *	 your option) any later version. The text of the GNU Lesser	 *
+ *	 General Public License is included with this library in the	 *
+ *	 file LICENSE.TXT.						 *
+ *   (2) The BSD-style license that is included with this library in	 *
+ *	 the file LICENSE-BSD.TXT.					 *
+ *									 *
+ * This library is distributed in the hope that it will be useful,	 *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of	 *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files	 *
+ * LICENSE.TXT and LICENSE-BSD.TXT for more details.			 *
+ *									 *
+ *************************************************************************/
+
+/* C++ interface for non-collision stuff */
+
+
+#ifndef _ODE_ODECPP_H_
+#define _ODE_ODECPP_H_
+#ifdef __cplusplus
+
+#include <ode/error.h>
+
+
+class dWorld {
+  dWorldID _id;
+
+  // intentionally undefined, don't use these
+  dWorld (const dWorld &);
+  void operator= (const dWorld &);
+
+public:
+  dWorld()
+    { _id = dWorldCreate(); }
+  ~dWorld()
+    { dWorldDestroy (_id); }
+
+  dWorldID id() const
+    { return _id; }
+  operator dWorldID() const
+    { return _id; }
+
+  void setGravity (dReal x, dReal y, dReal z)
+    { dWorldSetGravity (_id,x,y,z); }
+  void getGravity (dVector3 g) const
+    { dWorldGetGravity (_id,g); }
+
+  void setERP (dReal erp)
+    { dWorldSetERP(_id, erp); }
+  dReal getERP() const
+    { return dWorldGetERP(_id); }
+
+  void setCFM (dReal cfm)
+    { dWorldSetCFM(_id, cfm); }
+  dReal getCFM() const
+    { return dWorldGetCFM(_id); }
+
+  void step (dReal stepsize)
+    { dWorldStep (_id,stepsize); }
+
+  void stepFast1 (dReal stepsize, int maxiterations)
+    { dWorldStepFast1 (_id,stepsize,maxiterations); }
+  void setAutoEnableDepthSF1(dWorldID, int depth)
+    { dWorldSetAutoEnableDepthSF1 (_id, depth); }
+  int getAutoEnableDepthSF1(dWorldID)
+    { return dWorldGetAutoEnableDepthSF1 (_id); }
+
+  void  setAutoDisableLinearThreshold (dReal threshold) 
+    { dWorldSetAutoDisableLinearThreshold (_id,threshold); }
+  dReal getAutoDisableLinearThreshold()
+    { return dWorldGetAutoDisableLinearThreshold (_id); }
+  void setAutoDisableAngularThreshold (dReal threshold)
+    { dWorldSetAutoDisableAngularThreshold (_id,threshold); }
+  dReal getAutoDisableAngularThreshold()
+    { return dWorldGetAutoDisableAngularThreshold (_id); }
+  void setAutoDisableSteps (int steps)
+    { dWorldSetAutoDisableSteps (_id,steps); }
+  int getAutoDisableSteps()
+    { return dWorldGetAutoDisableSteps (_id); }
+  void setAutoDisableTime (dReal time)
+    { dWorldSetAutoDisableTime (_id,time); }
+  dReal getAutoDisableTime()
+    { return dWorldGetAutoDisableTime (_id); }
+  void setAutoDisableFlag (int do_auto_disable)
+    { dWorldSetAutoDisableFlag (_id,do_auto_disable); }
+  int getAutoDisableFlag()
+    { return dWorldGetAutoDisableFlag (_id); }
+
+  void impulseToForce (dReal stepsize, dReal ix, dReal iy, dReal iz,
+		       dVector3 force)
+    { dWorldImpulseToForce (_id,stepsize,ix,iy,iz,force); }
+};
+
+
+class dBody {
+  dBodyID _id;
+
+  // intentionally undefined, don't use these
+  dBody (const dBody &);
+  void operator= (const dBody &);
+
+public:
+  dBody()
+    { _id = 0; }
+  dBody (dWorldID world)
+    { _id = dBodyCreate (world); }
+  ~dBody()
+    { if (_id) dBodyDestroy (_id); }
+
+  void create (dWorldID world) {
+    if (_id) dBodyDestroy (_id);
+    _id = dBodyCreate (world);
+  }
+
+  dBodyID id() const
+    { return _id; }
+  operator dBodyID() const
+    { return _id; }
+
+  void setData (void *data)
+    { dBodySetData (_id,data); }
+  void *getData() const
+    { return dBodyGetData (_id); }
+
+  void setPosition (dReal x, dReal y, dReal z)
+    { dBodySetPosition (_id,x,y,z); }
+  void setRotation (const dMatrix3 R)
+    { dBodySetRotation (_id,R); }
+  void setQuaternion (const dQuaternion q)
+    { dBodySetQuaternion (_id,q); }
+  void setLinearVel  (dReal x, dReal y, dReal z)
+    { dBodySetLinearVel (_id,x,y,z); }
+  void setAngularVel (dReal x, dReal y, dReal z)
+    { dBodySetAngularVel (_id,x,y,z); }
+
+  const dReal * getPosition() const
+    { return dBodyGetPosition (_id); }
+  const dReal * getRotation() const
+    { return dBodyGetRotation (_id); }
+  const dReal * getQuaternion() const
+    { return dBodyGetQuaternion (_id); }
+  const dReal * getLinearVel() const
+    { return dBodyGetLinearVel (_id); }
+  const dReal * getAngularVel() const
+    { return dBodyGetAngularVel (_id); }
+
+  void setMass (const dMass *mass)
+    { dBodySetMass (_id,mass); }
+  void getMass (dMass *mass) const
+    { dBodyGetMass (_id,mass); }
+
+  void addForce (dReal fx, dReal fy, dReal fz)
+    { dBodyAddForce (_id, fx, fy, fz); }
+  void addTorque (dReal fx, dReal fy, dReal fz)
+    { dBodyAddTorque (_id, fx, fy, fz); }
+  void addRelForce (dReal fx, dReal fy, dReal fz)
+    { dBodyAddRelForce (_id, fx, fy, fz); }
+  void addRelTorque (dReal fx, dReal fy, dReal fz)
+    { dBodyAddRelTorque (_id, fx, fy, fz); }
+  void addForceAtPos (dReal fx, dReal fy, dReal fz,
+		      dReal px, dReal py, dReal pz)
+    { dBodyAddForceAtPos (_id, fx, fy, fz, px, py, pz); }
+  void addForceAtRelPos (dReal fx, dReal fy, dReal fz,
+		      dReal px, dReal py, dReal pz)
+    { dBodyAddForceAtRelPos (_id, fx, fy, fz, px, py, pz); }
+  void addRelForceAtPos (dReal fx, dReal fy, dReal fz,
+			 dReal px, dReal py, dReal pz)
+    { dBodyAddRelForceAtPos (_id, fx, fy, fz, px, py, pz); }
+  void addRelForceAtRelPos (dReal fx, dReal fy, dReal fz,
+			    dReal px, dReal py, dReal pz)
+    { dBodyAddRelForceAtRelPos (_id, fx, fy, fz, px, py, pz); }
+
+  const dReal * getForce() const
+    { return dBodyGetForce(_id); }
+  const dReal * getTorque() const
+    { return dBodyGetTorque(_id); }
+  void setForce (dReal x, dReal y, dReal z)
+    { dBodySetForce (_id,x,y,z); }
+  void setTorque (dReal x, dReal y, dReal z)
+    { dBodySetTorque (_id,x,y,z); }
+
+  void enable()
+    { dBodyEnable (_id); }
+  void disable()
+    { dBodyDisable (_id); }
+  int isEnabled() const
+    { return dBodyIsEnabled (_id); }
+
+  void getRelPointPos (dReal px, dReal py, dReal pz, dVector3 result) const
+    { dBodyGetRelPointPos (_id, px, py, pz, result); }
+  void getRelPointVel (dReal px, dReal py, dReal pz, dVector3 result) const
+    { dBodyGetRelPointVel (_id, px, py, pz, result); }
+  void getPointVel (dReal px, dReal py, dReal pz, dVector3 result) const
+    { dBodyGetPointVel (_id,px,py,pz,result); }
+  void getPosRelPoint (dReal px, dReal py, dReal pz, dVector3 result) const
+    { dBodyGetPosRelPoint (_id,px,py,pz,result); }
+  void vectorToWorld (dReal px, dReal py, dReal pz, dVector3 result) const
+    { dBodyVectorToWorld (_id,px,py,pz,result); }
+  void vectorFromWorld (dReal px, dReal py, dReal pz, dVector3 result) const
+    { dBodyVectorFromWorld (_id,px,py,pz,result); }
+
+  void setFiniteRotationMode (int mode)
+    { dBodySetFiniteRotationMode (_id, mode); }
+  void setFiniteRotationAxis (dReal x, dReal y, dReal z)
+    { dBodySetFiniteRotationAxis (_id, x, y, z); }
+
+  int getFiniteRotationMode() const
+    { return dBodyGetFiniteRotationMode (_id); }
+  void getFiniteRotationAxis (dVector3 result) const
+    { dBodyGetFiniteRotationAxis (_id, result); }
+
+  int getNumJoints() const
+    { return dBodyGetNumJoints (_id); }
+  dJointID getJoint (int index) const
+    { return dBodyGetJoint (_id, index); }
+
+  void setGravityMode (int mode)
+    { dBodySetGravityMode (_id,mode); }
+  int getGravityMode() const
+    { return dBodyGetGravityMode (_id); }
+
+  int isConnectedTo (dBodyID body) const
+    { return dAreConnected (_id, body); }
+
+  void  setAutoDisableLinearThreshold (dReal threshold) 
+    { dBodySetAutoDisableLinearThreshold (_id,threshold); }
+  dReal getAutoDisableLinearThreshold()
+    { return dBodyGetAutoDisableLinearThreshold (_id); }
+  void setAutoDisableAngularThreshold (dReal threshold)
+    { dBodySetAutoDisableAngularThreshold (_id,threshold); }
+  dReal getAutoDisableAngularThreshold()
+    { return dBodyGetAutoDisableAngularThreshold (_id); }
+  void setAutoDisableSteps (int steps)
+    { dBodySetAutoDisableSteps (_id,steps); }
+  int getAutoDisableSteps()
+    { return dBodyGetAutoDisableSteps (_id); }
+  void setAutoDisableTime (dReal time)
+    { dBodySetAutoDisableTime (_id,time); }
+  dReal getAutoDisableTime()
+    { return dBodyGetAutoDisableTime (_id); }
+  void setAutoDisableFlag (int do_auto_disable)
+    { dBodySetAutoDisableFlag (_id,do_auto_disable); }
+  int getAutoDisableFlag()
+    { return dBodyGetAutoDisableFlag (_id); }
+};
+
+
+class dJointGroup {
+  dJointGroupID _id;
+
+  // intentionally undefined, don't use these
+  dJointGroup (const dJointGroup &);
+  void operator= (const dJointGroup &);
+
+public:
+  dJointGroup (int dummy_arg=0)
+    { _id = dJointGroupCreate (0); }
+  ~dJointGroup()
+    { dJointGroupDestroy (_id); }
+  void create (int dummy_arg=0) {
+    if (_id) dJointGroupDestroy (_id);
+    _id = dJointGroupCreate (0);
+  }
+
+  dJointGroupID id() const
+    { return _id; }
+  operator dJointGroupID() const
+    { return _id; }
+
+  void empty()
+    { dJointGroupEmpty (_id); }
+};
+
+
+class dJoint {
+private:
+  // intentionally undefined, don't use these
+  dJoint (const dJoint &) ;
+  void operator= (const dJoint &);
+
+protected:
+  dJointID _id;
+
+public:
+  dJoint()
+    { _id = 0; }
+  ~dJoint()
+    { if (_id) dJointDestroy (_id); }
+
+  dJointID id() const
+    { return _id; }
+  operator dJointID() const
+    { return _id; }
+
+  void attach (dBodyID body1, dBodyID body2)
+    { dJointAttach (_id, body1, body2); }
+
+  void setData (void *data)
+    { dJointSetData (_id, data); }
+  void *getData() const
+    { return dJointGetData (_id); }
+
+  int getType() const
+    { return dJointGetType (_id); }
+
+  dBodyID getBody (int index) const
+    { return dJointGetBody (_id, index); }
+};
+
+
+class dBallJoint : public dJoint {
+private:
+  // intentionally undefined, don't use these
+  dBallJoint (const dBallJoint &);
+  void operator= (const dBallJoint &);
+
+public:
+  dBallJoint() { }
+  dBallJoint (dWorldID world, dJointGroupID group=0)
+    { _id = dJointCreateBall (world, group); }
+
+  void create (dWorldID world, dJointGroupID group=0) {
+    if (_id) dJointDestroy (_id);
+    _id = dJointCreateBall (world, group);
+  }
+
+  void setAnchor (dReal x, dReal y, dReal z)
+    { dJointSetBallAnchor (_id, x, y, z); }
+  void getAnchor (dVector3 result) const
+    { dJointGetBallAnchor (_id, result); }
+  void getAnchor2 (dVector3 result) const
+    { dJointGetBallAnchor2 (_id, result); }
+} ;
+
+
+class dHingeJoint : public dJoint {
+  // intentionally undefined, don't use these
+  dHingeJoint (const dHingeJoint &);
+  void operator = (const dHingeJoint &);
+
+public:
+  dHingeJoint() { }
+  dHingeJoint (dWorldID world, dJointGroupID group=0)
+    { _id = dJointCreateHinge (world, group); }
+
+  void create (dWorldID world, dJointGroupID group=0) {
+    if (_id) dJointDestroy (_id);
+    _id = dJointCreateHinge (world, group);
+  }
+
+  void setAnchor (dReal x, dReal y, dReal z)
+    { dJointSetHingeAnchor (_id, x, y, z); }
+  void getAnchor (dVector3 result) const
+    { dJointGetHingeAnchor (_id, result); }
+  void getAnchor2 (dVector3 result) const
+    { dJointGetHingeAnchor2 (_id, result); }
+
+  void setAxis (dReal x, dReal y, dReal z)
+    { dJointSetHingeAxis (_id, x, y, z); }
+  void getAxis (dVector3 result) const
+    { dJointGetHingeAxis (_id, result); }
+
+  dReal getAngle() const
+    { return dJointGetHingeAngle (_id); }
+  dReal getAngleRate() const
+    { return dJointGetHingeAngleRate (_id); }
+
+  void setParam (int parameter, dReal value)
+    { dJointSetHingeParam (_id, parameter, value); }
+  dReal getParam (int parameter) const
+    { return dJointGetHingeParam (_id, parameter); }
+
+  void addTorque (dReal torque)
+	{ dJointAddHingeTorque(_id, torque); }
+};
+
+
+class dSliderJoint : public dJoint {
+  // intentionally undefined, don't use these
+  dSliderJoint (const dSliderJoint &);
+  void operator = (const dSliderJoint &);
+
+public:
+  dSliderJoint() { }
+  dSliderJoint (dWorldID world, dJointGroupID group=0)
+    { _id = dJointCreateSlider (world, group); }
+
+  void create (dWorldID world, dJointGroupID group=0) {
+    if (_id) dJointDestroy (_id);
+    _id = dJointCreateSlider (world, group);
+  }
+
+  void setAxis (dReal x, dReal y, dReal z)
+    { dJointSetSliderAxis (_id, x, y, z); }
+  void getAxis (dVector3 result) const
+    { dJointGetSliderAxis (_id, result); }
+
+  dReal getPosition() const
+    { return dJointGetSliderPosition (_id); }
+  dReal getPositionRate() const
+    { return dJointGetSliderPositionRate (_id); }
+
+  void setParam (int parameter, dReal value)
+    { dJointSetSliderParam (_id, parameter, value); }
+  dReal getParam (int parameter) const
+    { return dJointGetSliderParam (_id, parameter); }
+
+  void addForce (dReal force)
+	{ dJointAddSliderForce(_id, force); }
+};
+
+
+class dUniversalJoint : public dJoint {
+  // intentionally undefined, don't use these
+  dUniversalJoint (const dUniversalJoint &);
+  void operator = (const dUniversalJoint &);
+
+public:
+  dUniversalJoint() { }
+  dUniversalJoint (dWorldID world, dJointGroupID group=0)
+    { _id = dJointCreateUniversal (world, group); }
+
+  void create (dWorldID world, dJointGroupID group=0) {
+    if (_id) dJointDestroy (_id);
+    _id = dJointCreateUniversal (world, group);
+  }
+
+  void setAnchor (dReal x, dReal y, dReal z)
+    { dJointSetUniversalAnchor (_id, x, y, z); }
+  void setAxis1 (dReal x, dReal y, dReal z)
+    { dJointSetUniversalAxis1 (_id, x, y, z); }
+  void setAxis2 (dReal x, dReal y, dReal z)
+    { dJointSetUniversalAxis2 (_id, x, y, z); }
+  void setParam (int parameter, dReal value)
+    { dJointSetUniversalParam (_id, parameter, value); }
+
+  void getAnchor (dVector3 result) const
+    { dJointGetUniversalAnchor (_id, result); }
+  void getAnchor2 (dVector3 result) const
+    { dJointGetUniversalAnchor2 (_id, result); }
+  void getAxis1 (dVector3 result) const
+    { dJointGetUniversalAxis1 (_id, result); }
+  void getAxis2 (dVector3 result) const
+    { dJointGetUniversalAxis2 (_id, result); }
+  dReal getParam (int parameter) const
+    { return dJointGetUniversalParam (_id, parameter); }
+  dReal getAngle1() const
+    { return dJointGetUniversalAngle1 (_id); }
+  dReal getAngle1Rate() const
+    { return dJointGetUniversalAngle1Rate (_id); }
+  dReal getAngle2() const
+    { return dJointGetUniversalAngle2 (_id); }
+  dReal getAngle2Rate() const
+    { return dJointGetUniversalAngle2Rate (_id); }
+
+  void addTorques (dReal torque1, dReal torque2)
+	{ dJointAddUniversalTorques(_id, torque1, torque2); }
+};
+
+
+class dHinge2Joint : public dJoint {
+  // intentionally undefined, don't use these
+  dHinge2Joint (const dHinge2Joint &);
+  void operator = (const dHinge2Joint &);
+
+public:
+  dHinge2Joint() { }
+  dHinge2Joint (dWorldID world, dJointGroupID group=0)
+    { _id = dJointCreateHinge2 (world, group); }
+
+  void create (dWorldID world, dJointGroupID group=0) {
+    if (_id) dJointDestroy (_id);
+    _id = dJointCreateHinge2 (world, group);
+  }
+
+  void setAnchor (dReal x, dReal y, dReal z)
+    { dJointSetHinge2Anchor (_id, x, y, z); }
+  void setAxis1 (dReal x, dReal y, dReal z)
+    { dJointSetHinge2Axis1 (_id, x, y, z); }
+  void setAxis2 (dReal x, dReal y, dReal z)
+    { dJointSetHinge2Axis2 (_id, x, y, z); }
+
+  void getAnchor (dVector3 result) const
+    { dJointGetHinge2Anchor (_id, result); }
+  void getAnchor2 (dVector3 result) const
+    { dJointGetHinge2Anchor2 (_id, result); }
+  void getAxis1 (dVector3 result) const
+    { dJointGetHinge2Axis1 (_id, result); }
+  void getAxis2 (dVector3 result) const
+    { dJointGetHinge2Axis2 (_id, result); }
+
+  dReal getAngle1() const
+    { return dJointGetHinge2Angle1 (_id); }
+  dReal getAngle1Rate() const
+    { return dJointGetHinge2Angle1Rate (_id); }
+  dReal getAngle2Rate() const
+    { return dJointGetHinge2Angle2Rate (_id); }
+
+  void setParam (int parameter, dReal value)
+    { dJointSetHinge2Param (_id, parameter, value); }
+  dReal getParam (int parameter) const
+    { return dJointGetHinge2Param (_id, parameter); }
+
+  void addTorques(dReal torque1, dReal torque2)
+	{ dJointAddHinge2Torques(_id, torque1, torque2); }
+};
+
+
+class dFixedJoint : public dJoint {
+  // intentionally undefined, don't use these
+  dFixedJoint (const dFixedJoint &);
+  void operator = (const dFixedJoint &);
+
+public:
+  dFixedJoint() { }
+  dFixedJoint (dWorldID world, dJointGroupID group=0)
+    { _id = dJointCreateFixed (world, group); }
+
+  void create (dWorldID world, dJointGroupID group=0) {
+    if (_id) dJointDestroy (_id);
+    _id = dJointCreateFixed (world, group);
+  }
+
+  void set()
+    { dJointSetFixed (_id); }
+};
+
+
+class dContactJoint : public dJoint {
+  // intentionally undefined, don't use these
+  dContactJoint (const dContactJoint &);
+  void operator = (const dContactJoint &);
+
+public:
+  dContactJoint() { }
+  dContactJoint (dWorldID world, dJointGroupID group, dContact *contact)
+    { _id = dJointCreateContact (world, group, contact); }
+
+  void create (dWorldID world, dJointGroupID group, dContact *contact) {
+    if (_id) dJointDestroy (_id);
+    _id = dJointCreateContact (world, group, contact);
+  }
+};
+
+
+class dNullJoint : public dJoint {
+  // intentionally undefined, don't use these
+  dNullJoint (const dNullJoint &);
+  void operator = (const dNullJoint &);
+
+public:
+  dNullJoint() { }
+  dNullJoint (dWorldID world, dJointGroupID group=0)
+    { _id = dJointCreateNull (world, group); }
+
+  void create (dWorldID world, dJointGroupID group=0) {
+    if (_id) dJointDestroy (_id);
+    _id = dJointCreateNull (world, group);
+  }
+};
+
+
+class dAMotorJoint : public dJoint {
+  // intentionally undefined, don't use these
+  dAMotorJoint (const dAMotorJoint &);
+  void operator = (const dAMotorJoint &);
+
+public:
+  dAMotorJoint() { }
+  dAMotorJoint (dWorldID world, dJointGroupID group=0)
+    { _id = dJointCreateAMotor (world, group); }
+
+  void create (dWorldID world, dJointGroupID group=0) {
+    if (_id) dJointDestroy (_id);
+    _id = dJointCreateAMotor (world, group);
+  }
+
+  void setMode (int mode)
+    { dJointSetAMotorMode (_id, mode); }
+  int getMode() const
+    { return dJointGetAMotorMode (_id); }
+
+  void setNumAxes (int num)
+    { dJointSetAMotorNumAxes (_id, num); }
+  int getNumAxes() const
+    { return dJointGetAMotorNumAxes (_id); }
+
+  void setAxis (int anum, int rel, dReal x, dReal y, dReal z)
+    { dJointSetAMotorAxis (_id, anum, rel, x, y, z); }
+  void getAxis (int anum, dVector3 result) const
+    { dJointGetAMotorAxis (_id, anum, result); }
+  int getAxisRel (int anum) const
+    { return dJointGetAMotorAxisRel (_id, anum); }
+
+  void setAngle (int anum, dReal angle)
+    { dJointSetAMotorAngle (_id, anum, angle); }
+  dReal getAngle (int anum) const
+    { return dJointGetAMotorAngle (_id, anum); }
+  dReal getAngleRate (int anum)
+    { return dJointGetAMotorAngleRate (_id,anum); }
+
+  void setParam (int parameter, dReal value)
+    { dJointSetAMotorParam (_id, parameter, value); }
+  dReal getParam (int parameter) const
+    { return dJointGetAMotorParam (_id, parameter); }
+
+  void addTorques(dReal torque1, dReal torque2, dReal torque3)
+	{ dJointAddAMotorTorques(_id, torque1, torque2, torque3); }
+};
+
+
+#endif
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/timer.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/timer.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/timer.h	(revision 1812)
@@ -0,0 +1,76 @@
+/*************************************************************************
+ *                                                                       *
+ * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith.       *
+ * All rights reserved.  Email: russ@q12.org   Web: www.q12.org          *
+ *                                                                       *
+ * This library is free software; you can redistribute it and/or         *
+ * modify it under the terms of EITHER:                                  *
+ *   (1) The GNU Lesser General Public License as published by the Free  *
+ *       Software Foundation; either version 2.1 of the License, or (at  *
+ *       your option) any later version. The text of the GNU Lesser      *
+ *       General Public License is included with this library in the     *
+ *       file LICENSE.TXT.                                               *
+ *   (2) The BSD-style license that is included with this library in     *
+ *       the file LICENSE-BSD.TXT.                                       *
+ *                                                                       *
+ * This library is distributed in the hope that it will be useful,       *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
+ * LICENSE.TXT and LICENSE-BSD.TXT for more details.                     *
+ *                                                                       *
+ *************************************************************************/
+
+#ifndef _ODE_TIMER_H_
+#define _ODE_TIMER_H_
+
+#include <ode/config.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* stop watch objects */
+
+typedef struct dStopwatch {
+  double time;			/* total clock count */
+  unsigned long cc[2];		/* clock count since last `start' */
+} dStopwatch;
+
+void dStopwatchReset (dStopwatch *);
+void dStopwatchStart (dStopwatch *);
+void dStopwatchStop  (dStopwatch *);
+double dStopwatchTime (dStopwatch *);	/* returns total time in secs */
+
+
+/* code timers */
+
+void dTimerStart (const char *description);	/* pass a static string here */
+void dTimerNow (const char *description);	/* pass a static string here */
+void dTimerEnd();
+
+/* print out a timer report. if `average' is nonzero, print out the average
+ * time for each slot (this is only meaningful if the same start-now-end
+ * calls are being made repeatedly.
+ */
+void dTimerReport (FILE *fout, int average);
+
+
+/* resolution */
+
+/* returns the timer ticks per second implied by the timing hardware or API.
+ * the actual timer resolution may not be this great.
+ */
+double dTimerTicksPerSecond();
+
+/* returns an estimate of the actual timer resolution, in seconds. this may
+ * be greater than 1/ticks_per_second.
+ */
+double dTimerResolution();
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/export-dif.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/export-dif.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/export-dif.h	(revision 1812)
@@ -0,0 +1,32 @@
+/*************************************************************************
+ *                                                                       *
+ * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith.       *
+ * All rights reserved.  Email: russ@q12.org   Web: www.q12.org          *
+ *                                                                       *
+ * This library is free software; you can redistribute it and/or         *
+ * modify it under the terms of EITHER:                                  *
+ *   (1) The GNU Lesser General Public License as published by the Free  *
+ *       Software Foundation; either version 2.1 of the License, or (at  *
+ *       your option) any later version. The text of the GNU Lesser      *
+ *       General Public License is included with this library in the     *
+ *       file LICENSE.TXT.                                               *
+ *   (2) The BSD-style license that is included with this library in     *
+ *       the file LICENSE-BSD.TXT.                                       *
+ *                                                                       *
+ * This library is distributed in the hope that it will be useful,       *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
+ * LICENSE.TXT and LICENSE-BSD.TXT for more details.                     *
+ *                                                                       *
+ *************************************************************************/
+
+#ifndef _ODE_EXPORT_DIF_
+#define _ODE_EXPORT_DIF_
+
+#include <ode/common.h>
+
+
+void dWorldExportDIF (dWorldID w, FILE *file, const char *world_name);
+
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/odemath.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/odemath.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/odemath.h	(revision 1812)
@@ -0,0 +1,262 @@
+/*************************************************************************
+ *                                                                       *
+ * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith.       *
+ * All rights reserved.  Email: russ@q12.org   Web: www.q12.org          *
+ *                                                                       *
+ * This library is free software; you can redistribute it and/or         *
+ * modify it under the terms of EITHER:                                  *
+ *   (1) The GNU Lesser General Public License as published by the Free  *
+ *       Software Foundation; either version 2.1 of the License, or (at  *
+ *       your option) any later version. The text of the GNU Lesser      *
+ *       General Public License is included with this library in the     *
+ *       file LICENSE.TXT.                                               *
+ *   (2) The BSD-style license that is included with this library in     *
+ *       the file LICENSE-BSD.TXT.                                       *
+ *                                                                       *
+ * This library is distributed in the hope that it will be useful,       *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
+ * LICENSE.TXT and LICENSE-BSD.TXT for more details.                     *
+ *                                                                       *
+ *************************************************************************/
+
+#ifndef _ODE_ODEMATH_H_
+#define _ODE_ODEMATH_H_
+
+#include <ode/common.h>
+
+#ifdef __GNUC__
+#define PURE_INLINE extern inline
+#else
+#define PURE_INLINE inline
+#endif
+
+/*
+ * macro to access elements i,j in an NxM matrix A, independent of the
+ * matrix storage convention.
+ */
+#define dACCESS33(A,i,j) ((A)[(i)*4+(j)])
+
+
+/*
+ * 3-way dot product. dDOTpq means that elements of `a' and `b' are spaced
+ * p and q indexes apart respectively. dDOT() means dDOT11.
+ * in C++ we could use function templates to get all the versions of these
+ * functions - but on some compilers this will result in sub-optimal code.
+ */
+
+#define dDOTpq(a,b,p,q) ((a)[0]*(b)[0] + (a)[p]*(b)[q] + (a)[2*(p)]*(b)[2*(q)])
+
+#ifdef __cplusplus
+
+PURE_INLINE dReal dDOT   (const dReal *a, const dReal *b) { return dDOTpq(a,b,1,1); }
+PURE_INLINE dReal dDOT13 (const dReal *a, const dReal *b) { return dDOTpq(a,b,1,3); }
+PURE_INLINE dReal dDOT31 (const dReal *a, const dReal *b) { return dDOTpq(a,b,3,1); }
+PURE_INLINE dReal dDOT33 (const dReal *a, const dReal *b) { return dDOTpq(a,b,3,3); }
+PURE_INLINE dReal dDOT14 (const dReal *a, const dReal *b) { return dDOTpq(a,b,1,4); }
+PURE_INLINE dReal dDOT41 (const dReal *a, const dReal *b) { return dDOTpq(a,b,4,1); }
+PURE_INLINE dReal dDOT44 (const dReal *a, const dReal *b) { return dDOTpq(a,b,4,4); }
+
+#else
+
+#define dDOT(a,b)   dDOTpq(a,b,1,1)
+#define dDOT13(a,b) dDOTpq(a,b,1,3)
+#define dDOT31(a,b) dDOTpq(a,b,3,1)
+#define dDOT33(a,b) dDOTpq(a,b,3,3)
+#define dDOT14(a,b) dDOTpq(a,b,1,4)
+#define dDOT41(a,b) dDOTpq(a,b,4,1)
+#define dDOT44(a,b) dDOTpq(a,b,4,4)
+
+#endif /* __cplusplus */
+
+
+/*
+ * cross product, set a = b x c. dCROSSpqr means that elements of `a', `b'
+ * and `c' are spaced p, q and r indexes apart respectively.
+ * dCROSS() means dCROSS111. `op' is normally `=', but you can set it to
+ * +=, -= etc to get other effects.
+ */
+
+#define dCROSS(a,op,b,c) \
+  (a)[0] op ((b)[1]*(c)[2] - (b)[2]*(c)[1]); \
+  (a)[1] op ((b)[2]*(c)[0] - (b)[0]*(c)[2]); \
+  (a)[2] op ((b)[0]*(c)[1] - (b)[1]*(c)[0]);
+#define dCROSSpqr(a,op,b,c,p,q,r) \
+  (a)[  0] op ((b)[  q]*(c)[2*r] - (b)[2*q]*(c)[  r]); \
+  (a)[  p] op ((b)[2*q]*(c)[  0] - (b)[  0]*(c)[2*r]); \
+  (a)[2*p] op ((b)[  0]*(c)[  r] - (b)[  q]*(c)[  0]);
+#define dCROSS114(a,op,b,c) dCROSSpqr(a,op,b,c,1,1,4)
+#define dCROSS141(a,op,b,c) dCROSSpqr(a,op,b,c,1,4,1)
+#define dCROSS144(a,op,b,c) dCROSSpqr(a,op,b,c,1,4,4)
+#define dCROSS411(a,op,b,c) dCROSSpqr(a,op,b,c,4,1,1)
+#define dCROSS414(a,op,b,c) dCROSSpqr(a,op,b,c,4,1,4)
+#define dCROSS441(a,op,b,c) dCROSSpqr(a,op,b,c,4,4,1)
+#define dCROSS444(a,op,b,c) dCROSSpqr(a,op,b,c,4,4,4)
+
+
+/*
+ * set a 3x3 submatrix of A to a matrix such that submatrix(A)*b = a x b.
+ * A is stored by rows, and has `skip' elements per row. the matrix is
+ * assumed to be already zero, so this does not write zero elements!
+ * if (plus,minus) is (+,-) then a positive version will be written.
+ * if (plus,minus) is (-,+) then a negative version will be written.
+ */
+
+#define dCROSSMAT(A,a,skip,plus,minus) \
+  (A)[1] = minus (a)[2]; \
+  (A)[2] = plus (a)[1]; \
+  (A)[(skip)+0] = plus (a)[2]; \
+  (A)[(skip)+2] = minus (a)[0]; \
+  (A)[2*(skip)+0] = minus (a)[1]; \
+  (A)[2*(skip)+1] = plus (a)[0];
+
+
+/*
+ * compute the distance between two 3-vectors
+ */
+
+#ifdef __cplusplus
+PURE_INLINE float dDISTANCE (const float a[3], const float b[3])
+	{ return (float) dSqrt( (a[0]-b[0])*(a[0]-b[0]) + (a[1]-b[1])*(a[1]-b[1]) + (a[2]-b[2])*(a[2]-b[2]) ); }
+PURE_INLINE double dDISTANCE (const double a[3], const double b[3])
+	{ return dSqrt( (a[0]-b[0])*(a[0]-b[0]) + (a[1]-b[1])*(a[1]-b[1]) + (a[2]-b[2])*(a[2]-b[2]) ); }
+#else
+#define dDISTANCE(a,b) \
+	(dSqrt( ((a)[0]-(b)[0])*((a)[0]-(b)[0]) + ((a)[1]-(b)[1])*((a)[1]-(b)[1]) + ((a)[2]-(b)[2])*((a)[2]-(b)[2]) ))
+#endif
+
+
+/*
+ * special case matrix multipication, with operator selection
+ */
+
+#define dMULTIPLYOP0_331(A,op,B,C) \
+  (A)[0] op dDOT((B),(C)); \
+  (A)[1] op dDOT((B+4),(C)); \
+  (A)[2] op dDOT((B+8),(C));
+#define dMULTIPLYOP1_331(A,op,B,C) \
+  (A)[0] op dDOT41((B),(C)); \
+  (A)[1] op dDOT41((B+1),(C)); \
+  (A)[2] op dDOT41((B+2),(C));
+#define dMULTIPLYOP0_133(A,op,B,C) \
+  (A)[0] op dDOT14((B),(C)); \
+  (A)[1] op dDOT14((B),(C+1)); \
+  (A)[2] op dDOT14((B),(C+2));
+#define dMULTIPLYOP0_333(A,op,B,C) \
+  (A)[0] op dDOT14((B),(C)); \
+  (A)[1] op dDOT14((B),(C+1)); \
+  (A)[2] op dDOT14((B),(C+2)); \
+  (A)[4] op dDOT14((B+4),(C)); \
+  (A)[5] op dDOT14((B+4),(C+1)); \
+  (A)[6] op dDOT14((B+4),(C+2)); \
+  (A)[8] op dDOT14((B+8),(C)); \
+  (A)[9] op dDOT14((B+8),(C+1)); \
+  (A)[10] op dDOT14((B+8),(C+2));
+#define dMULTIPLYOP1_333(A,op,B,C) \
+  (A)[0] op dDOT44((B),(C)); \
+  (A)[1] op dDOT44((B),(C+1)); \
+  (A)[2] op dDOT44((B),(C+2)); \
+  (A)[4] op dDOT44((B+1),(C)); \
+  (A)[5] op dDOT44((B+1),(C+1)); \
+  (A)[6] op dDOT44((B+1),(C+2)); \
+  (A)[8] op dDOT44((B+2),(C)); \
+  (A)[9] op dDOT44((B+2),(C+1)); \
+  (A)[10] op dDOT44((B+2),(C+2));
+#define dMULTIPLYOP2_333(A,op,B,C) \
+  (A)[0] op dDOT((B),(C)); \
+  (A)[1] op dDOT((B),(C+4)); \
+  (A)[2] op dDOT((B),(C+8)); \
+  (A)[4] op dDOT((B+4),(C)); \
+  (A)[5] op dDOT((B+4),(C+4)); \
+  (A)[6] op dDOT((B+4),(C+8)); \
+  (A)[8] op dDOT((B+8),(C)); \
+  (A)[9] op dDOT((B+8),(C+4)); \
+  (A)[10] op dDOT((B+8),(C+8));
+
+#ifdef __cplusplus
+
+#define DECL template <class TA, class TB, class TC> PURE_INLINE void
+
+DECL dMULTIPLY0_331(TA *A, const TB *B, const TC *C) { dMULTIPLYOP0_331(A,=,B,C) }
+DECL dMULTIPLY1_331(TA *A, const TB *B, const TC *C) { dMULTIPLYOP1_331(A,=,B,C) }
+DECL dMULTIPLY0_133(TA *A, const TB *B, const TC *C) { dMULTIPLYOP0_133(A,=,B,C) }
+DECL dMULTIPLY0_333(TA *A, const TB *B, const TC *C) { dMULTIPLYOP0_333(A,=,B,C) }
+DECL dMULTIPLY1_333(TA *A, const TB *B, const TC *C) { dMULTIPLYOP1_333(A,=,B,C) }
+DECL dMULTIPLY2_333(TA *A, const TB *B, const TC *C) { dMULTIPLYOP2_333(A,=,B,C) }
+
+DECL dMULTIPLYADD0_331(TA *A, const TB *B, const TC *C) { dMULTIPLYOP0_331(A,+=,B,C) }
+DECL dMULTIPLYADD1_331(TA *A, const TB *B, const TC *C) { dMULTIPLYOP1_331(A,+=,B,C) }
+DECL dMULTIPLYADD0_133(TA *A, const TB *B, const TC *C) { dMULTIPLYOP0_133(A,+=,B,C) }
+DECL dMULTIPLYADD0_333(TA *A, const TB *B, const TC *C) { dMULTIPLYOP0_333(A,+=,B,C) }
+DECL dMULTIPLYADD1_333(TA *A, const TB *B, const TC *C) { dMULTIPLYOP1_333(A,+=,B,C) }
+DECL dMULTIPLYADD2_333(TA *A, const TB *B, const TC *C) { dMULTIPLYOP2_333(A,+=,B,C) }
+
+#undef DECL
+
+#else
+
+#define dMULTIPLY0_331(A,B,C) dMULTIPLYOP0_331(A,=,B,C)
+#define dMULTIPLY1_331(A,B,C) dMULTIPLYOP1_331(A,=,B,C)
+#define dMULTIPLY0_133(A,B,C) dMULTIPLYOP0_133(A,=,B,C)
+#define dMULTIPLY0_333(A,B,C) dMULTIPLYOP0_333(A,=,B,C)
+#define dMULTIPLY1_333(A,B,C) dMULTIPLYOP1_333(A,=,B,C)
+#define dMULTIPLY2_333(A,B,C) dMULTIPLYOP2_333(A,=,B,C)
+
+#define dMULTIPLYADD0_331(A,B,C) dMULTIPLYOP0_331(A,+=,B,C)
+#define dMULTIPLYADD1_331(A,B,C) dMULTIPLYOP1_331(A,+=,B,C)
+#define dMULTIPLYADD0_133(A,B,C) dMULTIPLYOP0_133(A,+=,B,C)
+#define dMULTIPLYADD0_333(A,B,C) dMULTIPLYOP0_333(A,+=,B,C)
+#define dMULTIPLYADD1_333(A,B,C) dMULTIPLYOP1_333(A,+=,B,C)
+#define dMULTIPLYADD2_333(A,B,C) dMULTIPLYOP2_333(A,+=,B,C)
+
+#endif
+
+// Terrain callback mod (start)
+#define dOP(a,op,b,c) \
+ (a)[0] = ((b)[0]) op ((c)[0]); \
+ (a)[1] = ((b)[1]) op ((c)[1]); \
+ (a)[2] = ((b)[2]) op ((c)[2]);
+#define dOPC(a,op,b,c) \
+ (a)[0] = ((b)[0]) op (c); \
+ (a)[1] = ((b)[1]) op (c); \
+ (a)[2] = ((b)[2]) op (c);
+#define dOPE(a,op,b) \
+ (a)[0] op ((b)[0]); \
+ (a)[1] op ((b)[1]); \
+ (a)[2] op ((b)[2]);
+#define dOPEC(a,op,c) \
+ (a)[0] op (c); \
+ (a)[1] op (c); \
+ (a)[2] op (c);
+#define dLENGTH(a) \
+ (dSqrt( ((a)[0])*((a)[0]) + ((a)[1])*((a)[1]) + ((a)[2])*((a)[2]) ));
+#define dLENGTHSQUARED(a) \
+ (((a)[0])*((a)[0]) + ((a)[1])*((a)[1]) + ((a)[2])*((a)[2]));
+// Terrain callback mod (end)
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * normalize 3x1 and 4x1 vectors (i.e. scale them to unit length)
+ */
+void dNormalize3 (dVector3 a);
+void dNormalize4 (dVector4 a);
+
+
+/*
+ * given a unit length "normal" vector n, generate vectors p and q vectors
+ * that are an orthonormal basis for the plane space perpendicular to n.
+ * i.e. this makes p,q such that n,p,q are all perpendicular to each other.
+ * q will equal n x p. if n is not unit length then p will be unit length but
+ * q wont be.
+ */
+
+void dPlaneSpace (const dVector3 n, dVector3 p, dVector3 q);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/odecpp_collision.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/odecpp_collision.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/odecpp_collision.h	(revision 1812)
@@ -0,0 +1,346 @@
+/*************************************************************************
+ *									 *
+ * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith.	 *
+ * All rights reserved.  Email: russ@q12.org   Web: www.q12.org 	 *
+ *									 *
+ * This library is free software; you can redistribute it and/or	 *
+ * modify it under the terms of EITHER: 				 *
+ *   (1) The GNU Lesser General Public License as published by the Free  *
+ *	 Software Foundation; either version 2.1 of the License, or (at  *
+ *	 your option) any later version. The text of the GNU Lesser	 *
+ *	 General Public License is included with this library in the	 *
+ *	 file LICENSE.TXT.						 *
+ *   (2) The BSD-style license that is included with this library in	 *
+ *	 the file LICENSE-BSD.TXT.					 *
+ *									 *
+ * This library is distributed in the hope that it will be useful,	 *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of	 *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files	 *
+ * LICENSE.TXT and LICENSE-BSD.TXT for more details.			 *
+ *									 *
+ *************************************************************************/
+
+/* C++ interface for new collision API */
+
+
+#ifndef _ODE_ODECPP_COLLISION_H_
+#define _ODE_ODECPP_COLLISION_H_
+#ifdef __cplusplus
+
+#include <ode/error.h>
+
+
+class dGeom {
+  // intentionally undefined, don't use these
+  dGeom (dGeom &);
+  void operator= (dGeom &);
+
+protected:
+  dGeomID _id;
+
+public:
+  dGeom()
+    { _id = 0; }
+  ~dGeom()
+    { if (_id) dGeomDestroy (_id); }
+
+  dGeomID id() const
+    { return _id; }
+  operator dGeomID() const
+    { return _id; }
+
+  void destroy() {
+    if (_id) dGeomDestroy (_id);
+    _id = 0;
+  }
+
+  int getClass() const
+    { return dGeomGetClass (_id); }
+
+  dSpaceID getSpace() const
+    { return dGeomGetSpace (_id); }
+
+  void setData (void *data)
+    { dGeomSetData (_id,data); }
+  void *getData() const
+    { return dGeomGetData (_id); }
+
+  void setBody (dBodyID b)
+    { dGeomSetBody (_id,b); }
+  dBodyID getBody() const
+    { return dGeomGetBody (_id); }
+
+  void setPosition (dReal x, dReal y, dReal z)
+    { dGeomSetPosition (_id,x,y,z); }
+  const dReal * getPosition() const
+    { return dGeomGetPosition (_id); }
+
+  void setRotation (const dMatrix3 R)
+    { dGeomSetRotation (_id,R); }
+  const dReal * getRotation() const
+    { return dGeomGetRotation (_id); }
+    
+  void setQuaternion (const dQuaternion quat)
+    { dGeomSetQuaternion (_id,quat); }
+  void getQuaternion (dQuaternion quat) const
+    { dGeomGetQuaternion (_id,quat); }
+
+  void getAABB (dReal aabb[6]) const
+    { dGeomGetAABB (_id, aabb); }
+
+  int isSpace()
+    { return dGeomIsSpace (_id); }
+
+  void setCategoryBits (unsigned long bits)
+    { dGeomSetCategoryBits (_id, bits); }
+  void setCollideBits (unsigned long bits)
+    { dGeomSetCollideBits (_id, bits); }
+  unsigned long getCategoryBits()
+    { return dGeomGetCategoryBits (_id); }
+  unsigned long getCollideBits()
+    { return dGeomGetCollideBits (_id); }
+
+  void enable()
+    { dGeomEnable (_id); }
+  void disable()
+    { dGeomDisable (_id); }
+  int isEnabled()
+    { return dGeomIsEnabled (_id); }
+
+  void collide2 (dGeomID g, void *data, dNearCallback *callback)
+    { dSpaceCollide2 (_id,g,data,callback); }
+};
+
+
+class dSpace : public dGeom {
+  // intentionally undefined, don't use these
+  dSpace (dSpace &);
+  void operator= (dSpace &);
+
+protected:
+  // the default constructor is protected so that you
+  // can't instance this class. you must instance one
+  // of its subclasses instead.
+  dSpace () { _id = 0; }
+
+public:
+  dSpaceID id() const
+    { return (dSpaceID) _id; }
+  operator dSpaceID() const
+    { return (dSpaceID) _id; }
+
+  void setCleanup (int mode)
+    { dSpaceSetCleanup (id(), mode); }
+  int getCleanup()
+    { return dSpaceGetCleanup (id()); }
+
+  void add (dGeomID x)
+    { dSpaceAdd (id(), x); }
+  void remove (dGeomID x)
+    { dSpaceRemove (id(), x); }
+  int query (dGeomID x)
+    { return dSpaceQuery (id(),x); }
+
+  int getNumGeoms()
+    { return dSpaceGetNumGeoms (id()); }
+  dGeomID getGeom (int i)
+    { return dSpaceGetGeom (id(),i); }
+
+  void collide (void *data, dNearCallback *callback)
+    { dSpaceCollide (id(),data,callback); }
+};
+
+
+class dSimpleSpace : public dSpace {
+  // intentionally undefined, don't use these
+  dSimpleSpace (dSimpleSpace &);
+  void operator= (dSimpleSpace &);
+
+public:
+  dSimpleSpace (dSpaceID space)
+    { _id = (dGeomID) dSimpleSpaceCreate (space); }
+};
+
+
+class dHashSpace : public dSpace {
+  // intentionally undefined, don't use these
+  dHashSpace (dHashSpace &);
+  void operator= (dHashSpace &);
+
+public:
+  dHashSpace (dSpaceID space)
+    { _id = (dGeomID) dHashSpaceCreate (space); }
+  void setLevels (int minlevel, int maxlevel)
+    { dHashSpaceSetLevels (id(),minlevel,maxlevel); }
+};
+
+
+class dQuadTreeSpace : public dSpace {
+  // intentionally undefined, don't use these
+  dQuadTreeSpace (dQuadTreeSpace &);
+  void operator= (dQuadTreeSpace &);
+
+public:
+  dQuadTreeSpace (dSpaceID space, dVector3 center, dVector3 extents, int depth)
+    { _id = (dGeomID) dQuadTreeSpaceCreate (space,center,extents,depth); }
+};
+
+
+class dSphere : public dGeom {
+  // intentionally undefined, don't use these
+  dSphere (dSphere &);
+  void operator= (dSphere &);
+
+public:
+  dSphere () { }
+  dSphere (dSpaceID space, dReal radius)
+    { _id = dCreateSphere (space, radius); }
+
+  void create (dSpaceID space, dReal radius) {
+    if (_id) dGeomDestroy (_id);
+    _id = dCreateSphere (space, radius);
+  }
+
+  void setRadius (dReal radius)
+    { dGeomSphereSetRadius (_id, radius); }
+  dReal getRadius() const
+    { return dGeomSphereGetRadius (_id); }
+};
+
+
+class dBox : public dGeom {
+  // intentionally undefined, don't use these
+  dBox (dBox &);
+  void operator= (dBox &);
+
+public:
+  dBox () { }
+  dBox (dSpaceID space, dReal lx, dReal ly, dReal lz)
+    { _id = dCreateBox (space,lx,ly,lz); }
+
+  void create (dSpaceID space, dReal lx, dReal ly, dReal lz) {
+    if (_id) dGeomDestroy (_id);
+    _id = dCreateBox (space,lx,ly,lz);
+  }
+
+  void setLengths (dReal lx, dReal ly, dReal lz)
+    { dGeomBoxSetLengths (_id, lx, ly, lz); }
+  void getLengths (dVector3 result) const
+    { dGeomBoxGetLengths (_id,result); }
+};
+
+
+class dPlane : public dGeom {
+  // intentionally undefined, don't use these
+  dPlane (dPlane &);
+  void operator= (dPlane &);
+
+public:
+  dPlane() { }
+  dPlane (dSpaceID space, dReal a, dReal b, dReal c, dReal d)
+    { _id = dCreatePlane (space,a,b,c,d); }
+
+  void create (dSpaceID space, dReal a, dReal b, dReal c, dReal d) {
+    if (_id) dGeomDestroy (_id);
+    _id = dCreatePlane (space,a,b,c,d);
+  }
+
+  void setParams (dReal a, dReal b, dReal c, dReal d)
+    { dGeomPlaneSetParams (_id, a, b, c, d); }
+  void getParams (dVector4 result) const
+    { dGeomPlaneGetParams (_id,result); }
+};
+
+
+class dCCylinder : public dGeom {
+  // intentionally undefined, don't use these
+  dCCylinder (dCCylinder &);
+  void operator= (dCCylinder &);
+
+public:
+  dCCylinder() { }
+  dCCylinder (dSpaceID space, dReal radius, dReal length)
+    { _id = dCreateCCylinder (space,radius,length); }
+
+  void create (dSpaceID space, dReal radius, dReal length) {
+    if (_id) dGeomDestroy (_id);
+    _id = dCreateCCylinder (space,radius,length);
+  }
+
+  void setParams (dReal radius, dReal length)
+    { dGeomCCylinderSetParams (_id, radius, length); }
+  void getParams (dReal *radius, dReal *length) const
+    { dGeomCCylinderGetParams (_id,radius,length); }
+};
+
+
+class dRay : public dGeom {
+  // intentionally undefined, don't use these
+  dRay (dRay &);
+  void operator= (dRay &);
+
+public:
+  dRay() { }
+  dRay (dSpaceID space, dReal length)
+    { _id = dCreateRay (space,length); }
+
+  void create (dSpaceID space, dReal length) {
+    if (_id) dGeomDestroy (_id);
+    _id = dCreateRay (space,length);
+  }
+
+  void setLength (dReal length)
+    { dGeomRaySetLength (_id, length); }
+  dReal getLength()
+    { return dGeomRayGetLength (_id); }
+
+  void set (dReal px, dReal py, dReal pz, dReal dx, dReal dy, dReal dz)
+    { dGeomRaySet (_id, px, py, pz, dx, dy, dz); }
+  void get (dVector3 start, dVector3 dir)
+    { dGeomRayGet (_id, start, dir); }
+
+  void setParams (int firstContact, int backfaceCull)
+    { dGeomRaySetParams (_id, firstContact, backfaceCull); }
+  void getParams (int *firstContact, int *backfaceCull)
+    { dGeomRayGetParams (_id, firstContact, backfaceCull); }
+  void setClosestHit (int closestHit)
+    { dGeomRaySetClosestHit (_id, closestHit); }
+  int getClosestHit()
+    { return dGeomRayGetClosestHit (_id); }
+};
+
+
+class dGeomTransform : public dGeom {
+  // intentionally undefined, don't use these
+  dGeomTransform (dGeomTransform &);
+  void operator= (dGeomTransform &);
+
+public:
+  dGeomTransform() { }
+  dGeomTransform (dSpaceID space)
+    { _id = dCreateGeomTransform (space); }
+
+  void create (dSpaceID space=0) {
+    if (_id) dGeomDestroy (_id);
+    _id = dCreateGeomTransform (space);
+  }
+
+  void setGeom (dGeomID geom)
+    { dGeomTransformSetGeom (_id, geom); }
+  dGeomID getGeom() const
+    { return dGeomTransformGetGeom (_id); }
+
+  void setCleanup (int mode)
+    { dGeomTransformSetCleanup (_id,mode); }
+  int getCleanup ()
+    { return dGeomTransformGetCleanup (_id); }
+
+  void setInfo (int mode)
+    { dGeomTransformSetInfo (_id,mode); }
+  int getInfo()
+    { return dGeomTransformGetInfo (_id); }
+};
+
+
+#endif
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/collision_trimesh.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/collision_trimesh.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/collision_trimesh.h	(revision 1812)
@@ -0,0 +1,181 @@
+/*************************************************************************
+ *                                                                       *
+ * Open Dynamics Engine, Copyright (C) 2001-2003 Russell L. Smith.       *
+ * All rights reserved.  Email: russ@q12.org   Web: www.q12.org          *
+ *                                                                       *
+ * This library is free software; you can redistribute it and/or         *
+ * modify it under the terms of EITHER:                                  *
+ *   (1) The GNU Lesser General Public License as published by the Free  *
+ *       Software Foundation; either version 2.1 of the License, or (at  *
+ *       your option) any later version. The text of the GNU Lesser      *
+ *       General Public License is included with this library in the     *
+ *       file LICENSE.TXT.                                               *
+ *   (2) The BSD-style license that is included with this library in     *
+ *       the file LICENSE-BSD.TXT.                                       *
+ *                                                                       *
+ * This library is distributed in the hope that it will be useful,       *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
+ * LICENSE.TXT and LICENSE-BSD.TXT for more details.                     *
+ *                                                                       *
+ *************************************************************************/
+
+/*
+ * TriMesh code by Erwin de Vries.
+ *
+ * Trimesh data.
+ * This is where the actual vertexdata (pointers), and BV tree is stored.
+ * Vertices should be single precision!
+ * This should be more sophisticated, so that the user can easyly implement
+ * another collision library, but this is a lot of work, and also costs some
+ * performance because some data has to be copied.
+ */
+
+#ifndef _ODE_COLLISION_TRIMESH_H_
+#define _ODE_COLLISION_TRIMESH_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Data storage for triangle meshes.
+ */
+struct dxTriMeshData;
+typedef struct dxTriMeshData* dTriMeshDataID;
+
+/*
+ * These dont make much sense now, but they will later when we add more
+ * features.
+ */
+dTriMeshDataID dGeomTriMeshDataCreate();
+void dGeomTriMeshDataDestroy(dTriMeshDataID g);
+
+enum { TRIMESH_FACE_NORMALS, TRIMESH_LAST_TRANSFORMATION };
+void dGeomTriMeshDataSet(dTriMeshDataID g, int data_id, void* data);
+
+
+/*
+ * Build TriMesh data with single pricision used in vertex data .
+ */
+void dGeomTriMeshDataBuildSingle(dTriMeshDataID g,
+                                 const void* Vertices, int VertexStride, int VertexCount, 
+                                 const void* Indices, int IndexCount, int TriStride);
+/* same again with a normals array (used as trimesh-trimesh optimization) */
+void dGeomTriMeshDataBuildSingle1(dTriMeshDataID g,
+                                  const void* Vertices, int VertexStride, int VertexCount, 
+                                  const void* Indices, int IndexCount, int TriStride,
+                                  const void* Normals);
+/*
+* Build TriMesh data with double pricision used in vertex data .
+*/
+void dGeomTriMeshDataBuildDouble(dTriMeshDataID g, 
+                                 const void* Vertices,  int VertexStride, int VertexCount, 
+                                 const void* Indices, int IndexCount, int TriStride);
+/* same again with a normals array (used as trimesh-trimesh optimization) */
+void dGeomTriMeshDataBuildDouble1(dTriMeshDataID g, 
+                                  const void* Vertices,  int VertexStride, int VertexCount, 
+                                  const void* Indices, int IndexCount, int TriStride,
+                                  const void* Normals);
+
+/*
+ * Simple build. Single/double precision based on dSINGLE/dDOUBLE!
+ */
+void dGeomTriMeshDataBuildSimple(dTriMeshDataID g,
+                                 const dReal* Vertices, int VertexCount,
+                                 const int* Indices, int IndexCount);
+/* same again with a normals array (used as trimesh-trimesh optimization) */
+void dGeomTriMeshDataBuildSimple1(dTriMeshDataID g,
+                                  const dReal* Vertices, int VertexCount,
+                                  const int* Indices, int IndexCount,
+                                  const int* Normals);
+/*
+ * Per triangle callback. Allows the user to say if he wants a collision with
+ * a particular triangle.
+ */
+typedef int dTriCallback(dGeomID TriMesh, dGeomID RefObject, int TriangleIndex);
+void dGeomTriMeshSetCallback(dGeomID g, dTriCallback* Callback);
+dTriCallback* dGeomTriMeshGetCallback(dGeomID g);
+
+/*
+ * Per object callback. Allows the user to get the list of triangles in 1
+ * shot. Maybe we should remove this one.
+ */
+typedef void dTriArrayCallback(dGeomID TriMesh, dGeomID RefObject, const int* TriIndices, int TriCount);
+void dGeomTriMeshSetArrayCallback(dGeomID g, dTriArrayCallback* ArrayCallback);
+dTriArrayCallback* dGeomTriMeshGetArrayCallback(dGeomID g);
+
+/*
+ * Ray callback.
+ * Allows the user to say if a ray collides with a triangle on barycentric
+ * coords. The user can for example sample a texture with alpha transparency
+ * to determine if a collision should occur.
+ */
+typedef int dTriRayCallback(dGeomID TriMesh, dGeomID Ray, int TriangleIndex, dReal u, dReal v);
+void dGeomTriMeshSetRayCallback(dGeomID g, dTriRayCallback* Callback);
+dTriRayCallback* dGeomTriMeshGetRayCallback(dGeomID g);
+
+/*
+ * Trimesh class
+ * Construction. Callbacks are optional.
+ */
+dGeomID dCreateTriMesh(dSpaceID space, dTriMeshDataID Data, dTriCallback* Callback, dTriArrayCallback* ArrayCallback, dTriRayCallback* RayCallback);
+
+void dGeomTriMeshSetData(dGeomID g, dTriMeshDataID Data);
+
+// enable/disable/check temporal coherence
+void dGeomTriMeshEnableTC(dGeomID g, int geomClass, int enable);
+int dGeomTriMeshIsTCEnabled(dGeomID g, int geomClass);
+
+/*
+ * Clears the internal temporal coherence caches. When a geom has its
+ * collision checked with a trimesh once, data is stored inside the trimesh.
+ * With large worlds with lots of seperate objects this list could get huge.
+ * We should be able to do this automagically.
+ */
+void dGeomTriMeshClearTCCache(dGeomID g);
+
+
+/*
+ * returns the TriMeshDataID
+ */
+dTriMeshDataID dGeomTriMeshGetTriMeshDataID(dGeomID g);
+
+/*
+ * Gets a triangle.
+ */
+void dGeomTriMeshGetTriangle(dGeomID g, int Index, dVector3* v0, dVector3* v1, dVector3* v2);
+
+/*
+ * Gets the point on the requested triangle and the given barycentric
+ * coordinates.
+ */
+void dGeomTriMeshGetPoint(dGeomID g, int Index, dReal u, dReal v, dVector3 Out);
+
+/*
+
+This is how the strided data works:
+
+struct StridedVertex{
+	dVector3 Vertex;
+	// Userdata
+};
+int VertexStride = sizeof(StridedVertex);
+
+struct StridedTri{
+	int Indices[3];
+	// Userdata
+};
+int TriStride = sizeof(StridedTri);
+
+*/
+
+
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif	/* _ODE_COLLISION_TRIMESH_H_ */
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/common.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/common.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/ode/common.h	(revision 1812)
@@ -0,0 +1,323 @@
+/*************************************************************************
+ *                                                                       *
+ * Open Dynamics Engine, Copyright (C) 2001,2002 Russell L. Smith.       *
+ * All rights reserved.  Email: russ@q12.org   Web: www.q12.org          *
+ *                                                                       *
+ * This library is free software; you can redistribute it and/or         *
+ * modify it under the terms of EITHER:                                  *
+ *   (1) The GNU Lesser General Public License as published by the Free  *
+ *       Software Foundation; either version 2.1 of the License, or (at  *
+ *       your option) any later version. The text of the GNU Lesser      *
+ *       General Public License is included with this library in the     *
+ *       file LICENSE.TXT.                                               *
+ *   (2) The BSD-style license that is included with this library in     *
+ *       the file LICENSE-BSD.TXT.                                       *
+ *                                                                       *
+ * This library is distributed in the hope that it will be useful,       *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of        *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the files    *
+ * LICENSE.TXT and LICENSE-BSD.TXT for more details.                     *
+ *                                                                       *
+ *************************************************************************/
+
+#ifndef _ODE_COMMON_H_
+#define _ODE_COMMON_H_
+
+#include <ode/config.h>
+#include <ode/error.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+/* configuration stuff */
+
+/* the efficient alignment. most platforms align data structures to some
+ * number of bytes, but this is not always the most efficient alignment.
+ * for example, many x86 compilers align to 4 bytes, but on a pentium it
+ * is important to align doubles to 8 byte boundaries (for speed), and
+ * the 4 floats in a SIMD register to 16 byte boundaries. many other
+ * platforms have similar behavior. setting a larger alignment can waste
+ * a (very) small amount of memory. NOTE: this number must be a power of
+ * two. this is set to 16 by default.
+ */
+#define EFFICIENT_ALIGNMENT 16
+
+
+/* constants */
+
+/* pi and 1/sqrt(2) are defined here if necessary because they don't get
+ * defined in <math.h> on some platforms (like MS-Windows)
+ */
+
+#ifndef M_PI
+#define M_PI REAL(3.1415926535897932384626433832795029)
+#endif
+#ifndef M_SQRT1_2
+#define M_SQRT1_2 REAL(0.7071067811865475244008443621048490)
+#endif
+
+
+/* debugging:
+ *   IASSERT  is an internal assertion, i.e. a consistency check. if it fails
+ *            we want to know where.
+ *   UASSERT  is a user assertion, i.e. if it fails a nice error message
+ *            should be printed for the user.
+ *   AASSERT  is an arguments assertion, i.e. if it fails "bad argument(s)"
+ *            is printed.
+ *   DEBUGMSG just prints out a message
+ */
+
+#ifndef dNODEBUG
+#ifdef __GNUC__
+#define dIASSERT(a) if (!(a)) dDebug (d_ERR_IASSERT, \
+  "assertion \"" #a "\" failed in %s() [%s]",__FUNCTION__,__FILE__);
+#define dUASSERT(a,msg) if (!(a)) dDebug (d_ERR_UASSERT, \
+  msg " in %s()", __FUNCTION__);
+#define dDEBUGMSG(msg) dMessage (d_ERR_UASSERT, \
+  msg " in %s()", __FUNCTION__);
+#else
+#define dIASSERT(a) if (!(a)) dDebug (d_ERR_IASSERT, \
+  "assertion \"" #a "\" failed in %s:%d",__FILE__,__LINE__);
+#define dUASSERT(a,msg) if (!(a)) dDebug (d_ERR_UASSERT, \
+  msg " (%s:%d)", __FILE__,__LINE__);
+#define dDEBUGMSG(msg) dMessage (d_ERR_UASSERT, \
+  msg " (%s:%d)", __FILE__,__LINE__);
+#endif
+#else
+#define dIASSERT(a) ;
+#define dUASSERT(a,msg) ;
+#define dDEBUGMSG(msg) ;
+#endif
+#define dAASSERT(a) dUASSERT(a,"Bad argument(s)")
+
+/* floating point data type, vector, matrix and quaternion types */
+
+#if defined(dSINGLE)
+typedef float dReal;
+#elif defined(dDOUBLE)
+typedef double dReal;
+#else
+#error You must #define dSINGLE or dDOUBLE
+#endif
+
+
+/* round an integer up to a multiple of 4, except that 0 and 1 are unmodified
+ * (used to compute matrix leading dimensions)
+ */
+#define dPAD(a) (((a) > 1) ? ((((a)-1)|3)+1) : (a))
+
+/* these types are mainly just used in headers */
+typedef dReal dVector3[4];
+typedef dReal dVector4[4];
+typedef dReal dMatrix3[4*3];
+typedef dReal dMatrix4[4*4];
+typedef dReal dMatrix6[8*6];
+typedef dReal dQuaternion[4];
+
+
+/* precision dependent scalar math functions */
+
+#if defined(dSINGLE)
+
+#define REAL(x) (x ## f)					/* form a constant */
+#define dRecip(x) ((float)(1.0f/(x)))				/* reciprocal */
+#define dSqrt(x) ((float)sqrtf(float(x)))			/* square root */
+#define dRecipSqrt(x) ((float)(1.0f/sqrtf(float(x))))		/* reciprocal square root */
+#define dSin(x) ((float)sinf(float(x)))				/* sine */
+#define dCos(x) ((float)cosf(float(x)))				/* cosine */
+#define dFabs(x) ((float)fabsf(float(x)))			/* absolute value */
+#define dAtan2(y,x) ((float)atan2f(float(y),float(x)))		/* arc tangent with 2 args */
+#define dFMod(a,b) ((float)fmodf(float(a),float(b)))		/* modulo */
+#define dCopySign(a,b) ((float)copysignf(float(a),float(b)))
+
+#elif defined(dDOUBLE)
+
+#define REAL(x) (x)
+#define dRecip(x) (1.0/(x))
+#define dSqrt(x) sqrt(x)
+#define dRecipSqrt(x) (1.0/sqrt(x))
+#define dSin(x) sin(x)
+#define dCos(x) cos(x)
+#define dFabs(x) fabs(x)
+#define dAtan2(y,x) atan2((y),(x))
+#define dFMod(a,b) (fmod((a),(b)))
+#define dCopySign(a,b) (copysign((a),(b)))
+
+#else
+#error You must #define dSINGLE or dDOUBLE
+#endif
+
+
+/* utility */
+
+
+/* round something up to be a multiple of the EFFICIENT_ALIGNMENT */
+
+#define dEFFICIENT_SIZE(x) ((((x)-1)|(EFFICIENT_ALIGNMENT-1))+1)
+
+
+/* alloca aligned to the EFFICIENT_ALIGNMENT. note that this can waste
+ * up to 15 bytes per allocation, depending on what alloca() returns.
+ */
+
+#define dALLOCA16(n) \
+  ((char*)dEFFICIENT_SIZE(((size_t)(alloca((n)+(EFFICIENT_ALIGNMENT-1))))))
+
+
+/* internal object types (all prefixed with `dx') */
+
+struct dxWorld;		/* dynamics world */
+struct dxSpace;		/* collision space */
+struct dxBody;		/* rigid body (dynamics object) */
+struct dxGeom;		/* geometry (collision object) */
+struct dxJoint;
+struct dxJointNode;
+struct dxJointGroup;
+
+typedef struct dxWorld *dWorldID;
+typedef struct dxSpace *dSpaceID;
+typedef struct dxBody *dBodyID;
+typedef struct dxGeom *dGeomID;
+typedef struct dxJoint *dJointID;
+typedef struct dxJointGroup *dJointGroupID;
+
+
+/* error numbers */
+
+enum {
+  d_ERR_UNKNOWN = 0,		/* unknown error */
+  d_ERR_IASSERT,		/* internal assertion failed */
+  d_ERR_UASSERT,		/* user assertion failed */
+  d_ERR_LCP			/* user assertion failed */
+};
+
+
+/* joint type numbers */
+
+enum {
+  dJointTypeNone = 0,		/* or "unknown" */
+  dJointTypeBall,
+  dJointTypeHinge,
+  dJointTypeSlider,
+  dJointTypeContact,
+  dJointTypeUniversal,
+  dJointTypeHinge2,
+  dJointTypeFixed,
+  dJointTypeNull,
+  dJointTypeAMotor,
+  // Plane2D change
+  dJointTypePlane2D
+};
+
+
+/* an alternative way of setting joint parameters, using joint parameter
+ * structures and member constants. we don't actually do this yet.
+ */
+
+/*
+typedef struct dLimot {
+  int mode;
+  dReal lostop, histop;
+  dReal vel, fmax;
+  dReal fudge_factor;
+  dReal bounce, soft;
+  dReal suspension_erp, suspension_cfm;
+} dLimot;
+
+enum {
+  dLimotLoStop		= 0x0001,
+  dLimotHiStop		= 0x0002,
+  dLimotVel		= 0x0004,
+  dLimotFMax		= 0x0008,
+  dLimotFudgeFactor	= 0x0010,
+  dLimotBounce		= 0x0020,
+  dLimotSoft		= 0x0040
+};
+*/
+
+
+/* standard joint parameter names. why are these here? - because we don't want
+ * to include all the joint function definitions in joint.cpp. hmmmm.
+ * MSVC complains if we call D_ALL_PARAM_NAMES_X with a blank second argument,
+ * which is why we have the D_ALL_PARAM_NAMES macro as well. please copy and
+ * paste between these two.
+ */
+
+#define D_ALL_PARAM_NAMES(start) \
+  /* parameters for limits and motors */ \
+  dParamLoStop = start, \
+  dParamHiStop, \
+  dParamVel, \
+  dParamFMax, \
+  dParamFudgeFactor, \
+  dParamBounce, \
+  dParamCFM, \
+  dParamStopERP, \
+  dParamStopCFM, \
+  /* parameters for suspension */ \
+  dParamSuspensionERP, \
+  dParamSuspensionCFM,
+
+#define D_ALL_PARAM_NAMES_X(start,x) \
+  /* parameters for limits and motors */ \
+  dParamLoStop ## x = start, \
+  dParamHiStop ## x, \
+  dParamVel ## x, \
+  dParamFMax ## x, \
+  dParamFudgeFactor ## x, \
+  dParamBounce ## x, \
+  dParamCFM ## x, \
+  dParamStopERP ## x, \
+  dParamStopCFM ## x, \
+  /* parameters for suspension */ \
+  dParamSuspensionERP ## x, \
+  dParamSuspensionCFM ## x,
+
+enum {
+  D_ALL_PARAM_NAMES(0)
+  D_ALL_PARAM_NAMES_X(0x100,2)
+  D_ALL_PARAM_NAMES_X(0x200,3)
+
+  /* add a multiple of this constant to the basic parameter numbers to get
+   * the parameters for the second, third etc axes.
+   */
+  dParamGroup=0x100
+};
+
+
+/* angular motor mode numbers */
+
+enum{
+  dAMotorUser = 0,
+  dAMotorEuler = 1
+};
+
+
+/* joint force feedback information */
+
+typedef struct dJointFeedback {
+  dVector3 f1;		/* force applied to body 1 */
+  dVector3 t1;		/* torque applied to body 1 */
+  dVector3 f2;		/* force applied to body 2 */
+  dVector3 t2;		/* torque applied to body 2 */
+} dJointFeedback;
+
+
+/* private functions that must be implemented by the collision library:
+ * (1) indicate that a geom has moved, (2) get the next geom in a body list.
+ * these functions are called whenever the position of geoms connected to a
+ * body have changed, e.g. with dBodySetPosition(), dBodySetRotation(), or
+ * when the ODE step function updates the body state.
+ */
+
+void dGeomMoved (dGeomID);
+dGeomID dGeomGetBodyNext (dGeomID);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreAutoParamDataSource.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreAutoParamDataSource.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreAutoParamDataSource.h	(revision 1812)
@@ -0,0 +1,186 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://ogre.sourceforge.net/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#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 {
+
+
+    /** 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
+    {
+    protected:
+        mutable Matrix4 mWorldMatrix[256];
+        mutable size_t mWorldMatrixCount;
+        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 mCameraPositionObjectSpace;
+        mutable Matrix4 mTextureViewProjMatrix;
+        mutable Matrix4 mViewMatrix;
+        mutable Matrix4 mProjectionMatrix;
+		mutable Real mDirLightExtrusionDistance;
+        mutable Vector4 mCameraPosition;
+
+        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 mCameraPositionObjectSpaceDirty;
+        mutable bool mCameraPositionDirty;
+        mutable bool mTextureViewProjMatrixDirty;
+		mutable ColourValue mAmbientLight;
+        mutable ColourValue mFogColour;
+        mutable Vector4 mFogParams;
+        mutable int mPassNumber;
+
+        const Renderable* mCurrentRenderable;
+        const Camera* mCurrentCamera;
+        const LightList* mCurrentLightList;
+        const Frustum* mCurrentTextureProjector;
+        const RenderTarget* mCurrentRenderTarget;
+        const Viewport* mCurrentViewport;
+
+        Light mBlankLight;
+    public:
+        AutoParamDataSource();
+        ~AutoParamDataSource();
+        /** Updates the current renderable */
+        void setCurrentRenderable(const Renderable* rend);
+        /** Updates the current camera */
+        void setCurrentCamera(const Camera* cam);
+        /** Sets the light list that should be used */
+        void setCurrentLightList(const LightList* ll);
+        /** Sets the current texture projector */
+        void setTextureProjector(const Frustum* frust);
+        /** Sets the current render target */
+        void setCurrentRenderTarget(const RenderTarget* target);
+        /** Sets the current viewport */
+        void setCurrentViewport(const Viewport* viewport);
+		/** Sets the shadow extrusion distance to be used for point lights. */
+		void setShadowDirLightExtrusionDistance(Real dist);
+
+        const Matrix4& getWorldMatrix(void) const;
+        const Matrix4* getWorldMatrixArray(void) const;
+        size_t getWorldMatrixCount(void) const;
+        const Matrix4& getViewMatrix(void) const;
+        const Matrix4& getViewProjectionMatrix(void) const;
+        const Matrix4& getProjectionMatrix(void) const;
+        const Matrix4& getWorldViewProjMatrix(void) const;
+        const Matrix4& getWorldViewMatrix(void) const;
+        const Matrix4& getInverseWorldMatrix(void) const;
+        const Matrix4& getInverseWorldViewMatrix(void) const;
+        const Matrix4& getInverseViewMatrix(void) const;
+        const Matrix4& getInverseTransposeWorldMatrix(void) const;
+        const Matrix4& getInverseTransposeWorldViewMatrix(void) const;
+        const Vector4& getCameraPosition(void) const;
+        const Vector4& getCameraPositionObjectSpace(void) const;
+        /** Get the light which is 'index'th closest to the current object */
+        const Light& getLight(size_t index) const;
+		void setAmbientLightColour(const ColourValue& ambient);
+		const ColourValue& getAmbientLightColour(void) const;
+        void setFog(FogMode mode, const ColourValue& colour, Real expDensity, Real linearStart, Real linearEnd);
+        const ColourValue& getFogColour(void) const;
+        const Vector4& getFogParams(void) const;
+        const Matrix4& getTextureViewProjMatrix(void) const;
+        const RenderTarget* getCurrentRenderTarget(void) const;
+        const Renderable* getCurrentRenderable(void) const;
+		Real getShadowExtrusionDistance(void) const;
+		Matrix4 getInverseViewProjMatrix(void) const;
+		Matrix4 getInverseTransposeViewProjMatrix() const;
+		Matrix4 getTransposeViewProjMatrix() const;
+		Matrix4 getTransposeViewMatrix() const;
+        Matrix4 getInverseTransposeViewMatrix() const;
+		Matrix4 getTransposeProjectionMatrix() const;
+		Matrix4 getInverseProjectionMatrix() const;
+		Matrix4 getInverseTransposeProjectionMatrix() const;
+		Matrix4 getTransposeWorldViewProjMatrix() const;
+		Matrix4 getInverseWorldViewProjMatrix() const;
+		Matrix4 getInverseTransposeWorldViewProjMatrix() const;
+		Matrix4 getTransposeWorldViewMatrix() const;
+		Matrix4 getTransposeWorldMatrix() const;
+        Real getTime(void) const;
+		Real getTime_0_X(Real x) const;
+		Real getCosTime_0_X(Real x) const;
+		Real getSinTime_0_X(Real x) const;
+		Real getTanTime_0_X(Real x) const;
+		Vector4 getTime_0_X_packed(Real x) const;
+		Real getTime_0_1(Real x) const;
+		Real getCosTime_0_1(Real x) const;
+		Real getSinTime_0_1(Real x) const;
+		Real getTanTime_0_1(Real x) const;
+		Vector4 getTime_0_1_packed(Real x) const;
+		Real getTime_0_2Pi(Real x) const;
+		Real getCosTime_0_2Pi(Real x) const;
+		Real getSinTime_0_2Pi(Real x) const;
+		Real getTanTime_0_2Pi(Real x) const;
+		Vector4 getTime_0_2Pi_packed(Real x) const;
+        Real getFrameTime(void) const;
+		Real getFPS() const;
+		Real getViewportWidth() const;
+		Real getViewportHeight() const;
+		Real getInverseViewportWidth() const;
+		Real getInverseViewportHeight() const;
+		Vector3 getViewDirection() const;
+		Vector3 getViewSideVector() const;
+		Vector3 getViewUpVector() const;
+		Real getFOV() const;
+		Real getNearClipDistance() const;
+		Real getFarClipDistance() const;
+        int getPassNumber(void) const;
+        void setPassNumber(const int passNumber);
+        void incPassNumber(void);
+    };
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreParticleAffectorFactory.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreParticleAffectorFactory.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreParticleAffectorFactory.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under 
+the terms of the GNU Lesser General Public License as published by the Free Software 
+Foundation; either version 2 of the License, or (at your option) any later 
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT 
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with 
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple 
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to 
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __ParticleAffectorFactory_H__
+#define __ParticleAffectorFactory_H__
+
+
+#include "OgrePrerequisites.h"
+#include "OgreParticleAffector.h"
+
+namespace Ogre {
+
+    /** 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
+    {
+    protected:
+        std::vector<ParticleAffector*> 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 reauired). */
+        virtual void destroyAffector(ParticleAffector* e);
+    };
+
+
+}
+
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSubMesh.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSubMesh.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSubMesh.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __SubMesh_H_
+#define __SubMesh_H_
+
+#include "OgrePrerequisites.h"
+
+#include "OgreVertexIndexData.h"
+#include "OgreMaterial.h"
+#include "OgreRenderOperation.h"
+#include "OgreVertexBoneAssignment.h"
+#include "OgreProgressiveMesh.h"
+#include "OgreAnimationTrack.h"
+
+namespace Ogre {
+
+    /** 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, instatiations 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
+    {
+        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 std::vector<unsigned short> IndexMap;
+        IndexMap blendIndexToBoneIndexMap;
+
+        ProgressiveMesh::LODFaceList mLodFaceList;
+
+        /// 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& 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 std::multimap<size_t, VertexBoneAssignment> 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);
+
+        /** 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;
+
+    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;
+
+
+        /// Internal method for removing LOD data
+        void removeLodLevels(void);
+
+
+
+    };
+
+} // namespace
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRibbonTrail.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRibbonTrail.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRibbonTrail.h	(revision 1812)
@@ -0,0 +1,220 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __RibbonTrail_H__
+#define __RibbonTrail_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreBillboardChain.h"
+#include "OgreNode.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreFrameListener.h"
+#include "OgreControllerManager.h"
+
+namespace Ogre {
+
+	/** 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 useColours = true);
+		/// destructor
+		virtual ~RibbonTrail();
+
+		typedef std::vector<Node*> 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;
+
+		/** 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;
+		/// Total length of trail in world units
+		Real mTrailLength;
+		/// length of each element
+		Real mElemLength;
+		/// Squared length of each element
+		Real mSquaredElemLength;
+		typedef std::vector<ColourValue> ColourValueList;
+		typedef std::vector<Real> 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);  
+
+	};
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreEdgeListBuilder.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreEdgeListBuilder.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreEdgeListBuilder.h	(revision 1812)
@@ -0,0 +1,234 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __EdgeListBuilder_H__
+#define __EdgeListBuilder_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreVector4.h"
+#include "OgreHardwareVertexBuffer.h"
+#include "OgreRenderOperation.h"
+
+namespace Ogre {
+
+
+    /** 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:
+        /** 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;
+            size_t vertIndex[3];/// Vertex indexes, relative to the original buffer
+            size_t sharedVertIndex[3]; /// Vertex indexes, relative to a shared vertex buffer with 
+                                        // duplicates eliminated (this buffer is not exposed)
+	        Vector4 normal;   // unit vector othogonal to this face, plus distance from origin
+            bool lightFacing; // Working vector used when calculating the silhouette
+        };
+        /** 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;
+        };
+
+        typedef std::vector<Triangle> TriangleList;
+        typedef std::vector<Edge> 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;
+            /** The edges themselves. */
+            EdgeList edges;
+
+        };
+
+        typedef std::vector<EdgeGroup> EdgeGroupList;
+        TriangleList triangles;
+        EdgeGroupList edgeGroups;
+		// manifold? NB This value is not stored in the  binary Mesh format yet so
+		// cannot be relied upon unless this has been calculated interactively.
+		//bool isClosed; // manifold?
+
+
+        /** Calculate the light facing state of the triangles in this edge list
+        @remarks
+            This is normally the first stage of calculating a silhouette, ie
+            establishing which tris are facing the light and which are facing
+            away. This state is stored in the 'lightFacing' flag in each 
+            Triangle.
+        @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, 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 std::vector<const VertexData*> VertexDataList;
+        typedef std::vector<Geometry> GeometryList;
+        typedef std::vector<CommonVertex> CommonVertexList;
+
+        GeometryList mGeometryList;
+        VertexDataList mVertexDataList;
+        CommonVertexList mVertices;
+        EdgeData* mEdgeData;
+		/// Map for identifying common vertices
+		typedef std::map<Vector3, size_t, vectorLess> 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 std::multimap< std::pair<size_t, size_t>, std::pair<size_t, size_t> > 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);
+    };
+
+}
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreBorderPanelOverlayElement.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreBorderPanelOverlayElement.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreBorderPanelOverlayElement.h	(revision 1812)
@@ -0,0 +1,338 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __BorderPanelOverlayElement_H__
+#define __BorderPanelOverlayElement_H__
+
+#include "OgrePanelOverlayElement.h"
+
+namespace Ogre {
+
+    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 _OgreExport 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;
+
+        /** Overridden from OverlayContainer */
+        void _updateRenderQueue(RenderQueue* queue);
+
+        /** Overridden from OverlayElement */
+        void setMetricsMode(GuiMetricsMode gmm);
+
+        /** Overridden from OverlayElement */
+        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 mpBorderMaterial;
+
+        // 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 meterial. 
+    */
+    class _OgreExport BorderRenderable : public Renderable
+    {
+    protected:
+        BorderPanelOverlayElement* mParent;
+    public:
+        /** Constructed with pointers to parent. */
+        BorderRenderable(BorderPanelOverlayElement* parent) : mParent(parent) {}
+        const MaterialPtr& getMaterial(void) const { return mParent->mpBorderMaterial; }
+        void getRenderOperation(RenderOperation& op) { op = mParent->mRenderOp2; }
+        void getWorldTransforms(Matrix4* xform) const { mParent->getWorldTransforms(xform); }
+        const Quaternion& getWorldOrientation(void) const { return Quaternion::IDENTITY; }
+        const Vector3& getWorldPosition(void) const { return Vector3::ZERO; }
+        unsigned short getNumWorldTransforms(void) const { return 1; }
+        bool useIdentityProjection(void) const { return true; }
+        bool useIdentityView(void) const { return true; }
+        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();
+		}
+    };
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreNoMemoryMacros.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreNoMemoryMacros.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreNoMemoryMacros.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+//-----------------------------------------------------------------------------
+// If you want to use the real C(++) *alloc/free/new/delete functions, you must
+// include this header before the section that uses them.
+#ifdef OGRE_MEMORY_MACROS
+#undef OGRE_MEMORY_MACROS
+#undef new
+#undef delete
+#undef malloc
+#undef calloc
+#undef realloc
+#undef free
+#endif
+//-----------------------------------------------------------------------------
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreHighLevelGpuProgram.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreHighLevelGpuProgram.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreHighLevelGpuProgram.h	(revision 1812)
@@ -0,0 +1,156 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __HighLevelGpuProgram_H__
+#define __HighLevelGpuProgram_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreGpuProgram.h"
+
+namespace Ogre {
+
+    /** 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;
+
+        /// 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, must be overridden
+        virtual void populateParameterNames(GpuProgramParametersSharedPtr params) = 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(); }
+
+
+
+    };
+
+    /** Specialisation of SharedPtr to allow SharedPtr to be assigned to HighLevelGpuProgramPtr 
+    @note Has to be a subclass since we need operator=.
+    We could templatise this instead of repeating per Resource subclass, 
+    except to do so requires a form VC6 does not support i.e.
+    ResourceSubclassPtr<T> : public SharedPtr<T>
+    */
+    class _OgreExport HighLevelGpuProgramPtr : public SharedPtr<HighLevelGpuProgram> 
+    {
+    public:
+        HighLevelGpuProgramPtr() : SharedPtr<HighLevelGpuProgram>() {}
+        explicit HighLevelGpuProgramPtr(HighLevelGpuProgram* rep) : SharedPtr<HighLevelGpuProgram>(rep) {}
+        HighLevelGpuProgramPtr(const HighLevelGpuProgramPtr& r) : SharedPtr<HighLevelGpuProgram>(r) {} 
+        HighLevelGpuProgramPtr(const ResourcePtr& r) : SharedPtr<HighLevelGpuProgram>()
+        {
+			// lock & copy other mutex pointer
+            OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME)
+            {
+			    OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
+			    OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
+                pRep = static_cast<HighLevelGpuProgram*>(r.getPointer());
+                pUseCount = r.useCountPointer();
+                if (pUseCount)
+                {
+                    ++(*pUseCount);
+                }
+            }
+        }
+
+        /// Operator used to convert a ResourcePtr to a HighLevelGpuProgramPtr
+        HighLevelGpuProgramPtr& operator=(const ResourcePtr& r)
+        {
+            if (pRep == static_cast<HighLevelGpuProgram*>(r.getPointer()))
+                return *this;
+            release();
+			// lock & copy other mutex pointer
+            OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME)
+            {
+                OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
+			    OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
+                pRep = static_cast<HighLevelGpuProgram*>(r.getPointer());
+                pUseCount = r.useCountPointer();
+                if (pUseCount)
+                {
+                    ++(*pUseCount);
+                }
+            }
+            return *this;
+        }
+		/// Operator used to convert a GpuProgramPtr to a HighLevelGpuProgramPtr
+		HighLevelGpuProgramPtr& operator=(const GpuProgramPtr& r);
+    };
+
+}
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePanelOverlayElement.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePanelOverlayElement.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePanelOverlayElement.h	(revision 1812)
@@ -0,0 +1,150 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __PanelOverlayElement_H__
+#define __PanelOverlayElement_H__
+
+#include "OgreOverlayContainer.h"
+
+namespace Ogre {
+
+
+    /** 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 _OgreExport 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 renderred.
+        */
+        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: /GTP/trunk/App/Demos/Geom/OgreStuff/include/asm_math.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/asm_math.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/asm_math.h	(revision 1812)
@@ -0,0 +1,365 @@
+#ifndef __asm_math_H__
+#define __asm_math_H__
+
+#include "OgrePrerequisites.h"
+
+/*=============================================================================
+ ASM math routines posted by davepermen et al on flipcode forums
+=============================================================================*/
+
+const float pi = 4.0 * atan( 1.0 );
+const float half_pi = 0.5 * pi;
+
+/*=============================================================================
+	NO EXPLICIT RETURN REQUIRED FROM THESE METHODS!! 
+=============================================================================*/
+#if  OGRE_COMPILER == OGRE_COMPILER_MSVC && OGRE_ARCH_TYPE == OGRE_ARCHITECTURE_32
+#	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
+
+    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
+
+    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
+
+    __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
+
+    __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
+
+    __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
+
+    // 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
+
+    __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
+
+    __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
+
+    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
+
+__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
+  #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
+  #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
+
+    const float asm_e = 2.71828182846f;
+    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
+#	pragma warning( pop )
+#endif
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreOverlayElementCommands.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreOverlayElementCommands.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreOverlayElementCommands.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under 
+the terms of the GNU Lesser General Public License as published by the Free Software 
+Foundation; either version 2 of the License, or (at your option) any later 
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT 
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with 
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple 
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to 
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __OverlayElementEmitterCommands_H__
+#define __OverlayElementEmitterCommands_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreStringInterface.h"
+
+namespace Ogre  {
+
+
+    namespace OverlayElementCommands {
+        /// Command object for OverlayElement  - see ParamCommand 
+        class _OgreExport CmdLeft : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for OverlayElement  - see ParamCommand 
+        class _OgreExport CmdTop : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for OverlayElement  - see ParamCommand 
+        class _OgreExport CmdWidth : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for OverlayElement  - see ParamCommand 
+        class _OgreExport CmdHeight : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for OverlayElement  - see ParamCommand 
+        class _OgreExport CmdMaterial : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for OverlayElement  - see ParamCommand 
+        class _OgreExport CmdCaption : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for OverlayElement  - see ParamCommand 
+        class _OgreExport CmdMetricsMode : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for OverlayElement  - see ParamCommand 
+        class _OgreExport CmdHorizontalAlign : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for OverlayElement  - see ParamCommand 
+        class _OgreExport CmdVerticalAlign : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+        /// Command object for OverlayElement  - see ParamCommand 
+        class _OgreExport CmdVisible : public ParamCommand
+        {
+        public:
+            String doGet(const void* target) const;
+            void doSet(void* target, const String& val);
+        };
+
+    }
+}
+
+#endif
+
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePlatformManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePlatformManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePlatformManager.h	(revision 1812)
@@ -0,0 +1,174 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __PlatformManager_H__
+#define __PlatformManager_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreSingleton.h"
+
+namespace Ogre {
+    typedef void (*DLL_CREATECONFIGDIALOG)(ConfigDialog** ppDlg);
+    typedef void (*DLL_CREATEERRORDIALOG)(ErrorDialog** ppDlg);
+    typedef void (*DLL_CREATEINPUTREADER)(InputReader** ppReader);
+	typedef void (*DLL_CREATETIMER)(Timer** ppTimer);
+
+    typedef void (*DLL_DESTROYCONFIGDIALOG)(ConfigDialog* ppDlg);
+    typedef void (*DLL_DESTROYERRORDIALOG)(ErrorDialog* ppDlg);
+    typedef void (*DLL_DESTROYINPUTREADER)(InputReader* ppReader);
+    typedef void (*DLL_DESTROYTIMER)(Timer* ppTimer);
+
+	typedef void (*DLL_MESSAGEPUMP)(RenderWindow* rw);
+
+    /** Class which manages the platform settings Ogre runs on.
+        @remarks
+            Because Ogre is designed to be platform-independent, it
+            dynamically loads a library containing all the platform-specific
+            elements like dialogs etc. 
+        @par
+            This class manages that load and provides a simple interface to
+            the platform.
+    */
+    class _OgreExport PlatformManager : public Singleton<PlatformManager>
+    {
+    protected:
+        DLL_CREATECONFIGDIALOG mpfCreateConfigDialog;
+        DLL_CREATEERRORDIALOG mpfCreateErrorDialog;
+        DLL_CREATEINPUTREADER mpfCreateInputReader;
+		DLL_CREATETIMER mpfCreateTimer;
+		
+		DLL_DESTROYCONFIGDIALOG mpfDestroyConfigDialog;
+        DLL_DESTROYERRORDIALOG mpfDestroyErrorDialog;
+        DLL_DESTROYINPUTREADER mpfDestroyInputReader;
+        DLL_DESTROYTIMER mpfDestroyTimer;
+
+		DLL_MESSAGEPUMP mpfMessagePump;
+		
+    public:
+        /** Default constructor.
+        */
+        PlatformManager();
+
+        /** Gets a new instance of a platform-specific config dialog.
+            @remarks
+                The instance returned from this method will be a
+                platform-specific subclass of ConfigDialog, and must be
+                destroyed by the caller when required.
+        */
+        ConfigDialog* createConfigDialog();
+
+        /** Destroys an instance of a platform-specific config dialog.
+            @remarks
+                Required since deletion of objects must be performed on the
+                correct heap.
+        */
+        void destroyConfigDialog(ConfigDialog* dlg);
+
+        /** Gets a new instance of a platform-specific config dialog.
+            @remarks
+                The instance returned from this method will be a
+                platform-specific subclass of ErrorDialog, and must be
+                destroyed by the caller when required.
+        */
+        ErrorDialog* createErrorDialog();
+
+        /** Destroys an instance of a platform-specific error dialog.
+            @remarks
+                Required since deletion of objects must be performed on the
+                correct heap.
+        */
+        void destroyErrorDialog(ErrorDialog* dlg);
+
+        /** Gets a new instance of a platform-specific input reader.
+            @remarks
+                The instance returned from this method will be a
+                platform-specific subclass of InputReader, and must be
+                destroyed by the caller when required.
+        */
+        InputReader* createInputReader();
+
+        /** Destroys an instance of a platform-specific input reader.
+            @remarks
+                Required since deletion of objects must be performed on the
+                correct heap.
+        */
+        void destroyInputReader(InputReader* reader);
+		
+		/** Creates a new Timer instance
+		*/
+		Timer* createTimer();
+
+        /** Destroys an instance of a timer. */
+        void destroyTimer(Timer* timer);
+
+		/**
+		@remarks
+			Allows platform to provide Platform specific Event
+			updating/dispatching per frame (ie. Win32 Message Pump) as called
+			from Root::startRendering . If you are not using Root::startRendering,
+			you can call this function yourself, or run your own event pump
+		*/
+		void messagePump(RenderWindow* rw);
+
+        /** 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 PlatformManager& 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 PlatformManager* getSingletonPtr(void);
+
+
+    };
+
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreUserDefinedObject.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreUserDefinedObject.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreUserDefinedObject.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __UserDefinedObject_H__
+#define __UserDefinedObject_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+
+    /** This class is designed to be subclassed by OGRE users, to allow them to
+        associate their own application objects with MovableObject instances
+        in the engine.
+    @remarks
+        It's always been suggested that an OGRE application would likley comprise
+        a number of game objects which would keep pointers to OGRE objects in order
+        to maintain the link. However, in some cases it would be very useful to be able to
+        navigate directly from an OGRE instance back to a custom application object.
+        This abstract class exists for this purpose; MovableObjects hold a pointer to
+        a UserDefinedObject instance, which application writers subclass in order to
+        include their own attributes. Your game objects themselves may be subclasses of this
+        class, or your subclasses may merely be a link between them.
+    @par
+        Because OGRE never uses instances of this object itself, there is very little
+        definition to this class; the application is expected to add all the detail it wants.
+        However, as a hint, and for debugging purposes, this class does define a 'type id',
+        which it is recommended you use to differentiate between your subclasses,
+        if you have more than one type.
+    */
+    class _OgreExport UserDefinedObject
+    {
+    public:
+        /** Standard constructor. */
+        UserDefinedObject();
+        virtual ~UserDefinedObject() {}
+
+        /** Return a number identifying the type of user defined object.
+        @remarks
+            Can be used to differentiate between different types of object which you attach to
+            OGRE MovableObject instances. Recommend you override this in your classes if you
+            use more than one type of object.
+        @par
+            Alternatively, you can override the getTypeName method and use that instead; 
+            that version is a litle more friendly and easier to scope, but obviously 
+            slightly less efficient. You choose which you prefer.
+        */
+        virtual long getTypeID(void) const;
+
+        /** Return a string identifying the type of user defined object.
+        @remarks
+            Can be used to differentiate between different types of object which you attach to
+            OGRE MovableObject instances. Recommend you override this in your classes if you
+            use more than one type of object.
+        @par
+            Alternatively, you can override the getTypeID method and use that instead; 
+            that version is a litle more efficient, but obviously 
+            slightly less easy to read. You choose which you prefer.
+        */
+        virtual const String& getTypeName(void) const;
+        
+    };
+    
+        
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreILCodecs.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreILCodecs.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreILCodecs.h	(revision 1812)
@@ -0,0 +1,50 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef _DDSCodec_H__
+#define _DDSCodec_H__
+
+#include <list>
+
+namespace Ogre 
+{
+    class ILImageCodec;
+    
+    class _OgrePrivate ILCodecs {
+    protected:
+       static std::list<ILImageCodec*> codeclist;
+    public:
+    	// Register all codecs provided by this module
+	   static void registerCodecs(void);
+	   // Delete all codecs provided by this module
+	   static void deleteCodecs(void);
+    };
+
+} // namespace Ogre
+
+
+#endif // #ifndef _DDSCodec_H__
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderTarget.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderTarget.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderTarget.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __RenderTarget_H__
+#define __RenderTarget_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreString.h"
+#include "OgreTextureManager.h"
+#include "OgreViewport.h"
+#include "OgreTimer.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 {
+
+    /** 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:
+        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;
+        };
+
+        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 unsigned int getWidth(void) const;
+        virtual unsigned int getHeight(void) const;
+        virtual unsigned int getColourDepth(void) const;
+
+        /** 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.
+        */
+        virtual void update(void);
+
+        /** Adds a viewport to the rendering target.
+            @remarks
+                A viewport is the rectangle into which redering 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 ZOrders are on top of lower ones. The actual number
+                is irrelevant, only the relative ZOrder 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);
+
+        /** Removes a viewport at a given ZOrder.
+        */
+        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);
+
+        /** Adds debug text to this window. */
+        virtual void setDebugText(const String& text);
+
+		/** Returns the debug text. */
+		const String& getDebugText() const;
+
+        /** 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;
+
+        /** Writes the current contents of the render target to the named file. */
+        virtual void writeContentsToFile(const String& filename) = 0;
+
+	/** Writes the current contents of the render target to the (PREFIX)(time-stamp)(SUFFIX) file.
+		@returns 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;
+        /** 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;
+
+
+        /** RenderSystem specific interface for a RenderTarget;
+            this should be subclassed by RenderSystems.
+        */
+        class Impl
+        {
+        protected:
+            /** Declared protected as interface is never used for destruction.
+                gcc will issue a warning here: `class Impl' has virtual functions 
+                but non-virtual destructor. This is no problem because this interface 
+                is never used to delete an object.
+            */
+            ~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();
+    protected:
+        /// The name of this target.
+        String mName;
+		/// The priority of the render target.
+		uchar mPriority;
+
+        unsigned int mWidth;
+        unsigned int mHeight;
+        unsigned int mColourDepth;
+        bool mIsDepthBuffered;
+
+        // Stats
+		FrameStats mStats;
+        
+        Timer* mTimer ;
+        String mDebugText;
+        unsigned long mLastSecond;
+        unsigned long mLastTime;
+        size_t mFrameCount;
+
+        bool mActive;
+        bool mAutoUpdate;
+
+        void updateStats(void);
+
+        typedef std::map<int, Viewport*, std::less<int> > ViewportList;
+        /// List of viewports, map on Z-order
+        ViewportList mViewportList;
+
+        typedef std::vector<RenderTargetListener*> 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);
+    };
+
+} // Namespace
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSearchOps.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSearchOps.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSearchOps.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+// 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
+
+#include <dirent.h>
+#include <unistd.h>
+#include <fnmatch.h>
+/* The max number of searches to allow at one time */
+#define MAX_FIND_SEARCHES 10
+
+struct _find_search_t
+{
+    int in_use;
+    char *pattern;
+    DIR *dirfd;
+};
+
+/* 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_SUBDIR 0x10  /* Subdirectory */
+#define _A_ARCH   0x20  /* Archive file */
+
+long _findfirst(const char *pattern, struct _finddata_t *data);
+int _findnext(long id, struct _finddata_t *data);
+int _findclose(long id);
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreDefaultHardwareBufferManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreDefaultHardwareBufferManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreDefaultHardwareBufferManager.h	(revision 1812)
@@ -0,0 +1,112 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __DefaultHardwareBufferManager_H__
+#define __DefaultHardwareBufferManager_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreHardwareBufferManager.h"
+#include "OgreHardwareVertexBuffer.h"
+#include "OgreHardwareIndexBuffer.h"
+
+namespace Ogre {
+
+    /// Specialisation of HardwareVertexBuffer for emulation
+    class _OgreExport DefaultHardwareVertexBuffer : public HardwareVertexBuffer 
+    {
+	protected:
+		unsigned char* mpData;
+        /** 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();
+        /** 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* mpData;
+        /** 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 HardwareBufferManager 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 DefaultHardwareBufferManager : public HardwareBufferManager
+	{
+    public:
+        DefaultHardwareBufferManager();
+        ~DefaultHardwareBufferManager();
+        /// Creates a vertex buffer
+		HardwareVertexBufferSharedPtr 
+            createVertexBuffer(size_t vertexSize, size_t numVerts, 
+				HardwareBuffer::Usage usage, bool useShadowBuffer = false);
+		/// Create a hardware vertex buffer
+		HardwareIndexBufferSharedPtr 
+            createIndexBuffer(HardwareIndexBuffer::IndexType itype, size_t numIndexes, 
+				HardwareBuffer::Usage usage, bool useShadowBuffer = false);
+
+    };
+
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePlaneBoundedVolume.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePlaneBoundedVolume.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePlaneBoundedVolume.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __PlaneBoundedVolume_H_
+#define __PlaneBoundedVolume_H_
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+#include "OgreAxisAlignedBox.h"
+#include "OgreSphere.h"
+#include "OgreMath.h"
+#include "OgrePlane.h"
+
+namespace Ogre {
+
+    /** Represents a convex volume bounded by planes.
+    */
+    class _OgreExport PlaneBoundedVolume
+    {
+    public:
+        typedef std::vector<Plane> 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 all points are on outside of any plane, we fail
+            const Vector3* points = box.getAllCorners();
+            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 corners are
+                // Intersection fails when at all corners are on the
+                // outside of one plane
+                bool splittingPlane = true;
+                for (int corner = 0; corner < 8; ++corner)
+                {
+                    if (plane.getSide(points[corner]) != outside)
+                    {
+                        // this point is on the wrong side
+                        splittingPlane = false;
+                        break;
+                    }
+                }
+                if (splittingPlane)
+                {
+                    // 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
+        @returns 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 std::vector<PlaneBoundedVolume> PlaneBoundedVolumeList;
+
+
+}
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCommon.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCommon.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCommon.h	(revision 1812)
@@ -0,0 +1,372 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __Common_H__
+#define __Common_H__
+// Common stuff
+
+#include <utility>
+
+namespace Ogre {
+
+
+    /** 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 magnifiying a texture
+        FT_MAG,
+        /// The filter used when determining the mipmap
+        FT_MIP
+    };
+    /** Filtering options for textures / mipmaps. */
+    enum FilterOptions
+    {
+        /// No filtering, used for FILT_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 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 apparant 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 monochrome 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 apparant when using coloured lights 
+			or bump mapping.
+        */
+        SHADOWTYPE_TEXTURE_ADDITIVE = 0x21
+    };
+
+    /** 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
+    };
+    
+	
+    typedef std::vector<Light*> LightList;
+
+    typedef std::map<String, bool> UnaryOptionList;
+    typedef std::map<String, String> BinaryOptionList;
+
+	/// Name / value parameter pair (first = name, second = value)
+	typedef std::map<String, String> NameValuePairList;
+
+    /// Alias / Texture name pair (first = alias, second = texture name)
+    typedef std::map<String, String> AliasTextureNamePairList;
+
+        template< typename T > struct TRect
+        {
+          T left, top, right, bottom;
+          TRect() {}
+          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;
+          }
+        };
+
+        /** 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 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 top ones are not.
+         */
+        struct Box
+        {
+            size_t left, top, right, bottom, front, back;
+			/// Parameterless constructor for setting the members manually
+            Box()
+            {
+            }
+            /** 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 top ones are not.
+            */
+            Box( size_t l, size_t t, size_t r, size_t 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 top ones are not.
+            */
+            Box( size_t l, size_t t, size_t ff, size_t r, size_t b, size_t 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
+            size_t getWidth() const { return right-left; }
+            /// Get the height of this box
+            size_t getHeight() const { return bottom-top; }
+            /// Get the depth of this box
+            size_t 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 (ie 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 binnary options (ie 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);
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMaterialSerializer.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMaterialSerializer.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMaterialSerializer.h	(revision 1812)
@@ -0,0 +1,263 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __MaterialSerializer_H__
+#define __MaterialSerializer_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreMaterial.h"
+#include "OgreBlendMode.h"
+#include "OgreTextureUnitState.h"
+#include "OgreGpuProgram.h"
+#include "OgreStringVector.h"
+
+namespace Ogre {
+
+    /** 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
+		std::map<String, String> 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 isProgramShadowCaster; // 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
+    {
+    protected:
+        /// Keyword-mapped attribute parsers.
+        typedef std::map<String, ATTRIBUTE_PARSER> AttribParserList;
+
+        MaterialScriptContext mScriptContext;
+
+        /** internal method for parsing a material
+        @returns 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;
+
+        void writeMaterial(const MaterialPtr& pMat);
+        void writeTechnique(const Technique* pTech);
+        void writePass(const Pass* pPass);
+        void writeVertexProgramRef(const Pass* pPass);
+        void writeShadowCasterVertexProgramRef(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 int level = 4, const bool useMainBuffer = true);
+		void writeTextureUnit(const TextureUnitState *pTex);
+
+		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 std::multimap<TextureUnitState::TextureEffectType, TextureUnitState::TextureEffect> 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);
+    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
+		*/
+        void queueForExport(const MaterialPtr& pMat, bool clearQueued = false, 
+			bool exportDefaults = false);
+        /** 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 seperate 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.
+        */
+        void exportMaterial(const MaterialPtr& pMat, const String& filename, bool exportDefaults = false,
+            const bool includeProgDef = false, const String& programFilename = "");
+		/** 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);
+
+
+
+	private:
+		String mBuffer;
+        String mGpuProgramBuffer;
+        typedef std::set<String> GpuProgramDefinitionContainer;
+        typedef GpuProgramDefinitionContainer::iterator GpuProgramDefIterator;
+        GpuProgramDefinitionContainer mGpuProgramDefinitionContainer;
+		bool mDefaults;
+
+        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);
+		}
+
+		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;
+		}
+
+    };
+}
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCompositionPass.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCompositionPass.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCompositionPass.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __CompositionPass_H__
+#define __CompositionPass_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreMaterial.h"
+#include "OgreRenderSystem.h"
+#include "OgreRenderQueue.h"
+
+namespace Ogre {
+	/** Object representing one pass or operation in a composition sequence. This provides a 
+		method to conviently interleave RenderSystem commands between Render Queues.
+	 */
+    class _OgreExport CompositionPass
+    {
+    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
+        };
+        
+        /** 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();
+		/** 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();
+
+		/** 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();
+        /** 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();
+        /** 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();
+		/** 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();
+
+		/** 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();
+		/** 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(); 
+		/** 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();
+		/** Set stencil mask.
+			@note applies when PassType is STENCIL
+		*/
+		void setStencilMask(uint32 value);
+		/** Get stencil mask.
+			@note applies when PassType is STENCIL
+		*/
+		uint32 getStencilMask();
+		/** 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();
+		/** 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();
+		/** 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();
+		/** 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();
+
+        /** 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.
+			@note applies when PassType is RENDERQUAD 
+        */
+        void setInput(size_t id, const String &input="");
+        
+        /** 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 String &getInput(size_t id);
+        
+        /** Get the number of inputs used.
+			@note applies when PassType is RENDERQUAD 
+        */
+        size_t getNumInputs();
+        
+        /** 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);
+
+    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;
+        /// 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
+        String mInputs[OGRE_MAX_TEXTURE_LAYERS];
+		/// Stencil operation parameters
+		bool mStencilCheck;
+		CompareFunction mStencilFunc; 
+		uint32 mStencilRefValue;
+		uint32 mStencilMask;
+		StencilOperation mStencilFailOp;
+		StencilOperation mStencilDepthFailOp;
+		StencilOperation mStencilPassOp;
+		bool mStencilTwoSidedOperation;
+    };
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMesh.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMesh.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMesh.h	(revision 1812)
@@ -0,0 +1,843 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#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 "OgreProgressiveMesh.h"
+#include "OgreHardwareVertexBuffer.h"
+#include "OgreSkeleton.h"
+#include "OgreAnimationTrack.h"
+#include "OgrePose.h"
+
+
+namespace Ogre {
+
+
+    /** 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 contruct,
+            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.
+    */
+
+
+    struct MeshLodUsage;
+
+    class _OgreExport Mesh: public Resource
+    {
+        friend class SubMesh;
+        friend class MeshSerializerImpl;
+        friend class MeshSerializerImpl_v1_2;
+        friend class MeshSerializerImpl_v1_1;
+
+    public:
+		typedef std::vector<Real> LodDistanceList;
+        /// Multimap of vertex bone assignments (orders by vertex index)
+        typedef std::multimap<size_t, VertexBoneAssignment> VertexBoneAssignmentList;
+        typedef MapIterator<VertexBoneAssignmentList> BoneAssignmentIterator;
+        typedef std::vector<SubMesh*> SubMeshList;
+        typedef std::vector<unsigned short> 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 3D texture coord buffer to hold tangents. */
+        void organiseTangentsBuffer(VertexData *vertexData, unsigned short destCoordSet);
+
+    public:
+		/** A hashmap used to store optional SubMesh names.
+			Translates a name into SubMesh index
+		*/
+		typedef HashMap<String, ushort> SubMeshNameMap ;
+
+		
+    protected:
+		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);
+
+		bool mIsLodManual;
+		ushort mNumLods;
+		typedef std::vector<MeshLodUsage> MeshLodUsageList;
+		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 std::map<String, Animation*> AnimationList;
+		AnimationList mAnimationsList;
+		/// The vertex animation type associated with the shared vertex data
+		mutable VertexAnimationType mSharedVertexDataAnimationType;
+		/// Do we need to scan animations for animation types?
+		mutable bool mAnimationTypesDirty;
+
+		/// List of available poses for shared and dedicated geometryPoseList
+		PoseList mPoseList;
+
+
+        /// @copydoc Resource::loadImpl
+        void loadImpl(void);
+        /// @copydoc Resource::unloadImpl
+        void unloadImpl(void);
+		/// @copydoc Resource::calculateSize
+		size_t calculateSize(void) const;
+
+
+
+    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();
+
+		/// @copydoc Resource::load
+		void load(void);
+
+		// 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);
+		
+		/** 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 ;
+
+        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. 
+        @returns 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);
+
+
+		/** Automatically generates lower level of detail versions of this mesh for use
+			when a simpler version of the model is acceptable for rendering.
+		@remarks
+			There are 2 ways that you can create level-of-detail (LOD) versions of a mesh;
+			the first is to call this method, which does fairly extensive calculations to
+			work out how to simplify the mesh whilst having the minimum affect on the model.
+			The alternative is to actually create simpler versions of the mesh yourself in 
+			a modelling tool, and having exported them, tell the 'master' mesh to use these
+			alternative meshes for lower detail versions; this is done by calling the 
+			createManualLodLevel method.
+		@par
+			As well as creating the lower detail versions of the mesh, this method will
+			also associate them with depth values. As soon as an object is at least as far
+			away from the camera as the depth value associated with it's LOD, it will drop 
+			to that level of detail. 
+		@par
+			I recommend calling this method before mesh export, not at runtime.
+		@param lodDistances A list of depth values indicating the distances at which new lods should be
+			generated. 
+		@param reductionMethod The way to determine the number of vertices collapsed per LOD
+		@param reductionValue Meaning depends on reductionMethod, typically either the proportion
+			of remaining vertices to collapse or a fixed number of vertices.
+		*/
+		void generateLodLevels(const LodDistanceList& lodDistances, 
+			ProgressiveMesh::VertexReductionQuota reductionMethod, Real reductionValue);
+
+		/** 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 fromDepth The z 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 fromDepth, const String& meshName);
+
+		/** 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 depth value. 
+		*/
+		ushort getLodIndex(Real depth) const;
+
+		/** Retrieves the level of detail index for the given squared depth value. 
+		@remarks
+			Internally the lods are stored at squared depths to avoid having to perform
+			square roots when determining the lod. This method allows you to provide a
+			squared length depth value to avoid having to do your own square roots.
+		*/
+		ushort getLodIndexSquaredDepth(Real squaredDepth) 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 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 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.
+        @returns 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 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 sourceTexCoordSet The texture coordinate index which should be used as the source
+            of 2D texture coordinates, with which to calculate the tangents.
+        @param destTexCoordSet The texture coordinate set which should be used to store the 3D
+            coordinates representing a tangent vector per vertex. If this already exists, it
+            will be overwritten.
+        */
+        void buildTangentVectors(unsigned short sourceTexCoordSet = 0, unsigned short destTexCoordSet = 1);
+
+        /** Ask the mesh to suggest parameters to a future buildTangentVectors call. 
+        @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 outSourceCoordSet Reference to a source texture coordinate set which 
+            will be populated
+        @param outDestCoordSet Reference to a destination texture coordinate set which 
+            will be populated
+        */
+        bool suggestTangentVectorBuildParams(unsigned short& outSourceCoordSet, unsigned short& outDestCoordSet);
+
+        /** 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.
+        @lodIndex The LOD at which to get the edge list, 0 being the highest.
+        */
+        EdgeData* getEdgeList(unsigned int 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.
+        @lodIndex The LOD at which to get the edge list, 0 being the highest.
+        */
+        const EdgeData* getEdgeList(unsigned int 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; }
+
+        /** 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 pMatrices Pointer to an array of matrices to be used to blend
+        @param pIndexMap Pointer to an array of indices to translate blend indices
+            in the sourceVertexData to the index of pMatrices
+        @param blendNormals If true, normals are blended as well as positions
+        */
+        static void softwareVertexBlend(const VertexData* sourceVertexData, 
+            const VertexData* targetVertexData, const Matrix4* pMatrices, 
+            const unsigned short* pIndexMap,
+            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 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 std::map<size_t, Vector3>& vertexOffsetMap,
+			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;
+
+		/** 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);
+
+        /** 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
+		@returns 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;
+
+    };
+
+    /** Specialisation of SharedPtr to allow SharedPtr to be assigned to MeshPtr 
+    @note Has to be a subclass since we need operator=.
+    We could templatise this instead of repeating per Resource subclass, 
+    except to do so requires a form VC6 does not support i.e.
+    ResourceSubclassPtr<T> : public SharedPtr<T>
+    */
+    class _OgreExport MeshPtr : public SharedPtr<Mesh> 
+    {
+    public:
+        MeshPtr() : SharedPtr<Mesh>() {}
+        explicit MeshPtr(Mesh* rep) : SharedPtr<Mesh>(rep) {}
+        MeshPtr(const MeshPtr& r) : SharedPtr<Mesh>(r) {} 
+        MeshPtr(const ResourcePtr& r);
+        /// Operator used to convert a ResourcePtr to a MeshPtr
+        MeshPtr& operator=(const ResourcePtr& r);
+    protected:
+        /// Override destroy since we need to delete Mesh after fully defined
+        void destroy(void);
+    };
+
+	/** A way of recording the way each LODs is recorded this Mesh. */
+	struct MeshLodUsage
+	{
+		/// squared Z value from which this LOD will apply
+		Real fromDepthSquared;
+		/// Only relevant if mIsLodManual is true, the name of the alternative mesh to use
+		String manualName;
+		/// 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;
+	};
+
+
+
+} // namespace
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreAxisAlignedBox.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreAxisAlignedBox.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreAxisAlignedBox.h	(revision 1812)
@@ -0,0 +1,437 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __AxisAlignedBox_H_
+#define __AxisAlignedBox_H_
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+
+#include "OgreVector3.h"
+#include "OgreMatrix4.h"
+
+namespace Ogre {
+
+    /** 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
+    {
+    protected:
+	    Vector3 mMinimum;
+	    Vector3 mMaximum;
+	    bool mNull;
+
+	    Vector3 mCorners[8];
+
+	    /** Internal method for updating corner points.
+	    */
+	    void updateCorners(void)
+	    {
+		    // 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)
+		    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;            
+	    }        
+
+    public:
+	    inline AxisAlignedBox()
+	    {
+		    // Default to null box
+		    setMinimum( -0.5, -0.5, -0.5 );
+		    setMaximum( 0.5, 0.5, 0.5 );
+		    mNull = true;
+	    }
+
+	    inline AxisAlignedBox( const Vector3& min, const Vector3& max )
+	    {
+		    setExtents( min, max );
+	    }
+
+	    inline AxisAlignedBox(
+		    Real mx, Real my, Real mz,
+		    Real Mx, Real My, Real Mz )
+	    {
+		    setExtents( mx, my, mz, Mx, My, Mz );
+	    }
+
+	    /** Gets the minimum corner of the box.
+	    */
+	    inline const Vector3& getMinimum(void) const
+	    { 
+		    return mMinimum; 
+	    }
+
+	    /** Gets the maximum corner of the box.
+	    */
+	    inline const Vector3& getMaximum(void) const
+	    { 
+		    return mMaximum;
+	    }
+
+	    /** Sets the minimum corner of the box.
+	    */
+	    inline void setMinimum( const Vector3& vec )
+	    {
+		    mNull = false;
+		    mMinimum = vec;
+		    updateCorners();
+	    }
+
+	    inline void setMinimum( Real x, Real y, Real z )
+	    {
+		    mNull = false;
+		    mMinimum.x = x;
+		    mMinimum.y = y;
+		    mMinimum.z = z;
+		    updateCorners();
+	    }
+
+	    /** Sets the maximum corner of the box.
+	    */
+	    inline void setMaximum( const Vector3& vec )
+	    {
+		    mNull = false;
+		    mMaximum = vec;
+		    updateCorners();
+	    }
+
+	    inline void setMaximum( Real x, Real y, Real z )
+	    {
+		    mNull = false;
+		    mMaximum.x = x;
+		    mMaximum.y = y;
+		    mMaximum.z = z;
+		    updateCorners();
+	    }
+
+	    /** Sets both minimum and maximum extents at once.
+	    */
+	    inline void setExtents( const Vector3& min, const Vector3& max )
+	    {
+		    mNull = false;
+		    mMinimum = min;
+		    mMaximum = max;
+		    updateCorners();
+	    }
+
+	    inline void setExtents(
+		    Real mx, Real my, Real mz,
+		    Real Mx, Real My, Real Mz )
+	    {
+		    mNull = false;
+
+		    mMinimum.x = mx;
+		    mMinimum.y = my;
+		    mMinimum.z = mz;
+
+		    mMaximum.x = Mx;
+		    mMaximum.y = My;
+		    mMaximum.z = Mz;
+
+		    updateCorners();
+	    }
+
+	    /** 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( !mNull && "Can't get corners of a null AAB" );
+		    return (const Vector3*)mCorners;
+	    }
+
+	    friend std::ostream& operator<<( std::ostream& o, AxisAlignedBox aab )
+	    {
+		    if (aab.isNull())
+		    {
+			    o << "AxisAlignedBox(null)";
+		    }
+		    else
+		    {
+			    o << "AxisAlignedBox(min=" << aab.mMinimum << ", max=" << aab.mMaximum;
+			    o << ", corners=";
+			    for (int i = 0; i < 7; ++i)
+				    o << aab.mCorners[i] << ", ";
+			    o << aab.mCorners[7] << ")";
+		    }
+		    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
+		    if (rhs.mNull)
+		    {
+			    return;
+		    }
+		    // Otherwise if current null, just take rhs
+		    else if (mNull)
+		    {
+			    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).
+		*/
+		void merge( const Vector3& point )
+		{
+			if (mNull){ // if null, use this point
+				setExtents(point, point);
+			} else {
+				mMaximum.makeCeil(point);
+				mMinimum.makeFloor(point);
+				updateCorners();
+			}
+		}
+
+	    /** 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.
+	    */
+	    void transform( const Matrix4& matrix )
+	    {
+		    // Do nothing if current null
+		    if( mNull )
+			    return;
+
+		    Vector3 min, max, temp;
+		    bool first = true;
+		    size_t i;
+
+		    for( i = 0; i < 8; ++i )
+		    {
+			    // Transform and check extents
+			    temp = matrix * mCorners[i];
+			    if( first || temp.x > max.x )
+				    max.x = temp.x;
+			    if( first || temp.y > max.y )
+				    max.y = temp.y;
+			    if( first || temp.z > max.z )
+				    max.z = temp.z;
+			    if( first || temp.x < min.x )
+				    min.x = temp.x;
+			    if( first || temp.y < min.y )
+				    min.y = temp.y;
+			    if( first || temp.z < min.z )
+				    min.z = temp.z;
+
+			    first = false;
+		    }
+
+		    setExtents( min,max );
+
+	    }
+
+	    /** Sets the box to a 'null' value i.e. not a box.
+	    */
+	    inline void setNull()
+	    {
+		    mNull = true;
+	    }
+
+	    /** Returns true if the box is null i.e. empty.
+	    */
+	    bool isNull(void) const
+	    {
+		    return mNull;
+	    }
+
+        /** 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;
+
+            // 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->intersects(b2))
+			{
+				return AxisAlignedBox();
+			}
+			Vector3 intMin, intMax;
+
+			const Vector3& b2max = b2.getMaximum();
+			const Vector3& b2min = b2.getMinimum();
+
+			if (b2max.x > mMaximum.x && mMaximum.x > b2min.x)
+				intMax.x = mMaximum.x;
+			else 
+				intMax.x = b2max.x;
+			if (b2max.y > mMaximum.y && mMaximum.y > b2min.y)
+				intMax.y = mMaximum.y;
+			else 
+				intMax.y = b2max.y;
+			if (b2max.z > mMaximum.z && mMaximum.z > b2min.z)
+				intMax.z = mMaximum.z;
+			else 
+				intMax.z = b2max.z;
+
+			if (b2min.x < mMinimum.x && mMinimum.x < b2max.x)
+				intMin.x = mMinimum.x;
+			else
+				intMin.x= b2min.x;
+			if (b2min.y < mMinimum.y && mMinimum.y < b2max.y)
+				intMin.y = mMinimum.y;
+			else
+				intMin.y= b2min.y;
+			if (b2min.z < mMinimum.z && mMinimum.z < b2max.z)
+				intMin.z = mMinimum.z;
+			else
+				intMin.z= b2min.z;
+
+			return AxisAlignedBox(intMin, intMax);
+
+		}
+
+		/// Calculate the volume of this box
+		Real volume(void) const
+		{
+			if (mNull)
+			{
+				return 0.0f;
+			}
+			else
+			{
+				Vector3 diff = mMaximum - mMinimum;
+				return diff.x * diff.y * diff.z;
+			}
+
+		}
+
+        /** Scales the AABB by the vector given. */
+        inline void scale(const Vector3& s)
+        {
+            // 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
+        {
+			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);
+        }
+		/// Gets the centre of the box
+		Vector3 getCenter(void) const
+		{
+			return Vector3((mMaximum + mMinimum) * 0.5);
+		}
+
+
+    };
+
+} // namespace Ogre
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreParticle.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreParticle.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreParticle.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under 
+the terms of the GNU Lesser General Public License as published by the Free Software 
+Foundation; either version 2 of the License, or (at your option) any later 
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT 
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with 
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple 
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to 
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __Particle_H__
+#define __Particle_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreBillboard.h"
+
+namespace Ogre {
+
+	/** 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 renderered 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:
+		ParticleVisualData() {}
+		virtual ~ParticleVisualData() {}
+
+	};
+
+	/** Class representing a single particle instance. */
+    class _OgreExport Particle 
+    {
+    protected:
+        /// Parent ParticleSystem
+        ParticleSystem* mParentSystem;
+		/// Additional visual data you might want to associate with the Particle
+		ParticleVisualData* mVisual;
+    public:
+        /// 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;
+
+
+        Particle()
+            : mParentSystem(0), mVisual(0), mOwnDimensions(false), rotation(0), 
+            position(Vector3::ZERO), direction(Vector3::ZERO), 
+            colour(ColourValue::White), timeToLive(10), totalTimeToLive(10), 
+            rotationSpeed(0)
+        {
+        }
+
+        /** 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);
+
+       
+    };
+}
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMemoryManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMemoryManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMemoryManager.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+//---- ORIGINAL COPYRIGHT FOLLOWS -------------------------------------------
+// ---------------------------------------------------------------------------------------------------------------------------------
+// Copyright 2000, Paul Nettle. All rights reserved.
+//
+// You are free to use this source code in any commercial or non-commercial product.
+//
+// mmgr.cpp - Memory manager & tracking software
+//
+// The most recent version of this software can be found at: ftp://ftp.GraphicsPapers.com/pub/ProgrammingTools/MemoryManagers/
+//
+// [NOTE: Best when viewed with 8-character tabs]
+//
+// ---------------------------------------------------------------------------------------------------------------------------------
+#ifndef __MemoryManager_H__
+#define __MemoryManager_H__
+
+#include "OgrePlatform.h"
+#include "OgreStdHeaders.h"
+
+namespace Ogre {
+
+    /** @page memory_manager The memory manager information page
+	
+		@subsection desc Description
+			The memory manager is a class that handles memory (de)allocation requests.
+        @par
+            This class works like a wrapper between the actual C memory allocation 
+            functions (*alloc, free) and the memory (de)allocation requests of the
+            application.
+        @par
+            Why would such a class be needed? First of all, because we had some 
+            major issues with memory getting misued (read: deleted) over DLL 
+            boundaries. One thing this memory manager does is solve the problem by
+            allocating all the memory in the OgreMain.dll/so process.
+        @par
+            Another use would be leak detection and memory misuse detection. With
+            a custom memory manager, calls to new/delete and *alloc/free could be
+            overseed and logged.
+        @par
+            Yet another use is the optimization of memory allocation for certain
+            object types. One of the most common examples is a small object 
+            allocator.
+		@subsection types Manager types
+			There actually are two classes, one is the standard memory manager
+			which only addresses memory allocation problems when deallocating
+			across processes. 
+		@par
+			The other is a modified version of the debugging memory manager written 
+			by Paul 'MidNight' Nettle (aka. the Fluid Studios Memory Manager). 
+			Obviously, the second one should be used only when debugging your 
+			application as it adds some visible overhead.
+		@par
+			You can switch between the two memory managers by setting the value of
+			the OGRE_DEBUG_MEMORY_MANAGER macro in OgreConfig.h
+        @subsection notes Implementation Note
+            The class contains a static member of type MemoryManager. That is 
+            because we want the memory manager to be created even before we 
+            override the new([])/delete([]) operators.
+		@subsection see See also
+			<a href="http://www.flipcode.com/cgi-bin/msg.cgi?showThread=12September2000-PresentingAMemoryManager&forum=askmid&id=-1">Paul Nettle's Memory Manager page at flipCode</a> - you can get the original source form here.
+    */
+
+#if OGRE_DEBUG_MEMORY_MANAGER && OGRE_DEBUG_MODE
+
+#ifndef __FUNCTION__
+#define __FUNCTION__ "???"
+#endif
+
+}
+
+//-----------------------------------------------------------------------------
+// We have to declare the global new([])/delete([]) operators before declaring 
+// the Ogre::MemoryManager class since it lists them as friend functions
+void *operator new(size_t reportedSize);
+void *operator new[](size_t reportedSize);
+void operator delete(void *reportedAddress);
+void operator delete[](void *reportedAddress);
+//-----------------------------------------------------------------------------
+
+namespace Ogre {
+
+    /** For internal use only.
+        \internal.
+        @remarks
+            This structure holds the allocation tracking information. So,
+            for each allocation made, the overhead this memory manager adds
+            is the size of this structure, the lengths of the names of the
+            file and function in which the allocation was made and the
+            padding size (which can be adjusted).
+    */
+    typedef struct tag_au
+    {
+        size_t actualSize;
+        size_t reportedSize;
+
+        void *actualAddress;
+        void *reportedAddress;
+
+        char sourceFile[40];
+        char sourceFunc[40];
+
+        unsigned int sourceLine;
+        unsigned int allocationType;
+
+        bool breakOnDealloc;
+        bool breakOnRealloc;
+
+        unsigned int allocationNumber;
+        unsigned int processID;
+
+        struct tag_au *next;
+        struct tag_au *prev;
+    } sAllocUnit;
+
+    typedef struct
+    {
+        size_t totalReportedMemory;
+        size_t totalActualMemory;
+
+        size_t peakReportedMemory;
+        size_t peakActualMemory;
+
+        size_t accumulatedReportedMemory;
+        size_t accumulatedActualMemory;
+        size_t accumulatedAllocUnitCount;
+
+        size_t totalAllocUnitCount;
+        size_t peakAllocUnitCount;
+    } sMStats;
+    
+    enum
+    {
+        m_alloc_unknown        = 0,
+        m_alloc_new            = 1,
+        m_alloc_new_array      = 2,
+        m_alloc_malloc         = 3,
+        m_alloc_calloc         = 4,
+        m_alloc_realloc        = 5,
+        m_alloc_delete         = 6,
+        m_alloc_delete_array   = 7,
+        m_alloc_free           = 8
+    };
+
+	/** See the \ref memory_manager.
+	*/
+    class _OgreExport MemoryManager
+    {
+        friend void * ::operator new(size_t);
+        friend void * ::operator new[](size_t);
+        friend void ::operator delete(void*);
+        friend void ::operator delete[](void*);
+
+    public:
+        static MemoryManager& instance(void);
+
+    private:
+        /// This is used in the process tracking part of the memory manager.
+        unsigned m_uProcessIDs;
+        /// This is set to true when deinitialization takes place.
+        bool m_bDeinitTime;
+
+#ifndef __BORLANDC__
+    private:
+#else
+    public:
+#endif
+        //-------------------------------------------------------------------------
+        // Wrappers for the new/delete functions        
+        void *op_new_sc( size_t reportedSize, unsigned processID );
+        void *op_new_vc( size_t reportedSize, unsigned processID );
+
+        void *op_new_sc( size_t reportedSize, const char *sourceFile, int sourceLine, unsigned processID );
+        void *op_new_vc( size_t reportedSize, const char *sourceFile, int sourceLine, unsigned processID );
+
+        void op_del_sc( void *reportedAddress, unsigned processID );
+        void op_del_vc( void *reportedAddress, unsigned processID );
+        //-------------------------------------------------------------------------
+
+        /** This function is intended for internal use only.
+            \internal
+            @remarks
+                This function is used to return an unique handle for each process 
+                calling it. The returned unsigned int is then passed to the memory
+                manager every time a re/de/allocation request is made, in order
+                to check that deallocations don't occur in processes other than the 
+                ones in which allcations were made and so on.
+            @par
+                Actually, the problem of re/de/allocating in other processes was
+                solved with the addition of the new memory manager, but you may
+                want to limit the occurence of such events anyway, and this function
+                helps you do just that.
+        */
+        unsigned _getProcessID();
+
+    public:
+        MemoryManager();
+        ~MemoryManager();
+
+        //-------------------------------------------------------------------------
+        // Used by the macros     
+        void setOwner(const char *file, const unsigned int line, const char *func);
+        //-------------------------------------------------------------------------
+
+        //-------------------------------------------------------------------------
+        // Allocation breakpoints        
+        bool &breakOnRealloc(void *reportedAddress);
+        bool &breakOnDealloc( void *reportedAddress );
+        void breakOnAlloc( unsigned int count );
+        //-------------------------------------------------------------------------
+
+        //-------------------------------------------------------------------------
+        // The meat & potatoes of the memory tracking software
+
+        /** This function is intended for internal use only.
+            \internal
+            @remarks
+                This function is the actual memory allocator and acts as a bridge
+                between OGRE and the C/C++ alloc/calloc functions. 
+            @par
+                While memory allocation requests are made trough this function, 
+                the tracking of memory addresses is possible. Therefore, attempting 
+                to deallocate a portion of memory that was not allocated using 
+                this function will result in a warning given by the deallocator, 
+                dllocMem.
+        */
+        void * allocMem(
+            const char *sourceFile, 
+            const unsigned int sourceLine, 
+            const char *sourceFunc,
+            const unsigned int allocationType, 
+            const size_t reportedSize, 
+            const unsigned processID );
+
+        /** This function is intended for internal use only.
+            \internal
+            @remarks
+                This function is the actual memory reallocator and acts as a bridge
+                between OGRE and the C/C++ realloc function. 
+            @par
+                While memory reallocation requests are made trough this function, 
+                the tracking of memory addresses is possible. Therefore, attempting 
+                to deallocate a portion of memory that was not reallocated using 
+                this function will result in a warning given by the deallocator, 
+                dllocMem. 
+            @par
+                As well, trying to reallocate memory that was not allocated using
+                mallc/calloc will result in a warning.
+        */
+        void * rllocMem(
+            const char *sourceFile, 
+            const unsigned int sourceLine, 
+            const char *sourceFunc,
+            const unsigned int reallocationType, 
+            const size_t reportedSize, 
+            void *reportedAddress, 
+            const unsigned processID );
+
+        /** This function is intended for internal use only.
+            \internal
+            @remarks
+                This function is the actual memory deallocator and acts as a
+                bridge between OGRE and the C/C++ free function.
+            @par
+                While memory deallocation requests are made trough this function, 
+                the tracking of memory addresses is possible. Therefore, attempting 
+                to deallocate a portion of memory that was not allocated using 
+                allocMem or rllocMem, trying to deallocate memory that was
+                allocated with malloc using delete (and the corresponding 
+                permutations) or trying to deallocate memory allocated from from
+                process will result in a warning.
+            @note
+                Actually, memory can be allocated in one process and deallocated
+                in another, since the actual (de)allocation takes place in the
+                memory space of the OgreMain library. 
+            @par
+                Tracking this kind of (possible) errors exists because users may 
+                want to write their own memory allocator later on or they'd like 
+                to get rid of OGRE's memory allocator.
+        */
+        void dllocMem(
+            const char *sourceFile, 
+            const unsigned int sourceLine, 
+            const char *sourceFunc,
+            const unsigned int deallocationType, 
+            const void *reportedAddress, 
+            const unsigned processID );
+        //-------------------------------------------------------------------------
+
+        //-------------------------------------------------------------------------
+        // Utilitarian functions        
+        bool validateAddr(const void *reportedAddress);
+        bool validateAlloc(const sAllocUnit *allocUnit);
+        bool validateAllAllocs();
+        //-------------------------------------------------------------------------
+
+        //-------------------------------------------------------------------------
+        // Unused RAM calculations        
+        unsigned int calcUnused( const sAllocUnit *allocUnit );
+        unsigned int calcAllUnused();
+        //-------------------------------------------------------------------------
+
+        //-------------------------------------------------------------------------
+        // Logging and reporting        
+        void dumpAllocUnit( const sAllocUnit *allocUnit, const char *prefix = "" );
+        void dumpMemReport( const char *filename = "memreport.log", const bool overwrite = true );
+        sMStats getMemStats();            
+        //-------------------------------------------------------------------------        
+    };
+}
+
+/** This variable exists separately in each module that links to the OGRE library
+    and is used to track the ID of the current process from the perspective
+    of the memory manager.
+    @see
+        unsigned Ogre::MemoryManager::_getProcessID()
+*/
+static unsigned gProcessID = 0;
+
+// When compiling in Visual C++ (occuring in VS2005 Express but not for VC 7.1) with
+// managed C++, should put the new([])/delete([]) overrides inside unmanaged context,
+// otherwise Visual C++ will link with overridden version of new([]) and CRT version
+// of delete([]), thus, mess up both of OGRE memory manager and CRT memory manager.
+#if defined(__cplusplus_cli)
+#pragma managed(push, off)
+#endif
+//-----------------------------------------------------------------------------
+// Overridden global new([])/delete([]) functions
+//
+inline void *operator new(size_t reportedSize)
+{
+    if( !gProcessID )
+        gProcessID = Ogre::MemoryManager::instance()._getProcessID();
+    return Ogre::MemoryManager::instance().op_new_sc( reportedSize, gProcessID );
+}
+inline void *operator new[](size_t reportedSize)
+{
+    if( !gProcessID )
+        gProcessID = Ogre::MemoryManager::instance()._getProcessID();
+    return Ogre::MemoryManager::instance().op_new_vc( reportedSize, gProcessID );
+}
+
+inline void operator delete(void *reportedAddress)
+{
+    Ogre::MemoryManager::instance().op_del_sc( reportedAddress, gProcessID );    
+}
+inline void operator delete[](void *reportedAddress)
+{
+    Ogre::MemoryManager::instance().op_del_vc( reportedAddress, gProcessID );
+}
+//-----------------------------------------------------------------------------
+#if defined(__cplusplus_cli)
+#pragma managed(pop)
+#endif
+
+//-----------------------------------------------------------------------------
+// This header adds the *alloc/free macros, wrapping the C functions
+#include "OgreMemoryMacros.h"
+//-----------------------------------------------------------------------------
+
+#else
+
+	/** See the \ref memory_manager.
+	*/
+    class _OgreExport MemoryManager
+    {
+    public:
+        static MemoryManager& instance(void);
+
+        MemoryManager();
+        ~MemoryManager();
+
+        /** Memory allocator - uses plain old malloc.
+        */
+        void *allocMem( const char *szFile, size_t uLine, size_t count ) throw ( );
+
+        /** Memory re-allocator - uses plain old realloc.
+        */
+        void *rllocMem( const char *szFile, size_t uLine, void *ptr , size_t count ) throw ( );
+
+        /** Memory allocator - uses plain old calloc.
+        */
+        void *cllocMem( const char *szFile, size_t uLine, size_t num, size_t size ) throw ( );
+
+        /** Memory de-allocator - uses plain old free.
+        */
+        void dllocMem( const char *szFile, size_t uLine, void *ptr ) throw ( );
+    };
+
+}
+
+#endif
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePrerequisites.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePrerequisites.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePrerequisites.h	(revision 1812)
@@ -0,0 +1,385 @@
+/*-------------------------------------------------------------------------
+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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License (LGPL) as
+published by the Free Software Foundation; either version 2.1 of the
+License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful, but
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License
+along with this library; if not, write to the Free Software Foundation,
+Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA or go to
+http://www.gnu.org/copyleft/lesser.txt
+-------------------------------------------------------------------------*/
+#ifndef __Prerequisites_H__
+#define __Prerequisites_H__
+
+// undefine this to not require new angular units where applicable
+#define OGRE_FORCE_ANGLE_TYPES
+
+// Platform-specific stuff
+#include "OgrePlatform.h"
+
+#if OGRE_COMPILER == OGRE_COMPILER_MSVC
+// 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: "conversion from 'double' to 'float', possible loss of data
+#   pragma warning (disable : 4244)
+
+// disable: "truncation from 'double' to 'float'
+#   pragma warning (disable : 4305)
+
+// 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)
+#endif
+
+/* Include all the standard header *after* all the configuration
+   settings have been made.
+*/
+#include "OgreStdHeaders.h"
+
+
+#include "OgreMemoryManager.h"
+
+namespace Ogre {
+    // Define ogre version
+    #define OGRE_VERSION_MAJOR 1
+    #define OGRE_VERSION_MINOR 2
+    #define OGRE_VERSION_PATCH 4
+    #define OGRE_VERSION_NAME "Dagon"
+
+    #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
+
+    // define the Char type as either char or wchar_t
+    #if OGRE_WCHAR_T_STRINGS == 1
+    #   define OgreChar wchar_t
+    #	define _TO_CHAR( x ) L##x
+    #else
+    #   define OgreChar char
+    #	define _TO_CHAR( x ) x
+    #endif
+
+    #if OGRE_COMPILER == OGRE_COMPILER_GNUC && OGRE_COMP_VER >= 310 && !defined(STLPORT)
+    #   define HashMap ::__gnu_cxx::hash_map
+    #else
+    #   if OGRE_COMPILER == OGRE_COMPILER_MSVC
+    #       if OGRE_COMP_VER > 1300 && !defined(_STLP_MSVC)
+    #           define HashMap ::stdext::hash_map
+    #       else
+    #           define HashMap ::std::hash_map
+    #       endif
+    #   else
+    #       define HashMap ::std::hash_map
+    #   endif
+    #endif
+
+    /** In order to avoid finger-aches :)
+    */
+    typedef unsigned char uchar;
+    typedef unsigned short ushort;
+    typedef unsigned int uint;
+	typedef unsigned long ulong;
+
+    /// Useful macros
+    #define OGRE_DELETE(p)       { if(p) { delete (p);     (p)=NULL; } }
+    #define OGRE_DELETE_ARRAY(p) { if(p) { delete[] (p);   (p)=NULL; } }
+
+	#if OGRE_WCHAR_T_STRINGS
+		typedef std::wstring _StringBase;
+	#else
+		typedef std::string _StringBase;
+	#endif
+
+	typedef _StringBase String;
+
+	// Useful threading defines
+	#define OGRE_AUTO_MUTEX_NAME mutex
+	#if OGRE_THREAD_SUPPORT
+		#define OGRE_AUTO_MUTEX mutable boost::recursive_mutex OGRE_AUTO_MUTEX_NAME;
+		#define OGRE_LOCK_AUTO_MUTEX boost::recursive_mutex::scoped_lock ogreAutoMutexLock(OGRE_AUTO_MUTEX_NAME);
+		#define OGRE_MUTEX(name) mutable boost::recursive_mutex name;
+		#define OGRE_LOCK_MUTEX(name) boost::recursive_mutex::scoped_lock ogrenameLock(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 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)
+
+	#else
+		#define OGRE_AUTO_MUTEX
+		#define OGRE_LOCK_AUTO_MUTEX
+		#define OGRE_MUTEX(name)
+		#define OGRE_LOCK_MUTEX(name)
+		#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)
+	#endif
+
+
+// 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 Cursor;
+	class Degree;
+    class DynLib;
+    class DynLibManager;
+    class EdgeData;
+    class EdgeListBuilder;
+    class Entity;
+    class ErrorDialog;
+	class EventDispatcher;
+	class EventProcessor;
+	class EventQueue;
+	class EventTarget;
+    class ExternalTextureSourceManager;
+    class Factory;
+    class Font;
+    class FontPtr;
+    class FontManager;
+    struct FrameEvent;
+    class FrameListener;
+    class Frustum;
+    class GpuProgram;
+    class GpuProgramPtr;
+    class GpuProgramManager;
+	class GpuProgramUsage;
+    class HardwareIndexBuffer;
+    class HardwareOcclusionQuery;
+    class HardwareVertexBuffer;
+	class HardwarePixelBuffer;
+    class HardwarePixelBufferSharedPtr;
+	class HighLevelGpuProgram;
+    class HighLevelGpuProgramPtr;
+	class HighLevelGpuProgramManager;
+	class HighLevelGpuProgramFactory;
+    class IndexData;
+	class InputEvent;
+    class InputReader;
+    class IntersectionSceneQuery;
+    class IntersectionSceneQueryListener;
+    class Image;
+	class KeyEvent;
+    class KeyFrame;
+	class KeyListener;
+	class KeyTarget;
+    class Light;
+    class Log;
+    class LogManager;
+	class ManualResourceLoader;
+	class ManualObject;
+    class Material;
+    class MaterialPtr;
+    class MaterialManager;
+    class Math;
+    class Matrix3;
+    class Matrix4;
+    class MemoryManager;
+    class Mesh;
+    class MeshPtr;
+    class MeshSerializer;
+    class MeshSerializerImpl;
+    class MeshManager;
+    class MovableObject;
+    class MovablePlane;
+	class MouseEvent;
+	class MouseListener;
+	class MouseMotionListener;
+	class MouseTarget;
+    class Node;
+	class NodeAnimationTrack;
+	class NodeKeyFrame;
+	class NumericAnimationTrack;
+	class NumericKeyFrame;
+    class Overlay;
+    class OverlayContainer;
+    class OverlayElement;
+    class OverlayElementFactory;
+    class OverlayManager;
+    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 PlatformManager;
+    class Plane;
+    class PlaneBoundedVolume;
+	class Pose;
+	class PositionTarget;
+    class ProgressiveMesh;
+    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 RenderSystem;
+    class RenderSystemCapabilities;
+    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 ScriptLoader;
+    class Serializer;
+    class ShadowCaster;
+    class ShadowRenderable;
+    class SimpleRenderable;
+    class SimpleSpline;
+    class Skeleton;
+    class SkeletonPtr;
+    class SkeletonInstance;
+    class SkeletonManager;
+    class Sphere;
+    class SphereSceneQuery;
+	class StaticGeometry;
+    class StringConverter;
+    class StringInterface;
+    class SubEntity;
+    class SubMesh;
+	class TagPoint;
+	class TargetManager;
+    class Technique;
+	class TempBlendedBufferInfo;
+	class ExternalTextureSource;
+    class TextureUnitState;
+    class Texture;
+    class TexturePtr;
+	class TextureFont;
+    class TextureManager;
+    class TransformKeyFrame;
+	class Timer;
+    class UserDefinedObject;
+    class Vector2;
+    class Vector3;
+    class Vector4;
+    class Viewport;
+	class VertexAnimationTrack;
+    class VertexBufferBinding;
+    class VertexData;
+    class VertexDeclaration;
+	class VertexMorphKeyFrame;
+    class WireBoundingBox;
+    class Compositor;
+    class CompositorManager;
+    class CompositorChain;
+    class CompositorInstance;
+    class CompositionTechnique;
+    class CompositionPass;
+    class CompositionTargetPass;
+}
+
+#endif // __OgrePrerequisites_H__
+
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMeshFileFormat.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMeshFileFormat.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMeshFileFormat.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __MeshFileFormat_H__
+#define __MeshFileFormat_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+/** 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
+                // 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 = 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
+                        // 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 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
+					M_POSE_VERTEX = 0xC111,
+						// unsigned long vertexIndex
+						// float xoffset, yoffset, zoffset
+			// Optional vertex animation chunk
+			M_ANIMATIONS = 0xD000, 
+				M_ANIMATION = 0xD100,
+				// char* name
+				// float length
+				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
+						// 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
+
+		
+	
+	/* Version 1.2 of the .mesh fornmat (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: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreILImageCodec.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreILImageCodec.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreILImageCodec.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _ILImageCodec_H__
+#define _ILImageCodec_H__
+
+#include "OgreImageCodec.h"
+
+namespace Ogre {
+
+    /** Codec specialized in images loaded using DevIL.
+        @remarks
+            The users implementing subclasses of ImageCodec are required to return
+            a valid pointer to a ImageData class from the decode(...) function.
+    */
+    class _OgreExport ILImageCodec : public ImageCodec
+    {
+    private:
+		static bool _is_initialised;
+        String mType;
+        unsigned int mIlType;
+
+    public:
+        ILImageCodec(const String &type, unsigned int ilType);
+        virtual ~ILImageCodec() { }
+
+        /// @copydoc Codec::code
+        DataStreamPtr code(MemoryDataStreamPtr& input, CodecDataPtr& pData) const;
+        /// @copydoc Codec::codeToFile
+        void codeToFile(MemoryDataStreamPtr& input, const String& outFileName, CodecDataPtr& pData) const;
+        /// @copydoc Codec::decode
+        DecodeResult decode(DataStreamPtr& input) const;
+
+        /// Initialise DevIL
+        void initialiseIL(void);
+        
+        virtual String getType() const;        
+    };
+
+} // namespace
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreFrustum.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreFrustum.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreFrustum.h	(revision 1812)
@@ -0,0 +1,585 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __Frustum_H__
+#define __Frustum_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreMovableObject.h"
+#include "OgreRenderable.h"
+#include "OgreAxisAlignedBox.h"
+#include "OgreVertexIndexData.h"
+#include "OgreMovablePlane.h"
+
+namespace Ogre
+{
+    /** 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;
+        /// 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 frustrum 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;
+
+		
+        // 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;
+
+		
+		/** 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;
+
+
+    public:
+
+        Frustum();
+        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);
+#ifndef OGRE_FORCE_ANGLE_TYPES
+        inline void setFOVy(Real fovy) {
+            setFOVy ( Angle(fovy) );
+        }
+#endif//OGRE_FORCE_ANGLE_TYPES
+
+        /** 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
+                near 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 frustrum 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
+                far 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);
+
+        /** Retreives 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);
+
+        /** Retreives 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;
+
+        /** 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 getRenderSystemProjectionMatrix
+            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;
+
+		/** 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 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
+		@see Frustum::setCustomProjectionMatrix
+		*/
+		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 true, the custom projection 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 
+			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.
+        @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.
+            @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
+            @param
+                culledBy Optional pointer to an int which will be filled by the plane number which culled
+                the box if the result was false;
+            @returns
+                If the box was visible, true is returned.
+            @par
+                Otherwise, 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
+            @param
+                culledBy Optional pointer to an int which will be filled by the plane number which culled
+                the box if the result was false;
+            @returns
+                If the sphere was visible, true is returned.
+            @par
+                Otherwise, 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
+            @param
+                culledBy Optional pointer to an int which will be filled by the plane number which culled
+                the box if the result was false;
+            @returns
+                If the box was visible, true is returned.
+            @par
+                Otherwise, false is returned.
+        */
+        virtual bool isVisible(const Vector3& vert, FrustumPlane* culledBy = 0) 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 */
+        const Quaternion& getWorldOrientation(void) const;
+
+        /** Overridden from Renderable */
+        const Vector3& getWorldPosition(void) 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;
+
+        /** 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 radius Radius of the sphere
+        @param left, top, right, bottom Pointers to destination values, these
+            will be completed with the normalised device coordinates (in the 
+            range {-1,1})
+        @returns true if the sphere was projected to a subset of the near plane,
+            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; }
+		
+
+        /// Small constant used to reduce far plane projection to avoid inaccuracies
+        static const Real INFINITE_FAR_PLANE_ADJUST;
+    };
+
+
+}
+
+#endif 
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreConfig.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreConfig.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreConfig.h	(revision 1812)
@@ -0,0 +1,119 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __Config_H_
+#define __Config_H_
+
+// configure options
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+/** 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 */
+#define OGRE_PROFILING 0
+
+/** If set to 1, stack unwinding code is compiled into the library and called
+    in case an exception is thrown in order to show the call stack.
+*/
+#define OGRE_STACK_UNWINDING 0
+
+/** 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
+*/
+#define OGRE_ASSERT_MODE 0
+
+/** 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
+
+/** If set to 1, the strings are transforned to Unicode, and char is replaced
+    with wchar_t when having to do with strings of any kind.
+*/
+#define OGRE_WCHAR_T_STRINGS 0
+
+/** Define number of texture coordinate sets allowed per vertex.
+*/
+#define OGRE_MAX_TEXTURE_COORD_SETS 6
+
+/** 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
+
+/** Set this to zero if you want to link OGRE as a static lib.
+*/
+#define OGRE_DYNAMIC_LINKAGE 1
+
+
+/** Set this to 0 if you want to use the standard memory manager in Debug builds
+    Release builds always use the standard memory manager
+*/
+#ifndef OGRE_DEBUG_MEMORY_MANAGER
+#define OGRE_DEBUG_MEMORY_MANAGER 1
+#endif
+/** Define max number of multiple render targets (MRTs) to render to at once.
+*/
+#define OGRE_MAX_MULTIPLE_RENDER_TARGETS 8
+
+/** Indicate general support for multithreading.
+	This will enable threading support in certain parts of the
+	engine, mainly resource loading and SharedPtr handling.
+	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.
+    WARNING: highly experimental, use with caution
+*/
+#ifndef OGRE_THREAD_SUPPORT
+#define OGRE_THREAD_SUPPORT 0
+#endif
+
+/** Disables use of the DevIL image library for loading images.
+    WARNING: Use only when you want to provide your own image loading code via codecs.
+*/
+#ifndef OGRE_NO_DEVIL
+#define OGRE_NO_DEVIL 0
+#endif
+
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreConfigFile.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreConfigFile.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreConfigFile.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __ConfigFile_H__
+#define __ConfigFile_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreString.h"
+#include "OgreStringVector.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreDataStream.h"
+
+namespace Ogre {
+
+    /** 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:
+
+        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 filename (using resource group locations)
+        void load(const String& filename, const String& resourceGroup, 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)
+        */
+        String getSetting(const String& key, const String& section = 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 std::multimap<String, String> SettingsMultiMap;
+        typedef MapIterator<SettingsMultiMap> SettingsIterator;
+        /** Gets an iterator for stepping through all the keys / values in the file. */
+        typedef std::map<String, SettingsMultiMap*> 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;
+    };
+
+}
+
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreWireBoundingBox.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreWireBoundingBox.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreWireBoundingBox.h	(revision 1812)
@@ -0,0 +1,77 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _WireBoundingBox_H__
+#define _WireBoundingBox_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreSimpleRenderable.h"
+
+namespace Ogre {
+
+    /** 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;
+        /** @copydoc Renderable::getWorldOrientation */
+        const Quaternion& getWorldOrientation(void) const;
+        /** @copydoc Renderable::getWorldPosition */
+        const Vector3& getWorldPosition(void) const;
+		
+        /** Builds the wireframe line list.
+        */
+		void setupBoundingBoxVertices(const AxisAlignedBox& aab);
+
+        Real mRadius;
+
+	public:
+			
+		WireBoundingBox();
+		~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: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSerializer.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSerializer.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSerializer.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __Serializer_H__
+#define __Serializer_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreString.h"
+#include "OgreDataStream.h"
+
+namespace Ogre {
+
+    /** 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:
+        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;
+        FILE* mpfFile;
+        String mVersion;
+		bool mFlipEndian; // default to native endian, derive from header
+
+        // Internal methods
+        virtual void writeFileHeader(void);
+        virtual void writeChunkHeader(uint16 id, uint32 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);
+    };
+
+}
+
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreOverlayManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreOverlayManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreOverlayManager.h	(revision 1812)
@@ -0,0 +1,231 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __OverlayManager_H__
+#define __OverlayManager_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreSingleton.h"
+#include "OgreStringVector.h"
+#include "OgreOverlay.h"
+#include "OgreScriptLoader.h"
+
+namespace Ogre {
+
+    /** Manages Overlay objects, parsing them from .overlay files and
+        storing a lookup library of them. Alo manages the creation of 
+		OverlayContainers and OverlayElements, used for non-interactive 2D 
+		elements such as HUDs.
+    */
+    class _OgreExport OverlayManager : public Singleton<OverlayManager>, public ScriptLoader
+    {
+    public:
+        typedef std::map<String, Overlay*> OverlayMap;
+		typedef std::map<String, OverlayElement*> ElementMap;
+    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;
+
+	    bool parseChildren( DataStreamPtr& chunk, const String& line,
+            Overlay* pOverlay, bool isTemplate, OverlayContainer* parent = NULL);
+
+		typedef std::map<String, OverlayElementFactory*> FactoryMap;
+		FactoryMap mFactories;
+
+		ElementMap mInstances;
+		ElementMap mTemplates;
+
+		typedef std::set<String> LoadedScripts;
+		LoadedScripts mLoadedScripts;
+
+
+
+
+		ElementMap& getElementMap(bool isTemplate);
+
+		OverlayElement* createOverlayElementImpl(const String& typeName, const String& instanceName, ElementMap& elementMap);
+
+		OverlayElement* getOverlayElementImpl(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 
+        @returns 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
+            reclaculate 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;
+
+
+		/** 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);
+
+		/** 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);
+
+		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: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreArchiveManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreArchiveManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreArchiveManager.h	(revision 1812)
@@ -0,0 +1,126 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _ArchiveManager_H__
+#define _ArchiveManager_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreResourceManager.h"
+#include "OgreSingleton.h"
+
+namespace Ogre {
+
+    /** This class manages the available ArchiveFactory plugins. 
+    */
+    class _OgreExport ArchiveManager : public Singleton<ArchiveManager>
+    {
+    protected:
+        typedef std::map<String, ArchiveFactory*> ArchiveFactoryMap;
+        /// Factories available to create archives, indexed by archive type (String identifier e.g. 'Zip')
+        ArchiveFactoryMap mArchFactories;
+        /// Currently loaded archives
+        typedef std::map<String, Archive*> 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 refLibrary
+                The library that contains the data-handling code
+            @returns
+                If the function succeeds, a valid pointer to an Archive
+                object is returened.
+            @par
+                If the function fails, an exception is thrown.
+        */
+        Archive* load( const String& filename, const String& archiveType);
+
+		/** 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);
+
+
+        /** 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);
+    };
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreEntity.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreEntity.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreEntity.h	(revision 1812)
@@ -0,0 +1,724 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://ogre.sourceforge.net/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#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"
+
+namespace Ogre {
+	/** 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
+	{
+		// Allow EntityFactory full access
+		friend class EntityFactory;
+		friend class SubEntity;
+	public:
+		typedef std::set<Entity*> EntitySet;
+
+	protected:
+
+		/** Private constructor (instances cannot be created directly).
+		*/
+		Entity();
+		/** Private constructor - specify name (the usual constructor used).
+		*/
+		Entity( const String& name, MeshPtr& mesh);
+
+		/** The Mesh that this Entity is based on.
+		*/
+		MeshPtr mMesh;
+
+		/** List of SubEntities (point to SubMeshes).
+		*/
+		typedef std::vector<SubEntity*> 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);
+
+		/// 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
+		void cacheBoneMatrices(void);
+
+		/// Flag determines whether or not to display skeleton
+		bool mDisplaySkeleton;
+		/// Flag indicating whether hardware animation is supported by this entities materials
+		bool mHardwareAnimation;
+		/// 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;
+
+
+		/// The LOD number of the mesh to use, calculated by _notifyCurrentCamera
+		ushort mMeshLodIndex;
+
+		/// LOD bias factor, inverted for optimisation when calculating adjusted depth
+		Real mMeshLodFactorInv;
+		/// 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, inverted for optimisation when calculating adjusted depth
+		Real mMaterialLodFactorInv;
+		/// 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 std::vector<Entity*> LODEntityList;
+		LODEntityList mLodEntityList;
+
+		/** This Entity's personal copy of the skeleton, if skeletally animated
+		*/
+		SkeletonInstance* mSkeletonInstance;
+
+		/// Last parent xform
+		Matrix4 mLastParentXform;
+
+		/** 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);
+
+		/// Trigger reevaluation of the kind of vertex processing in use
+		void reevaluateVertexProcessing(void);
+
+		/// Apply vertex animation
+		void applyVertexAnimation(bool hardwareAnimation, bool stencilShadows);
+		/// Initialise the hardware animation elements for given vertex data
+		void initHardwareAnimationElements(VertexData* vdata,
+			ushort numberOfElements);
+		/// 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 std::map<String, MovableObject*> ChildObjectList;
+	protected:
+		ChildObjectList mChildObjectList;
+
+
+		/// Bounding box that 'contains' all the mesh of each child entity
+		mutable AxisAlignedBox mFullBoundingBox;
+
+		bool mNormaliseNormals;
+
+		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();
+			/// Overridden from ShadowRenderable
+			void getWorldTransforms(Matrix4* xform) const;
+			/// Overridden from ShadowRenderable
+			const Quaternion& getWorldOrientation(void) const;
+			/// Overridden from ShadowRenderable
+			const Vector3& getWorldPosition(void) 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);
+			/// Overridden from ShadowRenderable
+			bool isVisible(void) const;
+
+		};
+	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);
+
+		/** Overridden - see MovableObject.
+		*/
+		void _notifyCurrentCamera(Camera* cam);
+
+		/// Overridden - see MovableObject.
+		void setRenderQueueGroup(uint8 queueID);
+
+		/** Overridden - see MovableObject.
+		*/
+		const AxisAlignedBox& getBoundingBox(void) const;
+
+		/// merge all the child object Bounds a return it
+		AxisAlignedBox getChildObjectsBoundingBox(void) const;
+
+		/** Overridden - see MovableObject.
+		*/
+		void _updateRenderQueue(RenderQueue* queue);
+
+		/** Overridden from MovableObject */
+		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;
+		/** For entities based on animated meshes, gets the AnimationState objects for all animations.
+		@returns
+		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;
+
+		/** 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.
+		@returns 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 is 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);
+		/** @see MovableObject::getBoundingRadius */
+		Real getBoundingRadius(void) const;
+
+		/** @copy MovableObject::getWorldBoundingBox */
+		const AxisAlignedBox& getWorldBoundingBox(bool derive = false) const;
+		/** @copy MovableObject::getWorldBoundingSphere */
+		const Sphere& getWorldBoundingSphere(bool derive = false) const;
+
+        /** If set to true, this forces normals of this entity to be normalised
+            dynamically by the hardware.
+        @remarks
+            This option can be used to prevent lighting variations when scaling an
+            Entity using a SceneNode - normally because this scaling is hardware
+            based, the normals get scaled too which causes lighting to become inconsistent.
+            However, this has an overhead so only do this if you really need to.
+        */
+        void setNormaliseNormals(bool normalise) { mNormaliseNormals = normalise; }
+
+        /** Returns true if this entity has auto-normalisation of normals set. */
+        bool getNormaliseNormals(void) const {return mNormaliseNormals; }
+
+
+        /** Overridden member from ShadowCaster. */
+        EdgeData* getEdgeList(void);
+        /** Overridden member from ShadowCaster. */
+        ShadowRenderableListIterator getShadowVolumeRenderableIterator(
+            ShadowTechnique shadowTechnique, const Light* light,
+            HardwareIndexBufferSharedPtr* indexBuffer,
+            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.
+		*/
+		bool isHardwareAnimationEnabled(void) const { return mHardwareAnimation; }
+
+		/** Overridden from MovableObject */
+		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 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 incase 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) const;
+
+		/** Are buffers already marked as vertex animated? */
+		bool _getBuffersMarkedForAnimation(void) const { return mVertexAnimationAppliedThisFrame; }
+		/** Mark just this vertex data as animated.
+		*/
+		void _markBuffersUsedForAnimation(void);
+
+
+	};
+
+	/** 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
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreParticleIterator.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreParticleIterator.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreParticleIterator.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under 
+the terms of the GNU Lesser General Public License as published by the Free Software 
+Foundation; either version 2 of the License, or (at your option) any later 
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT 
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with 
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple 
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to 
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __ParticleIterator_H__
+#define __ParticleIterator_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+
+    /** Convenience class to make it easy to step through all particles in a ParticleSystem.
+    */
+    class _OgreExport ParticleIterator
+    {
+        friend class ParticleSystem;
+    protected:
+        std::list<Particle*>::iterator mPos;
+        std::list<Particle*>::iterator mStart;
+        std::list<Particle*>::iterator mEnd;
+
+        /// Protected constructor, only available from ParticleSystem::getIterator
+        ParticleIterator(std::list<Particle*>::iterator start, std::list<Particle*>::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);
+    };
+}
+
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRadixSort.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRadixSort.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRadixSort.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __RadixSort_H__
+#define __RadixSort_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+	/** 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
+		std::vector<SortEntry> mSortArea1;
+		std::vector<SortEntry> mSortArea2;
+		std::vector<SortEntry>* mSrc;
+		std::vector<SortEntry>* 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
+				std::vector<SortEntry>* 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: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreDynLib.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreDynLib.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreDynLib.h	(revision 1812)
@@ -0,0 +1,112 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _DynLib_H__
+#define _DynLib_H__
+
+#include "OgrePrerequisites.h"
+
+#if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
+#    define DYNLIB_HANDLE hInstance
+#    define DYNLIB_LOAD( a ) LoadLibrary( a )
+#    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
+#    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
+#    define DYNLIB_HANDLE CFBundleRef
+#    define DYNLIB_LOAD( a ) mac_loadExeBundle( a )
+#    define DYNLIB_GETSYM( a, b ) mac_getBundleSym( a, b )
+#    define DYNLIB_UNLOAD( a ) mac_unloadExeBundle( a )
+#endif
+
+namespace Ogre {
+
+    /** 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
+        @see
+            Resource
+    */
+    class _OgreExport DynLib
+    {
+	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
+            @returns
+                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 m_hInst;
+    };
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreProfiler.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreProfiler.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreProfiler.h	(revision 1812)
@@ -0,0 +1,411 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+/*
+
+    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 "OgreOverlay.h"
+
+#if OGRE_PROFILING == 1
+#   if OGRE_COMPILER != OGRE_COMPILER_BORL
+#       define OgreProfile( a ) Ogre::Profile _OgreProfileInstance( (a) )
+#       define OgreProfileBegin( a ) Ogre::Profiler::getSingleton().beginProfile( (a) )
+#       define OgreProfileEnd( a ) Ogre::Profiler::getSingleton().endProfile( (a) )
+#   else
+#	    define OgreProfile( a ) Ogre::Profile _OgreProfileInstance( __FUNC__ )
+#	    define OgreProfileBegin( a ) Ogre::Profiler::getSingleton().beginProfile( __FUNC__ )
+#	    define OgreProfileEnd( a ) Ogre::Profiler::getSingleton().endProfile( __FUNC__ )
+#   endif
+#else
+#   define OgreProfile( a )
+#   define OgreProfileBegin( a )
+#   define OgreProfileEnd( a )
+#endif
+
+namespace Ogre {
+
+    /** 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 (ie the main game loop).
+        @author Amit Mathew (amitmathew (at) yahoo (dot) com)
+    */
+    class _OgreExport Profile {
+
+        public:
+            Profile(const String& profileName);
+            ~Profile();
+
+        protected:
+
+            /// The name of this profile
+            String mName;
+			
+
+    };
+
+    /** 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 (ie 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:
+            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 (ie 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
+            */
+            void beginProfile(const String& profileName);
+
+            /** 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.
+            */
+            void endProfile(const String& profileName);
+
+            /** 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 Only enables the profile if this function is not 
+            called during the profile it is trying to enable.
+            */
+            void enableProfile(const String& profileName);
+
+            /** Disables a profile
+            @remarks Only disables the profile if this function is not called during
+            the profile it is trying to disable.
+            */
+            void disableProfile(const String& profileName);
+
+            /** 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 ever n frames*/
+            void setUpdateDisplayFrequency(uint freq);
+
+            /** Gets the frequency that the Profiler display is updated */
+            uint getUpdateDisplayFrequency() 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 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:
+
+            /** Initializes the profiler's gui elements */
+            void initialize();
+
+            /** Prints the profiling results of each frame */
+            void displayResults();
+
+            /** Processes the profiler data after each frame */
+            void processFrameStats();
+
+            /** Handles a change of the profiler's enabled state*/
+            void changeEnableState();
+
+            /** 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);
+
+            /// Represents an individual profile call
+            struct ProfileInstance {
+
+                /// The name of the profile
+                String		name;
+
+                /// The name of the parent, empty string if root
+                String		parent;
+
+                /// 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;
+            };
+
+            /// Represents the total timing information of a profile
+            /// since profiles can be called more than once each frame
+            struct ProfileFrame {
+				
+                /// The name of the profile
+                String	name;
+
+                /// 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 name of the profile
+                String	name;
+
+                /// The current percentage of frame time this profile has taken
+                Real	currentTime; // %
+
+                /// The maximum percentage of frame time this profile has taken
+                Real	maxTime; // %
+
+                /// The minimum percentage of frame time this profile has taken
+                Real	minTime; // %
+
+                /// The number of times this profile has been called each frame
+                uint	numCallsThisFrame;
+
+                /// The total percentage of frame time this profile has taken
+                /// (used to calculate average)
+                Real	totalTime; // %
+
+                /// 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;
+
+			};
+
+			
+            typedef std::list<ProfileInstance> ProfileStack;
+            typedef std::list<ProfileFrame> ProfileFrameList;
+            typedef std::list<ProfileHistory> ProfileHistoryList;
+            typedef std::map<String, ProfileHistoryList::iterator> ProfileHistoryMap;
+            typedef std::map<String, bool> DisabledProfileMap;
+
+            typedef std::list<OverlayElement*> ProfileBarList;
+
+            /// A stack for each individual profile per frame
+            ProfileStack mProfiles;
+
+            /// Accumulates the results of each profile per frame (since a profile can be called
+            /// more than once a frame)
+            ProfileFrameList mProfileFrame;
+
+            /// Keeps track of the statistics of each profile
+            ProfileHistoryList mProfileHistory;
+
+            /// We use this for quick look-ups of profiles in the history list
+            ProfileHistoryMap mProfileHistoryMap;
+
+            /// Holds the names of disabled profiles
+            DisabledProfileMap mDisabledProfiles;
+
+            /// Holds the display bars for each profile results
+            ProfileBarList mProfileBars;
+
+            /// Whether the GUI elements have been initialized
+            bool mInitialized;
+
+            /// The max number of profiles we can display
+            uint maxProfiles;
+
+            /// 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 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 number of frames that must elapse before the current
+            /// frame display is updated
+            uint mUpdateDisplayFrequency;
+
+            /// The number of elasped 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 whether this profiler has
+            /// received a request to be enabled/disabled
+            bool mEnableStateChangePending;
+
+            /// Keeps track of the new enabled/disabled state that the user has requested
+            /// which will be applied after the frame ends
+            bool mNewEnableState;
+
+    }; // end class
+
+} // end namespace
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreResourceManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreResourceManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreResourceManager.h	(revision 1812)
@@ -0,0 +1,421 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#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"
+
+namespace Ogre {
+
+    /** 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 temporaily 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:
+		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 create(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;
+
+		/** 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, ie 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);
+
+        /** Retrieves a pointer to a resource by name, or null if the resource does not exist.
+        */
+        virtual ResourcePtr getByName(const String& 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 !getByName(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', ie 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 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.
+		*/
+		virtual ResourcePtr load(const String& name, 
+            const String& group, bool isManual = false, 
+			ManualResourceLoader* loader = 0, const NameValuePairList* loadParams = 0);
+
+		/** 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.
+		@returns
+			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) {}
+
+		/** 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; }
+
+    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.
+		*/
+		virtual void checkUsage(void);
+		/** Gets the current memory usage, in bytes. */
+		virtual size_t getMemoryUsage(void) const { return mMemoryUsage; }
+
+
+    public:
+		typedef HashMap< String, ResourcePtr > ResourceMap;
+		typedef std::map<ResourceHandle, ResourcePtr> ResourceHandleMap;
+    protected:
+        ResourceHandleMap mResourcesByHandle;
+        ResourceMap mResources;
+        ResourceHandle mNextHandle;
+        size_t mMemoryBudget; // In bytes
+        size_t mMemoryUsage; // In bytes
+
+		// 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());
+        }
+
+    
+
+    };
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreController.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreController.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreController.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __Controller_H__
+#define __Controller_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreSharedPtr.h"
+
+namespace Ogre {
+
+
+	
+	
+	/** 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
+    {
+    protected:
+        /// If true, function will add imput 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:
+        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
+    {
+    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: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreVector2.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreVector2.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreVector2.h	(revision 1812)
@@ -0,0 +1,522 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __Vector2_H__
+#define __Vector2_H__
+
+
+#include "OgrePrerequisites.h"
+#include "OgreMath.h"
+
+namespace Ogre
+{
+
+    /** Standard 2-dimensional vector.
+        @remarks
+            A direction in 2D space represented as distances along the 2
+            orthoganal 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:
+        union {
+            struct {
+                Real x, y;
+            };
+            Real val[2];
+        };
+
+    public:
+        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] )
+        {
+        }
+
+        inline Vector2( const Vector2& rkVector )
+            : x( rkVector.x ), y( rkVector.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);
+        }
+
+        /** 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.0 / 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.0 / 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;
+        }
+
+        /** 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).
+            @returns
+                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.
+            @returns 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
+            if ( fLength > 1e-08 )
+            {
+                Real fInvLength = 1.0 / 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.5,
+                ( y + vec.y ) * 0.5 );
+        }
+
+        /** 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
+            @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)
+            @returns
+                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(
+            Real angle) const
+        {
+
+            angle *=  Math::UnitRandom() * Math::TWO_PI;
+            Real cosa = cos(angle);
+            Real sina = 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 ) );
+        }
+
+        // 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: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreTagPoint.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreTagPoint.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreTagPoint.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __TagPoint_H_
+#define __TagPoint_H_
+
+#include "OgrePrerequisites.h"
+
+#include "OgreBone.h"
+#include "OgreMatrix4.h"
+
+namespace Ogre	{
+
+
+	
+    /** 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);
+		
+		void setParentEntity(Entity *pEntity);
+		void setChildObject(MovableObject *pObject);
+
+		/** 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 _updateFromParent(void) const;
+        /** @copydoc Renderable::getLights */
+        const LightList& getLights(void) const;
+
+
+
+	private:
+		Entity *mParentEntity;
+		MovableObject *mChildObject;
+        mutable Matrix4 mFullLocalTransform;
+		
+	};
+
+
+} //namespace
+
+
+#endif//__TagPoint_H_
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMeshSerializer.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMeshSerializer.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMeshSerializer.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __MeshSerializer_H__
+#define __MeshSerializer_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreMeshSerializerImpl.h"
+#include "OgreSerializer.h"
+
+namespace Ogre {
+
+    /** 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 instatiated 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. 
+        @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 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);
+
+        /** 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);
+    protected:
+        static String msCurrentVersion;
+
+        typedef std::map<String, MeshSerializerImpl* > MeshSerializerImplMap;
+        MeshSerializerImplMap mImplementations;
+
+    };
+
+}
+
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreResource.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreResource.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreResource.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _Resource_H__
+#define _Resource_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreString.h"
+#include "OgreSharedPtr.h"
+#include "OgreStringInterface.h"
+
+namespace Ogre {
+
+    typedef unsigned long ResourceHandle;
+
+
+	// Forward declaration
+	class ManualResourceLoader;
+
+	/** Abstract class reprensenting 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:
+		OGRE_AUTO_MUTEX // public to allow external locking
+    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?
+        bool mIsLoaded;
+		/// 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;
+
+		/** Protected unnamed constructor to prevent default construction. 
+		*/
+		Resource() 
+			: mCreator(0), mHandle(0), mIsLoaded(false), mSize(0), mIsManual(0), mLoader(0)
+		{ 
+		}
+
+		/** Internal implementation 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;
+		/** Calculate the size of a resource; this will only be called after 'load' */
+		virtual size_t calculateSize(void) const = 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();
+
+        /** 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
+			
+        */
+        virtual void load(void);
+
+		/** 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.
+        */
+        bool isReloadable(void) const
+        {
+            return !mIsManual || mLoader;
+        }
+
+        /** Is this resource manually loaded?
+		*/
+		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.
+        */
+        size_t getSize(void) const
+        { 
+            return mSize; 
+        }
+
+        /** 'Touches' the resource to indicate it has been used.
+        */
+        virtual void touch(void);
+
+        /** Gets resource name.
+        */
+        const String& getName(void) const 
+        { 
+            return mName; 
+        }
+
+        ResourceHandle getHandle(void) const
+        {
+            return mHandle;
+        }
+
+        /** Returns true if the Resource has been loaded, false otherwise.
+        */
+        bool isLoaded(void) const 
+        { 
+			OGRE_LOCK_AUTO_MUTEX
+            return mIsLoaded; 
+        }
+
+		/// Gets the group which this resource is a member of
+		const String& getGroup(void) { 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
+		*/
+		void changeGroupOwnership(const String& newGroup);
+
+		/// Gets the manager which created this resource
+		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.
+		*/
+		const String& getOrigin(void) const { return mOrigin; }
+		/// Notify this resource of it's origin
+		void _notifyOrigin(const String& origin) { mOrigin = origin; }
+
+    };
+
+	/** 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.
+		@param resource The resource which wishes to load
+		*/
+		virtual void loadResource(Resource* resource) = 0;
+	};
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreEventTarget.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreEventTarget.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreEventTarget.h	(revision 1812)
@@ -0,0 +1,58 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+/***************************************************************************
+OgreEventTarget.h  -  
+	This is an abstract class that is the base class of all Targets.
+
+	All targets can processEvents. This function should call the respective
+		event process method depending on what type of event is sent. 
+
+-------------------
+begin                : Nov 19 2002
+copyright            : (C) 2002 by Kenny Sabir
+email                : kenny@sparksuit.com
+***************************************************************************/
+
+#ifndef __EventTarget_H__
+#define __EventTarget_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+	/**	This is an abstract class that is the base class of all consumers of InputEvent instances.
+	@remarks
+		This class is part of the set of classes handling buffered input. 
+	*/
+    class _OgreExport EventTarget
+    {
+	public:
+		virtual void processEvent(InputEvent* e) = 0;
+		virtual ~EventTarget() {}
+    };
+}
+
+
+#endif //__EventTarget_H__
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreHardwarePixelBuffer.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreHardwarePixelBuffer.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreHardwarePixelBuffer.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __HardwarePixelBuffer__
+#define __HardwarePixelBuffer__
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+#include "OgreHardwareBuffer.h"
+#include "OgreSharedPtr.h"
+#include "OgrePixelFormat.h"
+#include "OgreImage.h"
+
+namespace Ogre {
+
+    /** 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
+        size_t mWidth, mHeight, mDepth;
+        // Pitches (offsets between rows and slices)
+        size_t mRowPitch, mSlicePitch;
+        // Internal format
+        PixelFormat mFormat;
+        // Currently locked region
+        PixelBox mCurrentLock;
+        
+        /// 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);
+
+        /// Internal implementation of unlock(), must be overridden in subclasses
+        // virtual void unlockImpl(void) = 0;
+
+		/** 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(size_t mWidth, size_t mHeight, size_t 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
+		    @returns 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)
+		    @returns 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 dst		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);
+
+		/** Convience 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;
+		
+		/** Convience 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;
+
+		/** Convience function that blits this entire buffer to a pixelbox.
+			The 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 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
+            @returns 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
+        size_t getWidth() const { return mWidth; }
+        /// Gets the height of this buffer
+        size_t getHeight() const { return mHeight; }
+        /// Gets the depth of this buffer
+        size_t 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);
+
+
+    };
+
+}
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePixelFormat.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePixelFormat.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePixelFormat.h	(revision 1812)
@@ -0,0 +1,432 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _PixelFormat_H__
+#define _PixelFormat_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreCommon.h"
+
+namespace Ogre {
+    /** The pixel format used for images, textures, and render surfaces */
+    enum PixelFormat
+    {
+        /// Unknown pixel format.
+        PF_UNKNOWN = 0,
+        /// 8-bit pixel format, all bits luminace.
+        PF_L8 = 1,
+		PF_BYTE_L = PF_L8,
+        /// 16-bit pixel format, all bits luminace.
+        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 luminace.
+        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,
+		// 16-bit pixel format, 16 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,
+		// Depth texture format
+		PF_DEPTH = 29,
+		// 64-bit pixel format, 16 bits for red, green, blue and alpha
+		PF_SHORT_RGBA = 30,
+		// Number of pixel formats currently defined
+        PF_COUNT = 34
+    };
+
+    /**
+     * 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
+    };
+    
+    /** 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_COUNT = 4    /// 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:
+    	/// Parameter constructor for setting the members manually
+    	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(size_t width, size_t height, size_t 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
+      		@returns	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;
+    };
+    
+
+    /**
+     * 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.
+         @returns
+               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.
+          @returns
+               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
+		  	@returns
+		  		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(size_t width, size_t height, size_t depth, PixelFormat format);
+		
+        /** Returns the property flags for this pixel format
+          @returns
+               A bitfield combination of PFF_HASALPHA, PFF_ISCOMPRESSED,
+               PFF_FLOAT, PFF_DEPTH, PFF_NATIVEENDIAN, PFF_LUMINANCE
+          @remarks
+               This replaces the seperate 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 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 wether 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, uint32 rgba[4]);
+
+        /** Gets the name of an image format
+        */
+        static String getFormatName(PixelFormat srcformat);
+
+        /** Returns wether 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.
+          @returns 
+               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);
+        
+        /** 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,  const void* dest);
+        /** Pack a colour value to memory
+        	@param r,g,b,a	The four colour components, range 0x00 to 0xFF
+        	@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,  const 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,  const 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,g,b,a	The colour 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,g,b,a	The colour 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 *dest, 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);
+    };
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreResourceBackgroundQueue.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreResourceBackgroundQueue.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreResourceBackgroundQueue.h	(revision 1812)
@@ -0,0 +1,258 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __ResourceBackgroundQueue_H__
+#define __ResourceBackgroundQueue_H__
+
+
+#include "OgrePrerequisites.h"
+#include "OgreCommon.h"
+#include "OgreSingleton.h"
+
+#if OGRE_THREAD_SUPPORT
+#	include <boost/thread/thread.hpp>
+#	include <boost/thread/condition.hpp>
+#endif
+
+namespace Ogre {
+
+	/// Identifier of a background process
+	typedef unsigned long BackgroundProcessTicket;
+
+	/** This abstract listener interface lets you get immediate notifications of
+		completed background processes instead of having to check ticket 
+		statuses.
+	@note
+		These callbacks occur in the <i>background thread</i>, not the thread
+		which you queued your request from. You should only use this method
+		if you understand the implications of threading and the use of locks, 
+		monitor objects or other such thread safety techniques. If you don't, 
+		use the simpler 'ticket' approach and poll the isProcessComplete() 
+		method
+		to determine when your processes complete.
+	*/
+	class _OgreExport ResourceBackgroundQueueListener
+	{
+	public:
+		/** Called when a requested operation completes. 
+		@note Called in the <i>background thread</i>, not your queueing
+		thread, so be careful!
+		*/
+		virtual void operationCompleted(BackgroundProcessTicket ticket) = 0;
+	};
+	
+	/** This class is used to perform Resource operations in a
+		background thread. 
+	@remarks
+		If threading is enabled, Ogre will create a single background thread
+		which can be used to load / unload resources in parallel. Only one
+		resource will be processed at once in this background thread, but it
+		will be in parallel with the main thread. 
+	@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 wil 
+		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. It is also possible to get immediate 
+		callbacks on completion, but these callbacks happen in the background 
+		loading thread (not your calling thread), so should only be used if you
+		really understand multithreading. 
+	@note
+		This class will only perform tasks in a background thread if 
+		OGRE_THREAD_SUPPORT is defined to be 1. Otherwise, all methods will
+		call their exact equivalents in ResourceGroupManager synchronously. 
+	*/
+	class _OgreExport ResourceBackgroundQueue : public Singleton<ResourceBackgroundQueue>
+	{
+	protected:
+		/** Enumerates the type of requests */
+		enum RequestType
+		{
+			RT_INITIALISE_GROUP,
+			RT_INITIALISE_ALL_GROUPS,
+			RT_LOAD_GROUP,
+			RT_LOAD_RESOURCE,
+			RT_SHUTDOWN
+		};
+		/** Encapsulates a queued request for the background queue */
+		struct Request
+		{
+			BackgroundProcessTicket ticketID;
+			RequestType type;
+			String resourceName;
+			String resourceType;
+			String groupName;
+			bool isManual; 
+			ManualResourceLoader* loader;
+			const NameValuePairList* loadParams;
+			ResourceBackgroundQueueListener* listener;
+		};
+		typedef std::list<Request> RequestQueue;
+		typedef std::map<BackgroundProcessTicket, Request*> RequestTicketMap;
+		
+		/// Queue of requests, used to store and order requests
+		RequestQueue mRequestQueue;
+		
+		/// Request lookup by ticket
+		RequestTicketMap mRequestTicketMap;
+
+		/// Next ticket ID
+		unsigned long mNextTicketID;
+
+#if OGRE_THREAD_SUPPORT
+		/// The single background thread which will process loading requests
+		boost::thread* mThread;
+		/// Synchroniser token to wait / notify on queue
+		boost::condition mCondition;
+		/// Thread function
+		static void threadFunc(void);
+		/// Internal method for adding a request; also assigns a ticketID
+		BackgroundProcessTicket addRequest(Request& req);
+#else
+		/// Dummy
+		void* mThread;
+#endif
+
+		/// Private mutex, not allowed to lock from outside
+		OGRE_AUTO_MUTEX
+
+	public:
+		ResourceBackgroundQueue();
+		virtual ~ResourceBackgroundQueue();
+
+		/** Initialise the background queue system. */
+		virtual void initialise(void);
+		
+		/** Shut down the background queue system. */
+		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.
+		@returns Ticket identifying the request, use isProcessComplete() to 
+			determine if completed if not using listener
+		*/
+		virtual BackgroundProcessTicket initialiseResourceGroup(
+			const String& name, ResourceBackgroundQueueListener* 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.
+		@returns Ticket identifying the request, use isProcessComplete() to 
+			determine if completed if not using listener
+		*/
+		virtual BackgroundProcessTicket initialiseAllResourceGroups( 
+			ResourceBackgroundQueueListener* listener = 0);
+		/** Loads a resource group 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.
+		@returns Ticket identifying the request, use isProcessComplete() to 
+			determine if completed if not using listener
+		*/
+		virtual BackgroundProcessTicket loadResourceGroup(const String& name, 
+			ResourceBackgroundQueueListener* 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, 
+			ResourceBackgroundQueueListener* listener = 0);
+
+		/** Returns whether a previously queued process has completed or not. 
+		@param ticket The ticket which was returned when the process was queued
+		@returns true if process has completed (or if the ticket is 
+			unrecognised), false otherwise
+		@note Tickets are not stored onced complete so do not accumulate over 
+			time.
+		This is why a non-existent ticket will return 'true'.
+		*/
+		virtual bool isProcessComplete(BackgroundProcessTicket ticket);
+
+		/** 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);
+		
+
+	};
+
+
+}
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSharedPtr.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSharedPtr.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSharedPtr.h	(revision 1812)
@@ -0,0 +1,193 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __SharedPtr_H__
+#define __SharedPtr_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+	/** 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. OGRE does not use this class
+        very often, because it is usually more efficient to make the destruction
+        of objects more intentional (in blocks, say). However in some cases you
+        really cannot tell how many people are using an object, and this approach is
+        worthwhile (e.g. ControllerValue)
+	@par
+		If OGRE_THREAD_SUPPORT is defined to be 1, use of this class is thread-safe.
+    */
+    template<class T> class SharedPtr {
+	protected:
+		T* pRep;
+		unsigned int* pUseCount;
+	public:
+		OGRE_AUTO_SHARED_MUTEX // public to allow external locking
+		/** Constructor, does not initialise the SharedPtr.
+			@remarks
+				<b>Dangerous!</b> You have to call bind() before using the SharedPtr.
+		*/
+		SharedPtr() : pRep(0), pUseCount(0)
+        {
+            OGRE_SET_AUTO_SHARED_MUTEX_NULL
+        }
+
+		explicit SharedPtr(T* rep) : pRep(rep), pUseCount(new unsigned int(1))
+		{
+            OGRE_SET_AUTO_SHARED_MUTEX_NULL
+			OGRE_NEW_AUTO_SHARED_MUTEX
+		}
+		SharedPtr(const SharedPtr& r)
+            : pRep(0), pUseCount(0)
+		{
+			// lock & copy other mutex pointer
+            
+            OGRE_SET_AUTO_SHARED_MUTEX_NULL
+            OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME)
+            {
+			    OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
+			    OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
+			    pRep = r.pRep;
+			    pUseCount = r.pUseCount; 
+			    // Handle zero pointer gracefully to manage STL containers
+			    if(pUseCount)
+			    {
+				    ++(*pUseCount); 
+			    }
+            }
+		}
+		SharedPtr& operator=(const SharedPtr& r) {
+			if (pRep == r.pRep)
+				return *this;
+			release();
+			// lock & copy other mutex pointer
+            OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME)
+            {
+			    OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
+			    OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
+			    pRep = r.pRep;
+			    pUseCount = r.pUseCount;
+			    if (pUseCount)
+			    {
+				    ++(*pUseCount);
+			    }
+            }
+			return *this;
+		}
+		virtual ~SharedPtr() {
+            release();
+		}
+
+
+		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!
+		*/
+		void bind(T* rep) {
+			assert(!pRep && !pUseCount);
+            OGRE_NEW_AUTO_SHARED_MUTEX
+			OGRE_LOCK_AUTO_SHARED_MUTEX
+			pUseCount = new unsigned int(1);
+			pRep = rep;
+		}
+
+		inline bool unique() const { OGRE_LOCK_AUTO_SHARED_MUTEX assert(pUseCount); return *pUseCount == 1; }
+		inline unsigned int useCount() const { OGRE_LOCK_AUTO_SHARED_MUTEX assert(pUseCount); return *pUseCount; }
+		inline unsigned int* useCountPointer() const { return pUseCount; }
+
+		inline T* getPointer() const { return pRep; }
+
+		inline bool isNull(void) const { return pRep == 0; }
+
+        inline void setNull(void) { 
+			if (pRep)
+			{
+				// can't scope lock mutex before release incase deleted
+				release();
+				pRep = 0;
+				pUseCount = 0;
+			}
+        }
+
+    protected:
+
+        inline void release(void)
+        {
+			bool destroyThis = false;
+
+            /* If the mutex is not initialized to a non-zero value, then
+               neither is pUseCount nor pRep.
+             */
+
+            OGRE_MUTEX_CONDITIONAL(OGRE_AUTO_MUTEX_NAME)
+			{
+				// lock own mutex in limited scope (must unlock before destroy)
+				OGRE_LOCK_AUTO_SHARED_MUTEX
+				if (pUseCount)
+				{
+					if (--(*pUseCount) == 0) 
+					{
+						destroyThis = true;
+	                }
+				}
+            }
+			if (destroyThis)
+				destroy();
+
+            OGRE_SET_AUTO_SHARED_MUTEX_NULL
+        }
+
+        virtual void destroy(void)
+        {
+            // 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.
+            delete pRep;
+            delete pUseCount;
+			OGRE_DELETE_AUTO_SHARED_MUTEX
+        }
+	};
+
+	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();
+	}
+}
+
+
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreBillboardChain.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreBillboardChain.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreBillboardChain.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+// 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"
+
+namespace Ogre {
+
+
+	/** Allows the rendering of a chain of connected billboards.
+	@remarks
+		A billboard chain operates much like a traditional billboard, ie 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(Vector3 position,
+				Real width,
+				Real texCoord,
+				ColourValue colour);
+
+			Vector3 position;
+			Real width;
+			/// U or V texture coord depending on options
+			Real texCoord;
+			ColourValue colour;
+
+		};
+		typedef std::vector<Element> 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 useVertexColours 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;
+
+		/** 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);
+
+		/// 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);
+
+
+		// Overridden members follow
+		void _notifyCurrentCamera(Camera* cam);
+		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 &);
+		void getWorldTransforms(Matrix4 *) const;
+		const Quaternion& getWorldOrientation(void) const;
+		const Vector3& getWorldPosition(void) const;
+		const LightList& getLights(void) const;
+
+
+
+	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;
+		/// AABB
+		mutable AxisAlignedBox mAABB;
+		/// Bounding radius
+		mutable Real mRadius;
+		/// Material 
+		String mMaterialName;
+		MaterialPtr mMaterial;
+		/// Tetxure coord direction
+		TexCoordDirection mTexCoordDir;
+		/// Other texture coord range
+		Real mOtherTexCoordRange[2];
+
+
+		/// 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 std::vector<ChainSegment> 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
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderSystemCapabilities.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderSystemCapabilities.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderSystemCapabilities.h	(revision 1812)
@@ -0,0 +1,346 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __RenderSystemCapabilities__
+#define __RenderSystemCapabilities__ 1
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+#include "OgreString.h"
+
+namespace Ogre {
+
+    /// Enum describing the different hardware capabilities we want to check for
+    enum Capabilities
+    {
+        //RSC_MULTITEXTURE          = 0x00000001,
+        /// Supporta generating mipmaps in hardware
+        RSC_AUTOMIPMAP              = 0x00000002,
+        RSC_BLENDING                = 0x00000004,
+        /// Supports anisotropic texture filtering
+        RSC_ANISOTROPY              = 0x00000008,
+        /// Supports fixed-function DOT3 texture blend
+        RSC_DOT3                    = 0x00000010,
+        /// Supports cube mapping
+        RSC_CUBEMAPPING             = 0x00000020,
+        /// Supports hardware stencil buffer
+        RSC_HWSTENCIL               = 0x00000040,
+        /// Supports hardware vertex and index buffers
+        RSC_VBO                     = 0x00000080,
+        /// Supports vertex programs (vertex shaders)
+		RSC_VERTEX_PROGRAM          = 0x00000200,
+        /// Supports fragment programs (pixel shaders)
+		RSC_FRAGMENT_PROGRAM        = 0x00000400,
+        /// Supports compressed textures
+		RSC_TEXTURE_COMPRESSION     = 0x00000800,
+        /// Supports compressed textures in the DXT/ST3C formats
+		RSC_TEXTURE_COMPRESSION_DXT = 0x00001000,
+        /// Supports compressed textures in the VTC format
+		RSC_TEXTURE_COMPRESSION_VTC = 0x00002000,
+        /// Supports performing a scissor test to exclude areas of the screen
+        RSC_SCISSOR_TEST            = 0x00004000,
+        /// Supports separate stencil updates for both front and back faces
+        RSC_TWO_SIDED_STENCIL       = 0x00008000,
+        /// Supports wrapping the stencil value at the range extremeties
+        RSC_STENCIL_WRAP            = 0x00010000,
+        /// Supports hardware occlusion queries
+        RSC_HWOCCLUSION				= 0x00020000,
+        /// Supports user clipping planes
+        RSC_USER_CLIP_PLANES		= 0x00040000,
+		/// Supports the VET_UBYTE4 vertex element type
+		RSC_VERTEX_FORMAT_UBYTE4	= 0x00080000,
+		/// Supports infinite far plane projection
+		RSC_INFINITE_FAR_PLANE      = 0x00100000,
+        /// Supports hardware render-to-texture (bigger than framebuffer)
+        RSC_HWRENDER_TO_TEXTURE     = 0x00200000,
+        /// Supports float textures and render targets
+        RSC_TEXTURE_FLOAT           = 0x00400000,
+        /// Supports non-power of two textures
+        RSC_NON_POWER_OF_2_TEXTURES = 0x00800000,
+		/// Supports 3d (volume) textures
+		RSC_TEXTURE_3D				= 0x01000000,
+		/// Supports basic point sprite rendering
+		RSC_POINT_SPRITES		    = 0x02000000,
+		/// Supports extra point parameters (minsize, maxsize, attenuation)
+		RSC_POINT_EXTENDED_PARAMETERS = 0x04000000
+    };
+
+    /** 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 
+    {
+        private:
+            /// The number of world matricies 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;
+            /// The best vertex program that this card / rendersystem supports
+            String mMaxVertexProgramVersion;
+            /// The best fragment program that this card / rendersystem supports
+            String mMaxFragmentProgramVersion;
+            /// 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 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;
+
+    	public:	
+            RenderSystemCapabilities ();
+            ~RenderSystemCapabilities ();
+
+            void setNumWorldMatricies(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 getNumWorldMatricies(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.
+            */
+            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 numVertexBlendMatrices(void) const
+            {
+                return mNumVertexBlendMatrices;
+            }
+
+			/// The number of simultaneous render targets supported
+			ushort numMultiRenderTargets(void) const
+			{
+				return mNumMultiRenderTargets;
+			}
+
+            /** Adds a capability flag to mCapabilities
+            */
+            void setCapability(const Capabilities c) 
+            { 
+                mCapabilities |= c;
+            }
+
+            /** Checks for a capability
+            */
+            bool hasCapability(const Capabilities c) const
+            {
+                if(mCapabilities & c)
+                {
+                    return true;
+                }
+                else
+                {
+                    return false;
+                }
+            }
+            /// Gets the best low-level vertex program version supported
+            const String& getMaxVertexProgramVersion(void) const
+            {
+                return mMaxVertexProgramVersion;
+            }
+            /// Gets the best fragment program that this card / rendersystem supports
+            const String& getMaxFragmentProgramVersion(void) const
+            {
+                return mMaxFragmentProgramVersion;
+            }
+            /// 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 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 best low-level vertex program version supported
+            void setMaxVertexProgramVersion(const String& ver)
+            {
+                mMaxVertexProgramVersion = ver;
+            }
+            /// sets the best fragment program that this card / rendersystem supports
+            void setMaxFragmentProgramVersion(const String& ver)
+            {
+                mMaxFragmentProgramVersion = ver;
+            }
+            /// 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 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;
+			}
+
+
+            /** Write the capabilities to the pass in Log */
+            void log(Log* pLog);
+
+
+
+
+    };
+}
+
+#endif // __RenderSystemCapabilities__
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMouseTarget.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMouseTarget.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMouseTarget.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+/***************************************************************************
+OgreMouseTarget.h  -  
+	Handles the adding and removing of MouseListeners.
+
+	Components that process the Mouse Event should subclass this class 
+	and call processMouseEvent when that event is identified.
+
+-------------------
+begin                : Nov 19 2002
+copyright            : (C) 2002 by Kenny Sabir
+email                : kenny@sparksuit.com
+***************************************************************************/
+
+#ifndef __MouseTarget_H__
+#define __MouseTarget_H__
+
+#include "OgrePrerequisites.h"
+#include "OgrePositionTarget.h"
+
+namespace Ogre {
+
+	
+	/** Handles the adding and removing of MouseListeners.
+	@remarks
+		Components that process the Mouse Event should subclass this class 
+		and call processMouseEvent when that event is identified.
+	*/
+	class _OgreExport MouseTarget : public PositionTarget
+    {
+    private:
+        std::set<MouseListener*> mRemovedListeners;
+    
+    protected:
+        std::set<MouseListener*> mMouseListeners;
+
+		// is mouse inside the object
+		bool mMouseWithin;
+
+    public:
+		MouseTarget();
+        virtual ~MouseTarget() { }
+
+		void processMouseEvent(MouseEvent* e) ;
+		void addMouseListener(MouseListener* l) ;
+		void removeMouseListener(MouseListener* l) ;
+		bool isMouseWithin() const;
+    };
+
+
+
+}
+
+
+#endif //__MouseTarget_H__
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreInputEvent.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreInputEvent.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreInputEvent.h	(revision 1812)
@@ -0,0 +1,190 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General License for more details.
+
+You should have received a copy of the GNU Lesser General License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+/***************************************************************************
+OgreInputEvent.h  -  
+	 * The root event class for all GuiElement-level input events.
+	 *
+	 * Input events are delivered to listeners before they are
+	 * processed normally by the source where they originated.
+	 * This allows listeners and GuiElement subclasses to "consume"
+	 * the event so that the source will not process them in their
+	 * default manner.  For example, consuming mousePressed events
+	 * on a Button GuiElement will prevent the Button from being
+	 * activated.
+-------------------
+begin                : Nov 19 2002
+copyright            : (C) 2002 by Kenny Sabir
+email                : kenny@sparksuit.com
+***************************************************************************/
+
+#ifndef __InputEvent_H__
+#define __InputEvent_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+    /** The root event class for all GuiElement-level input events.
+	 @remarks
+	  Input events are delivered to listeners before they are
+	  processed normally by the source where they originated.
+	  This allows listeners and GuiElement subclasses to "consume"
+	  the event so that the source will not process them in their
+	  default manner.  For example, consuming mousePressed events
+	  on a Button GuiElement will prevent the Button from being
+	  activated.
+	*/
+	class _OgreExport InputEvent
+    {
+    protected:
+
+		/**
+		 * Not implemented yet
+		 */
+		Real mWhen;
+		/**
+		 * The state of the modifier keys at the time the input
+		 * event was fired.
+		 */
+		int mModifiers;
+
+		/**
+		 * The target to process the event. This is ususally found by the dispatcher
+		 */
+
+		EventTarget* mSource;
+
+		/**
+		 * The ID of the event
+		 */
+		int mId;
+
+		/**
+		 * whether the event has been consumed
+		 */
+		bool mConsumed;
+
+	public:
+	
+		
+		enum		// using the enum hack cause VC6 doesn't support static const in classes
+		{
+			/**
+			 * This flag indicates that the Shift key was down when the event
+			 * occurred.
+			 */
+			SHIFT_MASK		= 1 << 0,
+			
+			/**
+			 * This flag indicates that the Control key was down when the event
+			 * occurred.
+			 */
+			CTRL_MASK		= 1 << 1,
+			
+			/**
+			 * This flag indicates that the Meta key was down when the event
+			 * occurred. For mouse events, this flag indicates that the right
+			 * button was pressed or released.
+			 */
+
+			 META_MASK		= 1 << 2,
+			/**
+			 * This flag indicates that the Alt key was down when
+			 * the event occurred. For mouse events, this flag indicates that the
+			 * middle mouse button was pressed or released.
+			 */
+			ALT_MASK			= 1 << 3,
+			BUTTON0_MASK		= 1 << 4,
+			BUTTON1_MASK		= 1 << 5,
+			BUTTON2_MASK		= 1 << 6,
+			BUTTON3_MASK		= 1 << 7,
+			BUTTON_ANY_MASK		= 0xF << 4
+		};
+
+
+
+		/**
+		 * Constructs an InputEvent object with the specified source GuiElement,
+		 * modifiers, and type.
+		 * @param source the object where the event originated
+		 * @id the event type
+		 * @when the time the event occurred
+		 * @modifiers the modifier keys down while event occurred
+		 */
+		InputEvent(EventTarget* source, int id, Real when, int modifiers);
+
+		/**
+		 * Consumes this event so that it will not be processed
+		 * in the default manner by the source which originated it.
+		 */
+		void consume();
+
+		/**
+		 * Returns the modifiers flag for this event.
+		 */
+		int getModifiers() const;
+		
+		/**
+		 * Returns the timestamp of when this event occurred. Not implemented yet
+		 */
+		Real getWhen() const;
+
+		/**
+		 * Returns whether or not the Alt modifier is down on this event.
+		 */
+		bool isAltDown() const;
+
+		/**
+		 * Returns whether or not this event has been consumed.
+		 * @see #consume
+		 */
+		bool isConsumed() const;
+
+		/**
+		 * Returns whether or not the Control modifier is down on this event.
+		 */
+		bool isControlDown() const;
+
+		/**
+		 * Returns whether or not the Meta modifier is down on this event.
+		 */
+		bool isMetaDown() const;
+
+		/**
+		 * Returns whether or not the Shift modifier is down on this event.
+		 */
+		bool isShiftDown() const;
+
+		bool isEventBetween(int start, int end) const;
+		int getID() const;
+
+		EventTarget* getSource() const;
+    };
+}
+
+
+#endif  // __InputEvent_H__
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreManualObject.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreManualObject.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreManualObject.h	(revision 1812)
@@ -0,0 +1,383 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __OgreManualObject_H__
+#define __OgreManualObject_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreMovableObject.h"
+#include "OgreRenderable.h"
+#include "OgreResourceGroupManager.h"
+
+
+namespace Ogre
+{
+	/** 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 one-off
+		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, ie 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
+		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();
+
+		/** Completely clear the contents of the object.
+		@remarks
+			This class is not designed for dynamic vertex data, since the 
+			translation it has to perform is not suitable for frame-by-frame
+			updates. However if you do want to modify the contents 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. 
+		*/
+		virtual void estimateVertexCount(size_t vcount);
+
+		/** Estimate the number of vertices ahead of time.
+		@remarks
+			Calling this helps to avoid memory reallocation when you define
+			indices. 
+		*/
+		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);
+		/** 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 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(const Vector2& uv);
+		/// @copydoc ManualObject::textureCoord(Real)
+		virtual void textureCoord(const Vector3& uvw);
+
+		/** 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 which is why this 
+			class only allows 16-bit indexes, for simplicity and ease of use.
+		@param idx A vertex index from 0 to 65535. 
+		*/
+		virtual void index(uint16 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 which is why this 
+			class only allows 16-bit indexes, for simplicity and ease of use.
+		@param i1, i2, i3 3 vertex indices from 0 to 65535 defining a face. 
+		*/
+		virtual void triangle(uint16 i1, uint16 i2, uint16 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 which is why this 
+			class only allows 16-bit indexes, for simplicity and ease of use.
+		@param i1, i2, i3 3 vertex indices from 0 to 65535 defining a face. 
+		*/
+		virtual void quad(uint16 i1, uint16 i2, uint16 i3, uint16 i4);
+
+		/** Finish defining the object and compile the final renderable version. */
+		virtual void end(void);
+
+		/** 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);
+
+		// 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);
+		/** Implement this method to enable stencil shadows. */
+		ShadowRenderableListIterator getShadowVolumeRenderableIterator(
+			ShadowTechnique shadowTechnique, const Light* light, 
+			HardwareIndexBufferSharedPtr* indexBuffer, 
+			bool extrudeVertices, Real extrusionDist, unsigned long flags = 0);
+
+
+		/// Built, renderable section of geometry
+		class _OgreExport ManualObjectSection : public Renderable
+		{
+		protected:
+			ManualObject* mParent;
+			String mMaterialName;
+			mutable MaterialPtr mMaterial;
+			RenderOperation mRenderOperation;
+			
+		public:
+			ManualObjectSection(ManualObject* parent, const String& materialName,
+				RenderOperation::OperationType opType);
+			virtual ~ManualObjectSection();
+			
+			/// Retrieve render operation for manipulation
+			RenderOperation* getRenderOperation(void);
+			/// Retrieve the material name in use
+			const String& getMaterialName(void) const { return mMaterialName; }
+			
+			// 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::getWorldOrientation. */
+			const Quaternion& getWorldOrientation(void) const;
+			/** @copydoc Renderable::getWorldPosition. */
+			const Vector3& getWorldPosition(void) 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;
+			/// Overridden from ShadowRenderable
+			const Quaternion& getWorldOrientation(void) const;
+			/// Overridden from ShadowRenderable
+			const Vector3& getWorldPosition(void) const;
+			HardwareVertexBufferSharedPtr getPositionBuffer(void) { return mPositionBuffer; }
+			HardwareVertexBufferSharedPtr getWBuffer(void) { return mWBuffer; }
+
+		};
+
+		typedef std::vector<ManualObjectSection*> SectionList;
+		
+	protected:
+		/// List of subsections
+		SectionList mSectionList;
+		/// Current section
+		ManualObjectSection* mCurrentSection;
+		/// Temporary vertex structure
+		struct TempVertex
+		{
+			Vector3 position;
+			Vector3 normal;
+			Vector3 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
+		uint16* mTempIndexBuffer;
+		/// System memory allocation size, in bytes
+		size_t mTempIndexSize;
+		/// Current declaration vertex size
+		size_t mDeclSize;
+		/// Current texture coordinate
+		ushort mTexCoordIndex;
+		/// Bounding box
+		AxisAlignedBox mAABB;
+		/// Bounding sphere
+		Real mRadius;
+		/// Any indexed geoemtry on any sections?
+		bool mAnyIndexed;
+		/// Edge list, used if stencil shadow casting is enabled 
+		EdgeData* mEdgeList;
+		/// List of shadow renderables
+		ShadowRenderableList mShadowRenderables;
+
+
+		/// 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);  
+
+	};
+}
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreBillboardSet.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreBillboardSet.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreBillboardSet.h	(revision 1812)
@@ -0,0 +1,835 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __BillboardSet_H__
+#define __BillboardSet_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreMovableObject.h"
+#include "OgreRenderable.h"
+#include "OgreRadixSort.h"
+#include "OgreCommon.h"
+
+namespace Ogre {
+
+    /** 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 mpMaterial;
+
+        /// 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 std::list<Billboard*> ActiveBillboardList;
+        typedef std::list<Billboard*> FreeBillboardList;
+        typedef std::vector<Billboard*> BillboardPool;
+
+        /** Active billboard list.
+            @remarks
+                This is a linked list of pointers to billboards in the billboard pool.
+            @par
+                This allows very fast instertions and deletions from anywhere in the list to activate / deactivate billboards
+                (required for particle systems etc)    as well as resuse 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)
+        //unsigned short* mpIndexes;
+        IndexData* mIndexData;
+
+        /// Flag indicating whether each billboard should be culled separately (default: false)
+        bool mCullIndividual;
+
+        typedef std::vector< Ogre::FloatRect > 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(unsigned int 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 bb Referenceto 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.
+        unsigned int mPoolSize;
+        /// Is external billboard data in use?
+        bool mExternalData;
+
+        /** 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 true, the source of data for drawing the 
+                billboards will not be the internal billboard list, but external 
+                data. When driving thebillboard 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::setAutoextendPool option.
+            @param
+                position The position of the new billboard realtive to the certer of the set
+            @param
+                colour Optional base colour of the billboard.
+            @returns
+                On success, a pointer to a newly created Billboard is
+                returned.
+            @par
+                On failiure (i.e. no more space and can't autoextend),
+                <b>NULL</b> 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::setAutoextendPool option.
+            @param
+                x
+            @param
+                y
+            @param
+                z The position of the new billboard realtive to the certer of the set
+            @param
+                colour Optional base colour of the billboard.
+            @returns
+                On success, a pointer to a newly created Billboard is
+                returned.
+            @par
+                On failiure (i.e. no more space and can't autoextend),
+                <b>NULL</b> 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 true to double the pool every time it runs out, 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(unsigned int size);
+
+        /** Returns the current size of the billboard pool.
+            @returns
+                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.
+            @returns
+                On success, a valid pointer to the requested billboard is
+                returned.
+            @par
+                On failiure, <b>NULL</b> 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.
+            @returns
+                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.
+            @returns
+                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);
+
+        /** Sets the name of the material to be used for this billboard set.
+            @returns 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.
+        */
+        void beginBillboards(void);
+        /** 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;
+
+        /** Overridden from MovableObject
+            @see
+                MovableObject
+        */
+        virtual void getRenderOperation(RenderOperation& op);
+
+        /** Overridden from MovableObject
+            @see
+                MovableObject
+        */
+        virtual void getWorldTransforms(Matrix4* xform) const;
+
+        /** @copydoc Renderable::getWorldOrientation */
+        const Quaternion& getWorldOrientation(void) const;
+        /** @copydoc Renderable::getWorldPosition */
+        const Vector3& getWorldPosition(void) 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 billbards 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 independant 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 calulated 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;
+
+        /** 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.
+          @par
+          @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;
+
+    };
+
+	/** 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);  
+
+	};
+
+
+}
+
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePose.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePose.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePose.h	(revision 1812)
@@ -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 © 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __OGRE_POSE_H
+#define __OGRE_POSE_H
+
+#include "OgrePrerequisites.h"
+#include "OgreString.h"
+#include "OgreHardwareVertexBuffer.h"
+#include "OgreVector3.h"
+#include "OgreIteratorWrappers.h"
+
+namespace Ogre {
+
+	/** 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:
+		/** 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 std::map<size_t, Vector3> VertexOffsetMap;
+		/// An iterator over the vertex offsets
+		typedef MapIterator<VertexOffsetMap> VertexOffsetIterator;
+		/// An iterator over the vertex offsets
+		typedef ConstMapIterator<VertexOffsetMap> ConstVertexOffsetIterator;
+
+		/** 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);
+
+		/** Remove a vertex offset. */
+		void removeVertex(size_t index);
+
+		/** Clear all vertex offsets. */
+		void clearVertexOffsets(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; }
+
+		/** Get a hardware vertex buffer version of the vertex offsets. */
+		const HardwareVertexBufferSharedPtr& _getHardwareVertexBuffer(size_t numVertices) 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;
+		/// Derived hardware buffer, covers all vertices
+		mutable HardwareVertexBufferSharedPtr mBuffer;
+	};
+	typedef std::vector<Pose*> PoseList;
+
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderWindow.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderWindow.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderWindow.h	(revision 1812)
@@ -0,0 +1,200 @@
+/*-------------------------------------------------------------------------
+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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License (LGPL) as 
+published by the Free Software Foundation; either version 2.1 of the 
+License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful, but 
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public 
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License 
+along with this library; if not, write to the Free Software Foundation, 
+Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA or go to
+http://www.gnu.org/copyleft/lesser.txt
+-------------------------------------------------------------------------*/
+#ifndef __RenderWindow_H__
+#define __RenderWindow_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreRenderTarget.h"
+
+namespace Ogre
+{
+    /** 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
+                colourDepth The colour depth in bits. Ignored if
+                fullScreen is false since the desktop depth is used.
+            @param
+                fullScreen If true, the window fills the screen,
+                with no title bar or border.
+            @param
+                left The x-position of the window. Ignored if
+                fullScreen = true.
+            @param
+                top The y-position of the window. Ignored if
+                fullScreen = true.
+            @param
+                depthBuffer Specify true to include a depth-buffer.
+            @param
+                miscParam 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;
+        
+        /** 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 externally.
+		@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; }
+
+        /** 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 wether 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;
+
+        /** Swaps the frame buffers to display the next frame.
+            @remarks
+                All render windows 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.
+
+            @param
+                waitForVSync If true, the system waits for the
+                next vertical blank period (when the CRT beam turns off
+                as it travels from bottom-right to top-left at the
+                end of the pass) before flipping. If false, flipping
+                occurs no matter what the beam position. Waiting for
+                a vertical blank can be slower (and limits the
+                framerate to the monitor refresh rate) but results
+                in a steadier image with no 'tearing' (a flicker
+                resulting from flipping buffers when the beam is
+                in the progress of drawing the last frame).
+        */
+        virtual void swapBuffers(bool waitForVSync = true) = 0;
+
+		/// @copydoc RenderTarget::update
+        virtual void update(void);
+        /** Updates the window contents.
+            @remarks
+                The window is updated by telling each camera which is supposed
+                to render into this window to render it's view, and then
+                the window buffers are swapped via swapBuffers() if requested
+			@param swapBuffers If set to true, the window 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);
+
+        /** 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);
+
+    protected:
+        bool mIsFullScreen;
+        bool mIsPrimary;
+        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;
+    };
+
+    /** Defines the interface a DLL implemeting a platform-specific version must implement.
+        @remarks
+            Any library (.dll, .so) wishing to implement a platform-specific version of this
+            dialog must export the symbol 'createRenderWindow' with the signature
+            void createPlatformRenderWindow(RenderWindow** ppDlg)
+    */
+    typedef void (*DLL_CREATERENDERWINDOW)(RenderWindow** ppWindow);
+
+} // Namespace
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreGpuProgramManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreGpuProgramManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreGpuProgramManager.h	(revision 1812)
@@ -0,0 +1,186 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __GpuProgramManager_H_
+#define __GpuProgramManager_H_
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+#include "OgreResourceManager.h"
+#include "OgreException.h"
+#include "OgreGpuProgram.h"
+#include "OgreSingleton.h"
+
+namespace Ogre {
+
+	class _OgreExport GpuProgramManager : public ResourceManager, public Singleton<GpuProgramManager>
+	{
+	public:
+		typedef std::set<String> SyntaxCodes;
+
+	protected:
+		/// Supported program syntax codes
+		SyntaxCodes mSyntaxCodes;
+        /// 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();
+
+        /** 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 prgram 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 { return mSyntaxCodes; };
+
+        /** 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) = 0;
+        
+        /** 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 prgram 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);
+
+        /** Internal method for populating the supported syntax codes, called by RenderSystem. */
+        virtual void _pushSyntaxCode(const String& syntaxCode) { mSyntaxCodes.insert(syntaxCode); }
+        /** Overrides the standard ResourceManager getByName 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 getByName(const String& name, bool preferHighLevelPrograms = true);
+        /** 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);
+    
+
+
+	};
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/Ogre.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/Ogre.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/Ogre.h	(revision 1812)
@@ -0,0 +1,124 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#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 "OgreEventProcessor.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 "OgreInput.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 "OgreOverlay.h"
+#include "OgreOverlayContainer.h"
+#include "OgreOverlayElement.h"
+#include "OgreOverlayManager.h"
+#include "OgreParticleAffector.h"
+#include "OgreParticleEmitter.h"
+#include "OgreParticleSystemManager.h"
+#include "OgrePass.h"
+#include "OgrePatchMesh.h"
+#include "OgrePatchSurface.h"
+#include "OgrePlatformManager.h"
+#include "OgreProfiler.h"
+#include "OgreRadixSort.h"
+#include "OgreRenderQueueInvocation.h"
+#include "OgreRenderQueueListener.h"
+#include "OgreRenderSystem.h"
+#include "OgreRenderTargetListener.h"
+#include "OgreRenderTexture.h"
+#include "OgreRenderWindow.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 "OgreTextureManager.h"
+#include "OgreTextureUnitState.h"
+#include "OgreUserDefinedObject.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"
+// .... more to come
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreExternalTextureSourceManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreExternalTextureSourceManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreExternalTextureSourceManager.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#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"
+
+namespace Ogre
+{
+	/** 
+	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:
+		/** 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 mpCurrExternalTextureSource; }
+	
+		/** 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 reistered 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* mpCurrExternalTextureSource;
+		
+        // Collection of loaded texture System PlugIns, keyed by registered type
+        typedef std::map< String, ExternalTextureSource*> TextureSystemList;
+        TextureSystemList mTextureSystems;
+    };
+} 
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreViewport.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreViewport.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreViewport.h	(revision 1812)
@@ -0,0 +1,306 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __Viewport_H__
+#define __Viewport_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreCommon.h"
+#include "OgreColourValue.h"
+
+namespace Ogre {
+    /** 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:
+        /** The usual constructor.
+            @param
+                cam 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
+            @param
+                top
+            @param
+                width
+            @param
+                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);
+
+        /** 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
+            @param
+                top
+            @param
+                width
+            @param
+                height 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);
+
+        /** Sets the initial background colour of the viewport (before
+            rendering).
+        */
+        void setBackgroundColour(const ColourValue& colour);
+
+        /** Gets the background colour.
+        */
+        const ColourValue& getBackgroundColour(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;
+
+		/** 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;
+
+        /** 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 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 The name of the RenderQueueInvocationSequence to use. If you
+			specify a blank string, behaviour will return to the defaul 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);
+
+    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;
+        /// ZOrder
+        int mZOrder;
+        /// Background options
+        ColourValue mBackColour;
+        bool mClearEveryFrame;
+		unsigned int mClearBuffers;
+        bool mUpdated;
+        bool mShowOverlays;
+        bool mShowSkies;
+		bool mShowShadows;
+		// Render queue invocation sequence name
+		String mRQSequenceName;
+		RenderQueueInvocationSequence* mRQSequence;
+		/// Material scheme
+		String mMaterialSchemeName;
+    };
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreHardwareBufferManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreHardwareBufferManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreHardwareBufferManager.h	(revision 1812)
@@ -0,0 +1,388 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __HardwareBufferManager__
+#define __HardwareBufferManager__
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+
+#include "OgreSingleton.h"
+#include "OgreHardwareVertexBuffer.h"
+#include "OgreHardwareIndexBuffer.h"
+
+
+namespace Ogre {
+
+    /** Abtract 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
+    {
+    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;
+    };
+
+
+    /** Abstract singleton class for managing hardware buffers, a concrete instance
+    of this will be created by the RenderSystem. */
+    class _OgreExport HardwareBufferManager : public Singleton<HardwareBufferManager>
+    {
+        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 std::set<HardwareVertexBuffer*> VertexBufferList;
+        typedef std::set<HardwareIndexBuffer*> IndexBufferList;
+        VertexBufferList mVertexBuffers;
+        IndexBufferList mIndexBuffers;
+
+
+        typedef std::set<VertexDeclaration*> VertexDeclarationList;
+		typedef std::set<VertexBufferBinding*> VertexBufferBindingList;
+        VertexDeclarationList mVertexDeclarations;
+		VertexBufferBindingList mVertexBufferBindings;
+
+
+        /// 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 std::multimap<HardwareVertexBuffer*, HardwareVertexBufferSharedPtr> FreeTemporaryVertexBufferMap;
+        /// Map of current available temp buffers 
+        FreeTemporaryVertexBufferMap mFreeTempVertexBufferMap;
+        /// Map from temporary buffer to details of a license
+        typedef std::map<HardwareVertexBuffer*, VertexBufferLicense> 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;
+
+
+        /// Creates  a new buffer as a copy of the source, does not copy data
+        HardwareVertexBufferSharedPtr makeBufferCopy(
+            const HardwareVertexBufferSharedPtr& source, 
+            HardwareBuffer::Usage usage, bool useShadowBuffer);
+
+    public:
+        HardwareBufferManager();
+        virtual ~HardwareBufferManager();
+		/** 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 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 themm 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 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;
+
+        /** 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 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 true, free all unused temporary buffers.
+            If 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);
+
+        /** 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);
+            
+    };
+
+}
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreOverlayElementFactory.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreOverlayElementFactory.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreOverlayElementFactory.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __OverlayElementFactory_H__
+#define __OverlayElementFactory_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreOverlayElement.h"
+#include "OgrePanelOverlayElement.h"
+#include "OgreBorderPanelOverlayElement.h"
+#include "OgreTextAreaOverlayElement.h"
+
+namespace Ogre {
+
+    /** 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 _OgreExport OverlayElementFactory
+    {
+    public:
+        /** 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 _OgreExport PanelOverlayElementFactory: public OverlayElementFactory
+    {
+    public:
+        /** See OverlayElementFactory */
+        OverlayElement* createOverlayElement(const String& instanceName)
+        {
+            return new PanelOverlayElement(instanceName);
+        }
+        /** See OverlayElementFactory */
+        const String& getTypeName(void) const
+        {
+            static String name = "Panel";
+            return name;
+        }
+    };
+
+    /** Factory for creating BorderPanelOverlayElement instances. */
+    class _OgreExport BorderPanelOverlayElementFactory: public OverlayElementFactory
+    {
+    public:
+        /** See OverlayElementFactory */
+        OverlayElement* createOverlayElement(const String& instanceName)
+        {
+            return new BorderPanelOverlayElement(instanceName);
+        }
+        /** See OverlayElementFactory */
+        const String& getTypeName(void) const
+        {
+            static String name = "BorderPanel";
+            return name;
+        }
+    };
+
+    /** Factory for creating TextAreaOverlayElement instances. */
+    class _OgreExport TextAreaOverlayElementFactory: public OverlayElementFactory
+    {
+    public:
+        /** See OverlayElementFactory */
+        OverlayElement* createOverlayElement(const String& instanceName)
+        {
+            return new TextAreaOverlayElement(instanceName);
+        }
+        /** See OverlayElementFactory */
+        const String& getTypeName(void) const
+        {
+            static String name = "TextArea";
+            return name;
+        }
+    };
+
+}
+
+
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCompositorInstance.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCompositorInstance.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCompositorInstance.h	(revision 1812)
@@ -0,0 +1,258 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __CompositorInstance_H__
+#define __CompositorInstance_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreMaterial.h"
+#include "OgreTexture.h"
+#include "OgreRenderQueue.h"
+namespace Ogre {
+    const size_t RENDER_QUEUE_COUNT = RENDER_QUEUE_OVERLAY+1;       
+            
+    /** An instance of a Compositor object for one Viewport. It is part of the CompositorChain
+		for a Viewport.
+     */
+    class _OgreExport CompositorInstance
+    {
+    public:
+        CompositorInstance(Compositor *filter, 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 miscelleneous parameters that are different
+				per Compositor instance can be set up.
+				@param pass_id	Pass identifier within Compositor instance, this is speficied 
+								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 speficied 
+								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);
+		};
+        /** 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 RenderSystemOperation
+		{
+		public:
+			virtual ~RenderSystemOperation();
+			/// Set state to SceneManager and RenderSystem
+			virtual void execute(SceneManager *sm, RenderSystem *rs) = 0;
+		};
+		typedef std::map<int, MaterialPtr> QuadMaterialMap;
+		typedef std::pair<int, RenderSystemOperation*> RenderSystemOpPair;
+		typedef std::vector<RenderSystemOpPair> RenderSystemOpPairs;
+        /** Operation setup for a RenderTarget (collected).
+        */
+        class TargetOperation
+        {
+        public:
+            TargetOperation()
+            { 
+            }
+            TargetOperation(RenderTarget *target):
+                target(target), currentQueueGroupID(0), visibilityMask(0xFFFFFFFF),
+                lodBias(1.0f),
+                onlyInitial(false), hasBeenRendered(false), findVisibleObjects(false)
+            { 
+            }
+            /// 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;
+        };
+        typedef std::vector<TargetOperation> CompiledState;
+        
+        /** Set enabled flag. The compositor instance will only render if it is
+            enabled, otherwise it is pass-through.
+        */
+        void setEnabled(bool value);
+        
+        /** Get enabled flag.
+        */
+        bool getEnabled();
+
+		/** 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 renable the compositor instance.
+		@param name The name of the texture in the original compositor definition
+		@returns The instance name for the texture, corresponds to a real texture
+		*/
+		const String& getTextureInstanceName(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 seperately 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();
+
+		/** 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);
+	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;
+        /// Map from name->local texture
+        typedef std::map<String,TexturePtr> LocalTextureMap;
+        LocalTextureMap mLocalTextures;
+
+		/// Vector of listeners
+		typedef std::vector<Listener*> 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();
+        
+        /** Create local rendertextures and other resources. Builds mLocalTextures.
+        */
+        void createResources();
+        
+        /** Destroy local rendertextures and other resources.
+        */
+        void freeResources();
+
+        /** Get RenderTarget for a named local texture.
+        */
+        RenderTarget *getTargetForTex(const String &name);
+        
+        /** Get source texture name for a named local texture.
+        */
+        const String &getSourceForTex(const String &name);
+
+		/** Queue a render system operation.
+			@returns destination pass
+		 */
+		void queueRenderSystemOp(TargetOperation &finalState, RenderSystemOperation *op);
+        
+        friend class CompositorChain;
+    };
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreNode.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreNode.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreNode.h	(revision 1812)
@@ -0,0 +1,743 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _Node_H__
+#define _Node_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreMatrix3.h"
+#include "OgreMatrix4.h"
+#include "OgreQuaternion.h"
+#include "OgreString.h"
+#include "OgreRenderable.h"
+#include "OgreIteratorWrappers.h"
+
+namespace Ogre {
+
+
+    /** 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 Renderable
+    {
+    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) {}
+			/** Node is being destroyed */
+			virtual void nodeDestroyed(const Node* node) {};
+			/** Node has been attached to a parent */
+			virtual void nodeAttached(const Node* node) {};
+			/** Node has been detached from a parent */
+			virtual void nodeDetached(const Node* node) {};
+		};
+
+    protected:
+        /// Pointer to parent node
+        Node* mParent;
+        /// Collection of pointers to direct children; hashmap for efficiency
+        ChildNodeMap mChildren;
+
+		typedef std::set<Node*> 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 unsigned long msNextGeneratedNameExt;
+
+        /// 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;
+
+		/// Material pointer should this node be rendered
+		mutable MaterialPtr mpMaterial;
+
+        /// 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;
+
+        /** 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;
+
+        // Weight of applied animations so far, used for blending
+        Real mAccumAnimWeight;
+        // The total weighted translation from the initial state so far
+        Vector3 mTransFromInitial;
+        // The total weighted rotation from the initial state so far
+        Quaternion mRotFromInitial;
+        // The total weighted scale from the initial state so far
+        Vector3 mScaleFromInitial;
+
+        /// 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 std::vector<Node*> QueuedUpdates;
+		static QueuedUpdates msQueuedUpdates;
+
+
+    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
+            Orientatings, unlike other transforms, are not always inherited by child nodes.
+            Whether or not orientatings 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
+            Orientatings, unlike other transforms, are not always inherited by child nodes.
+            Whether or not orientatings 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
+            Orientatings, unlike other transforms, are not always inherited by child nodes.
+            Whether or not orientatings 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
+            Orientatings, unlike other transforms, are not always inherited by child nodes.
+            Whether or not orientatings 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
+            Orientatings, unlike other transforms, are not always inherited by child nodes.
+            Whether or not orientatings 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
+            @param
+                y
+            @param
+                z Real x, y and z values 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 containg 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 containg 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,y,z Translation components 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);
+#ifndef OGRE_FORCE_ANGLE_TYPES
+        inline void roll(Real degrees, TransformSpace relativeTo = TS_LOCAL) {
+			roll ( Angle(degrees), relativeTo );
+		}
+#endif//OGRE_FORCE_ANGLE_TYPES
+
+        /** Rotate the node around the X-axis.
+        */
+        virtual void pitch(const Radian& angle, TransformSpace relativeTo = TS_LOCAL);
+#ifndef OGRE_FORCE_ANGLE_TYPES
+        inline void pitch(Real degrees, TransformSpace relativeTo = TS_LOCAL) {
+			pitch ( Angle(degrees), relativeTo );
+		}
+#endif//OGRE_FORCE_ANGLE_TYPES
+
+        /** Rotate the node around the Y-axis.
+        */
+        virtual void yaw(const Radian& angle, TransformSpace relativeTo = TS_LOCAL);
+#ifndef OGRE_FORCE_ANGLE_TYPES
+        inline void yaw(Real degrees, TransformSpace relativeTo = TS_LOCAL) {
+			yaw ( Angle(degrees), relativeTo );
+		}
+#endif//OGRE_FORCE_ANGLE_TYPES
+
+        /** Rotate the node around an arbitrary axis.
+        */
+        virtual void rotate(const Vector3& axis, const Radian& angle, TransformSpace relativeTo = TS_LOCAL);
+#ifndef OGRE_FORCE_ANGLE_TYPES
+        inline void rotate(const Vector3& axis, Real degrees, TransformSpace relativeTo = TS_LOCAL) {
+			rotate ( axis, Angle(degrees), relativeTo );
+		}
+#endif//OGRE_FORCE_ANGLE_TYPES
+
+        /** 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);
+
+        /** 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 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 xform has changed,
+                    so the child should retrieve the parent's xform 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; }
+		
+		/** Overridden from Renderable.
+        @remarks
+            This is only used if the SceneManager chooses to render the node. This option can be set
+            for SceneNodes at SceneManager::setDisplaySceneNodes, and for entities based on skeletal 
+            models using Entity::setDisplayBones()
+        */
+        const MaterialPtr& getMaterial(void) const;
+        /** Overridden from Renderable.
+        @remarks
+            This is only used if the SceneManager chooses to render the node. This option can be set
+            for SceneNodes at SceneManager::setDisplaySceneNodes, and for entities based on skeletal 
+            models using Entity::setDisplaySkeleton()
+        */
+        void getRenderOperation(RenderOperation& op);
+        /** Overridden from Renderable.
+        @remarks
+            This is only used if the SceneManager chooses to render the node. This option can be set
+            for SceneNodes at SceneManager::setDisplaySceneNodes, and for entities based on skeletal 
+            models using Entity::setDisplaySkeleton()
+        */
+        void getWorldTransforms(Matrix4* xform) const;
+        /** @copydoc Renderable::getWorldOrientation */
+        const Quaternion& getWorldOrientation(void) const;
+        /** @copydoc Renderable::getWorldPosition */
+        const Vector3& getWorldPosition(void) const;
+
+        /** 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 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;
+
+        /** Internal weighted transform method.
+        @remarks
+            This method transforms a Node by a weighted amount from it's
+            initial state. If weighted transforms have already been applied, 
+            the previous transforms and this one are blended together based
+            on their relative weight. This method should not be used in
+            combination with the unweighted rotate, translate etc methods.
+        */
+        virtual void _weightedTransform(Real weight, const Vector3& translate, 
+            const Quaternion& rotate, const Vector3& scale);
+
+        /** Overridden, see Renderable */
+        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);
+
+		/** Queue a 'needUpdate' call to a node safely.
+		@ramarks
+			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);
+
+        /** @copydoc Renderable::getLights */
+        const LightList& getLights(void) const;
+
+
+
+    };
+
+} //namespace
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreHardwareBuffer.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreHardwareBuffer.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreHardwareBuffer.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __HardwareBuffer__
+#define __HardwareBuffer__
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+    /** 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:
+		    /// 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 statuc buffers, ie those created without the HBU_DYNAMIC flag. 
+				*/ 
+			    HBL_READ_ONLY,
+                /** As HBL_NORMAL, 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
+    			
+		    };
+	    protected:
+		    size_t mSizeInBytes;
+		    Usage mUsage;
+		    bool mIsLocked;
+			size_t mLockStart;
+			size_t mLockSize;
+			bool mSystemMemory;
+            bool mUseShadowBuffer;
+            HardwareBuffer* mpShadowBuffer;
+            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), mSystemMemory(systemMemory), 
+                mUseShadowBuffer(useShadowBuffer), mpShadowBuffer(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
+		    @returns 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;
+				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 = mpShadowBuffer->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
+		    @returns 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 && mpShadowBuffer->isLocked())
+                {
+                    mpShadowBuffer->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();
+			}
+
+            /// 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 = mpShadowBuffer->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();
+                    mpShadowBuffer->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 && mpShadowBuffer->isLocked()); 
+            }
+            /// Pass true to suppress hardware upload of shadow buffer changes
+            void suppressHardwareUpdate(bool suppress) {
+                mSuppressHardwareUpdate = suppress;
+                if (!suppress)
+                    _updateFromShadow();
+            }
+
+
+
+
+    		
+    };
+}
+#endif
+
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreAny.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreAny.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreAny.h	(revision 1812)
@@ -0,0 +1,401 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) Any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+Any WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+// -- 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>
+
+
+namespace Ogre
+{
+	/** Variant type that can hold Any other type.
+	*/
+    class Any
+    {
+    public: // constructors
+
+        Any()
+          : mContent(0)
+        {
+        }
+
+        template<typename ValueType>
+        explicit Any(const ValueType & value)
+          : mContent(new holder<ValueType>(value))
+        {
+        }
+
+        Any(const Any & other)
+          : mContent(other.mContent ? other.mContent->clone() : 0)
+        {
+        }
+
+        virtual ~Any()
+        {
+            delete mContent;
+        }
+
+    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;
+		}
+
+
+    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 new holder(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()");
+			}
+		}
+
+		
+
+    };
+
+
+	/** 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 = new numholder<ValueType>(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 new numholder(held);
+			}
+
+			virtual placeholder* add(placeholder* rhs)
+			{
+				return new numholder(held + static_cast<numholder*>(rhs)->held);
+			}
+			virtual placeholder* subtract(placeholder* rhs)
+			{
+				return new numholder(held - static_cast<numholder*>(rhs)->held);
+			}
+			virtual placeholder* multiply(placeholder* rhs)
+			{
+				return new numholder(held * static_cast<numholder*>(rhs)->held);
+			}
+			virtual placeholder* multiply(Real factor)
+			{
+				return new numholder(held * factor);
+			}
+			virtual placeholder* divide(placeholder* rhs)
+			{
+				return new numholder(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 && operand->getType() == typeid(ValueType)
+                    ? &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;
+    }
+
+
+}
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreShadowCaster.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreShadowCaster.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreShadowCaster.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __ShadowCaster_H__
+#define __ShadowCaster_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreRenderable.h"
+
+
+namespace Ogre {
+
+
+    /** 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
+    {
+    protected:
+        MaterialPtr mMaterial;
+        RenderOperation mRenderOp;
+        ShadowRenderable* mLightCap; // used only if isLightCapSeparate == true
+    public:
+        ShadowRenderable() : mMaterial(0), 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(MaterialPtr& mat) { mMaterial = mat; }
+        /// Overridden from Renderable
+        const MaterialPtr& getMaterial(void) const { return mMaterial; }
+        /// Overridden from Renderable
+        void getRenderOperation(RenderOperation& op) { op = mRenderOp; }
+        /// Get the internal render operation for set up
+        RenderOperation* getRenderOperationForUpdate(void) {return &mRenderOp;}
+        /// Overridden from Renderable
+        void getWorldTransforms(Matrix4* xform) const = 0;
+        /// Overridden from Renderable
+        const Quaternion& getWorldOrientation(void) const = 0;
+        /// Overridden from Renderable
+        const Vector3& getWorldPosition(void) const = 0;
+        /// Overridden from Renderable
+        Real getSquaredViewDepth(const Camera* cam) const{ return 0; /* not used */}
+        /// Overridden from Renderable
+        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; }
+
+    };
+
+    /** 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;
+
+        /** 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 std::vector<ShadowRenderable*> 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 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, 
+            bool extrudeVertices, Real extrusionDistance, unsigned long flags = 0 ) = 0;
+
+        /** Utility method for extruding vertices based on a light. 
+        @remarks
+            Unfortunately, because D3D cannot handle homogenous (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, ie 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(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 moethod 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 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, 
+            HardwareIndexBufferSharedPtr indexBuffer, 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;
+
+
+    };
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCamera.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCamera.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCamera.h	(revision 1812)
@@ -0,0 +1,542 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://ogre.sourceforge.net/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#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"
+
+
+namespace Ogre {
+
+
+
+    /** 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 frustrum,
+            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
+    {
+    protected:
+        /// Camera name
+        String mName;
+        /// 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;
+
+        /// 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 std::vector<Plane> mWindowClipPlanes;
+        // Was viewing window changed.
+        mutable bool mRecalcWindow;
+        /// The last viewport to be added using this camera
+        Viewport* mLastViewport;
+        /** Whether aspect ratio will automaticaally be recalculated 
+            when a vieport 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;
+
+
+        // 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;
+        /** Get the derived position of this frustum. */
+        const Vector3& getPositionForViewUpdate(void) const;
+        /** Get the derived orientation of this frustum. */
+        const Quaternion& getOrientationForViewUpdate(void) const;
+
+
+    public:
+        /** Standard constructor.
+        */
+        Camera( const String& name, SceneManager* sm);
+
+        /** Standard destructor.
+        */
+        virtual ~Camera();
+
+
+        /** Returns a pointer to the SceneManager this camera is rendering through.
+        */
+        SceneManager* getSceneManager(void) const;
+
+        /** Gets the camera's name.
+        */
+        virtual const String& getName(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
+            @param
+                y
+            @param
+                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);
+#ifndef OGRE_FORCE_ANGLE_TYPES
+        void roll(Real degrees) { roll ( Angle(degrees) ); }
+#endif//OGRE_FORCE_ANGLE_TYPES
+
+        /** Rotates the camera anticlockwise around it's local y axis.
+        */
+        void yaw(const Radian& angle);
+#ifndef OGRE_FORCE_ANGLE_TYPES
+        void yaw(Real degrees) { yaw ( Angle(degrees) ); }
+#endif//OGRE_FORCE_ANGLE_TYPES
+
+        /** Pitches the camera up/down anticlockwise around it's local z axis.
+        */
+        void pitch(const Radian& angle);
+#ifndef OGRE_FORCE_ANGLE_TYPES
+        void pitch(Real degrees) { pitch ( Angle(degrees) ); }
+#endif//OGRE_FORCE_ANGLE_TYPES
+
+        /** Rotate the camera around an arbitrary axis.
+        */
+        void rotate(const Vector3& axis, const Radian& angle);
+#ifndef OGRE_FORCE_ANGLE_TYPES
+        void rotate(const Vector3& axis, Real degrees) { rotate ( axis, Angle(degrees) ); }
+#endif//OGRE_FORCE_ANGLE_TYPES
+
+        /** Rotate the camera around an aritrary axis using a Quarternion.
+        */
+        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 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.
+        */
+        friend std::ostream& operator<<(std::ostream& o, Camera& c);
+
+        /** Internal method to notify camera of the visible faces in the last render.
+        */
+        void _notifyRenderedFaces(unsigned int numfaces);
+
+        /** Internal method to retrieve the number of visible faces in the last render.
+        */
+        unsigned int _getNumRenderedFaces(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 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* 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;
+
+
+
+        /** 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;
+
+		/** 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 std::vector<Plane>& 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 vieport 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);
+
+        /** Retreives 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) { return mCullFrustum; }
+
+		/// @copydoc Frustum::isVisible
+		bool isVisible(const AxisAlignedBox& bound, FrustumPlane* culledBy = 0) const;
+		/// @copydoc Frustum::isVisible
+		bool isVisible(const Sphere& bound, FrustumPlane* culledBy = 0) const;
+		/// @copydoc Frustum::isVisible
+		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; }
+     };
+
+} // namespace Ogre
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreStringVector.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreStringVector.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreStringVector.h	(revision 1812)
@@ -0,0 +1,41 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _StringVector_H__
+#define _StringVector_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreString.h"
+#include "OgreSharedPtr.h"
+
+
+namespace Ogre {
+
+    typedef std::vector<String> StringVector;
+    typedef SharedPtr<StringVector> StringVectorPtr;
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreTextAreaOverlayElement.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreTextAreaOverlayElement.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreTextAreaOverlayElement.h	(revision 1812)
@@ -0,0 +1,248 @@
+/*-------------------------------------------------------------------------
+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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This library is free software; you can redistribute it and/or modify it
+under the terms of the GNU Lesser General Public License (LGPL) as 
+published by the Free Software Foundation; either version 2.1 of the 
+License, or (at your option) any later version.
+
+This library is distributed in the hope that it will be useful, but 
+WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
+or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public 
+License for more details.
+
+You should have received a copy of the GNU Lesser General Public License 
+along with this library; if not, write to the Free Software Foundation, 
+Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA or go to
+http://www.gnu.org/copyleft/lesser.txt
+-------------------------------------------------------------------------*/
+
+#ifndef _TextAreaOverlayElement_H__
+#define _TextAreaOverlayElement_H__
+
+#include "OgreOverlayElement.h"
+#include "OgreFont.h"
+
+namespace Ogre
+{
+    /** This class implements an overlay element which contains simple unformatted text.
+    */
+    class _OgreExport TextAreaOverlayElement : public OverlayElement
+    {
+    public:
+        enum Alignment
+        {
+            Left,
+            Right,
+            Center
+        };
+
+    public:
+        /** Constructor. */
+        TextAreaOverlayElement(const String& name);
+        virtual ~TextAreaOverlayElement();
+
+        virtual void initialise(void);
+        void setCaption( const String& caption );
+        const String& getCaption() const;
+
+        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. */
+        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 mpFont;
+        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: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCompositor.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCompositor.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCompositor.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __Compositor_H__
+#define __Compositor_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreResource.h"
+
+namespace Ogre {
+    /** 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 std::vector<CompositionTechnique *> 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);
+    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;
+    };
+
+    /** Specialisation of SharedPtr to allow SharedPtr to be assigned to CompositorPtr 
+    @note Has to be a subclass since we need operator=.
+    We could templatise this instead of repeating per Resource subclass, 
+    except to do so requires a form VC6 does not support i.e.
+    ResourceSubclassPtr<T> : public SharedPtr<T>
+    */
+    class _OgreExport CompositorPtr : public SharedPtr<Compositor> 
+    {
+    public:
+        CompositorPtr() : SharedPtr<Compositor>() {}
+        explicit CompositorPtr(Compositor* rep) : SharedPtr<Compositor>(rep) {}
+        CompositorPtr(const CompositorPtr& r) : SharedPtr<Compositor>(r) {} 
+        CompositorPtr(const ResourcePtr& r) : SharedPtr<Compositor>()
+        {
+            // lock & copy other mutex pointer
+            OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME)
+            {
+                OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
+                OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
+                pRep = static_cast<Compositor*>(r.getPointer());
+                pUseCount = r.useCountPointer();
+                if (pUseCount)
+                {
+                    ++(*pUseCount);
+                }
+            }
+        }
+
+        /// Operator used to convert a ResourcePtr to a CompositorPtr
+        CompositorPtr& operator=(const ResourcePtr& r)
+        {
+            if (pRep == static_cast<Compositor*>(r.getPointer()))
+                return *this;
+            release();
+            // lock & copy other mutex pointer
+            OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME)
+            {
+                OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
+                OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
+                pRep = static_cast<Compositor*>(r.getPointer());
+                pUseCount = r.useCountPointer();
+                if (pUseCount)
+                {
+                    ++(*pUseCount);
+                }
+            }
+            return *this;
+        }
+    };
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreException.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreException.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreException.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __Exception_H_
+#define __Exception_H_
+
+// Precompiler options
+#include "OgrePrerequisites.h"
+
+#include "OgreString.h"
+
+#define OGRE_EXCEPT( num, desc, src ) throw( Ogre::Exception( num, desc, src, __FILE__, __LINE__ ) )
+
+// Stack unwinding options
+// OgreUnguard and OgreUnguardRet are deprecated
+#if OGRE_STACK_UNWINDING == 1
+#   if OGRE_COMPILER != OGRE_COMPILER_BORL
+#       define OgreGuard( a ) Ogre::AutomaticGuardUnguard _auto_guard_object( (a) )
+#   else
+#       define OgreGuard( a ) Ogre::AutomaticGuardUnguard _auto_guard_object( __FUNC__ )
+#   endif
+
+#   define OgreUnguard() 
+#   define OgreUnguardRet( a ) return a
+
+#else
+#   define OgreGuard( a )
+#   define OgreUnguard()
+#   define OgreUnguardRet( a ) return a
+
+#endif
+
+// Backwards compatibility with old assert mode definitions
+#if OGRE_RELEASE_ASSERT == 1
+#   define OGRE_ASSERT_MODE 1
+#endif
+
+// Check for OGRE assert mode
+
+// RELEASE_EXCEPTIONS mode
+#if OGRE_ASSERT_MODE == 1
+#   ifdef _DEBUG
+#       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
+
+#define OGRE_CALL_STACK_DEPTH 512
+
+namespace Ogre {
+    /** 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
+    {
+    protected:
+        long line;
+        int number;
+        String description;
+        String source;
+        String file;
+        ushort stackDepth;
+        static Exception* last;
+
+        static String msFunctionStack[ OGRE_CALL_STACK_DEPTH ];
+        static ushort   msStackDepth;
+    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 {
+            UNIMPLEMENTED_FEATURE,
+            ERR_CANNOT_WRITE_TO_FILE,
+            ERR_NO_RENDERSYSTEM_SELECTED,
+            ERR_DIALOG_OPEN_ERROR,
+            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* file, long line );
+
+        /** Copy constructor.
+        */
+        Exception(const Exception& rhs);
+
+        /** 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.
+        */
+        String getFullDescription(void) const;
+
+        /** Gets the error code.
+        */
+        int getNumber(void) const throw();
+
+        /** Gets the source function.
+        */
+        const String &getSource() const { return source; }
+
+        /** Gets source file name.
+        */
+        const String &getFile() const { return file; }
+
+        /** Gets line number.
+        */
+        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.
+        */
+		const String &getDescription(void) const { return description; }
+
+        /** Retrieves a pointer to the last exception created.
+        */
+        static Exception* getLastException(void) throw();
+
+        /** Pushes a function on the stack.
+        */
+        static void _pushFunction( const String& strFuncName ) throw();
+        /** Pops a function from the stack.
+        */
+        static void _popFunction() throw();
+
+        
+    };
+
+    /** Internal class. Objects will automatically push/pop the function name for unwinding. */
+    class _OgreExport AutomaticGuardUnguard {
+    public:
+        AutomaticGuardUnguard(const String& funcName) throw()
+        {
+            Exception::_pushFunction(funcName);
+        }
+        ~AutomaticGuardUnguard() throw()
+        {
+            Exception::_popFunction();
+        }
+    };
+
+} // Namespace Ogre
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreStringConverter.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreStringConverter.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreStringConverter.h	(revision 1812)
@@ -0,0 +1,231 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __StringConverter_H__
+#define __StringConverter_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreMath.h"
+#include "OgreString.h"
+#include "OgreStringVector.h"
+
+namespace Ogre {
+
+    /** 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) );
+        /** 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_ARCH_TYPE == OGRE_ARCHITECTURE_64 || OGRE_PLATFORM == OGRE_PLATFORM_APPLE
+        /** 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 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 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 delimeter in
+            the output.
+        */
+        static String toString(const StringVector& val);
+
+        /** Converts a String to a Real. 
+        @returns
+            0.0 if the value could not be parsed, otherwise the Real version of the String.
+        */
+        static Real parseReal(const String& val);
+        /** Converts a String to a Angle. 
+        @returns
+            0.0 if the value could not be parsed, otherwise the Angle version of the String.
+        */
+        static inline Radian parseAngle(const String& val) {
+			return Angle(parseReal(val));
+		}
+        /** Converts a String to a whole number. 
+        @returns
+            0.0 if the value could not be parsed, otherwise the numeric version of the String.
+        */
+        static int parseInt(const String& val);
+        /** Converts a String to a whole number. 
+        @returns
+            0.0 if the value could not be parsed, otherwise the numeric version of the String.
+        */
+        static unsigned int parseUnsignedInt(const String& val);
+        /** Converts a String to a whole number. 
+        @returns
+            0.0 if the value could not be parsed, otherwise the numeric version of the String.
+        */
+        static long parseLong(const String& val);
+        /** Converts a String to a whole number. 
+        @returns
+            0.0 if the value could not be parsed, otherwise the numeric version of the String.
+        */
+        static unsigned long parseUnsignedLong(const String& val);
+        /** Converts a String to a boolean. 
+        @remarks
+            Accepts 'true' or 'false' as input.
+        */
+        static bool parseBool(const String& val);
+        /** 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);
+        /** 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);
+        /** 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);
+        /** 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);
+        /** 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);
+
+        /** Pareses a StringVector from a string.
+        @remarks
+            Strings must not contain spaces since space is used as a delimeter in
+            the output.
+        */
+        static StringVector parseStringVector(const String& val);
+        /** Checks the String is a valid number value. */
+        static bool isNumber(const String& val);
+    };
+
+
+}
+
+
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCompositorChain.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCompositorChain.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCompositorChain.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __CompositorChain_H__
+#define __CompositorChain_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreRenderTargetListener.h"
+#include "OgreRenderQueueListener.h"
+#include "OgreCompositorInstance.h"
+#include "OgreCompositor.h"
+namespace Ogre {
+    
+    /** Chain of compositor effects applying to one viewport.
+     */
+    class _OgreExport CompositorChain: public RenderTargetListener
+    {
+    public:
+        CompositorChain(Viewport *vp);
+        /** Another gcc warning here, which is no problem because RenderTargetListener is never used
+            to delete an object.
+            warning: `class Ogre::CompositorChain' has virtual functions but non-virtual destructor
+        */
+        virtual ~CompositorChain();
+        
+        /// Data types
+        typedef std::vector<CompositorInstance*> 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 technique      Technique to use; CompositorChain::BEST (default) chooses to the best one 
+                            available (first technique supported)
+        */
+        CompositorInstance* addCompositor(CompositorPtr filter, size_t addPosition=LAST, size_t technique=BEST);
+    
+        /** 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 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::preViewportUpdate */
+        virtual void preViewportUpdate(const RenderTargetViewportEvent& evt);
+        /** @see RenderTargetListener::postViewportUpdate */
+        virtual void postViewportUpdate(const RenderTargetViewportEvent& evt);
+		/** @see RenderTargetListener::viewportRemoved */
+		virtual void viewportRemoved(const RenderTargetViewportEvent& evt);
+        
+        /** 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);
+
+    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;
+
+        /// 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 std::vector<CompositorInstance::RenderSystemOperation*> RenderSystemOperations;
+		RenderSystemOperations mRenderSystemOperations;
+
+        
+		/** Clear compiled state */
+		void clearCompiledState();
+
+		/** Compile this Composition chain into a series of RenderTarget operations.
+        */
+        void _compile();
+        
+        /** 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);
+
+		/// destroy internal resources
+		void destroyResources(void);
+
+		/** Render queue listener used to set up rendering events. */
+		class RQListener: public RenderQueueListener
+		{
+		public:
+			/** @copydoc RenderQueueListener::renderQueueStarted
+			*/
+			virtual void renderQueueStarted(uint8 id, const String& invocation, bool& skipThisQueue);
+			/** @copydoc RenderQueueListener::renderQueueEnded
+			*/
+			virtual void renderQueueEnded(uint8 id, const String& invocation, bool& repeatThisQueue);
+
+			/** 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;
+    };
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreFactoryObj.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreFactoryObj.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreFactoryObj.h	(revision 1812)
@@ -0,0 +1,61 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _FactoryObj_H__
+#define _FactoryObj_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+    /** 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* ) = 0;    
+    };
+
+} // namespace
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreGpuProgramUsage.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreGpuProgramUsage.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreGpuProgramUsage.h	(revision 1812)
@@ -0,0 +1,125 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __GpuProgramUsage_H__
+#define __GpuProgramUsage_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreGpuProgram.h"
+
+
+namespace Ogre 
+{
+    /** 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
+    {
+    protected:
+        GpuProgramType mType;
+        // The program link
+        GpuProgramPtr mProgram;
+
+        /// program parameters
+        GpuProgramParametersSharedPtr mParameters;
+
+
+    public:
+        /** Default constructor.
+        @param gptype The type of program to link to
+        */
+        GpuProgramUsage(GpuProgramType gptype);
+
+		/** Copy constructor */
+		GpuProgramUsage(const GpuProgramUsage& rhs);
+
+        /** 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);
+
+    };
+}
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreErrorDialog.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreErrorDialog.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreErrorDialog.h	(revision 1812)
@@ -0,0 +1,64 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __ERRORDIALOG_H__
+#define __ERRORDIALOG_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreString.h"
+
+namespace Ogre {
+
+    /** Class for displaying the error dialog if Ogre fails badly.
+    */
+    class _OgreExport ErrorDialog
+    {
+    public:
+    	virtual ~ErrorDialog();
+    	
+        /** 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.
+        */
+        virtual void display(const String& errorMessage, String logName = "") = 0;
+
+    };
+
+    /** Defines the interface a platform-specific library must implement.
+        @remarks
+            Any library (.dll, .so) wishing to implement a platform-specific
+            version of this dialog must export the symbol 'createErrorDialog'
+            with the signature void
+            createPlatformErrorDialog(ErrorDialog** ppDlg)
+    */
+    typedef void (*DLL_CREATEERRORDIALOG)(ErrorDialog** ppDlg);
+}
+
+
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreEventListeners.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreEventListeners.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreEventListeners.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+/***************************************************************************
+OgreEventListeners.h  -  
+	This file contains definatitions of all the different EventListeners.
+	They are all included in 1 file, due to their small size.
+
+	They all inherit from an abstract base listener called EventListener.
+
+	So far we have the following listeners:
+		MouseListener - handles mouse buttons clicked, pressed released,
+						and mouse entered,exited, 
+		MouseMotionListener - handles mouse move and mouse drag
+		ActionListener - Used for buttons, when pressed and released.
+
+-------------------
+begin                : Nov 19 2002
+copyright            : (C) 2002 by Kenny Sabir
+email                : kenny@sparksuit.com
+***************************************************************************/
+
+#ifndef __MouseListener_H__
+#define __MouseListener_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreMouseEvent.h"
+
+namespace Ogre {
+
+    class _OgreExport EventListener 
+    {
+	public:
+		virtual ~EventListener() {}
+	};
+    
+	/** Specialised EventListener for discrete mouse events.
+	@remarks
+		This excludes mouse motion (this is not a discrete event), see
+		MouseMotionListener for that.
+	*/
+	class _OgreExport MouseListener : public EventListener
+    {
+	public :
+		/**
+		 * Invoked when the mouse has been clicked on a component.
+		 */
+		virtual void mouseClicked(MouseEvent* e) = 0;
+		/**
+		 * Invoked when the mouse enters a component.
+		 */
+		virtual void mouseEntered(MouseEvent* e) = 0;
+		/**
+		 * Invoked when the mouse exits a component.
+		 */
+		virtual void mouseExited(MouseEvent* e) = 0;
+
+		/**
+		 * Invoked when a mouse button has been pressed on a component.
+		 */
+		virtual void mousePressed(MouseEvent* e) = 0;
+		/**
+		 * Invoked when a mouse button has been released on a component.
+		 */
+		virtual void mouseReleased(MouseEvent* e) = 0;
+
+        virtual void mouseDragEntered(MouseEvent* e) {};
+        virtual void mouseDragExited(MouseEvent* e) {};
+        virtual void mouseDragDropped(MouseEvent* e) {};
+
+    };
+
+
+	class _OgreExport KeyListener : public EventListener
+    {
+    protected:
+
+	public :
+		/**
+		 * Invoked when the key has been clicked on a component.
+		 */
+		virtual void keyClicked(KeyEvent* e) = 0;
+		/**
+		 * Invoked when a key button has been pressed on a component.
+		 */
+		virtual void keyPressed(KeyEvent* e) = 0;
+		/**
+		 * Invoked when a key button has been released on a component.
+		 */
+		virtual void keyReleased(KeyEvent* e) = 0;
+		/**
+		 * Invoked when the target receives the keyboard focus
+		 */
+        virtual void keyFocusIn(KeyEvent* e) {}
+		/**
+		 * Invoked when the target loses the keyboard focus
+		 */
+        virtual void keyFocusOut(KeyEvent* e) {}
+
+    };
+
+	/** Specialised EventListener for mouse motion. */
+	class _OgreExport MouseMotionListener : public EventListener
+    {
+    protected:
+
+	public :
+		/**
+		 * Invoked when the mouse has been moved
+		 */
+		virtual void mouseMoved(MouseEvent* e) = 0;
+		/**
+		 * Invoked when the mouse dragged
+		 */
+		virtual void mouseDragged(MouseEvent* e) = 0;
+        /**
+         * sent to target
+         */
+        virtual void mouseDragMoved(MouseEvent* e) {};
+    };
+
+
+
+}
+
+
+#endif  // __MouseListener_H__
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreLogManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreLogManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreLogManager.h	(revision 1812)
@@ -0,0 +1,195 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __LogManager_H__
+#define __LogManager_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreLog.h"
+#include "OgreSingleton.h"
+#include "OgreString.h"
+
+namespace Ogre {
+
+	/** The log listener is here to provide alternate means to write out 
+	    log data. This is helpful if you want to redirect the log output
+		for example to a gui window for an editing application.
+	*/
+	class _OgreExport LogListener
+	{
+	public:
+		/** Called by the log system whenever a message needs to be output.
+		*/
+		virtual void write( const String& name,
+							const String& message, 
+							LogMessageLevel lml = LML_NORMAL, 
+							bool maskDebug = false ) = 0;
+		virtual ~LogListener();
+	};
+
+    /** 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>
+    {
+		friend class Log;
+
+	protected:
+
+		/** Internal helper method to reroute logging messages to the 
+			new listener system, while maintaining full backward compatiblity.
+		*/
+		void _routeMessage(	const String& name,
+							const String& message, 
+							LogMessageLevel lml = LML_NORMAL, 
+							bool maskDebug = false );
+
+        typedef std::map<String, Log*, std::less<String> >	LogList;
+		typedef std::vector<LogListener*>					LogListenerList;
+
+        /// A list of all the logs the manager can access
+        LogList mLogs;
+
+        /// The default log to which output is done
+        Log* mDefaultLog;
+
+		/// A list of all registered external log listeners.
+		LogListenerList mListeners;
+
+    public:
+        LogManager();
+        ~LogManager();
+
+		/** Adds a new listener for the logging system.
+		    Ogre does not assume ownership and does not destroy the listener
+			at application shutdown.
+		*/
+		void addListener( LogListener * listener );
+		
+		/** Removes a previously registered listener again, and
+			returns ownership of the listener to the caller, who
+			is responsible for destroying the listener again.
+		*/
+		void removeListener( LogListener * listener );
+
+        /** 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();
+
+        /** Sets the passed in log as the default log.
+        @returns 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); }
+
+		/** 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);
+
+    };
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreParticleAffector.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreParticleAffector.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreParticleAffector.h	(revision 1812)
@@ -0,0 +1,112 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE 
+	(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under 
+the terms of the GNU Lesser General Public License as published by the Free Software 
+Foundation; either version 2 of the License, or (at your option) any later 
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT 
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with 
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple 
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to 
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __ParticleAffector_H__
+#define __ParticleAffector_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreString.h"
+#include "OgreStringInterface.h"
+
+
+namespace Ogre {
+
+    /** 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 paramters within those
+        types.
+    */
+    class _OgreExport ParticleAffector : public StringInterface
+    {
+    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 */ }
+
+        /** 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; }
+
+    };
+
+}
+
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreIteratorWrappers.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreIteratorWrappers.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreIteratorWrappers.h	(revision 1812)
@@ -0,0 +1,355 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __IteratorWrappers_H__
+#define __IteratorWrappers_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+    /** Wraps iteration over a vector.
+    @remarks
+        This class is here just to allow clients to iterate over an internal
+        vector of a class without having to have access to the vector itself
+        (typically to iterate you need both the iterator and the end() iterator
+        to test for the end condition, which is messy).
+        No updates are allowed through this interface, it is purely for 
+        iterating and reading.
+    @par
+        Note that like STL iterators, these iterators are only valid whilst no 
+        updates are made to the underlying collection. You should not attempt to
+        use this iterator if a change is made to the collection. In fact, treat this
+        iterator as a transient object, do NOT store it and try to use it repeatedly.
+    */
+    template <class T>
+    class VectorIterator
+    {
+    private:
+        typename T::iterator mCurrent;
+        typename T::iterator mEnd;
+		/// Private constructor since only the parameterised constructor should be used
+        VectorIterator() {};
+    public:
+        typedef typename T::value_type ValueType;
+
+        /** Constructor.
+        @remarks
+            Provide a start and end iterator to initialise.
+        */
+        VectorIterator(typename T::iterator start, typename T::iterator end)
+            : mCurrent(start), mEnd(end)
+        {
+        }
+
+        /** Constructor.
+        @remarks
+            Provide a container to initialise.
+        */
+        explicit VectorIterator(T& c)
+            : mCurrent(c.begin()), mEnd(c.end())
+        {
+        }
+
+        /** Returns true if there are more items in the collection. */
+        bool hasMoreElements(void) const
+        {
+            return mCurrent != mEnd;
+        }
+
+        /** Returns the next element in the collection, and advances to the next. */
+        typename T::value_type getNext(void)
+        {
+            return *mCurrent++;
+        }
+        /** Returns the next element in the collection, without advancing to the next. */
+        typename T::value_type peekNext(void)
+        {
+            return *mCurrent;
+        }
+        /** Returns a pointer to the next element in the collection, without advancing to the next afterwards. */
+        typename T::pointer peekNextPtr(void)
+        {
+            return &(*mCurrent);
+        }
+        /** Moves the iterator on one element. */
+        void moveNext(void)
+        {
+            ++mCurrent;
+        }
+
+
+
+    };
+
+    /** Wraps iteration over a map.
+    @remarks
+        This class is here just to allow clients to iterate over an internal
+        map of a class without having to have access to the map itself
+        (typically to iterate you need both the iterator and the end() iterator
+        to test for the end condition, which is messy).
+        No updates are allowed through this interface, it is purely for 
+        iterating and reading.
+    @par
+        Note that like STL iterators, these iterators are only valid whilst no 
+        updates are made to the underlying collection. You should not attempt to
+        use this iterator if a change is made to the collection. In fact, treat this
+        iterator as a transient object, do NOT store it and try to use it repeatedly.
+    */
+    template <class T>
+    class MapIterator
+    {
+    private:
+        typename T::iterator mCurrent;
+        typename T::iterator mEnd;
+        /// Private constructor since only the parameterised constructor should be used
+        MapIterator() {};
+    public:
+        typedef typename T::mapped_type MappedType;
+        typedef typename T::key_type KeyType;
+
+        /** Constructor.
+        @remarks
+            Provide a start and end iterator to initialise.
+        */
+        MapIterator(typename T::iterator start, typename T::iterator end)
+            : mCurrent(start), mEnd(end)
+        {
+        }
+
+        /** Constructor.
+        @remarks
+            Provide a container to initialise.
+        */
+        explicit MapIterator(T& c)
+            : mCurrent(c.begin()), mEnd(c.end())
+        {
+        }
+
+        /** Returns true if there are more items in the collection. */
+        bool hasMoreElements(void) const
+        {
+            return mCurrent != mEnd;
+        }
+
+        /** Returns the next value element in the collection, and advances to the next. */
+        typename T::mapped_type getNext(void)
+        {
+            return (mCurrent++)->second;
+        }
+        /** Returns the next value element in the collection, without advancing to the next. */
+        typename T::mapped_type peekNextValue(void)
+        {
+            return mCurrent->second;
+        }
+        /** Returns the next key element in the collection, without advancing to the next. */
+        typename T::key_type peekNextKey(void)
+        {
+            return mCurrent->first;
+        }
+        /** Required to overcome intermittent bug */
+ 	    MapIterator<T> & operator=( MapIterator<T> &rhs )
+ 	    {
+ 		    mCurrent = rhs.mCurrent;
+ 		    mEnd = rhs.mEnd;
+ 		    return *this;
+ 	    }
+        /** Returns a pointer to the next value element in the collection, without 
+            advancing to the next afterwards. */
+        typename T::mapped_type* peekNextValuePtr(void)
+        {
+            return &(mCurrent->second);
+        }
+        /** Moves the iterator on one element. */
+        void moveNext(void)
+        {
+            ++mCurrent;
+        }
+
+
+
+    };
+    /** Wraps iteration over a const vector.
+    @remarks
+    This class is here just to allow clients to iterate over an internal
+    vector of a class without having to have access to the vector itself
+    (typically to iterate you need both the iterator and the end() iterator
+    to test for the end condition, which is messy).
+    No updates are allowed through this interface, it is purely for 
+    iterating and reading.
+    @par
+    Note that like STL iterators, these iterators are only valid whilst no 
+    updates are made to the underlying collection. You should not attempt to
+    use this iterator if a change is made to the collection. In fact, treat this
+    iterator as a transient object, do NOT store it and try to use it repeatedly.
+    */
+    template <class T>
+    class ConstVectorIterator
+    {
+    private:
+        mutable typename T::const_iterator mCurrent;
+        typename T::const_iterator mEnd;
+        /// Private constructor since only the parameterised constructor should be used
+        ConstVectorIterator() {};
+    public:
+        typedef typename T::value_type ValueType;
+
+        /** Constructor.
+        @remarks
+        Provide a start and end iterator to initialise.
+        */
+        ConstVectorIterator(typename T::const_iterator start, typename T::const_iterator end)
+            : mCurrent(start), mEnd(end)
+        {
+        }
+
+        /** Constructor.
+        @remarks
+            Provide a container to initialise.
+        */
+        explicit ConstVectorIterator(const T& c)
+            : mCurrent(c.begin()), mEnd(c.end())
+        {
+        }
+
+        /** Returns true if there are more items in the collection. */
+        bool hasMoreElements(void) const
+        {
+            return mCurrent != mEnd;
+        }
+
+        /** Returns the next element in the collection, and advances to the next. */
+        typename T::value_type getNext(void)
+        {
+            return *mCurrent++;
+        }
+        /** Returns the next element in the collection, without advancing to the next. */
+        typename T::value_type peekNext(void) const
+        {
+            return *mCurrent;
+        }
+        /** Returns a pointer to the next element in the collection, without advancing to the next afterwards. */
+        typename T::const_pointer peekNextPtr(void) const
+        {
+            return &(*mCurrent);
+        }
+        /** Moves the iterator on one element. */
+        void moveNext(void) const
+        {
+            ++mCurrent;
+        }
+
+
+
+    };
+
+    /** Wraps iteration over a const map.
+    @remarks
+    This class is here just to allow clients to iterate over an internal
+    map of a class without having to have access to the map itself
+    (typically to iterate you need both the iterator and the end() iterator
+    to test for the end condition, which is messy).
+    No updates are allowed through this interface, it is purely for 
+    iterating and reading.
+    @par
+    Note that like STL iterators, these iterators are only valid whilst no 
+    updates are made to the underlying collection. You should not attempt to
+    use this iterator if a change is made to the collection. In fact, treat this
+    iterator as a transient object, do NOT store it and try to use it repeatedly.
+    */
+    template <class T>
+    class ConstMapIterator
+    {
+    private:
+        mutable typename T::const_iterator mCurrent;
+        typename T::const_iterator mEnd;
+        /// Private constructor since only the parameterised constructor should be used
+        ConstMapIterator() {};
+    public:
+        typedef typename T::mapped_type MappedType;
+        typedef typename T::key_type KeyType;
+
+        /** Constructor.
+        @remarks
+        Provide a start and end iterator to initialise.
+        */
+        ConstMapIterator(typename T::const_iterator start, typename T::const_iterator end)
+            : mCurrent(start), mEnd(end)
+        {
+        }
+
+        /** Constructor.
+        @remarks
+            Provide a container to initialise.
+        */
+        explicit ConstMapIterator(const T& c)
+            : mCurrent(c.begin()), mEnd(c.end())
+        {
+        }
+
+        /** Returns true if there are more items in the collection. */
+        bool hasMoreElements(void) const
+        {
+            return mCurrent != mEnd;
+        }
+
+        /** Returns the next value element in the collection, and advances to the next. */
+        typename T::mapped_type getNext(void)
+        {
+            return (mCurrent++)->second;
+        }
+        /** Returns the next value element in the collection, without advancing to the next. */
+        typename T::mapped_type peekNextValue(void) const
+        {
+            return mCurrent->second;
+        }
+        /** Returns the next key element in the collection, without advancing to the next. */
+        typename T::key_type peekNextKey(void) const
+        {
+            return mCurrent->first;
+        }
+        /** Required to overcome intermittent bug */
+        MapIterator<T> & operator=( MapIterator<T> &rhs )
+        {
+            mCurrent = rhs.mCurrent;
+            mEnd = rhs.mEnd;
+            return *this;
+        }
+        /** Returns a pointer to the next value element in the collection, without 
+        advancing to the next afterwards. */
+        const typename T::mapped_type* peekNextValuePtr(void) const
+        {
+            return &(mCurrent->second);
+        }
+        /** Moves the iterator on one element. */
+        void moveNext(void) const
+        {
+            ++mCurrent;
+        }
+
+
+
+    };
+}
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSimpleRenderable.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSimpleRenderable.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSimpleRenderable.h	(revision 1812)
@@ -0,0 +1,94 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __SimpleRenderable_H__
+#define __SimpleRenderable_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreMovableObject.h"
+#include "OgreRenderable.h"
+#include "OgreAxisAlignedBox.h"
+#include "OgreMaterial.h"
+
+namespace Ogre {
+
+    class _OgreExport SimpleRenderable : public MovableObject, public Renderable
+    {
+    protected:
+        RenderOperation mRenderOp;
+
+        Matrix4 m_matWorldTransform;
+        AxisAlignedBox mBox;
+
+        String m_strMatName;
+        MaterialPtr m_pMaterial;
+
+        /// The scene manager for the current frame.
+        SceneManager *m_pParentSceneManager;
+
+        /// The camera for the current frame.
+        Camera *m_pCamera;
+
+        /// Static member used to automatically generate names for SimpleRendaerable objects.
+        static uint ms_uGenNameCount;
+
+    public:
+        SimpleRenderable();
+
+        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;
+        /** @copydoc Renderable::getWorldOrientation */
+        const Quaternion& getWorldOrientation(void) const;
+        /** @copydoc Renderable::getWorldPosition */
+        const Vector3& getWorldPosition(void) const;
+
+
+        virtual void _notifyCurrentCamera(Camera* cam);
+
+        void setBoundingBox( const AxisAlignedBox& box );
+        virtual const AxisAlignedBox& getBoundingBox(void) const;
+
+        virtual void _updateRenderQueue(RenderQueue* queue);
+
+        virtual ~SimpleRenderable();
+
+
+        /** Overridden from MovableObject */
+        virtual const String& getMovableType(void) const;
+
+        /** @copydoc Renderable::getLights */
+        const LightList& getLights(void) const;
+
+    };
+}
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCompositorScriptCompiler.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCompositorScriptCompiler.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCompositorScriptCompiler.h	(revision 1812)
@@ -0,0 +1,190 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.stevestreeting.com/ogre/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/gpl.html.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __CompositorScriptScompiler_H__
+#define __CompositorScriptScompiler_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreCompiler2Pass.h"
+#include "OgreCompositor.h"
+#include "OgreRenderSystem.h"
+
+
+namespace Ogre {
+
+	/** Compiler for parsing & lexing .compositor scripts */
+	class _OgreExport CompositorScriptCompiler : public Compiler2Pass
+	{
+
+	public:
+		CompositorScriptCompiler(void);
+		~CompositorScriptCompiler(void);
+
+        /** gets BNF Grammer for Compositor script.
+        */
+        virtual const String& getClientBNFGrammer(void) { return compositorScript_BNF; }
+
+        /** get the name of the Compositor script BNF grammer.
+        */
+        virtual const String& getClientGrammerName(void) const { static const String grammerName("Compositor Script"); return grammerName; }
+        /** Compile a compositor script from a data stream using a specific resource group name.
+        @param stream Weak reference to a data stream which is the source of the material 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.
+        */
+        void parseScript(DataStreamPtr& stream, const String& groupName)
+        {
+            mScriptContext.groupName = groupName;
+            Compiler2Pass::compile(stream->getAsString(),  stream->getName());
+        }
+
+	protected:
+		// Token ID enumeration
+		enum TokenID {
+			// Terminal Tokens section
+			ID_UNKOWN = 0, ID_OPENBRACE, ID_CLOSEBRACE,
+			// Top level
+			ID_COMPOSITOR,
+			// Techniques
+			ID_TECHNIQUE, ID_TEXTURE, ID_TARGET_WIDTH, ID_TARGET_HEIGHT,
+			ID_PF_A8R8G8B8, ID_PF_R8G8B8A8, ID_PF_R8G8B8,
+			ID_PF_FLOAT16_R, ID_PF_FLOAT16_RGB, ID_PF_FLOAT16_RGBA,
+			ID_PF_FLOAT32_R, ID_PF_FLOAT32_RGB, ID_PF_FLOAT32_RGBA,
+			// Targets
+			ID_TARGET, ID_INPUT, ID_TARGET_OUTPUT, ID_ONLY_INITIAL,
+			ID_VISIBILITY_MASK, ID_LOD_BIAS, ID_MATERIAL_SCHEME,
+			ID_PREVIOUS, ID_NONE,
+			// Passes
+			ID_PASS,
+			ID_MATERIAL,
+			ID_RENDER_QUAD, ID_CLEAR, ID_STENCIL, ID_RENDER_SCENE,
+			ID_FIRST_RQ, ID_LAST_RQ,
+			ID_IDENTIFIER,
+			// clear
+			ID_CLR_BUFF, ID_CLR_COLOUR, ID_CLR_DEPTH,
+			ID_CLR_COLOUR_VAL, ID_CLR_DEPTH_VAL, ID_CLR_STENCIL_VAL,
+			// stencil
+			ID_ST_CHECK, ID_ST_FUNC, ID_ST_REF_VAL, ID_ST_MASK, ID_ST_FAILOP,
+			ID_ST_DEPTH_FAILOP, ID_ST_PASSOP, ID_ST_TWOSIDED,
+
+			// compare functions
+            ID_ST_ALWAYS_FAIL, ID_ST_ALWAYS_PASS, ID_ST_LESS,
+            ID_ST_LESS_EQUAL, ID_ST_EQUAL, ID_ST_NOT_EQUAL,
+            ID_ST_GREATER_EQUAL, ID_ST_GREATER,
+
+            // stencil operations
+            ID_ST_KEEP, ID_ST_ZERO, ID_ST_REPLACE, ID_ST_INCREMENT,
+            ID_ST_DECREMENT, ID_ST_INCREMENT_WRAP, ID_ST_DECREMENT_WRAP,
+            ID_ST_INVERT,
+
+			// general
+			ID_ON, ID_OFF, ID_TRUE, ID_FALSE
+		};
+
+		/** Enum to identify compositor sections. */
+		enum CompositorScriptSection
+		{
+			CSS_NONE,
+			CSS_COMPOSITOR,
+			CSS_TECHNIQUE,
+			CSS_TARGET,
+			CSS_PASS
+		};
+		/** Struct for holding the script context while parsing. */
+		struct CompositorScriptContext
+		{
+			CompositorScriptSection section;
+		    String groupName;
+			CompositorPtr compositor;
+			CompositionTechnique* technique;
+			CompositionTargetPass* target;
+			CompositionPass* pass;
+		};
+
+		CompositorScriptContext mScriptContext;
+
+		// static library database for tokens and BNF rules
+		static TokenRule compositorScript_RulePath[];
+		// simplified Backus - Naur Form (BNF) grammer for compositor scripts
+		static String compositorScript_BNF;
+
+		typedef void (CompositorScriptCompiler::* CSC_Action)(void);
+		typedef std::map<size_t, CSC_Action> TokenActionMap;
+		typedef TokenActionMap::iterator TokenActionIterator;
+		/** Map of Token value as key to an Action.  An Action converts tokens into
+		the final format.
+            All instances use the same Token Action Map.
+		*/
+		static TokenActionMap mTokenActionMap;
+
+		/** Execute an Action associated with a token.  Gets called when the compiler finishes tokenizing a
+		section of the source that has been parsed.
+		**/
+		virtual void executeTokenAction(const size_t tokenID);
+		/** Associate all the lexemes used in a material script with their corresponding tokens and actions.
+		**/
+        virtual void setupTokenDefinitions(void);
+		void addLexemeTokenAction(const String& lexeme, const size_t token, const CSC_Action action = 0);
+
+		void logParseError(const String& error);
+
+		// Token Actions which get called when tokens are created during parsing.
+		void parseOpenBrace(void);
+		void parseCloseBrace(void);
+		void parseCompositor(void);
+		void parseTechnique(void);
+		void parseTexture(void);
+		void parseTarget(void);
+		void parseInput(void);
+		void parseTargetOutput(void);
+		void parseOnlyInitial(void);
+		void parseVisibilityMask(void);
+		void parseLodBias(void);
+		void parseMaterialScheme(void);
+		void parsePass(void);
+		void parseMaterial(void);
+		void parseFirstRenderQueue(void);
+		void parseLastRenderQueue(void);
+		void parseIdentifier(void);
+		void parseClearBuffers(void);
+		void parseClearColourValue(void);
+		void parseClearDepthValue(void);
+		void parseClearStencilValue(void);
+		void parseStencilCheck(void);
+		void parseStencilFunc(void);
+		void parseStencilRefVal(void);
+		void parseStencilMask(void);
+		void parseStencilFailOp(void);
+		void parseStencilDepthFailOp(void);
+		void parseStencilPassOp(void);
+		void parseStencilTwoSided(void);
+		StencilOperation extractStencilOp(void);
+        CompareFunction extractCompareFunc(void);
+	};
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderQueueInvocation.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderQueueInvocation.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderQueueInvocation.h	(revision 1812)
@@ -0,0 +1,214 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright © 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __RenderQueueInvocation_H__
+#define __RenderQueueInvocation_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreRenderQueueSortingGrouping.h"
+#include "OgreIteratorWrappers.h"
+
+namespace Ogre {
+
+	/** 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
+	{
+	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 std::vector<RenderQueueInvocation*> 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 shudown, 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
+	{
+	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
+		@returns 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: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreParticleEmitterCommands.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreParticleEmitterCommands.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreParticleEmitterCommands.h	(revision 1812)
@@ -0,0 +1,181 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE 
+	(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under 
+the terms of the GNU Lesser General Public License as published by the Free Software 
+Foundation; either version 2 of the License, or (at your option) any later 
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT 
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with 
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple 
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to 
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __ParticleEmitterCommands_H__
+#define __ParticleEmitterCommands_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreStringInterface.h"
+
+namespace Ogre  {
+
+
+    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 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);
+        };
+
+    }
+
+}
+
+
+
+
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreOverlay.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreOverlay.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreOverlay.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __Overlay_H__
+#define __Overlay_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreSceneNode.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreMatrix4.h"
+
+namespace Ogre {
+
+
+    /** 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 _OgreExport Overlay 
+    {
+
+    public:
+              typedef std::list<OverlayContainer*> 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);
+
+    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 ZOrder of this overlay. 
+        @remarks
+            Values between 0 and 650 are valid here.
+        */
+        void setZOrder(ushort zorder);
+        /** Gets the ZOrder 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);
+#ifndef OGRE_FORCE_ANGLE_TYPES
+        inline void setRotate(Real degrees) {
+			setRotate ( Angle(degrees) );
+		}
+#endif//OGRE_FORCE_ANGLE_TYPES
+
+        /** 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);
+#ifndef OGRE_FORCE_ANGLE_TYPES
+		inline void rotate(Real degrees) {
+			rotate ( Angle(degrees) );
+		}
+#endif//OGRE_FORCE_ANGLE_TYPES
+
+        /** 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;
+        /** @copydoc Renderable::getWorldOrientation */
+        const Quaternion& getWorldOrientation(void) const;
+        /** @copydoc Renderable::getWorldPosition */
+        const Vector3& getWorldPosition(void) 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: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreArchive.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreArchive.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreArchive.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _Archive_H__
+#define _Archive_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreString.h"
+#include "OgreDataStream.h"
+#include "OgreSharedPtr.h"
+#include "OgreStringVector.h"
+
+namespace Ogre {
+
+    /** 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)
+		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 std::vector<FileInfo> 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  
+    {
+    protected:
+        /// Archive name
+        String mName; 
+        /// Archive type code
+        String mType;
+    public:
+
+
+        /** Constructor - don't call direct, used by ArchiveFactory.
+        */
+        Archive( const String& name, const String& archType )
+            : mName(name), mType(archType) {}
+
+        /** 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 ment to be used
+            only by the ArchiveManager class.
+        */
+        virtual void load() = 0;
+
+        /** Unloads the archive.
+        @warning
+            Do not call this function directly, it is ment to be used
+            only by the ArchiveManager class.
+        */
+        virtual void unload() = 0;
+
+        /** 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
+        @returns 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) const = 0;
+
+        /** 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)
+        @returns A list of filenames matching the criteria, all are fully qualified
+        */
+        virtual StringVectorPtr list(bool recursive = true ) = 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)
+        @returns A list of structures detailing quite a lot of information about
+            all the files in the archive.
+        */
+        virtual FileInfoListPtr listFileInfo(bool recursive = true ) = 0;
+
+        /** Find all file 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)
+        @returns A list of filenames matching the criteria, all are fully qualified
+        */
+        virtual StringVectorPtr find(const String& pattern, bool recursive = true) = 0;
+
+        /** Find out if the named file exists (note: fully qualified filename required) */
+        virtual bool exists(const String& filename) = 0; 
+
+        /** Find all files 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)
+        @returns A list of file information structures for all files matching 
+            the criteria.
+        */
+        virtual FileInfoListPtr findFileInfo(const String& pattern, 
+            bool recursive = true) = 0;
+
+        /// Return the type code of this Archive
+        const String& getType(void) const { return mType; }
+        
+    };
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreEventProcessor.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreEventProcessor.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreEventProcessor.h	(revision 1812)
@@ -0,0 +1,229 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+/***************************************************************************
+OgreEventProcessor.h  -  
+	The EventProcessor controls getting events, storing them in a queue, and 
+	dispatching events.
+	It contains an InputDevice which creates InputEvents. The events are then
+	stored FIFO in the EventQueue. 
+
+	The EventProcessor is a frame listener, so each frame, it empties the entire
+	queue to the list of dispatchers.
+
+	Each dispatcher corresponds to a registered TargetManager.
+
+	The TargetManagers need to be registered with the Processor before initialise is called.
+
+	After intialise is called, the Processor will start processing events once startProcessingEvents is called.
+
+	The Processor acts like a default EventTarget, so it can process events that no dispatcher consumes.
+	You can listen default actions to the processor by e.g.
+		mProcessor->addMouseListener(defaultMouseMovement);
+
+	WARNING: The event objects are created in InputReader when they are submitted to the queue
+	, yet destroyed in the Event Processor when they are taken off the queue.
+	Deleting objects in different locations to where they are created is usually undesirable, however,
+	since the Processor, queue and InputReader are tightly coupled (only the Processor is visible to the outside)
+	this can be an exception.
+	The reason for this is for performance... The alternative, is to do 2 more event copies when sending events to the queue,
+	so the queue manages creating (copying the event from the inputReader) and deleting objects once popped - however
+	this would require the events to be copied twice.. So I have avoided this by having the same event object passed around
+	and not copied.
+-------------------
+begin                : Nov 19 2002
+copyright            : (C) 2002 by Kenny Sabir
+email                : kenny@sparksuit.com
+***************************************************************************/
+
+#ifndef __EventProcessor_H__
+#define __EventProcessor_H__
+
+#include <list>
+#include "OgrePrerequisites.h"
+#include "OgreSingleton.h"
+#include "OgreFrameListener.h"
+#include "OgreMouseTarget.h"
+#include "OgreKeyTarget.h"
+#include "OgreMouseMotionTarget.h"
+
+namespace Ogre {
+	/** The EventProcessor controls getting events, storing them in a queue, and 
+		dispatching events.
+	@remarks
+		An application can create an instance of this class to receive buffered input, as opposed
+		to creating an InputReader directly and retrieving snapshot state only. This class
+		contains an InputReader which it uses to create InputEvents which are then
+		stored FIFO in the EventQueue. 
+	@par
+		The EventProcessor is a frame listener, so each frame, it empties the entire
+		queue to the list of dispatchers. Each dispatcher corresponds to a registered TargetManager.
+		The TargetManagers need to be registered with the Processor before initialise is called.
+		After intialise is called, the Processor will start processing events once 
+		startProcessingEvents is called.
+	@par
+		The Processor acts like a default EventTarget, so it can process events that no dispatcher consumes.
+		You can listen default actions to the processor by e.g.
+			mProcessor->addMouseListener(defaultMouseMovement);
+	*/
+    class _OgreExport EventProcessor : public FrameListener, public MouseTarget, public MouseMotionTarget, public Singleton<EventProcessor>, public KeyTarget
+    {
+    protected:
+		EventQueue* mEventQueue;
+		/**
+		 * empty queue and cleanup objects 
+		 *
+		 */
+		void cleanup();
+		InputReader* mInputDevice;
+		typedef std::list<EventDispatcher*> DispatcherList;
+		typedef std::list<EventTarget*> EventTargetList;
+		DispatcherList mDispatcherList;
+        EventTargetList mEventTargetList;
+        bool mRegisteredAsFrameListener;
+
+    public:
+        EventProcessor();
+        virtual ~EventProcessor();
+
+		/**
+		 * Registers FrameListener, and activates the queue
+		 */
+		void startProcessingEvents(bool registerListener=true);
+
+		/**
+		 * Removes this from being a FrameListener,
+		 * and deactivates the queue
+		 */
+		void stopProcessingEvents();
+
+		/**
+		 * Creates the Queue object,
+		 * Creates the InputReader object
+		 * initialises the InputReader to use buffered input 
+		 */
+		void initialise(RenderWindow* ren);
+
+		/**
+		 * Processes default events,
+		 * these are events are aren't handled by any dispatcher
+		 */
+		void processEvent(InputEvent* e);
+
+		/**
+		 * Adds a mouse motion listener to the cursor object.
+		 * This keeps the Cursor object hidden.
+		 */
+		void addCursorMoveListener(MouseMotionListener* c);
+
+		/**
+		 * Removes a mouse motion listener to the cursor object.
+		 * This keeps the Cursor object hidden.
+		 */
+		void removeCursorMoveListener(MouseMotionListener* c);
+
+		/**
+		 * Creates a dispatcher object that dispatches to the targetManager.
+		 * Adds the new dispatcher object to the dispatcher list.
+		 */
+
+		void addTargetManager(TargetManager* targetManager);
+
+		/**
+		 * Creates a dispatcher object that dispatches to the targetManager.
+		 * Adds the new dispatcher object to the dispatcher list.
+		 */
+
+		void addEventTarget(EventTarget* eventTarget);
+
+		/**
+		 * Processes all events on the queue.
+		 * sends each event to each dispatcher.
+		 * deletes the event objects
+		 */
+		bool frameStarted(const FrameEvent& evt);
+
+		// PositionTarget methods
+		/**
+		 * returns 0, since this is a default event target, default events have a top of 0 
+		 */
+		Real getTop() const;
+
+		/**
+		 * returns 0, since this is a default event target, default events have a left of 0 
+		 */
+		Real getLeft() const;
+
+		/**
+		 * returns NULL, There is no parent of the default event target.
+		 */
+		PositionTarget* getPositionTargetParent() const;
+
+
+
+		bool isKeyEnabled() const
+		{ return true; }
+
+		inline InputReader* getInputReader()
+		{ return mInputDevice; }
+        /** 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 EventProcessor& 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 EventProcessor* getSingletonPtr(void);
+    };
+
+
+
+}
+
+
+#endif //__EventProcessor_H__
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreTargetManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreTargetManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreTargetManager.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General  License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General  License for more details.
+
+You should have received a copy of the GNU Lesser General  License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+
+-----------------------------------------------------------------------------
+*/
+
+/***************************************************************************
+TargetManager.h  -  
+	an abstract interface.
+	Implemented by OverlayManager, to return a GuiElement at a given x,y 
+	position. 
+
+	Custom TargetManagers can be written to get a 3D element from an x,y 
+	position so you can write mouse listeners for your 3D objects.
+
+-------------------
+begin                : Dec 02 2002
+copyright            : (C) 2002 by Kenny Sabir
+email                : kenny@sparksuit.com
+***************************************************************************/
+
+
+#ifndef __TargetManager_H__
+#define __TargetManager_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre {
+
+	/** An abstract interface, implemented by OverlayManager, to return a GuiElement at a given x,y 
+		position. 
+	@remarks
+		Custom TargetManagers can be written to get a 3D element from an x,y 
+		position so you can write mouse listeners for your 3D objects.
+	*/
+	class _OgreExport TargetManager 
+    {
+	public:
+		virtual PositionTarget* getPositionTargetAt(Real x, Real y) = 0;
+    };
+
+
+}
+#endif 
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreParticleEmitterFactory.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreParticleEmitterFactory.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreParticleEmitterFactory.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under 
+the terms of the GNU Lesser General Public License as published by the Free Software 
+Foundation; either version 2 of the License, or (at your option) any later 
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT 
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with 
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple 
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to 
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __ParticleEmitterFactory_H__
+#define __ParticleEmitterFactory_H__
+
+
+#include "OgrePrerequisites.h"
+#include "OgreParticleEmitter.h"
+#include "OgreString.h"
+
+namespace Ogre {
+
+    /** 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
+    {
+    protected:
+        std::vector<ParticleEmitter*> 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 reauired). */
+        virtual void destroyEmitter(ParticleEmitter* e);
+
+    };
+
+
+}
+
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMouseMotionTarget.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMouseMotionTarget.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMouseMotionTarget.h	(revision 1812)
@@ -0,0 +1,71 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+/***************************************************************************
+OgreMouseMotionTarget.h  -  
+	Handles the adding and removing of MouseMotionListeners.
+
+	Components that process the Mouse Motion Event should subclass this class 
+	and call processMouseMotionEvent when that event is identified.
+
+-------------------
+begin                : Nov 19 2002
+copyright            : (C) 2002 by Kenny Sabir
+email                : kenny@sparksuit.com
+***************************************************************************/
+
+
+#ifndef __MouseMotionTarget_H__
+#define __MouseMotionTarget_H__
+
+#include "OgrePrerequisites.h"
+#include "OgrePositionTarget.h"
+
+namespace Ogre {
+
+    /** Handles the adding and removing of MouseMotionListeners.
+	@remarks
+	Components that process the Mouse Motion Event should subclass this class 
+	and call processMouseMotionEvent when that event is identified.
+	*/
+	class _OgreExport MouseMotionTarget : public PositionTarget
+    {
+    private:
+        std::set<MouseMotionListener*> mRemovedListeners;
+
+    protected:
+        std::set<MouseMotionListener*> mMouseMotionListeners;
+
+    public:
+		MouseMotionTarget() { }
+        virtual ~MouseMotionTarget() {}
+
+	    void processMouseMotionEvent(MouseEvent* e);
+	    void addMouseMotionListener(MouseMotionListener* l);
+	    void removeMouseMotionListener(MouseMotionListener* l);
+    };
+}
+
+
+#endif //__MouseTarget_H__
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreVector3.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreVector3.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreVector3.h	(revision 1812)
@@ -0,0 +1,703 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __Vector3_H__
+#define __Vector3_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreMath.h"
+#include "OgreQuaternion.h"
+
+namespace Ogre
+{
+
+    /** Standard 3-dimensional vector.
+        @remarks
+            A direction in 3D space represented as distances along the 3
+            orthoganal 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:
+        union {
+            struct {
+                Real x, y, z;
+            };
+            Real val[3];
+        };
+
+    public:
+        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 )
+        {
+        }
+
+
+        inline Vector3( const Vector3& rkVector )
+            : x( rkVector.x ), y( rkVector.y ), z( rkVector.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);
+        }
+
+        /** 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.0 / 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.0 / 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;
+        }
+
+        /** 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).
+            @returns
+                A float representing the dot product value.
+        */
+        inline Real dotProduct(const Vector3& vec) const
+        {
+            return x * vec.x + y * vec.y + 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.
+            @returns 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
+            if ( fLength > 1e-08 )
+            {
+                Real fInvLength = 1.0 / 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
+                vec Vector which, together with this one, will be used to
+                calculate the cross-product.
+            @returns
+                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.5,
+                ( y + vec.y ) * 0.5,
+                ( z + vec.z ) * 0.5 );
+        }
+
+        /** 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 = 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 );
+            }
+
+            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)
+            @returns
+                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);
+        }
+#ifndef OGRE_FORCE_ANGLE_TYPES
+        inline Vector3 randomDeviant(
+            Real angle,
+            const Vector3& up = Vector3::ZERO ) const
+        {
+            return randomDeviant ( Radian(angle), up );
+        }
+#endif//OGRE_FORCE_ANGLE_TYPES
+
+        /** 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;
+            }
+            Real s = Math::Sqrt( (1+d)*2 );
+			if (s < 1e-6f)
+			{
+				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 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.5;
+				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 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
+		*/
+		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();
+
+		}
+
+        // 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: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMeshManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMeshManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMeshManager.h	(revision 1812)
@@ -0,0 +1,425 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#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"
+
+namespace Ogre {
+
+    /** 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);
+
+        /** Loads a mesh from a file, making it immediately available for use.
+            @note
+                If the model has already been 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
+			@param priority The priority of this mesh in the resource system
+        */
+        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 segements to the plane in the x direction
+            @param
+                ysegments The number of segements 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 createPlane(
+            const String& name, const String& groupName, const Plane& plane,
+            Real width, Real height,
+            int xsegments = 1, int ysegments = 1,
+            bool normals = true, int 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 segements to the plane in the x direction
+            @param
+                ysegments The number of segements 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, int 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 concidered the depth.)
+            @param
+                xsegments The number of segements to the plane in the x direction
+            @param
+                ysegments The number of segements 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, int numTexCoordSets = 1, 
+			Real xTile = 1.0f, Real yTile = 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
+                decaration 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);
+
+        /** @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 tesselating 2D meshes.
+        */
+        void tesselate2DMesh(SubMesh* pSub, int meshWidth, int meshHeight, 
+			bool doubleSided = false, 
+			HardwareBuffer::Usage indexBufferUsage = HardwareBuffer::HBU_STATIC_WRITE_ONLY,
+			bool indexSysMem = false);
+
+        void createPrefabPlane(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;
+            int 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 std::map<Resource*, MeshBuildParams> 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;
+    };
+
+
+} //namespace
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreStringInterface.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreStringInterface.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreStringInterface.h	(revision 1812)
@@ -0,0 +1,328 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __StringInterface_H__
+#define __StringInterface_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreString.h"
+#include "OgreCommon.h"
+
+namespace Ogre {
+
+
+    /// 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 std::vector<ParameterDef> 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 std::map<String, ParamCommand* > 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. 
+        @returns
+            A reference to a static list of ParameterDef objects.
+
+        */
+        const ParameterList& getParameters(void) const
+        {
+            return mParamDefs;
+        }
+
+
+
+    };
+    typedef std::map<String, ParamDictionary> 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 
+    {
+    protected:
+
+        /// Dictionary of parameters
+        static ParamDictionaryMap msDictionary;
+
+        /// Class name for this instance to be used as a lookup (must be initialised by subclasses)
+        String mParamDictName;
+
+        /** 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
+        @returns
+            true if a new dictionary was created, false if it was already there
+        */
+        bool createParamDictionary(const String& className)
+        {
+            mParamDictName = className;
+            if (msDictionary.find(className) == msDictionary.end())
+            {
+                msDictionary[className] = ParamDictionary();
+                return true;
+            }
+            return false;
+
+        }
+
+    public:
+
+        /** Virtual desctructor, see Effective C++ */
+        virtual ~StringInterface() {}
+
+        /** Retrieves the parameter dictionary for this class. 
+        @remarks
+            Only valid to call this after createParamDictionary.
+        @returns
+            Pointer to ParamDictionary shared by all instances of this class
+            which you can add parameters to, retrieve parameters etc.
+        */
+        ParamDictionary* getParamDictionary(void)
+        {
+            ParamDictionaryMap::iterator i = msDictionary.find(mParamDictName);
+            if (i != msDictionary.end())
+            {
+                return &(i->second);
+            }
+            else
+            {
+                return 0;
+            }
+        }
+
+		const ParamDictionary* getParamDictionary(void) const
+        {
+            ParamDictionaryMap::const_iterator i = msDictionary.find(mParamDictName);
+            if (i != msDictionary.end())
+            {
+                return &(i->second);
+            }
+            else
+            {
+                return 0;
+            }
+        }
+
+        /** Retrieves a list of parameters valid for this object. 
+        @returns
+            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.
+        @returns
+            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
+        @returns
+            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 () ;
+
+    };
+
+
+
+}
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMath.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMath.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMath.h	(revision 1812)
@@ -0,0 +1,600 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __Math_H__
+#define __Math_H__
+
+#include "OgrePrerequisites.h"
+
+namespace Ogre
+{
+    /** 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 );
+		const Radian& operator = ( const Real& f ) { mRad = f; return *this; }
+		const Radian& operator = ( const Radian& r ) { mRad = r.mRad; return *this; }
+		const Radian& operator = ( const Degree& d );
+
+		Real valueDegrees() const; // see bottom of this file
+		Real valueRadians() const { return mRad; }
+		Real valueAngleUnits() const;
+
+		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 - () { 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; }
+	};
+
+    /** 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()) {}
+		const Degree& operator = ( const Real& f ) { mDeg = f; return *this; }
+		const Degree& operator = ( const Degree& d ) { mDeg = d.mDeg; return *this; }
+		const 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;
+
+		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 - () { 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; }
+	};
+
+    /** 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();
+		operator Degree();
+	};
+
+	// 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 const 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
+       };
+
+    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;
+
+        /** 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);
+
+		static inline Real Abs (Real fValue) { return Real(fabs(fValue)); }
+		static inline Degree Abs (const Degree& dValue) { return Degree(fabs(dValue.valueDegrees())); }
+		static inline Radian Abs (const Radian& rValue) { return Radian(fabs(rValue.valueRadians())); }
+		static Radian ACos (Real fValue);
+		static Radian ASin (Real fValue);
+		static inline Radian ATan (Real fValue) { return Radian(atan(fValue)); }
+		static inline Radian ATan2 (Real fY, Real fX) { return Radian(atan2(fY,fX)); }
+		static inline Real Ceil (Real fValue) { return Real(ceil(fValue)); }
+
+        /** 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)); }
+
+		static inline Real Floor (Real fValue) { return Real(floor(fValue)); }
+
+		static inline Real Log (Real fValue) { return Real(log(fValue)); }
+
+		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()));
+		}
+
+        /** 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);
+		}
+
+		static inline Real Sqr (Real fValue) { return fValue*fValue; }
+
+		static inline Real Sqrt (Real fValue) { return Real(sqrt(fValue)); }
+
+        static inline Radian Sqrt (const Radian& fValue) { return Radian(sqrt(fValue.valueRadians())); }
+
+        static inline Degree Sqrt (const Degree& fValue) { return Degree(sqrt(fValue.valueDegrees())); }
+
+        /** Inverse square root i.e. 1 / Sqrt(x), good for vector
+            normalisation.
+        */
+		static Real InvSqrt(Real fValue);
+
+        static Real UnitRandom ();  // in [0,1]
+
+        static Real RangeRandom (Real fLow, Real fHigh);  // in [fLow,fHigh]
+
+        static Real SymmetricRandom ();  // in [-1,1]
+
+        /** 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.
+            @returns
+                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 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 callermay already have it)
+        @returns
+            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.
+        @returns
+            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 callermay 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
+        @returns
+            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
+        @returns
+            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 plaeList 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 std::vector<Plane>& planeList, 
+            bool normalIsOutside);
+        /** Ray / convex plane list intersection test. 
+        @param ray The ray to test with
+        @param plaeList 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 std::list<Plane>& 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);
+
+        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()
+	{
+		return Radian(Math::AngleUnitsToRadians(mAngle));
+	}
+
+	inline Angle::operator Degree()
+	{
+		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() );
+	}
+
+}
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCompositorManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCompositorManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreCompositorManager.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __CompositorManager_H__
+#define __CompositorManager_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreResourceManager.h"
+#include "OgreCompositor.h"
+#include "OgreRectangle2D.h"
+#include "OgreCompositorSerializer.h"
+
+namespace Ogre {
+    /** 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);
+
+        /** Intialises the Compositor manager, which also triggers it to
+            parse all available .compositor scripts. */
+        void initialise(void);
+
+        /** @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).
+			@returns 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);
+
+		/** 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 std::map<Viewport*, CompositorChain*> Chains;
+        Chains mChains;
+
+        /// Serializer
+        CompositorSerializer mSerializer;
+
+        /** Clear composition chains for all viewports
+         */
+        void freeChains();
+
+		Rectangle2D *mRectangle;
+    };
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMouseEvent.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMouseEvent.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMouseEvent.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General  License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General  License for more details.
+
+You should have received a copy of the GNU Lesser General  License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+/***************************************************************************
+OgreMouseEvent.h  -  
+ * An event which indicates that a mouse action occurred in a MouseTarget (e.g. MouseTarget).
+ * This event is used both for mouse events (click, enter, exit) and mouse 
+ * motion events (moves and drags). 
+ * <P>
+ * This low-level event is generated by a MouseTarget object for:
+ * <ul>
+ * <li>Mouse Events
+ *     <ul>
+ *     <li>a mouse button is pressed
+ *     <li>a mouse button is released
+ *     <li>a mouse button is clicked (pressed and released)
+ *     <li>the mouse cursor enters a MouseTarget
+ *     <li>the mouse cursor exits a MouseTarget
+ *     </ul>
+ * <li> Mouse Motion Events
+ *     <ul>
+ *     <li>the mouse is moved
+ *     <li>the mouse is dragged
+ *     </ul>
+ * </ul>
+ * <P>
+ * A MouseEvent object is passed to every MouseListener
+ * object which registered to receive 
+ * the "interesting" mouse events using MouseTarget's 
+ * <code>addMouseListener</code> method.
+ *
+ * A MouseEvent object is also passed to every MouseMotionListener
+ * object which registered to receive 
+ * mouse motion events using the MouseTarget's addMouseMotionListener
+ * method
+ *
+ * When a mouse button is clicked, events are generated and sent to the
+ * registered MouseListeners, with the button mask set in the modifier field.
+ * For example, if the first mouse button is pressed, events are sent in the
+ * following order:
+ * <PRE>
+ *    MOUSE_PRESSED:  BUTTON1_MASK
+ *    MOUSE_RELEASED: BUTTON1_MASK
+ *    MOUSE_CLICKED:  BUTTON1_MASK
+ * </PRE>
+ * When multiple mouse buttons are pressed, each press, release, and click
+ * results in a separate event. The button mask in the modifier field reflects
+ * only the button that changed state, not the current state of all buttons.
+ * <P> 
+ * For example, if the user presses button 1 followed by button 2 and
+ * releases them in the same order, the following sequence of events is
+ * generated:
+ * <PRE>
+ *    MOUSE_PRESSED:  BUTTON1_MASK
+ *    MOUSE_PRESSED:  BUTTON2_MASK
+ *    MOUSE_RELEASED: BUTTON1_MASK
+ *    MOUSE_CLICKED:  BUTTON1_MASK
+ *    MOUSE_RELEASED: BUTTON2_MASK
+ *    MOUSE_CLICKED:  BUTTON2_MASK
+ * </PRE>
+ * If button2 is released first, the MOUSE_RELEASED/MOUSE_CLICKED pair
+ * for BUTTON2_MASK arrives first, followed by the pair for BUTTON1_MASK.
+ *
+-------------------
+begin                : Dec 03 2002
+copyright            : (C) 2002 by Kenny Sabir
+email                : kenny@sparksuit.com
+***************************************************************************/
+#ifndef __MouseEvent_H__
+#define __MouseEvent_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreInputEvent.h"
+
+namespace Ogre {
+
+/** An event which indicates that a mouse action occurred in a MouseTarget (e.g. MouseTarget).
+@remarks
+ * This event is used both for mouse events (click, enter, exit) and mouse 
+ * motion events (moves and drags). 
+ * <P>
+ * This low-level event is generated by a MouseTarget object for:
+ * <ul>
+ * <li>Mouse Events
+ *     <ul>
+ *     <li>a mouse button is pressed
+ *     <li>a mouse button is released
+ *     <li>a mouse button is clicked (pressed and released)
+ *     <li>the mouse cursor enters a MouseTarget
+ *     <li>the mouse cursor exits a MouseTarget
+ *     </ul>
+ * <li> Mouse Motion Events
+ *     <ul>
+ *     <li>the mouse is moved
+ *     <li>the mouse is dragged
+ *     </ul>
+ * </ul>
+ * <P>
+ * A MouseEvent object is passed to every MouseListener
+ * object which registered to receive 
+ * the "interesting" mouse events using MouseTarget's 
+ * <code>addMouseListener</code> method.
+ *
+ * A MouseEvent object is also passed to every MouseMotionListener
+ * object which registered to receive 
+ * mouse motion events using the MouseTarget's addMouseMotionListener
+ * method
+ *
+ * When a mouse button is clicked, events are generated and sent to the
+ * registered MouseListeners, with the button mask set in the modifier field.
+ * For example, if the first mouse button is pressed, events are sent in the
+ * following order:
+ * <PRE>
+ *    MOUSE_PRESSED:  BUTTON1_MASK
+ *    MOUSE_RELEASED: BUTTON1_MASK
+ *    MOUSE_CLICKED:  BUTTON1_MASK
+ * </PRE>
+ * When multiple mouse buttons are pressed, each press, release, and click
+ * results in a separate event. The button mask in the modifier field reflects
+ * only the button that changed state, not the current state of all buttons.
+ * <P> 
+ * For example, if the user presses button 1 followed by button 2 and
+ * releases them in the same order, the following sequence of events is
+ * generated:
+ * <PRE>
+ *    MOUSE_PRESSED:  BUTTON1_MASK
+ *    MOUSE_PRESSED:  BUTTON2_MASK
+ *    MOUSE_RELEASED: BUTTON1_MASK
+ *    MOUSE_CLICKED:  BUTTON1_MASK
+ *    MOUSE_RELEASED: BUTTON2_MASK
+ *    MOUSE_CLICKED:  BUTTON2_MASK
+ * </PRE>
+ * If button2 is released first, the MOUSE_RELEASED/MOUSE_CLICKED pair
+ * for BUTTON2_MASK arrives first, followed by the pair for BUTTON1_MASK.
+ *
+ */
+    class _OgreExport MouseEvent : public InputEvent
+    {
+    protected:
+		/**
+		 * The mouse events x coordinate.
+		 * The x value is relative to the MouseTarget
+		 * that fired the event.
+		 */
+		Real mX;
+		/**
+		 * The mouse events y coordinate.
+		 * The y value is relative to the MouseTarget
+		 * that fired the event.
+		 */
+		Real mY;
+
+		/**
+		 * The mouse events z coordinate.
+		 * The z value is relative to the MouseTarget
+		 * that fired the event.
+		 */
+		Real mZ;
+
+
+        Real mRelX;
+        Real mRelY;
+        Real mRelZ;
+
+		/**
+		 * Which button was pressed
+		 */
+
+		int mButtonID;
+		/**
+		 * not implemented yet
+		 */
+		int mClickCount;
+
+
+
+
+	public:
+
+		enum
+		{
+			ME_FIRST_EVENT = 500,
+			ME_LAST_EVENT = 510
+		};
+
+		enum 
+		{
+			ME_MOUSE_CLICKED 	= ME_FIRST_EVENT,
+			ME_MOUSE_PRESSED,
+			ME_MOUSE_RELEASED,
+			ME_MOUSE_MOVED,
+			ME_MOUSE_ENTERED,
+			ME_MOUSE_EXITED,
+			ME_MOUSE_DRAGGED,
+
+      ME_MOUSE_DRAGENTERED,
+      ME_MOUSE_DRAGEXITED,
+      ME_MOUSE_DRAGMOVED,
+      ME_MOUSE_DRAGDROPPED
+		};
+
+		/**
+		 * Constructs a MouseEvent object with the specified source MouseTarget,
+		 * type, modifiers, coordinates, and click count.
+		 *
+		 * @param source       the MouseTarget that originated the event
+		 * @param id           the integer that identifies the event
+		 * @param when         a long int that gives the time the event occurred
+		 * @param modifiers    the modifier keys down during event
+		 *                     (shift, ctrl, alt, meta)
+		 * @param x            the horizontal x coordinate for the mouse location
+		 * @param y            the vertical y coordinate for the mouse location
+		 * @param clickCount   the number of mouse clicks associated with event
+		 */
+		MouseEvent(PositionTarget* source, int id, int whichButton, Real when, int modifiers,
+			Real x, Real y, Real z, int clickCount);
+
+        MouseEvent(PositionTarget* source, int id, int whichButton, Real when, int modifiers,
+			Real x, Real y, Real z, Real relx, Real rely, Real relz, int clickCount);
+		
+         /**
+		 * Return the number of mouse clicks associated with this event.
+		 *
+		 * @return integer value for the number of clicks - NOT IMPLEMENTED
+		 */
+		 int getClickCount();
+
+		/**
+		 * Returns the horizontal x position of the event relative to the 
+		 * source MouseTarget.
+		 *
+		 * @return x  an integer indicating horizontal position relative to
+		 *            the MouseTarget
+		 */
+		 Real getX() const;
+
+		/**
+		 * Returns the vertical y position of the event relative to the
+		 * source MouseTarget.
+		 *
+		 * @return y  an integer indicating vertical position relative to
+		 *            the MouseTarget
+		 */
+		 Real getY() const;
+
+		/**
+		 * Returns the scrollwheel z position of the event relative to the
+		 * source MouseTarget.
+		 *
+		 * @return y  an integer indicating scrollwheel position relative to
+		 *            the MouseTarget
+		 */
+		 Real getZ() const;
+
+         /** get relative X cursor movement */
+         Real getRelX() const {return mRelX;}
+         
+         /** get relative Y cursor movement */
+         Real getRelY() const {return mRelY;}
+         
+         /** get relative Z cursor movement */
+         Real getRelZ() const {return mRelZ;}
+
+		/**
+		 * Returns a parameter string identifying this event.
+		 * This method is useful for event-logging and for debugging.
+		 *
+		 * @return a string identifying the event and its attributes
+		 */
+		 String paramString() const;
+
+		/**
+		 * Translates the event's coordinates to a new position
+		 * by adding specified x (horizontal) and y (veritcal) offsets.
+		 *
+		 * @param x the horizontal x value to add to the current x coordinate position
+		 * @param y the vertical y value to add to the current y coordinate position
+		 */
+		 void translatePoint(Real x, Real y);
+
+		 /** return the ID of the button */
+		 int getButtonID() const;
+    };
+
+
+}
+
+
+#endif 
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreOverlayElement.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreOverlayElement.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreOverlayElement.h	(revision 1812)
@@ -0,0 +1,487 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __OverlayElement_H__
+#define __OverlayElement_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreString.h"
+#include "OgreRenderable.h"
+#include "OgreStringInterface.h"
+#include "OgreOverlayElementCommands.h"
+
+#include "OgreColourValue.h"
+#include "OgreRectangle.h"
+
+namespace Ogre {
+
+
+    /** 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 _OgreExport OverlayElement : public StringInterface, public Renderable
+    {
+    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 mpMaterial;
+        String mCaption;
+        ColourValue mColour;
+        Rectangle 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 positons 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;
+        /** @copydoc Renderable::getWorldOrientation */
+        const Quaternion& getWorldOrientation(void) const;
+        /** @copydoc Renderable::getWorldPosition */
+        const Vector3& getWorldPosition(void) const;
+
+        /** See Renderable */
+        bool useIdentityProjection(void) const;
+
+        /** See Renderable */
+        bool useIdentityView(void) 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(Rectangle &clippingRegion);
+
+        /** Internal method to notify the element when Zorder of parent overlay
+        has changed.
+        @remarks
+        Overlays have explicit Z orders. OverlayElements do not, they inherit the 
+        ZOrder of the overlay, and the Zorder 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 zorder which is used to render the element.
+        */
+        virtual void _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);
+
+        /** 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 String& text);
+
+        /** Gets the caption for this element. */
+        virtual const String& 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 
+        { 
+            return 10000 - 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: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePredefinedControllers.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePredefinedControllers.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgrePredefinedControllers.h	(revision 1812)
@@ -0,0 +1,276 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __PredefinedControllers_H__
+#define __PredefinedControllers_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreCommon.h"
+#include "OgreController.h"
+#include "OgreFrameListener.h"
+#include "OgreGpuProgram.h"
+
+namespace Ogre {
+
+    //-----------------------------------------------------------------------
+    // 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-1).
+        */
+        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 ant 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 paramter 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
+		GpuProgramParameters* mParams;
+		/// The index of the parameter to e 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(GpuProgramParameters* 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
+		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)
+		*/
+		PassthroughControllerFunction(bool deltaInput = false);
+
+		/** Overriden 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);
+
+        /** Overriden function.
+        */
+        Real calculate(Real source);
+    };
+
+	//-----------------------------------------------------------------------
+    /** 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 multipier 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);
+
+        /** Overriden method.
+        */
+        Real calculate(Real source);
+
+    };
+
+    //-----------------------------------------------------------------------
+    /** Predefined controller function based on a waveform.
+        @remarks
+            A waveform function translates parametric intput 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 ouput 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 contructor, 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);
+
+        /** Overriden function.
+        */
+        Real calculate(Real source);
+
+    };
+    //-----------------------------------------------------------------------
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMaterial.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMaterial.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreMaterial.h	(revision 1812)
@@ -0,0 +1,666 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _Material_H__
+#define _Material_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreResource.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreCommon.h"
+#include "OgreColourValue.h"
+#include "OgreBlendMode.h"
+
+
+namespace Ogre {
+
+	// Forward declaration
+	class MaterialPtr;
+
+	/** 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 multitexrtuing, 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 std::vector<Real> LodDistanceList;
+        typedef ConstVectorIterator<LodDistanceList> LodDistanceIterator;
+    protected:
+
+
+        /** Internal method which sets the material up from the default settings.
+        */
+        void applyDefaults(void);
+
+        typedef std::vector<Technique*> Techniques;
+		/// All techniques, supported and unsupported
+        Techniques mTechniques;
+		/// Supported techniques of any sort
+        Techniques mSupportedTechniques;
+		typedef std::map<unsigned short, Technique*> LodTechniques;
+        typedef std::map<unsigned short, LodTechniques*> 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;
+
+        LodDistanceList mLodDistances;
+        bool mReceiveShadows;
+		bool mTransparencyCastsShadows;
+        /// Does this material require compilation?
+        bool mCompilationRequired;
+
+		/** Insert a supported technique into the local collections. */
+		void insertSupportedTechnique(Technique* t);
+
+		/** Clear the best technique list.
+		*/
+		void clearBestTechniqueList(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 { return 0; } // TODO 
+    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 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
+        */
+        Technique* getBestTechnique(unsigned short lodIndex = 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(ushort bias);
+
+        /** 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 );
+
+        /** 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);
+
+
+        /** 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 lodDistances A vector of Reals which indicate the distance 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 distance of 0).
+        */
+        void setLodLevels(const LodDistanceList& lodDistances);
+        /** Gets an iterator over the list of distances at which each LOD comes into effect. 
+        @remarks
+            Note that the iterator returned from this method is not totally anagolous to 
+            the one passed in by calling setLodLevels - the list includes a zero
+            entry at the start (since the highest LOD starts at distance 0), and
+            the other distances are held as their squared value for efficiency.
+        */
+        LodDistanceIterator getLodDistanceIterator(void) const;
+
+        /** Gets the LOD index to use at the given distance. */
+        unsigned short getLodIndex(Real d) const;
+        /** Gets the LOD index to use at the given squared distance. */
+        unsigned short getLodIndexSquaredDepth(Real squaredDepth) const;
+
+        /** @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;
+	    }
+
+
+    };
+
+	/** Specialisation of SharedPtr to allow SharedPtr to be assigned to MaterialPtr 
+	@note Has to be a subclass since we need operator=.
+	We could templatise this instead of repeating per Resource subclass, 
+	except to do so requires a form VC6 does not support i.e.
+	ResourceSubclassPtr<T> : public SharedPtr<T>
+	*/
+	class _OgreExport MaterialPtr : public SharedPtr<Material> 
+	{
+	public:
+		MaterialPtr() : SharedPtr<Material>() {}
+		explicit MaterialPtr(Material* rep) : SharedPtr<Material>(rep) {}
+		MaterialPtr(const MaterialPtr& r) : SharedPtr<Material>(r) {} 
+		MaterialPtr(const ResourcePtr& r) : SharedPtr<Material>()
+		{
+			// lock & copy other mutex pointer
+            OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME)
+            {
+			    OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
+			    OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
+			    pRep = static_cast<Material*>(r.getPointer());
+			    pUseCount = r.useCountPointer();
+			    if (pUseCount)
+			    {
+				    ++(*pUseCount);
+			    }
+            }
+		}
+
+		/// Operator used to convert a ResourcePtr to a MaterialPtr
+		MaterialPtr& operator=(const ResourcePtr& r)
+		{
+			if (pRep == static_cast<Material*>(r.getPointer()))
+				return *this;
+			release();
+			// lock & copy other mutex pointer
+            OGRE_MUTEX_CONDITIONAL(r.OGRE_AUTO_MUTEX_NAME)
+            {
+			    OGRE_LOCK_MUTEX(*r.OGRE_AUTO_MUTEX_NAME)
+			    OGRE_COPY_AUTO_SHARED_MUTEX(r.OGRE_AUTO_MUTEX_NAME)
+			    pRep = static_cast<Material*>(r.getPointer());
+			    pUseCount = r.useCountPointer();
+			    if (pUseCount)
+			    {
+				    ++(*pUseCount);
+			    }
+            }
+			return *this;
+		}
+	};
+
+} //namespace 
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderable.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderable.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderable.h	(revision 1812)
@@ -0,0 +1,256 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://ogre.sourceforge.net/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#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"
+
+namespace Ogre {
+
+    /** 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:
+		Renderable() : mPolygonModeOverrideable(true) {}
+        /** Virtual destructor needed as class has virtual methods. */
+        virtual ~Renderable() { }
+        /** 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(); }
+        /** Gets the render operation required to send this object to the frame buffer.
+        */
+        virtual void getRenderOperation(RenderOperation& op) = 0;
+        /** 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 xform 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.
+        */
+        virtual void getWorldTransforms(Matrix4* xform) const = 0;
+        /** Gets the worldspace orientation of this renderable; this is used in order to
+            more efficiently update parameters to vertex & fragment programs, since inverting Quaterion
+            and Vector in order to derive object-space positions / directions for cameras and
+            lights is much more efficient than inverting a complete 4x4 matrix, and also 
+            eliminates problems introduced by scaling. */
+        virtual const Quaternion& getWorldOrientation(void) const = 0;
+        /** Gets the worldspace orientation of this renderable; this is used in order to
+            more efficiently update parameters to vertex & fragment programs, since inverting Quaterion
+            and Vector in order to derive object-space positions / directions for cameras and
+            lights is much more efficient than inverting a complete 4x4 matrix, and also 
+            eliminates problems introduced by scaling. */
+        virtual const Vector3& getWorldPosition(void) 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; }
+
+        /** 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 override this.
+        */
+        virtual bool useIdentityProjection(void) const { return false; }
+
+        /** Returns whether or not to use an 'identity' projection.
+        @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 override this.
+        */
+        virtual bool useIdentityView(void) const { return false; }
+
+		/** 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;
+
+        /** Returns whether or not this Renderable wishes the hardware to normalise normals. */
+        virtual bool getNormaliseNormals(void) const { return false; }
+
+        /** 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;
+
+        virtual const PlaneList& getClipPlanes() const { return msDummyPlaneList; };
+
+        /** 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;
+        }
+
+        /** Gets the custom value associated with this Renderable at the given index.
+        @param
+            @see setCustomParaemter 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->setConstant(constantEntry.index, i->second);
+            }
+        }
+
+		/** 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;
+		}
+
+
+    protected:
+        static const PlaneList msDummyPlaneList;
+        typedef std::map<size_t, Vector4> CustomParameterMap;
+        CustomParameterMap mCustomParameters;
+		bool mPolygonModeOverrideable;
+    };
+
+
+
+}
+
+#endif //__Renderable_H__
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSceneNode.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSceneNode.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSceneNode.h	(revision 1812)
@@ -0,0 +1,431 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _SceneNode_H__
+#define _SceneNode_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreNode.h"
+#include "OgreIteratorWrappers.h"
+#include "OgreAxisAlignedBox.h"
+
+namespace Ogre {
+
+    /** 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;
+        mutable LightList mLightList;
+        mutable bool mLightListDirty;
+
+		/// 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;
+
+        /// SceneManager which created this node
+        SceneManager* mCreator;
+
+        /// World-Axis aligned bounding box, updated only through _update
+        AxisAlignedBox mWorldAABB;
+
+        /** 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, ie
+			whether it's ulitimate 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 xform has changed,
+                    so the child should retrieve the parent's xform 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
+                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, 
+            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;
+
+        /** 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);
+
+        /** 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. Multiple access to this method when neither 
+            the node nor the lights have moved will result in the same list being returned
+            without recalculation. Can be useful when implementing Renderable::getLights.
+        @param radius Optional parameter to specify lights intersecting a given radius of
+            this SceneNode's centre.
+        */
+        virtual const LightList& findLights(Real radius) 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);
+#ifndef OGRE_FORCE_ANGLE_TYPES
+		inline void yaw(Real degrees, TransformSpace relativeTo = TS_LOCAL) {
+			yaw ( Angle(degrees), relativeTo );
+		}
+#endif//OGRE_FORCE_ANGLE_TYPES
+        /** 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* 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 / invisble.
+        @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);
+
+
+
+
+
+    };
+
+
+}// namespace
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreAnimationTrack.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreAnimationTrack.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreAnimationTrack.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __AnimationTrack_H__
+#define __AnimationTrack_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreSimpleSpline.h"
+#include "OgreRotationalSpline.h"
+#include "OgreKeyFrame.h"
+#include "OgreAnimable.h"
+#include "OgrePose.h"
+
+namespace Ogre 
+{
+    /** A 'track' in an animation sequence, ie 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:
+        /// 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 timePos The time index in seconds.
+        @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 incase the caller needs it.
+        @returns Parametric value indicating how far along the gap between the 2 keyframes the timePos
+            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(Real timePos, 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(Real timeIndex, KeyFrame* kf) const = 0;
+
+        /** Applies an animation track to the designated target.
+        @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 acculumate Don't make weights relative to overall weights applied, 
+			make them absolute and just add.
+	    @param scale The scale to apply to translations and scalings, useful for 
+			adapting an animation to a different size target.
+        */
+        virtual void apply(Real timePos, Real weight = 1.0, bool accumulate = false, 
+			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) {}
+
+    protected:
+        typedef std::vector<KeyFrame*> KeyFrameList;
+        KeyFrameList mKeyFrames;
+        Animation* mParent;
+		unsigned short mHandle;
+
+		/// 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
+		void getInterpolatedKeyFrame(Real timeIndex, KeyFrame* kf) const;
+
+		/// @copydoc AnimationTrack::apply
+		void apply(Real timePos, Real weight = 1.0, bool accumulate = false, 
+			Real scale = 1.0f);
+
+        /** Applies an animation track to a given animable value.
+		@param anim The AnimableValue to which to apply the animation
+        @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);
+
+		/** 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);
+        /** 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, Real timePos, Real weight = 1.0, 
+			bool accumulate = false, 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
+		void getInterpolatedKeyFrame(Real timeIndex, KeyFrame* kf) const;
+
+		/// @copydoc AnimationTrack::apply
+		void apply(Real timePos, Real weight = 1.0, bool accumulate = false, 
+			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;
+		
+	protected:
+		/// Specialised keyframe creation
+		KeyFrame* createKeyFrameImpl(Real time);
+		// Flag indicating we need to rebuild the splines next time
+		virtual void buildInterpolationSplines(void) const;
+
+		Node* mTargetNode;
+		// Prebuilt splines, must be mutable since lazy-update in const method
+		mutable bool mSplineBuildNeeded;
+		mutable SimpleSpline mPositionSpline;
+		mutable SimpleSpline mScaleSpline;
+		mutable RotationalSpline mRotationSpline;
+		/// 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 refrences 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; }
+
+		/** 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);
+
+		/** This method in fact does nothing, since interpolation is not performed
+			inside the keyframes for this type of track. 
+		*/
+		void getInterpolatedKeyFrame(Real timeIndex, KeyFrame* kf) const {}
+
+		/// @copydoc AnimationTrack::apply
+		void apply(Real timePos, Real weight = 1.0, bool accumulate = false, 
+			Real scale = 1.0f);
+
+		/** As the 'apply' method but applies to specified VertexData instead of 
+			associated data. */
+		virtual void applyToVertexData(VertexData* data, 
+			Real timePos, 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;
+
+	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);
+
+
+	};
+
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSimpleSpline.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSimpleSpline.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSimpleSpline.h	(revision 1812)
@@ -0,0 +1,126 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __SimpleSpline_H__
+#define __SimpleSpline_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreVector3.h"
+#include "OgreMatrix4.h"
+
+namespace Ogre {
+
+
+    /** 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);
+
+        /** 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);
+
+
+        /** 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;
+
+        std::vector<Vector3> mPoints;
+        std::vector<Vector3> mTangents;
+
+        /// Matrix of coefficients 
+        Matrix4 mCoeffs;
+
+
+
+    };
+
+
+}
+
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderQueueSortingGrouping.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderQueueSortingGrouping.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreRenderQueueSortingGrouping.h	(revision 1812)
@@ -0,0 +1,649 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#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 {
+
+	/** 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, ie 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(const 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.
+		@returns 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(const 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:
+		/** 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 (adepth == bdepth)
+				    {
+                        // Must return deterministic result, doesn't matter what
+                        return a.pass < b.pass;
+				    }
+				    else
+				    {
+				        // Sort DESCENDING by depth (ie 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 std::vector<RenderablePass> RenderablePassList;
+        typedef std::vector<Renderable*> RenderableList;
+        /** Map of pass to renderable lists, this is a grouping by pass. */
+        typedef std::map<Pass*, RenderableList*, PassGroupLess> 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;
+		
+	};
+
+	/** 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
+    {
+	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;
+		/// 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 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& 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, ie 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, ie 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, ie 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;
+		}
+
+
+
+    };
+
+
+    /** 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:
+        typedef std::map<ushort, RenderPriorityGroup*, std::less<ushort> > PriorityMap;
+        typedef MapIterator<PriorityMap> PriorityMapIterator;
+    protected:
+        RenderQueue* mParent;
+        bool mSplitPassesByLightingType;
+        bool mSplitNoShadowPasses;
+		bool mShadowCastersNotReceivers;
+        /// Map of RenderPriorityGroup objects
+        PriorityMap mPriorityGroups;
+		/// Whether shadows are enabled for this queue
+		bool mShadowsEnabled;
+
+
+    public:
+		RenderQueueGroup(RenderQueue* parent,
+            bool splitPassesByLightingType,
+            bool splitNoShadowPasses,
+            bool shadowCastersNotReceivers) 
+            : mParent(parent)
+            , mSplitPassesByLightingType(splitPassesByLightingType)
+            , mSplitNoShadowPasses(splitNoShadowPasses)
+            , mShadowCastersNotReceivers(shadowCastersNotReceivers)
+            , mShadowsEnabled(true)
+        {
+        }
+
+        ~RenderQueueGroup() {
+            // destroy contents now
+            PriorityMap::iterator i;
+            for (i = mPriorityGroups.begin(); i != mPriorityGroups.end(); ++i)
+            {
+                delete i->second;
+            }
+        }
+
+        /** Get an iterator for browsing through child contents. */
+        PriorityMapIterator getIterator(void)
+        {
+            return PriorityMapIterator(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 = new RenderPriorityGroup(this, 
+                    mSplitPassesByLightingType,
+                    mSplitNoShadowPasses, 
+					mShadowCastersNotReceivers);
+                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 rougly 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)
+					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)
+		{
+			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)
+		{
+			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)
+		{
+			PriorityMap::iterator i, iend;
+			iend = mPriorityGroups.end();
+			for (i = mPriorityGroups.begin(); i != iend; ++i)
+			{
+				i->second->defaultOrganisationMode();
+			}
+		}
+
+    };
+
+
+
+}
+
+#endif
+
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreHighLevelGpuProgramManager.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreHighLevelGpuProgramManager.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreHighLevelGpuProgramManager.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef __HighLevelGpuProgramManager_H__
+#define __HighLevelGpuProgramManager_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreResourceManager.h"
+#include "OgreSingleton.h"
+#include "OgreException.h"
+#include "OgreHighLevelGpuProgram.h"
+
+namespace Ogre {
+
+	/** Interface definition for factories of HighLevelGpuProgram. */
+	class _OgreExport HighLevelGpuProgramFactory
+	{
+	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 std::map<String, HighLevelGpuProgramFactory*> FactoryMap;
+	protected:
+		/// Factories capable of creating HighLevelGpuProgram instances
+		FactoryMap mFactories;
+
+		/// Factory for dealing with programs for languages we can't create
+		HighLevelGpuProgramFactory* mNullFactory;
+
+		HighLevelGpuProgramFactory* getFactory(const String& language);
+
+        /// @copydoc ResourceManager::createImpl
+        Resource* createImpl(const String& name, ResourceHandle handle, 
+            const String& group, bool isManual, ManualResourceLoader* loader,
+            const NameValuePairList* params);
+	public:
+		HighLevelGpuProgramManager();
+		~HighLevelGpuProgramManager();
+		/** Add a new factory object for high-level programs of a given language. */
+		void addFactory(HighLevelGpuProgramFactory* factory);
+
+
+        /** 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
+		*/
+		virtual 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);
+
+
+	};
+
+}
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreLight.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreLight.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreLight.h	(revision 1812)
@@ -0,0 +1,407 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#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"
+
+namespace Ogre {
+
+
+    /** 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 diffues 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 havea 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 tesselation and the normals are properly set. This is particularly
+            true for the spotlight which will only look right on highly tesselated 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;
+
+        /// 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,
+            /// Directional lights simulate parallel light beams from a distant source, hence have direction but no position
+            LT_DIRECTIONAL,
+            /// Spotlights simulate a cone of light from a source so require position and direction, plus extra values for falloff
+            LT_SPOTLIGHT
+        };
+
+        /** 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 emenating 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 emenating 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 ie 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 attentuation 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
+                @node
+                    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);
+#ifndef OGRE_FORCE_ANGLE_TYPES
+        inline void setSpotlightRange(Real innerAngle, Real outerAngle, Real falloff = 1.0) {
+            setSpotlightRange ( Angle(innerAngle), Angle(outerAngle), falloff );
+        }
+#endif//OGRE_FORCE_ANGLE_TYPES
+
+        /** 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 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;
+
+        /** Overridden from MovableObject */
+        const AxisAlignedBox& getBoundingBox(void) const;
+
+        /** Overridden from MovableObject */
+        void _updateRenderQueue(RenderQueue* queue);
+
+        /** Overridden from MovableObject */
+        const String& getMovableType(void) const;
+
+        /** Retrieves the position of the light including any transform from nodes it is attached to. */
+        const Vector3& getDerivedPosition(void) const;
+
+        /** Retrieves the direction of the light including any transform from nodes it is attached to. */
+        const Vector3& getDerivedDirection(void) const;
+
+        /** Overridden from MovableObject.
+        @remarks
+            Although lights themselves are not 'visible', setting a light to invisible
+            means it no longer affects the scene.
+        */
+        void setVisible(bool visible);
+
+        /** Overridden from MovableObject */
+        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.
+		*/
+		Vector4 getAs4DVector(void) 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);
+
+    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 mRange;
+        Real mAttenuationConst;
+        Real mAttenuationLinear;
+        Real mAttenuationQuad;
+		Real mPowerScale;
+
+        mutable Vector3 mDerivedPosition;
+        mutable Vector3 mDerivedDirection;
+        /// Stored versions of parent orientation / position
+        mutable Quaternion mLastParentOrientation;
+        mutable Vector3 mLastParentPosition;
+
+        /// Shared class-level name for Movable type
+        static String msMovableType;
+
+        mutable PlaneBoundedVolume mNearClipVolume;
+        mutable PlaneBoundedVolumeList mFrustumClipVolumes;
+        /// Is the local transform dirty?
+        mutable bool mLocalTransformDirty;
+
+
+
+    };
+
+	/** 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);  
+
+	};
+
+} // Namespace
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreAnimable.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreAnimable.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreAnimable.h	(revision 1812)
@@ -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-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#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"
+
+namespace Ogre {
+
+	/** Defines an object property which is animable, ie 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:
+		/// The type of the value being animated
+		enum ValueType
+		{
+			INT,
+			REAL,
+			VECTOR2,
+			VECTOR3,
+			VECTOR4,
+			QUATERNION,
+			COLOUR
+		};
+	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.val, sizeof(Real)*2); }
+		/// Internal method to set a value as base
+		virtual void setAsBaseValue(const Vector3& val) 
+		{ memcpy(mBaseValueReal, val.val, sizeof(Real)*3); }
+		/// Internal method to set a value as base
+		virtual void setAsBaseValue(const Vector4& val) 
+		{ memcpy(mBaseValueReal, val.val, sizeof(Real)*4); }
+		/// Internal method to set a value as base
+		virtual void setAsBaseValue(const Quaternion& val) 
+		{ memcpy(mBaseValueReal, val.val, 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;
+		}
+
+
+	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 val) {
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", "");
+		}
+		/// Set value 
+		virtual void setValue(Real val) {
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", "");
+		}
+		/// Set value 
+		virtual void setValue(const Vector2& val) {
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", "");
+		}
+		/// Set value 
+		virtual void setValue(const Vector3& val) {
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", "");
+		}
+		/// Set value 
+		virtual void setValue(const Vector4& val) {
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", "");
+		}
+		/// Set value 
+		virtual void setValue(const Quaternion& val) {
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", "");
+		}
+		/// Set value 
+		virtual void setValue(const ColourValue& val) {
+			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 val) {
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", "");
+		}
+		/// Set value 
+		virtual void applyDeltaValue(Real val) {
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", "");
+		}
+		/// Apply delta value 
+		virtual void applyDeltaValue(const Vector2& val) {
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", "");
+		}
+		/// Apply delta value 
+		virtual void applyDeltaValue(const Vector3& val) {
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", "");
+		}
+		/// Apply delta value 
+		virtual void applyDeltaValue(const Vector4& val) {
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", "");
+		}
+		/// Apply delta value 
+		virtual void applyDeltaValue(const Quaternion& val) {
+			OGRE_EXCEPT(Exception::ERR_NOT_IMPLEMENTED, "", "");
+		}
+		/// Apply delta value 
+		virtual void applyDeltaValue(const ColourValue& val) {
+			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 std::map<String, StringVector> 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& vec) 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");
+		}
+
+
+
+	};
+
+
+}
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreArchiveFactory.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreArchiveFactory.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreArchiveFactory.h	(revision 1812)
@@ -0,0 +1,58 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+    (Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+#ifndef _ArchiveFactory_H__
+#define _ArchiveFactory_H__
+
+#include "OgrePrerequisites.h"
+
+#include "OgreFactoryObj.h"
+
+namespace Ogre {
+
+    /** 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:
+        // No methods, must just override all methods inherited from FactoryObj
+    };
+
+} // namespace
+
+#endif
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSkeletonInstance.h
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSkeletonInstance.h	(revision 1812)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/include/OgreSkeletonInstance.h	(revision 1812)
@@ -0,0 +1,153 @@
+/*
+-----------------------------------------------------------------------------
+This source file is part of OGRE
+(Object-oriented Graphics Rendering Engine)
+For the latest info, see http://www.ogre3d.org/
+
+Copyright (c) 2000-2005 The OGRE Team
+Also see acknowledgements in Readme.html
+
+This program is free software; you can redistribute it and/or modify it under
+the terms of the GNU Lesser General Public License as published by the Free Software
+Foundation; either version 2 of the License, or (at your option) any later
+version.
+
+This program is distributed in the hope that it will be useful, but WITHOUT
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public License along with
+this program; if not, write to the Free Software Foundation, Inc., 59 Temple
+Place - Suite 330, Boston, MA 02111-1307, USA, or go to
+http://www.gnu.org/copyleft/lesser.txt.
+-----------------------------------------------------------------------------
+*/
+
+#ifndef __SkeletonInstance_H__
+#define __SkeletonInstance_H__
+
+#include "OgrePrerequisites.h"
+#include "OgreSkeleton.h"
+
+namespace Ogre {
+
+    /** 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 std::list<TagPoint*> ActiveTagPointList;
+        typedef std::deque<TagPoint*> FreeTagPointQueue;
+
+        /** Active tag point list.
+        @remarks
+            This is a linked list of pointers to actived tag point
+        @par
+            This allows very fast instertions and deletions from anywhere in the list to activate / deactivate
+            tag points (required for weapon / equip systems etc)    as well as resuse of TagPoint instances
+            without construction & destruction which avoids memory thrashing.
+        */
+        ActiveTagPointList mActiveTagPoints;
+
+        /** Free tag point queue.
+        @remarks
+            This contains a list of the tag points free for use as new instances
+            as required by the set. When a TagPoint instances are deactived, there will are referenced on this
+            deque. As they get used this deque reduces, as they get released back to to the set they get added
+            back to the deque.
+        */
+        FreeTagPointQueue 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);
+
+    };
+
+}
+
+
+#endif
+
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/bin/release/Plugins.cfg
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/bin/release/Plugins.cfg	(revision 1092)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/bin/release/Plugins.cfg	(revision 1812)
@@ -5,5 +5,4 @@
 
 # Define plugins
-Plugin=RenderSystem_Direct3D7
 Plugin=RenderSystem_Direct3D9
 Plugin=RenderSystem_GL
Index: /GTP/trunk/App/Demos/Geom/OgreStuff/bin/debug/Plugins.cfg
===================================================================
--- /GTP/trunk/App/Demos/Geom/OgreStuff/bin/debug/Plugins.cfg	(revision 1092)
+++ /GTP/trunk/App/Demos/Geom/OgreStuff/bin/debug/Plugins.cfg	(revision 1812)
@@ -5,5 +5,4 @@
 
 # Define plugins
-Plugin=RenderSystem_Direct3D7
 Plugin=RenderSystem_Direct3D9
 Plugin=RenderSystem_GL
Index: /GTP/trunk/App/Demos/Geom/Demo_LodTrees/build/Release/Plugins.cfg
===================================================================
--- /GTP/trunk/App/Demos/Geom/Demo_LodTrees/build/Release/Plugins.cfg	(revision 1540)
+++ /GTP/trunk/App/Demos/Geom/Demo_LodTrees/build/Release/Plugins.cfg	(revision 1812)
@@ -5,5 +5,4 @@
 
 # Define plugins
-Plugin=RenderSystem_Direct3D7
 Plugin=RenderSystem_Direct3D9
 Plugin=RenderSystem_GL
Index: /GTP/trunk/App/Demos/Geom/Demo_LodTrees/build/Release/ogre.cfg
===================================================================
--- /GTP/trunk/App/Demos/Geom/Demo_LodTrees/build/Release/ogre.cfg	(revision 1561)
+++ /GTP/trunk/App/Demos/Geom/Demo_LodTrees/build/Release/ogre.cfg	(revision 1812)
@@ -1,7 +1,19 @@
-Render System	Direct3D9 Rendering SubSystem
-Anti aliasing	None
-Floating-point mode	Fastest
-Full Screen	Yes
-Rendering Device	NVIDIA GeForce 6800 Series GPU
-VSync	No
-Video Mode	800 x 600 @ 32-bit colour
+Render System=Direct3D9 Rendering Subsystem
+
+[Direct3D9 Rendering Subsystem]
+Allow NVPerfHUD=No
+Anti aliasing=None
+Floating-point mode=Fastest
+Full Screen=Yes
+Rendering Device=NVIDIA GeForce 6800 Series GPU
+VSync=No
+Video Mode=800 x 600 @ 32-bit colour
+
+[OpenGL Rendering Subsystem]
+Colour Depth=32
+Display Frequency=60
+FSAA=0
+Full Screen=Yes
+RTT Preferred Mode=FBO
+VSync=No
+Video Mode=1024 x 768
Index: /GTP/trunk/App/Demos/Geom/Demo_LodTrees/main.cpp
===================================================================
--- /GTP/trunk/App/Demos/Geom/Demo_LodTrees/main.cpp	(revision 1783)
+++ /GTP/trunk/App/Demos/Geom/Demo_LodTrees/main.cpp	(revision 1812)
@@ -60,4 +60,6 @@
 	Geometry::LodTreeLibrary **lod_tree_types;
 
+	Ogre::TexturePtr shadow_map;
+
 public:
 
@@ -70,9 +72,16 @@
 		for (int i=0; i<num_tree_types; i++)
 			lodfactorBefore[i]=-1;
-		lod_tree_types=lod_trees;
+		lod_tree_types=lod_trees;		
 	}
 
 	bool frameStarted(const FrameEvent& evt)
     {
+		static bool firstFrame=true;
+		if (firstFrame)
+		{
+			CalculateShadowMap();
+			firstFrame=false;
+		}
+
 		Vector3 dist; 
 		int inc2=0,d;
@@ -204,4 +213,8 @@
 		return true;
     }
+
+	void CalculateShadowMap(void)
+	{
+	}
 };
 
@@ -255,5 +268,6 @@
     {
         // Get the SceneManager, in this case a generic one
-		mSceneMgr = mRoot->getSceneManager(Ogre::ST_EXTERIOR_CLOSE);
+	//	mSceneMgr = mRoot->getSceneManager(Ogre::ST_EXTERIOR_CLOSE);
+        mSceneMgr = mRoot->createSceneManager("TerrainSceneManager");
     }
 
@@ -326,4 +340,22 @@
 		mInfo->setCaption("Maintain F2 to disable LOD");
 
+		// create the shadow texture
+		TexturePtr shadow_map = Ogre::TextureManager::getSingleton().createManual("TheShadowMap",
+			ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME,TEX_TYPE_2D,
+			256,256,0,PF_R8G8B8,TU_STATIC_WRITE_ONLY|TU_RENDERTARGET);
+
+/*		// en vez de crear la textura aqui se puee intentar cargar de fichero una y modificarla
+		HardwarePixelBufferSharedPtr shadowBuffer = shadow_map->getBuffer();
+		RenderTarget *render_target = shadowBuffer->getRenderTarget();*/
+
+		HardwarePixelBufferSharedPtr shadowBuffer = shadow_map->getBuffer();
+		RenderTarget *render_target = shadowBuffer->getRenderTarget();
+
+
+//		RenderTarget *rttTex = shadow_map->getBuffer()->getRenderTarget();
+//			mSceneMgr->createCamera("lightCam");
+	
+
+
     }
 
@@ -338,5 +370,5 @@
     {
         mFrameListener= new LodTreeFrameListener(mWindow, mCamera, raySceneQuery, lod_tree_types);
-        mFrameListener->showDebugOverlay(true);
+        mFrameListener->showDebugOverlay(false);
         mRoot->addFrameListener(mFrameListener);
     }
@@ -359,11 +391,16 @@
 
 		Ogre::Entity *entity = mSceneMgr->createEntity(newMeshName,filename);		
-		if (!entity->getMesh().unique())
-		{
+//		if (!entity->getMesh().unique())
+//		{
 			static int iclone = 0;
 			char newCloneMesh[16]="";
-			sprintf(newCloneMesh,"clonetree_%d",iclone++);
-			entity->getMesh() = entity->getMesh()->clone(newCloneMesh);
-		}
+			sprintf(newCloneMesh,"clonemesh_%d",iclone);
+			char newCloneEntity[16]="";
+			sprintf(newCloneEntity,"cloneentity_%d",iclone);
+			iclone++;
+
+			Ogre::MeshPtr newmesh = entity->getMesh()->clone(newCloneMesh);
+			entity = mSceneMgr->createEntity(newCloneEntity,newCloneMesh);
+//		}
 		Ogre::Mesh *ogreMesh = entity->getMesh().getPointer();
 		entity->setNormaliseNormals(true);
