Ignore:
Timestamp:
07/31/15 20:25:22 (10 years ago)
Author:
epyon
Message:
  • math library work
  • glm only referenced in math/common.hh
  • still a lot work to do, but its WURF
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/nv/core/transform.hh

    r398 r454  
    2626                void set_orientation( const quat& a_orientation ) { m_orientation = a_orientation; }
    2727                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 );
    3030                }
    3131
     
    3636                void move( const vec3& heading, float distance )
    3737                {
    38                         m_position += glm::normalize( heading ) * distance;
     38                        m_position += math::normalize( heading ) * distance;
    3939                }
    4040                void translate( const vec3& absolute )
     
    4242                        m_position += absolute;
    4343                }
    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                }
    4949                void set( const mat4& from )
    5050                {
     
    5454                mat4 extract() const
    5555                {
    56                         mat4 result = mat4_cast( m_orientation );
     56                        mat4 result = math::mat4_cast( m_orientation );
    5757                        result[3] = vec4( m_position, 1.0f );
    5858                        return result;
     
    6060                transform inverse() const
    6161                {
    62                         quat new_orient( glm::inverse( m_orientation ) );
     62                        quat new_orient( math::inverse( m_orientation ) );
    6363                        // TODO: simplify
    64                         return transform( -mat3_cast(new_orient) * m_position, new_orient );
     64                        return transform( -math::mat3_cast(new_orient) * m_position, new_orient );
    6565                }
    6666
     
    9999        {
    100100                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 )
    103103                );
    104104        }
Note: See TracChangeset for help on using the changeset viewer.