Index: /trunk/nv/base/capi.hh
===================================================================
--- /trunk/nv/base/capi.hh	(revision 396)
+++ /trunk/nv/base/capi.hh	(revision 397)
@@ -31,4 +31,7 @@
 			NV_NOALIAS NV_RESTRICT void * __cdecl malloc( size_t );
 			NV_NOALIAS NV_RESTRICT void * __cdecl realloc( void * _Memory, size_t _NewSize );
+			NV_NOALIAS NV_RESTRICT void * __cdecl _aligned_malloc( size_t _Size, size_t _Alignment );
+			NV_NOALIAS             void   __cdecl _aligned_free( void* _Block );
+//			NV_NOALIAS NV_RESTRICT void * __cdecl _aligned_realloc( void*  _Block, size_t _Size, size_t _Alignment );
 			void *  __cdecl memcpy( void * _Dst, const void * _Src, size_t _Size );
 			void *  __cdecl memmove( void * _Dst, const void * _Src, size_t _Size );
@@ -49,4 +52,5 @@
 			extern void * __cdecl malloc( nv::size_t );
 			extern void * __cdecl realloc( void * , nv::size_t );
+			extern void * __cdecl aligned_alloc( nv::size_t, nv::size_t );
 			extern void * __cdecl memcpy( void * , const void * , nv::size_t );
 			extern void * __cdecl memmove( void * , const void * , nv::size_t );
@@ -75,4 +79,22 @@
 		if ( p ) NV_CAPI_CALL( free )( p );
 	}
+
+	inline void* nvaligned_malloc( size_t size, size_t alignment )
+	{
+#if NV_COMPILER == NV_MSVC
+		return NV_CAPI_CALL( _aligned_malloc )( size, alignment );
+#else
+		return NV_CAPI_CALL( aligned_alloc )( size, alignment );
+#endif
+	}
+	inline void nvaligned_free( void* p )
+	{
+#if NV_COMPILER == NV_MSVC
+		if ( p ) NV_CAPI_CALL( _aligned_free )( p );
+#else
+		if ( p ) NV_CAPI_CALL( free )( p );
+#endif
+	}
+
 
 	inline void* nvmemcpy( void *dest, const void *src, size_t count )
Index: /trunk/nv/base/common.hh
===================================================================
--- /trunk/nv/base/common.hh	(revision 396)
+++ /trunk/nv/base/common.hh	(revision 397)
@@ -174,4 +174,20 @@
 #define NV_TEMPLATE_FAIL(T,message) static_assert( NV_TYPE_FAIL(T), message );
 
+#ifdef min
+#undef min
+#endif
+#ifdef max
+#undef max
+#endif
+#ifdef isnan
+#undef isnan
+#endif
+#ifdef isinf
+#undef isinf
+#endif
+#ifdef log2
+#undef log2
+#endif
+
 namespace nv
 {
Index: /trunk/nv/core/random.hh
===================================================================
--- /trunk/nv/core/random.hh	(revision 396)
+++ /trunk/nv/core/random.hh	(revision 397)
@@ -35,7 +35,7 @@
 
 		template < typename T >
-		glm::detail::tvec2<T> range( glm::detail::tvec2<T> min, glm::detail::tvec2<T> max )
+		tvec2<T> range( tvec2<T> min, tvec2<T> max )
 		{
-			return glm::detail::tvec2<T>( 
+			return tvec2<T>( 
 				range_impl( min.x, max.x, is_floating_point<T>() ), 
 				range_impl( min.y, max.y, is_floating_point<T>() )
@@ -44,7 +44,7 @@
 
 		template < typename T >
-		glm::detail::tvec3<T> range( glm::detail::tvec3<T> min, glm::detail::tvec3<T> max )
+		tvec3<T> range( tvec3<T> min, tvec3<T> max )
 		{
-			return glm::detail::tvec3<T>( 
+			return tvec3<T>( 
 				range_impl( min.x, max.x, is_floating_point<T>() ), 
 				range_impl( min.y, max.y, is_floating_point<T>() ),
@@ -54,7 +54,7 @@
 
 		template < typename T >
-		glm::detail::tvec4<T> range( glm::detail::tvec4<T> min, glm::detail::tvec4<T> max )
+		tvec4<T> range( tvec4<T> min, tvec4<T> max )
 		{
-			return glm::detail::tvec4<T>( 
+			return tvec4<T>( 
 				range_impl( min.x, max.x, is_floating_point<T>() ), 
 				range_impl( min.y, max.y, is_floating_point<T>() ),
Index: /trunk/nv/core/transform.hh
===================================================================
--- /trunk/nv/core/transform.hh	(revision 396)
+++ /trunk/nv/core/transform.hh	(revision 397)
@@ -25,8 +25,8 @@
 		void set_position( const vec3& a_position ) { m_position = a_position; }
 		void set_orientation( const quat& a_orientation ) { m_orientation = a_orientation; }
-		void set_orientation( const vec3& axis, float angle )
-		{
-			m_orientation = glm::angleAxis( angle, axis );
-		}
+ 		void set_orientation( float radians, const vec3& axis )
+ 		{ // use glm::radians if degrees!
+ 			m_orientation = glm::angleAxis( radians, axis );
+ 		}
 
 		const vec3& get_position() const { return m_position; }
@@ -42,9 +42,9 @@
 			m_position += absolute;
 		}
-		void rotate( const vec3& axis, f32 angle )
-		{
-			quat temp( angle, axis );
-			m_orientation = temp * m_orientation;
-		}
+// 		void rotate( const vec3& axis, f32 angle )
+// 		{ // use glm::radians if degrees!
+// 			quat temp( angle, axis );
+// 			m_orientation = temp * m_orientation;
+// 		}
 		void set( const mat4& from )
 		{
Index: /trunk/nv/interface/camera.hh
===================================================================
--- /trunk/nv/interface/camera.hh	(revision 396)
+++ /trunk/nv/interface/camera.hh	(revision 397)
@@ -33,5 +33,5 @@
 		void set_perspective( f32 fov, f32 aspect, f32 near, f32 far )
 		{
-			m_projection = glm::perspective( fov, aspect, near, far );
+			m_projection = glm::perspective( glm::radians( fov ), aspect, near, far );
 		}
 		void set_ortho( f32 left, f32 right, f32 bottom, f32 top, f32 near = -1.0f, f32 far = 1.0f )
Index: /trunk/nv/lua/lua_glm.hh
===================================================================
--- /trunk/nv/lua/lua_glm.hh	(revision 396)
+++ /trunk/nv/lua/lua_glm.hh	(revision 397)
@@ -60,7 +60,7 @@
 
 		template< typename T >
-		struct pass_traits< glm::detail::tvec2<T> >
+		struct pass_traits< tvec2<T> >
 		{
-			typedef glm::detail::tvec2<T> value_type;
+			typedef tvec2<T> value_type;
 			static void push( lua_State *L, const value_type& p ) { detail::push_vec< value_type >( L, p ); }
 			static value_type to( lua_State *L, int index ) { return detail::to_vec< value_type >( L, index ); }
@@ -69,7 +69,7 @@
 
 		template< typename T >
-		struct pass_traits< glm::detail::tvec3<T> >
+		struct pass_traits< tvec3<T> >
 		{
-			typedef glm::detail::tvec3<T> value_type;
+			typedef tvec3<T> value_type;
 			static void push( lua_State *L, const value_type& p ) { detail::push_vec< value_type >( L, p ); }
 			static value_type to( lua_State *L, int index ) { return detail::to_vec< value_type >( L, index ); }
@@ -78,7 +78,7 @@
 
 		template< typename T >
-		struct pass_traits< glm::detail::tvec4<T> >
+		struct pass_traits< tvec4<T> >
 		{
-			typedef glm::detail::tvec4<T> value_type;
+			typedef tvec4<T> value_type;
 			static void push( lua_State *L, const value_type& p ) { detail::push_vec< value_type >( L, p ); }
 			static value_type to( lua_State *L, int index ) { return detail::to_vec< value_type >( L, index ); }
Index: /trunk/nv/stl/math.hh
===================================================================
--- /trunk/nv/stl/math.hh	(revision 396)
+++ /trunk/nv/stl/math.hh	(revision 397)
@@ -4,4 +4,6 @@
 // This file is part of Nova libraries. 
 // For conditions of distribution and use, see copying.txt file in root folder.
+//
+// TODO: https://github.com/cinder/Cinder/commit/56fd3996be207ccca8063bc81648e199930c909d
 
 #ifndef NV_STL_MATH_HH
@@ -18,36 +20,51 @@
 #include <glm/glm.hpp>
 #include <glm/gtc/matrix_transform.hpp>
-#include <glm/gtc/matrix_access.hpp>
 #include <glm/gtc/type_ptr.hpp>
 #include <glm/gtc/quaternion.hpp>
-#include <glm/gtx/rotate_vector.hpp>
 #include <glm/gtx/vector_angle.hpp>
 
 namespace nv
 {
-
-	typedef glm::detail::tvec2<sint8> i8vec2;
-	typedef glm::detail::tvec3<sint8> i8vec3;
-	typedef glm::detail::tvec4<sint8> i8vec4;
-
-	typedef glm::detail::tvec2<sint16> i16vec2;
-	typedef glm::detail::tvec3<sint16> i16vec3;
-	typedef glm::detail::tvec4<sint16> i16vec4;
-
-	typedef glm::detail::tvec2<uint8> u8vec2;
-	typedef glm::detail::tvec3<uint8> u8vec3;
-	typedef glm::detail::tvec4<uint8> u8vec4;
-
-	typedef glm::vec2 vec2;
-	typedef glm::vec3 vec3;
-	typedef glm::vec4 vec4;
-
-	typedef glm::ivec2 ivec2;
-	typedef glm::ivec3 ivec3;
-	typedef glm::ivec4 ivec4;
-
-	typedef glm::mat2 mat2;
-	typedef glm::mat3 mat3;
-	typedef glm::mat4 mat4;
+#if 0
+	template < typename T > using tvec2 = ::glm::detail::tvec2<T, glm::precision::highp>;
+	template < typename T > using tvec3 = ::glm::detail::tvec3<T, glm::precision::highp>;
+	template < typename T > using tvec4 = ::glm::detail::tvec4<T, glm::precision::highp>;
+	template < typename T > using tmat2 = ::glm::detail::tmat2x2<T, glm::precision::highp>;
+	template < typename T > using tmat3 = ::glm::detail::tmat3x3<T, glm::precision::highp>;
+	template < typename T > using tmat4 = ::glm::detail::tmat4x4<T, glm::precision::highp>;
+	template < typename T > using tquat = ::glm::detail::tmat4x4<T, glm::precision::highp>;
+#else
+	template < typename T > using tvec2 = ::glm::tvec2<T>;
+	template < typename T > using tvec3 = ::glm::tvec3<T>;
+	template < typename T > using tvec4 = ::glm::tvec4<T>;
+	template < typename T > using tmat2 = ::glm::tmat2x2<T>;
+	template < typename T > using tmat3 = ::glm::tmat3x3<T>;
+	template < typename T > using tmat4 = ::glm::tmat4x4<T>;
+	template < typename T > using tquat = ::glm::tmat4x4<T>;
+#endif
+
+	typedef tvec2<sint8> i8vec2;
+	typedef tvec3<sint8> i8vec3;
+	typedef tvec4<sint8> i8vec4;
+
+	typedef tvec2<sint16> i16vec2;
+	typedef tvec3<sint16> i16vec3;
+	typedef tvec4<sint16> i16vec4;
+
+	typedef tvec2<uint8> u8vec2;
+	typedef tvec3<uint8> u8vec3;
+	typedef tvec4<uint8> u8vec4;
+
+	typedef tvec2< float > vec2;
+	typedef tvec3< float > vec3;
+	typedef tvec4< float > vec4;
+
+	typedef tvec2< int > ivec2;
+	typedef tvec3< int > ivec3;
+	typedef tvec4< int > ivec4;
+
+	typedef tmat2< float > mat2;
+	typedef tmat3< float > mat3;
+	typedef tmat4< float > mat4;
 
 	typedef glm::quat quat;
@@ -62,7 +79,7 @@
 
 	template <typename T> 
-	struct datatype_traits< glm::detail::tvec2<T> > 
-	{
-		typedef glm::detail::tvec2<T> type;
+	struct datatype_traits< tvec2<T> > 
+	{
+		typedef tvec2<T> type;
 		typedef typename type::value_type base_type;
 		static const size_t size = 2;
@@ -70,7 +87,7 @@
 
 	template <typename T> 
-	struct datatype_traits< glm::detail::tvec3<T> > 
-	{
-		typedef glm::detail::tvec3<T> type;
+	struct datatype_traits< tvec3<T> > 
+	{
+		typedef tvec3<T> type;
 		typedef typename type::value_type base_type;
 		static const size_t size = 3;
@@ -78,7 +95,7 @@
 
 	template <typename T> 
-	struct datatype_traits< glm::detail::tvec4<T> > 
-	{
-		typedef glm::detail::tvec4<T> type;
+	struct datatype_traits< tvec4<T> > 
+	{
+		typedef tvec4<T> type;
 		typedef typename type::value_type base_type;
 		static const size_t size = 4;
@@ -255,10 +272,10 @@
 
 	template <typename T>
-	glm::detail::tvec3<T> normalize_safe( 
-		const glm::detail::tvec3<T>& x, 
-		const glm::detail::tvec3<T>& def = vec3()
+	tvec3<T> normalize_safe( 
+		const tvec3<T>& x, 
+		const tvec3<T>& def = vec3()
 	)
 	{
-		typename glm::detail::tvec3<T>::value_type sqr = x.x * x.x + x.y * x.y + x.z * x.z;
+		typename tvec3<T>::value_type sqr = x.x * x.x + x.y * x.y + x.z * x.z;
 		return ( sqr > 0 ? x * glm::inversesqrt(sqr) : def );
 	}
Index: /trunk/nv/stl/range.hh
===================================================================
--- /trunk/nv/stl/range.hh	(revision 396)
+++ /trunk/nv/stl/range.hh	(revision 397)
@@ -66,11 +66,11 @@
 		template < typename T >
 		class range2d_iterator_base 
-			: public forward_iterator_base< glm::detail::tvec2<T> >
-		{
-		public:
-			typedef forward_iterator_base< glm::detail::tvec2<T> > base_class;
-
-			range2d_iterator_base( glm::detail::tvec2<T> value, T min, T max ) 
-				: forward_iterator_base< glm::detail::tvec2<T> >( value ), m_min(min), m_max(max) {}
+			: public forward_iterator_base< tvec2<T> >
+		{
+		public:
+			typedef forward_iterator_base< tvec2<T> > base_class;
+
+			range2d_iterator_base( tvec2<T> value, T min, T max ) 
+				: forward_iterator_base< tvec2<T> >( value ), m_min(min), m_max(max) {}
 			range2d_iterator_base& operator++ () 
 			{
Index: /trunk/nv/stl/rtti_types.hh
===================================================================
--- /trunk/nv/stl/rtti_types.hh	(revision 396)
+++ /trunk/nv/stl/rtti_types.hh	(revision 397)
@@ -16,5 +16,4 @@
 #include <nv/common.hh>
 #include <nv/stl/math.hh>
-#include <nv/stl/rtti_support.hh>
 
 NV_RTTI_DECLARE( void )
Index: /trunk/src/lua/lua_glm.cc
===================================================================
--- /trunk/src/lua/lua_glm.cc	(revision 396)
+++ /trunk/src/lua/lua_glm.cc	(revision 397)
@@ -56,5 +56,5 @@
 	static inline T unit() { return T( 1, 1, 1 ); }
 	static inline T construct( lua_State* L, int index ) {
-		typedef glm::detail::tvec2<typename T::value_type> vec2;
+		typedef nv::tvec2<typename T::value_type> vec2;
 		if ( lua_type( L, index ) == LUA_TUSERDATA )
 		{
@@ -77,6 +77,6 @@
 	static inline T unit() { return T( 1, 1, 1, 1 ); }
 	static inline T construct( lua_State* L, int index ) {
-		typedef glm::detail::tvec2<typename T::value_type> vec2;
-		typedef glm::detail::tvec3<typename T::value_type> vec3;
+		typedef nv::tvec2<typename T::value_type> vec2;
+		typedef nv::tvec3<typename T::value_type> vec3;
 		if ( lua_type( L, index ) == LUA_TUSERDATA )
 		{
@@ -214,5 +214,5 @@
 {
 	T v = to_vec<T>( L, 1 );
-	for ( size_t i = 0; i < v.length(); ++i )
+	for ( int i = 0; i < v.length(); ++i )
 	{
 		lua_pushnumber( L, v[i] );
@@ -242,7 +242,7 @@
 	{
 		switch (len) {
-		case 2 : push_vec( L, glm::detail::tvec2<typename T::value_type>( (*v)[nlua_swizzel_lookup[key[0]]], (*v)[nlua_swizzel_lookup[key[1]]] ) ); return 1;
-		case 3 : push_vec( L, glm::detail::tvec3<typename T::value_type>( (*v)[nlua_swizzel_lookup[key[0]]], (*v)[nlua_swizzel_lookup[key[1]]], (*v)[nlua_swizzel_lookup[key[2]]] ) ); return 1;
-		case 4 : push_vec( L, glm::detail::tvec4<typename T::value_type>( (*v)[nlua_swizzel_lookup[key[0]]], (*v)[nlua_swizzel_lookup[key[1]]], (*v)[nlua_swizzel_lookup[key[2]]], (*v)[nlua_swizzel_lookup[key[3]]] ) ); return 1;
+		case 2 : push_vec( L, nv::tvec2<typename T::value_type>( (*v)[nlua_swizzel_lookup[key[0]]], (*v)[nlua_swizzel_lookup[key[1]]] ) ); return 1;
+		case 3 : push_vec( L, nv::tvec3<typename T::value_type>( (*v)[nlua_swizzel_lookup[key[0]]], (*v)[nlua_swizzel_lookup[key[1]]], (*v)[nlua_swizzel_lookup[key[2]]] ) ); return 1;
+		case 4 : push_vec( L, nv::tvec4<typename T::value_type>( (*v)[nlua_swizzel_lookup[key[0]]], (*v)[nlua_swizzel_lookup[key[1]]], (*v)[nlua_swizzel_lookup[key[2]]], (*v)[nlua_swizzel_lookup[key[3]]] ) ); return 1;
 		default: break;
 		}
@@ -258,7 +258,7 @@
 int nlua_vec_newindex( lua_State* L )
 {
-	typedef glm::detail::tvec2<typename T::value_type> vec2;
-	typedef glm::detail::tvec3<typename T::value_type> vec3;
-	typedef glm::detail::tvec4<typename T::value_type> vec4;
+	typedef nv::tvec2<typename T::value_type> vec2;
+	typedef nv::tvec3<typename T::value_type> vec3;
+	typedef nv::tvec4<typename T::value_type> vec4;
 
 	T* v = to_pvec<T>( L, 1 );
Index: /trunk/src/sdl/sdl_audio.cc
===================================================================
--- /trunk/src/sdl/sdl_audio.cc	(revision 396)
+++ /trunk/src/sdl/sdl_audio.cc	(revision 397)
@@ -75,5 +75,5 @@
 			if ( relative != vec3() )
 			{
-				angle = -glm::orientedAngle( m_forward, glm::normalize( relative ), m_up );
+				angle = glm::degrees( -glm::orientedAngle( m_forward, glm::normalize( relative ), m_up ) );
 				distance = glm::clamp( 20.0f * glm::length( relative ), 0.0f, 255.0f );
 			}
