Changeset 454 for trunk/nv/core/transform.hh
- Timestamp:
- 07/31/15 20:25:22 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/nv/core/transform.hh
r398 r454 26 26 void set_orientation( const quat& a_orientation ) { m_orientation = a_orientation; } 27 27 void set_orientation( float radians, const vec3& axis ) 28 { // use math::radians if degrees!29 m_orientation = glm::angleAxis( radians, axis );28 { 29 m_orientation = math::angle_axis( radians, axis ); 30 30 } 31 31 … … 36 36 void move( const vec3& heading, float distance ) 37 37 { 38 m_position += glm::normalize( heading ) * distance;38 m_position += math::normalize( heading ) * distance; 39 39 } 40 40 void translate( const vec3& absolute ) … … 42 42 m_position += absolute; 43 43 } 44 //void rotate( const vec3& axis, f32 angle )45 // { // use math::radians if degrees! 46 //quat temp( angle, axis );47 //m_orientation = temp * m_orientation;48 //}44 void rotate( const vec3& axis, f32 angle ) 45 { 46 quat temp( angle, axis ); 47 m_orientation = temp * m_orientation; 48 } 49 49 void set( const mat4& from ) 50 50 { … … 54 54 mat4 extract() const 55 55 { 56 mat4 result = mat 4_cast( m_orientation );56 mat4 result = math::mat4_cast( m_orientation ); 57 57 result[3] = vec4( m_position, 1.0f ); 58 58 return result; … … 60 60 transform inverse() const 61 61 { 62 quat new_orient( glm::inverse( m_orientation ) );62 quat new_orient( math::inverse( m_orientation ) ); 63 63 // TODO: simplify 64 return transform( -mat 3_cast(new_orient) * m_position, new_orient );64 return transform( -math::mat3_cast(new_orient) * m_position, new_orient ); 65 65 } 66 66 … … 99 99 { 100 100 return transform( 101 glm::mix ( a.get_position(), b.get_position(), value ),102 glm::slerp( a.get_orientation(), b.get_orientation(), value )101 math::mix ( a.get_position(), b.get_position(), value ), 102 math::slerp( a.get_orientation(), b.get_orientation(), value ) 103 103 ); 104 104 }
Note: See TracChangeset
for help on using the changeset viewer.