Index: /trunk/nv/core/arcball.hh
===================================================================
--- /trunk/nv/core/arcball.hh	(revision 397)
+++ /trunk/nv/core/arcball.hh	(revision 398)
@@ -16,4 +16,5 @@
 #include <nv/common.hh>
 #include <nv/stl/math.hh>
+#include <nv/stl/utility/common.hh>
 
 namespace nv
@@ -46,6 +47,6 @@
 		void drag( ivec2 nposition )
 		{
-			glm::vec3 va = get_arcball_vector( m_last );
-			glm::vec3 vb = get_arcball_vector( nposition );
+			vec3 va = get_arcball_vector( m_last );
+			vec3 vb = get_arcball_vector( nposition );
 
 			m_angle = glm::acos( glm::min( 1.0f, glm::dot( va, vb ) ) );
@@ -56,7 +57,7 @@
 		f32 get_angle() const { return m_angle; }
 	private:
-		glm::vec3 get_arcball_vector( const nv::ivec2& s )
+		vec3 get_arcball_vector( const ivec2& s )
 		{
-			glm::vec3 p( 1.0*s.x / m_window.x * 2 - 1.0, 1.0*s.y / m_window.y * 2 - 1.0, 0 );
+			vec3 p( 1.0*s.x / m_window.x * 2 - 1.0, 1.0*s.y / m_window.y * 2 - 1.0, 0 );
 			p.y = -p.y;
 			float sq = p.x * p.x + p.y * p.y;
@@ -64,5 +65,5 @@
 				p.z = sqrt( 1.0f - sq );
 			else
-				p = glm::normalize( p );
+				p = math::normalize( p );
 			return p;
 		}
Index: /trunk/nv/core/transform.hh
===================================================================
--- /trunk/nv/core/transform.hh	(revision 397)
+++ /trunk/nv/core/transform.hh	(revision 398)
@@ -26,5 +26,5 @@
 		void set_orientation( const quat& a_orientation ) { m_orientation = a_orientation; }
  		void set_orientation( float radians, const vec3& axis )
- 		{ // use glm::radians if degrees!
+ 		{ // use math::radians if degrees!
  			m_orientation = glm::angleAxis( radians, axis );
  		}
@@ -43,5 +43,5 @@
 		}
 // 		void rotate( const vec3& axis, f32 angle )
-// 		{ // use glm::radians if degrees!
+// 		{ // use math::radians if degrees!
 // 			quat temp( angle, axis );
 // 			m_orientation = temp * m_orientation;
@@ -54,5 +54,5 @@
 		mat4 extract() const
 		{
-			mat4 result = glm::mat4_cast( m_orientation );
+			mat4 result = mat4_cast( m_orientation );
 			result[3] = vec4( m_position, 1.0f );
 			return result;
@@ -62,5 +62,5 @@
 			quat new_orient( glm::inverse( m_orientation ) );
 			// TODO: simplify
-			return transform( -glm::mat3_cast(new_orient) * m_position, new_orient );
+			return transform( -mat3_cast(new_orient) * m_position, new_orient );
 		}
 
@@ -100,5 +100,5 @@
 		return transform( 
 			glm::mix  ( a.get_position(), b.get_position(), value ), 
-			glm::slerp( a.get_orientation(), b.get_orientation(), value ) 
+			glm::slerp( a.get_orientation(), b.get_orientation(), value )
 		);
 	}
Index: /trunk/nv/formats/md5_loader.hh
===================================================================
--- /trunk/nv/formats/md5_loader.hh	(revision 397)
+++ /trunk/nv/formats/md5_loader.hh	(revision 398)
@@ -63,7 +63,7 @@
 		struct md5_weight
 		{
-			size_t    joint_id;
-			float     bias;
-			glm::vec3 pos;
+			size_t joint_id;
+			float  bias;
+			vec3   pos;
 		};
 
Index: /trunk/nv/interface/interpolation_raw.hh
===================================================================
--- /trunk/nv/interface/interpolation_raw.hh	(revision 397)
+++ /trunk/nv/interface/interpolation_raw.hh	(revision 398)
@@ -64,8 +64,8 @@
 			{
 			case animation_slot::TIME:     return mat4();
-			case animation_slot::POSITION: return glm::translate( mat4(),glm::make_vec3( data ) );
-			case animation_slot::ROTATION: return glm::mat4_cast( make_quat_fixed( data ) );
-			case animation_slot::SCALE:    return glm::scale( mat4(),glm::make_vec3( data ) );
-			case animation_slot::TFORM:    return transform( glm::make_vec3( data ), make_quat_fixed( data + 3 ) ).extract();
+			case animation_slot::POSITION: return glm::translate( mat4(), make_vec3( data ) );
+			case animation_slot::ROTATION: return mat4_cast( make_quat_fixed( data ) );
+			case animation_slot::SCALE:    return glm::scale( mat4(),make_vec3( data ) );
+			case animation_slot::TFORM:    return transform( make_vec3( data ), make_quat_fixed( data + 3 ) ).extract();
 			default:
 				return mat4();
@@ -84,10 +84,10 @@
 				case animation_slot::TIME:     break;
 				case animation_slot::POSITION: 
-					position = glm::translate( position,glm::make_vec3( data + offset ) ); break;
+					position = glm::translate( position,make_vec3( data + offset ) ); break;
 				case animation_slot::ROTATION: 
-					rotation = glm::mat4_cast( make_quat_fixed( data + offset ) ); break;
+					rotation = mat4_cast( make_quat_fixed( data + offset ) ); break;
 				case animation_slot::SCALE:    
-					scale    = glm::scale( mat4(),glm::make_vec3( data + offset ) ); break;
-				case animation_slot::TFORM:    return transform( glm::make_vec3( data + offset ), make_quat_fixed( data + offset + 3 ) ).extract();
+					scale    = glm::scale( mat4(),make_vec3( data + offset ) ); break;
+				case animation_slot::TFORM:    return transform( make_vec3( data + offset ), make_quat_fixed( data + offset + 3 ) ).extract();
 				default:
 					break;
@@ -105,8 +105,8 @@
 			{
 			case animation_slot::TIME:     return transform();
-			case animation_slot::POSITION: return transform( glm::make_vec3( data ) );
+			case animation_slot::POSITION: return transform( make_vec3( data ) );
 			case animation_slot::ROTATION: return transform( make_quat_fixed( data ) );
 			case animation_slot::SCALE:    return transform();
-			case animation_slot::TFORM:    return transform( glm::make_vec3( data ), make_quat_fixed( data + 3 ) );
+			case animation_slot::TFORM:    return transform( make_vec3( data ), make_quat_fixed( data + 3 ) );
 			default:
 				return transform();
@@ -124,9 +124,9 @@
 				case animation_slot::TIME:     break;
 				case animation_slot::POSITION: 
-					position = glm::make_vec3( data + offset ); break;
+					position = make_vec3( data + offset ); break;
 				case animation_slot::ROTATION: 
 					rotation = make_quat_fixed( data + offset ); break;
 				case animation_slot::SCALE:	   break;
-				case animation_slot::TFORM:    return transform( glm::make_vec3( data + offset ), make_quat_fixed( data + 3 ) );
+				case animation_slot::TFORM:    return transform( make_vec3( data + offset ), make_quat_fixed( data + 3 ) );
 				default:
 					break;
@@ -145,5 +145,5 @@
 	{
 		quat& r = *((quat*)(data));
-		r = glm::quat_cast( r33 * glm::mat3_cast( r ) * ri33 );
+		r = quat_cast( r33 * mat3_cast( r ) * ri33 );
 	}
 	inline void transform_key_scale( void* data, float scale )
@@ -157,5 +157,5 @@
 		t = transform( 
 			r33 * t.get_position() * scale,
-			glm::quat_cast( r33 * glm::mat3_cast( t.get_orientation() ) * ri33 )
+			quat_cast( r33 * mat3_cast( t.get_orientation() ) * ri33 )
 		);
 	}
Index: /trunk/nv/lib/assimp.hh
===================================================================
--- /trunk/nv/lib/assimp.hh	(revision 397)
+++ /trunk/nv/lib/assimp.hh	(revision 398)
@@ -68,5 +68,5 @@
 	{
 		const float* p = (float*)&m;
-		return glm::transpose( glm::make_mat4( p ) );
+		return glm::transpose( make_mat4( p ) );
 	}
 
Index: /trunk/nv/stl/math.hh
===================================================================
--- /trunk/nv/stl/math.hh	(revision 397)
+++ /trunk/nv/stl/math.hh	(revision 398)
@@ -43,4 +43,14 @@
 	template < typename T > using tquat = ::glm::tmat4x4<T>;
 #endif
+
+	using ::glm::mat3_cast;
+	using ::glm::mat4_cast;
+	using ::glm::quat_cast;
+	using ::glm::make_vec2;
+	using ::glm::make_vec3;
+	using ::glm::make_vec4;
+	using ::glm::make_mat2;
+	using ::glm::make_mat3;
+	using ::glm::make_mat4;
 
 	typedef tvec2<sint8> i8vec2;
Index: /trunk/src/formats/md5_loader.cc
===================================================================
--- /trunk/src/formats/md5_loader.cc	(revision 397)
+++ /trunk/src/formats/md5_loader.cc	(revision 398)
@@ -31,5 +31,5 @@
 }
 
-static void unit_quat_w( glm::quat& quat )
+static void unit_quat_w( nv::quat& quat )
 {
 	float t = 1.0f - ( quat.x * quat.x ) - ( quat.y * quat.y ) - ( quat.z * quat.z );
@@ -343,7 +343,7 @@
 		md5_vtx_pnt& vtc = vtcs[i];
 
-		vtc.position = glm::vec3(0);
-		vtc.normal   = glm::vec3(0);
-		vtc.tangent  = glm::vec3(0);
+		vtc.position = vec3(0);
+		vtc.normal   = vec3(0);
+		vtc.tangent  = vec3(0);
 
 		stable_sort( weights + start_weight, weights + start_weight + weight_count, [] ( const md5_weight& a, const md5_weight& b ) -> bool { return a.bias > b.bias; } );
@@ -386,5 +386,5 @@
 				const mesh_node_data&  joint = nodes[weight.joint_id];
 				const transform tr = transform( joint.transform ).inverse();
-				glm::vec3 rot_pos = tr.get_orientation() * weight.pos;
+				vec3 rot_pos = tr.get_orientation() * weight.pos;
 
 				vtc.position += ( tr.get_position() + rot_pos ) * weight.bias;
@@ -404,11 +404,11 @@
 		uint32 ti2 = idata[ i * 3 + 2 ];
  
-		glm::vec3 v1 = vtcs[ ti0 ].position;
-		glm::vec3 v2 = vtcs[ ti1 ].position;
-		glm::vec3 v3 = vtcs[ ti2 ].position;
-		glm::vec3 xyz1 = v3 - v1;
-		glm::vec3 xyz2 = v2 - v1;
-
-		glm::vec3 normal = glm::cross( xyz1, xyz2 );
+		vec3 v1 = vtcs[ ti0 ].position;
+		vec3 v2 = vtcs[ ti1 ].position;
+		vec3 v3 = vtcs[ ti2 ].position;
+		vec3 xyz1 = v3 - v1;
+		vec3 xyz2 = v2 - v1;
+
+		vec3 normal = glm::cross( xyz1, xyz2 );
 
 		vtcs[ ti0 ].normal += normal;
@@ -436,12 +436,12 @@
 		md5_vtx_pntiw& vdata = vtx_data[i];
 
-		glm::vec3 normal  = glm::normalize( vtcs[i].normal );
-		glm::vec3 tangent = glm::normalize( vtcs[i].tangent );
+		vec3 normal  = glm::normalize( vtcs[i].normal );
+		vec3 tangent = glm::normalize( vtcs[i].tangent );
 		vtcs[i].normal   = normal;
 		vtcs[i].tangent  = tangent;
 
 		vdata.position = vtcs[i].position;
-		vdata.normal   = glm::vec3(0);
- 		vdata.tangent  = glm::vec3(0);
+		vdata.normal   = vec3(0);
+ 		vdata.tangent  = vec3(0);
  
  		for ( size_t j = 0; j < 4; ++j )
@@ -484,5 +484,5 @@
 			transform ptr;
 			if ( pjoint.data->get_channel(0)->count > index ) ptr = ptv[ index ];
-			glm::vec3 rot_pos = ptr.get_orientation() * pos;
+			vec3 rot_pos = ptr.get_orientation() * pos;
 
 			pos    = ptr.get_position() + rot_pos;
Index: /trunk/src/gfx/image.cc
===================================================================
--- /trunk/src/gfx/image.cc	(revision 397)
+++ /trunk/src/gfx/image.cc	(revision 398)
@@ -10,5 +10,5 @@
 using namespace nv;
 
-image::image( glm::ivec2 size, nv::size_t depth )
+image::image( ivec2 size, nv::size_t depth )
 	: m_size( size ), m_depth( depth ), m_data( nullptr )
 {
@@ -23,5 +23,5 @@
 
 
-image::image( glm::ivec2 size, nv::size_t depth, const uint8 * data, bool reversed )
+image::image( ivec2 size, nv::size_t depth, const uint8 * data, bool reversed )
 	: m_size( size ), m_depth( depth ), m_data( nullptr )
 {
Index: /trunk/src/gfx/mesh_creator.cc
===================================================================
--- /trunk/src/gfx/mesh_creator.cc	(revision 397)
+++ /trunk/src/gfx/mesh_creator.cc	(revision 398)
@@ -21,5 +21,5 @@
 		size_t count     = ( keys ? keys->get_channel(0)->count : 0 );
 		size_t pcount    = ( pkeys ? pkeys->get_channel(0)->count : 0 );
-		max_frames = glm::max<uint32>( count, max_frames );
+		max_frames = nv::max<uint32>( count, max_frames );
 		if ( pkeys && pkeys->get_channel_count() > 0 && keys && keys->get_channel_count() > 0 )
 		{
@@ -28,5 +28,5 @@
 			for ( unsigned n = 0; n < count; ++n )
 			{
-				channel[n].tform = pchannel[ glm::min( n, pcount-1 ) ].tform * channel[n].tform;
+				channel[n].tform = pchannel[ nv::min( n, pcount-1 ) ].tform * channel[n].tform;
 			}
 		}
@@ -63,5 +63,5 @@
 			for ( size_t c = 0; c < chan_count; ++c )
 			{
-				max_keys = glm::max( max_keys, old_keys->get_channel(c)->count );
+				max_keys = nv::max( max_keys, old_keys->get_channel(c)->count );
 			}
 
@@ -79,5 +79,5 @@
 				for ( uint16 c = 0; c < chan_count; ++c )
 				{
-					size_t idx = glm::min( old_keys->get_channel(c)->count - 1, n );
+					size_t idx = nv::min( old_keys->get_channel(c)->count - 1, n );
 					pkey += old_keys->get_channel(c)->get_raw( idx, pkey );
 				}
@@ -119,5 +119,5 @@
 void nv::mesh_data_creator::transform( float scale, const mat3& r33 )
 {
-	vec3 vertex_offset     = glm::vec3(); 
+	vec3 vertex_offset     = vec3(); 
 	mat3 vertex_transform  = scale * r33;
 	mat3 normal_transform  = r33;
@@ -297,5 +297,5 @@
 			vec3 xyz2 = v2 - v1;
 
-			//glm::vec3 normal = glm::cross( xyz1, xyz2 );
+			//vec3 normal = glm::cross( xyz1, xyz2 );
 			//
 			//vtcs[ ti0 ].normal += normal;
Index: /trunk/src/gfx/texture_atlas.cc
===================================================================
--- /trunk/src/gfx/texture_atlas.cc	(revision 397)
+++ /trunk/src/gfx/texture_atlas.cc	(revision 398)
@@ -11,14 +11,14 @@
 using namespace nv;
 
-texture_atlas::texture_atlas( glm::ivec2 size, nv::size_t depth, nv::size_t border /*= 1*/ )
+texture_atlas::texture_atlas( ivec2 size, nv::size_t depth, nv::size_t border /*= 1*/ )
 	: image( size, depth ), m_used( 0 ), m_border( border )
 {
-	m_nodes.push_back( glm::ivec3( m_border, m_border, m_size.x - 2 * static_cast<int>( m_border ) ) );
+	m_nodes.push_back( ivec3( m_border, m_border, m_size.x - 2 * static_cast<int>( m_border ) ) );
 	fill( 0 );
 }
 
-region texture_atlas::get_region( glm::ivec2 size )
+region texture_atlas::get_region( ivec2 size )
 {
-	region r ( glm::ivec2(0,0), size );
+	region r ( ivec2(0,0), size );
 
 	int best_height = INT_MAX;
@@ -31,5 +31,5 @@
 		if ( y >= 0 )
 		{
-			glm::ivec3 node = m_nodes[ i ];
+			ivec3 node = m_nodes[ i ];
 			if ( ( (y + size.y) < best_height ) ||
 				( ((y + size.y) == best_height) && (node.z < best_width)) )
@@ -46,13 +46,13 @@
 	if ( best_index == -1 )
 	{
-		return region( glm::ivec2( -1, -1 ), glm::ivec2( 0, 0 ) );
+		return region( ivec2( -1, -1 ), ivec2( 0, 0 ) );
 	}
 
-	m_nodes.insert( m_nodes.begin() + best_index, glm::ivec3( r.pos.x, r.pos.y + size.y, size.x ) );
+	m_nodes.insert( m_nodes.begin() + best_index, ivec3( r.pos.x, r.pos.y + size.y, size.x ) );
 
 	for( size_t i = static_cast<size_t>( best_index )+1; i < m_nodes.size(); ++i )
 	{
-		glm::ivec3 node = m_nodes[ i ];
-		glm::ivec3 prev = m_nodes[ i-1 ];
+		ivec3 node = m_nodes[ i ];
+		ivec3 prev = m_nodes[ i-1 ];
 
 		if ( node.x < prev.x + prev.z )
@@ -82,7 +82,7 @@
 }
 
-int texture_atlas::fit( nv::size_t index, glm::ivec2 size )
+int texture_atlas::fit( nv::size_t index, ivec2 size )
 {
-	glm::ivec3 node = m_nodes[ index ];
+	ivec3 node = m_nodes[ index ];
 
 	if ( node.x + size.x > m_size.x - static_cast<int>( m_border ) ) 
@@ -128,5 +128,5 @@
 	m_nodes.clear();
 	m_used = 0;
-	m_nodes.push_back( glm::ivec3( 1, 1, m_size.x - 2 ) );
+	m_nodes.push_back( ivec3( 1, 1, m_size.x - 2 ) );
 	fill( 0 );
 }
Index: /trunk/src/gfx/texture_font.cc
===================================================================
--- /trunk/src/gfx/texture_font.cc	(revision 397)
+++ /trunk/src/gfx/texture_font.cc	(revision 398)
@@ -94,7 +94,7 @@
 bool texture_font::load_glyphs( string_ref codes )
 {
-	FT_Face face     = (FT_Face)(m_rface);
-	size_t depth     = m_atlas->get_depth();
-	glm::ivec2 asize = m_atlas->get_size();
+	FT_Face face = (FT_Face)(m_rface);
+	size_t depth = m_atlas->get_depth();
+	ivec2 asize  = m_atlas->get_size();
 	FT_Int32 flags = 0; 
 	flags |= FT_LOAD_RENDER; 
@@ -137,5 +137,5 @@
 		int reg_width       = ft_bitmap_width / (depth > 3 ? 3 : (int)depth);
 
-		glm::ivec2 gsize( reg_width + 1, ft_bitmap_rows + 1 ); 
+		ivec2 gsize( reg_width + 1, ft_bitmap_rows + 1 ); 
 		region r = m_atlas->get_region( gsize );
 		if ( r.pos.x < 0 ) 
@@ -164,12 +164,12 @@
 		g->charcode = c;
 		g->size     = gsize;
-		g->offset   = glm::ivec2( ft_glyph_left, ft_glyph_top );
-		g->tl       = glm::vec2( r.pos.x/(float)asize.x, r.pos.y/(float)asize.y );
-		g->br       = glm::vec2( ( r.pos.x + gsize.x )/(float)asize.x, (r.pos.y + gsize.y )/(float)asize.y );
+		g->offset   = ivec2( ft_glyph_left, ft_glyph_top );
+		g->tl       = vec2( r.pos.x/(float)asize.x, r.pos.y/(float)asize.y );
+		g->br       = vec2( ( r.pos.x + gsize.x )/(float)asize.x, (r.pos.y + gsize.y )/(float)asize.y );
 
 		// Discard hinting to get advance
 		FT_Load_Glyph( face, glyph_index, FT_LOAD_RENDER | FT_LOAD_NO_HINTING);
 		slot = face->glyph;
-		g->advance = glm::ivec2( slot->advance.x/64.0, slot->advance.y/64.0 );
+		g->advance = ivec2( slot->advance.x/64.0, slot->advance.y/64.0 );
 	}
 	generate_kerning();
Index: /trunk/src/gl/gl_context.cc
===================================================================
--- /trunk/src/gl/gl_context.cc	(revision 397)
+++ /trunk/src/gl/gl_context.cc	(revision 398)
@@ -731,5 +731,5 @@
 	}
 	unsigned int buffers[8];
-	count = glm::min<uint32>( count, 8 );
+	count = nv::min<uint32>( count, 8 );
 	for ( uint32 i = 0; i < count; ++i )
 	{
Index: /trunk/src/gl/gl_device.cc
===================================================================
--- /trunk/src/gl/gl_device.cc	(revision 397)
+++ /trunk/src/gl/gl_device.cc	(revision 398)
@@ -53,5 +53,5 @@
 	assert( image->format->BytesPerPixel > 2 );
 	image_format format(image->format->BytesPerPixel == 3 ? RGB : RGBA, UBYTE );
-	image_data* data = new image_data( format, glm::ivec2( image->w, image->h ), (nv::uint8*)image->pixels );
+	image_data* data = new image_data( format, ivec2( image->w, image->h ), (nv::uint8*)image->pixels );
 	return data;
 }
@@ -71,5 +71,5 @@
 	assert( image->format->BytesPerPixel > 2 );
 	image_format format( image->format->BytesPerPixel == 3 ? RGB : RGBA, UBYTE );
-	image_data* idata = new image_data( format, glm::ivec2( image->w, image->h ), ( nv::uint8* )image->pixels );
+	image_data* idata = new image_data( format, ivec2( image->w, image->h ), ( nv::uint8* )image->pixels );
 	return idata;
 }
Index: /trunk/src/rogue/fov_recursive_shadowcasting.cc
===================================================================
--- /trunk/src/rogue/fov_recursive_shadowcasting.cc	(revision 397)
+++ /trunk/src/rogue/fov_recursive_shadowcasting.cc	(revision 398)
@@ -24,7 +24,6 @@
 	{
 		position max_radius = m_size-m_position;
-		max_radius.x=glm::max(max_radius.x,m_position.x);
-		max_radius.y=glm::max(max_radius.y,m_position.y);
-		m_radius = (int)glm::length((glm::vec2)max_radius)+1;
+		max_radius = glm::max(max_radius,m_position);
+		m_radius = (int)glm::length((vec2)max_radius)+1;
 	}
 	m_radius2 = m_radius * m_radius;
