Explorar o código

Merged camera and frustum

Marko Pintera %!s(int64=13) %!d(string=hai) anos
pai
achega
7b0a310ce5

+ 0 - 5
CamelotD3D9Renderer/Include/CmD3D9RenderSystem.h

@@ -80,8 +80,6 @@ namespace CamelotEngine
 			size_t coordIndex;
 			size_t coordIndex;
 			/// type of auto tex. calc. used
 			/// type of auto tex. calc. used
 			TexCoordCalcMethod autoTexCoordType;
 			TexCoordCalcMethod autoTexCoordType;
-            /// Frustum, used if the above is projection
-            const Frustum *frustum;
 			/// texture 
 			/// texture 
 			IDirect3DBaseTexture9 *pTex;
 			IDirect3DBaseTexture9 *pTex;
 			/// vertex texture 
 			/// vertex texture 
@@ -233,12 +231,9 @@ namespace CamelotEngine
 		void _setVertexTexture(size_t unit, const TexturePtr& tex);
 		void _setVertexTexture(size_t unit, const TexturePtr& tex);
 		void _disableTextureUnit(size_t texUnit);
 		void _disableTextureUnit(size_t texUnit);
 		void _setTextureCoordSet( size_t unit, size_t index );
 		void _setTextureCoordSet( size_t unit, size_t index );
-        void _setTextureCoordCalculation(size_t unit, TexCoordCalcMethod m, 
-            const Frustum* frustum = 0);
         void _setTextureAddressingMode(size_t stage, const TextureState::UVWAddressingMode& uvw);
         void _setTextureAddressingMode(size_t stage, const TextureState::UVWAddressingMode& uvw);
         void _setTextureBorderColour(size_t stage, const Color& colour);
         void _setTextureBorderColour(size_t stage, const Color& colour);
 		void _setTextureMipmapBias(size_t unit, float bias);
 		void _setTextureMipmapBias(size_t unit, float bias);
-		void _setTextureMatrix( size_t unit, const Matrix4 &xform );
 		void _setSceneBlending( SceneBlendFactor sourceFactor, SceneBlendFactor destFactor, SceneBlendOperation op );
 		void _setSceneBlending( SceneBlendFactor sourceFactor, SceneBlendFactor destFactor, SceneBlendOperation op );
 		void _setSeparateSceneBlending( SceneBlendFactor sourceFactor, SceneBlendFactor destFactor, SceneBlendFactor sourceFactorAlpha, SceneBlendFactor destFactorAlpha, SceneBlendOperation op, SceneBlendOperation alphaOp );
 		void _setSeparateSceneBlending( SceneBlendFactor sourceFactor, SceneBlendFactor destFactor, SceneBlendFactor sourceFactorAlpha, SceneBlendFactor destFactorAlpha, SceneBlendOperation op, SceneBlendOperation alphaOp );
 		void _setAlphaRejectSettings( CompareFunction func, unsigned char value, bool alphaToCoverage );
 		void _setAlphaRejectSettings( CompareFunction func, unsigned char value, bool alphaToCoverage );

+ 4 - 222
CamelotD3D9Renderer/Source/CmD3D9RenderSystem.cpp

@@ -1490,8 +1490,8 @@ namespace CamelotEngine
 		float q, qn;
 		float q, qn;
 		if (farPlane == 0)
 		if (farPlane == 0)
 		{
 		{
-			q = 1 - Frustum::INFINITE_FAR_PLANE_ADJUST;
-			qn = nearPlane * (Frustum::INFINITE_FAR_PLANE_ADJUST - 1);
+			q = 1 - Camera::INFINITE_FAR_PLANE_ADJUST;
+			qn = nearPlane * (Camera::INFINITE_FAR_PLANE_ADJUST - 1);
 		}
 		}
 		else
 		else
 		{
 		{
@@ -1819,19 +1819,6 @@ namespace CamelotEngine
 			CM_EXCEPT(RenderingAPIException, "Unable to set texture coord. set index");
 			CM_EXCEPT(RenderingAPIException, "Unable to set texture coord. set index");
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	void D3D9RenderSystem::_setTextureCoordCalculation( size_t stage, TexCoordCalcMethod m,
-		const Frustum* frustum)
-	{
-		HRESULT hr;
-		// record the stage state
-		mTexStageDesc[stage].autoTexCoordType = m;
-		mTexStageDesc[stage].frustum = frustum;
-
-		hr = __SetTextureStageState( static_cast<DWORD>(stage), D3DTSS_TEXCOORDINDEX, D3D9Mappings::get(m, mDeviceManager->getActiveDevice()->getD3D9DeviceCaps()) | mTexStageDesc[stage].coordIndex );
-		if(FAILED(hr))
-			CM_EXCEPT(RenderingAPIException, "Unable to set texture auto tex.coord. generation mode");
-	}
-	//---------------------------------------------------------------------
 	void D3D9RenderSystem::_setTextureMipmapBias(size_t unit, float bias)
 	void D3D9RenderSystem::_setTextureMipmapBias(size_t unit, float bias)
 	{
 	{
 		if (mCurrentCapabilities->hasCapability(RSC_MIPMAP_LOD_BIAS))
 		if (mCurrentCapabilities->hasCapability(RSC_MIPMAP_LOD_BIAS))
@@ -1845,211 +1832,6 @@ namespace CamelotEngine
 		}
 		}
 	}
 	}
 	//---------------------------------------------------------------------
 	//---------------------------------------------------------------------
-	void D3D9RenderSystem::_setTextureMatrix( size_t stage, const Matrix4& xForm )
-	{
-		HRESULT hr;
-		D3DXMATRIX d3dMat; // the matrix we'll maybe apply
-		Matrix4 newMat = xForm; // the matrix we'll apply after conv. to D3D format
-		// Cache texcoord calc method to register
-		TexCoordCalcMethod autoTexCoordType = mTexStageDesc[stage].autoTexCoordType;
-
-		// if a vertex program is bound, we mustn't set texture transforms
-		if (mVertexProgramBound)
-		{
-			hr = __SetTextureStageState( static_cast<DWORD>(stage), D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE );
-			if( FAILED( hr ) )
-				CM_EXCEPT(RenderingAPIException, "Unable to disable texture coordinate transform");
-			return;
-		}
-
-
-		if (autoTexCoordType == TEXCALC_ENVIRONMENT_MAP)
-		{
-			if (mDeviceManager->getActiveDevice()->getD3D9DeviceCaps().VertexProcessingCaps & D3DVTXPCAPS_TEXGEN_SPHEREMAP)
-			{
-				/** Invert the texture for the spheremap */
-				Matrix4 ogreMatEnvMap = Matrix4::IDENTITY;
-				// set env_map values
-				ogreMatEnvMap[1][1] = -1.0f;
-				// concatenate with the xForm
-				newMat = newMat.concatenate(ogreMatEnvMap);
-			}
-			else
-			{
-				/* If envmap is applied, but device doesn't support spheremap,
-				then we have to use texture transform to make the camera space normal
-				reference the envmap properly. This isn't exactly the same as spheremap
-				(it looks nasty on flat areas because the camera space normals are the same)
-				but it's the best approximation we have in the absence of a proper spheremap */
-				// concatenate with the xForm
-				newMat = newMat.concatenate(Matrix4::CLIPSPACE2DTOIMAGESPACE);
-			}
-		}
-
-		// If this is a cubic reflection, we need to modify using the view matrix
-		if (autoTexCoordType == TEXCALC_ENVIRONMENT_MAP_REFLECTION)
-		{
-			// Get transposed 3x3
-			// We want to transpose since that will invert an orthonormal matrix ie rotation
-			Matrix4 ogreViewTransposed;
-			ogreViewTransposed[0][0] = mViewMatrix[0][0];
-			ogreViewTransposed[0][1] = mViewMatrix[1][0];
-			ogreViewTransposed[0][2] = mViewMatrix[2][0];
-			ogreViewTransposed[0][3] = 0.0f;
-
-			ogreViewTransposed[1][0] = mViewMatrix[0][1];
-			ogreViewTransposed[1][1] = mViewMatrix[1][1];
-			ogreViewTransposed[1][2] = mViewMatrix[2][1];
-			ogreViewTransposed[1][3] = 0.0f;
-
-			ogreViewTransposed[2][0] = mViewMatrix[0][2];
-			ogreViewTransposed[2][1] = mViewMatrix[1][2];
-			ogreViewTransposed[2][2] = mViewMatrix[2][2];
-			ogreViewTransposed[2][3] = 0.0f;
-
-			ogreViewTransposed[3][0] = 0.0f;
-			ogreViewTransposed[3][1] = 0.0f;
-			ogreViewTransposed[3][2] = 0.0f;
-			ogreViewTransposed[3][3] = 1.0f;
-
-			newMat = newMat.concatenate(ogreViewTransposed);
-		}
-
-		if (autoTexCoordType == TEXCALC_PROJECTIVE_TEXTURE)
-		{
-			// Derive camera space to projector space transform
-			// To do this, we need to undo the camera view matrix, then 
-			// apply the projector view & projection matrices
-			newMat = mViewMatrix.inverse();
-			if(mTexProjRelative)
-			{
-				Matrix4 viewMatrix;
-				mTexStageDesc[stage].frustum->calcViewMatrixRelative(mTexProjRelativeOrigin, viewMatrix);
-				newMat = viewMatrix * newMat;
-			}
-			else
-			{
-				newMat = mTexStageDesc[stage].frustum->getViewMatrix() * newMat;
-			}
-			newMat = mTexStageDesc[stage].frustum->getProjectionMatrix() * newMat;
-			newMat = Matrix4::CLIPSPACE2DTOIMAGESPACE * newMat;
-			newMat = xForm * newMat;
-		}
-
-		// need this if texture is a cube map, to invert D3D's z coord
-		if (autoTexCoordType != TEXCALC_NONE &&
-			autoTexCoordType != TEXCALC_PROJECTIVE_TEXTURE)
-		{
-			newMat[2][0] = -newMat[2][0];
-			newMat[2][1] = -newMat[2][1];
-			newMat[2][2] = -newMat[2][2];
-			newMat[2][3] = -newMat[2][3];
-		}
-
-		// convert our matrix to D3D format
-		d3dMat = D3D9Mappings::makeD3DXMatrix(newMat);
-
-		// set the matrix if it's not the identity
-		if (!D3DXMatrixIsIdentity(&d3dMat))
-		{
-			/* It's seems D3D automatically add a texture coordinate with value 1,
-			and fill up the remaining texture coordinates with 0 for the input
-			texture coordinates before pass to texture coordinate transformation.
-
-			NOTE: It's difference with D3DDECLTYPE enumerated type expand in
-			DirectX SDK documentation!
-
-			So we should prepare the texcoord transform, make the transformation
-			just like standardized vector expand, thus, fill w with value 1 and
-			others with 0.
-			*/
-			if (autoTexCoordType == TEXCALC_NONE)
-			{
-				/* FIXME: The actually input texture coordinate dimensions should
-				be determine by texture coordinate vertex element. Now, just trust
-				user supplied texture type matchs texture coordinate vertex element.
-				*/
-				if (mTexStageDesc[stage].texType == D3D9Mappings::D3D_TEX_TYPE_NORMAL)
-				{
-					/* It's 2D input texture coordinate:
-
-					texcoord in vertex buffer     D3D expanded to     We are adjusted to
-					-->                 -->
-					(u, v)               (u, v, 1, 0)          (u, v, 0, 1)
-					*/
-					std::swap(d3dMat._31, d3dMat._41);
-					std::swap(d3dMat._32, d3dMat._42);
-					std::swap(d3dMat._33, d3dMat._43);
-					std::swap(d3dMat._34, d3dMat._44);
-				}
-			}
-			else
-			{
-				// All texgen generate 3D input texture coordinates.
-			}
-
-			// tell D3D the dimension of tex. coord.
-			int texCoordDim = D3DTTFF_COUNT2;
-			if (mTexStageDesc[stage].autoTexCoordType == TEXCALC_PROJECTIVE_TEXTURE)
-			{
-				/* We want texcoords (u, v, w, q) always get divided by q, but D3D
-				projected texcoords is divided by the last element (in the case of
-				2D texcoord, is w). So we tweak the transform matrix, transform the
-				texcoords with w and q swapped: (u, v, q, w), and then D3D will
-				divide u, v by q. The w and q just ignored as it wasn't used by
-				rasterizer.
-				*/
-				switch (mTexStageDesc[stage].texType)
-				{
-				case D3D9Mappings::D3D_TEX_TYPE_NORMAL:
-					std::swap(d3dMat._13, d3dMat._14);
-					std::swap(d3dMat._23, d3dMat._24);
-					std::swap(d3dMat._33, d3dMat._34);
-					std::swap(d3dMat._43, d3dMat._44);
-
-					texCoordDim = D3DTTFF_PROJECTED | D3DTTFF_COUNT3;
-					break;
-
-				case D3D9Mappings::D3D_TEX_TYPE_CUBE:
-				case D3D9Mappings::D3D_TEX_TYPE_VOLUME:
-					// Yes, we support 3D projective texture.
-					texCoordDim = D3DTTFF_PROJECTED | D3DTTFF_COUNT4;
-					break;
-				}
-			}
-			else
-			{
-				switch (mTexStageDesc[stage].texType)
-				{
-				case D3D9Mappings::D3D_TEX_TYPE_NORMAL:
-					texCoordDim = D3DTTFF_COUNT2;
-					break;
-				case D3D9Mappings::D3D_TEX_TYPE_CUBE:
-				case D3D9Mappings::D3D_TEX_TYPE_VOLUME:
-					texCoordDim = D3DTTFF_COUNT3;
-					break;
-				}
-			}
-
-			hr = __SetTextureStageState( static_cast<DWORD>(stage), D3DTSS_TEXTURETRANSFORMFLAGS, texCoordDim );
-			if (FAILED(hr))
-				CM_EXCEPT(RenderingAPIException, "Unable to set texture coord. dimension");
-
-			hr = getActiveD3D9Device()->SetTransform( (D3DTRANSFORMSTATETYPE)(D3DTS_TEXTURE0 + stage), &d3dMat );
-			if (FAILED(hr))
-				CM_EXCEPT(RenderingAPIException, "Unable to set texture matrix");
-		}
-		else
-		{
-			// disable all of this
-			hr = __SetTextureStageState( static_cast<DWORD>(stage), D3DTSS_TEXTURETRANSFORMFLAGS, D3DTTFF_DISABLE );
-			if( FAILED( hr ) )
-				CM_EXCEPT(RenderingAPIException, "Unable to disable texture coordinate transform");
-
-			// Needless to sets texture transform here, it's never used at all
-		}
-	}
-	//---------------------------------------------------------------------
 	void D3D9RenderSystem::_setTextureAddressingMode( size_t stage, 
 	void D3D9RenderSystem::_setTextureAddressingMode( size_t stage, 
 		const TextureState::UVWAddressingMode& uvw )
 		const TextureState::UVWAddressingMode& uvw )
 	{
 	{
@@ -3261,8 +3043,8 @@ namespace CamelotEngine
 		float q, qn;
 		float q, qn;
 		if (farPlane == 0)
 		if (farPlane == 0)
 		{
 		{
-			q = 1 - Frustum::INFINITE_FAR_PLANE_ADJUST;
-			qn = nearPlane * (Frustum::INFINITE_FAR_PLANE_ADJUST - 1);
+			q = 1 - Camera::INFINITE_FAR_PLANE_ADJUST;
+			qn = nearPlane * (Camera::INFINITE_FAR_PLANE_ADJUST - 1);
 		}
 		}
 		else
 		else
 		{
 		{

+ 0 - 9
CamelotGLRenderer/Include/CmGLRenderSystem.h

@@ -254,11 +254,6 @@ namespace CamelotEngine {
           RenderSystem
           RenderSystem
          */
          */
         void _setTextureCoordSet(size_t stage, size_t index);
         void _setTextureCoordSet(size_t stage, size_t index);
-        /** See
-          RenderSystem
-         */
-        void _setTextureCoordCalculation(size_t stage, TexCoordCalcMethod m, 
-            const Frustum* frustum = 0);
         /** See
         /** See
           RenderSystem
           RenderSystem
          */
          */
@@ -271,10 +266,6 @@ namespace CamelotEngine {
 		  RenderSystem
 		  RenderSystem
 		 */
 		 */
 		void _setTextureMipmapBias(size_t unit, float bias);
 		void _setTextureMipmapBias(size_t unit, float bias);
-        /** See
-          RenderSystem
-         */
-        void _setTextureMatrix(size_t stage, const Matrix4& xform);
         /** See
         /** See
           RenderSystem
           RenderSystem
          */
          */

+ 4 - 180
CamelotGLRenderer/Source/CmGLRenderSystem.cpp

@@ -1353,154 +1353,6 @@ namespace CamelotEngine {
 		mTextureCoordIndex[stage] = index;
 		mTextureCoordIndex[stage] = index;
 	}
 	}
 	//-----------------------------------------------------------------------------
 	//-----------------------------------------------------------------------------
-	void GLRenderSystem::_setTextureCoordCalculation(size_t stage, TexCoordCalcMethod m, 
-		const Frustum* frustum)
-	{
-		if (stage >= mFixedFunctionTextureUnits)
-		{
-			// Can't do this
-			return;
-		}
-
-
-		GLfloat M[16];
-		Matrix4 projectionBias;
-
-		// Default to no extra auto texture matrix
-		mUseAutoTextureMatrix = false;
-
-		GLfloat eyePlaneS[] = {1.0, 0.0, 0.0, 0.0};
-		GLfloat eyePlaneT[] = {0.0, 1.0, 0.0, 0.0};
-		GLfloat eyePlaneR[] = {0.0, 0.0, 1.0, 0.0};
-		GLfloat eyePlaneQ[] = {0.0, 0.0, 0.0, 1.0};
-
-		if (!activateGLTextureUnit(stage))
-			return;
-
-		switch( m )
-		{
-		case TEXCALC_NONE:
-			glDisable( GL_TEXTURE_GEN_S );
-			glDisable( GL_TEXTURE_GEN_T );
-			glDisable( GL_TEXTURE_GEN_R );
-			glDisable( GL_TEXTURE_GEN_Q );
-			break;
-
-		case TEXCALC_ENVIRONMENT_MAP:
-			glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP );
-			glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP );
-
-			glEnable( GL_TEXTURE_GEN_S );
-			glEnable( GL_TEXTURE_GEN_T );
-			glDisable( GL_TEXTURE_GEN_R );
-			glDisable( GL_TEXTURE_GEN_Q );
-
-			// Need to use a texture matrix to flip the spheremap
-			mUseAutoTextureMatrix = true;
-			memset(mAutoTextureMatrix, 0, sizeof(GLfloat)*16);
-			mAutoTextureMatrix[0] = mAutoTextureMatrix[10] = mAutoTextureMatrix[15] = 1.0f;
-			mAutoTextureMatrix[5] = -1.0f;
-
-			break;
-
-		case TEXCALC_ENVIRONMENT_MAP_PLANAR:            
-			// XXX This doesn't seem right?!
-#ifdef GL_VERSION_1_3
-			glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP );
-			glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP );
-			glTexGeni( GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP );
-
-			glEnable( GL_TEXTURE_GEN_S );
-			glEnable( GL_TEXTURE_GEN_T );
-			glEnable( GL_TEXTURE_GEN_R );
-			glDisable( GL_TEXTURE_GEN_Q );
-#else
-			glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP );
-			glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP );
-
-			glEnable( GL_TEXTURE_GEN_S );
-			glEnable( GL_TEXTURE_GEN_T );
-			glDisable( GL_TEXTURE_GEN_R );
-			glDisable( GL_TEXTURE_GEN_Q );
-#endif
-			break;
-		case TEXCALC_ENVIRONMENT_MAP_REFLECTION:
-
-			glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP );
-			glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP );
-			glTexGeni( GL_R, GL_TEXTURE_GEN_MODE, GL_REFLECTION_MAP );
-
-			glEnable( GL_TEXTURE_GEN_S );
-			glEnable( GL_TEXTURE_GEN_T );
-			glEnable( GL_TEXTURE_GEN_R );
-			glDisable( GL_TEXTURE_GEN_Q );
-
-			// We need an extra texture matrix here
-			// This sets the texture matrix to be the inverse of the view matrix
-			mUseAutoTextureMatrix = true;
-			makeGLMatrix( M, mViewMatrix);
-
-			// Transpose 3x3 in order to invert matrix (rotation)
-			// Note that we need to invert the Z _before_ the rotation
-			// No idea why we have to invert the Z at all, but reflection is wrong without it
-			mAutoTextureMatrix[0] = M[0]; mAutoTextureMatrix[1] = M[4]; mAutoTextureMatrix[2] = -M[8];
-			mAutoTextureMatrix[4] = M[1]; mAutoTextureMatrix[5] = M[5]; mAutoTextureMatrix[6] = -M[9];
-			mAutoTextureMatrix[8] = M[2]; mAutoTextureMatrix[9] = M[6]; mAutoTextureMatrix[10] = -M[10];
-			mAutoTextureMatrix[3] = mAutoTextureMatrix[7] = mAutoTextureMatrix[11] = 0.0f;
-			mAutoTextureMatrix[12] = mAutoTextureMatrix[13] = mAutoTextureMatrix[14] = 0.0f;
-			mAutoTextureMatrix[15] = 1.0f;
-
-			break;
-		case TEXCALC_ENVIRONMENT_MAP_NORMAL:
-			glTexGeni( GL_S, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP );
-			glTexGeni( GL_T, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP );
-			glTexGeni( GL_R, GL_TEXTURE_GEN_MODE, GL_NORMAL_MAP );
-
-			glEnable( GL_TEXTURE_GEN_S );
-			glEnable( GL_TEXTURE_GEN_T );
-			glEnable( GL_TEXTURE_GEN_R );
-			glDisable( GL_TEXTURE_GEN_Q );
-			break;
-		case TEXCALC_PROJECTIVE_TEXTURE:
-			glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
-			glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
-			glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
-			glTexGeni(GL_Q, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
-			glTexGenfv(GL_S, GL_EYE_PLANE, eyePlaneS);
-			glTexGenfv(GL_T, GL_EYE_PLANE, eyePlaneT);
-			glTexGenfv(GL_R, GL_EYE_PLANE, eyePlaneR);
-			glTexGenfv(GL_Q, GL_EYE_PLANE, eyePlaneQ);
-			glEnable(GL_TEXTURE_GEN_S);
-			glEnable(GL_TEXTURE_GEN_T);
-			glEnable(GL_TEXTURE_GEN_R);
-			glEnable(GL_TEXTURE_GEN_Q);
-
-			mUseAutoTextureMatrix = true;
-
-			// Set scale and translation matrix for projective textures
-			projectionBias = Matrix4::CLIPSPACE2DTOIMAGESPACE;
-
-			projectionBias = projectionBias * frustum->getProjectionMatrix();
-			if(mTexProjRelative)
-			{
-				Matrix4 viewMatrix;
-				frustum->calcViewMatrixRelative(mTexProjRelativeOrigin, viewMatrix);
-				projectionBias = projectionBias * viewMatrix;
-			}
-			else
-			{
-				projectionBias = projectionBias * frustum->getViewMatrix();
-			}
-			projectionBias = projectionBias * mWorldMatrix;
-
-			makeGLMatrix(mAutoTextureMatrix, projectionBias);
-			break;
-		default:
-			break;
-		}
-		activateGLTextureUnit(0);
-	}
-	//-----------------------------------------------------------------------------
 	GLint GLRenderSystem::getTextureAddressingMode(
 	GLint GLRenderSystem::getTextureAddressingMode(
 		TextureState::TextureAddressingMode tam) const
 		TextureState::TextureAddressingMode tam) const
 	{
 	{
@@ -1555,34 +1407,6 @@ namespace CamelotEngine {
 
 
 	}
 	}
 	//-----------------------------------------------------------------------------
 	//-----------------------------------------------------------------------------
-	void GLRenderSystem::_setTextureMatrix(size_t stage, const Matrix4& xform)
-	{
-		if (stage >= mFixedFunctionTextureUnits)
-		{
-			// Can't do this
-			return;
-		}
-
-		GLfloat mat[16];
-		makeGLMatrix(mat, xform);
-
-		if (!activateGLTextureUnit(stage))
-			return;
-		glMatrixMode(GL_TEXTURE);
-
-		// Load this matrix in
-		glLoadMatrixf(mat);
-
-		if (mUseAutoTextureMatrix)
-		{
-			// Concat auto matrix
-			glMultMatrixf(mAutoTextureMatrix);
-		}
-
-		glMatrixMode(GL_MODELVIEW);
-		activateGLTextureUnit(0);
-	}
-	//-----------------------------------------------------------------------------
 	GLint GLRenderSystem::getBlendMode(SceneBlendFactor ogreBlend) const
 	GLint GLRenderSystem::getBlendMode(SceneBlendFactor ogreBlend) const
 	{
 	{
 		switch(ogreBlend)
 		switch(ogreBlend)
@@ -2002,8 +1826,8 @@ namespace CamelotEngine {
 		if (farPlane == 0)
 		if (farPlane == 0)
 		{
 		{
 			// Infinite far plane
 			// Infinite far plane
-			q = Frustum::INFINITE_FAR_PLANE_ADJUST - 1;
-			qn = nearPlane * (Frustum::INFINITE_FAR_PLANE_ADJUST - 2);
+			q = Camera::INFINITE_FAR_PLANE_ADJUST - 1;
+			qn = nearPlane * (Camera::INFINITE_FAR_PLANE_ADJUST - 2);
 		}
 		}
 		else
 		else
 		{
 		{
@@ -2921,8 +2745,8 @@ namespace CamelotEngine {
 		if (farPlane == 0)
 		if (farPlane == 0)
 		{
 		{
 			// Infinite far plane
 			// Infinite far plane
-			q = Frustum::INFINITE_FAR_PLANE_ADJUST - 1;
-			qn = nearPlane * (Frustum::INFINITE_FAR_PLANE_ADJUST - 2);
+			q = Camera::INFINITE_FAR_PLANE_ADJUST - 1;
+			qn = nearPlane * (Camera::INFINITE_FAR_PLANE_ADJUST - 2);
 		}
 		}
 		else
 		else
 		{
 		{

+ 0 - 2
CamelotRenderer/CamelotRenderer.vcxproj

@@ -101,7 +101,6 @@
     <ClInclude Include="Include\CmCommon.h" />
     <ClInclude Include="Include\CmCommon.h" />
     <ClInclude Include="Include\CmConfigOptionMap.h" />
     <ClInclude Include="Include\CmConfigOptionMap.h" />
     <ClInclude Include="Include\CmDefaultHardwareBufferManager.h" />
     <ClInclude Include="Include\CmDefaultHardwareBufferManager.h" />
-    <ClInclude Include="Include\CmFrustum.h" />
     <ClInclude Include="Include\CmGpuProgram.h" />
     <ClInclude Include="Include\CmGpuProgram.h" />
     <ClInclude Include="Include\CmGpuProgramManager.h" />
     <ClInclude Include="Include\CmGpuProgramManager.h" />
     <ClInclude Include="Include\CmGpuProgramParams.h" />
     <ClInclude Include="Include\CmGpuProgramParams.h" />
@@ -147,7 +146,6 @@
     <ClCompile Include="Source\CmCgProgram.cpp" />
     <ClCompile Include="Source\CmCgProgram.cpp" />
     <ClCompile Include="Source\CmCgProgramFactory.cpp" />
     <ClCompile Include="Source\CmCgProgramFactory.cpp" />
     <ClCompile Include="Source\CmDefaultHardwareBufferManager.cpp" />
     <ClCompile Include="Source\CmDefaultHardwareBufferManager.cpp" />
-    <ClCompile Include="Source\CmFrustum.cpp" />
     <ClCompile Include="Source\CmGpuProgram.cpp" />
     <ClCompile Include="Source\CmGpuProgram.cpp" />
     <ClCompile Include="Source\CmGpuProgramManager.cpp" />
     <ClCompile Include="Source\CmGpuProgramManager.cpp" />
     <ClCompile Include="Source\CmGpuProgramParams.cpp" />
     <ClCompile Include="Source\CmGpuProgramParams.cpp" />

+ 0 - 6
CamelotRenderer/CamelotRenderer.vcxproj.filters

@@ -79,9 +79,6 @@
     <ClInclude Include="Include\CmCamera.h">
     <ClInclude Include="Include\CmCamera.h">
       <Filter>Header Files</Filter>
       <Filter>Header Files</Filter>
     </ClInclude>
     </ClInclude>
-    <ClInclude Include="Include\CmFrustum.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="Include\CmViewport.h">
     <ClInclude Include="Include\CmViewport.h">
       <Filter>Header Files</Filter>
       <Filter>Header Files</Filter>
     </ClInclude>
     </ClInclude>
@@ -210,9 +207,6 @@
     <ClCompile Include="Source\CmCamera.cpp">
     <ClCompile Include="Source\CmCamera.cpp">
       <Filter>Source Files</Filter>
       <Filter>Source Files</Filter>
     </ClCompile>
     </ClCompile>
-    <ClCompile Include="Source\CmFrustum.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="Source\CmViewport.cpp">
     <ClCompile Include="Source\CmViewport.cpp">
       <Filter>Source Files</Filter>
       <Filter>Source Files</Filter>
     </ClCompile>
     </ClCompile>

+ 449 - 69
CamelotRenderer/Include/CmCamera.h

@@ -36,15 +36,37 @@ THE SOFTWARE.
 // Matrices & Vectors
 // Matrices & Vectors
 #include "CmMatrix4.h"
 #include "CmMatrix4.h"
 #include "CmVector3.h"
 #include "CmVector3.h"
+#include "CmVector2.h"
+#include "CmAxisAlignedBox.h"
+#include "CmVertexIndexData.h"
 #include "CmPlane.h"
 #include "CmPlane.h"
 #include "CmQuaternion.h"
 #include "CmQuaternion.h"
 #include "CmCommon.h"
 #include "CmCommon.h"
-#include "CmFrustum.h"
 #include "CmRay.h"
 #include "CmRay.h"
 
 
 
 
 namespace CamelotEngine {
 namespace CamelotEngine {
 
 
+	/** 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
+    };
+
 	/** \addtogroup Core
 	/** \addtogroup Core
 	*  @{
 	*  @{
 	*/
 	*/
@@ -80,8 +102,428 @@ namespace CamelotEngine {
             This is useful for implementing more complex Camera / object
             This is useful for implementing more complex Camera / object
             relationships i.e. having a camera attached to a world object.
             relationships i.e. having a camera attached to a world object.
     */
     */
-    class CM_EXPORT Camera : public Frustum
+    class CM_EXPORT Camera
     {
     {
+	protected:
+        /// Orthographic or perspective?
+        ProjectionType mProjType;
+
+        /// y-direction field-of-view (default 45)
+        Radian mFOVy;
+        /// Far clip distance - default 10000
+        float mFarDist;
+        /// Near clip distance - default 100
+        float mNearDist;
+        /// x/y viewport ratio - default 1.3333
+        float mAspect;
+		/// Ortho height size (world units)
+		float mOrthoHeight;
+        /// Off-axis frustum center offset - default (0.0, 0.0)
+        Vector2 mFrustumOffset;
+        /// Focal length of frustum (for stereo rendering, defaults to 1.0)
+        float mFocalLength;
+
+        /// The 6 main clipping planes
+        mutable Plane mFrustumPlanes[6];
+
+        /// Stored versions of parent orientation / position
+        mutable Quaternion mLastParentOrientation;
+        mutable Vector3 mLastParentPosition;
+
+        /// Pre-calced projection matrix for the specific render system
+        mutable Matrix4 mProjMatrixRS;
+        /// Pre-calced standard projection matrix but with render system depth range
+        mutable Matrix4 mProjMatrixRSDepth;
+        /// Pre-calced standard projection matrix
+        mutable Matrix4 mProjMatrix;
+        /// Pre-calced view matrix
+        mutable Matrix4 mViewMatrix;
+        /// Something's changed in the frustum shape?
+        mutable bool mRecalcFrustum;
+        /// Something re the view pos has changed
+        mutable bool mRecalcView;
+        /// Something re the frustum planes has changed
+        mutable bool mRecalcFrustumPlanes;
+        /// Something re the world space corners has changed
+        mutable bool mRecalcWorldSpaceCorners;
+        /// Something re the vertex data has changed
+        mutable bool mRecalcVertexData;
+		/// Are we using a custom view matrix?
+		bool mCustomViewMatrix;
+		/// Are we using a custom projection matrix?
+		bool mCustomProjMatrix;
+		/// Have the frustum extents been manually set?
+		bool mFrustumExtentsManuallySet;
+		/// Frustum extents
+		mutable float mLeft, mRight, mTop, mBottom;
+		
+        // Internal functions for calcs
+        virtual void calcProjectionParameters(float& left, float& right, float& bottom, float& 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;
+
+        mutable AxisAlignedBox mBoundingBox;
+        mutable VertexData mVertexData;
+
+        mutable Vector3 mWorldSpaceCorners[8];
+
+    public:
+        /** Sets the Y-dimension Field Of View (FOV) of the frustum.
+            @remarks
+                Field Of View (FOV) is the angle made between the frustum's position, and the edges
+                of the 'screen' onto which the scene is projected. High values (90+ degrees) result in a wide-angle,
+                fish-eye kind of view, low values (30- degrees) in a stretched, telescopic kind of view. Typical values
+                are between 45 and 60 degrees.
+            @par
+                This value represents the VERTICAL field-of-view. The horizontal field of view is calculated from
+                this depending on the dimensions of the viewport (they will only be the same if the viewport is square).
+            @note
+                Setting the FOV overrides the value supplied for frustum::setNearClipPlane.
+         */
+        virtual void setFOVy(const Radian& fovy);
+
+        /** Retrieves the frustums Y-dimension Field Of View (FOV).
+        */
+        virtual const Radian& getFOVy(void) const;
+
+        /** Sets the position of the near clipping plane.
+            @remarks
+                The position of the near clipping plane is the distance from the frustums position to the screen
+                on which the world is projected. The near plane distance, combined with the field-of-view and the
+                aspect ratio, determines the size of the viewport through which the world is viewed (in world
+                co-ordinates). Note that this world viewport is different to a screen viewport, which has it's
+                dimensions expressed in pixels. The frustums viewport should have the same aspect ratio as the
+                screen viewport it renders into to avoid distortion.
+            @param
+                near The distance to the near clipping plane from the frustum in world coordinates.
+         */
+        virtual void setNearClipDistance(float nearDist);
+
+        /** Sets the position of the near clipping plane.
+        */
+        virtual float getNearClipDistance(void) const;
+
+        /** Sets the distance to the far clipping plane.
+            @remarks
+                The view frustum is a pyramid created from the frustum position and the edges of the viewport.
+                This method sets the distance for the far end of that pyramid. 
+                Different applications need different values: e.g. a flight sim
+                needs a much further far clipping plane than a first-person 
+                shooter. An important point here is that the larger the ratio 
+                between near and far clipping planes, the lower the accuracy of
+                the Z-buffer used to depth-cue pixels. This is because the
+                Z-range is limited to the size of the Z buffer (16 or 32-bit) 
+                and the max values must be spread over the gap between near and
+                far clip planes. As it happens, you can affect the accuracy far 
+                more by altering the near distance rather than the far distance, 
+                but keep this in mind.
+            @param
+                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(float farDist);
+
+        /** Retrieves the distance from the frustum to the far clipping plane.
+        */
+        virtual float 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(float ratio);
+
+        /** Retreives the current aspect ratio.
+        */
+        virtual float 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(float horizontal = 0.0, float vertical = 0.0);
+
+        /** Retrieves the frustum offsets.
+        */
+        virtual const Vector2& getFrustumOffset() const;
+
+        /** Sets frustum focal length (used in stereo rendering).
+            @param
+                focalLength The distance to the focal plane from the frustum in world coordinates.
+        */
+        virtual void setFocalLength(float focalLength = 1.0);
+
+        /** Returns focal length of frustum.
+        */
+        virtual float getFocalLength() const;
+
+		/** Manually set the extents of the frustum.
+		@param left, right, top, bottom The position where the side clip planes intersect
+			the near clip plane, in eye space
+		*/
+		virtual void setFrustumExtents(float left, float right, float top, float bottom);
+		/** Reset the frustum extents to be automatically derived from other params. */
+		virtual void resetFrustumExtents(); 
+		/** Get the extents of the frustum in view space. */
+		virtual void getFrustumExtents(float& outleft, float& outright, float& outtop, float& outbottom) const;
+
+
+        /** Gets the projection matrix for this frustum adjusted for the current
+			rendersystem specifics (may be right or left-handed, depth range
+			may vary).
+        @remarks
+            This method retrieves the rendering-API dependent version of the projection
+            matrix. If you want a 'typical' projection matrix then use 
+            getProjectionMatrix.
+
+        */
+        virtual const Matrix4& getProjectionMatrixRS(void) const;
+        /** Gets the depth-adjusted projection matrix for the current rendersystem,
+			but one which still conforms to right-hand rules.
+        @remarks
+            This differs from the rendering-API dependent getProjectionMatrix
+            in that it always returns a right-handed projection matrix result 
+            no matter what rendering API is being used - this is required for
+            vertex and fragment programs for example. However, the resulting depth
+            range may still vary between render systems since D3D uses [0,1] and 
+            GL uses [-1,1], and the range must be kept the same between programmable
+            and fixed-function pipelines.
+        */
+        virtual const Matrix4& getProjectionMatrixWithRSDepth(void) const;
+        /** Gets the normal projection matrix for this frustum, ie the 
+        projection matrix which conforms to standard right-handed rules and
+        uses depth range [-1,+1].
+        @remarks
+            This differs from the rendering-API dependent getProjectionMatrixRS
+            in that it always returns a right-handed projection matrix with depth
+            range [-1,+1], result no matter what rendering API is being used - this
+            is required for some uniform algebra for example.
+        */
+        virtual const Matrix4& getProjectionMatrix(void) const;
+
+        /** Gets the view matrix for this frustum. Mainly for use by OGRE internally.
+        */
+        virtual const Matrix4& getViewMatrix(void) const;
+
+		/** Calculate a view matrix for this frustum, relative to a potentially dynamic point. 
+			Mainly for use by OGRE internally when using camera-relative rendering
+			for frustums that are not the centre (e.g. texture projection)
+		*/
+		virtual void calcViewMatrixRelative(const Vector3& relPos, Matrix4& matToUpdate) const;
+
+		/** Set whether to use a custom view matrix on this frustum.
+		@remarks
+			This is an advanced method which allows you to manually set
+			the view matrix on this frustum, rather than having it calculate
+			itself based on it's position and orientation. 
+		@note
+			After enabling a custom view matrix, the frustum will no longer
+			update on its own based on position / orientation changes. You 
+			are completely responsible for keeping the view matrix up to date.
+			The custom matrix will be returned from getViewMatrix.
+		@param enable If true, the custom view matrix passed as the second 
+			parameter will be used in preference to an auto calculated one. If
+			false, the frustum will revert to auto calculating the view matrix.
+		@param viewMatrix The custom view matrix to use, the matrix must be an
+            affine matrix.
+		@see Frustum::setCustomProjectionMatrix, Matrix4::isAffine
+		*/
+		virtual void setCustomViewMatrix(bool enable, 
+			const Matrix4& viewMatrix = Matrix4::IDENTITY);
+		/// Returns whether a custom view matrix is in use
+		virtual bool isCustomViewMatrixEnabled(void) const 
+		{ return mCustomViewMatrix; }
+		
+		/** Set whether to use a custom projection matrix on this frustum.
+		@remarks
+			This is an advanced method which allows you to manually set
+			the projection matrix on this frustum, rather than having it 
+			calculate itself based on it's position and orientation. 
+		@note
+			After enabling a custom projection matrix, the frustum will no 
+			longer update on its own based on field of view and near / far
+			distance changes. You are completely responsible for keeping the 
+			projection matrix up to date if those values change. The custom 
+			matrix will be returned from getProjectionMatrix and derivative
+			functions.
+		@param enable If 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 (world space).
+        @remarks
+            The clipping planes are ordered as declared in enumerate constants FrustumPlane.
+        */
+        virtual const Plane* getFrustumPlanes(void) const;
+
+        /** Retrieves a specified plane of the frustum (world space).
+            @remarks
+                Gets a reference to one of the planes which make up the frustum frustum, e.g. for clipping purposes.
+        */
+        virtual const Plane& getFrustumPlane( unsigned short plane ) const;
+
+        /** Tests whether the given container is visible in the Frustum.
+            @param
+                bound Bounding box to be checked (world space)
+            @param
+                culledBy Optional pointer to an int which will be filled by the plane number which culled
+                the box if the result was 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 (world space)
+            @param
+                culledBy Optional pointer to an int which will be filled by the plane number which culled
+                the box if the result was 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 (world space)
+            @param
+                culledBy Optional pointer to an int which will be filled by the plane number which culled
+                the box if the result was 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 */
+		float getBoundingRadius(void) const;
+
+        /** Gets the world space corners of the frustum.
+        @remarks
+            The corners are ordered as follows: top-right near, 
+            top-left near, bottom-left near, bottom-right near, 
+            top-right far, top-left far, bottom-left far, bottom-right far.
+        */
+        virtual const Vector3* getWorldSpaceCorners(void) const;
+
+        /** Sets the type of projection to use (orthographic or perspective). Default is perspective.
+        */
+        virtual void setProjectionType(ProjectionType pt);
+
+        /** Retrieves info on the type of projection used (orthographic or perspective).
+        */
+        virtual ProjectionType getProjectionType(void) const;
+
+		/** Sets the orthographic window settings, for use with orthographic rendering only. 
+		@note Calling this method will recalculate the aspect ratio, use 
+			setOrthoWindowHeight or setOrthoWindowWidth alone if you wish to 
+			preserve the aspect ratio but just fit one or other dimension to a 
+			particular size.
+		@param w, h The dimensions of the view window in world units
+		*/
+		virtual void setOrthoWindow(float w, float h);
+		/** Sets the orthographic window height, for use with orthographic rendering only. 
+		@note The width of the window will be calculated from the aspect ratio. 
+		@param h The height of the view window in world units
+		*/
+		virtual void setOrthoWindowHeight(float h);
+		/** Sets the orthographic window width, for use with orthographic rendering only. 
+		@note The height of the window will be calculated from the aspect ratio. 
+		@param w The width of the view window in world units
+		*/
+		virtual void setOrthoWindowWidth(float w);
+		/** Gets the orthographic window height, for use with orthographic rendering only. 
+		*/
+		virtual float getOrthoWindowHeight() const;
+		/** Gets the orthographic window width, for use with orthographic rendering only. 
+		@note This is calculated from the orthographic height and the aspect ratio
+		*/
+		virtual float getOrthoWindowWidth() const;
+
+        /** 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, 
+            float* left, float* top, float* right, float* bottom) const;
+
+        /// Small constant used to reduce far plane projection to avoid inaccuracies
+        static const float INFINITE_FAR_PLANE_ADJUST;
+
+		/** Get the derived position of this frustum. */
+		virtual const Vector3& getPositionForViewUpdate(void) const;
+		/** Get the derived orientation of this frustum. */
+		virtual const Quaternion& getOrientationForViewUpdate(void) const;
     protected:
     protected:
         /// Camera orientation, quaternion style
         /// Camera orientation, quaternion style
         Quaternion mOrientation;
         Quaternion mOrientation;
@@ -122,29 +564,19 @@ namespace CamelotEngine {
             when a viewport changes its size
             when a viewport changes its size
         */
         */
         bool mAutoAspectRatio;
         bool mAutoAspectRatio;
-		/// Custom culling frustum
-		Frustum *mCullFrustum;
 		/// Whether or not the rendering distance of objects should take effect for this camera
 		/// Whether or not the rendering distance of objects should take effect for this camera
 		bool mUseRenderingDistance;
 		bool mUseRenderingDistance;
 
 
 		Viewport* mViewport;
 		Viewport* mViewport;
 
 
-        // 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
         /** Do actual window setting, using parameters set in SetWindow call
         @remarks
         @remarks
             The method will called on demand.
             The method will called on demand.
         */
         */
-        virtual void setWindowImpl(void) const;
+        void setWindowImpl(void) const;
 
 
 		/** Helper function for forwardIntersect that intersects rays with canonical plane */
 		/** Helper function for forwardIntersect that intersects rays with canonical plane */
-		virtual vector<Vector4>::type getRayForwardIntersect(const Vector3& anchor, const Vector3 *dir, float planeOffset) const;
+		vector<Vector4>::type getRayForwardIntersect(const Vector3& anchor, const Vector3 *dir, float planeOffset) const;
 
 
     public:
     public:
         /** Standard constructor.
         /** Standard constructor.
@@ -156,7 +588,7 @@ namespace CamelotEngine {
 
 
         /** Standard destructor.
         /** Standard destructor.
         */
         */
-        virtual ~Camera();
+        ~Camera();
 
 
 		Viewport* getViewport() { return mViewport; }
 		Viewport* getViewport() { return mViewport; }
 
 
@@ -355,9 +787,6 @@ namespace CamelotEngine {
         virtual bool isWindowSet(void) const { return mWindowSet; }
         virtual bool isWindowSet(void) const { return mWindowSet; }
         /// Gets the window clip planes, only applicable if isWindowSet == true
         /// Gets the window clip planes, only applicable if isWindowSet == true
         const vector<Plane>::type& getWindowPlanes(void) const;
         const vector<Plane>::type& getWindowPlanes(void) const;
-
-        /** Overridden from MovableObject */
-        float getBoundingRadius(void) const;
 		
 		
         /** Get the last viewport which was attached to this camera. 
         /** Get the last viewport which was attached to this camera. 
         @note This is not guaranteed to be the only viewport which is
         @note This is not guaranteed to be the only viewport which is
@@ -381,55 +810,11 @@ namespace CamelotEngine {
         */
         */
         bool getAutoAspectRatio(void) const;
         bool getAutoAspectRatio(void) const;
 
 
-		/** Tells the camera to use a separate Frustum instance to perform culling.
-		@remarks
-			By calling this method, you can tell the camera to perform culling
-			against a different frustum to it's own. This is mostly useful for
-			debug cameras that allow you to show the culling behaviour of another
-			camera, or a manual frustum instance. 
-		@param frustum Pointer to a frustum to use; this can either be a manual
-			Frustum instance (which you can attach to scene nodes like any other
-			MovableObject), or another camera. If you pass 0 to this method it
-			reverts the camera to normal behaviour.
-		*/
-		void setCullingFrustum(Frustum* frustum) { mCullFrustum = frustum; }
-		/** Returns the custom culling frustum in use. */
-		Frustum* getCullingFrustum(void) const { return mCullFrustum; }
-
 		/** Forward projects frustum rays to find forward intersection with plane.
 		/** Forward projects frustum rays to find forward intersection with plane.
 		 @remarks
 		 @remarks
 		    Forward projection may lead to intersections at infinity.
 		    Forward projection may lead to intersections at infinity.
 		*/
 		*/
-		virtual void forwardIntersect(const Plane& worldPlane, vector<Vector4>::type* intersect3d) const;
-
-		/// @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, 
-			float* left, float* top, float* right, float* bottom) const;
-		/// @copydoc Frustum::getNearClipDistance
-		float getNearClipDistance(void) const;
-		/// @copydoc Frustum::getFarClipDistance
-		float 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;
+		void forwardIntersect(const Plane& worldPlane, vector<Vector4>::type* intersect3d) const;
 
 
 		/** Synchronise core camera settings with another. 
 		/** Synchronise core camera settings with another. 
 		@remarks
 		@remarks
@@ -437,12 +822,7 @@ namespace CamelotEngine {
 			FOV, focal length and aspect ratio from another camera. Other settings like query flags, 
 			FOV, focal length and aspect ratio from another camera. Other settings like query flags, 
 			reflection etc are preserved.
 			reflection etc are preserved.
 		*/
 		*/
-		virtual void synchroniseBaseSettingsWith(const Camera* cam);
-
-		/** Get the derived position of this frustum. */
-		const Vector3& getPositionForViewUpdate(void) const;
-		/** Get the derived orientation of this frustum. */
-		const Quaternion& getOrientationForViewUpdate(void) const;
+		void synchroniseBaseSettingsWith(const Camera* cam);
      };
      };
 	 /** @} */
 	 /** @} */
 	 /** @} */
 	 /** @} */

+ 0 - 497
CamelotRenderer/Include/CmFrustum.h

@@ -1,497 +0,0 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org/
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-#ifndef __Frustum_H__
-#define __Frustum_H__
-
-#include "CmPrerequisites.h"
-#include "CmVector2.h"
-#include "CmAxisAlignedBox.h"
-#include "CmVertexIndexData.h"
-#include "CmString.h"
-
-namespace CamelotEngine
-{
-	/** 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 CM_EXPORT Frustum
-    {
-    protected:
-        /// Orthographic or perspective?
-        ProjectionType mProjType;
-
-        /// y-direction field-of-view (default 45)
-        Radian mFOVy;
-        /// Far clip distance - default 10000
-        float mFarDist;
-        /// Near clip distance - default 100
-        float mNearDist;
-        /// x/y viewport ratio - default 1.3333
-        float mAspect;
-		/// Ortho height size (world units)
-		float mOrthoHeight;
-        /// Off-axis frustum center offset - default (0.0, 0.0)
-        Vector2 mFrustumOffset;
-        /// Focal length of frustum (for stereo rendering, defaults to 1.0)
-        float mFocalLength;
-
-        /// The 6 main clipping planes
-        mutable Plane mFrustumPlanes[6];
-
-        /// Stored versions of parent orientation / position
-        mutable Quaternion mLastParentOrientation;
-        mutable Vector3 mLastParentPosition;
-
-        /// Pre-calced projection matrix for the specific render system
-        mutable Matrix4 mProjMatrixRS;
-        /// Pre-calced standard projection matrix but with render system depth range
-        mutable Matrix4 mProjMatrixRSDepth;
-        /// Pre-calced standard projection matrix
-        mutable Matrix4 mProjMatrix;
-        /// Pre-calced view matrix
-        mutable Matrix4 mViewMatrix;
-        /// Something's changed in the frustum shape?
-        mutable bool mRecalcFrustum;
-        /// Something re the view pos has changed
-        mutable bool mRecalcView;
-        /// Something re the frustum planes has changed
-        mutable bool mRecalcFrustumPlanes;
-        /// Something re the world space corners has changed
-        mutable bool mRecalcWorldSpaceCorners;
-        /// Something re the vertex data has changed
-        mutable bool mRecalcVertexData;
-		/// Are we using a custom view matrix?
-		bool mCustomViewMatrix;
-		/// Are we using a custom projection matrix?
-		bool mCustomProjMatrix;
-		/// Have the frustum extents been manually set?
-		bool mFrustumExtentsManuallySet;
-		/// Frustum extents
-		mutable float mLeft, mRight, mTop, mBottom;
-		
-        // Internal functions for calcs
-        virtual void calcProjectionParameters(float& left, float& right, float& bottom, float& 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;
-
-        mutable AxisAlignedBox mBoundingBox;
-        mutable VertexData mVertexData;
-
-        mutable Vector3 mWorldSpaceCorners[8];
-
-    public:
-
-		/// Named constructor
-		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);
-
-        /** 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(float nearDist);
-
-        /** Sets the position of the near clipping plane.
-        */
-        virtual float getNearClipDistance(void) const;
-
-        /** Sets the distance to the far clipping plane.
-            @remarks
-                The view frustum is a pyramid created from the frustum position and the edges of the viewport.
-                This method sets the distance for the far end of that pyramid. 
-                Different applications need different values: e.g. a flight sim
-                needs a much further far clipping plane than a first-person 
-                shooter. An important point here is that the larger the ratio 
-                between near and far clipping planes, the lower the accuracy of
-                the Z-buffer used to depth-cue pixels. This is because the
-                Z-range is limited to the size of the Z buffer (16 or 32-bit) 
-                and the max values must be spread over the gap between near and
-                far clip planes. As it happens, you can affect the accuracy far 
-                more by altering the near distance rather than the far distance, 
-                but keep this in mind.
-            @param
-                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(float farDist);
-
-        /** Retrieves the distance from the frustum to the far clipping plane.
-        */
-        virtual float 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(float ratio);
-
-        /** Retreives the current aspect ratio.
-        */
-        virtual float 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(float horizontal = 0.0, float vertical = 0.0);
-
-        /** Retrieves the frustum offsets.
-        */
-        virtual const Vector2& getFrustumOffset() const;
-
-        /** Sets frustum focal length (used in stereo rendering).
-            @param
-                focalLength The distance to the focal plane from the frustum in world coordinates.
-        */
-        virtual void setFocalLength(float focalLength = 1.0);
-
-        /** Returns focal length of frustum.
-        */
-        virtual float getFocalLength() const;
-
-		/** Manually set the extents of the frustum.
-		@param left, right, top, bottom The position where the side clip planes intersect
-			the near clip plane, in eye space
-		*/
-		virtual void setFrustumExtents(float left, float right, float top, float bottom);
-		/** Reset the frustum extents to be automatically derived from other params. */
-		virtual void resetFrustumExtents(); 
-		/** Get the extents of the frustum in view space. */
-		virtual void getFrustumExtents(float& outleft, float& outright, float& outtop, float& outbottom) const;
-
-
-        /** Gets the projection matrix for this frustum adjusted for the current
-			rendersystem specifics (may be right or left-handed, depth range
-			may vary).
-        @remarks
-            This method retrieves the rendering-API dependent version of the projection
-            matrix. If you want a 'typical' projection matrix then use 
-            getProjectionMatrix.
-
-        */
-        virtual const Matrix4& getProjectionMatrixRS(void) const;
-        /** Gets the depth-adjusted projection matrix for the current rendersystem,
-			but one which still conforms to right-hand rules.
-        @remarks
-            This differs from the rendering-API dependent getProjectionMatrix
-            in that it always returns a right-handed projection matrix result 
-            no matter what rendering API is being used - this is required for
-            vertex and fragment programs for example. However, the resulting depth
-            range may still vary between render systems since D3D uses [0,1] and 
-            GL uses [-1,1], and the range must be kept the same between programmable
-            and fixed-function pipelines.
-        */
-        virtual const Matrix4& getProjectionMatrixWithRSDepth(void) const;
-        /** Gets the normal projection matrix for this frustum, ie the 
-        projection matrix which conforms to standard right-handed rules and
-        uses depth range [-1,+1].
-        @remarks
-            This differs from the rendering-API dependent getProjectionMatrixRS
-            in that it always returns a right-handed projection matrix with depth
-            range [-1,+1], result no matter what rendering API is being used - this
-            is required for some uniform algebra for example.
-        */
-        virtual const Matrix4& getProjectionMatrix(void) const;
-
-        /** Gets the view matrix for this frustum. Mainly for use by OGRE internally.
-        */
-        virtual const Matrix4& getViewMatrix(void) const;
-
-		/** Calculate a view matrix for this frustum, relative to a potentially dynamic point. 
-			Mainly for use by OGRE internally when using camera-relative rendering
-			for frustums that are not the centre (e.g. texture projection)
-		*/
-		virtual void calcViewMatrixRelative(const Vector3& relPos, Matrix4& matToUpdate) const;
-
-		/** Set whether to use a custom view matrix on this frustum.
-		@remarks
-			This is an advanced method which allows you to manually set
-			the view matrix on this frustum, rather than having it calculate
-			itself based on it's position and orientation. 
-		@note
-			After enabling a custom view matrix, the frustum will no longer
-			update on its own based on position / orientation changes. You 
-			are completely responsible for keeping the view matrix up to date.
-			The custom matrix will be returned from getViewMatrix.
-		@param enable If true, the custom view matrix passed as the second 
-			parameter will be used in preference to an auto calculated one. If
-			false, the frustum will revert to auto calculating the view matrix.
-		@param viewMatrix The custom view matrix to use, the matrix must be an
-            affine matrix.
-		@see Frustum::setCustomProjectionMatrix, Matrix4::isAffine
-		*/
-		virtual void setCustomViewMatrix(bool enable, 
-			const Matrix4& viewMatrix = Matrix4::IDENTITY);
-		/// Returns whether a custom view matrix is in use
-		virtual bool isCustomViewMatrixEnabled(void) const 
-		{ return mCustomViewMatrix; }
-		
-		/** Set whether to use a custom projection matrix on this frustum.
-		@remarks
-			This is an advanced method which allows you to manually set
-			the projection matrix on this frustum, rather than having it 
-			calculate itself based on it's position and orientation. 
-		@note
-			After enabling a custom projection matrix, the frustum will no 
-			longer update on its own based on field of view and near / far
-			distance changes. You are completely responsible for keeping the 
-			projection matrix up to date if those values change. The custom 
-			matrix will be returned from getProjectionMatrix and derivative
-			functions.
-		@param enable If 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 (world space).
-        @remarks
-            The clipping planes are ordered as declared in enumerate constants FrustumPlane.
-        */
-        virtual const Plane* getFrustumPlanes(void) const;
-
-        /** Retrieves a specified plane of the frustum (world space).
-            @remarks
-                Gets a reference to one of the planes which make up the frustum frustum, e.g. for clipping purposes.
-        */
-        virtual const Plane& getFrustumPlane( unsigned short plane ) const;
-
-        /** Tests whether the given container is visible in the Frustum.
-            @param
-                bound Bounding box to be checked (world space)
-            @param
-                culledBy Optional pointer to an int which will be filled by the plane number which culled
-                the box if the result was 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 (world space)
-            @param
-                culledBy Optional pointer to an int which will be filled by the plane number which culled
-                the box if the result was 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 (world space)
-            @param
-                culledBy Optional pointer to an int which will be filled by the plane number which culled
-                the box if the result was 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 */
-		float getBoundingRadius(void) const;
-
-        /** Gets the world space corners of the frustum.
-        @remarks
-            The corners are ordered as follows: top-right near, 
-            top-left near, bottom-left near, bottom-right near, 
-            top-right far, top-left far, bottom-left far, bottom-right far.
-        */
-        virtual const Vector3* getWorldSpaceCorners(void) const;
-
-        /** Sets the type of projection to use (orthographic or perspective). Default is perspective.
-        */
-        virtual void setProjectionType(ProjectionType pt);
-
-        /** Retrieves info on the type of projection used (orthographic or perspective).
-        */
-        virtual ProjectionType getProjectionType(void) const;
-
-		/** Sets the orthographic window settings, for use with orthographic rendering only. 
-		@note Calling this method will recalculate the aspect ratio, use 
-			setOrthoWindowHeight or setOrthoWindowWidth alone if you wish to 
-			preserve the aspect ratio but just fit one or other dimension to a 
-			particular size.
-		@param w, h The dimensions of the view window in world units
-		*/
-		virtual void setOrthoWindow(float w, float h);
-		/** Sets the orthographic window height, for use with orthographic rendering only. 
-		@note The width of the window will be calculated from the aspect ratio. 
-		@param h The height of the view window in world units
-		*/
-		virtual void setOrthoWindowHeight(float h);
-		/** Sets the orthographic window width, for use with orthographic rendering only. 
-		@note The height of the window will be calculated from the aspect ratio. 
-		@param w The width of the view window in world units
-		*/
-		virtual void setOrthoWindowWidth(float w);
-		/** Gets the orthographic window height, for use with orthographic rendering only. 
-		*/
-		virtual float getOrthoWindowHeight() const;
-		/** Gets the orthographic window width, for use with orthographic rendering only. 
-		@note This is calculated from the orthographic height and the aspect ratio
-		*/
-		virtual float getOrthoWindowWidth() const;
-
-        /** 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, 
-            float* left, float* top, float* right, float* bottom) const;
-
-        /// Small constant used to reduce far plane projection to avoid inaccuracies
-        static const float INFINITE_FAR_PLANE_ADJUST;
-
-		/** Get the derived position of this frustum. */
-		virtual const Vector3& getPositionForViewUpdate(void) const;
-		/** Get the derived orientation of this frustum. */
-		virtual const Quaternion& getOrientationForViewUpdate(void) const;
-    };
-
-	/** @} */
-	/** @} */
-
-}
-
-#endif 

+ 0 - 1
CamelotRenderer/Include/CmPrerequisites.h

@@ -68,7 +68,6 @@ namespace CamelotEngine {
 // so decreases dependencies between files
 // so decreases dependencies between files
     class Camera;
     class Camera;
     class Color;
     class Color;
-    class Frustum;
     class GpuProgram;
     class GpuProgram;
     class GpuProgramManager;
     class GpuProgramManager;
 	class GpuProgramUsage;
 	class GpuProgramUsage;

+ 0 - 16
CamelotRenderer/Include/CmRenderSystem.h

@@ -641,16 +641,6 @@ namespace CamelotEngine
 		*/
 		*/
 		virtual void _setTextureCoordSet(size_t unit, size_t index) = 0;
 		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 filtering options for a given texture unit.
 		/** Sets the filtering options for a given texture unit.
 		@param unit The texture unit to set the filtering options for
 		@param unit The texture unit to set the filtering options for
 		@param minFilter The filter used when a texture is reduced in size
 		@param minFilter The filter used when a texture is reduced in size
@@ -686,12 +676,6 @@ namespace CamelotEngine
 		*/
 		*/
 		virtual void _setTextureMipmapBias(size_t unit, float bias) = 0;
 		virtual void _setTextureMipmapBias(size_t unit, float bias) = 0;
 
 
-		/** Sets the texture coordinate transformation matrix for a texture unit.
-		@param unit Texture unit to affect
-		@param xform The 4x4 matrix
-		*/
-		virtual void _setTextureMatrix(size_t unit, const Matrix4& xform) = 0;
-
 		/** Sets the global blending factors for combining subsequent renders with the existing frame contents.
 		/** Sets the global blending factors for combining subsequent renders with the existing frame contents.
 		The result of the blending operation is:</p>
 		The result of the blending operation is:</p>
 		<p align="center">final = (texture * sourceFactor) + (pixel * destFactor)</p>
 		<p align="center">final = (texture * sourceFactor) + (pixel * destFactor)</p>

+ 0 - 1
CamelotRenderer/Include/CmViewport.h

@@ -31,7 +31,6 @@ THE SOFTWARE.
 #include "CmPrerequisites.h"
 #include "CmPrerequisites.h"
 #include "CmCommon.h"
 #include "CmCommon.h"
 #include "CmColor.h"
 #include "CmColor.h"
-#include "CmFrustum.h"
 
 
 namespace CamelotEngine {
 namespace CamelotEngine {
 	/** \addtogroup Core
 	/** \addtogroup Core

+ 2 - 1
CamelotRenderer/Source/CmApplication.cpp

@@ -8,6 +8,7 @@
 #include "CmRenderWindow.h"
 #include "CmRenderWindow.h"
 #include "CmCamera.h"
 #include "CmCamera.h"
 #include "CmViewport.h"
 #include "CmViewport.h"
+#include "CmVector2.h"
 #include "CmHighLevelGpuProgram.h"
 #include "CmHighLevelGpuProgram.h"
 #include "CmHighLevelGpuProgramManager.h"
 #include "CmHighLevelGpuProgramManager.h"
 #include "CmDynLib.h"
 #include "CmDynLib.h"
@@ -318,7 +319,7 @@ namespace CamelotEngine
 		//renderSystem->_setViewMatrix(viewMatrix);
 		//renderSystem->_setViewMatrix(viewMatrix);
 
 
 		Matrix4 projMatrixCstm = mCamera->getProjectionMatrix();
 		Matrix4 projMatrixCstm = mCamera->getProjectionMatrix();
-		Matrix4 viewMatrixCstm = mCamera->getViewMatrix(true);
+		Matrix4 viewMatrixCstm = mCamera->getViewMatrix();
 
 
 		Matrix4 viewProjMatrix = projMatrixCstm * viewMatrixCstm;
 		Matrix4 viewProjMatrix = projMatrixCstm * viewMatrixCstm;
 
 

A diferenza do arquivo foi suprimida porque é demasiado grande
+ 1012 - 3
CamelotRenderer/Source/CmCamera.cpp


+ 0 - 1111
CamelotRenderer/Source/CmFrustum.cpp

@@ -1,1111 +0,0 @@
-/*
------------------------------------------------------------------------------
-This source file is part of OGRE
-    (Object-oriented Graphics Rendering Engine)
-For the latest info, see http://www.ogre3d.org
-
-Copyright (c) 2000-2011 Torus Knot Software Ltd
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
------------------------------------------------------------------------------
-*/
-
-#include "CmFrustum.h"
-
-#include "CmMath.h"
-#include "CmMatrix3.h"
-#include "CmSphere.h"
-#include "CmException.h"
-#include "CmHardwareBufferManager.h"
-#include "CmHardwareVertexBuffer.h"
-#include "CmHardwareIndexBuffer.h"
-#include "CmRenderSystem.h"
-#include "CmRenderSystemManager.h"
-
-namespace CamelotEngine {
-    const float Frustum::INFINITE_FAR_PLANE_ADJUST = 0.00001f;
-    //-----------------------------------------------------------------------
-    Frustum::Frustum() : 
-        mProjType(PT_PERSPECTIVE), 
-        mFOVy(Radian(Math::PI/4.0f)), 
-        mFarDist(100000.0f), 
-        mNearDist(100.0f), 
-        mAspect(1.33333333333333f), 
-		mOrthoHeight(1000),
-        mFrustumOffset(Vector2::ZERO),
-        mFocalLength(1.0f),
-        mLastParentOrientation(Quaternion::IDENTITY),
-        mLastParentPosition(Vector3::ZERO),
-        mRecalcFrustum(true), 
-        mRecalcView(true), 
-        mRecalcFrustumPlanes(true),
-        mRecalcWorldSpaceCorners(true),
-        mRecalcVertexData(true),
-		mCustomViewMatrix(false),
-		mCustomProjMatrix(false),
-		mFrustumExtentsManuallySet(false)
-    {
-        updateView();
-        updateFrustum();
-    }
-
-    //-----------------------------------------------------------------------
-    Frustum::~Frustum()
-    {
-        // Do nothing
-    }
-
-    //-----------------------------------------------------------------------
-    void Frustum::setFOVy(const Radian& fov)
-    {
-        mFOVy = fov;
-        invalidateFrustum();
-    }
-
-    //-----------------------------------------------------------------------
-    const Radian& Frustum::getFOVy(void) const
-    {
-        return mFOVy;
-    }
-
-
-    //-----------------------------------------------------------------------
-    void Frustum::setFarClipDistance(float farPlane)
-    {
-        mFarDist = farPlane;
-        invalidateFrustum();
-    }
-
-    //-----------------------------------------------------------------------
-    float Frustum::getFarClipDistance(void) const
-    {
-        return mFarDist;
-    }
-
-    //-----------------------------------------------------------------------
-    void Frustum::setNearClipDistance(float nearPlane)
-    {
-        if (nearPlane <= 0)
-		{
-            CM_EXCEPT(InvalidParametersException, "Near clip distance must be greater than zero.");
-		}
-        mNearDist = nearPlane;
-        invalidateFrustum();
-    }
-
-    //-----------------------------------------------------------------------
-    float Frustum::getNearClipDistance(void) const
-    {
-        return mNearDist;
-    }
-
-    //---------------------------------------------------------------------
-    void Frustum::setFrustumOffset(const Vector2& offset)
-    {
-        mFrustumOffset = offset;
-        invalidateFrustum();
-    }
-    //---------------------------------------------------------------------
-    void Frustum::setFrustumOffset(float horizontal, float vertical)
-    {
-        setFrustumOffset(Vector2(horizontal, vertical));
-    }
-    //---------------------------------------------------------------------
-    const Vector2& Frustum::getFrustumOffset() const
-    {
-        return mFrustumOffset;
-    }
-    //---------------------------------------------------------------------
-    void Frustum::setFocalLength(float focalLength)
-    {
-        if (focalLength <= 0)
-        {
-            CM_EXCEPT(InvalidParametersException,
-                "Focal length must be greater than zero.");
-        }
-
-        mFocalLength = focalLength;
-        invalidateFrustum();
-    }
-    //---------------------------------------------------------------------
-    float Frustum::getFocalLength() const
-    {
-        return mFocalLength;
-    }
-    //-----------------------------------------------------------------------
-    const Matrix4& Frustum::getProjectionMatrix(void) const
-    {
-
-        updateFrustum();
-
-        return mProjMatrix;
-    }
-    //-----------------------------------------------------------------------
-    const Matrix4& Frustum::getProjectionMatrixWithRSDepth(void) const
-    {
-
-        updateFrustum();
-
-        return mProjMatrixRSDepth;
-    }
-    //-----------------------------------------------------------------------
-    const Matrix4& Frustum::getProjectionMatrixRS(void) const
-    {
-
-        updateFrustum();
-
-        return mProjMatrixRS;
-    }
-    //-----------------------------------------------------------------------
-    const Matrix4& Frustum::getViewMatrix(void) const
-    {
-        updateView();
-
-        return mViewMatrix;
-
-    }
-
-    //-----------------------------------------------------------------------
-    const Plane* Frustum::getFrustumPlanes(void) const
-    {
-        // Make any pending updates to the calculated frustum planes
-        updateFrustumPlanes();
-
-        return mFrustumPlanes;
-    }
-
-    //-----------------------------------------------------------------------
-    const Plane& Frustum::getFrustumPlane(unsigned short plane) const
-    {
-        // Make any pending updates to the calculated frustum planes
-        updateFrustumPlanes();
-
-        return mFrustumPlanes[plane];
-
-    }
-
-    //-----------------------------------------------------------------------
-    bool Frustum::isVisible(const AxisAlignedBox& bound, FrustumPlane* culledBy) const
-    {
-        // Null boxes always invisible
-        if (bound.isNull()) return false;
-
-        // Infinite boxes always visible
-        if (bound.isInfinite()) return true;
-
-        // Make any pending updates to the calculated frustum planes
-        updateFrustumPlanes();
-
-        // Get centre of the box
-        Vector3 centre = bound.getCenter();
-        // Get the half-size of the box
-        Vector3 halfSize = bound.getHalfSize();
-
-        // For each plane, see if all points are on the negative side
-        // If so, object is not visible
-        for (int plane = 0; plane < 6; ++plane)
-        {
-            // Skip far plane if infinite view frustum
-            if (plane == FRUSTUM_PLANE_FAR && mFarDist == 0)
-                continue;
-
-            Plane::Side side = mFrustumPlanes[plane].getSide(centre, halfSize);
-            if (side == Plane::NEGATIVE_SIDE)
-            {
-                // ALL corners on negative side therefore out of view
-                if (culledBy)
-                    *culledBy = (FrustumPlane)plane;
-                return false;
-            }
-
-        }
-
-        return true;
-    }
-
-    //-----------------------------------------------------------------------
-    bool Frustum::isVisible(const Vector3& vert, FrustumPlane* culledBy) const
-    {
-        // Make any pending updates to the calculated frustum planes
-        updateFrustumPlanes();
-
-        // For each plane, see if all points are on the negative side
-        // If so, object is not visible
-        for (int plane = 0; plane < 6; ++plane)
-        {
-            // Skip far plane if infinite view frustum
-            if (plane == FRUSTUM_PLANE_FAR && mFarDist == 0)
-                continue;
-
-            if (mFrustumPlanes[plane].getSide(vert) == Plane::NEGATIVE_SIDE)
-            {
-                // ALL corners on negative side therefore out of view
-                if (culledBy)
-                    *culledBy = (FrustumPlane)plane;
-                return false;
-            }
-
-        }
-
-        return true;
-    }
-    //-----------------------------------------------------------------------
-    bool Frustum::isVisible(const Sphere& sphere, FrustumPlane* culledBy) const
-    {
-        // Make any pending updates to the calculated frustum planes
-        updateFrustumPlanes();
-
-        // For each plane, see if sphere is on negative side
-        // If so, object is not visible
-        for (int plane = 0; plane < 6; ++plane)
-        {
-            // Skip far plane if infinite view frustum
-            if (plane == FRUSTUM_PLANE_FAR && mFarDist == 0)
-                continue;
-
-            // If the distance from sphere center to plane is negative, and 'more negative' 
-            // than the radius of the sphere, sphere is outside frustum
-            if (mFrustumPlanes[plane].getDistance(sphere.getCenter()) < -sphere.getRadius())
-            {
-                // ALL corners on negative side therefore out of view
-                if (culledBy)
-                    *culledBy = (FrustumPlane)plane;
-                return false;
-            }
-
-        }
-
-        return true;
-    }
-    //-----------------------------------------------------------------------
-    void Frustum::calcProjectionParameters(float& left, float& right, float& bottom, float& top) const
-    { 
-		if (mCustomProjMatrix)
-		{
-			// Convert clipspace corners to camera space
-			Matrix4 invProj = mProjMatrix.inverse();
-			Vector3 topLeft(-0.5f, 0.5f, 0.0f);
-			Vector3 bottomRight(0.5f, -0.5f, 0.0f);
-
-			topLeft = invProj * topLeft;
-			bottomRight = invProj * bottomRight;
-
-			left = topLeft.x;
-			top = topLeft.y;
-			right = bottomRight.x;
-			bottom = bottomRight.y;
-
-		}
-		else
-		{
-			if (mFrustumExtentsManuallySet)
-			{
-				left = mLeft;
-				right = mRight;
-				top = mTop;
-				bottom = mBottom;
-			}
-			// Calculate general projection parameters
-			else if (mProjType == PT_PERSPECTIVE)
-			{
-				Radian thetaY (mFOVy * 0.5f);
-				float tanThetaY = Math::Tan(thetaY);
-				float tanThetaX = tanThetaY * mAspect;
-
-				float nearFocal = mNearDist / mFocalLength;
-				float nearOffsetX = mFrustumOffset.x * nearFocal;
-				float nearOffsetY = mFrustumOffset.y * nearFocal;
-				float half_w = tanThetaX * mNearDist;
-				float half_h = tanThetaY * mNearDist;
-
-				left   = - half_w + nearOffsetX;
-				right  = + half_w + nearOffsetX;
-				bottom = - half_h + nearOffsetY;
-				top    = + half_h + nearOffsetY;
-
-				mLeft = left;
-				mRight = right;
-				mTop = top;
-				mBottom = bottom;
-			}
-			else
-			{
-				// Unknown how to apply frustum offset to orthographic camera, just ignore here
-				float half_w = getOrthoWindowWidth() * 0.5f;
-				float half_h = getOrthoWindowHeight() * 0.5f;
-
-				left   = - half_w;
-				right  = + half_w;
-				bottom = - half_h;
-				top    = + half_h;
-
-				mLeft = left;
-				mRight = right;
-				mTop = top;
-				mBottom = bottom;
-			}
-
-		}
-    }
-	//-----------------------------------------------------------------------
-	void Frustum::updateFrustumImpl(void) const
-	{
-		// Common calcs
-		float left, right, bottom, top;
-
-        calcProjectionParameters(left, right, bottom, top);
-
-		if (!mCustomProjMatrix)
-		{
-
-			// The code below will dealing with general projection 
-			// parameters, similar glFrustum and glOrtho.
-			// Doesn't optimise manually except division operator, so the 
-			// code more self-explaining.
-
-			float inv_w = 1 / (right - left);
-			float inv_h = 1 / (top - bottom);
-			float inv_d = 1 / (mFarDist - mNearDist);
-
-			// Recalc if frustum params changed
-			if (mProjType == PT_PERSPECTIVE)
-			{
-				// Calc matrix elements
-				float A = 2 * mNearDist * inv_w;
-				float B = 2 * mNearDist * inv_h;
-				float C = (right + left) * inv_w;
-				float D = (top + bottom) * inv_h;
-				float q, qn;
-				if (mFarDist == 0)
-				{
-					// Infinite far plane
-					q = Frustum::INFINITE_FAR_PLANE_ADJUST - 1;
-					qn = mNearDist * (Frustum::INFINITE_FAR_PLANE_ADJUST - 2);
-				}
-				else
-				{
-					q = - (mFarDist + mNearDist) * inv_d;
-					qn = -2 * (mFarDist * mNearDist) * inv_d;
-				}
-
-				// NB: This creates 'uniform' perspective projection matrix,
-				// which depth range [-1,1], right-handed rules
-				//
-				// [ A   0   C   0  ]
-				// [ 0   B   D   0  ]
-				// [ 0   0   q   qn ]
-				// [ 0   0   -1  0  ]
-				//
-				// A = 2 * near / (right - left)
-				// B = 2 * near / (top - bottom)
-				// C = (right + left) / (right - left)
-				// D = (top + bottom) / (top - bottom)
-				// q = - (far + near) / (far - near)
-				// qn = - 2 * (far * near) / (far - near)
-
-				mProjMatrix = Matrix4::ZERO;
-				mProjMatrix[0][0] = A;
-				mProjMatrix[0][2] = C;
-				mProjMatrix[1][1] = B;
-				mProjMatrix[1][2] = D;
-				mProjMatrix[2][2] = q;
-				mProjMatrix[2][3] = qn;
-				mProjMatrix[3][2] = -1;
-			} // perspective
-			else if (mProjType == PT_ORTHOGRAPHIC)
-			{
-				float A = 2 * inv_w;
-				float B = 2 * inv_h;
-				float C = - (right + left) * inv_w;
-				float D = - (top + bottom) * inv_h;
-				float q, qn;
-				if (mFarDist == 0)
-				{
-					// Can not do infinite far plane here, avoid divided zero only
-					q = - Frustum::INFINITE_FAR_PLANE_ADJUST / mNearDist;
-					qn = - Frustum::INFINITE_FAR_PLANE_ADJUST - 1;
-				}
-				else
-				{
-					q = - 2 * inv_d;
-					qn = - (mFarDist + mNearDist)  * inv_d;
-				}
-
-				// NB: This creates 'uniform' orthographic projection matrix,
-				// which depth range [-1,1], right-handed rules
-				//
-				// [ A   0   0   C  ]
-				// [ 0   B   0   D  ]
-				// [ 0   0   q   qn ]
-				// [ 0   0   0   1  ]
-				//
-				// A = 2 * / (right - left)
-				// B = 2 * / (top - bottom)
-				// C = - (right + left) / (right - left)
-				// D = - (top + bottom) / (top - bottom)
-				// q = - 2 / (far - near)
-				// qn = - (far + near) / (far - near)
-
-				mProjMatrix = Matrix4::ZERO;
-				mProjMatrix[0][0] = A;
-				mProjMatrix[0][3] = C;
-				mProjMatrix[1][1] = B;
-				mProjMatrix[1][3] = D;
-				mProjMatrix[2][2] = q;
-				mProjMatrix[2][3] = qn;
-				mProjMatrix[3][3] = 1;
-			} // ortho            
-		} // !mCustomProjMatrix
-
-		RenderSystem* renderSystem = CamelotEngine::RenderSystemManager::getActive();
-		// API specific
-		renderSystem->_convertProjectionMatrix(mProjMatrix, mProjMatrixRS);
-		// API specific for Gpu Programs
-		renderSystem->_convertProjectionMatrix(mProjMatrix, mProjMatrixRSDepth, true);
-
-
-		// Calculate bounding box (local)
-		// Box is from 0, down -Z, max dimensions as determined from far plane
-		// If infinite view frustum just pick a far value
-		float farDist = (mFarDist == 0) ? 100000 : mFarDist;
-		// Near plane bounds
-		Vector3 min(left, bottom, -farDist);
-		Vector3 max(right, top, 0);
-
-		if (mCustomProjMatrix)
-		{
-			// Some custom projection matrices can have unusual inverted settings
-			// So make sure the AABB is the right way around to start with
-			Vector3 tmp = min;
-			min.makeFloor(max);
-			max.makeCeil(tmp);
-		}
-
-		if (mProjType == PT_PERSPECTIVE)
-		{
-			// Merge with far plane bounds
-			float radio = farDist / mNearDist;
-			min.makeFloor(Vector3(left * radio, bottom * radio, -farDist));
-			max.makeCeil(Vector3(right * radio, top * radio, 0));
-		}
-		mBoundingBox.setExtents(min, max);
-
-		mRecalcFrustum = false;
-
-		// Signal to update frustum clipping planes
-		mRecalcFrustumPlanes = true;
-	}
-    //-----------------------------------------------------------------------
-    void Frustum::updateFrustum(void) const
-    {
-        if (isFrustumOutOfDate())
-        {
-			updateFrustumImpl();
-        }
-    }
-
-    //-----------------------------------------------------------------------
-    void Frustum::updateVertexData(void) const
-    {
-        if (mRecalcVertexData)
-        {
-            if (mVertexData.vertexBufferBinding->getBufferCount() <= 0)
-            {
-                // Initialise vertex & index data
-                mVertexData.vertexDeclaration->addElement(0, 0, VET_FLOAT3, VES_POSITION);
-                mVertexData.vertexCount = 32;
-                mVertexData.vertexStart = 0;
-                mVertexData.vertexBufferBinding->setBinding( 0,
-                    HardwareBufferManager::instance().createVertexBuffer(
-                        sizeof(float)*3, 32, HardwareBuffer::HBU_DYNAMIC_WRITE_ONLY) );
-            }
-
-            // Note: Even though we can dealing with general projection matrix here,
-            //       but because it's incompatibly with infinite far plane, thus, we
-            //       still need to working with projection parameters.
-
-            // Calc near plane corners
-            float vpLeft, vpRight, vpBottom, vpTop;
-            calcProjectionParameters(vpLeft, vpRight, vpBottom, vpTop);
-
-            // Treat infinite fardist as some arbitrary far value
-            float farDist = (mFarDist == 0) ? 100000 : mFarDist;
-
-            // Calc far plane corners
-            float radio = mProjType == PT_PERSPECTIVE ? farDist / mNearDist : 1;
-            float farLeft = vpLeft * radio;
-            float farRight = vpRight * radio;
-            float farBottom = vpBottom * radio;
-            float farTop = vpTop * radio;
-
-            // Calculate vertex positions (local)
-            // 0 is the origin
-            // 1, 2, 3, 4 are the points on the near plane, top left first, clockwise
-            // 5, 6, 7, 8 are the points on the far plane, top left first, clockwise
-            HardwareVertexBufferPtr vbuf = mVertexData.vertexBufferBinding->getBuffer(0);
-            float* pFloat = static_cast<float*>(vbuf->lock(HardwareBuffer::HBL_DISCARD));
-
-            // near plane (remember frustum is going in -Z direction)
-            *pFloat++ = vpLeft;  *pFloat++ = vpTop;    *pFloat++ = -mNearDist;
-            *pFloat++ = vpRight; *pFloat++ = vpTop;    *pFloat++ = -mNearDist;
-
-            *pFloat++ = vpRight; *pFloat++ = vpTop;    *pFloat++ = -mNearDist;
-            *pFloat++ = vpRight; *pFloat++ = vpBottom; *pFloat++ = -mNearDist;
-
-            *pFloat++ = vpRight; *pFloat++ = vpBottom; *pFloat++ = -mNearDist;
-            *pFloat++ = vpLeft;  *pFloat++ = vpBottom; *pFloat++ = -mNearDist;
-
-            *pFloat++ = vpLeft;  *pFloat++ = vpBottom; *pFloat++ = -mNearDist;
-            *pFloat++ = vpLeft;  *pFloat++ = vpTop;    *pFloat++ = -mNearDist;
-
-            // far plane (remember frustum is going in -Z direction)
-            *pFloat++ = farLeft;  *pFloat++ = farTop;    *pFloat++ = -farDist;
-            *pFloat++ = farRight; *pFloat++ = farTop;    *pFloat++ = -farDist;
-
-            *pFloat++ = farRight; *pFloat++ = farTop;    *pFloat++ = -farDist;
-            *pFloat++ = farRight; *pFloat++ = farBottom; *pFloat++ = -farDist;
-
-            *pFloat++ = farRight; *pFloat++ = farBottom; *pFloat++ = -farDist;
-            *pFloat++ = farLeft;  *pFloat++ = farBottom; *pFloat++ = -farDist;
-
-            *pFloat++ = farLeft;  *pFloat++ = farBottom; *pFloat++ = -farDist;
-            *pFloat++ = farLeft;  *pFloat++ = farTop;    *pFloat++ = -farDist;
-
-            // Sides of the pyramid
-            *pFloat++ = 0.0f;    *pFloat++ = 0.0f;   *pFloat++ = 0.0f;
-            *pFloat++ = vpLeft;  *pFloat++ = vpTop;  *pFloat++ = -mNearDist;
-
-            *pFloat++ = 0.0f;    *pFloat++ = 0.0f;   *pFloat++ = 0.0f;
-            *pFloat++ = vpRight; *pFloat++ = vpTop;    *pFloat++ = -mNearDist;
-
-            *pFloat++ = 0.0f;    *pFloat++ = 0.0f;   *pFloat++ = 0.0f;
-            *pFloat++ = vpRight; *pFloat++ = vpBottom; *pFloat++ = -mNearDist;
-
-            *pFloat++ = 0.0f;    *pFloat++ = 0.0f;   *pFloat++ = 0.0f;
-            *pFloat++ = vpLeft;  *pFloat++ = vpBottom; *pFloat++ = -mNearDist;
-
-            // Sides of the box
-
-            *pFloat++ = vpLeft;  *pFloat++ = vpTop;  *pFloat++ = -mNearDist;
-            *pFloat++ = farLeft;  *pFloat++ = farTop;  *pFloat++ = -farDist;
-
-            *pFloat++ = vpRight; *pFloat++ = vpTop;    *pFloat++ = -mNearDist;
-            *pFloat++ = farRight; *pFloat++ = farTop;    *pFloat++ = -farDist;
-
-            *pFloat++ = vpRight; *pFloat++ = vpBottom; *pFloat++ = -mNearDist;
-            *pFloat++ = farRight; *pFloat++ = farBottom; *pFloat++ = -farDist;
-
-            *pFloat++ = vpLeft;  *pFloat++ = vpBottom; *pFloat++ = -mNearDist;
-            *pFloat++ = farLeft;  *pFloat++ = farBottom; *pFloat++ = -farDist;
-
-
-            vbuf->unlock();
-
-            mRecalcVertexData = false;
-        }
-    }
-
-    //-----------------------------------------------------------------------
-    bool Frustum::isViewOutOfDate(void) const
-    {
-        // Attached to node?
-		// TODO PORT - Not attached to node because I'll be handling this differently
-        //if (mParentNode)
-        //{
-        //    if (mRecalcView ||
-        //        mParentNode->_getDerivedOrientation() != mLastParentOrientation ||
-        //        mParentNode->_getDerivedPosition() != mLastParentPosition)
-        //    {
-        //        // Ok, we're out of date with SceneNode we're attached to
-        //        mLastParentOrientation = mParentNode->_getDerivedOrientation();
-        //        mLastParentPosition = mParentNode->_getDerivedPosition();
-        //        mRecalcView = true;
-        //    }
-        //}
-
-        return mRecalcView;
-    }
-
-    //-----------------------------------------------------------------------
-    bool Frustum::isFrustumOutOfDate(void) const
-    {
-        return mRecalcFrustum;
-    }
-
-    //-----------------------------------------------------------------------
-	void Frustum::updateViewImpl(void) const
-	{
-		// ----------------------
-		// Update the view matrix
-		// ----------------------
-
-		// Get orientation from quaternion
-
-		if (!mCustomViewMatrix)
-		{
-			Matrix3 rot;
-			const Quaternion& orientation = getOrientationForViewUpdate();
-			const Vector3& position = getPositionForViewUpdate();
-
-			mViewMatrix = Math::makeViewMatrix(position, orientation, 0);
-		}
-
-		mRecalcView = false;
-
-		// Signal to update frustum clipping planes
-		mRecalcFrustumPlanes = true;
-		// Signal to update world space corners
-		mRecalcWorldSpaceCorners = true;
-	}
-	//---------------------------------------------------------------------
-	void Frustum::calcViewMatrixRelative(const Vector3& relPos, Matrix4& matToUpdate) const
-	{
-		Matrix4 matTrans = Matrix4::IDENTITY;
-		matTrans.setTrans(relPos);
-		matToUpdate = getViewMatrix() * matTrans;
-
-	}
-	//-----------------------------------------------------------------------
-    void Frustum::updateView(void) const
-    {
-        if (isViewOutOfDate())
-        {
-			updateViewImpl();
-        }
-    }
-
-	//-----------------------------------------------------------------------
-	void Frustum::updateFrustumPlanesImpl(void) const
-	{
-		// -------------------------
-		// Update the frustum planes
-		// -------------------------
-		Matrix4 combo = mProjMatrix * mViewMatrix;
-
-		mFrustumPlanes[FRUSTUM_PLANE_LEFT].normal.x = combo[3][0] + combo[0][0];
-		mFrustumPlanes[FRUSTUM_PLANE_LEFT].normal.y = combo[3][1] + combo[0][1];
-		mFrustumPlanes[FRUSTUM_PLANE_LEFT].normal.z = combo[3][2] + combo[0][2];
-		mFrustumPlanes[FRUSTUM_PLANE_LEFT].d = combo[3][3] + combo[0][3];
-
-		mFrustumPlanes[FRUSTUM_PLANE_RIGHT].normal.x = combo[3][0] - combo[0][0];
-		mFrustumPlanes[FRUSTUM_PLANE_RIGHT].normal.y = combo[3][1] - combo[0][1];
-		mFrustumPlanes[FRUSTUM_PLANE_RIGHT].normal.z = combo[3][2] - combo[0][2];
-		mFrustumPlanes[FRUSTUM_PLANE_RIGHT].d = combo[3][3] - combo[0][3];
-
-		mFrustumPlanes[FRUSTUM_PLANE_TOP].normal.x = combo[3][0] - combo[1][0];
-		mFrustumPlanes[FRUSTUM_PLANE_TOP].normal.y = combo[3][1] - combo[1][1];
-		mFrustumPlanes[FRUSTUM_PLANE_TOP].normal.z = combo[3][2] - combo[1][2];
-		mFrustumPlanes[FRUSTUM_PLANE_TOP].d = combo[3][3] - combo[1][3];
-
-		mFrustumPlanes[FRUSTUM_PLANE_BOTTOM].normal.x = combo[3][0] + combo[1][0];
-		mFrustumPlanes[FRUSTUM_PLANE_BOTTOM].normal.y = combo[3][1] + combo[1][1];
-		mFrustumPlanes[FRUSTUM_PLANE_BOTTOM].normal.z = combo[3][2] + combo[1][2];
-		mFrustumPlanes[FRUSTUM_PLANE_BOTTOM].d = combo[3][3] + combo[1][3];
-
-		mFrustumPlanes[FRUSTUM_PLANE_NEAR].normal.x = combo[3][0] + combo[2][0];
-		mFrustumPlanes[FRUSTUM_PLANE_NEAR].normal.y = combo[3][1] + combo[2][1];
-		mFrustumPlanes[FRUSTUM_PLANE_NEAR].normal.z = combo[3][2] + combo[2][2];
-		mFrustumPlanes[FRUSTUM_PLANE_NEAR].d = combo[3][3] + combo[2][3];
-
-		mFrustumPlanes[FRUSTUM_PLANE_FAR].normal.x = combo[3][0] - combo[2][0];
-		mFrustumPlanes[FRUSTUM_PLANE_FAR].normal.y = combo[3][1] - combo[2][1];
-		mFrustumPlanes[FRUSTUM_PLANE_FAR].normal.z = combo[3][2] - combo[2][2];
-		mFrustumPlanes[FRUSTUM_PLANE_FAR].d = combo[3][3] - combo[2][3];
-
-		// Renormalise any normals which were not unit length
-		for(int i=0; i<6; i++ ) 
-		{
-			float length = mFrustumPlanes[i].normal.normalise();
-			mFrustumPlanes[i].d /= length;
-		}
-
-		mRecalcFrustumPlanes = false;
-	}
-    //-----------------------------------------------------------------------
-    void Frustum::updateFrustumPlanes(void) const
-    {
-        updateView();
-        updateFrustum();
-
-        if (mRecalcFrustumPlanes)
-        {
-			updateFrustumPlanesImpl();
-        }
-    }
-	//-----------------------------------------------------------------------
-	void Frustum::updateWorldSpaceCornersImpl(void) const
-	{
-		Matrix4 eyeToWorld = mViewMatrix.inverseAffine();
-
-		// Note: Even though we can dealing with general projection matrix here,
-		//       but because it's incompatibly with infinite far plane, thus, we
-		//       still need to working with projection parameters.
-
-		// Calc near plane corners
-		float nearLeft, nearRight, nearBottom, nearTop;
-		calcProjectionParameters(nearLeft, nearRight, nearBottom, nearTop);
-
-		// Treat infinite fardist as some arbitrary far value
-		float farDist = (mFarDist == 0) ? 100000 : mFarDist;
-
-		// Calc far palne corners
-		float radio = mProjType == PT_PERSPECTIVE ? farDist / mNearDist : 1;
-		float farLeft = nearLeft * radio;
-		float farRight = nearRight * radio;
-		float farBottom = nearBottom * radio;
-		float farTop = nearTop * radio;
-
-		// near
-		mWorldSpaceCorners[0] = eyeToWorld.transformAffine(Vector3(nearRight, nearTop,    -mNearDist));
-		mWorldSpaceCorners[1] = eyeToWorld.transformAffine(Vector3(nearLeft,  nearTop,    -mNearDist));
-		mWorldSpaceCorners[2] = eyeToWorld.transformAffine(Vector3(nearLeft,  nearBottom, -mNearDist));
-		mWorldSpaceCorners[3] = eyeToWorld.transformAffine(Vector3(nearRight, nearBottom, -mNearDist));
-		// far
-		mWorldSpaceCorners[4] = eyeToWorld.transformAffine(Vector3(farRight,  farTop,     -farDist));
-		mWorldSpaceCorners[5] = eyeToWorld.transformAffine(Vector3(farLeft,   farTop,     -farDist));
-		mWorldSpaceCorners[6] = eyeToWorld.transformAffine(Vector3(farLeft,   farBottom,  -farDist));
-		mWorldSpaceCorners[7] = eyeToWorld.transformAffine(Vector3(farRight,  farBottom,  -farDist));
-
-
-		mRecalcWorldSpaceCorners = false;
-	}
-    //-----------------------------------------------------------------------
-    void Frustum::updateWorldSpaceCorners(void) const
-    {
-        updateView();
-
-        if (mRecalcWorldSpaceCorners)
-        {
-			updateWorldSpaceCornersImpl();
-        }
-
-    }
-
-    //-----------------------------------------------------------------------
-    float Frustum::getAspectRatio(void) const
-    {
-        return mAspect;
-    }
-
-    //-----------------------------------------------------------------------
-    void Frustum::setAspectRatio(float r)
-    {
-        mAspect = r;
-        invalidateFrustum();
-    }
-
-    //-----------------------------------------------------------------------
-    const AxisAlignedBox& Frustum::getBoundingBox(void) const
-    {
-        return mBoundingBox;
-    }
-    //-----------------------------------------------------------------------
-	float Frustum::getBoundingRadius(void) const
-	{
-        return (mFarDist == 0)? 100000 : mFarDist;
-	}
-    // -------------------------------------------------------------------
-    void Frustum::invalidateFrustum() const
-    {
-        mRecalcFrustum = true;
-        mRecalcFrustumPlanes = true;
-        mRecalcWorldSpaceCorners = true;
-        mRecalcVertexData = true;
-    }
-    // -------------------------------------------------------------------
-    void Frustum::invalidateView() const
-    {
-        mRecalcView = true;
-        mRecalcFrustumPlanes = true;
-        mRecalcWorldSpaceCorners = true;
-    }
-    // -------------------------------------------------------------------
-    const Vector3* Frustum::getWorldSpaceCorners(void) const
-    {
-        updateWorldSpaceCorners();
-
-        return mWorldSpaceCorners;
-    }
-    //-----------------------------------------------------------------------
-    void Frustum::setProjectionType(ProjectionType pt)
-    {
-        mProjType = pt;
-        invalidateFrustum();
-    }
-
-    //-----------------------------------------------------------------------
-    ProjectionType Frustum::getProjectionType(void) const
-    {
-        return mProjType;
-    }
-    //-----------------------------------------------------------------------
-    const Vector3& Frustum::getPositionForViewUpdate(void) const
-    {
-        return mLastParentPosition;
-    }
-    //-----------------------------------------------------------------------
-    const Quaternion& Frustum::getOrientationForViewUpdate(void) const
-    {
-        return mLastParentOrientation;
-    }
-    //---------------------------------------------------------------------
-    bool Frustum::projectSphere(const Sphere& sphere, 
-        float* left, float* top, float* right, float* bottom) const
-    {
-		// See http://www.gamasutra.com/features/20021011/lengyel_06.htm
-        // Transform light position into camera space
-
-        updateView();
-        Vector3 eyeSpacePos = mViewMatrix.transformAffine(sphere.getCenter());
-
-		// initialise
-		*left = *bottom = -1.0f;
-		*right = *top = 1.0f;
-
-        if (eyeSpacePos.z < 0)
-        {
-			updateFrustum();
-			const Matrix4& projMatrix = getProjectionMatrix();
-            float r = sphere.getRadius();
-			float rsq = r * r;
-
-            // early-exit
-            if (eyeSpacePos.squaredLength() <= rsq)
-                return false;
-
-			float Lxz = Math::Sqr(eyeSpacePos.x) + Math::Sqr(eyeSpacePos.z);
-			float Lyz = Math::Sqr(eyeSpacePos.y) + Math::Sqr(eyeSpacePos.z);
-
-			// Find the tangent planes to the sphere
-			// XZ first
-			// calculate quadratic discriminant: b*b - 4ac
-			// x = Nx
-			// a = Lx^2 + Lz^2
-			// b = -2rLx
-			// c = r^2 - Lz^2
-			float a = Lxz;
-			float b = -2.0f * r * eyeSpacePos.x;
-			float c = rsq - Math::Sqr(eyeSpacePos.z);
-			float D = b*b - 4.0f*a*c;
-
-			// two roots?
-			if (D > 0)
-			{
-				float sqrootD = Math::Sqrt(D);
-				// solve the quadratic to get the components of the normal
-				float Nx0 = (-b + sqrootD) / (2 * a);
-				float Nx1 = (-b - sqrootD) / (2 * a);
-				
-				// Derive Z from this
-				float Nz0 = (r - Nx0 * eyeSpacePos.x) / eyeSpacePos.z;
-				float Nz1 = (r - Nx1 * eyeSpacePos.x) / eyeSpacePos.z;
-
-				// Get the point of tangency
-				// Only consider points of tangency in front of the camera
-				float Pz0 = (Lxz - rsq) / (eyeSpacePos.z - ((Nz0 / Nx0) * eyeSpacePos.x));
-				if (Pz0 < 0)
-				{
-					// Project point onto near plane in worldspace
-					float nearx0 = (Nz0 * mNearDist) / Nx0;
-					// now we need to map this to viewport coords
-					// use projection matrix since that will take into account all factors
-					Vector3 relx0 = projMatrix * Vector3(nearx0, 0, -mNearDist);
-
-					// find out whether this is a left side or right side
-					float Px0 = -(Pz0 * Nz0) / Nx0;
-					if (Px0 > eyeSpacePos.x)
-					{
-						*right = std::min(*right, relx0.x);
-					}
-					else
-					{
-						*left = std::max(*left, relx0.x);
-					}
-				}
-				float Pz1 = (Lxz - rsq) / (eyeSpacePos.z - ((Nz1 / Nx1) * eyeSpacePos.x));
-				if (Pz1 < 0)
-				{
-					// Project point onto near plane in worldspace
-					float nearx1 = (Nz1 * mNearDist) / Nx1;
-					// now we need to map this to viewport coords
-					// use projection matrix since that will take into account all factors
-					Vector3 relx1 = projMatrix * Vector3(nearx1, 0, -mNearDist);
-
-					// find out whether this is a left side or right side
-					float Px1 = -(Pz1 * Nz1) / Nx1;
-					if (Px1 > eyeSpacePos.x)
-					{
-						*right = std::min(*right, relx1.x);
-					}
-					else
-					{
-						*left = std::max(*left, relx1.x);
-					}
-				}
-			}
-
-
-			// Now YZ 
-			// calculate quadratic discriminant: b*b - 4ac
-			// x = Ny
-			// a = Ly^2 + Lz^2
-			// b = -2rLy
-			// c = r^2 - Lz^2
-			a = Lyz;
-			b = -2.0f * r * eyeSpacePos.y;
-			c = rsq - Math::Sqr(eyeSpacePos.z);
-			D = b*b - 4.0f*a*c;
-
-			// two roots?
-			if (D > 0)
-			{
-				float sqrootD = Math::Sqrt(D);
-				// solve the quadratic to get the components of the normal
-				float Ny0 = (-b + sqrootD) / (2 * a);
-				float Ny1 = (-b - sqrootD) / (2 * a);
-
-				// Derive Z from this
-				float Nz0 = (r - Ny0 * eyeSpacePos.y) / eyeSpacePos.z;
-				float Nz1 = (r - Ny1 * eyeSpacePos.y) / eyeSpacePos.z;
-
-				// Get the point of tangency
-				// Only consider points of tangency in front of the camera
-				float Pz0 = (Lyz - rsq) / (eyeSpacePos.z - ((Nz0 / Ny0) * eyeSpacePos.y));
-				if (Pz0 < 0)
-				{
-					// Project point onto near plane in worldspace
-					float neary0 = (Nz0 * mNearDist) / Ny0;
-					// now we need to map this to viewport coords
-					// use projection matriy since that will take into account all factors
-					Vector3 rely0 = projMatrix * Vector3(0, neary0, -mNearDist);
-
-					// find out whether this is a top side or bottom side
-					float Py0 = -(Pz0 * Nz0) / Ny0;
-					if (Py0 > eyeSpacePos.y)
-					{
-						*top = std::min(*top, rely0.y);
-					}
-					else
-					{
-						*bottom = std::max(*bottom, rely0.y);
-					}
-				}
-				float Pz1 = (Lyz - rsq) / (eyeSpacePos.z - ((Nz1 / Ny1) * eyeSpacePos.y));
-				if (Pz1 < 0)
-				{
-					// Project point onto near plane in worldspace
-					float neary1 = (Nz1 * mNearDist) / Ny1;
-					// now we need to map this to viewport coords
-					// use projection matriy since that will take into account all factors
-					Vector3 rely1 = projMatrix * Vector3(0, neary1, -mNearDist);
-
-					// find out whether this is a top side or bottom side
-					float Py1 = -(Pz1 * Nz1) / Ny1;
-					if (Py1 > eyeSpacePos.y)
-					{
-						*top = std::min(*top, rely1.y);
-					}
-					else
-					{
-						*bottom = std::max(*bottom, rely1.y);
-					}
-				}
-			}
-        }
-
-        return (*left != -1.0f) || (*top != 1.0f) || (*right != 1.0f) || (*bottom != -1.0f);
-
-    }
-    //---------------------------------------------------------------------
-	void Frustum::setCustomViewMatrix(bool enable, const Matrix4& viewMatrix)
-	{
-		mCustomViewMatrix = enable;
-		if (enable)
-		{
-            assert(viewMatrix.isAffine());
-			mViewMatrix = viewMatrix;
-		}
-		invalidateView();
-	}
-    //---------------------------------------------------------------------
-	void Frustum::setCustomProjectionMatrix(bool enable, const Matrix4& projMatrix)
-	{
-		mCustomProjMatrix = enable;
-		if (enable)
-		{
-			mProjMatrix = projMatrix;
-		}
-		invalidateFrustum();
-	}
-	//---------------------------------------------------------------------
-	void Frustum::setOrthoWindow(float w, float h)
-	{
-		mOrthoHeight = h;
-		mAspect = w / h;
-		invalidateFrustum();
-	}
-	//---------------------------------------------------------------------
-	void Frustum::setOrthoWindowHeight(float h)
-	{
-		mOrthoHeight = h;
-		invalidateFrustum();
-	}
-	//---------------------------------------------------------------------
-	void Frustum::setOrthoWindowWidth(float w)
-	{
-		mOrthoHeight = w / mAspect;
-		invalidateFrustum();
-	}
-	//---------------------------------------------------------------------
-	float Frustum::getOrthoWindowHeight() const
-	{
-		return mOrthoHeight;
-	}
-	//---------------------------------------------------------------------
-	float Frustum::getOrthoWindowWidth() const
-	{
-		return mOrthoHeight * mAspect;	
-	}
-	//---------------------------------------------------------------------
-	void Frustum::setFrustumExtents(float left, float right, float top, float bottom)
-	{
-		mFrustumExtentsManuallySet = true;
-		mLeft = left;
-		mRight = right;
-		mTop = top;
-		mBottom = bottom;
-
-		invalidateFrustum();
-	}
-	//---------------------------------------------------------------------
-	void Frustum::resetFrustumExtents()
-	{
-		mFrustumExtentsManuallySet = false;
-		invalidateFrustum();
-	}
-	//---------------------------------------------------------------------
-	void Frustum::getFrustumExtents(float& outleft, float& outright, float& outtop, float& outbottom) const
-	{
-		updateFrustum();
-		outleft = mLeft;
-		outright = mRight;
-		outtop = mTop;
-		outbottom = mBottom;
-	}
-} // namespace CamelotEngine

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio