Index: branches/terrain/src/lib/graphics/importer/md3/md3_animation_cfg.cc
===================================================================
--- branches/terrain/src/lib/graphics/importer/md3/md3_animation_cfg.cc	(revision 9146)
+++ branches/terrain/src/lib/graphics/importer/md3/md3_animation_cfg.cc	(revision 9147)
@@ -87,5 +87,7 @@
 
     // parse file
-    while( (read = getline(&cLine, &len, pFile)) != -1) { /*( !this->dataStream.eof()) {*/
+	/*
+    while( (read = getline(&cLine, &len, pFile)) != -1) { 
+		// ( !this->dataStream.eof()) {
       std::string line(cLine);
 
@@ -176,5 +178,5 @@
         }
       }
-    }
+    }*/
   }
 
Index: branches/terrain/src/lib/graphics/importer/terrain/frustum.h
===================================================================
--- branches/terrain/src/lib/graphics/importer/terrain/frustum.h	(revision 9146)
+++ branches/terrain/src/lib/graphics/importer/terrain/frustum.h	(revision 9147)
@@ -15,4 +15,6 @@
 #ifndef _FRUSTUM_H
 #define _FRUSTUM_H
+#include "plane.h"
+#include "vector.h"
 #include "types.h"
 #include "glincl.h"
@@ -71,8 +73,8 @@
 
 				// is the positive vertex outside?
-				if ( planes[i].distance( _box.vertexP( planes[i].n ) ) < 0 )
+				if ( planes[i].distancePoint( _box.vertexP( planes[i].n ) ) < 0 )
 					return OUTSIDE;
 				// is the negative vertex outside?	
-				else if ( planes[i].distance( _box.vertexN( planes[i].n ) ) < 0 )
+				else if ( planes[i].distancePoint( _box.vertexN( planes[i].n ) ) < 0 )
 					result = INTERSECT;
 			}
@@ -80,9 +82,9 @@
 		}
 		
-		inline int pointInFrustum( const Triple& _point)
+		inline int pointInFrustum( const Vector& _point)
 		{
 			int result = INSIDE;
 			for(int i=0; i < 6; i++) {
-				if (planes[i].distance( _point ) < 0)
+				if (planes[i].distancePoint( _point ) < 0)
 					return OUTSIDE;
 			}
@@ -91,33 +93,42 @@
 		
 		inline Plane getPlane( int _plane ) { return planes[_plane]; }
+		
 		inline void setFrustum( float *_m )
 		{
-			planes[NEAR].setCoefficients( m(2,0) + m(3,0),
-									  	  m(2,1) + m(3,1),
-									  	  m(2,2) + m(3,2),
-									      m(2,3) + m(3,3));
-			planes[FAR].setCoefficients( -m(2,0) + m(3,0),
-									     -m(2,1) + m(3,1),
-									     -m(2,2) + m(3,2),
-									     -m(2,3) + m(3,3));
-			planes[BOTTOM].setCoefficients( m(1,0) + m(3,0),
-									   		m(1,1) + m(3,1),
-									   		m(1,2) + m(3,2),
-									   		m(1,3) + m(3,3));
-			planes[TOP].setCoefficients(  -m(1,0) + m(3,0),
-									  -m(1,1) + m(3,1),
-									  -m(1,2) + m(3,2),
-									  -m(1,3) + m(3,3));
-			planes[LEFT].setCoefficients(  m(0,0) + m(3,0),
-									   m(0,1) + m(3,1),
-									   m(0,2) + m(3,2),
-									   m(0,3) + m(3,3));
-			planes[RIGHT].setCoefficients(-m(0,0) + m(3,0),
-									  -m(0,1) + m(3,1),
-									  -m(0,2) + m(3,2),
-									  -m(0,3) + m(3,3));
+			planes[NEAR] =  Plane( Vector( 
+				m(2,0) + m(3,0), 
+				m(2,1) + m(3,1), 
+				m(2,2) + m(3,2) ), 
+				m(2,3) + m(3,3) );
+				
+			planes[FAR] = Plane( Vector( 
+				-m(2,0) + m(3,0),
+				-m(2,1) + m(3,1),
+				-m(2,2) + m(3,2) ),
+				-m(2,3) + m(3,3) );
+									
+			planes[BOTTOM] = Plane( Vector( 
+				m(1,0) + m(3,0), 
+				m(1,1) + m(3,1), 
+				m(1,2) + m(3,2) ), 
+				m(1,3) + m(3,3) );
+			planes[TOP] = Plane( Vector(  
+				-m(1,0) + m(3,0),
+				-m(1,1) + m(3,1),
+				-m(1,2) + m(3,2) ),
+				-m(1,3) + m(3,3) );
+			planes[LEFT] = Plane( Vector(  
+				m(0,0) + m(3,0),
+				m(0,1) + m(3,1),
+				m(0,2) + m(3,2) ),
+				m(0,3) + m(3,3) );
+			planes[RIGHT] =  Plane( Vector( 
+				-m(0,0) + m(3,0),
+				-m(0,1) + m(3,1),
+				-m(0,2) + m(3,2) ),
+				-m(0,3) + m(3,3) );
 							
-			if ( planes[NEAR].d +planes[FAR].d  > MAX_CLIP_DISTANCE ) {
-				planes[FAR].d = -planes[NEAR].d+MAX_CLIP_DISTANCE;
+			if ( planes[NEAR].k +planes[FAR].k  > MAX_CLIP_DISTANCE ) {
+				planes[FAR].k = -planes[NEAR].k+MAX_CLIP_DISTANCE;
 			}
 		}
Index: branches/terrain/src/lib/graphics/importer/terrain/terrain.cc
===================================================================
--- branches/terrain/src/lib/graphics/importer/terrain/terrain.cc	(revision 9146)
+++ branches/terrain/src/lib/graphics/importer/terrain/terrain.cc	(revision 9147)
@@ -97,5 +97,5 @@
 	pTerrainPage newPage = new TerrainPage( const_cast<Terrain*>( this ), _xOffset, _zOffset );
 	newPage->setScale( scale );	
-	newPage->setPosition( Triple( scale.x*_xOffset, 0.0f, scale.z*_zOffset ) );
+	newPage->setPosition( Vector( scale.x*_xOffset, 0.0f, scale.z*_zOffset ) );
 	newPage->calculateErrors();
 	return newPage;
@@ -248,5 +248,5 @@
 	//Due to some reason, the OpenGL implementors chose the plane equation
 	//to an array of doubles. So we will make them happy.
-	double farPlane[] = { far.n.x, far.n.y, far.n.z, far.d };
+	double farPlane[] = { far.n.x, far.n.y, far.n.z, far.k };
 	glEnable( GL_CLIP_PLANE0 );
 	glClipPlane( GL_CLIP_PLANE0, farPlane );
@@ -419,5 +419,5 @@
 }
 
-void Terrain::getAltitude( Triple& _alt, Triple& _normal )
+void Terrain::getAltitude( Vector& _alt, Vector& _normal )
 {
 	float xScaled = _alt.x / scale.x, zScaled = _alt.z / scale.z;
Index: branches/terrain/src/lib/graphics/importer/terrain/terrain.h
===================================================================
--- branches/terrain/src/lib/graphics/importer/terrain/terrain.h	(revision 9146)
+++ branches/terrain/src/lib/graphics/importer/terrain/terrain.h	(revision 9147)
@@ -21,5 +21,6 @@
 #include "buffer_broker.h"
 #endif
-#include "types.h"
+
+#include "vector.h"
 #include "terrain_page.h"
 #include "terrain_quad.h"
@@ -30,4 +31,5 @@
 #include "frustum.h"
 
+class Texture;
 class Terrain;
 typedef Terrain *pTerrain;
@@ -53,15 +55,15 @@
 
 	
-		inline void setCameraPosition( const Triple& _cameraPosition ) 
+		inline void setCameraPosition( const Vector& _cameraPosition ) 
 		{ 
 			cameraPosition = _cameraPosition; 
 		}
 		
-		inline const Triple& getCameraPosition() const
+		inline const Vector& getCameraPosition() const
 		{
 			return cameraPosition;
 		}
 	
-		void getAltitude( Triple& _alt, Triple& _normal );
+		void getAltitude( Vector& _alt, Vector& _normal );
 		
 		inline void setLightmap( Texture *_lightmap )
@@ -86,5 +88,5 @@
 			current = 0;
 			activePages = NULL;
-			scale  = Triple( 1.0f, 3.0f, 1.0f );
+			scale  = Vector( 1.0f, 3.0f, 1.0f );
 			frustum = new Frustum();
 			activatedCount = deactivatedCount = 0;
@@ -114,5 +116,5 @@
 		void draw( );
 
-		void setPageSize( const Triple& _page ) { }
+		void setPageSize( const Vector& _page ) { }
 		
 		void build();
@@ -146,5 +148,5 @@
 		}
 		
-		inline const Triple getScale() const { return scale; }
+		inline const Vector getScale() const { return scale; }
 		
 		inline int getPageSize() const 
@@ -159,5 +161,5 @@
 		}
 		
-		inline void setScale( const Triple& _scale )
+		inline void setScale( const Vector& _scale )
 		{ scale = _scale; }
 #ifdef USE_VBO
@@ -197,5 +199,5 @@
 		Texture						*lightmap;
 		Heightfield					heightfield;
-		Triple						scale;
+		Vector						scale;
 		int 						pagesX, 
 									pagesZ;
@@ -213,5 +215,5 @@
 		std::vector<BufferInfo>		buffers;			
 			
-		Triple						cameraPosition;
+		Vector						cameraPosition;
 		pFrustum					frustum;
 		pTerrainPage				activePages;
Index: branches/terrain/src/lib/graphics/importer/terrain/terrain_page.cc
===================================================================
--- branches/terrain/src/lib/graphics/importer/terrain/terrain_page.cc	(revision 9146)
+++ branches/terrain/src/lib/graphics/importer/terrain/terrain_page.cc	(revision 9147)
@@ -46,5 +46,5 @@
 		layerVisibility[i] = LV_NO;	
 		
-	position = Triple( scale.x*_xOffset, 
+	position = Vector( scale.x*_xOffset, 
 		0.0f, scale.z*_zOffset );
 	isVisible = false;
@@ -129,12 +129,12 @@
 {
 	wantedLOD = -1;
-	Triple cam( owner->getCameraPosition() );
+	Vector cam( owner->getCameraPosition() );
 	
 	for ( int i = TerrainPage::MAX_LODS-1; i >= 0; --i ) {
-		Triple distance( cam.x-errors[i].correct.x,
+		Vector distance( cam.x-errors[i].correct.x,
 						 cam.y-errors[i].correct.y,
 						 cam.z-errors[i].correct.z );
 		
-		float d = distance.length();
+		float d = distance.len();
 		
 		float err =  errors[i].diff / d ;
@@ -230,5 +230,5 @@
 	float alt = 0.0f;
 	
-	Triple	min( xOffset*scale.x ,0.0f, zOffset*scale.z ), 
+	Vector	min( xOffset*scale.x ,0.0f, zOffset*scale.z ), 
 			max( (xOffset+1)*scale.x, 0.0f, (zOffset+1)*scale.z);
 	
@@ -774,5 +774,5 @@
 }
 
-void TerrainPage::getVertex( int _x, int _z, Triple& _vertex ) const
+void TerrainPage::getVertex( int _x, int _z, Vector& _vertex ) const
 {
 	_vertex.x = position.x+scale.x*_x/
Index: branches/terrain/src/lib/graphics/importer/terrain/terrain_page.h
===================================================================
--- branches/terrain/src/lib/graphics/importer/terrain/terrain_page.h	(revision 9146)
+++ branches/terrain/src/lib/graphics/importer/terrain/terrain_page.h	(revision 9147)
@@ -28,5 +28,5 @@
 struct Vertex {
 	TexCoord 	t;	
-	Triple 		p;
+	Vector 		p;
 };
 
@@ -34,6 +34,6 @@
 
 typedef struct {
-	Triple	correct;
-	Triple	real;
+	Vector	correct;
+	Vector	real;
 	float	diff;
 } LODError, *pLODError;
@@ -159,5 +159,5 @@
 		 * Sets the position of the TerrainPage. Is this needed?
 		 */
-		inline void setPosition( const Triple& _pos )
+		inline void setPosition( const Vector& _pos )
 		{
 			position.x = _pos.x;
@@ -250,5 +250,5 @@
 		 * Fills _vertex with the vertex information at index.
 		 */
-		void getVertex( int _x, int _z, Triple& _vertex ) const;
+		void getVertex( int _x, int _z, Vector& _vertex ) const;
 		
 	 	/**
@@ -288,5 +288,5 @@
 		pTerrainPage				previous;
 		LODError					*errors;
-		Triple						position;
+		Vector						position;
 };
 
Index: branches/terrain/src/lib/graphics/importer/terrain/terrain_quad.cc
===================================================================
--- branches/terrain/src/lib/graphics/importer/terrain/terrain_quad.cc	(revision 9146)
+++ branches/terrain/src/lib/graphics/importer/terrain/terrain_quad.cc	(revision 9147)
@@ -47,6 +47,6 @@
 		exit( 0 );
 	}	
-	Triple min = Triple( children[BL_CHILD]->getBounds().min() );
-	Triple max = Triple( children[TR_CHILD]->getBounds().max() );
+	Vector min = Vector( children[BL_CHILD]->getBounds().min() );
+	Vector max = Vector( children[TR_CHILD]->getBounds().max() );
 	for ( int i = 1; i < 4; ++i ) {
 		pTerrainQuad child = children[i];
Index: branches/terrain/src/lib/graphics/importer/terrain/terrain_quad.h
===================================================================
--- branches/terrain/src/lib/graphics/importer/terrain/terrain_quad.h	(revision 9146)
+++ branches/terrain/src/lib/graphics/importer/terrain/terrain_quad.h	(revision 9147)
@@ -66,5 +66,5 @@
 			return children[_child]; 
 		}
-		inline void setScale( Triple _scale )
+		inline void setScale( Vector _scale )
 		{
 			scale = _scale;
@@ -94,5 +94,5 @@
 		int				xOffset, zOffset;
 		int				width,	height;
-		Triple			scale;
+		Vector			scale;
 		pTerrainQuad 	children[4];
 		ABox			bounds;
Index: branches/terrain/src/lib/graphics/importer/terrain/types.h
===================================================================
--- branches/terrain/src/lib/graphics/importer/terrain/types.h	(revision 9146)
+++ branches/terrain/src/lib/graphics/importer/terrain/types.h	(revision 9147)
@@ -26,16 +26,4 @@
 #define SAVE_DELETE( _a ) if ( _a ) { delete _a; _a = NULL; }
 
-struct Triple
-{
-  Triple( float _x, float _y, float _z )
-  {
-    x = _x; y = _y; z = _z;
-  }
-  Triple() { x = y = z = 0.0f; }
-  inline float length() const
-    { return sqrt( x*x+y*y+z*z ); }
-  float x, y, z;
-};
-
 struct TexCoord
 {
@@ -54,5 +42,5 @@
 {
 
-  ABox( Triple _min, Triple _max)
+  ABox( Vector _min, Vector _max)
   {
     corner = _min;
@@ -64,12 +52,12 @@
   ABox()
   {
-    corner = Triple( 0.0f, 0.0f, 0.0f );
+    corner = Vector( 0.0f, 0.0f, 0.0f );
     x = y = z = 0.0f;
   }
-  inline void set( const Triple& _min, const Triple& _max )
+  inline void set( const Vector& _min, const Vector& _max )
   {
     setMin( _min ); setMax( _max );
   }
-  inline void setMax( const Triple& _max )
+  inline void setMax( const Vector& _max )
   {
     x = _max.x-corner.x;
@@ -77,11 +65,11 @@
     z = _max.z-corner.z;
   }
-  inline void setMin( const Triple& _min )
+  inline void setMin( const Vector& _min )
   {
     corner = _min;
   }
-  inline Triple vertexP( const Triple& _normal ) const
+  inline Vector vertexP( const Vector& _normal ) const
   {
-    Triple res = corner;
+    Vector res = corner;
     if ( _normal.x > 0 )
       res.x+= x;
@@ -93,7 +81,7 @@
     return res;
   }
-  inline Triple vertexN( const Triple& _normal ) const
+  inline Vector vertexN( const Vector& _normal ) const
   {
-    Triple res = corner;
+    Vector res = corner;
     if ( _normal.x < 0 )
       res.x+= x;
@@ -106,7 +94,7 @@
 
   }
-inline Triple min() const { return Triple(corner); }
-  inline Triple max() const { return Triple( corner.x+x, corner.y+y, corner.z+z ); }
-  Triple corner;
+inline Vector min() const { return Vector(corner); }
+  inline Vector max() const { return Vector( corner.x+x, corner.y+y, corner.z+z ); }
+  Vector corner;
   float x, y, z;
 
@@ -115,17 +103,17 @@
 // struct Plane
 // {
-//   Plane() { n = Triple( 0.0f, 1.0f, 0.0f ); d = 0.0f; }
+//   Plane() { n = Vector( 0.0f, 1.0f, 0.0f ); d = 0.0f; }
 //   inline void setCoefficients( float _nx, float _ny, float _nz, float _d )
 //   {
-//     n = Triple( _nx, _ny, _nz );
+//     n = Vector( _nx, _ny, _nz );
 //     float l = n.length();
 //     n.x /= l; n.y/=l; n.z/=l;
 //     d = _d/l;
 //   }
-//   inline float distance( const Triple& _point ) const
+//   inline float distance( const Vector& _point ) const
 //   {
 //     return _point.x*n.x+_point.y*n.y+_point.z*n.z+d;
 //   }
-//   Triple n;
+//   Vector n;
 //   float d;
 // };
Index: branches/terrain/src/world_entities/terrain_entity.cc
===================================================================
--- branches/terrain/src/world_entities/terrain_entity.cc	(revision 9146)
+++ branches/terrain/src/world_entities/terrain_entity.cc	(revision 9147)
@@ -25,5 +25,5 @@
 #include "model.h"
 #include "network_game_manager.h"
-
+#include "vector.h"
 #include "material.h"
 
@@ -167,5 +167,5 @@
 void TerrainEntity::setScale(float x, float y, float z)
 {
- 	terrain->setScale( Triple( x, y, z ) );
+ 	terrain->setScale( Vector( x, y, z ) );
 }
 
@@ -220,5 +220,5 @@
 	
   	if ( this->terrain ) {
-		terrain->setCameraPosition( Triple( cam.x, cam.y, cam.z ) ); 
+		terrain->setCameraPosition( cam ); 
 		terrain->draw( );
   	}
@@ -405,5 +405,5 @@
 void TerrainEntity::getAltitude( Vector& _position, Vector& _normal )
 {
-	Triple 	altitude( _position.x-getAbsCoor().x, 0.0f, _position.z-getAbsCoor().z ), 
+	Vector 	altitude( _position.x-getAbsCoor().x, 0.0f, _position.z-getAbsCoor().z ), 
 			normal( 0.0f, 0.0f, 0.0f );
 	if ( terrain ) 
@@ -416,5 +416,5 @@
 float TerrainEntity::getHeight( float x, float z )
 {
-	Triple 	altitude( x-getAbsCoor().x, 0.0f, z-getAbsCoor().z ), 
+	Vector 	altitude( x-getAbsCoor().x, 0.0f, z-getAbsCoor().z ), 
 			normal( 0.0f, 0.0f, 0.0f );
 	if ( terrain )
